* lib/m4sugar/m4sugar.m4 (m4_provide_ifelse): Rename as...

(m4_provide_if): this.
* lib/m4sugar/m4sh.m4 (AS_REQUIRE): New.
* lib/autoconf/general.m4 (AS_DEFUN, AC_DEFUN_ONCE, AC_BEFORE)
(AC_REQUIRE, AC_PROVIDE, AC_PROVIDE_IFELSE): Be exact copy of the
M4sugar peer, i.e., drop the `AC_PROVIDE_$1' broken marker.
This commit is contained in:
Akim Demaille 2001-10-08 08:21:34 +00:00
parent b17d5c4b6c
commit 201baaa8df
4 changed files with 79 additions and 78 deletions

View File

@ -1,3 +1,12 @@
2001-10-08 Akim Demaille <akim@epita.fr>
* lib/m4sugar/m4sugar.m4 (m4_provide_ifelse): Rename as...
(m4_provide_if): this.
* lib/m4sugar/m4sh.m4 (AS_REQUIRE): New.
* lib/autoconf/general.m4 (AS_DEFUN, AC_DEFUN_ONCE, AC_BEFORE)
(AC_REQUIRE, AC_PROVIDE, AC_PROVIDE_IFELSE): Be exact copy of the
M4sugar peer, i.e., drop the `AC_PROVIDE_$1' broken marker.
2001-10-08 Akim Demaille <akim@epita.fr>
Use `add-log-current-defun-function' for ChangeLog creation.

View File

@ -157,28 +157,25 @@ m4_copy([m4_divert_push],[AC_DIVERT_PUSH])
m4_copy([m4_divert_pop], [AC_DIVERT_POP])
## ------------------------------- ##
## Defining macros in autoconf::. ##
## ------------------------------- ##
## ------------------------------------ ##
## Defining/requiring Autoconf macros. ##
## ------------------------------------ ##
# AC_DEFUN(NAME, EXPANSION)
# -------------------------
# Same as `m4_define' but equip the macro with the needed machinery
# for `AC_REQUIRE'.
#
# We don't use this macro to define some frequently called macros that
# are not involved in ordering constraints, to save m4 processing.
m4_define([AC_DEFUN],
[m4_defun([$1], [$2[]AC_PROVIDE([$1])])])
# AC_DEFUN_ONCE(NAME, EXPANSION)
# ------------------------------
# As AC_DEFUN, but issues the EXPANSION only once, and warns if used
# several times.
m4_define([AC_DEFUN_ONCE],
[m4_defun_once([$1], [$2[]AC_PROVIDE([$1])])])
# AC_BEFORE(THIS-MACRO-NAME, CALLED-MACRO-NAME)
# AC_REQUIRE(STRING)
# AC_PROVIDE(MACRO-NAME)
# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED)
# -----------------------------------------------------------
m4_copy([m4_defun], [AC_DEFUN])
m4_copy([m4_defun_once], [AC_DEFUN_ONCE])
m4_copy([m4_before], [AC_BEFORE])
m4_copy([m4_require], [AC_REQUIRE])
m4_copy([m4_provide], [AC_PROVIDE])
m4_copy([m4_provide_if], [AC_PROVIDE_IFELSE])
# AC_OBSOLETE(THIS-MACRO-NAME, [SUGGESTION])
@ -188,48 +185,6 @@ m4_define([AC_OBSOLETE],
## ----------------------------- ##
## Dependencies between macros. ##
## ----------------------------- ##
# AC_BEFORE(THIS-MACRO-NAME, CALLED-MACRO-NAME)
# ---------------------------------------------
m4_define([AC_BEFORE],
[AC_PROVIDE_IFELSE([$2], [AC_DIAGNOSE([syntax], [$2 was called before $1])])])
# AC_REQUIRE(STRING)
# ------------------
# 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_copy([m4_require], [AC_REQUIRE])
# AC_PROVIDE(MACRO-NAME)
# ----------------------
# Ideally we should just use `m4_provide($1)', but unfortunately many
# third party macros know that we use `AC_PROVIDE_$1' and they depend
# on it.
m4_define([AC_PROVIDE],
[m4_define([AC_PROVIDE_$1])m4_provide([$1])])
# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED)
# -----------------------------------------------------------
# If MACRO-NAME is provided do IF-PROVIDED, else IF-NOT-PROVIDED.
# The purpose of this macro is to provide the user with a means to
# check macros which are provided without letting her know how the
# information is coded.
m4_define([AC_PROVIDE_IFELSE],
[m4_ifdef([AC_PROVIDE_$1],
[$2], [$3])])
## ----------------------------- ##
## Implementing Autoconf loops. ##
## ----------------------------- ##

View File

@ -96,6 +96,43 @@ m4_copy([_m4_divert(M4SH-INIT)], [_m4_divert(NOTICE)])
## ------------------------- ##
# AS_REQUIRE(NAME-TO-CHECK, [BODY-TO-EXPAND = NAME-TO-CHECK])
# -----------------------------------------------------------
# BODY-TO-EXPAND is some initialization which must be expanded in the
# M4SH-INIT section when expanded (required or not). For instance:
#
# m4_defun([_FOO_PREPARE], [foo=foo])
# m4_defun([FOO],
# [m4_require([_FOO_PREPARE])dnl
# echo $foo])
#
# m4_defun([_BAR_PREPARE], [bar=bar])
# m4_defun([BAR],
# [AS_REQUIRE([_BAR_PREPARE])dnl
# echo $bar])
#
# AS_INIT
# foo1=`FOO`
# foo2=`FOO`
# bar1=`BAR`
# bar2=`BAR`
#
# gives
#
# #! /bin/sh
# bar=bar
#
# foo1=`foo=foo
# echo $foo`
# foo2=`echo $foo`
# bar1=`echo $bar`
# bar2=`echo $bar`
#
m4_define([AS_REQUIRE],
[m4_provide_if([$1], [],
[m4_divert_text([M4SH-INIT], [$1])])])
# AS_SHELL_SANITIZE
# -----------------
# Try to be as Bourne and/or POSIX as possible.

View File

@ -1193,9 +1193,9 @@ m4_define([$1],
m4_define([m4_defun_once],
[m4_define([m4_location($1)], m4_location)dnl
m4_define([$1],
[m4_provide_ifelse([$1],
[m4_warn([syntax], [$1 invoked multiple times])],
[_m4_defun_pro([$1])$2[]_m4_defun_epi([$1])])])])
[m4_provide_if([$1],
[m4_warn([syntax], [$1 invoked multiple times])],
[_m4_defun_pro([$1])$2[]_m4_defun_epi([$1])])])])
# m4_pattern_forbid(ERE)
@ -1220,8 +1220,8 @@ m4_define([m4_pattern_allow], [])
# m4_before(THIS-MACRO-NAME, CALLED-MACRO-NAME)
# ---------------------------------------------
m4_define([m4_before],
[m4_provide_ifelse([$2],
[m4_warn([syntax], [$2 was called before $1])])])
[m4_provide_if([$2],
[m4_warn([syntax], [$2 was called before $1])])])
# m4_require(NAME-TO-CHECK, [BODY-TO-EXPAND = NAME-TO-CHECK])
@ -1262,17 +1262,17 @@ m4_ifdef([_m4_expanding($1)],
[m4_fatal([$0: circular dependency of $1])])dnl
m4_ifndef([_m4_divert_dump],
[m4_fatal([$0: cannot be used outside of an m4_defun'd macro])])dnl
m4_provide_ifelse([$1],
[],
[m4_divert_push(m4_eval(m4_divnum - 1))dnl
m4_provide_if([$1],
[],
[m4_divert_push(m4_eval(m4_divnum - 1))dnl
m4_default([$2], [$1])
m4_divert(m4_defn([_m4_divert_dump]))dnl
m4_undivert(m4_defn([_m4_divert_diversion]))dnl
m4_divert_pop(m4_defn([_m4_divert_dump]))])dnl
m4_provide_ifelse([$1],
[],
[m4_warn([syntax],
[$1 is m4_require'd but is not m4_defun'd])])dnl
m4_provide_if([$1],
[],
[m4_warn([syntax],
[$1 is m4_require'd but is not m4_defun'd])])dnl
m4_expansion_stack_pop()dnl
])
@ -1282,9 +1282,9 @@ m4_expansion_stack_pop()dnl
# If TEXT has never been expanded, expand it *here*. Use WITNESS as
# as a memory that TEXT has already been expanded.
m4_define([m4_expand_once],
[m4_provide_ifelse(m4_ifval([$2], [[$2]], [[$1]]),
[],
[m4_provide(m4_ifval([$2], [[$2]], [[$1]]))[]$1])])
[m4_provide_if(m4_ifval([$2], [[$2]], [[$1]]),
[],
[m4_provide(m4_ifval([$2], [[$2]], [[$1]]))[]$1])])
# m4_provide(MACRO-NAME)
@ -1293,13 +1293,13 @@ m4_define([m4_provide],
[m4_define([m4_provide($1)])])
# m4_provide_ifelse(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED)
# -----------------------------------------------------------
# m4_provide_if(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED)
# -------------------------------------------------------
# If MACRO-NAME is provided do IF-PROVIDED, else IF-NOT-PROVIDED.
# The purpose of this macro is to provide the user with a means to
# check macros which are provided without letting her know how the
# information is coded.
m4_define([m4_provide_ifelse],
m4_define([m4_provide_if],
[m4_ifdef([m4_provide($1)],
[$2], [$3])])