+2001-10-08 Akim Demaille <akim@epita.fr>
+
+ * lib/autoconf/autoconf.m4, lib/autoconf/general.m4,
+ * lib/autoconf/libs.m4, lib/autoconf/status.m4,
+ * lib/autoconf/types.m4, lib/autotest/general.m4,
+ * lib/m4sugar/m4sh.m4, lib/m4sugar/m4sugar.m4, tests/atspecific.m4,
+ * tests/torture.at: Rename m4_regexp, m4_patsubst, and m4_match to
+ m4_bregexp, m4_bpatsubst, and m4_bmatch.
+ * doc/autoconf.texi (Redefined M4 Macros): Adjust.
+
+
2001-10-08 Akim Demaille <akim@epita.fr>
* lib/m4sugar/m4sh.m4: Use AS_REQUIRE.
to recover the behavior of the builtin.
@end defmac
+@defmac m4_bpatsubst (@var{string}, @var{regexp}, @ovar{replacement})
+@msindex bpatsubst
+This macro corresponds to @code{patsubst}. The name @code{m4_patsubst}
+is kept for future versions of M4sh, on top of @sc{gnu} M4 which will
+provide extended regular expression syntax via @code{epatsubst}.
+@end defmac
+
@defmac m4_popdef (@var{macro})
@msindex defn
Contrary to the M4 builtin, this macro fails if @var{macro} is not
defined. See @code{m4_undefine}.
@end defmac
+@defmac m4_bregexp (@var{string}, @var{regexp}, @ovar{replacement})
+@msindex bregexp
+This macro corresponds to @code{regexp}. The name @code{m4_regexp}
+is kept for future versions of M4sh, on top of @sc{gnu} M4 which will
+provide extended regular expression syntax via @code{eregexp}.
+@end defmac
+
@defmac m4_wrap (@var{text})
@msindex m4_wrap
This macro corresponds to @code{m4wrap}.
instead of:
@example
-m4_patsubst([$1], [$"])
+m4_bpatsubst([$1], [$"])
@end example
@noindent
use
@example
-m4_patsubst([$1], [$""])
+m4_bpatsubst([$1], [$""])
@end example
@noindent
@example
m4_builtin
m4_indir
-m4_patsubst
+m4_bpatsubst
__file__
__line__
@end example
m4_copy_unm4([m4_index])
m4_copy_unm4([m4_indir])
m4_copy_unm4([m4_len])
-m4_copy_unm4([m4_patsubst])
+m4_copy([m4_bpatsubst], [patsubst])
m4_copy_unm4([m4_popdef])
m4_copy_unm4([m4_pushdef])
-m4_copy_unm4([m4_regexp])
+m4_copy([m4_bregexp], [regexp])
m4_copy_unm4([m4_sinclude])
m4_copy_unm4([m4_syscmd])
m4_copy_unm4([m4_sysval])
AS_LITERAL_IF([$3], [], [m4_warn([syntax], [AC_INIT: not a literal: $3])])
m4_define([AC_PACKAGE_NAME], [$1])
m4_define([AC_PACKAGE_TARNAME],
- m4_tolower(m4_patsubst([[[$1]]], [GNU ])))
+ m4_tolower(m4_bpatsubst([[[$1]]], [GNU ])))
m4_define([AC_PACKAGE_VERSION], [$2])
m4_define([AC_PACKAGE_STRING], [$1 $2])
m4_define([AC_PACKAGE_BUGREPORT], [$3])
# would have not been evaluated. Another solution, a bit fragile,
# would have be to use m4_quote to force an evaluation:
#
-# m4_patsubst(m4_quote($1), [^], [# ])
+# m4_bpatsubst(m4_quote($1), [^], [# ])
m4_define([AC_COPYRIGHT],
[m4_divert_text([HEADER-COPYRIGHT],
-[m4_patsubst([
+[m4_bpatsubst([
$1], [^], [@%:@ ])])dnl
m4_divert_text(m4_default([$2], [VERSION_USER]),
[
echo
AS_BOX([Cache variables.])
echo
- m4_patsubst(m4_patsubst(m4_dquote(m4_defn([_AC_CACHE_DUMP])),
+ m4_bpatsubst(m4_bpatsubst(m4_dquote(m4_defn([_AC_CACHE_DUMP])),
[^ *\(#.*\)?
]),
['], ['"'"'])
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]]])dnl
m4_divert_once([HELP_ENABLE], [$2])dnl
# Check whether --enable-$1 or --disable-$1 was given.
-if test "[${enable_]m4_patsubst([$1], -, _)+set}" = set; then
- enableval="[$enable_]m4_patsubst([$1], -, _)"
+if test "[${enable_]m4_bpatsubst([$1], -, _)+set}" = set; then
+ enableval="[$enable_]m4_bpatsubst([$1], -, _)"
$3
m4_ifvaln([$4], [else
$4])dnl
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)]])
m4_divert_once([HELP_WITH], [$2])dnl
# Check whether --with-$1 or --without-$1 was given.
-if test "[${with_]m4_patsubst([$1], -, _)+set}" = set; then
- withval="[$with_]m4_patsubst([$1], -, _)"
+if test "[${with_]m4_bpatsubst([$1], -, _)+set}" = set; then
+ withval="[$with_]m4_bpatsubst([$1], -, _)"
$3
m4_ifvaln([$4], [else
$4])dnl
# The name of shell var CACHE-ID must contain `_cv_' in order to get saved.
# Should be dnl'ed. Try to catch common mistakes.
m4_define([AC_CACHE_VAL],
-[m4_match([$2], [AC_DEFINE],
+[m4_bmatch([$2], [AC_DEFINE],
[AC_DIAGNOSE(syntax,
[$0($1, ...): suspicious presence of an AC_DEFINE in the second argument, ]dnl
[where no actions should be taken])])dnl
# it must be a literal name.
AU_DEFUN([AC_HAVE_LIBRARY],
[m4_pushdef([AC_Lib_Name],
- m4_patsubst(m4_patsubst([[$1]],
+ m4_bpatsubst(m4_bpatsubst([[$1]],
[lib\([^\.]*\)\.a], [\1]),
[-l], []))dnl
AC_CHECK_LIB(AC_Lib_Name, main, [$2], [$3], [$4])dnl
# matching. The big problem is then that the active characters should
# be quoted. Currently `+*.' are quoted.
m4_define([AC_CONFIG_IF_MEMBER],
-[m4_match($2, [\(^\| \)]m4_re_escape([$1])[\(:\| \|$\)]),
+[m4_bmatch($2, [\(^\| \)]m4_re_escape([$1])[\(:\| \|$\)]),
[$3], [$4])])
m4_define([_AC_CONFIG_DEPENDENCIES],
[m4_divert_push([KILL])
AC_FOREACH([AC_File], [$1],
- [_AC_CONFIG_DEPENDENCY(m4_patsubst(AC_File, [:], [,]))])
+ [_AC_CONFIG_DEPENDENCY(m4_bpatsubst(AC_File, [:], [,]))])
m4_divert_pop([KILL])dnl
])
m4_define([_AC_CONFIG_UNIQUE],
[m4_divert_push([KILL])
AC_FOREACH([AC_File], [$1],
-[m4_pushdef([AC_Dest], m4_patsubst(AC_File, [:.*]))
+[m4_pushdef([AC_Dest], m4_bpatsubst(AC_File, [:.*]))
AC_CONFIG_IF_MEMBER(AC_Dest, [AC_LIST_HEADERS],
[AC_FATAL(`AC_Dest' [is already registered with AC_CONFIG_HEADER or AC_CONFIG_HEADERS.])])
AC_CONFIG_IF_MEMBER(AC_Dest, [AC_LIST_LINKS],
m4_if([$2],,, [AC_FOREACH([AC_Name], [$1],
[m4_append([AC_LIST_COMMANDS_COMMANDS],
-[ ]m4_patsubst(AC_Name, [:.*])[ ) $2 ;;
+[ ]m4_bpatsubst(AC_Name, [:.*])[ ) $2 ;;
])])])
_AC_CONFIG_COMMANDS_INIT([$3])
m4_divert_pop([KILL])dnl
dnl Register the commands
m4_ifval([$2], [AC_FOREACH([AC_File], [$1],
[m4_append([AC_LIST_HEADERS_COMMANDS],
-[ ]m4_patsubst(AC_File, [:.*])[ ) $2 ;;
+[ ]m4_bpatsubst(AC_File, [:.*])[ ) $2 ;;
])])])
_AC_CONFIG_COMMANDS_INIT([$3])
m4_divert_pop([KILL])dnl
[m4_divert_push([KILL])
_AC_CONFIG_UNIQUE([$1])
_AC_CONFIG_DEPENDENCIES([$1])
-m4_match([$1], [^\.:\| \.:], [m4_fatal([$0: invalid destination: `.'])])
+m4_bmatch([$1], [^\.:\| \.:], [m4_fatal([$0: invalid destination: `.'])])
m4_append([AC_LIST_LINKS], [ $1])
dnl Register the commands
m4_ifval([$2], [AC_FOREACH([AC_File], [$1],
[m4_append([AC_LIST_LINKS_COMMANDS],
-[ ]m4_patsubst(AC_File, [:.*])[ ) $2 ;;
+[ ]m4_bpatsubst(AC_File, [:.*])[ ) $2 ;;
])])])
_AC_CONFIG_COMMANDS_INIT([$3])
m4_divert_pop([KILL])dnl
dnl Register the commands.
m4_ifval([$2], [AC_FOREACH([AC_File], [$1],
[m4_append([AC_LIST_FILES_COMMANDS],
-[ ]m4_patsubst(AC_File, [:.*])[ ) $2 ;;
+[ ]m4_bpatsubst(AC_File, [:.*])[ ) $2 ;;
])])])
_AC_CONFIG_COMMANDS_INIT([$3])
m4_divert_pop([KILL])dnl
case "$ac_config_target" in
# Handling of arguments.
AC_FOREACH([AC_File], AC_LIST_FILES,
-[ "m4_patsubst(AC_File, [:.*])" )dnl
+[ "m4_bpatsubst(AC_File, [:.*])" )dnl
CONFIG_FILES="$CONFIG_FILES AC_File" ;;
])dnl
AC_FOREACH([AC_File], AC_LIST_LINKS,
-[ "m4_patsubst(AC_File, [:.*])" )dnl
+[ "m4_bpatsubst(AC_File, [:.*])" )dnl
CONFIG_LINKS="$CONFIG_LINKS AC_File" ;;
])dnl
AC_FOREACH([AC_File], AC_LIST_COMMANDS,
-[ "m4_patsubst(AC_File, [:.*])" )dnl
+[ "m4_bpatsubst(AC_File, [:.*])" )dnl
CONFIG_COMMANDS="$CONFIG_COMMANDS AC_File" ;;
])dnl
AC_FOREACH([AC_File], AC_LIST_HEADERS,
-[ "m4_patsubst(AC_File, [:.*])" )dnl
+[ "m4_bpatsubst(AC_File, [:.*])" )dnl
CONFIG_HEADERS="$CONFIG_HEADERS AC_File" ;;
])dnl
*) AC_MSG_ERROR([invalid argument: $ac_config_target]);;
# Because many people have used `off_t' and `size_t' too, they are added
# for better common-useward backward compatibility.
m4_define([_AC_CHECK_TYPE_REPLACEMENT_TYPE_P],
-[m4_match([$1],
+[m4_bmatch([$1],
[^\(_Bool\|bool\|char\|double\|float\|int\|long\|short\|\(un\)?signed\|[_a-zA-Z][_a-zA-Z0-9]*_t\)[][_a-zA-Z0-9() *]*$],
1, 0)dnl
])# _AC_CHECK_TYPE_REPLACEMENT_TYPE_P
# -----------------------------------
# Return `1' if STRING looks like a C/C++ type.
m4_define([_AC_CHECK_TYPE_MAYBE_TYPE_P],
-[m4_match([$1], [^[_a-zA-Z0-9 ]+\([_a-zA-Z0-9() *]\|\[\|\]\)*$],
+[m4_bmatch([$1], [^[_a-zA-Z0-9 ]+\([_a-zA-Z0-9() *]\|\[\|\]\)*$],
1, 0)dnl
])# _AC_CHECK_TYPE_MAYBE_TYPE_P
AC_DEFUN([AC_CHECK_MEMBER],
[AS_LITERAL_IF([$1], [],
[AC_FATAL([$0: requires literal arguments])])dnl
-m4_match([$1], [\.], ,
+m4_bmatch([$1], [\.], ,
[m4_fatal([$0: Did not see any dot in `$1'])])dnl
AS_VAR_PUSHDEF([ac_Member], [ac_cv_member_$1])dnl
dnl Extract the aggregate name, and the member name
AC_CACHE_CHECK([for $1], ac_Member,
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT([$4])],
[dnl AGGREGATE ac_aggr;
-static m4_patsubst([$1], [\..*]) ac_aggr;
+static m4_bpatsubst([$1], [\..*]) ac_aggr;
dnl ac_aggr.MEMBER;
-if (ac_aggr.m4_patsubst([$1], [^[^.]*\.]))
+if (ac_aggr.m4_bpatsubst([$1], [^[^.]*\.]))
return 0;])],
[AS_VAR_SET(ac_Member, yes)],
[AS_VAR_SET(ac_Member, no)])])
[m4_foreach([AC_Member], [$1],
[AC_CHECK_MEMBER(AC_Member,
[AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_[]AC_Member), 1,
- [Define if `]m4_patsubst(AC_Member,
+ [Define if `]m4_bpatsubst(AC_Member,
[^[^.]*\.])[' is
- member of `]m4_patsubst(AC_Member, [\..*])['.])
+ member of `]m4_bpatsubst(AC_Member, [\..*])['.])
$2],
[$3],
[$4])])])
#
# Gee, we can't use simply
#
-# m4_patsubst(__file__, [^.*/\(.*\)], [[\1]])
+# m4_bpatsubst(__file__, [^.*/\(.*\)], [[\1]])
#
# since then, since `dnl' doesn't match the pattern, it is returned
# with once quotation level less, so you lose, dammit! And since GNU M4
# even think about using `?' or `\?'. Bah, `*' will do.
# Pleeeeeeeease, Gary, provide us with dirname and ERE!
m4_define([AT_LINE],
-[m4_patsubst(__file__, [^\(.*/\)*\(.*\)], [[\2]]):__line__])
+[m4_bpatsubst(__file__, [^\(.*/\)*\(.*\)], [[\2]]):__line__])
# AT_INIT([TESTSUITE-NAME])
# -----------------------
# Declare a list of FILES to clean.
m4_define([AT_CLEANUP_FILES],
-[m4_foreach([AT_File], m4_quote(m4_patsubst([$1], [ *], [,])),
+[m4_foreach([AT_File], m4_quote(m4_bpatsubst([$1], [ *], [,])),
[_AT_CLEANUP_FILE(AT_File)])])
# ---------------------------------
# Escape the CHARS in STRING.
m4_define([AS_ESCAPE],
-[m4_patsubst([$1],
+[m4_bpatsubst([$1],
m4_ifval([$2], [[\([$2]\)]], [[\([\"$`]\)]]),
[\\\1])])
# Otherwise it's modern.
# We use two quotes in the pattern to keep highlighting tools at peace.
m4_define([_AS_QUOTE_IFELSE],
-[m4_match([$1],
+[m4_bmatch([$1],
[\\[\\$]], [$2],
[\\[`""]], [$3],
[$2])])
# This is an *approximation*: for instance EXPRESSION = `\$' is
# definitely a literal, but will not be recognized as such.
m4_define([AS_LITERAL_IF],
-[m4_match([$1], [[`$]],
+[m4_bmatch([$1], [[`$]],
[$3], [$2])])
m4_defun([AS_TR_SH],
[AS_REQUIRE([_$0_PREPARE])dnl
AS_LITERAL_IF([$1],
- [m4_patsubst(m4_translit([[$1]], [*+], [pp]),
+ [m4_bpatsubst(m4_translit([[$1]], [*+], [pp]),
[[^a-zA-Z0-9_]], [_])],
[`echo "$1" | $as_tr_sh`])])
m4_defun([AS_TR_CPP],
[AS_REQUIRE([_$0_PREPARE])dnl
AS_LITERAL_IF([$1],
- [m4_patsubst(m4_translit([[$1]],
+ [m4_bpatsubst(m4_translit([[$1]],
[*abcdefghijklmnopqrstuvwxyz],
[PABCDEFGHIJKLMNOPQRSTUVWXYZ]),
[[^A-Z0-9_]], [_])],
m4_define([AS_VAR_GET],
[AS_LITERAL_IF([$1],
[$$1],
- [`eval echo '${'m4_patsubst($1, [[\\`]], [\\\&])'}'`])])
+ [`eval echo '${'m4_bpatsubst($1, [[\\`]], [\\\&])'}'`])])
# AS_VAR_TEST_SET(VARIABLE)
# ---------------------------
# Copy m4_MACRO-NAME as MACRO-NAME.
m4_define([m4_copy_unm4],
-[m4_copy([$1], m4_patsubst([$1], [^m4_\(.*\)], [[\1]]))])
+[m4_copy([$1], m4_bpatsubst([$1], [^m4_\(.*\)], [[\1]]))])
# Some m4 internals have names colliding with tokens we might use.
m4_rename([m4exit], [m4_exit])
m4_rename([m4wrap], [m4_wrap])
m4_rename_m4([maketemp])
-m4_rename_m4([patsubst])
+m4_rename([patsubst], [m4_bpatsubst])
m4_undefine([popdef])
m4_rename_m4([pushdef])
-m4_rename_m4([regexp])
+m4_rename([regexp], [m4_bregexp])
m4_rename_m4([shift])
m4_rename_m4([sinclude])
m4_rename_m4([substr])
[m4_case([$1], m4_shiftn(3, $@))])])
-# m4_match(SWITCH, RE1, VAL1, RE2, VAL2, ..., DEFAULT)
-# ----------------------------------------------------
+# m4_bmatch(SWITCH, RE1, VAL1, RE2, VAL2, ..., DEFAULT)
+# -----------------------------------------------------
# m4 equivalent of
#
# if (SWITCH =~ RE1)
#
# All the values are optional, and the macro is robust to active symbols
# properly quoted.
-m4_define([m4_match],
+m4_define([m4_bmatch],
[m4_if([$#], 0, [],
[$#], 1, [],
[$#], 2, [$2],
- m4_regexp([$1], [$2]), -1, [m4_match([$1], m4_shiftn(3, $@))],
+ m4_bregexp([$1], [$2]), -1, [m4_bmatch([$1], m4_shiftn(3, $@))],
[$3])])
# --------------------
# Escape BRE active characters in STRING.
m4_define([m4_re_escape],
-[m4_patsubst([$1],
- [[][+*.]], [\\\&])])
+[m4_bpatsubst([$1],
+ [[][+*.]], [\\\&])])
# m4_re_string
<<m4_changequote(``, '')dnl
[dnl Can't use m4_default here instead of m4_if, because m4_default uses
dnl [ and ] as quotes.
-m4_patsubst(````$1'''',
- m4_if(``$2'',, ``[ ]+'', ``$2''),
- ``], ['')]dnl
+m4_bpatsubst(````$1'''',
+ m4_if(``$2'',, ``[ ]+'', ``$2''),
+ ``], ['')]dnl
m4_changequote([, ])>>)
m4_changequote([, ])
# ive])end
# => active activeend
m4_define([m4_flatten],
-[m4_translit(m4_patsubst([[[$1]]], [\\
+[m4_translit(m4_bpatsubst([[[$1]]], [\\
]), [
], [ ])])
# the *third* character, since there are two leading `['; Equally for
# the outer patsubst.
m4_define([m4_strip],
-[m4_patsubst(m4_patsubst(m4_patsubst([[[[$1]]]],
- [[ ]+], [ ]),
- [^\(..\) ], [\1]),
- [ \(.\)$], [\1])])
+[m4_bpatsubst(m4_bpatsubst(m4_bpatsubst([[[[$1]]]],
+ [[ ]+], [ ]),
+ [^\(..\) ], [\1]),
+ [ \(.\)$], [\1])])
# m4_normalize(STRING)
# As `m4_append', but append only if not yet present.
m4_define([m4_append_uniq],
[m4_ifdef([$1],
- [m4_match([$3]m4_defn([$1])[$3], m4_re_escape([$3$2$3]), [],
- [m4_append($@)])],
+ [m4_bmatch([$3]m4_defn([$1])[$3], m4_re_escape([$3$2$3]), [],
+ [m4_append($@)])],
[m4_append($@)])])
# m4_text_box(MESSAGE, [FRAME-CHARACTER = `-'])
# ---------------------------------------------
m4_define([m4_text_box],
-[@%:@@%:@ m4_patsubst([$1], [.], m4_if([$2], [], [[-]], [[$2]])) @%:@@%:@
+[@%:@@%:@ m4_bpatsubst([$1], [.], m4_if([$2], [], [[-]], [[$2]])) @%:@@%:@
@%:@@%:@ $1 @%:@@%:@
-@%:@@%:@ m4_patsubst([$1], [.], m4_if([$2], [], [[-]], [[$2]])) @%:@@%:@[]dnl
+@%:@@%:@ m4_bpatsubst([$1], [.], m4_if([$2], [], [[-]], [[$2]])) @%:@@%:@[]dnl
])
#
# The sign of the integer A.
m4_define([m4_sign],
-[m4_match([$1],
- [^-], -1,
- [^0+], 0,
- 1)])
+[m4_bmatch([$1],
+ [^-], -1,
+ [^0+], 0,
+ 1)])
# m4_cmp(A, B)
# ------------
# This macro is absolutely not robust to active macro, it expects
# reasonable version numbers and is valid up to `z', no double letters.
m4_define([m4_version_unletter],
-[m4_translit(m4_patsubst(m4_patsubst(m4_patsubst([$1],
- [\([0-9]+\)\([abcdefghi]\)],
- [m4_eval(\1 + 1).-1.\2]),
- [\([0-9]+\)\([jklmnopqrs]\)],
- [m4_eval(\1 + 1).-1.1\2]),
- [\([0-9]+\)\([tuvwxyz]\)],
- [m4_eval(\1 + 1).-1.2\2]),
+[m4_translit(m4_bpatsubst(m4_bpatsubst(m4_bpatsubst([$1],
+ [\([0-9]+\)\([abcdefghi]\)],
+ [m4_eval(\1 + 1).-1.\2]),
+ [\([0-9]+\)\([jklmnopqrs]\)],
+ [m4_eval(\1 + 1).-1.1\2]),
+ [\([0-9]+\)\([tuvwxyz]\)],
+ [m4_eval(\1 + 1).-1.2\2]),
[abcdefghijklmnopqrstuvwxyz],
[12345678901234567890123456])])
# Escape the invalid tokens with @&t@.
m4_define([AT_DATA_M4SUGAR],
[AT_DATA([$1],
-[m4_patsubst(m4_patsubst([[$2]], [\(m4\)_], [\1@&t@_]),
- [dnl], [d@&t@nl])])])
+[m4_bpatsubst(m4_bpatsubst([[$2]], [\(m4\)_], [\1@&t@_]),
+ [dnl], [d@&t@nl])])])
# AT_CHECK_M4SUGAR(FLAGS, [EXIT-STATUS = 0], STDOUT, STDERR)
# Escape the invalid tokens with @&t@.
m4_define([AT_DATA_M4SH],
[AT_DATA([$1],
-[m4_patsubst(m4_patsubst([[$2]], [\(m4\|AS\)_], [\1@&t@_]),
- [dnl], [d@&t@nl])])])
+[m4_bpatsubst(m4_bpatsubst([[$2]], [\(m4\|AS\)_], [\1@&t@_]),
+ [dnl], [d@&t@nl])])])
# AT_CHECK_M4SH(FLAGS, [EXIT-STATUS = 0], STDOUT, STDERR)
# turned into ac_uummy during the construction of config.status. Yes,
# this is admittedly a bug, but it would be too hard to fix this.
# There is really no point in AC_DEFINE a var named ac_d.*.
-m4_pattern_allow([^m4_patsubst$])
+m4_pattern_allow([^m4_bpatsubst$])
m4_define([AT_DUMMY_VAR],
-[ac_Dummy_[]m4_patsubst([000$1], [.*\(...\)$], [\1])])
+[ac_Dummy_[]m4_bpatsubst([000$1], [.*\(...\)$], [\1])])