about summary refs log tree commit diff
path: root/configure
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2015-10-06 21:27:55 +0200
committerFlorian Weimer <fweimer@redhat.com>2015-10-06 21:27:55 +0200
commit99e1dc0a688d6c25d3f422bc9f3fa29adb483339 (patch)
tree425b9d0a7670515c8ca8cbbbde0717a1fa180b96 /configure
parent6c9678ebd42358f931100130a368fafe375a0ba2 (diff)
downloadglibc-99e1dc0a688d6c25d3f422bc9f3fa29adb483339.tar.gz
glibc-99e1dc0a688d6c25d3f422bc9f3fa29adb483339.tar.xz
glibc-99e1dc0a688d6c25d3f422bc9f3fa29adb483339.zip
Add a test case for C++11 thread_local support
This requires a C++ compiler with thread_local support, and a new
configure check is needed.
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure56
1 files changed, 56 insertions, 0 deletions
diff --git a/configure b/configure
index fe402ea05b..f0cd17580c 100755
--- a/configure
+++ b/configure
@@ -614,6 +614,7 @@ use_nscd
 libc_cv_gcc_unwind_find_fde
 libc_extra_cppflags
 libc_extra_cflags
+libc_cv_cxx_thread_local
 CPPUNDEFS
 sizeof_long_double
 have_selinux
@@ -7215,6 +7216,61 @@ if test $libc_cv_builtin_trap = yes; then
 
 fi
 
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C++ compiler supports thread_local" >&5
+$as_echo_n "checking whether the C++ compiler supports thread_local... " >&6; }
+if ${libc_cv_cxx_thread_local+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+old_CXXFLAGS="$CXXFLAGS"
+CXXFLAGS="$CXXFLAGS -std=gnu++11"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <thread>
+
+// Compiler support.
+struct S
+{
+  S ();
+  ~S ();
+};
+thread_local S s;
+S * get () { return &s; }
+
+// libstdc++ support.
+#ifndef _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL
+#error __cxa_thread_atexit_impl not supported
+#endif
+
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  libc_cv_cxx_thread_local=yes
+else
+  libc_cv_cxx_thread_local=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+CXXFLAGS="$old_CXXFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cxx_thread_local" >&5
+$as_echo "$libc_cv_cxx_thread_local" >&6; }
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
 ### End of automated tests.
 ### Now run sysdeps configure fragments.