Various cleanups and consistency checks.

* m4sugar.m4: Formatting changes.
* acgeneral.m4 (AC_DIVERT_PUSH, AC_DIVERT_POP, AC_REQUIRE)
(AC_DIAGNOSE, AC_FATAL, AC_MSG_WARN, AC_MSG_NOTICE, AC_MSG_ERROR):
Use m4_copy to define them, in order to keep a good $0.
(AC_INIT): AC_LANG_PUSH C, not AC_LANG, to initialize the stack.
* aclang.m4 (AC_LANG_PUSH): Dont't use m4_defn on undefined macros.
(AC_LANG_POP): Admit an argument specifying the language we quit
when popping.
Adjust Autoconf's AC_LANG_POPs.
* tests/tools.at (AWK portability): Don't depend on AC_INIT.
(autoconf --trace: user macros): Obviously I
meant TRACE1, not AC_TRACE1.
This commit is contained in:
Akim Demaille 2001-01-18 09:15:31 +00:00
parent 8a3c7070bd
commit 70b6f5cc93
11 changed files with 200 additions and 162 deletions

View File

@ -1,3 +1,20 @@
2001-01-18 Akim Demaille <akim@epita.fr>
Various cleanups and consistency checks.
* m4sugar.m4: Formatting changes.
* acgeneral.m4 (AC_DIVERT_PUSH, AC_DIVERT_POP, AC_REQUIRE)
(AC_DIAGNOSE, AC_FATAL, AC_MSG_WARN, AC_MSG_NOTICE, AC_MSG_ERROR):
Use m4_copy to define them, in order to keep a good $0.
(AC_INIT): AC_LANG_PUSH C, not AC_LANG, to initialize the stack.
* aclang.m4 (AC_LANG_PUSH): Dont't use m4_defn on undefined macros.
(AC_LANG_POP): Admit an argument specifying the language we quit
when popping.
Adjust Autoconf's AC_LANG_POPs.
* tests/tools.at (AWK portability): Don't depend on AC_INIT.
(autoconf --trace: user macros): Obviously I
meant TRACE1, not AC_TRACE1.
2001-01-17 Akim Demaille <akim@epita.fr>
* m4sugar.m4 (m4_undefine, m4_popdef): Don't tolerate undefined

View File

@ -143,15 +143,10 @@ m4_define([AC_DIVERT_ONCE],
# AC_DIVERT_PUSH(DIVERSION-NAME)
# ------------------------------
m4_define([AC_DIVERT_PUSH],
[m4_divert_push($@)])
# AC_DIVERT_POP
# -------------
m4_define([AC_DIVERT_POP],
[m4_divert_pop($@)])
# ------------------------------
m4_copy([m4_divert_push],[AC_DIVERT_PUSH])
m4_copy([m4_divert_pop], [AC_DIVERT_POP])
# Throw away output until AC_INIT is called.
@ -209,8 +204,7 @@ m4_define([AC_BEFORE],
# ------------------
# If STRING has never been AC_PROVIDE'd, then expand it. A macro must
# be AC_DEFUN'd if either it is AC_REQUIRE'd, or it AC_REQUIRE's.
m4_define([AC_REQUIRE],
[m4_require([$1])])
m4_copy([m4_require], [AC_REQUIRE])
# AC_EXPAND_ONCE(TEXT)
@ -1491,7 +1485,7 @@ _AC_ARG_VAR_VALIDATE
_AC_ARG_VAR_PRECIOUS(build_alias)dnl
_AC_ARG_VAR_PRECIOUS(host_alias)dnl
_AC_ARG_VAR_PRECIOUS(target_alias)dnl
AC_LANG(C)
AC_LANG_PUSH(C)
_AC_PROG_ECHO()dnl
dnl Substitute for predefined variables.
@ -2139,11 +2133,10 @@ s,@$1@,,;t t])])
# AC_DIAGNOSE(CATEGORY, MESSAGE)
# ------------------------------
# Report a MESSAGE to the user of autoconf if `-W' or `-W all' was
# specified.
m4_define([AC_DIAGNOSE],
[m4_warn($@)])
# AC_FATAL(MESSAGE, [EXIT-STATUS])
# --------------------------------
m4_copy([m4_warn], [AC_DIAGNOSE])
m4_copy([m4_fatal], [AC_FATAL])
# AC_WARNING(MESSAGE)
@ -2154,12 +2147,6 @@ m4_define([AC_WARNING],
[AC_DIAGNOSE([syntax], [$1])])
# AC_FATAL(MESSAGE, [EXIT-STATUS])
# --------------------------------
m4_define([AC_FATAL],
[m4_fatal($@)])
## ---------------------------------------- ##
@ -2204,9 +2191,9 @@ _AS_ECHO_UNQUOTED([${ECHO_T}$1])[]dnl
# AC_MSG_NOTICE(STRING)
# AC_MSG_ERROR(ERROR, [EXIT-STATUS = 1])
# --------------------------------------
m4_define([AC_MSG_WARN], [AS_WARN($@)])
m4_define([AC_MSG_NOTICE], [AS_MESSAGE($@)])
m4_define([AC_MSG_ERROR], [AS_ERROR($@)])
m4_copy([AS_WARN], [AC_MSG_WARN])
m4_copy([AS_MESSAGE], [AC_MSG_NOTICE])
m4_copy([AS_ERROR], [AC_MSG_ERROR])
# AU::AC_CHECKING(FEATURE)

