]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
configure.in: Rearranged the TLS test such that autoreconf doesn't complain about it
authorBart Van Assche <bvanassche@acm.org>
Sat, 22 Oct 2011 09:46:16 +0000 (09:46 +0000)
committerBart Van Assche <bvanassche@acm.org>
Sat, 22 Oct 2011 09:46:16 +0000 (09:46 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12193

configure.in

index ada91ea890bafbc7cbe5ca772acdac5627f4129d..26ccfecc7a42a7477e2d6f6513c38a22dab96c76 100644 (file)
@@ -1555,27 +1555,22 @@ AM_CONDITIONAL(BUILD_SSE42_TESTS, test x$ac_have_as_sse42 = xyes)
 # when building the tool executables.  I think we should get rid of it.
 #
 # Check for TLS support in the compiler and linker
-if test "x${cross_compiling}" = "xno"; then
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
+                                [[return foo;]])],
+                               [vg_cv_linktime_tls=yes],
+                               [vg_cv_linktime_tls=no])
 # 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],
-                       [AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
+                       [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
                                                 [[return foo;]])],
                                [vg_cv_tls=yes],
-                               [vg_cv_tls=no])])])
-fi
+                               [vg_cv_tls=no],
+                               [vg_cv_tls=$vg_cv_linktime_tls])])])
 
 if test "$vg_cv_tls" = yes; then
 AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])