[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[patches] RFA: Remove configure link tests



This patch replaces some configure-time link tests with tool version
tests that ensure the same properties.  The link tests prevented
running the configure script when bootstrapping an EGLIBC/GCC pair,
requiring kludges.

2007-02-13  Jim Blandy  <jimb@xxxxxxxxxxxxxxxx>

	Make configuration script more friendly to cross-compilation.
	* configure.in: Require at least binutils 2.17 and GCC 4.1.
	* nptl/sysdeps/pthread/configure.in: Disable link tests for forced
	unwinding and C cleanup handling; always #define
	HAVE_FORCED_UNWIND and set libc_cv_c_cleanup.

Index: configure.in
===================================================================
--- configure.in	(revision 1452)
+++ configure.in	(working copy)
@@ -839,13 +839,15 @@
 LIBC_PROG_BINUTILS
 AC_SUBST(MIG)dnl Needed by sysdeps/mach/configure.in
 
-# Accept binutils 2.13 or newer.
+# Accept binutils 2.17 or newer.
 AC_CHECK_PROG_VER(AS, $AS, --version,
 		  [GNU assembler.* \([0-9]*\.[0-9.]*\)],
-		  [2.1[3-9]*], AS=: critic_missing="$critic_missing as")
+		  [2.1[7-9]* | 2.[2-9][0-9]* | [3-9].*],
+                  AS=: critic_missing="$critic_missing as")
 AC_CHECK_PROG_VER(LD, $LD, --version,
 		  [GNU ld.* \([0-9][0-9]*\.[0-9.]*\)],
-		  [2.1[3-9]*], LD=: critic_missing="$critic_missing ld")
+		  [2.1[7-9]* | 2.[2-9][0-9]* | [3-9].*],
+                  LD=: critic_missing="$critic_missing ld")
 
 # We need the physical current working directory.  We cannot use the
 # "pwd -P" shell builtin since that's not portable.  Instead we try to
@@ -859,8 +861,9 @@
 
 # These programs are version sensitive.
 AC_CHECK_TOOL_PREFIX
+# We require GCC 4.1 or later.
 AC_CHECK_PROG_VER(CC, ${ac_tool_prefix}gcc ${ac_tool_prefix}cc, -v,
-  [version \([egcygnustpi-]*[0-9.]*\)], [3.4* | 4.[0-9]* ],
+  [version [egcygnustpi-]*\([0-9.]*\)], [4.[1-9]* | [5-9].*],
   critic_missing="$critic_missing gcc")
 AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version,
   [GNU Make[^0-9]*\([0-9][0-9.]*\)],
Index: nptl/sysdeps/pthread/configure.in
===================================================================
--- nptl/sysdeps/pthread/configure.in	(revision 1452)
+++ nptl/sysdeps/pthread/configure.in	(working copy)
@@ -19,31 +19,41 @@
   esac
 fi
 
-dnl Iff <unwind.h> is available, make sure it is the right one and it
-dnl contains struct _Unwind_Exception.
-AC_CACHE_CHECK(dnl
-for forced unwind support, libc_cv_forced_unwind, [dnl
-AC_TRY_LINK([#include <unwind.h>], [
-struct _Unwind_Exception exc;
-struct _Unwind_Context *context;
-_Unwind_GetCFA (context)],
-libc_cv_forced_unwind=yes, libc_cv_forced_unwind=no)])
-if test $libc_cv_forced_unwind = yes; then
-  AC_DEFINE(HAVE_FORCED_UNWIND)
-dnl Check for C cleanup handling.
-  old_CFLAGS="$CFLAGS"
-  CFLAGS="$CFLAGS -Werror -fexceptions"
-  AC_CACHE_CHECK([for C cleanup handling], libc_cv_c_cleanup, [dnl
-  AC_TRY_LINK([
-#include <stdio.h>
-void cl (void *a) { }], [
-  int a __attribute__ ((cleanup (cl)));
-  puts ("test")],
-libc_cv_c_cleanup=yes, libc_cv_c_cleanup=no)])
-  CFLAGS="$old_CFLAGS"
-  if test $libc_cv_c_cleanup = no; then
-    AC_MSG_ERROR([the compiler must support C cleanup handling])
-  fi
-else
-  AC_MSG_ERROR(forced unwind support is required)
-fi
+dnl These link tests made bootstrapping EGLIBC difficult (how do you
+dnl link if you haven't built a libc yet?), and this test is only used
+dnl to produce an error message anyway.  We've already checked the
+dnl GCC, as, and ld versions in the top-level configure script, and we
+dnl only use the results of these tests to produce an error message,
+dnl so we just disable these tests entirely.
+dnl 
+dnl dnl Iff <unwind.h> is available, make sure it is the right one and it
+dnl dnl contains struct _Unwind_Exception.
+dnl AC_CACHE_CHECK(dnl
+dnl for forced unwind support, libc_cv_forced_unwind, [dnl
+dnl AC_TRY_LINK([#include <unwind.h>], [
+dnl struct _Unwind_Exception exc;
+dnl struct _Unwind_Context *context;
+dnl _Unwind_GetCFA (context)],
+dnl libc_cv_forced_unwind=yes, libc_cv_forced_unwind=no)])
+dnl if test $libc_cv_forced_unwind = yes; then
+dnl   AC_DEFINE(HAVE_FORCED_UNWIND)
+dnl dnl Check for C cleanup handling.
+dnl   old_CFLAGS="$CFLAGS"
+dnl   CFLAGS="$CFLAGS -Werror -fexceptions"
+dnl   AC_CACHE_CHECK([for C cleanup handling], libc_cv_c_cleanup, [dnl
+dnl   AC_TRY_LINK([
+dnl #include <stdio.h>
+dnl void cl (void *a) { }], [
+dnl   int a __attribute__ ((cleanup (cl)));
+dnl   puts ("test")],
+dnl libc_cv_c_cleanup=yes, libc_cv_c_cleanup=no)])
+dnl   CFLAGS="$old_CFLAGS"
+dnl   if test $libc_cv_c_cleanup = no; then
+dnl     AC_MSG_ERROR([the compiler must support C cleanup handling])
+dnl   fi
+dnl else
+dnl   AC_MSG_ERROR(forced unwind support is required)
+dnl fi
+libc_cv_forced_unwind=yes
+AC_DEFINE(HAVE_FORCED_UNWIND)
+libc_cv_c_cleanup=yes