check whether __thread binaries actually run

This commit is contained in:
Glenn Maynard
2004-12-17 02:25:52 +00:00
parent 74886cc5e9
commit b609af7cce
+6 -5
View File
@@ -1,13 +1,14 @@
# See if we have working TLS. We only check to see if it compiles; we test
# to see if it works at runtime, since we can run binaries compiled with __thread
# on systems without TLS.
# See if we have working TLS. We only check to see if it compiles, and that
# the resulting program actually runs, not whether the resulting TLS variables
# work properly; that check is done at runtime, since we can run binaries
# compiled with __thread on systems without TLS.
AC_DEFUN(SM_TLS,
[
AC_MSG_CHECKING(for TLS)
AC_TRY_COMPILE( [], [ static __thread int val; ], have_tls=yes,have_tls=no,have_tls=no )
AC_TRY_RUN( [ 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_TLS],[1],[Define if the complier supports __thread])
AC_DEFINE([HAVE_TLS],[1],[Define if the compiler supports __thread])
AC_DEFINE([thread_local],[__thread],[Define to the compiler TLS keyword])
fi
])