-# lock.m4 serial 7 (gettext-0.16)
-dnl Copyright (C) 2005-2007 Free Software Foundation, Inc.
+# lock.m4 serial 8 (gettext-0.18)
+dnl Copyright (C) 2005-2008 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.
dnl From Bruno Haible.
+dnl gl_LOCK
+dnl -------
dnl Tests for a multithreading library to be used.
dnl Defines at most one of the macros USE_POSIX_THREADS, USE_SOLARIS_THREADS,
dnl USE_PTH_THREADS, USE_WIN32_THREADS
AC_BEFORE([$0], [gl_ARGP])dnl
AC_REQUIRE([AC_CANONICAL_HOST])
- AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) dnl needed for pthread_rwlock_t on glibc systems
+ dnl _GNU_SOURCE is needed for pthread_rwlock_t on glibc systems.
+ dnl AC_USE_SYSTEM_EXTENSIONS was introduced in autoconf 2.60 and obsoletes
+ dnl AC_GNU_SOURCE.
+ m4_ifdef([AC_USE_SYSTEM_EXTENSIONS],
+ [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])],
+ [AC_REQUIRE([AC_GNU_SOURCE])])
dnl Check for multithreading.
+ m4_divert_text([DEFAULTS], [gl_use_threads_default=])
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],
- [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 child
- dnl process gets an endless segmentation fault inside execvp().
- osf*) gl_use_threads=no ;;
- *) gl_use_threads=yes ;;
- esac
+ [if test -n "$gl_use_threads_default"; then
+ gl_use_threads="$gl_use_threads_default"
+ else
+ 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().
+ osf*) gl_use_threads=no ;;
+ *) gl_use_threads=yes ;;
+ esac
+ fi
])
if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then
# For using <pthread.h>:
AC_REQUIRE([AC_C_INLINE])
])
-# AC_USE_SYSTEM_EXTENSIONS was only added in autoconf 2.60, but lock.m4
-# wants to work with autoconf 2.54. Add a fallback until such time as
-# a newer autoconf is standard, if one is not already provided by gnulib
-# extensions.m4.
-m4_if(m4_version_compare(m4_PACKAGE_VERSION, [2.60]), [-1],
- [m4_ifndef([AC_USE_SYSTEM_EXTENSIONS],
- [AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS], [AC_GNU_SOURCE])])])
+
+dnl gl_DISABLE_THREADS
+dnl ------------------
+dnl Sets the gl_LOCK default so that threads are not used by default.
+dnl The user can still override it at installation time, by using the
+dnl configure option '--enable-threads'.
+
+AC_DEFUN([gl_DISABLE_THREADS], [
+ m4_divert_text([INIT_PREPARE], [gl_use_threads_default=no])
+])
+
dnl Survey of platforms:
dnl