diff options
author | Bruno Haible <bruno@clisp.org> | 2019-06-20 03:54:56 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2019-06-20 03:59:07 +0200 |
commit | 79c2545308000d2120009a76bea4f36f06f16b1b (patch) | |
tree | 8acbf5d44d2160038130e4f65f40fc0d00e774c4 /m4 | |
parent | 97ae5364457c30ea826fa5e6c0c0a41c73a30c38 (diff) | |
download | gnulib-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.m4 | 9 |
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. |