Check for __thread
authorAlan T. DeKok <aland@freeradius.org>
Tue, 26 Aug 2008 13:27:23 +0000 (15:27 +0200)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 26 Aug 2008 13:27:23 +0000 (15:27 +0200)
For thread-local storage.

aclocal.m4
configure
configure.in
src/include/autoconf.h.in

index 3bdee60..cab1ae2 100644 (file)
@@ -102,3 +102,15 @@ fi
 
 m4_include([libtool.m4])
 m4_include([acinclude.m4])
+
+#  See if the compilation works with __thread, for thread-local storage
+#
+AC_DEFUN([FR_TLS],
+[
+    AC_MSG_CHECKING(for TLS)
+    AC_RUN_IFELSE([AC_LANG_SOURCE([[ static __thread int val; int main() { return 0; } ]])],[have_tls=yes],[have_tls=no],[have_tls=no ])
+    AC_MSG_RESULT($have_tls)
+    if test "$have_tls" = "yes"; then
+        AC_DEFINE([HAVE_THREAD_TLS],[1],[Define if the compiler supports __thread])
+    fi
+])
index 603cf12..5345dbf 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.in Revision: 1.262 .
+# From configure.in Revision.
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.61.
 #
@@ -19756,6 +19756,10 @@ if test "x$developer" != "xno" -a -d $srcdir/CVS; then
     developer="yes"
 fi
 
+if test "x$developer" != "xno" -a -d $srcdir/.git; then
+    developer="yes"
+fi
+
 EXPERIMENTAL=
 
 # Check whether --with-experimental-modules was given.
@@ -23916,6 +23920,64 @@ echo "${ECHO_T}no." >&6; }
 fi
 
 
+    { echo "$as_me:$LINENO: checking for TLS" >&5
+echo $ECHO_N "checking for TLS... $ECHO_C" >&6; }
+    if test "$cross_compiling" = yes; then
+  have_tls=no
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+ static __thread int val; int main() { return 0; }
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  have_tls=yes
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+have_tls=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+    { echo "$as_me:$LINENO: result: $have_tls" >&5
+echo "${ECHO_T}$have_tls" >&6; }
+    if test "$have_tls" = "yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_THREAD_TLS 1
+_ACEOF
+
+    fi
+
+
+
 { echo "$as_me:$LINENO: checking for crypt in -lcrypt" >&5
 echo $ECHO_N "checking for crypt in -lcrypt... $ECHO_C" >&6; }
 if test "${ac_cv_lib_crypt_crypt+set}" = set; then
index 54b5a6b..c255897 100644 (file)
@@ -907,6 +907,8 @@ else
   AC_MSG_RESULT(no.)
 fi
 
+FR_TLS
+
 dnl #############################################################
 dnl #
 dnl #  7. Checks for library functions
index a96194f..ef9d1b3 100644 (file)
 /* Define to 1 if you have the <sys/wait.h> header file. */
 #undef HAVE_SYS_WAIT_H
 
+/* Define if the compiler supports __thread */
+#undef HAVE_THREAD_TLS
+
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H