autoconf-patches
[Top][All Lists]
Advanced

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

Re: AC_NO_EXECUTABLES update for GCC


From: Daniel Jacobowitz
Subject: Re: AC_NO_EXECUTABLES update for GCC
Date: Thu, 2 Oct 2003 12:37:53 -0400
User-agent: Mutt/1.5.1i

On Wed, Oct 01, 2003 at 07:31:26PM -0400, Daniel Jacobowitz wrote:
> 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.]

Removed the MMAP hack, fixed the quoting.  So this one's a little
cleaner.

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

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

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     2 Oct 2003 14:43:37 -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,22 +363,39 @@ 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])
+m4_divert_text([DEFAULTS], [ac_no_link=no])
 
-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()])
+if AC_TRY_EVAL(ac_link); then
+  ac_no_link=no
+  ]m4_defn([_AC_COMPILER_EXEEXT])[
+else
+  ac_no_link=yes
+  # 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=
+  _AC_COMPILER_EXEEXT_CROSS
+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]))
 
 m4_divert_pop()dnl
 ])# AC_NO_EXECUTABLES


-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer




reply via email to

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