summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2005-09-23 17:28:31 +0000
committerTom Tromey <tromey@redhat.com>2005-09-23 17:28:31 +0000
commit30d8841d2a21ba5d80cf71e08f1552fb916776e7 (patch)
tree57a6238c0c9685db4987bed3cc467976e038519d
parent75993643572fe4f155b2b34dcd584f8a3bb8c429 (diff)
downloadgdb-30d8841d2a21ba5d80cf71e08f1552fb916776e7.tar.gz
* enable.m4: New file.
* tls.m4: New file.
-rw-r--r--config/ChangeLog5
-rw-r--r--config/enable.m438
-rw-r--r--config/tls.m421
3 files changed, 64 insertions, 0 deletions
diff --git a/config/ChangeLog b/config/ChangeLog
index c90079c72c8..800698cf2b8 100644
--- a/config/ChangeLog
+++ b/config/ChangeLog
@@ -1,3 +1,8 @@
+2005-09-23 Tom Tromey <tromey@redhat.com>
+
+ * enable.m4: New file.
+ * tls.m4: New file.
+
2005-08-12 Paolo Bonzini <bonzini@gnu.org>
* config/acx.m4 (NCN_CHECK_TARGET_TOOL, NCN_STRICT_CHECK_TOOL,
diff --git a/config/enable.m4 b/config/enable.m4
new file mode 100644
index 00000000000..88b29b8aa7f
--- /dev/null
+++ b/config/enable.m4
@@ -0,0 +1,38 @@
+dnl ----------------------------------------------------------------------
+dnl This whole bit snagged from libstdc++-v3.
+
+dnl
+dnl GCC_ENABLE
+dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING)
+dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, permit a|b|c)
+dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, SHELL-CODE-HANDLER)
+dnl
+dnl See docs/html/17_intro/configury.html#enable for documentation.
+dnl
+AC_DEFUN([GCC_ENABLE],[dnl
+m4_define([_g_switch],[--enable-$1])dnl
+m4_define([_g_help],[AC_HELP_STRING(_g_switch$3,[$4 @<:@default=$2@:>@])])dnl
+ AC_ARG_ENABLE($1,_g_help,
+ m4_bmatch([$5],
+ [^permit ],
+ [[
+ case "$enableval" in
+ m4_bpatsubst([$5],[permit ])) ;;
+ *) AC_MSG_ERROR(Unknown argument to enable/disable $1) ;;
+ dnl Idea for future: generate a URL pointing to
+ dnl "onlinedocs/configopts.html#whatever"
+ esac
+ ]],
+ [^$],
+ [[
+ case "$enableval" in
+ yes|no) ;;
+ *) AC_MSG_ERROR(Argument to enable/disable $1 must be yes or no) ;;
+ esac
+ ]],
+ [[$5]]),
+ [enable_]m4_bpatsubst([$1],-,_)[=][$2])
+m4_undefine([_g_switch])dnl
+m4_undefine([_g_help])dnl
+])
+
diff --git a/config/tls.m4 b/config/tls.m4
new file mode 100644
index 00000000000..5cbb6854f6c
--- /dev/null
+++ b/config/tls.m4
@@ -0,0 +1,21 @@
+dnl Check whether the target supports TLS.
+AC_DEFUN([GCC_CHECK_TLS], [
+ GCC_ENABLE(tls, yes, [Use thread-local storage])
+ AC_CACHE_CHECK([whether the target supports thread-local storage],
+ have_tls, [
+ AC_RUN_IFELSE([__thread int a; int b; int main() { return a = b; }],
+ [dnl If the test case passed with dynamic linking, try again with
+ dnl static linking. This fails at least with some older Red Hat
+ dnl releases.
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="-static $LDFLAGS"
+ AC_RUN_IFELSE([__thread int a; int b; int main() { return a = b; }],
+ [have_tls=yes], [have_tls=no], [])
+ LDFLAGS="$save_LDFLAGS"],
+ [have_tls=no],
+ [AC_COMPILE_IFELSE([__thread int foo;], [have_tls=yes], [have_tls=no])]
+ )])
+ if test "$enable_tls $have_tls" = "yes yes"; then
+ AC_DEFINE(HAVE_TLS, 1,
+ [Define to 1 if the target supports thread-local storage.])
+ fi])