]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - config/tls.m4
2007-02-09 H.J. Lu <hongjiu.lu@intel.com>
[thirdparty/binutils-gdb.git] / config / tls.m4
CommitLineData
11c94d12
TT
1dnl Check whether the target supports TLS.
2AC_DEFUN([GCC_CHECK_TLS], [
98c5f827 3 GCC_ENABLE(tls, yes, [], [Use thread-local storage])
11c94d12
TT
4 AC_CACHE_CHECK([whether the target supports thread-local storage],
5 have_tls, [
6 AC_RUN_IFELSE([__thread int a; int b; int main() { return a = b; }],
7 [dnl If the test case passed with dynamic linking, try again with
8a0d8a5c
PB
8 dnl static linking, but only if static linking is supported (not
9 dnl on Solaris 10). This fails with some older Red Hat releases.
11c94d12
TT
10 save_LDFLAGS="$LDFLAGS"
11 LDFLAGS="-static $LDFLAGS"
8a0d8a5c
PB
12 AC_LINK_IFELSE([int main() { return 0; }],
13 AC_RUN_IFELSE([__thread int a; int b; int main() { return a = b; }],
14 [have_tls=yes], [have_tls=no],[]),
15 [have_tls=yes])
11c94d12
TT
16 LDFLAGS="$save_LDFLAGS"],
17 [have_tls=no],
7173306d
DJ
18 [AC_LINK_IFELSE([__thread int a; int b; int main() { return a = b; }],
19 [have_tls=yes], [have_tls=no])]
11c94d12
TT
20 )])
21 if test "$enable_tls $have_tls" = "yes yes"; then
22 AC_DEFINE(HAVE_TLS, 1,
23 [Define to 1 if the target supports thread-local storage.])
24 fi])