From: Ludovic Courtès Date: Wed, 10 Oct 2007 16:46:26 +0000 (+0000) Subject: Changes from arch/CVS synchronization X-Git-Url: https://git.hcoop.net/bpt/guile.git/commitdiff_plain/663026180234a3ab0a808fdae89a4da85e4e64de?hp=1445e4492fd0a6a19f39625d3bfe2f78c33fda9a Changes from arch/CVS synchronization --- diff --git a/ChangeLog b/ChangeLog index 18f16fd7b..006b6ddda 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2007-10-10 Ludovic Courtès + + * configure.in (SCM_I_GSC_NEED_BRACES_ON_PTHREAD_ONCE_INIT): + New substituted variable. + Use `-Werror' when using GCC and checking for + `PTHREAD_ONCE_INIT'. Add check for braces around + `PTHREAD_MUTEX_INITIALIZER'. + * NEWS: Mention build fix for IRIX. + 2007-10-02 Ludovic Courtès * NEWS: Mention `(ice-9 slib)' fix and threading fix. diff --git a/NEWS b/NEWS index e4fbb145b..70d6fe699 100644 --- a/NEWS +++ b/NEWS @@ -47,7 +47,7 @@ Changes in 1.8.3 (since 1.8.2) ** A memory leak in `make-socket-address' was fixed ** Alignment issues (e.g., on SPARC) in network routines were fixed ** A threading issue that showed up at least on NetBSD was fixed -** Build problems on Solaris fixed +** Build problems on Solaris and IRIX fixed * Implementation improvements diff --git a/configure.in b/configure.in index 2cf481336..7d639270a 100644 --- a/configure.in +++ b/configure.in @@ -1090,6 +1090,7 @@ AC_ARG_WITH(threads, [ --with-threads thread interface], , with_threads=yes) AC_SUBST(SCM_I_GSC_NEED_BRACES_ON_PTHREAD_ONCE_INIT, 0) +AC_SUBST(SCM_I_GSC_NEED_BRACES_ON_PTHREAD_MUTEX_INITIALIZER, 0) case "$with_threads" in "yes" | "pthread" | "pthreads" | "pthread-threads" | "") @@ -1113,23 +1114,42 @@ case "$with_threads" in # On past versions of Solaris, believe 8 through 10 at least, you # had to write "pthread_once_t foo = { PTHREAD_ONCE_INIT };". - # This is contrary to posix: + # This is contrary to POSIX: # http://www.opengroup.org/onlinepubs/000095399/functions/pthread_once.html # Check here if this style is required. # # glibc (2.3.6 at least) works both with or without braces, so the # test checks whether it works without. # + + if test "$GCC" = "yes"; then + # Since GCC only issues a warning for missing braces, so we need + # `-Werror' to catch it. + CFLAGS="-Werror -Wmissing-braces $CFLAGS" + fi + AC_CACHE_CHECK([whether PTHREAD_ONCE_INIT needs braces], guile_cv_need_braces_on_pthread_once_init, - [AC_TRY_COMPILE([#include ], - [pthread_once_t foo = PTHREAD_ONCE_INIT;], + [AC_COMPILE_IFELSE([#include + pthread_once_t foo = PTHREAD_ONCE_INIT;], [guile_cv_need_braces_on_pthread_once_init=no], [guile_cv_need_braces_on_pthread_once_init=yes])]) if test "$guile_cv_need_braces_on_pthread_once_init" = yes; then SCM_I_GSC_NEED_BRACES_ON_PTHREAD_ONCE_INIT=1 fi + # Same problem with `PTHREAD_MUTEX_INITIALIZER', e.g., on IRIX + # 6.5.30m with GCC 3.3. + AC_CACHE_CHECK([whether PTHREAD_MUTEX_INITIALIZER needs braces], + guile_cv_need_braces_on_pthread_mutex_initializer, + [AC_COMPILE_IFELSE([#include + pthread_mutex_t foo = PTHREAD_MUTEX_INITIALIZER;], + [guile_cv_need_braces_on_pthread_mutex_initializer=no], + [guile_cv_need_braces_on_pthread_mutex_initializer=yes])]) + if test "$guile_cv_need_braces_on_pthread_mutex_initializer" = yes; then + SCM_I_GSC_NEED_BRACES_ON_PTHREAD_MUTEX_INITIALIZER=1 + fi + CFLAGS="$old_CFLAGS" # On Solaris, sched_yield lives in -lrt. diff --git a/libguile/ChangeLog b/libguile/ChangeLog index 35479f98b..4990216c7 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,3 +1,12 @@ +2007-10-10 Ludovic Courtès + + * pthread-threads.h (SCM_I_PTHREAD_MUTEX_INITIALIZER): Check + `SCM_NEED_BRACES_ON_PTHREAD_MUTEX_INITIALIZER'. + * gen-scmconfig.h.in + (SCM_I_GSC_NEED_BRACES_ON_PTHREAD_MUTEX_INITIALIZER): New. + * gen-scmconfig.c (main): Define + `SCM_NEED_BRACES_ON_PTHREAD_MUTEX_INITIALIZER'. + 2007-10-04 Ludovic Courtès * i18n.c (scm_make_locale)[!USE_GNU_LOCALE_API]: Don't call diff --git a/libguile/gen-scmconfig.c b/libguile/gen-scmconfig.c index 43a2a989d..6afa72fcc 100644 --- a/libguile/gen-scmconfig.c +++ b/libguile/gen-scmconfig.c @@ -382,6 +382,11 @@ main (int argc, char *argv[]) pf ("#define SCM_NEED_BRACES_ON_PTHREAD_ONCE_INIT %d /* 0 or 1 */\n", SCM_I_GSC_NEED_BRACES_ON_PTHREAD_ONCE_INIT); + pf ("/* Define to 1 if need braces around PTHREAD_MUTEX_INITIALIZER\n" + " (for IRIX with GCC) */\n"); + pf ("#define SCM_NEED_BRACES_ON_PTHREAD_MUTEX_INITIALIZER %d /* 0 or 1 */\n", + SCM_I_GSC_NEED_BRACES_ON_PTHREAD_MUTEX_INITIALIZER); + #if USE_DLL_IMPORT pf ("\n"); pf ("/* Define some additional CPP macros on Win32 platforms. */\n"); diff --git a/libguile/gen-scmconfig.h.in b/libguile/gen-scmconfig.h.in index b4e0561f1..cdc59b047 100644 --- a/libguile/gen-scmconfig.h.in +++ b/libguile/gen-scmconfig.h.in @@ -29,6 +29,7 @@ #define SCM_I_GSC_USE_PTHREAD_THREADS @SCM_I_GSC_USE_PTHREAD_THREADS@ #define SCM_I_GSC_USE_NULL_THREADS @SCM_I_GSC_USE_NULL_THREADS@ #define SCM_I_GSC_NEED_BRACES_ON_PTHREAD_ONCE_INIT @SCM_I_GSC_NEED_BRACES_ON_PTHREAD_ONCE_INIT@ +#define SCM_I_GSC_NEED_BRACES_ON_PTHREAD_MUTEX_INITIALIZER @SCM_I_GSC_NEED_BRACES_ON_PTHREAD_MUTEX_INITIALIZER@ /* Local Variables: diff --git a/libguile/pthread-threads.h b/libguile/pthread-threads.h index 015a70767..0fb0b51d2 100644 --- a/libguile/pthread-threads.h +++ b/libguile/pthread-threads.h @@ -43,7 +43,11 @@ /* Mutexes */ -#define SCM_I_PTHREAD_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER +#if SCM_NEED_BRACES_ON_PTHREAD_MUTEX_INITIALIZER +# define SCM_I_PTHREAD_MUTEX_INITIALIZER { PTHREAD_MUTEX_INITIALIZER } +#else +# define SCM_I_PTHREAD_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER +#endif #define scm_i_pthread_mutex_t pthread_mutex_t #define scm_i_pthread_mutex_init pthread_mutex_init #define scm_i_pthread_mutex_destroy pthread_mutex_destroy