]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
The test suite fails on some hosts because for instance
authorAkim Demaille <akim@epita.fr>
Tue, 12 Sep 2000 13:59:55 +0000 (13:59 +0000)
committerAkim Demaille <akim@epita.fr>
Tue, 12 Sep 2000 13:59:55 +0000 (13:59 +0000)
  AC_INIT
  AC_CHECK_FUNC(exit)
will not look for a compiler, it will just use `cc'.
Macros that need a compiler should require one.

ChangeLog
acfunctions.m4
acgeneral.m4
aclang.m4
lib/autoconf/c.m4
lib/autoconf/fortran.m4
lib/autoconf/functions.m4
lib/autoconf/general.m4
lib/autoconf/lang.m4

index 2c253ebd5ffe97babee285d8a5a81f9c23fc929a..ad9999e11e5175d43f1aadfb2a2923a5f041e504 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2000-09-12  Akim Demaille  <akim@epita.fr>
+
+       The test suite fails on some hosts because for instance
+         AC_INIT
+         AC_CHECK_FUNC(exit)
+       will not look for a compiler, it will just use `cc'.
+       Macros that need a compiler should require one.
+
+       * acgeneral.m4 (_AC_REQUIRE): New macro, which is actually the
+       previous version of AC_REQUIRE plus the possibility to distinguish
+       the name of the symbol being AC_PROVIDE'd, and the text to expand.
+       (AC_REQUIRE): Reimplement in terms of _AC_REQUIRE.
+       * aclang.m4 (AC_LANG_COMPILER, AC_LANG_COMPILER_REQUIRE)
+       (AC_LANG_COMPILER(C), AC_LANG_COMPILER(C++))
+       (AC_LANG_COMPILER(Fortran 77)):
+       New macros.
+       * acgeneral.m4 (AC_COMPILE_IFELSE, AC_LINK_IFELSE, AC_RUN_IFELSE):
+       Require a compiler.
+       (AC_TRY_RUN): Formatting changes.
+       * acfunctions.m4 (AC_FUNC_SETPGRP): Quote properly.  The previous
+       changes revealed the weaknesses of this macro.
+
 2000-09-12  Pavel Roskin  <proski@gnu.org>
 
        * acgeneral.m4 (_AC_TRY_CPP): New macro. It runs the preprocessor
