From: Bart Van Assche Date: Mon, 2 Jun 2008 07:14:20 +0000 (+0000) Subject: Modified TLS-test slightly: the program checking for TLS support is now compiled... X-Git-Tag: svn/VALGRIND_3_4_0~527 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=463381c162781b561a8b884533c16536ee675174;p=thirdparty%2Fvalgrind.git Modified TLS-test slightly: the program checking for TLS support is now compiled, linked and run when compiling natively and compiled and linked only when cross-compiling. Before it was compiled and linked only, both for native and cross-compilation. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8172 --- diff --git a/configure.in b/configure.in index 5cbae4466a..1bdbde754e 100644 --- a/configure.in +++ b/configure.in @@ -1149,6 +1149,19 @@ AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes) # Check for TLS support in the compiler and linker +if test "x${cross_compiling}" = "xno"; then +# Native compilation: check whether running a program using TLS succeeds. +# Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs +# succeeds but running programs using TLS fails. +AC_CACHE_CHECK([for TLS support], vg_cv_tls, + [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS], + [vg_cv_tls=$enableval], + [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]], + [[return foo;]])], + [vg_cv_tls=yes], + [vg_cv_tls=no])])]) +else +# Cross-compiling: check whether linking a program using TLS succeeds. AC_CACHE_CHECK([for TLS support], vg_cv_tls, [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS], [vg_cv_tls=$enableval], @@ -1156,6 +1169,7 @@ AC_CACHE_CHECK([for TLS support], vg_cv_tls, [[return foo;]])], [vg_cv_tls=yes], [vg_cv_tls=no])])]) +fi if test "$vg_cv_tls" = yes; then AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])