diff --git a/ChangeLog b/ChangeLog index b3596cbe..12a7875e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2000-11-03 Akim Demaille + + * m4sugar.m4 (m4_rename_m4, m4_copy_unm4): New macros. + Use them. + (debugfile, debugmode, m4exit, m4wrap, maketemp, patsubst, regexp) + (substr, translit, m4_wrap): Rename as... + (m4_debugfile, m4_debugmode, m4_exit, m4_wrap, m4_maketemp) + (m4_patsubst, m4_regexp, m4_substr, m4_translit, m4_text_wrap): these. + Adjust all dependencies. + * acgeneral.m4: Adjust. + * tests/m4sugar.at: Adjust. + * autoconf.m4 (m4exit, patsubst, regexp, substr, translit): + Reestablish them. + 2000-11-02 Akim Demaille The documentation is not clear about the obsoleteness of diff --git a/acgeneral.m4 b/acgeneral.m4 index ef539c52..3bb2103c 100644 --- a/acgeneral.m4 +++ b/acgeneral.m4 @@ -366,7 +366,7 @@ define([AH_VERBATIM], # DESCRIPTION (properly wrapped), and then #undef KEY. define([AH_TEMPLATE], [AH_VERBATIM([$1], - m4_wrap([$2 */], [ ], [/* ])[ + m4_text_wrap([$2 */], [ ], [/* ])[ #undef $1])]) @@ -409,7 +409,7 @@ define([_AH_COUNTER], [0]) # If EXPRESSION has shell indirections ($var or `expr`), expand # IF-INDIR, else IF-NOT-INDIR. define([AC_VAR_INDIR_IFELSE], -[ifelse(regexp([$1], [[`$]]), +[ifelse(m4_regexp([$1], [[`$]]), -1, [$3], [$2])]) @@ -431,7 +431,7 @@ define([AC_VAR_SET], # else into the appropriate `eval' sequence. define([AC_VAR_GET], [AC_VAR_INDIR_IFELSE([$1], - [`eval echo '${'patsubst($1, [[\\`]], [\\\&])'}'`], + [`eval echo '${'m4_patsubst($1, [[\\`]], [\\\&])'}'`], [$[]$1])]) @@ -516,10 +516,10 @@ define([AC_VAR_POPDEF], define([AC_TR_CPP], [AC_VAR_INDIR_IFELSE([$1], [`echo "$1" | $ac_tr_cpp`], - [patsubst(translit([[$1]], - [*abcdefghijklmnopqrstuvwxyz], - [PABCDEFGHIJKLMNOPQRSTUVWXYZ]), - [[^A-Z0-9_]], [_])])]) + [m4_patsubst(m4_translit([[$1]], + [*abcdefghijklmnopqrstuvwxyz], + [PABCDEFGHIJKLMNOPQRSTUVWXYZ]), + [[^A-Z0-9_]], [_])])]) # AC_TR_SH(EXPRESSION) @@ -530,8 +530,8 @@ define([AC_TR_CPP], define([AC_TR_SH], [AC_VAR_INDIR_IFELSE([$1], [`echo "$1" | $ac_tr_sh`], - [patsubst(translit([[$1]], [*+], [pp]), - [[^a-zA-Z0-9_]], [_])])]) + [m4_patsubst(m4_translit([[$1]], [*+], [pp]), + [[^a-zA-Z0-9_]], [_])])]) @@ -608,7 +608,7 @@ define([AC_FOREACH], define([AC_HELP_STRING], [m4_pushdef([AC_Prefix], m4_default([$3], [ ]))dnl m4_pushdef([AC_Prefix_Format], [ %-]m4_eval(len(AC_Prefix) - 3)[s ])dnl [ %-23s ] -m4_wrap([$2], AC_Prefix, m4_format(AC_Prefix_Format, [$1]))dnl +m4_text_wrap([$2], AC_Prefix, m4_format(AC_Prefix_Format, [$1]))dnl m4_popdef([AC_Prefix_Format])dnl m4_popdef([AC_Prefix])dnl ]) @@ -651,10 +651,10 @@ define([AC_PACKAGE_BUGREPORT], [$3])dnl # would have not been evaluated. Another solution, a bit fragile, # would have be to use m4_quote to force an evaluation: # -# patsubst(m4_quote($1), [^], [# ]) +# m4_patsubst(m4_quote($1), [^], [# ]) define([AC_COPYRIGHT], [m4_divert([NOTICE], -[patsubst([ +[m4_patsubst([ $1], [^], [@%:@ ])])dnl m4_divert([VERSION_BEGIN], [ @@ -1632,8 +1632,8 @@ Optional Features: --enable-FEATURE[=ARG] include FEATURE [ARG=yes]]])dnl AC_DIVERT_ONCE([HELP_ENABLE], [$2])dnl # Check whether --enable-$1 or --disable-$1 was given. -if test "[${enable_]patsubst([$1], -, _)+set}" = set; then - enableval="[$enable_]patsubst([$1], -, _)" +if test "[${enable_]m4_patsubst([$1], -, _)+set}" = set; then + enableval="[$enable_]m4_patsubst([$1], -, _)" $3 m4_ifvanl([$4], [else $4])dnl @@ -1660,8 +1660,8 @@ Optional Packages: --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)]]) AC_DIVERT_ONCE([HELP_WITH], [$2])dnl # Check whether --with-$1 or --without-$1 was given. -if test "[${with_]patsubst([$1], -, _)+set}" = set; then - withval="[$with_]patsubst([$1], -, _)" +if test "[${with_]m4_patsubst([$1], -, _)+set}" = set; then + withval="[$with_]m4_patsubst([$1], -, _)" $3 m4_ifvanl([$4], [else $4])dnl @@ -2072,8 +2072,8 @@ rm -f confcache[]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. define([AC_CACHE_VAL], -[ifelse(regexp([$2], [AC_DEFINE]), [-1], [], - [AC_DIAGNOSE(syntax, +[ifelse(m4_regexp([$2], [AC_DEFINE]), [-1], [], + [AC_DIAGNOSE(syntax, [$0($1, ...): suspicious presence of an AC_DEFINE in the second argument, ]dnl [where no actions should be taken])])dnl AC_VAR_SET_IFELSE([$1], @@ -2227,8 +2227,8 @@ define([AC_FATAL], # Otherwise it's modern. # We use two quotes in the pattern to keep highlighting tools at peace. define([_AC_SH_QUOTE_IFELSE], -[ifelse(regexp([$1], [\\[\\$]]), - [-1], [ifelse(regexp([$1], [\\[`""]]), +[ifelse(m4_regexp([$1], [\\[\\$]]), + [-1], [ifelse(m4_regexp([$1], [\\[`""]]), [-1], [$2], [$3])], [$2])]) @@ -2243,7 +2243,7 @@ define([_AC_SH_QUOTE_IFELSE], # the transition (for Libtool for instance). define([_AC_SH_QUOTE], [_AC_SH_QUOTE_IFELSE([$1], - [patsubst([$1], [\([`""]\)], [\\\1])], + [m4_patsubst([$1], [\([`""]\)], [\\\1])], [AC_DIAGNOSE([obsolete], [backquotes and double quotes should not be backslashed in: $1])dnl $1])]) @@ -2432,7 +2432,7 @@ define([AC_INCLUDES_DEFAULT], AC_DEFUN([AC_CHECK_MEMBER], [AC_VAR_INDIR_IFELSE([$1], [AC_FATAL([$0: requires literal arguments])])dnl -ifelse(regexp([$1], [\.]), -1, +ifelse(m4_regexp([$1], [\.]), -1, [AC_FATAL([$0: Did not see any dot in `$1'])])dnl AC_REQUIRE([AC_HEADER_STDC])dnl AC_VAR_PUSHDEF([ac_Member], [ac_cv_member_$1])dnl @@ -2440,9 +2440,9 @@ 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 foo; -patsubst([$1], [\..*]) foo; +m4_patsubst([$1], [\..*]) foo; dnl foo.MEMBER; -foo.patsubst([$1], [^[^.]*\.]);])], +foo.m4_patsubst([$1], [^[^.]*\.]);])], AC_VAR_SET(ac_Member, yes), AC_VAR_SET(ac_Member, no))]) AS_IFELSE([test AC_VAR_GET(ac_Member) = yes], @@ -2460,8 +2460,9 @@ AC_DEFUN([AC_CHECK_MEMBERS], [m4_foreach([AC_Member], [$1], [AC_CHECK_MEMBER(AC_Member, [AC_DEFINE_UNQUOTED(AC_TR_CPP(HAVE_[]AC_Member), 1, - [Define if `]patsubst(AC_Member, [^[^.]*\.])[' is - member of `]patsubst(AC_Member, [\..*])['.]) + [Define if `]m4_patsubst(AC_Member, + [^[^.]*\.])[' is + member of `]m4_patsubst(AC_Member, [\..*])['.]) $2], [$3], [$4])])]) @@ -2804,7 +2805,9 @@ define([AH_CHECK_LIB], # it must be a literal name. AU_DEFUN([AC_HAVE_LIBRARY], [m4_pushdef([AC_Lib_Name], - patsubst(patsubst([[$1]], [lib\([^\.]*\)\.a], [\1]), [-l], []))dnl + m4_patsubst(m4_patsubst([[$1]], + [lib\([^\.]*\)\.a], [\1]), + [-l], []))dnl AC_CHECK_LIB(AC_Lib_Name, main, [$2], [$3], [$4])dnl ac_cv_lib_[]AC_Lib_Name()=ac_cv_lib_[]AC_Lib_Name()_main m4_popdef([AC_Lib_Name])dnl @@ -3413,7 +3416,7 @@ define([_AC_CHECK_TYPE_OLD], # Because many people have used `off_t' and `size_t' too, they are added # for better common-useward backward compatibility. define([_AC_CHECK_TYPE_REPLACEMENT_TYPE_P], -[ifelse(regexp([$1], +[ifelse(m4_regexp([$1], [^\(_Bool\|bool\|char\|double\|float\|int\|long\|short\|\(un\)?signed\|size_t\|off_t\)\([_a-zA-Z0-9() *]\|\[\|\]\)*$]), 0, 1, 0)dnl ])# _AC_CHECK_TYPE_REPLACEMENT_TYPE_P @@ -3423,7 +3426,7 @@ define([_AC_CHECK_TYPE_REPLACEMENT_TYPE_P], # ----------------------------------- # Return `1' if STRING looks like a C/C++ type. define([_AC_CHECK_TYPE_MAYBE_TYPE_P], -[ifelse(regexp([$1], [^[_a-zA-Z0-9 ]+\([_a-zA-Z0-9() *]\|\[\|\]\)*$]), +[ifelse(m4_regexp([$1], [^[_a-zA-Z0-9 ]+\([_a-zA-Z0-9() *]\|\[\|\]\)*$]), 0, 1, 0)dnl ])# _AC_CHECK_TYPE_MAYBE_TYPE_P @@ -3540,8 +3543,8 @@ AC_DEFUN([AC_CHECK_TYPE], # matching. The big problem is then that the active characters should # be quoted. Currently `+*.' are quoted. define([AC_CONFIG_IF_MEMBER], -[ifelse(regexp($2, [\(^\| \)]patsubst([$1], - [\([+*.]\)], [\\\1])[\(:\| \|$\)]), +[ifelse(m4_regexp($2, [\(^\| \)]m4_patsubst([$1], + [\([+*.]\)], [\\\1])[\(:\| \|$\)]), -1, [$4], [$3])]) @@ -3568,7 +3571,7 @@ define([_AC_CONFIG_DEPENDENCY], define([_AC_CONFIG_DEPENDENCIES], [m4_divert_push([KILL]) AC_FOREACH([AC_File], [$1], - [_AC_CONFIG_DEPENDENCY(patsubst(AC_File, [:], [,]))]) + [_AC_CONFIG_DEPENDENCY(m4_patsubst(AC_File, [:], [,]))]) m4_divert_pop()dnl ]) @@ -3585,7 +3588,7 @@ m4_divert_pop()dnl define([_AC_CONFIG_UNIQUE], [m4_divert_push([KILL]) AC_FOREACH([AC_File], [$1], -[m4_pushdef([AC_Dest], patsubst(AC_File, [:.*])) +[m4_pushdef([AC_Dest], m4_patsubst(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], @@ -3630,7 +3633,7 @@ m4_append([AC_LIST_COMMANDS], [ $1]) ifelse([$2],,, [AC_FOREACH([AC_Name], [$1], [m4_append([AC_LIST_COMMANDS_COMMANDS], -[ ]patsubst(AC_Name, [:.*])[ ) $2 ;; +[ ]m4_patsubst(AC_Name, [:.*])[ ) $2 ;; ])])]) _AC_CONFIG_COMMANDS_INIT([$3]) m4_divert_pop()dnl @@ -3708,7 +3711,7 @@ m4_append([AC_LIST_HEADERS], [ $1]) dnl Register the commands ifelse([$2],,, [AC_FOREACH([AC_File], [$1], [m4_append([AC_LIST_HEADERS_COMMANDS], -[ ]patsubst(AC_File, [:.*])[ ) $2 ;; +[ ]m4_patsubst(AC_File, [:.*])[ ) $2 ;; ])])]) _AC_CONFIG_COMMANDS_INIT([$3]) m4_divert_pop()dnl @@ -3739,13 +3742,13 @@ AC_DEFUN([AC_CONFIG_LINKS], [m4_divert_push([KILL]) _AC_CONFIG_UNIQUE([$1]) _AC_CONFIG_DEPENDENCIES([$1]) -ifelse(regexp([$1], [^\.:\| \.:]), -1,, +ifelse(m4_regexp([$1], [^\.:\| \.:]), -1,, [AC_FATAL([$0: invalid destination: `.'])]) m4_append([AC_LIST_LINKS], [ $1]) dnl Register the commands ifelse([$2],,, [AC_FOREACH([AC_File], [$1], [m4_append([AC_LIST_LINKS_COMMANDS], -[ ]patsubst(AC_File, [:.*])[ ) $2 ;; +[ ]m4_patsubst(AC_File, [:.*])[ ) $2 ;; ])])]) _AC_CONFIG_COMMANDS_INIT([$3]) m4_divert_pop()dnl @@ -3816,7 +3819,7 @@ m4_append([AC_LIST_FILES], [ $1]) dnl Register the commands. ifelse([$2],,, [AC_FOREACH([AC_File], [$1], [m4_append([AC_LIST_FILES_COMMANDS], -[ ]patsubst(AC_File, [:.*])[ ) $2 ;; +[ ]m4_patsubst(AC_File, [:.*])[ ) $2 ;; ])])]) _AC_CONFIG_COMMANDS_INIT([$3]) m4_divert_pop()dnl @@ -4070,19 +4073,19 @@ Try \`$me --help' for more information."; exit 1 ;; # Handling of arguments. AC_FOREACH([AC_File], AC_LIST_FILES, -[ 'patsubst(AC_File, [:.*])' )dnl +[ 'm4_patsubst(AC_File, [:.*])' )dnl CONFIG_FILES="$CONFIG_FILES AC_File" ;; ])dnl AC_FOREACH([AC_File], AC_LIST_LINKS, -[ 'patsubst(AC_File, [:.*])' )dnl +[ 'm4_patsubst(AC_File, [:.*])' )dnl CONFIG_LINKS="$CONFIG_LINKS AC_File" ;; ])dnl AC_FOREACH([AC_File], AC_LIST_COMMANDS, -[ 'patsubst(AC_File, [:.*])' )dnl +[ 'm4_patsubst(AC_File, [:.*])' )dnl CONFIG_COMMANDS="$CONFIG_COMMANDS AC_File" ;; ])dnl AC_FOREACH([AC_File], AC_LIST_HEADERS, -[ 'patsubst(AC_File, [:.*])' )dnl +[ 'm4_patsubst(AC_File, [:.*])' )dnl CONFIG_HEADERS="$CONFIG_HEADERS AC_File" ;; ])dnl diff --git a/autoconf.m4 b/autoconf.m4 index a6ff1b8b..ff2f855f 100644 --- a/autoconf.m4 +++ b/autoconf.m4 @@ -24,20 +24,23 @@ include(m4sugar.m4)# -*- Autoconf -*- # yet when Autoconf is frozen. # Do not sinclude ./aclocal.m4 here, to prevent it from being frozen. -m4_include(m4sh.m4) +m4_include([m4sh.m4]) # M4sugar and M4sh use exclusively the `m4_' prefix, but Autoconf, # for historical reasons, uses the old names. -m4_copy([m4_define], [define]) -m4_copy([m4_defn], [defn]) -m4_copy([m4_popdef], [popdef]) -m4_copy([m4_pushdef], [pushdef]) -m4_copy([m4_undefine], [undefine]) +m4_copy_unm4([m4_define]) +m4_copy_unm4([m4_defn]) +m4_copy_unm4([m4_patsubst]) +m4_copy_unm4([m4_popdef]) +m4_copy_unm4([m4_pushdef]) +m4_copy_unm4([m4_regexp]) +m4_copy_unm4([m4_translit]) +m4_copy_unm4([m4_undefine]) -m4_include(acversion.m4) -m4_include(acgeneral.m4) -m4_include(aclang.m4) -m4_include(acfunctions.m4) -m4_include(acspecific.m4) -m4_include(acoldnames.m4) +m4_include([acversion.m4]) +m4_include([acgeneral.m4]) +m4_include([aclang.m4]) +m4_include([acfunctions.m4]) +m4_include([acspecific.m4]) +m4_include([acoldnames.m4]) diff --git a/lib/autoconf/autoconf.m4 b/lib/autoconf/autoconf.m4 index a6ff1b8b..ff2f855f 100644 --- a/lib/autoconf/autoconf.m4 +++ b/lib/autoconf/autoconf.m4 @@ -24,20 +24,23 @@ include(m4sugar.m4)# -*- Autoconf -*- # yet when Autoconf is frozen. # Do not sinclude ./aclocal.m4 here, to prevent it from being frozen. -m4_include(m4sh.m4) +m4_include([m4sh.m4]) # M4sugar and M4sh use exclusively the `m4_' prefix, but Autoconf, # for historical reasons, uses the old names. -m4_copy([m4_define], [define]) -m4_copy([m4_defn], [defn]) -m4_copy([m4_popdef], [popdef]) -m4_copy([m4_pushdef], [pushdef]) -m4_copy([m4_undefine], [undefine]) +m4_copy_unm4([m4_define]) +m4_copy_unm4([m4_defn]) +m4_copy_unm4([m4_patsubst]) +m4_copy_unm4([m4_popdef]) +m4_copy_unm4([m4_pushdef]) +m4_copy_unm4([m4_regexp]) +m4_copy_unm4([m4_translit]) +m4_copy_unm4([m4_undefine]) -m4_include(acversion.m4) -m4_include(acgeneral.m4) -m4_include(aclang.m4) -m4_include(acfunctions.m4) -m4_include(acspecific.m4) -m4_include(acoldnames.m4) +m4_include([acversion.m4]) +m4_include([acgeneral.m4]) +m4_include([aclang.m4]) +m4_include([acfunctions.m4]) +m4_include([acspecific.m4]) +m4_include([acoldnames.m4]) diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index ef539c52..3bb2103c 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -366,7 +366,7 @@ define([AH_VERBATIM], # DESCRIPTION (properly wrapped), and then #undef KEY. define([AH_TEMPLATE], [AH_VERBATIM([$1], - m4_wrap([$2 */], [ ], [/* ])[ + m4_text_wrap([$2 */], [ ], [/* ])[ #undef $1])]) @@ -409,7 +409,7 @@ define([_AH_COUNTER], [0]) # If EXPRESSION has shell indirections ($var or `expr`), expand # IF-INDIR, else IF-NOT-INDIR. define([AC_VAR_INDIR_IFELSE], -[ifelse(regexp([$1], [[`$]]), +[ifelse(m4_regexp([$1], [[`$]]), -1, [$3], [$2])]) @@ -431,7 +431,7 @@ define([AC_VAR_SET], # else into the appropriate `eval' sequence. define([AC_VAR_GET], [AC_VAR_INDIR_IFELSE([$1], - [`eval echo '${'patsubst($1, [[\\`]], [\\\&])'}'`], + [`eval echo '${'m4_patsubst($1, [[\\`]], [\\\&])'}'`], [$[]$1])]) @@ -516,10 +516,10 @@ define([AC_VAR_POPDEF], define([AC_TR_CPP], [AC_VAR_INDIR_IFELSE([$1], [`echo "$1" | $ac_tr_cpp`], - [patsubst(translit([[$1]], - [*abcdefghijklmnopqrstuvwxyz], - [PABCDEFGHIJKLMNOPQRSTUVWXYZ]), - [[^A-Z0-9_]], [_])])]) + [m4_patsubst(m4_translit([[$1]], + [*abcdefghijklmnopqrstuvwxyz], + [PABCDEFGHIJKLMNOPQRSTUVWXYZ]), + [[^A-Z0-9_]], [_])])]) # AC_TR_SH(EXPRESSION) @@ -530,8 +530,8 @@ define([AC_TR_CPP], define([AC_TR_SH], [AC_VAR_INDIR_IFELSE([$1], [`echo "$1" | $ac_tr_sh`], - [patsubst(translit([[$1]], [*+], [pp]), - [[^a-zA-Z0-9_]], [_])])]) + [m4_patsubst(m4_translit([[$1]], [*+], [pp]), + [[^a-zA-Z0-9_]], [_])])]) @@ -608,7 +608,7 @@ define([AC_FOREACH], define([AC_HELP_STRING], [m4_pushdef([AC_Prefix], m4_default([$3], [ ]))dnl m4_pushdef([AC_Prefix_Format], [ %-]m4_eval(len(AC_Prefix) - 3)[s ])dnl [ %-23s ] -m4_wrap([$2], AC_Prefix, m4_format(AC_Prefix_Format, [$1]))dnl +m4_text_wrap([$2], AC_Prefix, m4_format(AC_Prefix_Format, [$1]))dnl m4_popdef([AC_Prefix_Format])dnl m4_popdef([AC_Prefix])dnl ]) @@ -651,10 +651,10 @@ define([AC_PACKAGE_BUGREPORT], [$3])dnl # would have not been evaluated. Another solution, a bit fragile, # would have be to use m4_quote to force an evaluation: # -# patsubst(m4_quote($1), [^], [# ]) +# m4_patsubst(m4_quote($1), [^], [# ]) define([AC_COPYRIGHT], [m4_divert([NOTICE], -[patsubst([ +[m4_patsubst([ $1], [^], [@%:@ ])])dnl m4_divert([VERSION_BEGIN], [ @@ -1632,8 +1632,8 @@ Optional Features: --enable-FEATURE[=ARG] include FEATURE [ARG=yes]]])dnl AC_DIVERT_ONCE([HELP_ENABLE], [$2])dnl # Check whether --enable-$1 or --disable-$1 was given. -if test "[${enable_]patsubst([$1], -, _)+set}" = set; then - enableval="[$enable_]patsubst([$1], -, _)" +if test "[${enable_]m4_patsubst([$1], -, _)+set}" = set; then + enableval="[$enable_]m4_patsubst([$1], -, _)" $3 m4_ifvanl([$4], [else $4])dnl @@ -1660,8 +1660,8 @@ Optional Packages: --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)]]) AC_DIVERT_ONCE([HELP_WITH], [$2])dnl # Check whether --with-$1 or --without-$1 was given. -if test "[${with_]patsubst([$1], -, _)+set}" = set; then - withval="[$with_]patsubst([$1], -, _)" +if test "[${with_]m4_patsubst([$1], -, _)+set}" = set; then + withval="[$with_]m4_patsubst([$1], -, _)" $3 m4_ifvanl([$4], [else $4])dnl @@ -2072,8 +2072,8 @@ rm -f confcache[]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. define([AC_CACHE_VAL], -[ifelse(regexp([$2], [AC_DEFINE]), [-1], [], - [AC_DIAGNOSE(syntax, +[ifelse(m4_regexp([$2], [AC_DEFINE]), [-1], [], + [AC_DIAGNOSE(syntax, [$0($1, ...): suspicious presence of an AC_DEFINE in the second argument, ]dnl [where no actions should be taken])])dnl AC_VAR_SET_IFELSE([$1], @@ -2227,8 +2227,8 @@ define([AC_FATAL], # Otherwise it's modern. # We use two quotes in the pattern to keep highlighting tools at peace. define([_AC_SH_QUOTE_IFELSE], -[ifelse(regexp([$1], [\\[\\$]]), - [-1], [ifelse(regexp([$1], [\\[`""]]), +[ifelse(m4_regexp([$1], [\\[\\$]]), + [-1], [ifelse(m4_regexp([$1], [\\[`""]]), [-1], [$2], [$3])], [$2])]) @@ -2243,7 +2243,7 @@ define([_AC_SH_QUOTE_IFELSE], # the transition (for Libtool for instance). define([_AC_SH_QUOTE], [_AC_SH_QUOTE_IFELSE([$1], - [patsubst([$1], [\([`""]\)], [\\\1])], + [m4_patsubst([$1], [\([`""]\)], [\\\1])], [AC_DIAGNOSE([obsolete], [backquotes and double quotes should not be backslashed in: $1])dnl $1])]) @@ -2432,7 +2432,7 @@ define([AC_INCLUDES_DEFAULT], AC_DEFUN([AC_CHECK_MEMBER], [AC_VAR_INDIR_IFELSE([$1], [AC_FATAL([$0: requires literal arguments])])dnl -ifelse(regexp([$1], [\.]), -1, +ifelse(m4_regexp([$1], [\.]), -1, [AC_FATAL([$0: Did not see any dot in `$1'])])dnl AC_REQUIRE([AC_HEADER_STDC])dnl AC_VAR_PUSHDEF([ac_Member], [ac_cv_member_$1])dnl @@ -2440,9 +2440,9 @@ 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 foo; -patsubst([$1], [\..*]) foo; +m4_patsubst([$1], [\..*]) foo; dnl foo.MEMBER; -foo.patsubst([$1], [^[^.]*\.]);])], +foo.m4_patsubst([$1], [^[^.]*\.]);])], AC_VAR_SET(ac_Member, yes), AC_VAR_SET(ac_Member, no))]) AS_IFELSE([test AC_VAR_GET(ac_Member) = yes], @@ -2460,8 +2460,9 @@ AC_DEFUN([AC_CHECK_MEMBERS], [m4_foreach([AC_Member], [$1], [AC_CHECK_MEMBER(AC_Member, [AC_DEFINE_UNQUOTED(AC_TR_CPP(HAVE_[]AC_Member), 1, - [Define if `]patsubst(AC_Member, [^[^.]*\.])[' is - member of `]patsubst(AC_Member, [\..*])['.]) + [Define if `]m4_patsubst(AC_Member, + [^[^.]*\.])[' is + member of `]m4_patsubst(AC_Member, [\..*])['.]) $2], [$3], [$4])])]) @@ -2804,7 +2805,9 @@ define([AH_CHECK_LIB], # it must be a literal name. AU_DEFUN([AC_HAVE_LIBRARY], [m4_pushdef([AC_Lib_Name], - patsubst(patsubst([[$1]], [lib\([^\.]*\)\.a], [\1]), [-l], []))dnl + m4_patsubst(m4_patsubst([[$1]], + [lib\([^\.]*\)\.a], [\1]), + [-l], []))dnl AC_CHECK_LIB(AC_Lib_Name, main, [$2], [$3], [$4])dnl ac_cv_lib_[]AC_Lib_Name()=ac_cv_lib_[]AC_Lib_Name()_main m4_popdef([AC_Lib_Name])dnl @@ -3413,7 +3416,7 @@ define([_AC_CHECK_TYPE_OLD], # Because many people have used `off_t' and `size_t' too, they are added # for better common-useward backward compatibility. define([_AC_CHECK_TYPE_REPLACEMENT_TYPE_P], -[ifelse(regexp([$1], +[ifelse(m4_regexp([$1], [^\(_Bool\|bool\|char\|double\|float\|int\|long\|short\|\(un\)?signed\|size_t\|off_t\)\([_a-zA-Z0-9() *]\|\[\|\]\)*$]), 0, 1, 0)dnl ])# _AC_CHECK_TYPE_REPLACEMENT_TYPE_P @@ -3423,7 +3426,7 @@ define([_AC_CHECK_TYPE_REPLACEMENT_TYPE_P], # ----------------------------------- # Return `1' if STRING looks like a C/C++ type. define([_AC_CHECK_TYPE_MAYBE_TYPE_P], -[ifelse(regexp([$1], [^[_a-zA-Z0-9 ]+\([_a-zA-Z0-9() *]\|\[\|\]\)*$]), +[ifelse(m4_regexp([$1], [^[_a-zA-Z0-9 ]+\([_a-zA-Z0-9() *]\|\[\|\]\)*$]), 0, 1, 0)dnl ])# _AC_CHECK_TYPE_MAYBE_TYPE_P @@ -3540,8 +3543,8 @@ AC_DEFUN([AC_CHECK_TYPE], # matching. The big problem is then that the active characters should # be quoted. Currently `+*.' are quoted. define([AC_CONFIG_IF_MEMBER], -[ifelse(regexp($2, [\(^\| \)]patsubst([$1], - [\([+*.]\)], [\\\1])[\(:\| \|$\)]), +[ifelse(m4_regexp($2, [\(^\| \)]m4_patsubst([$1], + [\([+*.]\)], [\\\1])[\(:\| \|$\)]), -1, [$4], [$3])]) @@ -3568,7 +3571,7 @@ define([_AC_CONFIG_DEPENDENCY], define([_AC_CONFIG_DEPENDENCIES], [m4_divert_push([KILL]) AC_FOREACH([AC_File], [$1], - [_AC_CONFIG_DEPENDENCY(patsubst(AC_File, [:], [,]))]) + [_AC_CONFIG_DEPENDENCY(m4_patsubst(AC_File, [:], [,]))]) m4_divert_pop()dnl ]) @@ -3585,7 +3588,7 @@ m4_divert_pop()dnl define([_AC_CONFIG_UNIQUE], [m4_divert_push([KILL]) AC_FOREACH([AC_File], [$1], -[m4_pushdef([AC_Dest], patsubst(AC_File, [:.*])) +[m4_pushdef([AC_Dest], m4_patsubst(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], @@ -3630,7 +3633,7 @@ m4_append([AC_LIST_COMMANDS], [ $1]) ifelse([$2],,, [AC_FOREACH([AC_Name], [$1], [m4_append([AC_LIST_COMMANDS_COMMANDS], -[ ]patsubst(AC_Name, [:.*])[ ) $2 ;; +[ ]m4_patsubst(AC_Name, [:.*])[ ) $2 ;; ])])]) _AC_CONFIG_COMMANDS_INIT([$3]) m4_divert_pop()dnl @@ -3708,7 +3711,7 @@ m4_append([AC_LIST_HEADERS], [ $1]) dnl Register the commands ifelse([$2],,, [AC_FOREACH([AC_File], [$1], [m4_append([AC_LIST_HEADERS_COMMANDS], -[ ]patsubst(AC_File, [:.*])[ ) $2 ;; +[ ]m4_patsubst(AC_File, [:.*])[ ) $2 ;; ])])]) _AC_CONFIG_COMMANDS_INIT([$3]) m4_divert_pop()dnl @@ -3739,13 +3742,13 @@ AC_DEFUN([AC_CONFIG_LINKS], [m4_divert_push([KILL]) _AC_CONFIG_UNIQUE([$1]) _AC_CONFIG_DEPENDENCIES([$1]) -ifelse(regexp([$1], [^\.:\| \.:]), -1,, +ifelse(m4_regexp([$1], [^\.:\| \.:]), -1,, [AC_FATAL([$0: invalid destination: `.'])]) m4_append([AC_LIST_LINKS], [ $1]) dnl Register the commands ifelse([$2],,, [AC_FOREACH([AC_File], [$1], [m4_append([AC_LIST_LINKS_COMMANDS], -[ ]patsubst(AC_File, [:.*])[ ) $2 ;; +[ ]m4_patsubst(AC_File, [:.*])[ ) $2 ;; ])])]) _AC_CONFIG_COMMANDS_INIT([$3]) m4_divert_pop()dnl @@ -3816,7 +3819,7 @@ m4_append([AC_LIST_FILES], [ $1]) dnl Register the commands. ifelse([$2],,, [AC_FOREACH([AC_File], [$1], [m4_append([AC_LIST_FILES_COMMANDS], -[ ]patsubst(AC_File, [:.*])[ ) $2 ;; +[ ]m4_patsubst(AC_File, [:.*])[ ) $2 ;; ])])]) _AC_CONFIG_COMMANDS_INIT([$3]) m4_divert_pop()dnl @@ -4070,19 +4073,19 @@ Try \`$me --help' for more information."; exit 1 ;; # Handling of arguments. AC_FOREACH([AC_File], AC_LIST_FILES, -[ 'patsubst(AC_File, [:.*])' )dnl +[ 'm4_patsubst(AC_File, [:.*])' )dnl CONFIG_FILES="$CONFIG_FILES AC_File" ;; ])dnl AC_FOREACH([AC_File], AC_LIST_LINKS, -[ 'patsubst(AC_File, [:.*])' )dnl +[ 'm4_patsubst(AC_File, [:.*])' )dnl CONFIG_LINKS="$CONFIG_LINKS AC_File" ;; ])dnl AC_FOREACH([AC_File], AC_LIST_COMMANDS, -[ 'patsubst(AC_File, [:.*])' )dnl +[ 'm4_patsubst(AC_File, [:.*])' )dnl CONFIG_COMMANDS="$CONFIG_COMMANDS AC_File" ;; ])dnl AC_FOREACH([AC_File], AC_LIST_HEADERS, -[ 'patsubst(AC_File, [:.*])' )dnl +[ 'm4_patsubst(AC_File, [:.*])' )dnl CONFIG_HEADERS="$CONFIG_HEADERS AC_File" ;; ])dnl diff --git a/lib/m4sugar/m4sugar.m4 b/lib/m4sugar/m4sugar.m4 index f7cd1d81..bbec258d 100644 --- a/lib/m4sugar/m4sugar.m4 +++ b/lib/m4sugar/m4sugar.m4 @@ -91,14 +91,38 @@ m4_define([m4_copy], m4_define([m4_rename], [m4_copy([$1], [$2])m4_undefine([$1])]) + +# m4_rename_m4(MACRO-NAME) +# ------------------------ +# Rename MACRO-NAME as m4_MACRO-NAME. +m4_define([m4_rename_m4], +[m4_rename([$1], [m4_$1])]) + + +# m4_copy_unm4(m4_MACRO-NAME) +# --------------------------- +# Copy m4_MACRO-NAME as MACRO-NAME. +m4_define([m4_copy_unm4], +[m4_copy([$1], m4_patsubst([[$1]], [[m4_]]))]) + + # Some m4 internals have names colliding with tokens we might use. # Rename them a` la `m4 --prefix-builtins'. -m4_rename([eval], [m4_eval]) -m4_rename([format], [m4_format]) -m4_rename([popdef], [m4_popdef]) -m4_rename([pushdef], [m4_pushdef]) -m4_rename([shift], [m4_shift]) -m4_rename([symbols], [m4_symbols]) +m4_rename_m4([debugfile]) +m4_rename_m4([debugmode]) +m4_rename_m4([eval]) +m4_rename_m4([format]) +m4_rename([m4exit], [m4_exit]) +m4_rename([m4wrap], [m4_wrap]) +m4_rename_m4([maketemp]) +m4_rename_m4([patsubst]) +m4_rename_m4([popdef]) +m4_rename_m4([pushdef]) +m4_rename_m4([regexp]) +m4_rename_m4([shift]) +m4_rename_m4([substr]) +m4_rename_m4([symbols]) +m4_rename_m4([translit]) ## ------------------- ## @@ -131,7 +155,7 @@ m4_define([m4_warning], m4_define([m4_fatal], [m4_errprint(m4_location[: error: $1])dnl m4_expansion_stack_dump()dnl -m4exit(ifelse([$2],, 1, [$2]))]) +m4_exit(ifelse([$2],, 1, [$2]))]) # m4_assert( EXPRESSION [, EXIT-STATUS = 1 ]) @@ -359,7 +383,7 @@ m4_define([m4_match], [ifelse([$#], 0, [], [$#], 1, [], [$#], 2, [$2], - regexp([$1], [$2]), -1, [m4_match([$1], m4_shiftn(3, $@))], + m4_regexp([$1], [$2]), -1, [m4_match([$1], m4_shiftn(3, $@))], [$3])]) @@ -1151,14 +1175,14 @@ m4_define([m4_provide_ifelse], # ------------------ # These macros lowercase and uppercase strings. m4_define([m4_tolower], -[translit([$1], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ], - [abcdefghijklmnopqrstuvwxyz])]) +[m4_translit([$1], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ], + [abcdefghijklmnopqrstuvwxyz])]) m4_define([m4_toupper], -[translit([$1], - [abcdefghijklmnopqrstuvwxyz], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ])]) +[m4_translit([$1], + [abcdefghijklmnopqrstuvwxyz], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ])]) # m4_split(STRING, [REGEXP]) @@ -1190,9 +1214,9 @@ m4_define(<>, <>) changequote([, ]) @@ -1209,7 +1233,7 @@ changequote([, ]) # ive])end # => active activeend m4_define([m4_join], -[translit(patsubst([[[$1]]], [\\ +[m4_translit(m4_patsubst([[[$1]]], [\\ ]), [ ], [ ])]) @@ -1236,7 +1260,7 @@ m4_define([m4_join], # the *third* character, since there are two leading `['; Equally for # the outer patsubst. m4_define([m4_strip], -[patsubst(patsubst(patsubst([[[[$1]]]], +[m4_patsubst(m4_patsubst(m4_patsubst([[[[$1]]]], [[ ]+], [ ]), [^\(..\) ], [\1]), [ \(.\)$], [\1])]) @@ -1302,8 +1326,8 @@ m4_define([_m4_foreach_quoted], [$3])])]) -# m4_wrap(STRING, [PREFIX], [FIRST-PREFIX], [WIDTH]) -# -------------------------------------------------- +# m4_text_wrap(STRING, [PREFIX], [FIRST-PREFIX], [WIDTH]) +# ------------------------------------------------------- # Expands into STRING wrapped to hold in WIDTH columns (default = 79). # If prefix is set, each line is prefixed with it. If FIRST-PREFIX is # specified, then the first line is prefixed with it. As a special @@ -1312,21 +1336,21 @@ m4_define([_m4_foreach_quoted], # # Typical outputs are: # -# m4_wrap([Short string */], [ ], [/* ], 20) +# m4_text_wrap([Short string */], [ ], [/* ], 20) # => /* Short string */ # -# m4_wrap([Much longer string */], [ ], [/* ], 20) +# m4_text_wrap([Much longer string */], [ ], [/* ], 20) # => /* Much longer # => string */ # -# m4_wrap([Short doc.], [ ], [ --short ], 30) +# m4_text_wrap([Short doc.], [ ], [ --short ], 30) # => --short Short doc. # -# m4_wrap([Short doc.], [ ], [ --too-wide ], 30) +# m4_text_wrap([Short doc.], [ ], [ --too-wide ], 30) # => --too-wide # => Short doc. # -# m4_wrap([Super long documentation.], [ ], [ --too-wide ], 30) +# m4_text_wrap([Super long documentation.], [ ], [ --too-wide ], 30) # => --too-wide # => Super long # => documentation. @@ -1339,7 +1363,7 @@ m4_define([_m4_foreach_quoted], # what complicates it a bit. The algorithm is stupid simple: all the # words are preceded by m4_Separator which is defined to empty for the # first word, and then ` ' (single space) for all the others. -m4_define([m4_wrap], +m4_define([m4_text_wrap], [m4_pushdef([m4_Prefix], m4_default([$2], []))dnl m4_pushdef([m4_Prefix1], m4_default([$3], [m4_Prefix]))dnl m4_pushdef([m4_Width], m4_default([$4], 79))dnl @@ -1430,15 +1454,15 @@ m4_define([m4_list_cmp], # 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], -[translit(patsubst(patsubst(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]), - abcdefghijklmnopqrstuvwxyz, - 12345678901234567890123456)]) +[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]), + [abcdefghijklmnopqrstuvwxyz], + [12345678901234567890123456])]) # m4_version_compare(VERSION-1, VERSION-2) diff --git a/m4sugar.m4 b/m4sugar.m4 index f7cd1d81..bbec258d 100644 --- a/m4sugar.m4 +++ b/m4sugar.m4 @@ -91,14 +91,38 @@ m4_define([m4_copy], m4_define([m4_rename], [m4_copy([$1], [$2])m4_undefine([$1])]) + +# m4_rename_m4(MACRO-NAME) +# ------------------------ +# Rename MACRO-NAME as m4_MACRO-NAME. +m4_define([m4_rename_m4], +[m4_rename([$1], [m4_$1])]) + + +# m4_copy_unm4(m4_MACRO-NAME) +# --------------------------- +# Copy m4_MACRO-NAME as MACRO-NAME. +m4_define([m4_copy_unm4], +[m4_copy([$1], m4_patsubst([[$1]], [[m4_]]))]) + + # Some m4 internals have names colliding with tokens we might use. # Rename them a` la `m4 --prefix-builtins'. -m4_rename([eval], [m4_eval]) -m4_rename([format], [m4_format]) -m4_rename([popdef], [m4_popdef]) -m4_rename([pushdef], [m4_pushdef]) -m4_rename([shift], [m4_shift]) -m4_rename([symbols], [m4_symbols]) +m4_rename_m4([debugfile]) +m4_rename_m4([debugmode]) +m4_rename_m4([eval]) +m4_rename_m4([format]) +m4_rename([m4exit], [m4_exit]) +m4_rename([m4wrap], [m4_wrap]) +m4_rename_m4([maketemp]) +m4_rename_m4([patsubst]) +m4_rename_m4([popdef]) +m4_rename_m4([pushdef]) +m4_rename_m4([regexp]) +m4_rename_m4([shift]) +m4_rename_m4([substr]) +m4_rename_m4([symbols]) +m4_rename_m4([translit]) ## ------------------- ## @@ -131,7 +155,7 @@ m4_define([m4_warning], m4_define([m4_fatal], [m4_errprint(m4_location[: error: $1])dnl m4_expansion_stack_dump()dnl -m4exit(ifelse([$2],, 1, [$2]))]) +m4_exit(ifelse([$2],, 1, [$2]))]) # m4_assert( EXPRESSION [, EXIT-STATUS = 1 ]) @@ -359,7 +383,7 @@ m4_define([m4_match], [ifelse([$#], 0, [], [$#], 1, [], [$#], 2, [$2], - regexp([$1], [$2]), -1, [m4_match([$1], m4_shiftn(3, $@))], + m4_regexp([$1], [$2]), -1, [m4_match([$1], m4_shiftn(3, $@))], [$3])]) @@ -1151,14 +1175,14 @@ m4_define([m4_provide_ifelse], # ------------------ # These macros lowercase and uppercase strings. m4_define([m4_tolower], -[translit([$1], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ], - [abcdefghijklmnopqrstuvwxyz])]) +[m4_translit([$1], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ], + [abcdefghijklmnopqrstuvwxyz])]) m4_define([m4_toupper], -[translit([$1], - [abcdefghijklmnopqrstuvwxyz], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ])]) +[m4_translit([$1], + [abcdefghijklmnopqrstuvwxyz], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ])]) # m4_split(STRING, [REGEXP]) @@ -1190,9 +1214,9 @@ m4_define(<>, <>) changequote([, ]) @@ -1209,7 +1233,7 @@ changequote([, ]) # ive])end # => active activeend m4_define([m4_join], -[translit(patsubst([[[$1]]], [\\ +[m4_translit(m4_patsubst([[[$1]]], [\\ ]), [ ], [ ])]) @@ -1236,7 +1260,7 @@ m4_define([m4_join], # the *third* character, since there are two leading `['; Equally for # the outer patsubst. m4_define([m4_strip], -[patsubst(patsubst(patsubst([[[[$1]]]], +[m4_patsubst(m4_patsubst(m4_patsubst([[[[$1]]]], [[ ]+], [ ]), [^\(..\) ], [\1]), [ \(.\)$], [\1])]) @@ -1302,8 +1326,8 @@ m4_define([_m4_foreach_quoted], [$3])])]) -# m4_wrap(STRING, [PREFIX], [FIRST-PREFIX], [WIDTH]) -# -------------------------------------------------- +# m4_text_wrap(STRING, [PREFIX], [FIRST-PREFIX], [WIDTH]) +# ------------------------------------------------------- # Expands into STRING wrapped to hold in WIDTH columns (default = 79). # If prefix is set, each line is prefixed with it. If FIRST-PREFIX is # specified, then the first line is prefixed with it. As a special @@ -1312,21 +1336,21 @@ m4_define([_m4_foreach_quoted], # # Typical outputs are: # -# m4_wrap([Short string */], [ ], [/* ], 20) +# m4_text_wrap([Short string */], [ ], [/* ], 20) # => /* Short string */ # -# m4_wrap([Much longer string */], [ ], [/* ], 20) +# m4_text_wrap([Much longer string */], [ ], [/* ], 20) # => /* Much longer # => string */ # -# m4_wrap([Short doc.], [ ], [ --short ], 30) +# m4_text_wrap([Short doc.], [ ], [ --short ], 30) # => --short Short doc. # -# m4_wrap([Short doc.], [ ], [ --too-wide ], 30) +# m4_text_wrap([Short doc.], [ ], [ --too-wide ], 30) # => --too-wide # => Short doc. # -# m4_wrap([Super long documentation.], [ ], [ --too-wide ], 30) +# m4_text_wrap([Super long documentation.], [ ], [ --too-wide ], 30) # => --too-wide # => Super long # => documentation. @@ -1339,7 +1363,7 @@ m4_define([_m4_foreach_quoted], # what complicates it a bit. The algorithm is stupid simple: all the # words are preceded by m4_Separator which is defined to empty for the # first word, and then ` ' (single space) for all the others. -m4_define([m4_wrap], +m4_define([m4_text_wrap], [m4_pushdef([m4_Prefix], m4_default([$2], []))dnl m4_pushdef([m4_Prefix1], m4_default([$3], [m4_Prefix]))dnl m4_pushdef([m4_Width], m4_default([$4], 79))dnl @@ -1430,15 +1454,15 @@ m4_define([m4_list_cmp], # 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], -[translit(patsubst(patsubst(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]), - abcdefghijklmnopqrstuvwxyz, - 12345678901234567890123456)]) +[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]), + [abcdefghijklmnopqrstuvwxyz], + [12345678901234567890123456])]) # m4_version_compare(VERSION-1, VERSION-2) diff --git a/tests/atspecific.m4 b/tests/atspecific.m4 index dd177407..2461e7da 100644 --- a/tests/atspecific.m4 +++ b/tests/atspecific.m4 @@ -22,10 +22,12 @@ divert(-1) -*- Autoconf -*- include(atgeneral.m4)divert(-1) -# Until the day Autotest, Ad'HoC and Autoconf share the same m4sugar, we +# Until the day Autotest, Ad'HoC and Autoconf share the same M4sugar, we # have to reinstall some m4 builtins that atgeneral.m4 undefined. AT_DEFINE([m4_shift], [builtin([shift], $@)]) +AT_DEFINE([m4_patsubst], +[builtin([patsubst], $@)]) AT_DEFINE([define], [builtin([define], $@)]) diff --git a/tests/m4sugar.at b/tests/m4sugar.at index 25cfa368..e7df9e19 100644 --- a/tests/m4sugar.at +++ b/tests/m4sugar.at @@ -6,29 +6,29 @@ M4sugar. EOF -## ------- ## -## m4_wrap ## -## ------- ## +## -------------- ## +## m4_text_wrap. ## +## -------------- ## -AT_SETUP(m4_wrap) +AT_SETUP(m4_text_wrap) -# m4_wrap is used to display the help strings. Also, check that +# m4_text_wrap is used to display the help strings. Also, check that # commas are not swallowed. This can easily happen because of # m4-listification. AT_DATA(configure.in, [[AC_PLAIN_SCRIPT()dnl -m4_wrap([Short string */], [ ], [/* ], 20) +m4_text_wrap([Short string */], [ ], [/* ], 20) -m4_wrap([Much longer string */], [ ], [/* ], 20) +m4_text_wrap([Much longer string */], [ ], [/* ], 20) -m4_wrap([Short doc.], [ ], [ --short ], 30) +m4_text_wrap([Short doc.], [ ], [ --short ], 30) -m4_wrap([Short doc.], [ ], [ --too-wide], 30) +m4_text_wrap([Short doc.], [ ], [ --too-wide], 30) -m4_wrap([Super long documentation.], [ ], [ --too-wide], 30) +m4_text_wrap([Super long documentation.], [ ], [ --too-wide], 30) -m4_wrap([First, second , third, [,quoted]]) +m4_text_wrap([First, second , third, [,quoted]]) ]]) AT_DATA(expout, diff --git a/tests/torture.at b/tests/torture.at index 394114ec..4b3120c9 100644 --- a/tests/torture.at +++ b/tests/torture.at @@ -34,7 +34,7 @@ define(DEFINE_Description, # 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.*. define(AT_DUMMY_VAR, -[ac_Dummy_[]patsubst([000$1], [.*\(...\)$], [\1])]) +[ac_Dummy_[]m4_patsubst([000$1], [.*\(...\)$], [\1])]) dnl This call was quite delicate to write because we didn't want to dnl produce the 100 commands by hand. Be very careful if you want to