summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2019-06-20 03:54:56 +0200
committerBruno Haible <bruno@clisp.org>2019-06-20 03:59:07 +0200
commit79c2545308000d2120009a76bea4f36f06f16b1b (patch)
tree8acbf5d44d2160038130e4f65f40fc0d00e774c4 /m4
parent97ae5364457c30ea826fa5e6c0c0a41c73a30c38 (diff)
downloadgnulib-79c2545308000d2120009a76bea4f36f06f16b1b.tar.gz
thread, lock, cond, tls: Recognize C11 multithreaded applications.
* m4/threadlib.m4 (gl_THREADLIB_BODY): Test for <threads.h>. * lib/glthread/thread.h (c11_threads_in_use): New macro. (pthread_in_use, pth_in_use, thread_in_use): Use it. * lib/glthread/lock.h (c11_threads_in_use): New macro. (pthread_in_use, pth_in_use, thread_in_use): Use it. * lib/glthread/cond.h (c11_threads_in_use): New macro. (pthread_in_use, pth_in_use, thread_in_use): Use it. * lib/glthread/tls.h (c11_threads_in_use): New macro. (pthread_in_use, pth_in_use, thread_in_use): Use it.
Diffstat (limited to 'm4')
-rw-r--r--m4/threadlib.m49
1 files changed, 8 insertions, 1 deletions
diff --git a/m4/threadlib.m4 b/m4/threadlib.m4
index b4401f8665..f02eb972cc 100644
--- a/m4/threadlib.m4
+++ b/m4/threadlib.m4
@@ -1,4 +1,4 @@
-# threadlib.m4 serial 17
+# threadlib.m4 serial 18
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,
@@ -160,6 +160,13 @@ int main ()
*" -static "*) gl_cv_have_weak=no ;;
esac
])
+ if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then
+ dnl If we use weak symbols to implement pthread_in_use / pth_in_use /
+ gnl thread_in_use, we also need to test whether the ISO C 11 thrd_create
+ dnl facility is in use.
+ AC_CHECK_HEADERS_ONCE([threads.h])
+ :
+ fi
if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then
# On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that
# it groks <pthread.h>. It's added above, in gl_THREADLIB_EARLY_BODY.