diff options
author | Daiki Ueno <dueno@redhat.com> | 2018-07-20 11:43:15 +0200 |
---|---|---|
committer | Daiki Ueno <ueno@gnu.org> | 2018-08-10 10:11:24 +0200 |
commit | ebfd7da82d7b9eea81067479861aac2d2c07cc29 (patch) | |
tree | a7327aa6a42a508018e971bcfacc27ef0e7297a5 /configure.ac | |
parent | dc4a6eaddbb36a344cc6a9c7eb12cab9df4899b0 (diff) |
common: Use thread-local storage class when possible
This eliminates the unconditional use of pthread_{get,set}specific()
and pthread_key_{create,delete}(), which glibc doesn't provide the stubs.
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index b35da75..6ee6404 100644 --- a/configure.ac +++ b/configure.ac @@ -139,6 +139,18 @@ if test "$os_unix" = "yes"; then fi ]) + AC_CACHE_CHECK([for thread-local storage class], + [ac_cv_tls_keyword], + [ac_cv_tls_keyword= + for keyword in _Thread_local __thread; do + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>]], + [[static ]$keyword[ foo;]])], + [ac_cv_tls_keyword=$keyword]) + done]) + if test -n "$ac_cv_tls_keyword"; then + AC_DEFINE_UNQUOTED([P11_TLS_KEYWORD], [$ac_cv_tls_keyword], [the compiler keyword to define thread-local storage]) + fi + # Required functions AC_CHECK_FUNCS([gmtime_r], [AC_DEFINE([HAVE_GMTIME_R], 1, [Whether gmtime_r() is available])], |