|
From: <sv...@va...> - 2008-06-02 07:14:25
|
Author: bart
Date: 2008-06-02 08:14:20 +0100 (Mon, 02 Jun 2008)
New Revision: 8172
Log:
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.
Modified:
trunk/configure.in
Modified: trunk/configure.in
===================================================================
--- trunk/configure.in 2008-06-01 22:49:25 UTC (rev 8171)
+++ trunk/configure.in 2008-06-02 07:14:20 UTC (rev 8172)
@@ -1149,13 +1149,27 @@
# 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],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
[[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])
|