index 70322d3a5e65838c347a1ccc86460a713bd34e33..66b1c8872a0c236f1a64ecbf80c435d74a8683af 100644 (file)
@@ -1143,7 +1143,7 @@ AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG5, ($[3]),
 # ---------------
 AC_DEFUN([AC_FUNC_SETPGRP],
 [AC_CACHE_CHECK(whether setpgrp takes no argument, ac_cv_func_setpgrp_void,
-AC_TRY_RUN(
+[AC_TRY_RUN(
 [#if HAVE_UNISTD_H
 # include <unistd.h>
 #endif
@@ -1158,9 +1158,10 @@ main ()
     exit (0);
   else
     exit (1);
-}], ac_cv_func_setpgrp_void=no, ac_cv_func_setpgrp_void=yes,
-   AC_MSG_ERROR(cannot check setpgrp if cross compiling))
-)
+}],
+            [ac_cv_func_setpgrp_void=no],
+            [ac_cv_func_setpgrp_void=yes],
+            [AC_MSG_ERROR([cannot check setpgrp if cross compiling])])])
 if test $ac_cv_func_setpgrp_void = yes; then
   AC_DEFINE(SETPGRP_VOID, 1,
             [Define if the `setpgrp' function takes no argument.])
index ebf307b54c998ec4309f191a475b101325c38eea..9d228b78b32520a45258e669408e74c927c74ec7 100644 (file)
@@ -562,17 +562,41 @@ define([AC_BEFORE],
 [AC_PROVIDE_IFELSE([$2], [AC_DIAGNOSE([syntax], [$2 was called before $1])])])
 
 
-# AC_REQUIRE(MACRO-NAME)
-# ----------------------
-# If MACRO-NAME has never been expanded, expand it *before* the current
-# macro expansion.  Once expanded, emit it in _AC_DIVERT_DUMP.
-define([AC_REQUIRE],
+# _AC_REQUIRE(NAME-TO-CHECK, BODY-TO-EXPAND)
+# ------------------------------------------
+# If NAME-TO-CHECK has never been expanded (actually, if it is not
+# AC_PROVIDE'd), expand BODY-TO-EXPAND *before* the current macro
+# expansion.  Once expanded, emit it in _AC_DIVERT_DUMP.
+#
+# The normal cases are:
+#
+# - NAME-TO-CHECK == BODY-TO-EXPAND
+#   Which you can use for regular macros with or without arguments, e.g.,
+#     _AC_REQUIRE([AC_PROG_CC], [AC_PROG_CC])
+#     _AC_REQUIRE([AC_CHECK_HEADERS(limits.h)], [AC_CHECK_HEADERS(limits.h)])
+#
+# - BODY-TO-EXPAND == m4_indir([NAME-TO-CHECK])
+#   In the case of macros with irregular names.  For instance:
+#     _AC_REQUIRE([AC_LANG_COMPILER(C)], [indir([AC_LANG_COMPILER(C)])])
+#   which means `if the macro named `AC_LANG_COMPILER(C)' (the parens are
+#   part of the name, it is not an argument) has not been run, then
+#   call it.'
+#   Had you used
+#     _AC_REQUIRE([AC_LANG_COMPILER(C)], [AC_LANG_COMPILER(C)])
+#   then _AC_REQUIRE would have tried to expand `AC_LANG_COMPILER(C)', i.e.,
+#   call the macro `AC_LANG_COMPILER' with `C' as argument.
+#
+#   You could argue that `AC_LANG_COMPILER', when it receives an argument
+#   such as `C' should dispatch the call to `AC_LANG_COMPILER(C)'.  But this
+#   `extension' prevents `AC_LANG_COMPILER' from having actual arguments that
+#   it passes to `AC_LANG_COMPILER(C)'.
+define([_AC_REQUIRE],
 [ifndef([_AC_DIVERT_DUMP],
         [AC_FATAL([$0: cannot be used outside of an AC_DEFUN'd macro])])dnl
 AC_PROVIDE_IFELSE([$1],
                   [],
                   [AC_DIVERT_PUSH(m4_eval(_AC_DIVERT_DIVERSION - 1))dnl
-$1
+$2
 divert(_AC_DIVERT_DUMP)undivert(_AC_DIVERT_DIVERSION)dnl
 AC_DIVERT_POP()])dnl
 AC_PROVIDE_IFELSE([$1],
@@ -582,6 +606,13 @@ AC_PROVIDE_IFELSE([$1],
 ])
 
 
+# AC_REQUIRE(STRING)
+# ------------------
+# If STRING has never been AC_PROVIDE'd, then expand it.
+define([AC_REQUIRE],
+[_AC_REQUIRE([$1], [$1])])
+
+
 # AC_EXPAND_ONCE(TEXT)
 # --------------------
 # If TEXT has never been expanded, expand it *here*.
@@ -3339,7 +3370,8 @@ rm -f conftest*
 # --------------------------------------------------------------------
 # Try to compile PROGRAM.
 AC_DEFUN([AC_COMPILE_IFELSE],
-[m4_ifvanl([$1], [AC_LANG_CONFTEST([$1])])dnl
+[AC_LANG_COMPILER_REQUIRE()dnl
+m4_ifvanl([$1], [AC_LANG_CONFTEST([$1])])dnl
 if AC_TRY_EVAL(ac_compile) && test -s conftest.$ac_objext; then
   m4_default([$2], :)
 else
@@ -3368,7 +3400,8 @@ AC_DEFUN([AC_TRY_COMPILE],
 # -----------------------------------------------------------------
 # Try to link PROGRAM.
 AC_DEFUN([AC_LINK_IFELSE],
-[m4_ifvanl([$1], [AC_LANG_CONFTEST([$1])])dnl
+[AC_LANG_COMPILER_REQUIRE()dnl
+m4_ifvanl([$1], [AC_LANG_CONFTEST([$1])])dnl
 if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then
   m4_default([$2], :)
 else
@@ -3415,7 +3448,8 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[$2]], [[$3]])], [$4], [$5])
 # -----------------------------------------------------------
 # Compile, link, and run.
 AC_DEFUN([AC_RUN_IFELSE],
-[m4_ifvanl([$1], [AC_LANG_CONFTEST([$1])])dnl
+[AC_LANG_COMPILER_REQUIRE()dnl
+m4_ifvanl([$1], [AC_LANG_CONFTEST([$1])])dnl
 if AC_TRY_EVAL(ac_link) &&
    test -s conftest$ac_exeext && (./conftest; exit) 2>/dev/null; then
   m4_default([$2], :)
@@ -3433,11 +3467,12 @@ rm -f conftest.$ac_objext conftest$ac_exeext ifval([$1],
 #            [ACTION-IF-CROSS-COMPILING])
 # --------------------------------------------------------
 AC_DEFUN([AC_TRY_RUN],
-[if test "$cross_compiling" = yes; then
+[ifval([$4], [],
+       [AC_DIAGNOSE([cross],
+                    [$0 called without default to allow cross compiling])])dnl
+if test "$cross_compiling" = yes; then
   m4_default([$4],
-   [AC_DIAGNOSE([cross],
-            [AC_TRY_RUN called without default to allow cross compiling])dnl
-AC_MSG_ERROR(cannot run test program while cross compiling)])
+             [AC_MSG_ERROR(cannot run test program while cross compiling)])
 else
   AC_RUN_IFELSE([AC_LANG_SOURCE([[$1]])], [$2], [$3])
 fi
index 2cc134e734d3f538999fc5bc7deed8849060d341..6e266b32a78f5c04f3d9813e15b450905fd1647e 100644 (file)
--- a/aclang.m4
+++ b/aclang.m4
@@ -475,6 +475,23 @@ define([AC_LANG_CALL(Fortran 77)],
 # 3a. Generic routines in compilers and preprocessors.  #
 # ----------------------------------------------------- #
 
+# AC_LANG_COMPILER
+# ----------------
+# Find a compiler for the current LANG.  Note that because we might
+# AC_REQUIRE `AC_LANG_COMPILER(C)' for instance, the latter must be
+# AC_DEFUN'd, not just define'd.
+define([AC_LANG_COMPILER],
+[_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
+
+
+# AC_LANG_COMPILER_REQUIRE
+# ------------------------
+# Ensure we have a compiler for the current LANG.
+AC_DEFUN([AC_LANG_COMPILER_REQUIRE],
+[_AC_REQUIRE([AC_LANG_COMPILER(]_AC_LANG[)],
+             [indir([AC_LANG_COMPILER(]_AC_LANG[)])])])
+
+
 # AC_REQUIRE_CPP
 # --------------
 # Require finding the C or C++ preprocessor, whichever is the
@@ -625,6 +642,13 @@ AC_LANG_POP()dnl
 ])# AC_PROG_CPP
 
 
+# AC_LANG_COMPILER(C)
+# -------------------
+# Find the C compiler.  Must be AC_DEFUN'd to be AC_REQUIRE'able.
+AC_DEFUN([AC_LANG_COMPILER(C)],
+[AC_PROG_CC])
+
+
 # AC_PROG_CC([COMPILER ...])
 # --------------------------
 # COMPILER ... is a space separated list of C compilers to search for.
@@ -836,6 +860,13 @@ AC_LANG_POP()dnl
 ])# AC_PROG_CXXCPP
 
 
+# AC_LANG_COMPILER(C++)
+# ---------------------
+# Find the C++ compiler.  Must be AC_DEFUN'd to be AC_REQUIRE'able.
+AC_DEFUN([AC_LANG_COMPILER(C++)],
+[AC_PROG_CXX])
+
+
 # AC_PROG_CXX([LIST-OF-COMPILERS])
 # --------------------------------
 # LIST-OF-COMPILERS is a space separated list of C++ compilers to search
@@ -932,6 +963,14 @@ fi[]dnl
 # ----------------------------- #
 
 
+# AC_LANG_COMPILER(Fortran 77)
+# ----------------------------
+# Find the Fortran 77 compiler.  Must be AC_DEFUN'd to be
+# AC_REQUIRE'able.
+AC_DEFUN([AC_LANG_COMPILER(Fortran 77)],
+[AC_PROG_F77])
+
+
 # AC_PROG_F77([COMPILERS...])
 # ---------------------------
 # COMPILERS is a space separated list of Fortran 77 compilers to search
index 2cc134e734d3f538999fc5bc7deed8849060d341..6e266b32a78f5c04f3d9813e15b450905fd1647e 100644 (file)
@@ -475,6 +475,23 @@ define([AC_LANG_CALL(Fortran 77)],
 # 3a. Generic routines in compilers and preprocessors.  #
 # ----------------------------------------------------- #
 
+# AC_LANG_COMPILER
+# ----------------
+# Find a compiler for the current LANG.  Note that because we might
+# AC_REQUIRE `AC_LANG_COMPILER(C)' for instance, the latter must be
+# AC_DEFUN'd, not just define'd.
+define([AC_LANG_COMPILER],
+[_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
+
+
+# AC_LANG_COMPILER_REQUIRE
+# ------------------------
+# Ensure we have a compiler for the current LANG.
+AC_DEFUN([AC_LANG_COMPILER_REQUIRE],
+[_AC_REQUIRE([AC_LANG_COMPILER(]_AC_LANG[)],
+             [indir([AC_LANG_COMPILER(]_AC_LANG[)])])])
+
+
 # AC_REQUIRE_CPP
 # --------------
 # Require finding the C or C++ preprocessor, whichever is the
@@ -625,6 +642,13 @@ AC_LANG_POP()dnl
 ])# AC_PROG_CPP
 
 
+# AC_LANG_COMPILER(C)
+# -------------------
+# Find the C compiler.  Must be AC_DEFUN'd to be AC_REQUIRE'able.
+AC_DEFUN([AC_LANG_COMPILER(C)],
+[AC_PROG_CC])
+
+
 # AC_PROG_CC([COMPILER ...])
 # --------------------------
 # COMPILER ... is a space separated list of C compilers to search for.
@@ -836,6 +860,13 @@ AC_LANG_POP()dnl
 ])# AC_PROG_CXXCPP
 
 
+# AC_LANG_COMPILER(C++)
+# ---------------------
+# Find the C++ compiler.  Must be AC_DEFUN'd to be AC_REQUIRE'able.
+AC_DEFUN([AC_LANG_COMPILER(C++)],
+[AC_PROG_CXX])
+
+
 # AC_PROG_CXX([LIST-OF-COMPILERS])
 # --------------------------------
 # LIST-OF-COMPILERS is a space separated list of C++ compilers to search
@@ -932,6 +963,14 @@ fi[]dnl
 # ----------------------------- #
 
 
+# AC_LANG_COMPILER(Fortran 77)
+# ----------------------------
+# Find the Fortran 77 compiler.  Must be AC_DEFUN'd to be
+# AC_REQUIRE'able.
+AC_DEFUN([AC_LANG_COMPILER(Fortran 77)],
+[AC_PROG_F77])
+
+
 # AC_PROG_F77([COMPILERS...])
 # ---------------------------
 # COMPILERS is a space separated list of Fortran 77 compilers to search
index 2cc134e734d3f538999fc5bc7deed8849060d341..6e266b32a78f5c04f3d9813e15b450905fd1647e 100644 (file)
@@ -475,6 +475,23 @@ define([AC_LANG_CALL(Fortran 77)],
 # 3a. Generic routines in compilers and preprocessors.  #
 # ----------------------------------------------------- #
 
+# AC_LANG_COMPILER
+# ----------------
+# Find a compiler for the current LANG.  Note that because we might
+# AC_REQUIRE `AC_LANG_COMPILER(C)' for instance, the latter must be
+# AC_DEFUN'd, not just define'd.
+define([AC_LANG_COMPILER],
+[_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
+
+
+# AC_LANG_COMPILER_REQUIRE
+# ------------------------
+# Ensure we have a compiler for the current LANG.
+AC_DEFUN([AC_LANG_COMPILER_REQUIRE],
+[_AC_REQUIRE([AC_LANG_COMPILER(]_AC_LANG[)],
+             [indir([AC_LANG_COMPILER(]_AC_LANG[)])])])
+
+
 # AC_REQUIRE_CPP
 # --------------
 # Require finding the C or C++ preprocessor, whichever is the
@@ -625,6 +642,13 @@ AC_LANG_POP()dnl
 ])# AC_PROG_CPP
 
 
+# AC_LANG_COMPILER(C)
+# -------------------
+# Find the C compiler.  Must be AC_DEFUN'd to be AC_REQUIRE'able.
+AC_DEFUN([AC_LANG_COMPILER(C)],
+[AC_PROG_CC])
+
+
 # AC_PROG_CC([COMPILER ...])
 # --------------------------
 # COMPILER ... is a space separated list of C compilers to search for.
@@ -836,6 +860,13 @@ AC_LANG_POP()dnl
 ])# AC_PROG_CXXCPP
 
 
+# AC_LANG_COMPILER(C++)
+# ---------------------
+# Find the C++ compiler.  Must be AC_DEFUN'd to be AC_REQUIRE'able.
+AC_DEFUN([AC_LANG_COMPILER(C++)],
+[AC_PROG_CXX])
+
+
 # AC_PROG_CXX([LIST-OF-COMPILERS])
 # --------------------------------
 # LIST-OF-COMPILERS is a space separated list of C++ compilers to search
@@ -932,6 +963,14 @@ fi[]dnl
 # ----------------------------- #
 
 
+# AC_LANG_COMPILER(Fortran 77)
+# ----------------------------
+# Find the Fortran 77 compiler.  Must be AC_DEFUN'd to be
+# AC_REQUIRE'able.
+AC_DEFUN([AC_LANG_COMPILER(Fortran 77)],
+[AC_PROG_F77])
+
+
 # AC_PROG_F77([COMPILERS...])
 # ---------------------------
 # COMPILERS is a space separated list of Fortran 77 compilers to search
index 70322d3a5e65838c347a1ccc86460a713bd34e33..66b1c8872a0c236f1a64ecbf80c435d74a8683af 100644 (file)
@@ -1143,7 +1143,7 @@ AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG5, ($[3]),
 # ---------------
 AC_DEFUN([AC_FUNC_SETPGRP],
 [AC_CACHE_CHECK(whether setpgrp takes no argument, ac_cv_func_setpgrp_void,
-AC_TRY_RUN(
+[AC_TRY_RUN(
 [#if HAVE_UNISTD_H
 # include <unistd.h>
 #endif
@@ -1158,9 +1158,10 @@ main ()
     exit (0);
   else
     exit (1);
-}], ac_cv_func_setpgrp_void=no, ac_cv_func_setpgrp_void=yes,
-   AC_MSG_ERROR(cannot check setpgrp if cross compiling))
-)
+}],
+            [ac_cv_func_setpgrp_void=no],
+            [ac_cv_func_setpgrp_void=yes],
+            [AC_MSG_ERROR([cannot check setpgrp if cross compiling])])])
 if test $ac_cv_func_setpgrp_void = yes; then
   AC_DEFINE(SETPGRP_VOID, 1,
             [Define if the `setpgrp' function takes no argument.])
index ebf307b54c998ec4309f191a475b101325c38eea..9d228b78b32520a45258e669408e74c927c74ec7 100644 (file)
@@ -562,17 +562,41 @@ define([AC_BEFORE],
 [AC_PROVIDE_IFELSE([$2], [AC_DIAGNOSE([syntax], [$2 was called before $1])])])
 
 
-# AC_REQUIRE(MACRO-NAME)
-# ----------------------
-# If MACRO-NAME has never been expanded, expand it *before* the current
-# macro expansion.  Once expanded, emit it in _AC_DIVERT_DUMP.
-define([AC_REQUIRE],
+# _AC_REQUIRE(NAME-TO-CHECK, BODY-TO-EXPAND)
+# ------------------------------------------
+# If NAME-TO-CHECK has never been expanded (actually, if it is not
+# AC_PROVIDE'd), expand BODY-TO-EXPAND *before* the current macro
+# expansion.  Once expanded, emit it in _AC_DIVERT_DUMP.
+#
+# The normal cases are:
+#
+# - NAME-TO-CHECK == BODY-TO-EXPAND
+#   Which you can use for regular macros with or without arguments, e.g.,
+#     _AC_REQUIRE([AC_PROG_CC], [AC_PROG_CC])
+#     _AC_REQUIRE([AC_CHECK_HEADERS(limits.h)], [AC_CHECK_HEADERS(limits.h)])
+#
+# - BODY-TO-EXPAND == m4_indir([NAME-TO-CHECK])
+#   In the case of macros with irregular names.  For instance:
+#     _AC_REQUIRE([AC_LANG_COMPILER(C)], [indir([AC_LANG_COMPILER(C)])])
+#   which means `if the macro named `AC_LANG_COMPILER(C)' (the parens are
+#   part of the name, it is not an argument) has not been run, then
+#   call it.'
+#   Had you used
+#     _AC_REQUIRE([AC_LANG_COMPILER(C)], [AC_LANG_COMPILER(C)])
+#   then _AC_REQUIRE would have tried to expand `AC_LANG_COMPILER(C)', i.e.,
+#   call the macro `AC_LANG_COMPILER' with `C' as argument.
+#
+#   You could argue that `AC_LANG_COMPILER', when it receives an argument
+#   such as `C' should dispatch the call to `AC_LANG_COMPILER(C)'.  But this
+#   `extension' prevents `AC_LANG_COMPILER' from having actual arguments that
+#   it passes to `AC_LANG_COMPILER(C)'.
+define([_AC_REQUIRE],
 [ifndef([_AC_DIVERT_DUMP],
         [AC_FATAL([$0: cannot be used outside of an AC_DEFUN'd macro])])dnl
 AC_PROVIDE_IFELSE([$1],
                   [],
                   [AC_DIVERT_PUSH(m4_eval(_AC_DIVERT_DIVERSION - 1))dnl
-$1
+$2
 divert(_AC_DIVERT_DUMP)undivert(_AC_DIVERT_DIVERSION)dnl
 AC_DIVERT_POP()])dnl
 AC_PROVIDE_IFELSE([$1],
@@ -582,6 +606,13 @@ AC_PROVIDE_IFELSE([$1],
 ])
 
 
+# AC_REQUIRE(STRING)
+# ------------------
+# If STRING has never been AC_PROVIDE'd, then expand it.
+define([AC_REQUIRE],
+[_AC_REQUIRE([$1], [$1])])
+
+
 # AC_EXPAND_ONCE(TEXT)
 # --------------------
 # If TEXT has never been expanded, expand it *here*.
@@ -3339,7 +3370,8 @@ rm -f conftest*
 # --------------------------------------------------------------------
 # Try to compile PROGRAM.
 AC_DEFUN([AC_COMPILE_IFELSE],
-[m4_ifvanl([$1], [AC_LANG_CONFTEST([$1])])dnl
+[AC_LANG_COMPILER_REQUIRE()dnl
+m4_ifvanl([$1], [AC_LANG_CONFTEST([$1])])dnl
 if AC_TRY_EVAL(ac_compile) && test -s conftest.$ac_objext; then
   m4_default([$2], :)
 else
@@ -3368,7 +3400,8 @@ AC_DEFUN([AC_TRY_COMPILE],
 # -----------------------------------------------------------------
 # Try to link PROGRAM.
 AC_DEFUN([AC_LINK_IFELSE],
-[m4_ifvanl([$1], [AC_LANG_CONFTEST([$1])])dnl
+[AC_LANG_COMPILER_REQUIRE()dnl
+m4_ifvanl([$1], [AC_LANG_CONFTEST([$1])])dnl
 if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then
   m4_default([$2], :)
 else
@@ -3415,7 +3448,8 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[$2]], [[$3]])], [$4], [$5])
 # -----------------------------------------------------------
 # Compile, link, and run.
 AC_DEFUN([AC_RUN_IFELSE],
-[m4_ifvanl([$1], [AC_LANG_CONFTEST([$1])])dnl
+[AC_LANG_COMPILER_REQUIRE()dnl
+m4_ifvanl([$1], [AC_LANG_CONFTEST([$1])])dnl
 if AC_TRY_EVAL(ac_link) &&
    test -s conftest$ac_exeext && (./conftest; exit) 2>/dev/null; then
   m4_default([$2], :)
@@ -3433,11 +3467,12 @@ rm -f conftest.$ac_objext conftest$ac_exeext ifval([$1],
 #            [ACTION-IF-CROSS-COMPILING])
 # --------------------------------------------------------
 AC_DEFUN([AC_TRY_RUN],
-[if test "$cross_compiling" = yes; then
+[ifval([$4], [],
+       [AC_DIAGNOSE([cross],
+                    [$0 called without default to allow cross compiling])])dnl
+if test "$cross_compiling" = yes; then
   m4_default([$4],
-   [AC_DIAGNOSE([cross],
-            [AC_TRY_RUN called without default to allow cross compiling])dnl
-AC_MSG_ERROR(cannot run test program while cross compiling)])
+             [AC_MSG_ERROR(cannot run test program while cross compiling)])
 else
   AC_RUN_IFELSE([AC_LANG_SOURCE([[$1]])], [$2], [$3])
 fi
index 2cc134e734d3f538999fc5bc7deed8849060d341..6e266b32a78f5c04f3d9813e15b450905fd1647e 100644 (file)
@@ -475,6 +475,23 @@ define([AC_LANG_CALL(Fortran 77)],
 # 3a. Generic routines in compilers and preprocessors.  #
 # ----------------------------------------------------- #
 
+# AC_LANG_COMPILER
+# ----------------
+# Find a compiler for the current LANG.  Note that because we might
+# AC_REQUIRE `AC_LANG_COMPILER(C)' for instance, the latter must be
+# AC_DEFUN'd, not just define'd.
+define([AC_LANG_COMPILER],
+[_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
+
+
+# AC_LANG_COMPILER_REQUIRE
+# ------------------------
+# Ensure we have a compiler for the current LANG.
+AC_DEFUN([AC_LANG_COMPILER_REQUIRE],
+[_AC_REQUIRE([AC_LANG_COMPILER(]_AC_LANG[)],
+             [indir([AC_LANG_COMPILER(]_AC_LANG[)])])])
+
+
 # AC_REQUIRE_CPP
 # --------------
 # Require finding the C or C++ preprocessor, whichever is the
@@ -625,6 +642,13 @@ AC_LANG_POP()dnl
 ])# AC_PROG_CPP
 
 
+# AC_LANG_COMPILER(C)
+# -------------------
+# Find the C compiler.  Must be AC_DEFUN'd to be AC_REQUIRE'able.
+AC_DEFUN([AC_LANG_COMPILER(C)],
+[AC_PROG_CC])
+
+
 # AC_PROG_CC([COMPILER ...])
 # --------------------------
 # COMPILER ... is a space separated list of C compilers to search for.
@@ -836,6 +860,13 @@ AC_LANG_POP()dnl
 ])# AC_PROG_CXXCPP
 
 
+# AC_LANG_COMPILER(C++)
+# ---------------------
+# Find the C++ compiler.  Must be AC_DEFUN'd to be AC_REQUIRE'able.
+AC_DEFUN([AC_LANG_COMPILER(C++)],
+[AC_PROG_CXX])
+
+
 # AC_PROG_CXX([LIST-OF-COMPILERS])
 # --------------------------------
 # LIST-OF-COMPILERS is a space separated list of C++ compilers to search
@@ -932,6 +963,14 @@ fi[]dnl
 # ----------------------------- #
 
 
+# AC_LANG_COMPILER(Fortran 77)
+# ----------------------------
+# Find the Fortran 77 compiler.  Must be AC_DEFUN'd to be
+# AC_REQUIRE'able.
+AC_DEFUN([AC_LANG_COMPILER(Fortran 77)],
+[AC_PROG_F77])
+
+
 # AC_PROG_F77([COMPILERS...])
 # ---------------------------
 # COMPILERS is a space separated list of Fortran 77 compilers to search