autoconf-patches
[Top][All Lists]
Advanced

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

AC_NO_EXECUTABLES update for GCC


From: Daniel Jacobowitz
Subject: AC_NO_EXECUTABLES update for GCC
Date: Wed, 1 Oct 2003 19:31:26 -0400
User-agent: Mutt/1.5.1i

It turns out that AC_NO_EXECUTABLES wasn't quite what GCC needed.  Here's an
update, which is.  The difference is that it triggers off of
AC_NO_EXECUTABLES being encountered at runtime; so that link tests can
remain in the configure script but be avoided in the no-executables case. 
GCC's been using this for several months.

When moving it into autoconf proper this could either remain in one place,
or have the uses of m4_define/m4_defn replaced by moving the ac_no_link
tests to the normal definitions of those macros.  I don't know which is
nicer, but I'm sending this one since it's the version I've tested properly.

[This code triggers building target libiberty and target libstdc++ for
cross-compilers to Cygwin; they're built before newlib and winsup, so
nothing links yet.]

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

2003-10-01  Daniel Jacobowitz  <address@hidden>

        * lib/autoconf/lang.m4 (AC_NO_EXECUTABLES): Try to link.  If
        linking fails, override AC_LINK_IFELSE and AC_FUNC_MMAP.
        

Index: lang.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/lang.m4,v
retrieving revision 1.165
diff -u -p -r1.165 lang.m4
--- lang.m4     3 Sep 2003 00:35:53 -0000       1.165
+++ lang.m4     1 Oct 2003 23:21:56 -0000
@@ -351,8 +351,8 @@ AC_DEFUN([AC_REQUIRE_CPP],
 # -----------------
 # FIXME: The GCC team has specific needs which the current Autoconf
 # framework cannot solve elegantly.  This macro implements a dirty
-# hack until Autoconf is abble to provide the services its users
-# needs.
+# hack until Autoconf is able to provide the services its users
+# need.
 #
 # Several of the support libraries that are often built with GCC can't
 # assume the tool-chain is already capable of linking a program: the
@@ -363,26 +363,51 @@ AC_DEFUN([AC_REQUIRE_CPP],
 # avoid the AC_PROG_CC_WORKS test, that would just abort their
 # configuration.  The introduction of AC_EXEEXT, enabled either by
 # libtool or by CVS autoconf, have just made matters worse.
+#
+# Unlike an earlier version of this macro, using AC_NO_EXECUTABLES does
+# not disable link tests at autoconf time, but at configure time.
+# This allows AC_NO_EXECUTABLES to be invoked conditionally.
 AC_DEFUN_ONCE([AC_NO_EXECUTABLES],
 [m4_divert_push([KILL])
 
-AC_BEFORE([$0], [_AC_COMPILER_EXEEXT_WORKS])
 AC_BEFORE([$0], [_AC_COMPILER_EXEEXT])
-
-m4_define([_AC_COMPILER_EXEEXT_WORKS],
-[cross_compiling=maybe
-])
+AC_BEFORE([$0], [AC_LINK_IFELSE])
 
 m4_define([_AC_COMPILER_EXEEXT],
-[EXEEXT=
-])
+AC_LANG_CONFTEST([AC_LANG_PROGRAM()])
+AS_IF([AC_TRY_EVAL(ac_link)], [ac_no_link=no], [ac_no_link=yes])
+if test x$ac_no_link = xyes; then
+  # Setting cross_compile will disable run tests; it will
+  # also disable AC_CHECK_FILE but that's generally
+  # correct if we can't link.
+  cross_compiling=yes
+  EXEEXT=
+else
+  m4_defn([_AC_COMPILER_EXEEXT])dnl
+fi
+)
 
 m4_define([AC_LINK_IFELSE],
-[AC_FATAL([All the tests involving linking were disabled by $0])])
+if test x$ac_no_link = xyes; then
+  ac_tmp=AC
+  AC_MSG_ERROR([Link tests are not allowed after ${ac}_NO_EXECUTABLES.])
+fi
+m4_defn([AC_LINK_IFELSE]))
+
+dnl This is a shame.  We have to provide a default for some link tests,
+dnl similar to the default for run tests.
+m4_define([AC_FUNC_MMAP],
+if test x$ac_no_link = xyes; then
+  if test "x${ac_cv_func_mmap_fixed_mapped+set}" != xset; then
+    ac_cv_func_mmap_fixed_mapped=no
+  fi
+fi
+if test "x${ac_cv_func_mmap_fixed_mapped+set}" != xset; then
+  m4_defn([AC_FUNC_MMAP])
+fi)
 
 m4_divert_pop()dnl
 ])# AC_NO_EXECUTABLES
-
 
 
 # ----------------------------- #




reply via email to

[Prev in Thread] Current Thread [Next in Thread]