View File

@ -111,14 +111,10 @@ m4_define([_AC_LANG_DISPATCH],
# AC_LANG(LANG)
# -------------
# Set the current language to LANG.
#
# Do *not* write AC_LANG([$1]), because this pair of parens does not
# correspond to an evaluation, rather, they are just part of the name.
# If you add quotes here, they will be part of the name too, yielding
# `AC_LANG([C])' for instance, which does not exist.
AC_DEFUN([AC_LANG],
[m4_if(m4_defn([_AC_LANG]), [$1], [],
[m4_define([_AC_LANG], [$1])dnl
[m4_ifdef([_AC_LANG],
[m4_if(m4_defn([_AC_LANG]), [$1], [],
[m4_define([_AC_LANG], [$1])])dnl
_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])])
@ -126,15 +122,21 @@ _AC_LANG_DISPATCH([$0], _AC_LANG, $@)])])
# ------------------
# Save the current language, and use LANG.
m4_define([AC_LANG_PUSH],
[m4_pushdef([_AC_LANG], m4_defn([_AC_LANG]))dnl
[m4_pushdef([_AC_LANG],
m4_ifdef([_AC_LANG],
[m4_defn([_AC_LANG])]))dnl
AC_LANG([$1])])
# AC_LANG_POP
# -----------
# Restore the previous language.
# AC_LANG_POP([LANG])
# -------------------
# If given, check that the current language is LANG, and restore the
# previous language.
m4_define([AC_LANG_POP],
[m4_popdef([_AC_LANG])dnl
[m4_ifval([$1],
[m4_if([$1], m4_defn([_AC_LANG]), [],
[m4_fatal([$0($1): unexpected current language: ]_AC_LANG)])])dnl
m4_popdef([_AC_LANG])dnl
m4_if(_AC_LANG, [_AC_LANG], [AC_FATAL([too many $0])])dnl
AC_LANG(_AC_LANG)])
@ -822,7 +824,7 @@ if test -n "$ac_cpp_err"; then
AC_MSG_ERROR([C preprocessor "$CPP" fails sanity check])
fi
AC_SUBST(CPP)dnl
AC_LANG_POP()dnl
AC_LANG_POP(C)dnl
])# AC_PROG_CPP
@ -846,7 +848,7 @@ AU_DEFUN([ac_cv_prog_gcc],
# This just gives the user an opportunity to specify an alternative
# search list for the C compiler.
AC_DEFUN([AC_PROG_CC],
[AC_LANG_PUSH(C)
[AC_LANG_PUSH(C)dnl
AC_ARG_VAR([CC], [C compiler command])
AC_ARG_VAR([CFLAGS], [C compiler flags])
m4_ifval([$1],
@ -879,7 +881,7 @@ _AC_COMPILE_IFELSE([@%:@ifndef __cplusplus
choke me
@%:@endif],
[_AC_PROG_CXX_EXIT_DECLARATION])
AC_LANG_POP
AC_LANG_POP(C)dnl
])# AC_PROG_CC
@ -1031,7 +1033,7 @@ if test -n "$ac_cpp_err"; then
AC_MSG_ERROR([C++ preprocessor "$CXXCPP" fails sanity check])
fi
AC_SUBST(CXXCPP)dnl
AC_LANG_POP()dnl
AC_LANG_POP(C++)dnl
])# AC_PROG_CXXCPP
@ -1076,7 +1078,7 @@ AC_EXPAND_ONCE([_AC_COMPILER_OBJEXT])[]dnl
AC_EXPAND_ONCE([_AC_COMPILER_EXEEXT])[]dnl
_AC_PROG_CXX_G
_AC_PROG_CXX_EXIT_DECLARATION
AC_LANG_POP
AC_LANG_POP(C++)dnl
])# AC_PROG_CXX
@ -1201,7 +1203,7 @@ G77=`test $ac_compiler_gnu = yes && echo yes`
AC_EXPAND_ONCE([_AC_COMPILER_OBJEXT])[]dnl
AC_EXPAND_ONCE([_AC_COMPILER_EXEEXT])[]dnl
_AC_PROG_F77_G
AC_LANG_POP
AC_LANG_POP(Fortran 77)dnl
])# AC_PROG_F77
@ -1641,7 +1643,7 @@ echo "$ac_f77_v_output" >&AS_MESSAGE_LOG_FD
FFLAGS=$ac_save_FFLAGS
rm -f conftest.*
AC_LANG_POP()dnl
AC_LANG_POP(Fortran 77)dnl
# If we are using xlf then replace all the commas with spaces.
if echo $ac_f77_v_output | grep xlfentry >/dev/null 2>&1; then
@ -1796,7 +1798,7 @@ fi # test "x$FLIBS" = "x"
])
FLIBS="$ac_cv_flibs"
AC_SUBST(FLIBS)
AC_LANG_POP()dnl
AC_LANG_POP(Fortran 77)dnl
])# AC_F77_LIBRARY_LDFLAGS
@ -1882,9 +1884,9 @@ AC_COMPILE_IFELSE(
fi
LIBS=$ac_save_LIBS
AC_LANG_POP()dnl
AC_LANG_POP(C)dnl
rm -f cf77_test* conftest*])
AC_LANG_POP()dnl
AC_LANG_POP(Fortran 77)dnl
])
])# _AC_F77_NAME_MANGLING

