1 dnl Check whether the target supports TLS.
2 AC_DEFUN([LIBMUDFLAP_CHECK_TLS], [
3 LIBMUDFLAP_ENABLE(tls, yes, [Use thread-local storage])
4 AC_CACHE_CHECK([whether the target supports thread-local storage],
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
8 dnl static linking. This fails at least with some older Red Hat
10 save_LDFLAGS="$LDFLAGS"
11 LDFLAGS="-static $LDFLAGS"
12 AC_RUN_IFELSE([__thread int a; int b; int main() { return a = b; }],
13 [have_tls=yes], [have_tls=no], [])
14 LDFLAGS="$save_LDFLAGS"],
16 [AC_COMPILE_IFELSE([__thread int foo;], [have_tls=yes], [have_tls=no])]
18 if test "$enable_tls $have_tls" = "yes yes"; then
19 AC_DEFINE(HAVE_TLS, 1,
20 [Define to 1 if the target supports thread-local storage.])
23 dnl ----------------------------------------------------------------------
24 dnl This whole bit snagged from libgfortran.
26 sinclude(../libtool.m4)
27 dnl The lines below arrange for aclocal not to bring an installed
28 dnl libtool.m4 into aclocal.m4, while still arranging for automake to
29 dnl add a definition of LIBTOOL to Makefile.in.
30 ifelse(,,,[AC_SUBST(LIBTOOL)
31 AC_DEFUN([AM_PROG_LIBTOOL])
32 AC_DEFUN([AC_LIBTOOL_DLOPEN])
33 AC_DEFUN([AC_PROG_LD])
36 dnl ----------------------------------------------------------------------
37 dnl This whole bit snagged from libstdc++-v3.
41 dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING)
42 dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, permit a|b|c)
43 dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, SHELL-CODE-HANDLER)
45 dnl See docs/html/17_intro/configury.html#enable for documentation.
47 m4_define([LIBMUDFLAP_ENABLE],[dnl
48 m4_define([_g_switch],[--enable-$1])dnl
49 m4_define([_g_help],[AC_HELP_STRING(_g_switch$3,[$4 @<:@default=$2@:>@])])dnl
50 AC_ARG_ENABLE($1,_g_help,
55 m4_bpatsubst([$5],[permit ])) ;;
56 *) AC_MSG_ERROR(Unknown argument to enable/disable $1) ;;
57 dnl Idea for future: generate a URL pointing to
58 dnl "onlinedocs/configopts.html#whatever"
65 *) AC_MSG_ERROR(Argument to enable/disable $1 must be yes or no) ;;
69 [enable_]m4_bpatsubst([$1],-,_)[=][$2])
70 m4_undefine([_g_switch])dnl
71 m4_undefine([_g_help])dnl