Changes from arch/CVS synchronization
authorLudovic Courtès <ludo@gnu.org>
Wed, 10 Oct 2007 16:46:26 +0000 (16:46 +0000)
committerLudovic Courtès <ludo@gnu.org>
Wed, 10 Oct 2007 16:46:26 +0000 (16:46 +0000)
ChangeLog
NEWS
configure.in
libguile/ChangeLog
libguile/gen-scmconfig.c
libguile/gen-scmconfig.h.in
libguile/pthread-threads.h

index 18f16fd..006b6dd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2007-10-10  Ludovic Courtès  <ludo@gnu.org>
+
+       * 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  <ludo@gnu.org>
 
        * NEWS: Mention `(ice-9 slib)' fix and threading fix.
diff --git a/NEWS b/NEWS
index e4fbb14..70d6fe6 100644 (file)
--- 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
 
index 2cf4813..7d63927 100644 (file)
@@ -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.h>],
-        [pthread_once_t foo = PTHREAD_ONCE_INIT;],
+      [AC_COMPILE_IFELSE([#include <pthread.h>
+         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.h>
+         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.
index 35479f9..4990216 100644 (file)
@@ -1,3 +1,12 @@
+2007-10-10  Ludovic Courtès  <ludo@gnu.org>
+
+       * 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  <ludo@gnu.org>
 
        * i18n.c (scm_make_locale)[!USE_GNU_LOCALE_API]: Don't call
index 43a2a98..6afa72f 100644 (file)
@@ -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");
index b4e0561..cdc59b0 100644 (file)
@@ -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:
index 015a707..0fb0b51 100644 (file)
 
 /* 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