View File

@ -6498,10 +6498,21 @@ then select the @var{language}. Use this macro and @code{AC_LANG_POP}
in macros that need to temporarily switch to a particular language.
@end defmac
@defmac AC_LANG_POP
@defmac AC_LANG_POP (@ovar{language})
@maindex LANG_POP
Select the language that is saved on the top of the stack, as set by
@code{AC_LANG_PUSH}, and remove it from the stack.
If given, @var{language} specifies the language we just @emph{quit}. It
is a good idea to specify it when it's known (which should be the
case...), since Autoconf will track inconsistencies.
@example
AC_LANG_PUSH(Fortran 77)
# Perform some tests on Fortran 77.
# ...
AC_LANG_POP(Fortran 77)
@end example
@end defmac
@defmac AC_REQUIRE_CPP

View File

@ -111,14 +111,10 @@ m4_define([_AC_LANG_DISPATCH],
# AC_LANG(LANG)
# -------------
# Set the current language to LANG.
#
# Do *not* write AC_LANG([$1]), because this pair of parens does not
# correspond to an evaluation, rather, they are just part of the name.
# If you add quotes here, they will be part of the name too, yielding
# `AC_LANG([C])' for instance, which does not exist.
AC_DEFUN([AC_LANG],
[m4_if(m4_defn([_AC_LANG]), [$1], [],
[m4_define([_AC_LANG], [$1])dnl
[m4_ifdef([_AC_LANG],
[m4_if(m4_defn([_AC_LANG]), [$1], [],
[m4_define([_AC_LANG], [$1])])dnl
_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])])
@ -126,15 +122,21 @@ _AC_LANG_DISPATCH([$0], _AC_LANG, $@)])])
# ------------------
# Save the current language, and use LANG.
m4_define([AC_LANG_PUSH],
[m4_pushdef([_AC_LANG], m4_defn([_AC_LANG]))dnl
[m4_pushdef([_AC_LANG],
m4_ifdef([_AC_LANG],
[m4_defn([_AC_LANG])]))dnl
AC_LANG([$1])])
# AC_LANG_POP
# -----------
# Restore the previous language.
# AC_LANG_POP([LANG])
# -------------------
# If given, check that the current language is LANG, and restore the
# previous language.
m4_define([AC_LANG_POP],
[m4_popdef([_AC_LANG])dnl
[m4_ifval([$1],
[m4_if([$1], m4_defn([_AC_LANG]), [],
[m4_fatal([$0($1): unexpected current language: ]_AC_LANG)])])dnl
m4_popdef([_AC_LANG])dnl
m4_if(_AC_LANG, [_AC_LANG], [AC_FATAL([too many $0])])dnl
AC_LANG(_AC_LANG)])
@ -822,7 +824,7 @@ if test -n "$ac_cpp_err"; then
AC_MSG_ERROR([C preprocessor "$CPP" fails sanity check])
fi
AC_SUBST(CPP)dnl
AC_LANG_POP()dnl
AC_LANG_POP(C)dnl
])# AC_PROG_CPP
@ -846,7 +848,7 @@ AU_DEFUN([ac_cv_prog_gcc],
# This just gives the user an opportunity to specify an alternative
# search list for the C compiler.
AC_DEFUN([AC_PROG_CC],
[AC_LANG_PUSH(C)
[AC_LANG_PUSH(C)dnl
AC_ARG_VAR([CC], [C compiler command])
AC_ARG_VAR([CFLAGS], [C compiler flags])
m4_ifval([$1],
@ -879,7 +881,7 @@ _AC_COMPILE_IFELSE([@%:@ifndef __cplusplus
choke me
@%:@endif],
[_AC_PROG_CXX_EXIT_DECLARATION])
AC_LANG_POP
AC_LANG_POP(C)dnl
])# AC_PROG_CC
@ -1031,7 +1033,7 @@ if test -n "$ac_cpp_err"; then
AC_MSG_ERROR([C++ preprocessor "$CXXCPP" fails sanity check])
fi
AC_SUBST(CXXCPP)dnl
AC_LANG_POP()dnl
AC_LANG_POP(C++)dnl
])# AC_PROG_CXXCPP
@ -1076,7 +1078,7 @@ AC_EXPAND_ONCE([_AC_COMPILER_OBJEXT])[]dnl
AC_EXPAND_ONCE([_AC_COMPILER_EXEEXT])[]dnl
_AC_PROG_CXX_G
_AC_PROG_CXX_EXIT_DECLARATION
AC_LANG_POP
AC_LANG_POP(C++)dnl
])# AC_PROG_CXX
@ -1201,7 +1203,7 @@ G77=`test $ac_compiler_gnu = yes && echo yes`
AC_EXPAND_ONCE([_AC_COMPILER_OBJEXT])[]dnl
AC_EXPAND_ONCE([_AC_COMPILER_EXEEXT])[]dnl
_AC_PROG_F77_G
AC_LANG_POP
AC_LANG_POP(Fortran 77)dnl
])# AC_PROG_F77
@ -1641,7 +1643,7 @@ echo "$ac_f77_v_output" >&AS_MESSAGE_LOG_FD
FFLAGS=$ac_save_FFLAGS
rm -f conftest.*
AC_LANG_POP()dnl
AC_LANG_POP(Fortran 77)dnl
# If we are using xlf then replace all the commas with spaces.
if echo $ac_f77_v_output | grep xlfentry >/dev/null 2>&1; then
@ -1796,7 +1798,7 @@ fi # test "x$FLIBS" = "x"
])
FLIBS="$ac_cv_flibs"
AC_SUBST(FLIBS)
AC_LANG_POP()dnl
AC_LANG_POP(Fortran 77)dnl
])# AC_F77_LIBRARY_LDFLAGS
@ -1882,9 +1884,9 @@ AC_COMPILE_IFELSE(
fi
LIBS=$ac_save_LIBS
AC_LANG_POP()dnl
AC_LANG_POP(C)dnl
rm -f cf77_test* conftest*])
AC_LANG_POP()dnl
AC_LANG_POP(Fortran 77)dnl
])
])# _AC_F77_NAME_MANGLING

