Subject: bug#7073: no pthread_spinlock_t on Mac OS 10.6.4

From: Paul Eggert <[email-masked]>
Date: Tue, 21 Sep 2010 11:56:56 -0700

On 09/21/10 10:40, Bruno Haible wrote:
> You can do so by inserting
>   gl_use_threads_default=no
> in your configure.ac, before the invocations of gl_INIT_EARLY and gl_INIT.

Thanks, I didn't know that.  I tried it, and found one minor glitch.
"configure" said "checking for multithread API to use... no"
which might imply to the casual reader that the resulting coreutils
would not use multiple threads anywhere.  How about appending
"within threadlib" to that message?

Also, it'd be helpful to document gl_use_threads_default.

Perhaps the following patch?

diff --git a/m4/threadlib.m4 b/m4/threadlib.m4
index bff01bc..b6c1817 100644
--- a/m4/threadlib.m4
+++ b/m4/threadlib.m4
@@ -282,7 +282,7 @@ int main ()
       fi
     fi
   fi
-  AC_MSG_CHECKING([for multithread API to use])
+  AC_MSG_CHECKING([for multithread API to use within threadlib])
   AC_MSG_RESULT([$gl_threads_api])
   AC_SUBST([LIBTHREAD])
   AC_SUBST([LTLIBTHREAD])
diff --git a/modules/gettext b/modules/gettext
index cab538e..787f237 100644
--- a/modules/gettext
+++ b/modules/gettext
@@ -38,6 +38,13 @@ gettext-h
 havelib
 
 configure.ac:
+# If your applications do not need gnulib to be multithread-safe,
+# either because they don't use threads or because they carefully
+# control which APIs are invoked while concurrent threads are running,
+# then you can avoid some build-time hassles and run-time overhead by
+# inserting:
+#     gl_use_threads_default=no
+# early in configure.ac, before the invocations of gl_INIT_EARLY and gl_INIT.
 AM_GNU_GETTEXT([external])
 AM_GNU_GETTEXT_VERSION([0.18.1])
 
diff --git a/modules/threadlib b/modules/threadlib
index 9e3438c..3e2226a 100644
--- a/modules/threadlib
+++ b/modules/threadlib
@@ -13,6 +13,13 @@ configure.ac-early:
 gl_THREADLIB_EARLY
 
 configure.ac:
+# If your applications do not need gnulib to be multithread-safe,
+# either because they don't use threads or because they carefully
+# control which APIs are invoked while concurrent threads are running,
+# then you can avoid some build-time hassles and run-time overhead by
+# inserting:
+#     gl_use_threads_default=no
+# early in configure.ac, before the invocations of gl_INIT_EARLY and gl_INIT.
 gl_THREADLIB
 
 Makefile.am: