This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch: move TLS configury to config/


>>>>> "rth" == Richard Henderson <rth@redhat.com> writes:

>> This patch moves some TLS configury bits from libmudflap to a new .m4
>> file in config/.  I wanted to reuse this code in libjava and it seemed
>> better to move it than to make a copy.

rth> Cool.  We should probably split out the ENABLE macro separately.
rth> It's not related to TLS directly after all.

I forgot to mention -- I had tried this and ran into a problem where
aclocal wouldn't pick up the GCC_ENABLE macro from a separate file.
This is easily worked around though (see the addition to
libmudflap/acinclude.m4 for the workaround).

How about the appended patch?

Tom

Index: libmudflap/ChangeLog
from  Tom Tromey  <tromey@redhat.com>

	* aclocal.m4, configure: Rebuilt.
	* configure.ac: Use GCC_CHECK_TLS.
	* acinclude.m4 (LIBMUDFLAP_CHECK_TLS, LIBMUDFLAP_ENABLE): Moved
	to ../config.

Index: config/ChangeLog
from  Tom Tromey  <tromey@redhat.com>

	* enable.m4: New file.
	* tls.m4: New file.

Index: libmudflap/configure.ac
===================================================================
RCS file: /cvs/gcc/gcc/libmudflap/configure.ac,v
retrieving revision 1.13
diff -u -r1.13 configure.ac
--- libmudflap/configure.ac 15 Aug 2005 16:15:16 -0000 1.13
+++ libmudflap/configure.ac 20 Sep 2005 17:26:30 -0000
@@ -245,7 +245,7 @@
 fi
 
 # See if we support thread-local storage.
-LIBMUDFLAP_CHECK_TLS
+GCC_CHECK_TLS
 
 AC_CONFIG_FILES([Makefile testsuite/Makefile testsuite/mfconfig.exp])
 AC_OUTPUT
Index: libmudflap/acinclude.m4
===================================================================
RCS file: /cvs/gcc/gcc/libmudflap/acinclude.m4,v
retrieving revision 1.7
diff -u -r1.7 acinclude.m4
--- libmudflap/acinclude.m4 17 Jul 2005 02:28:57 -0000 1.7
+++ libmudflap/acinclude.m4 20 Sep 2005 17:26:30 -0000
@@ -1,24 +1,6 @@
-dnl Check whether the target supports TLS.
-AC_DEFUN([LIBMUDFLAP_CHECK_TLS], [
-  LIBMUDFLAP_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])
+dnl Need to include this manually for the TLS check macro to work
+dnl Most likely this is an aclocal bug.
+sinclude(../config/enable.m4)
 
 dnl ----------------------------------------------------------------------
 dnl This whole bit snagged from libgfortran.
@@ -32,41 +14,3 @@
 AC_DEFUN([AC_LIBTOOL_DLOPEN])
 AC_DEFUN([AC_PROG_LD])
 ])
-
-dnl ----------------------------------------------------------------------
-dnl This whole bit snagged from libstdc++-v3.
-
-dnl
-dnl LIBMUDFLAP_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
-m4_define([LIBMUDFLAP_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
-])
Index: config/enable.m4
===================================================================
RCS file: config/enable.m4
diff -N config/enable.m4
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ config/enable.m4 20 Sep 2005 17:26:31 -0000
@@ -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
+m4_define([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
+])
+
Index: config/tls.m4
===================================================================
RCS file: config/tls.m4
diff -N config/tls.m4
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ config/tls.m4 20 Sep 2005 17:26:31 -0000
@@ -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])


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]