View File

@ -111,14 +111,10 @@ m4_define([_AC_LANG_DISPATCH],
# AC_LANG(LANG)
# -------------
# Set the current language to LANG.
#
# Do *not* write AC_LANG([$1]), because this pair of parens does not
# correspond to an evaluation, rather, they are just part of the name.
# If you add quotes here, they will be part of the name too, yielding
# `AC_LANG([C])' for instance, which does not exist.
AC_DEFUN([AC_LANG],
[m4_if(m4_defn([_AC_LANG]), [$1], [],
[m4_define([_AC_LANG], [$1])dnl
[m4_ifdef([_AC_LANG],
[m4_if(m4_defn([_AC_LANG]), [$1], [],
[m4_define([_AC_LANG], [$1])])dnl
_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])])
@ -126,15 +122,21 @@ _AC_LANG_DISPATCH([$0], _AC_LANG, $@)])])
# ------------------
# Save the current language, and use LANG.
m4_define([AC_LANG_PUSH],
[m4_pushdef([_AC_LANG], m4_defn([_AC_LANG]))dnl
[m4_pushdef([_AC_LANG],
m4_ifdef([_AC_LANG],
[m4_defn([_AC_LANG])]))dnl
AC_LANG([$1])])
# AC_LANG_POP
# -----------
# Restore the previous language.
# AC_LANG_POP([LANG])
# -------------------
# If given, check that the current language is LANG, and restore the
# previous language.
m4_define([AC_LANG_POP],
[m4_popdef([_AC_LANG])dnl
[m4_ifval([$1],
[m4_if([$1], m4_defn([_AC_LANG]), [],
[m4_fatal([$0($1): unexpected current language: ]_AC_LANG)])])dnl
m4_popdef([_AC_LANG])dnl
m4_if(_AC_LANG, [_AC_LANG], [AC_FATAL([too many $0])])dnl
AC_LANG(_AC_LANG)])
@ -822,7 +824,7 @@ if test -n "$ac_cpp_err"; then
AC_MSG_ERROR([C preprocessor "$CPP" fails sanity check])
fi
AC_SUBST(CPP)dnl
AC_LANG_POP()dnl
AC_LANG_POP(C)dnl
])# AC_PROG_CPP
@ -846,7 +848,7 @@ AU_DEFUN([ac_cv_prog_gcc],
# This just gives the user an opportunity to specify an alternative
# search list for the C compiler.
AC_DEFUN([AC_PROG_CC],
[AC_LANG_PUSH(C)
[AC_LANG_PUSH(C)dnl
AC_ARG_VAR([CC], [C compiler command])
AC_ARG_VAR([CFLAGS], [C compiler flags])
m4_ifval([$1],
@ -879,7 +881,7 @@ _AC_COMPILE_IFELSE([@%:@ifndef __cplusplus
choke me
@%:@endif],
[_AC_PROG_CXX_EXIT_DECLARATION])
AC_LANG_POP
AC_LANG_POP(C)dnl
])# AC_PROG_CC
@ -1031,7 +1033,7 @@ if test -n "$ac_cpp_err"; then
AC_MSG_ERROR([C++ preprocessor "$CXXCPP" fails sanity check])
fi
AC_SUBST(CXXCPP)dnl
AC_LANG_POP()dnl
AC_LANG_POP(C++)dnl
])# AC_PROG_CXXCPP
@ -1076,7 +1078,7 @@ AC_EXPAND_ONCE([_AC_COMPILER_OBJEXT])[]dnl
AC_EXPAND_ONCE([_AC_COMPILER_EXEEXT])[]dnl
_AC_PROG_CXX_G
_AC_PROG_CXX_EXIT_DECLARATION
AC_LANG_POP
AC_LANG_POP(C++)dnl
])# AC_PROG_CXX
@ -1201,7 +1203,7 @@ G77=`test $ac_compiler_gnu = yes && echo yes`
AC_EXPAND_ONCE([_AC_COMPILER_OBJEXT])[]dnl
AC_EXPAND_ONCE([_AC_COMPILER_EXEEXT])[]dnl
_AC_PROG_F77_G
AC_LANG_POP
AC_LANG_POP(Fortran 77)dnl
])# AC_PROG_F77
@ -1641,7 +1643,7 @@ echo "$ac_f77_v_output" >&AS_MESSAGE_LOG_FD
FFLAGS=$ac_save_FFLAGS
rm -f conftest.*
AC_LANG_POP()dnl
AC_LANG_POP(Fortran 77)dnl
# If we are using xlf then replace all the commas with spaces.
if echo $ac_f77_v_output | grep xlfentry >/dev/null 2>&1; then
@ -1796,7 +1798,7 @@ fi # test "x$FLIBS" = "x"
])
FLIBS="$ac_cv_flibs"
AC_SUBST(FLIBS)
AC_LANG_POP()dnl
AC_LANG_POP(Fortran 77)dnl
])# AC_F77_LIBRARY_LDFLAGS
@ -1882,9 +1884,9 @@ AC_COMPILE_IFELSE(
fi
LIBS=$ac_save_LIBS
AC_LANG_POP()dnl
AC_LANG_POP(C)dnl
rm -f cf77_test* conftest*])
AC_LANG_POP()dnl
AC_LANG_POP(Fortran 77)dnl
])
])# _AC_F77_NAME_MANGLING

