summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2019-05-18 18:22:45 +0200
committerBruno Haible <bruno@clisp.org>2019-05-18 18:22:45 +0200
commit7ded27a6c89101fce7f00203b3439f8d40f281b4 (patch)
tree9a1af9792ae064ef6d10ced44dde496befbcf982
parent64e905db05c32792c3f0e77ce271f65e77980a92 (diff)
downloadgnulib-7ded27a6c89101fce7f00203b3439f8d40f281b4.tar.gz
threadlib: Provide an easy way to avoid mingw's winpthreads library.
* m4/threadlib.m4 (gl_AVOID_WINPTHREAD): New macro. (gl_THREADLIB_EARLY_BODY): Recognize when it was invoked, and set gl_use_threads accordingly.
-rw-r--r--ChangeLog7
-rw-r--r--m4/threadlib.m425
2 files changed, 30 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index abdaa99ce1..3ec5ac58f1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2019-05-18 Bruno Haible <bruno@clisp.org>
+ threadlib: Provide an easy way to avoid mingw's winpthreads library.
+ * m4/threadlib.m4 (gl_AVOID_WINPTHREAD): New macro.
+ (gl_THREADLIB_EARLY_BODY): Recognize when it was invoked, and set
+ gl_use_threads accordingly.
+
+2019-05-18 Bruno Haible <bruno@clisp.org>
+
pthread_sigmask: Fix compilation error with --enable-threads=windows.
Reported by Tim Rühsen in
<https://lists.gnu.org/archive/html/bug-gnulib/2018-01/msg00018.html>
diff --git a/m4/threadlib.m4 b/m4/threadlib.m4
index bfc3bac853..b4401f8665 100644
--- a/m4/threadlib.m4
+++ b/m4/threadlib.m4
@@ -1,4 +1,4 @@
-# threadlib.m4 serial 16
+# threadlib.m4 serial 17
dnl Copyright (C) 2005-2019 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -50,6 +50,7 @@ AC_DEFUN([gl_THREADLIB_EARLY_BODY],
m4_ifdef([gl_THREADLIB_DEFAULT_NO],
[m4_divert_text([DEFAULTS], [gl_use_threads_default=no])],
[m4_divert_text([DEFAULTS], [gl_use_threads_default=])])
+ m4_divert_text([DEFAULTS], [gl_use_winpthreads_default=])
AC_ARG_ENABLE([threads],
AC_HELP_STRING([--enable-threads={posix|solaris|pth|windows}], [specify multithreading API])m4_ifdef([gl_THREADLIB_DEFAULT_NO], [], [
AC_HELP_STRING([--disable-threads], [build without multithread safety])]),
@@ -62,16 +63,24 @@ changequote(,)dnl
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 ;;
dnl Disable multithreading by default on Cygwin 1.5.x, because it has
dnl bugs that lead to endless loops or crashes. See
dnl <https://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
;;
+ dnl Obey gl_AVOID_WINPTHREAD on mingw.
+ mingw*)
+ case "$gl_use_winpthreads_default" in
+ yes) gl_use_threads=posix ;;
+ no) gl_use_threads=windows ;;
+ *) gl_use_threads=yes ;;
+ esac
+ ;;
*) gl_use_threads=yes ;;
esac
changequote([,])dnl
@@ -337,6 +346,18 @@ AC_DEFUN([gl_DISABLE_THREADS], [
])
+dnl gl_AVOID_WINPTHREAD
+dnl -------------------
+dnl Sets the gl_THREADLIB default so that on mingw, a dependency to the
+dnl libwinpthread DLL (mingw-w64 winpthreads library) is avoided.
+dnl The user can still override it at installation time, by using the
+dnl configure option '--enable-threads'.
+
+AC_DEFUN([gl_AVOID_WINPTHREAD], [
+ m4_divert_text([INIT_PREPARE], [gl_use_winpthreads_default=no])
+])
+
+
dnl Survey of platforms:
dnl
dnl Platform Available Compiler Supports test-lock