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.
This commit is contained in:
Akim Demaille 2000-09-12 13:59:55 +00:00
parent 58e8d5c397
commit 368c1810a2
9 changed files with 284 additions and 34 deletions

View File

@ -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> 2000-09-12 Pavel Roskin <proski@gnu.org>
* acgeneral.m4 (_AC_TRY_CPP): New macro. It runs the preprocessor * acgeneral.m4 (_AC_TRY_CPP): New macro. It runs the preprocessor

View File

@ -1143,7 +1143,7 @@ AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG5, ($[3]),
# --------------- # ---------------
AC_DEFUN([AC_FUNC_SETPGRP], AC_DEFUN([AC_FUNC_SETPGRP],
[AC_CACHE_CHECK(whether setpgrp takes no argument, ac_cv_func_setpgrp_void, [AC_CACHE_CHECK(whether setpgrp takes no argument, ac_cv_func_setpgrp_void,
AC_TRY_RUN( [AC_TRY_RUN(
[#if HAVE_UNISTD_H [#if HAVE_UNISTD_H
# include <unistd.h> # include <unistd.h>
#endif #endif
@ -1158,9 +1158,10 @@ main ()
exit (0); exit (0);
else else
exit (1); 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 if test $ac_cv_func_setpgrp_void = yes; then
AC_DEFINE(SETPGRP_VOID, 1, AC_DEFINE(SETPGRP_VOID, 1,
[Define if the `setpgrp' function takes no argument.]) [Define if the `setpgrp' function takes no argument.])

View File

@ -562,17 +562,41 @@ define([AC_BEFORE],
[AC_PROVIDE_IFELSE([$2], [AC_DIAGNOSE([syntax], [$2 was called before $1])])]) [AC_PROVIDE_IFELSE([$2], [AC_DIAGNOSE([syntax], [$2 was called before $1])])])
# AC_REQUIRE(MACRO-NAME) # _AC_REQUIRE(NAME-TO-CHECK, BODY-TO-EXPAND)
# ---------------------- # ------------------------------------------
# If MACRO-NAME has never been expanded, expand it *before* the current # If NAME-TO-CHECK has never been expanded (actually, if it is not
# macro expansion. Once expanded, emit it in _AC_DIVERT_DUMP. # AC_PROVIDE'd), expand BODY-TO-EXPAND *before* the current macro
define([AC_REQUIRE], # 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], [ifndef([_AC_DIVERT_DUMP],
[AC_FATAL([$0: cannot be used outside of an AC_DEFUN'd macro])])dnl [AC_FATAL([$0: cannot be used outside of an AC_DEFUN'd macro])])dnl
AC_PROVIDE_IFELSE([$1], AC_PROVIDE_IFELSE([$1],
[], [],
[AC_DIVERT_PUSH(m4_eval(_AC_DIVERT_DIVERSION - 1))dnl [AC_DIVERT_PUSH(m4_eval(_AC_DIVERT_DIVERSION - 1))dnl
$1 $2
divert(_AC_DIVERT_DUMP)undivert(_AC_DIVERT_DIVERSION)dnl divert(_AC_DIVERT_DUMP)undivert(_AC_DIVERT_DIVERSION)dnl
AC_DIVERT_POP()])dnl AC_DIVERT_POP()])dnl
AC_PROVIDE_IFELSE([$1], 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) # AC_EXPAND_ONCE(TEXT)
# -------------------- # --------------------
# If TEXT has never been expanded, expand it *here*. # If TEXT has never been expanded, expand it *here*.
@ -3339,7 +3370,8 @@ rm -f conftest*
# -------------------------------------------------------------------- # --------------------------------------------------------------------
# Try to compile PROGRAM. # Try to compile PROGRAM.
AC_DEFUN([AC_COMPILE_IFELSE], 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 if AC_TRY_EVAL(ac_compile) && test -s conftest.$ac_objext; then
m4_default([$2], :) m4_default([$2], :)
else else
@ -3368,7 +3400,8 @@ AC_DEFUN([AC_TRY_COMPILE],
# ----------------------------------------------------------------- # -----------------------------------------------------------------
# Try to link PROGRAM. # Try to link PROGRAM.
AC_DEFUN([AC_LINK_IFELSE], 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 if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then
m4_default([$2], :) m4_default([$2], :)
else else
@ -3415,7 +3448,8 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[$2]], [[$3]])], [$4], [$5])
# ----------------------------------------------------------- # -----------------------------------------------------------
# Compile, link, and run. # Compile, link, and run.
AC_DEFUN([AC_RUN_IFELSE], 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) && if AC_TRY_EVAL(ac_link) &&
test -s conftest$ac_exeext && (./conftest; exit) 2>/dev/null; then test -s conftest$ac_exeext && (./conftest; exit) 2>/dev/null; then
m4_default([$2], :) m4_default([$2], :)
@ -3433,11 +3467,12 @@ rm -f conftest.$ac_objext conftest$ac_exeext ifval([$1],
# [ACTION-IF-CROSS-COMPILING]) # [ACTION-IF-CROSS-COMPILING])
# -------------------------------------------------------- # --------------------------------------------------------
AC_DEFUN([AC_TRY_RUN], 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], m4_default([$4],
[AC_DIAGNOSE([cross], [AC_MSG_ERROR(cannot run test program while cross compiling)])
[AC_TRY_RUN called without default to allow cross compiling])dnl
AC_MSG_ERROR(cannot run test program while cross compiling)])
else else
AC_RUN_IFELSE([AC_LANG_SOURCE([[$1]])], [$2], [$3]) AC_RUN_IFELSE([AC_LANG_SOURCE([[$1]])], [$2], [$3])
fi fi

View File

@ -475,6 +475,23 @@ define([AC_LANG_CALL(Fortran 77)],
# 3a. Generic routines in compilers and preprocessors. # # 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 # AC_REQUIRE_CPP
# -------------- # --------------
# Require finding the C or C++ preprocessor, whichever is the # Require finding the C or C++ preprocessor, whichever is the
@ -625,6 +642,13 @@ AC_LANG_POP()dnl
])# AC_PROG_CPP ])# 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 ...]) # AC_PROG_CC([COMPILER ...])
# -------------------------- # --------------------------
# COMPILER ... is a space separated list of C compilers to search for. # COMPILER ... is a space separated list of C compilers to search for.
@ -836,6 +860,13 @@ AC_LANG_POP()dnl
])# AC_PROG_CXXCPP ])# 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]) # AC_PROG_CXX([LIST-OF-COMPILERS])
# -------------------------------- # --------------------------------
# LIST-OF-COMPILERS is a space separated list of C++ compilers to search # 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...]) # AC_PROG_F77([COMPILERS...])
# --------------------------- # ---------------------------
# COMPILERS is a space separated list of Fortran 77 compilers to search # COMPILERS is a space separated list of Fortran 77 compilers to search

View File

@ -475,6 +475,23 @@ define([AC_LANG_CALL(Fortran 77)],
# 3a. Generic routines in compilers and preprocessors. # # 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 # AC_REQUIRE_CPP
# -------------- # --------------
# Require finding the C or C++ preprocessor, whichever is the # Require finding the C or C++ preprocessor, whichever is the
@ -625,6 +642,13 @@ AC_LANG_POP()dnl
])# AC_PROG_CPP ])# 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 ...]) # AC_PROG_CC([COMPILER ...])
# -------------------------- # --------------------------
# COMPILER ... is a space separated list of C compilers to search for. # COMPILER ... is a space separated list of C compilers to search for.
@ -836,6 +860,13 @@ AC_LANG_POP()dnl
])# AC_PROG_CXXCPP ])# 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]) # AC_PROG_CXX([LIST-OF-COMPILERS])
# -------------------------------- # --------------------------------
# LIST-OF-COMPILERS is a space separated list of C++ compilers to search # 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...]) # AC_PROG_F77([COMPILERS...])
# --------------------------- # ---------------------------
# COMPILERS is a space separated list of Fortran 77 compilers to search # COMPILERS is a space separated list of Fortran 77 compilers to search

View File

@ -475,6 +475,23 @@ define([AC_LANG_CALL(Fortran 77)],
# 3a. Generic routines in compilers and preprocessors. # # 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 # AC_REQUIRE_CPP
# -------------- # --------------
# Require finding the C or C++ preprocessor, whichever is the # Require finding the C or C++ preprocessor, whichever is the
@ -625,6 +642,13 @@ AC_LANG_POP()dnl
])# AC_PROG_CPP ])# 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 ...]) # AC_PROG_CC([COMPILER ...])
# -------------------------- # --------------------------
# COMPILER ... is a space separated list of C compilers to search for. # COMPILER ... is a space separated list of C compilers to search for.
@ -836,6 +860,13 @@ AC_LANG_POP()dnl
])# AC_PROG_CXXCPP ])# 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]) # AC_PROG_CXX([LIST-OF-COMPILERS])
# -------------------------------- # --------------------------------
# LIST-OF-COMPILERS is a space separated list of C++ compilers to search # 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...]) # AC_PROG_F77([COMPILERS...])
# --------------------------- # ---------------------------
# COMPILERS is a space separated list of Fortran 77 compilers to search # COMPILERS is a space separated list of Fortran 77 compilers to search

View File

@ -1143,7 +1143,7 @@ AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG5, ($[3]),
# --------------- # ---------------
AC_DEFUN([AC_FUNC_SETPGRP], AC_DEFUN([AC_FUNC_SETPGRP],
[AC_CACHE_CHECK(whether setpgrp takes no argument, ac_cv_func_setpgrp_void, [AC_CACHE_CHECK(whether setpgrp takes no argument, ac_cv_func_setpgrp_void,
AC_TRY_RUN( [AC_TRY_RUN(
[#if HAVE_UNISTD_H [#if HAVE_UNISTD_H
# include <unistd.h> # include <unistd.h>
#endif #endif
@ -1158,9 +1158,10 @@ main ()
exit (0); exit (0);
else else
exit (1); 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 if test $ac_cv_func_setpgrp_void = yes; then
AC_DEFINE(SETPGRP_VOID, 1, AC_DEFINE(SETPGRP_VOID, 1,
[Define if the `setpgrp' function takes no argument.]) [Define if the `setpgrp' function takes no argument.])

View File

@ -562,17 +562,41 @@ define([AC_BEFORE],
[AC_PROVIDE_IFELSE([$2], [AC_DIAGNOSE([syntax], [$2 was called before $1])])]) [AC_PROVIDE_IFELSE([$2], [AC_DIAGNOSE([syntax], [$2 was called before $1])])])
# AC_REQUIRE(MACRO-NAME) # _AC_REQUIRE(NAME-TO-CHECK, BODY-TO-EXPAND)
# ---------------------- # ------------------------------------------
# If MACRO-NAME has never been expanded, expand it *before* the current # If NAME-TO-CHECK has never been expanded (actually, if it is not
# macro expansion. Once expanded, emit it in _AC_DIVERT_DUMP. # AC_PROVIDE'd), expand BODY-TO-EXPAND *before* the current macro
define([AC_REQUIRE], # 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], [ifndef([_AC_DIVERT_DUMP],
[AC_FATAL([$0: cannot be used outside of an AC_DEFUN'd macro])])dnl [AC_FATAL([$0: cannot be used outside of an AC_DEFUN'd macro])])dnl
AC_PROVIDE_IFELSE([$1], AC_PROVIDE_IFELSE([$1],
[], [],
[AC_DIVERT_PUSH(m4_eval(_AC_DIVERT_DIVERSION - 1))dnl [AC_DIVERT_PUSH(m4_eval(_AC_DIVERT_DIVERSION - 1))dnl
$1 $2
divert(_AC_DIVERT_DUMP)undivert(_AC_DIVERT_DIVERSION)dnl divert(_AC_DIVERT_DUMP)undivert(_AC_DIVERT_DIVERSION)dnl
AC_DIVERT_POP()])dnl AC_DIVERT_POP()])dnl
AC_PROVIDE_IFELSE([$1], 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) # AC_EXPAND_ONCE(TEXT)
# -------------------- # --------------------
# If TEXT has never been expanded, expand it *here*. # If TEXT has never been expanded, expand it *here*.
@ -3339,7 +3370,8 @@ rm -f conftest*
# -------------------------------------------------------------------- # --------------------------------------------------------------------
# Try to compile PROGRAM. # Try to compile PROGRAM.
AC_DEFUN([AC_COMPILE_IFELSE], 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 if AC_TRY_EVAL(ac_compile) && test -s conftest.$ac_objext; then
m4_default([$2], :) m4_default([$2], :)
else else
@ -3368,7 +3400,8 @@ AC_DEFUN([AC_TRY_COMPILE],
# ----------------------------------------------------------------- # -----------------------------------------------------------------
# Try to link PROGRAM. # Try to link PROGRAM.
AC_DEFUN([AC_LINK_IFELSE], 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 if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then
m4_default([$2], :) m4_default([$2], :)
else else
@ -3415,7 +3448,8 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[$2]], [[$3]])], [$4], [$5])
# ----------------------------------------------------------- # -----------------------------------------------------------
# Compile, link, and run. # Compile, link, and run.
AC_DEFUN([AC_RUN_IFELSE], 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) && if AC_TRY_EVAL(ac_link) &&
test -s conftest$ac_exeext && (./conftest; exit) 2>/dev/null; then test -s conftest$ac_exeext && (./conftest; exit) 2>/dev/null; then
m4_default([$2], :) m4_default([$2], :)
@ -3433,11 +3467,12 @@ rm -f conftest.$ac_objext conftest$ac_exeext ifval([$1],
# [ACTION-IF-CROSS-COMPILING]) # [ACTION-IF-CROSS-COMPILING])
# -------------------------------------------------------- # --------------------------------------------------------
AC_DEFUN([AC_TRY_RUN], 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], m4_default([$4],
[AC_DIAGNOSE([cross], [AC_MSG_ERROR(cannot run test program while cross compiling)])
[AC_TRY_RUN called without default to allow cross compiling])dnl
AC_MSG_ERROR(cannot run test program while cross compiling)])
else else
AC_RUN_IFELSE([AC_LANG_SOURCE([[$1]])], [$2], [$3]) AC_RUN_IFELSE([AC_LANG_SOURCE([[$1]])], [$2], [$3])
fi fi

View File

@ -475,6 +475,23 @@ define([AC_LANG_CALL(Fortran 77)],
# 3a. Generic routines in compilers and preprocessors. # # 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 # AC_REQUIRE_CPP
# -------------- # --------------
# Require finding the C or C++ preprocessor, whichever is the # Require finding the C or C++ preprocessor, whichever is the
@ -625,6 +642,13 @@ AC_LANG_POP()dnl
])# AC_PROG_CPP ])# 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 ...]) # AC_PROG_CC([COMPILER ...])
# -------------------------- # --------------------------
# COMPILER ... is a space separated list of C compilers to search for. # COMPILER ... is a space separated list of C compilers to search for.
@ -836,6 +860,13 @@ AC_LANG_POP()dnl
])# AC_PROG_CXXCPP ])# 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]) # AC_PROG_CXX([LIST-OF-COMPILERS])
# -------------------------------- # --------------------------------
# LIST-OF-COMPILERS is a space separated list of C++ compilers to search # 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...]) # AC_PROG_F77([COMPILERS...])
# --------------------------- # ---------------------------
# COMPILERS is a space separated list of Fortran 77 compilers to search # COMPILERS is a space separated list of Fortran 77 compilers to search