View File

@ -143,15 +143,10 @@ m4_define([AC_DIVERT_ONCE],
# AC_DIVERT_PUSH(DIVERSION-NAME)
# ------------------------------
m4_define([AC_DIVERT_PUSH],
[m4_divert_push($@)])
# AC_DIVERT_POP
# -------------
m4_define([AC_DIVERT_POP],
[m4_divert_pop($@)])
# ------------------------------
m4_copy([m4_divert_push],[AC_DIVERT_PUSH])
m4_copy([m4_divert_pop], [AC_DIVERT_POP])
# Throw away output until AC_INIT is called.
@ -209,8 +204,7 @@ m4_define([AC_BEFORE],
# ------------------
# If STRING has never been AC_PROVIDE'd, then expand it. A macro must
# be AC_DEFUN'd if either it is AC_REQUIRE'd, or it AC_REQUIRE's.
m4_define([AC_REQUIRE],
[m4_require([$1])])
m4_copy([m4_require], [AC_REQUIRE])
# AC_EXPAND_ONCE(TEXT)
@ -1491,7 +1485,7 @@ _AC_ARG_VAR_VALIDATE
_AC_ARG_VAR_PRECIOUS(build_alias)dnl
_AC_ARG_VAR_PRECIOUS(host_alias)dnl
_AC_ARG_VAR_PRECIOUS(target_alias)dnl
AC_LANG(C)
AC_LANG_PUSH(C)
_AC_PROG_ECHO()dnl
dnl Substitute for predefined variables.
@ -2139,11 +2133,10 @@ s,@$1@,,;t t])])
# AC_DIAGNOSE(CATEGORY, MESSAGE)
# ------------------------------
# Report a MESSAGE to the user of autoconf if `-W' or `-W all' was
# specified.
m4_define([AC_DIAGNOSE],
[m4_warn($@)])
# AC_FATAL(MESSAGE, [EXIT-STATUS])
# --------------------------------
m4_copy([m4_warn], [AC_DIAGNOSE])
m4_copy([m4_fatal], [AC_FATAL])
# AC_WARNING(MESSAGE)
@ -2154,12 +2147,6 @@ m4_define([AC_WARNING],
[AC_DIAGNOSE([syntax], [$1])])
# AC_FATAL(MESSAGE, [EXIT-STATUS])
# --------------------------------
m4_define([AC_FATAL],
[m4_fatal($@)])
## ---------------------------------------- ##
@ -2204,9 +2191,9 @@ _AS_ECHO_UNQUOTED([${ECHO_T}$1])[]dnl
# AC_MSG_NOTICE(STRING)
# AC_MSG_ERROR(ERROR, [EXIT-STATUS = 1])
# --------------------------------------
m4_define([AC_MSG_WARN], [AS_WARN($@)])
m4_define([AC_MSG_NOTICE], [AS_MESSAGE($@)])
m4_define([AC_MSG_ERROR], [AS_ERROR($@)])
m4_copy([AS_WARN], [AC_MSG_WARN])
m4_copy([AS_MESSAGE], [AC_MSG_NOTICE])
m4_copy([AS_ERROR], [AC_MSG_ERROR])
# AU::AC_CHECKING(FEATURE)

