ChangeLog: add entry for "init.sh: automatically accommodate programs with the .exe...
[gnulib.git] / m4 / threadlib.m4
index 51caf57..bba460e 100644 (file)
@@ -1,5 +1,5 @@
-# threadlib.m4 serial 2 (gettext-0.18)
-dnl Copyright (C) 2005-2008 Free Software Foundation, Inc.
+# threadlib.m4 serial 4 (gettext-0.18)
+dnl Copyright (C) 2005-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -45,20 +45,31 @@ AC_DEFUN([gl_THREADLIB_EARLY_BODY],
     [AC_REQUIRE([AC_GNU_SOURCE])])
   dnl Check for multithreading.
   m4_divert_text([DEFAULTS], [gl_use_threads_default=])
-  AC_ARG_ENABLE(threads,
+  AC_ARG_ENABLE([threads],
 AC_HELP_STRING([--enable-threads={posix|solaris|pth|win32}], [specify multithreading API])
 AC_HELP_STRING([--disable-threads], [build without multithread safety]),
     [gl_use_threads=$enableval],
     [if test -n "$gl_use_threads_default"; then
        gl_use_threads="$gl_use_threads_default"
      else
+changequote(,)dnl
        case "$host_os" in
          dnl Disable multithreading by default on OSF/1, because it interferes
          dnl with fork()/exec(): When msgexec is linked with -lpthread, its
          dnl child process gets an endless segmentation fault inside execvp().
+         dnl Disable multithreading by default on Cygwin 1.5.x, because it has
+         dnl bugs that lead to endless loops or crashes. See
+         dnl <http://cygwin.com/ml/cygwin/2009-08/msg00283.html>.
          osf*) gl_use_threads=no ;;
+         cygwin*)
+               case `uname -r` in
+                 1.[0-5].*) gl_use_threads=no ;;
+                 *)         gl_use_threads=yes ;;
+               esac
+               ;;
          *)    gl_use_threads=yes ;;
        esac
+changequote([,])dnl
      fi
     ])
   if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then
@@ -131,7 +142,7 @@ AC_DEFUN([gl_THREADLIB_BODY],
              # pthread_create will actually create a thread.
              case "$host_os" in
                solaris* | hpux*)
-                 AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], 1,
+                 AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1],
                    [Define if the pthread_in_use() detection is hard.])
              esac
             ])
@@ -151,11 +162,11 @@ AC_DEFUN([gl_THREADLIB_BODY],
         fi
         if test -n "$gl_have_pthread"; then
           gl_threads_api=posix
-          AC_DEFINE([USE_POSIX_THREADS], 1,
+          AC_DEFINE([USE_POSIX_THREADS], [1],
             [Define if the POSIX multithreading library can be used.])
           if test -n "$LIBMULTITHREAD" || test -n "$LTLIBMULTITHREAD"; then
             if test $gl_have_weak = yes; then
-              AC_DEFINE([USE_POSIX_THREADS_WEAK], 1,
+              AC_DEFINE([USE_POSIX_THREADS_WEAK], [1],
                 [Define if references to the POSIX multithreading library should be made weak.])
               LIBTHREAD=
               LTLIBTHREAD=
@@ -180,10 +191,10 @@ AC_DEFUN([gl_THREADLIB_BODY],
           LTLIBTHREAD=-lthread
           LIBMULTITHREAD="$LIBTHREAD"
           LTLIBMULTITHREAD="$LTLIBTHREAD"
-          AC_DEFINE([USE_SOLARIS_THREADS], 1,
+          AC_DEFINE([USE_SOLARIS_THREADS], [1],
             [Define if the old Solaris multithreading library can be used.])
           if test $gl_have_weak = yes; then
-            AC_DEFINE([USE_SOLARIS_THREADS_WEAK], 1,
+            AC_DEFINE([USE_SOLARIS_THREADS_WEAK], [1],
               [Define if references to the old Solaris multithreading library should be made weak.])
             LIBTHREAD=
             LTLIBTHREAD=
@@ -205,11 +216,11 @@ AC_DEFUN([gl_THREADLIB_BODY],
         LTLIBTHREAD="$LTLIBPTH"
         LIBMULTITHREAD="$LIBTHREAD"
         LTLIBMULTITHREAD="$LTLIBTHREAD"
-        AC_DEFINE([USE_PTH_THREADS], 1,
+        AC_DEFINE([USE_PTH_THREADS], [1],
           [Define if the GNU Pth multithreading library can be used.])
         if test -n "$LIBMULTITHREAD" || test -n "$LTLIBMULTITHREAD"; then
           if test $gl_have_weak = yes; then
-            AC_DEFINE([USE_PTH_THREADS_WEAK], 1,
+            AC_DEFINE([USE_PTH_THREADS_WEAK], [1],
               [Define if references to the GNU Pth multithreading library should be made weak.])
             LIBTHREAD=
             LTLIBTHREAD=
@@ -227,7 +238,7 @@ AC_DEFUN([gl_THREADLIB_BODY],
              esac
            }; then
           gl_threads_api=win32
-          AC_DEFINE([USE_WIN32_THREADS], 1,
+          AC_DEFINE([USE_WIN32_THREADS], [1],
             [Define if the Win32 multithreading API can be used.])
         fi
       fi