]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* lib/autoconf/lang.m4 (AC_NO_EXECUTABLES): Override
authorDaniel Jacobowitz <drow@mvista.com>
Mon, 20 Oct 2003 15:57:44 +0000 (15:57 +0000)
committerDaniel Jacobowitz <drow@mvista.com>
Mon, 20 Oct 2003 15:57:44 +0000 (15:57 +0000)
_AC_COMPILER_EXEEXT to attempt a link.  If linking fails,
override AC_LINK_IFELSE.

ChangeLog
lib/autoconf/lang.m4

index 9dd4c27674bff913cccea7aed9a08ab8b3f427e0..9444d16147116d76ab92b1ee64e48d0b6633fce8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2003-10-20  Daniel Jacobowitz  <drow@mvista.com>
+
+       * lib/autoconf/lang.m4 (AC_NO_EXECUTABLES): Override
+       _AC_COMPILER_EXEEXT to attempt a link.  If linking fails,
+       override AC_LINK_IFELSE.
+
 2003-10-15  Paul Eggert  <eggert@twinsun.com>
 
        * lib/m4sugar/m4sh.m4 (_AS_UNSET_PREPARE): Work around a bug in
index 605e30cde343c04f90ce30bcdafa4d9366cda747..05c9f4c8841076c549e8f5554ce71c2cb29a121d 100644 (file)
@@ -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,38 @@ 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_MSG_ERROR([Link tests are not allowed after AC@&t@_NO_EXECUTABLES.])
+fi
+]m4_defn([AC_LINK_IFELSE]))
 
 m4_divert_pop()dnl
 ])# AC_NO_EXECUTABLES