View File

@ -111,14 +111,10 @@ m4_define([_AC_LANG_DISPATCH],
# AC_LANG(LANG)
# -------------
# Set the current language to LANG.
#
# Do *not* write AC_LANG([$1]), because this pair of parens does not
# correspond to an evaluation, rather, they are just part of the name.
# If you add quotes here, they will be part of the name too, yielding
# `AC_LANG([C])' for instance, which does not exist.
AC_DEFUN([AC_LANG],
[m4_if(m4_defn([_AC_LANG]), [$1], [],
[m4_define([_AC_LANG], [$1])dnl
[m4_ifdef([_AC_LANG],
[m4_if(m4_defn([_AC_LANG]), [$1], [],
[m4_define([_AC_LANG], [$1])])dnl
_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])])
@ -126,15 +122,21 @@ _AC_LANG_DISPATCH([$0], _AC_LANG, $@)])])
# ------------------
# Save the current language, and use LANG.
m4_define([AC_LANG_PUSH],
[m4_pushdef([_AC_LANG], m4_defn([_AC_LANG]))dnl
[m4_pushdef([_AC_LANG],
m4_ifdef([_AC_LANG],
[m4_defn([_AC_LANG])]))dnl
AC_LANG([$1])])
# AC_LANG_POP
# -----------
# Restore the previous language.
# AC_LANG_POP([LANG])
# -------------------
# If given, check that the current language is LANG, and restore the
# previous language.
m4_define([AC_LANG_POP],
[m4_popdef([_AC_LANG])dnl
[m4_ifval([$1],
[m4_if([$1], m4_defn([_AC_LANG]), [],
[m4_fatal([$0($1): unexpected current language: ]_AC_LANG)])])dnl
m4_popdef([_AC_LANG])dnl
m4_if(_AC_LANG, [_AC_LANG], [AC_FATAL([too many $0])])dnl
AC_LANG(_AC_LANG)])
@ -822,7 +824,7 @@ if test -n "$ac_cpp_err"; then
AC_MSG_ERROR([C preprocessor "$CPP" fails sanity check])
fi
AC_SUBST(CPP)dnl
AC_LANG_POP()dnl
AC_LANG_POP(C)dnl
])# AC_PROG_CPP
@ -846,7 +848,7 @@ AU_DEFUN([ac_cv_prog_gcc],
# This just gives the user an opportunity to specify an alternative
# search list for the C compiler.
AC_DEFUN([AC_PROG_CC],
[AC_LANG_PUSH(C)
[AC_LANG_PUSH(C)dnl
AC_ARG_VAR([CC], [C compiler command])
AC_ARG_VAR([CFLAGS], [C compiler flags])
m4_ifval([$1],
@ -879,7 +881,7 @@ _AC_COMPILE_IFELSE([@%:@ifndef __cplusplus
choke me
@%:@endif],
[_AC_PROG_CXX_EXIT_DECLARATION])
AC_LANG_POP
AC_LANG_POP(C)dnl
])# AC_PROG_CC
@ -1031,7 +1033,7 @@ if test -n "$ac_cpp_err"; then
AC_MSG_ERROR([C++ preprocessor "$CXXCPP" fails sanity check])
fi
AC_SUBST(CXXCPP)dnl
AC_LANG_POP()dnl
AC_LANG_POP(C++)dnl
])# AC_PROG_CXXCPP
@ -1076,7 +1078,7 @@ AC_EXPAND_ONCE([_AC_COMPILER_OBJEXT])[]dnl
AC_EXPAND_ONCE([_AC_COMPILER_EXEEXT])[]dnl
_AC_PROG_CXX_G
_AC_PROG_CXX_EXIT_DECLARATION
AC_LANG_POP
AC_LANG_POP(C++)dnl
])# AC_PROG_CXX
@ -1201,7 +1203,7 @@ G77=`test $ac_compiler_gnu = yes && echo yes`
AC_EXPAND_ONCE([_AC_COMPILER_OBJEXT])[]dnl
AC_EXPAND_ONCE([_AC_COMPILER_EXEEXT])[]dnl
_AC_PROG_F77_G
AC_LANG_POP
AC_LANG_POP(Fortran 77)dnl
])# AC_PROG_F77
@ -1641,7 +1643,7 @@ echo "$ac_f77_v_output" >&AS_MESSAGE_LOG_FD
FFLAGS=$ac_save_FFLAGS
rm -f conftest.*
AC_LANG_POP()dnl
AC_LANG_POP(Fortran 77)dnl
# If we are using xlf then replace all the commas with spaces.
if echo $ac_f77_v_output | grep xlfentry >/dev/null 2>&1; then
@ -1796,7 +1798,7 @@ fi # test "x$FLIBS" = "x"
])
FLIBS="$ac_cv_flibs"
AC_SUBST(FLIBS)
AC_LANG_POP()dnl
AC_LANG_POP(Fortran 77)dnl
])# AC_F77_LIBRARY_LDFLAGS
@ -1882,9 +1884,9 @@ AC_COMPILE_IFELSE(
fi
LIBS=$ac_save_LIBS
AC_LANG_POP()dnl
AC_LANG_POP(C)dnl
rm -f cf77_test* conftest*])
AC_LANG_POP()dnl
AC_LANG_POP(Fortran 77)dnl
])
])# _AC_F77_NAME_MANGLING

View File

@ -81,6 +81,14 @@ m4_undefine([undefine])
# m4_copy(SRC, DST)
# -----------------
# Define DST as the definition of SRC.
# What's the difference between:
# 1. m4_copy([from], [to])
# 2. m4_define([from], [to($@)])
# Well, obviously 1 is more expansive in space. Maybe 2 is more expansive
# in time, but because of the space cost of 1, it's not that obvious.
# Nevertheless, one huge difference is the handling of `$0'. If `from'
# uses `$0', then with 1, `to''s `$0' is `to', while it is `from' in 2.
# The user will certainly prefer see `from'.
m4_define([m4_copy],
[m4_define([$2], m4_defn([$1]))])
@ -534,8 +542,7 @@ m4_builtin([undefine], $@)])
# m4_for(VARIABLE, FIRST, LAST, [STEP = +/-1], EXPRESSION)
# --------------------------------------------------------
# Expand EXPRESSION defining VARIABLE to FROM, FROM + 1, ..., TO.
# Both limits are included.
# Both limits are included, and bounds are checked for consistency.
m4_define([m4_for],
[m4_case(m4_sign(m4_eval($3 - $2)),
1, [m4_assert(m4_sign(m4_default($4, 1)) == 1)],
@ -546,6 +553,10 @@ m4_if(m4_eval([$3 > $2]), 1,
[_m4_for([$1], [$3], m4_default([$4], -1), [$5])])dnl
m4_popdef([$1])])
# _m4_for(VARIABLE, FIRST, LAST, STEP, EXPRESSION)
# ------------------------------------------------
# Core of the loop, no consistency checks.
m4_define([_m4_for],
[$4[]dnl
m4_if($1, [$2], [],
@ -666,10 +677,10 @@ m4_define([_m4_foreach],
## --------------------------- ##
# _m4_divert(DIBERSION-NAME or NUMBER)
# _m4_divert(DIVERSION-NAME or NUMBER)
# ------------------------------------
# If DIVERSION-NAME is the name of a diversion, return its number, otherwise
# return makeNUMBER.
# If DIVERSION-NAME is the name of a diversion, return its number,
# otherwise if is a NUMBER return it.
m4_define([_m4_divert],
[m4_ifdef([_m4_divert($1)],
[m4_indir([_m4_divert($1)])],
@ -1064,8 +1075,8 @@ m4_divert_pop()dnl
# -----------------------------
m4_define([m4_expansion_stack_push],
[m4_pushdef([m4_expansion_stack],
[$1]
m4_defn([m4_expansion_stack]))])
[$1]m4_ifdef([m4_expansion_stack], [
m4_defn([m4_expansion_stack])]))])
# m4_expansion_stack_pop
@ -1079,7 +1090,8 @@ m4_define([m4_expansion_stack_pop],
# -----------------------
# Dump the expansion stack.
m4_define([m4_expansion_stack_dump],
[m4_errprint(m4_defn([m4_expansion_stack]))dnl
[m4_ifdef([m4_expansion_stack],
[m4_errprintn(m4_defn([m4_expansion_stack]))])dnl
m4_errprintn(m4_location[: the top level])])

View File

@ -81,6 +81,14 @@ m4_undefine([undefine])
# m4_copy(SRC, DST)
# -----------------
# Define DST as the definition of SRC.
# What's the difference between:
# 1. m4_copy([from], [to])
# 2. m4_define([from], [to($@)])
# Well, obviously 1 is more expansive in space. Maybe 2 is more expansive
# in time, but because of the space cost of 1, it's not that obvious.
# Nevertheless, one huge difference is the handling of `$0'. If `from'
# uses `$0', then with 1, `to''s `$0' is `to', while it is `from' in 2.
# The user will certainly prefer see `from'.
m4_define([m4_copy],
[m4_define([$2], m4_defn([$1]))])
@ -534,8 +542,7 @@ m4_builtin([undefine], $@)])
# m4_for(VARIABLE, FIRST, LAST, [STEP = +/-1], EXPRESSION)
# --------------------------------------------------------
# Expand EXPRESSION defining VARIABLE to FROM, FROM + 1, ..., TO.
# Both limits are included.
# Both limits are included, and bounds are checked for consistency.
m4_define([m4_for],
[m4_case(m4_sign(m4_eval($3 - $2)),
1, [m4_assert(m4_sign(m4_default($4, 1)) == 1)],
@ -546,6 +553,10 @@ m4_if(m4_eval([$3 > $2]), 1,
[_m4_for([$1], [$3], m4_default([$4], -1), [$5])])dnl
m4_popdef([$1])])
# _m4_for(VARIABLE, FIRST, LAST, STEP, EXPRESSION)
# ------------------------------------------------
# Core of the loop, no consistency checks.
m4_define([_m4_for],
[$4[]dnl
m4_if($1, [$2], [],
@ -666,10 +677,10 @@ m4_define([_m4_foreach],
## --------------------------- ##
# _m4_divert(DIBERSION-NAME or NUMBER)
# _m4_divert(DIVERSION-NAME or NUMBER)
# ------------------------------------
# If DIVERSION-NAME is the name of a diversion, return its number, otherwise
# return makeNUMBER.
# If DIVERSION-NAME is the name of a diversion, return its number,
# otherwise if is a NUMBER return it.
m4_define([_m4_divert],
[m4_ifdef([_m4_divert($1)],
[m4_indir([_m4_divert($1)])],
@ -1064,8 +1075,8 @@ m4_divert_pop()dnl
# -----------------------------
m4_define([m4_expansion_stack_push],
[m4_pushdef([m4_expansion_stack],
[$1]
m4_defn([m4_expansion_stack]))])
[$1]m4_ifdef([m4_expansion_stack], [
m4_defn([m4_expansion_stack])]))])
# m4_expansion_stack_pop
@ -1079,7 +1090,8 @@ m4_define([m4_expansion_stack_pop],
# -----------------------
# Dump the expansion stack.
m4_define([m4_expansion_stack_dump],
[m4_errprint(m4_defn([m4_expansion_stack]))dnl
[m4_ifdef([m4_expansion_stack],
[m4_errprintn(m4_defn([m4_expansion_stack]))])dnl
m4_errprintn(m4_location[: the top level])])

View File

@ -75,8 +75,7 @@ AT_CLEANUP
AT_SETUP([AWK portability])
AT_DATA([configure.ac],
[[AC_INIT
]])
[])
if (gawk --version) >/dev/null 2>&1; then
# Generation of the script.
@ -111,7 +110,7 @@ AT_DATA(configure.ac,
AC_DEFUN([TRACE1], [TRACE2(m4_shift($@))])
AC_DEFUN([TRACE2], [[$2], $1])
TRACE1(foo, bar, baz)
TRACE1(foo, AC_TRACE1(bar, baz))
TRACE1(foo, TRACE1(bar, baz))
TRACE1(foo, active, baz)
TRACE1(foo, [active], TRACE1(active, [active]))
]])
@ -120,8 +119,10 @@ TRACE1(foo, [active], TRACE1(active, [active]))
AT_CHECK([autoconf --autoconf-dir .. -l $at_srcdir -t TRACE1 -t TRACE2], 0,
[[configure.ac:4:TRACE1:foo:bar:baz
configure.ac:4:TRACE2:bar:baz
configure.ac:5:TRACE1:foo:AC_TRACE1(bar, baz)
configure.ac:5:TRACE2:AC_TRACE1(bar, baz)
configure.ac:5:TRACE1:bar:baz
configure.ac:5:TRACE2:baz
configure.ac:5:TRACE1:foo::baz
configure.ac:5:TRACE2::baz
configure.ac:6:TRACE1:foo:ACTIVE:baz
configure.ac:6:TRACE2:ACTIVE:baz
configure.ac:7:TRACE1:ACTIVE:active
@ -136,7 +137,9 @@ AT_CHECK([[autoconf --autoconf-dir .. -l $at_srcdir -t TRACE1:'
[[
[foo], [bar], [baz].
[foo], [AC_TRACE1(bar, baz)], [].
[bar], [baz], [].
[foo], [], [baz].
[foo], [ACTIVE], [baz].
@ -148,7 +151,8 @@ AT_CHECK([[autoconf --autoconf-dir .. -l $at_srcdir -t TRACE1:'
# ${sep}@.
AT_CHECK([autoconf --autoconf-dir .. -l $at_srcdir -t TRACE2:'${)===(}@'], 0,
[[[bar])===([baz]
[AC_TRACE1(bar, baz)]
[baz]
[])===([baz]
[ACTIVE])===([baz]
[active]
[active])===([])===([ACTIVE]