From: Akim Demaille Date: Wed, 6 Dec 2000 08:58:41 +0000 (+0000) Subject: * m4sugar.m4 (ifelse): Rename as... X-Git-Tag: autoconf-2.50~348 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=482e84f65ca02c14f84fc41ed906ffeb0e8d3a9c;p=thirdparty%2Fautoconf.git * m4sugar.m4 (ifelse): Rename as... (m4_if): this. * autoconf.m4 (ifelse): Restore. --- diff --git a/ChangeLog b/ChangeLog index 6e86c5abc..2c4ccbd38 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2000-12-06 Akim Demaille + + * m4sugar.m4 (ifelse): Rename as... + (m4_if): this. + * autoconf.m4 (ifelse): Restore. + 2000-12-06 Akim Demaille * m4sugar.m4 (m4_dquote, m4_pattern_forbid, m4_pattern_allow) diff --git a/acgeneral.m4 b/acgeneral.m4 index 026f9e43c..2db9dce2b 100644 --- a/acgeneral.m4 +++ b/acgeneral.m4 @@ -366,9 +366,9 @@ m4_define([_AH_COUNTER], [0]) # If EXPRESSION has shell indirections ($var or `expr`), expand # IF-INDIR, else IF-NOT-INDIR. m4_define([AC_VAR_INDIR_IFELSE], -[ifelse(m4_regexp([$1], [[`$]]), - -1, [$3], - [$2])]) +[m4_if(m4_regexp([$1], [[`$]]), + -1, [$3], + [$2])]) # AC_VAR_SET(VARIABLE, VALUE) # --------------------------- @@ -649,7 +649,7 @@ m4_define([AC_REVISION], # occurrences with the current version of Autoconf, which is certainly # not what mean the user. AU_DEFUN([AC_PREREQ], -[ifelse(m4_version_compare(]m4_defn([AC_ACVERSION])[, [$1]), -1, +[m4_if(m4_version_compare(]m4_defn([AC_ACVERSION])[, [$1]), -1, [m4_fatal([Autoconf version $1 or higher is required for this script])])dnl [AC_PREREQ(]]m4_defn([AC_ACVERSION])[[)]]) @@ -658,7 +658,7 @@ AU_DEFUN([AC_PREREQ], # ------------------ # Complain and exit if the Autoconf version is less than VERSION. m4_define([AC_PREREQ], -[ifelse(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, +[m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [AC_FATAL([Autoconf version $1 or higher is required for this script])])]) @@ -2021,8 +2021,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. m4_define([AC_CACHE_VAL], -[ifelse(m4_regexp([$2], [AC_DEFINE]), [-1], [], - [AC_DIAGNOSE(syntax, +[m4_if(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], @@ -2069,7 +2069,7 @@ m4_define([AC_DEFINE], [AC_DEFINE_TRACE([$1])dnl m4_ifval([$3], [AH_TEMPLATE([$1], [$3])])dnl cat >>confdefs.h <<\EOF -[#define] $1 ifelse($#, 2, [$2], $#, 3, [$2], 1) +[@%:@define] $1 m4_if($#, 2, [$2], $#, 3, [$2], 1) EOF ]) @@ -2081,7 +2081,7 @@ m4_define([AC_DEFINE_UNQUOTED], [AC_DEFINE_TRACE([$1])dnl m4_ifval([$3], [AH_TEMPLATE([$1], [$3])])dnl cat >>confdefs.h < NEW plus a warning # 4. default => NEW AC_DEFUN([AC_CHECK_TYPE], -[ifelse($#, 3, - [_AC_CHECK_TYPE_NEW($@)], - $#, 4, - [_AC_CHECK_TYPE_NEW($@)], - _AC_CHECK_TYPE_REPLACEMENT_TYPE_P([$2]), 1, - [_AC_CHECK_TYPE_OLD($@)], - _AC_CHECK_TYPE_MAYBE_TYPE_P([$2]), 1, - [AC_DIAGNOSE([syntax], +[m4_if($#, 3, + [_AC_CHECK_TYPE_NEW($@)], + $#, 4, + [_AC_CHECK_TYPE_NEW($@)], + _AC_CHECK_TYPE_REPLACEMENT_TYPE_P([$2]), 1, + [_AC_CHECK_TYPE_OLD($@)], + _AC_CHECK_TYPE_MAYBE_TYPE_P([$2]), 1, + [AC_DIAGNOSE([syntax], [$0: assuming `$2' is not a type])_AC_CHECK_TYPE_NEW($@)], - [_AC_CHECK_TYPE_NEW($@)])[]dnl + [_AC_CHECK_TYPE_NEW($@)])[]dnl ])# AC_CHECK_TYPE @@ -3399,9 +3400,9 @@ AC_DEFUN([AC_CHECK_TYPE], # matching. The big problem is then that the active characters should # be quoted. Currently `+*.' are quoted. m4_define([AC_CONFIG_IF_MEMBER], -[ifelse(m4_regexp($2, [\(^\| \)]m4_patsubst([$1], - [\([+*.]\)], [\\\1])[\(:\| \|$\)]), - -1, [$4], [$3])]) +[m4_if(m4_regexp($2, [\(^\| \)]m4_patsubst([$1], + [\([+*.]\)], [\\\1])[\(:\| \|$\)]), + -1, [$4], [$3])]) # AC_FILE_DEPENDENCY_TRACE(DEST, SOURCE1, [SOURCE2...]) @@ -3488,7 +3489,7 @@ AC_DEFUN([AC_CONFIG_COMMANDS], _AC_CONFIG_UNIQUE([$1]) m4_append([AC_LIST_COMMANDS], [ $1]) -ifelse([$2],,, [AC_FOREACH([AC_Name], [$1], +m4_if([$2],,, [AC_FOREACH([AC_Name], [$1], [m4_append([AC_LIST_COMMANDS_COMMANDS], [ ]m4_patsubst(AC_Name, [:.*])[ ) $2 ;; ])])]) @@ -3566,7 +3567,7 @@ _AC_CONFIG_UNIQUE([$1]) _AC_CONFIG_DEPENDENCIES([$1]) m4_append([AC_LIST_HEADERS], [ $1]) dnl Register the commands -ifelse([$2],,, [AC_FOREACH([AC_File], [$1], +m4_ifval([$2], [AC_FOREACH([AC_File], [$1], [m4_append([AC_LIST_HEADERS_COMMANDS], [ ]m4_patsubst(AC_File, [:.*])[ ) $2 ;; ])])]) @@ -3599,11 +3600,11 @@ AC_DEFUN([AC_CONFIG_LINKS], [m4_divert_push([KILL]) _AC_CONFIG_UNIQUE([$1]) _AC_CONFIG_DEPENDENCIES([$1]) -ifelse(m4_regexp([$1], [^\.:\| \.:]), -1,, - [AC_FATAL([$0: invalid destination: `.'])]) +m4_if(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_ifval([$2], [AC_FOREACH([AC_File], [$1], [m4_append([AC_LIST_LINKS_COMMANDS], [ ]m4_patsubst(AC_File, [:.*])[ ) $2 ;; ])])]) @@ -3633,8 +3634,8 @@ m4_define([AC_LIST_LINKS_COMMANDS]) # # _AC_LINK_CNT is used to be robust to multiple calls. AU_DEFUN([AC_LINK_FILES], -[ifelse($#, 2, , - [m4_fatal([$0: incorrect number of arguments])])dnl +[m4_if($#, 2, , + [m4_fatal([$0: incorrect number of arguments])])dnl m4_define([_AC_LINK_FILES_CNT], m4_incr(_AC_LINK_FILES_CNT))dnl ac_sources="$1" ac_dests="$2" @@ -3674,7 +3675,7 @@ _AC_CONFIG_UNIQUE([$1]) _AC_CONFIG_DEPENDENCIES([$1]) m4_append([AC_LIST_FILES], [ $1]) dnl Register the commands. -ifelse([$2],,, [AC_FOREACH([AC_File], [$1], +m4_ifval([$2], [AC_FOREACH([AC_File], [$1], [m4_append([AC_LIST_FILES_COMMANDS], [ ]m4_patsubst(AC_File, [:.*])[ ) $2 ;; ])])]) @@ -4749,8 +4750,8 @@ fi]) # ACTION-IF-NOT-FOUND. AC_DEFUN([AC_LIST_MEMBER_OF], [dnl Do some sanity checking of the arguments. -ifelse([$1], , [AC_FATAL([$0]: missing argument 1)])dnl -ifelse([$2], , [AC_FATAL([$0]: missing argument 2)])dnl +m4_if([$1], , [AC_FATAL([$0]: missing argument 1)])dnl +m4_if([$2], , [AC_FATAL([$0]: missing argument 2)])dnl ac_exists=false for ac_i in $2; do diff --git a/aclang.m4 b/aclang.m4 index 37158c9af..0a8fc8491 100644 --- a/aclang.m4 +++ b/aclang.m4 @@ -134,8 +134,7 @@ AC_LANG([$1])]) # Restore the previous language. m4_define([AC_LANG_POP], [m4_popdef([_AC_LANG])dnl -ifelse(_AC_LANG, [_AC_LANG], - [AC_FATAL([too many $0])])dnl +m4_if(_AC_LANG, [_AC_LANG], [AC_FATAL([too many $0])])dnl AC_LANG(_AC_LANG)]) @@ -345,7 +344,7 @@ $2 # Avoid conflicting decl of main. m4_define([AC_LANG_CALL(C)], [AC_LANG_PROGRAM([$1 -ifelse([$2], [main], , +m4_if([$2], [main], , [/* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" @@ -1789,7 +1788,7 @@ case $ac_cv_f77_mangling in *) ac_val="unknown" ;; esac case $ac_cv_f77_mangling in *," underscore"*) ac_val="$ac_val"_ ;; esac -ifelse(m4_index([$1],[_]),-1,[], +m4_if(m4_index([$1],[_]),-1,[], [case $ac_cv_f77_mangling in *," extra underscore"*) ac_val="$ac_val"_ ;; esac ]) m4_default([$2],[$1])="$ac_val" diff --git a/autoconf.m4 b/autoconf.m4 index f78753cdf..06ff9209f 100644 --- a/autoconf.m4 +++ b/autoconf.m4 @@ -47,6 +47,7 @@ m4_copy_unm4([m4_divnum]) m4_copy_unm4([m4_errprint]) m4_copy_unm4([m4_esyscmd]) m4_copy_unm4([m4_ifdef]) +m4_copy([m4_if], [ifelse]) m4_copy_unm4([m4_incr]) m4_copy_unm4([m4_index]) m4_copy_unm4([m4_indir]) diff --git a/lib/autoconf/autoconf.m4 b/lib/autoconf/autoconf.m4 index f78753cdf..06ff9209f 100644 --- a/lib/autoconf/autoconf.m4 +++ b/lib/autoconf/autoconf.m4 @@ -47,6 +47,7 @@ m4_copy_unm4([m4_divnum]) m4_copy_unm4([m4_errprint]) m4_copy_unm4([m4_esyscmd]) m4_copy_unm4([m4_ifdef]) +m4_copy([m4_if], [ifelse]) m4_copy_unm4([m4_incr]) m4_copy_unm4([m4_index]) m4_copy_unm4([m4_indir]) diff --git a/lib/autoconf/c.m4 b/lib/autoconf/c.m4 index 37158c9af..0a8fc8491 100644 --- a/lib/autoconf/c.m4 +++ b/lib/autoconf/c.m4 @@ -134,8 +134,7 @@ AC_LANG([$1])]) # Restore the previous language. m4_define([AC_LANG_POP], [m4_popdef([_AC_LANG])dnl -ifelse(_AC_LANG, [_AC_LANG], - [AC_FATAL([too many $0])])dnl +m4_if(_AC_LANG, [_AC_LANG], [AC_FATAL([too many $0])])dnl AC_LANG(_AC_LANG)]) @@ -345,7 +344,7 @@ $2 # Avoid conflicting decl of main. m4_define([AC_LANG_CALL(C)], [AC_LANG_PROGRAM([$1 -ifelse([$2], [main], , +m4_if([$2], [main], , [/* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" @@ -1789,7 +1788,7 @@ case $ac_cv_f77_mangling in *) ac_val="unknown" ;; esac case $ac_cv_f77_mangling in *," underscore"*) ac_val="$ac_val"_ ;; esac -ifelse(m4_index([$1],[_]),-1,[], +m4_if(m4_index([$1],[_]),-1,[], [case $ac_cv_f77_mangling in *," extra underscore"*) ac_val="$ac_val"_ ;; esac ]) m4_default([$2],[$1])="$ac_val" diff --git a/lib/autoconf/fortran.m4 b/lib/autoconf/fortran.m4 index 37158c9af..0a8fc8491 100644 --- a/lib/autoconf/fortran.m4 +++ b/lib/autoconf/fortran.m4 @@ -134,8 +134,7 @@ AC_LANG([$1])]) # Restore the previous language. m4_define([AC_LANG_POP], [m4_popdef([_AC_LANG])dnl -ifelse(_AC_LANG, [_AC_LANG], - [AC_FATAL([too many $0])])dnl +m4_if(_AC_LANG, [_AC_LANG], [AC_FATAL([too many $0])])dnl AC_LANG(_AC_LANG)]) @@ -345,7 +344,7 @@ $2 # Avoid conflicting decl of main. m4_define([AC_LANG_CALL(C)], [AC_LANG_PROGRAM([$1 -ifelse([$2], [main], , +m4_if([$2], [main], , [/* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" @@ -1789,7 +1788,7 @@ case $ac_cv_f77_mangling in *) ac_val="unknown" ;; esac case $ac_cv_f77_mangling in *," underscore"*) ac_val="$ac_val"_ ;; esac -ifelse(m4_index([$1],[_]),-1,[], +m4_if(m4_index([$1],[_]),-1,[], [case $ac_cv_f77_mangling in *," extra underscore"*) ac_val="$ac_val"_ ;; esac ]) m4_default([$2],[$1])="$ac_val" diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index 026f9e43c..2db9dce2b 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -366,9 +366,9 @@ m4_define([_AH_COUNTER], [0]) # If EXPRESSION has shell indirections ($var or `expr`), expand # IF-INDIR, else IF-NOT-INDIR. m4_define([AC_VAR_INDIR_IFELSE], -[ifelse(m4_regexp([$1], [[`$]]), - -1, [$3], - [$2])]) +[m4_if(m4_regexp([$1], [[`$]]), + -1, [$3], + [$2])]) # AC_VAR_SET(VARIABLE, VALUE) # --------------------------- @@ -649,7 +649,7 @@ m4_define([AC_REVISION], # occurrences with the current version of Autoconf, which is certainly # not what mean the user. AU_DEFUN([AC_PREREQ], -[ifelse(m4_version_compare(]m4_defn([AC_ACVERSION])[, [$1]), -1, +[m4_if(m4_version_compare(]m4_defn([AC_ACVERSION])[, [$1]), -1, [m4_fatal([Autoconf version $1 or higher is required for this script])])dnl [AC_PREREQ(]]m4_defn([AC_ACVERSION])[[)]]) @@ -658,7 +658,7 @@ AU_DEFUN([AC_PREREQ], # ------------------ # Complain and exit if the Autoconf version is less than VERSION. m4_define([AC_PREREQ], -[ifelse(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, +[m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [AC_FATAL([Autoconf version $1 or higher is required for this script])])]) @@ -2021,8 +2021,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. m4_define([AC_CACHE_VAL], -[ifelse(m4_regexp([$2], [AC_DEFINE]), [-1], [], - [AC_DIAGNOSE(syntax, +[m4_if(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], @@ -2069,7 +2069,7 @@ m4_define([AC_DEFINE], [AC_DEFINE_TRACE([$1])dnl m4_ifval([$3], [AH_TEMPLATE([$1], [$3])])dnl cat >>confdefs.h <<\EOF -[#define] $1 ifelse($#, 2, [$2], $#, 3, [$2], 1) +[@%:@define] $1 m4_if($#, 2, [$2], $#, 3, [$2], 1) EOF ]) @@ -2081,7 +2081,7 @@ m4_define([AC_DEFINE_UNQUOTED], [AC_DEFINE_TRACE([$1])dnl m4_ifval([$3], [AH_TEMPLATE([$1], [$3])])dnl cat >>confdefs.h < NEW plus a warning # 4. default => NEW AC_DEFUN([AC_CHECK_TYPE], -[ifelse($#, 3, - [_AC_CHECK_TYPE_NEW($@)], - $#, 4, - [_AC_CHECK_TYPE_NEW($@)], - _AC_CHECK_TYPE_REPLACEMENT_TYPE_P([$2]), 1, - [_AC_CHECK_TYPE_OLD($@)], - _AC_CHECK_TYPE_MAYBE_TYPE_P([$2]), 1, - [AC_DIAGNOSE([syntax], +[m4_if($#, 3, + [_AC_CHECK_TYPE_NEW($@)], + $#, 4, + [_AC_CHECK_TYPE_NEW($@)], + _AC_CHECK_TYPE_REPLACEMENT_TYPE_P([$2]), 1, + [_AC_CHECK_TYPE_OLD($@)], + _AC_CHECK_TYPE_MAYBE_TYPE_P([$2]), 1, + [AC_DIAGNOSE([syntax], [$0: assuming `$2' is not a type])_AC_CHECK_TYPE_NEW($@)], - [_AC_CHECK_TYPE_NEW($@)])[]dnl + [_AC_CHECK_TYPE_NEW($@)])[]dnl ])# AC_CHECK_TYPE @@ -3399,9 +3400,9 @@ AC_DEFUN([AC_CHECK_TYPE], # matching. The big problem is then that the active characters should # be quoted. Currently `+*.' are quoted. m4_define([AC_CONFIG_IF_MEMBER], -[ifelse(m4_regexp($2, [\(^\| \)]m4_patsubst([$1], - [\([+*.]\)], [\\\1])[\(:\| \|$\)]), - -1, [$4], [$3])]) +[m4_if(m4_regexp($2, [\(^\| \)]m4_patsubst([$1], + [\([+*.]\)], [\\\1])[\(:\| \|$\)]), + -1, [$4], [$3])]) # AC_FILE_DEPENDENCY_TRACE(DEST, SOURCE1, [SOURCE2...]) @@ -3488,7 +3489,7 @@ AC_DEFUN([AC_CONFIG_COMMANDS], _AC_CONFIG_UNIQUE([$1]) m4_append([AC_LIST_COMMANDS], [ $1]) -ifelse([$2],,, [AC_FOREACH([AC_Name], [$1], +m4_if([$2],,, [AC_FOREACH([AC_Name], [$1], [m4_append([AC_LIST_COMMANDS_COMMANDS], [ ]m4_patsubst(AC_Name, [:.*])[ ) $2 ;; ])])]) @@ -3566,7 +3567,7 @@ _AC_CONFIG_UNIQUE([$1]) _AC_CONFIG_DEPENDENCIES([$1]) m4_append([AC_LIST_HEADERS], [ $1]) dnl Register the commands -ifelse([$2],,, [AC_FOREACH([AC_File], [$1], +m4_ifval([$2], [AC_FOREACH([AC_File], [$1], [m4_append([AC_LIST_HEADERS_COMMANDS], [ ]m4_patsubst(AC_File, [:.*])[ ) $2 ;; ])])]) @@ -3599,11 +3600,11 @@ AC_DEFUN([AC_CONFIG_LINKS], [m4_divert_push([KILL]) _AC_CONFIG_UNIQUE([$1]) _AC_CONFIG_DEPENDENCIES([$1]) -ifelse(m4_regexp([$1], [^\.:\| \.:]), -1,, - [AC_FATAL([$0: invalid destination: `.'])]) +m4_if(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_ifval([$2], [AC_FOREACH([AC_File], [$1], [m4_append([AC_LIST_LINKS_COMMANDS], [ ]m4_patsubst(AC_File, [:.*])[ ) $2 ;; ])])]) @@ -3633,8 +3634,8 @@ m4_define([AC_LIST_LINKS_COMMANDS]) # # _AC_LINK_CNT is used to be robust to multiple calls. AU_DEFUN([AC_LINK_FILES], -[ifelse($#, 2, , - [m4_fatal([$0: incorrect number of arguments])])dnl +[m4_if($#, 2, , + [m4_fatal([$0: incorrect number of arguments])])dnl m4_define([_AC_LINK_FILES_CNT], m4_incr(_AC_LINK_FILES_CNT))dnl ac_sources="$1" ac_dests="$2" @@ -3674,7 +3675,7 @@ _AC_CONFIG_UNIQUE([$1]) _AC_CONFIG_DEPENDENCIES([$1]) m4_append([AC_LIST_FILES], [ $1]) dnl Register the commands. -ifelse([$2],,, [AC_FOREACH([AC_File], [$1], +m4_ifval([$2], [AC_FOREACH([AC_File], [$1], [m4_append([AC_LIST_FILES_COMMANDS], [ ]m4_patsubst(AC_File, [:.*])[ ) $2 ;; ])])]) @@ -4749,8 +4750,8 @@ fi]) # ACTION-IF-NOT-FOUND. AC_DEFUN([AC_LIST_MEMBER_OF], [dnl Do some sanity checking of the arguments. -ifelse([$1], , [AC_FATAL([$0]: missing argument 1)])dnl -ifelse([$2], , [AC_FATAL([$0]: missing argument 2)])dnl +m4_if([$1], , [AC_FATAL([$0]: missing argument 1)])dnl +m4_if([$2], , [AC_FATAL([$0]: missing argument 2)])dnl ac_exists=false for ac_i in $2; do diff --git a/lib/autoconf/lang.m4 b/lib/autoconf/lang.m4 index 37158c9af..0a8fc8491 100644 --- a/lib/autoconf/lang.m4 +++ b/lib/autoconf/lang.m4 @@ -134,8 +134,7 @@ AC_LANG([$1])]) # Restore the previous language. m4_define([AC_LANG_POP], [m4_popdef([_AC_LANG])dnl -ifelse(_AC_LANG, [_AC_LANG], - [AC_FATAL([too many $0])])dnl +m4_if(_AC_LANG, [_AC_LANG], [AC_FATAL([too many $0])])dnl AC_LANG(_AC_LANG)]) @@ -345,7 +344,7 @@ $2 # Avoid conflicting decl of main. m4_define([AC_LANG_CALL(C)], [AC_LANG_PROGRAM([$1 -ifelse([$2], [main], , +m4_if([$2], [main], , [/* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" @@ -1789,7 +1788,7 @@ case $ac_cv_f77_mangling in *) ac_val="unknown" ;; esac case $ac_cv_f77_mangling in *," underscore"*) ac_val="$ac_val"_ ;; esac -ifelse(m4_index([$1],[_]),-1,[], +m4_if(m4_index([$1],[_]),-1,[], [case $ac_cv_f77_mangling in *," extra underscore"*) ac_val="$ac_val"_ ;; esac ]) m4_default([$2],[$1])="$ac_val" diff --git a/lib/autotest/general.m4 b/lib/autotest/general.m4 index 76d8052ba..efc7e1142 100644 --- a/lib/autotest/general.m4 +++ b/lib/autotest/general.m4 @@ -338,9 +338,9 @@ m4_divert([TEST])[]dnl # AT_CLEANUP_FILE_IFELSE(FILE, IF-REGISTERED, IF-NOT-REGISTERED) # -------------------------------------------------------------- m4_define([AT_CLEANUP_FILE_IFELSE], -[ifelse(m4_regexp(AT_data_files, m4_patsubst([ $1 ], [\([\[\]*.]\)], [\\\1])), - -1, - [$3], [$2])]) +[m4_if(m4_regexp(AT_data_files, m4_patsubst([ $1 ], [\([\[\]*.]\)], [\\\1])), + -1, + [$3], [$2])]) # AT_CLEANUP_FILE(FILE) diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4 index 8ad614ba0..b9ac4a885 100644 --- a/lib/m4sugar/m4sh.m4 +++ b/lib/m4sugar/m4sh.m4 @@ -172,11 +172,11 @@ $as_unset $1 || test "${$1+set}" != set || { $1=$2; export $1; }]) # Otherwise it's modern. # We use two quotes in the pattern to keep highlighting tools at peace. m4_define([_AS_QUOTE_IFELSE], -[ifelse(m4_regexp([$1], [\\[\\$]]), - [-1], [ifelse(m4_regexp([$1], [\\[`""]]), - [-1], [$2], - [$3])], - [$2])]) +[m4_if(m4_regexp([$1], [\\[\\$]]), + [-1], [m4_if(m4_regexp([$1], [\\[`""]]), + [-1], [$2], + [$3])], + [$2])]) # _AS_ECHO_UNQUOTED(STRING, [FD = AS_MESSAGE_FD]) diff --git a/lib/m4sugar/m4sugar.m4 b/lib/m4sugar/m4sugar.m4 index 2a8b2460a..1622e3086 100644 --- a/lib/m4sugar/m4sugar.m4 +++ b/lib/m4sugar/m4sugar.m4 @@ -122,6 +122,7 @@ m4_rename_m4([esyscmd]) m4_rename_m4([eval]) m4_rename_m4([format]) m4_rename_m4([ifdef]) +m4_rename([ifelse], [m4_if]) m4_rename_m4([incr]) m4_rename_m4([index]) m4_rename_m4([indir]) @@ -176,7 +177,7 @@ m4_define([m4_warning], m4_define([m4_fatal], [m4_errprintn(m4_location[: error: $1])dnl m4_expansion_stack_dump()dnl -m4_exit(ifelse([$2],, 1, [$2]))]) +m4_exit(m4_if([$2],, 1, [$2]))]) # m4_assert(EXPRESSION, [EXIT-STATUS = 1]) @@ -184,9 +185,8 @@ m4_exit(ifelse([$2],, 1, [$2]))]) # This macro ensures that EXPRESSION evaluates to true, and exits if # EXPRESSION evaluates to false. m4_define([m4_assert], -[ifelse(m4_eval([$1]), 0, - [m4_fatal([assert failed: $1], [$2])], - [])]) +[m4_if(m4_eval([$1]), 0, + [m4_fatal([assert failed: $1], [$2])])]) ## ------------- ## @@ -215,12 +215,13 @@ m4_define([m4_warning_ifelse], # -------------------------------------------------------------- # Implementation of the loop described above. m4_define([_m4_warning_ifelse], -[ifelse([$4], [$1], [$2], - [$4], [all], [$2], - [$4], [], [$3], - [$4], [none], [$3], - [$4], [no-$1], [$3], - [$0([$1], [$2], [$3], m4_shiftn(4, $@))])]) +[m4_case([$4], + [$1], [$2], + [all], [$2], + [], [$3], + [none], [$3], + [no-$1], [$3], + [$0([$1], [$2], [$3], m4_shiftn(4, $@))])]) # _m4_warning_error_ifelse(IF-TRUE, IF-FALSE) @@ -234,10 +235,11 @@ m4_define([_m4_warning_error_ifelse], # -------------------------------------------- # The same as _m4_warning_ifelse, but scan for `error' only. m4_define([__m4_warning_error_ifelse], -[ifelse([$3], [error], [$1], - [$3], [], [$2], - [$3], [no-error], [$2], - [$0([$1], [$2], m4_shiftn(3, $@))])]) +[m4_case([$3], + [error], [$1], + [], [$2], + [no-error], [$2], + [$0([$1], [$2], m4_shiftn(3, $@))])]) @@ -329,16 +331,16 @@ m4_undefine([sinclude]) # If COND is not the empty string, expand IF-TRUE, otherwise IF-FALSE. # Comparable to m4_ifdef. m4_define([m4_ifval], -[ifelse([$1], [], [$3], [$2])]) +[m4_if([$1], [], [$3], [$2])]) # m4_n(TEXT) # ---------- # If TEXT is not empty, return TEXT and a new line, otherwise nothing. m4_define([m4_n], -[ifelse([$1], - [], [], - [$1 +[m4_if([$1], + [], [], + [$1 ])]) @@ -347,9 +349,9 @@ m4_define([m4_n], # Same as `m4_ifval', but add an extra newline to IF-TRUE or IF-FALSE # unless that argument is empty. m4_define([m4_ifvaln], -[ifelse([$1], - [], [m4_n([$3])], - [m4_n([$2])])]) +[m4_if([$1], + [], [m4_n([$3])], + [m4_n([$2])])]) # m4_ifset(MACRO, [IF-TRUE], [IF-FALSE]) @@ -358,7 +360,7 @@ m4_define([m4_ifvaln], # expand IF-FALSE, otherwise IF-TRUE. m4_define([m4_ifset], [m4_ifdef([$1], - [ifelse(m4_defn([$1]), [], [$3], [$2])], + [m4_if(m4_defn([$1]), [], [$3], [$2])], [$3])]) @@ -387,11 +389,11 @@ m4_define([m4_ifndef], # All the values are optional, and the macro is robust to active # symbols properly quoted. m4_define([m4_case], -[ifelse([$#], 0, [], - [$#], 1, [], - [$#], 2, [$2], - [$1], [$2], [$3], - [m4_case([$1], m4_shiftn(3, $@))])]) +[m4_if([$#], 0, [], + [$#], 1, [], + [$#], 2, [$2], + [$1], [$2], [$3], + [m4_case([$1], m4_shiftn(3, $@))])]) # m4_match(SWITCH, RE1, VAL1, RE2, VAL2, ..., DEFAULT) @@ -410,11 +412,11 @@ m4_define([m4_case], # All the values are optional, and the macro is robust to active symbols # properly quoted. m4_define([m4_match], -[ifelse([$#], 0, [], - [$#], 1, [], - [$#], 2, [$2], - m4_regexp([$1], [$2]), -1, [m4_match([$1], m4_shiftn(3, $@))], - [$3])]) +[m4_if([$#], 0, [], + [$#], 1, [], + [$#], 2, [$2], + m4_regexp([$1], [$2]), -1, [m4_match([$1], m4_shiftn(3, $@))], + [$3])]) @@ -428,9 +430,9 @@ m4_define([m4_match], # useful for making your macros more structured and readable by dropping # unecessary dnl's and have the macros indented properly. m4_define([m4_do], - [ifelse($#, 0, [], - $#, 1, [$1], - [$1[]m4_do(m4_shift($@))])]) +[m4_if($#, 0, [], + $#, 1, [$1], + [$1[]m4_do(m4_shift($@))])]) # m4_default(EXP1, EXP2) @@ -448,9 +450,9 @@ m4_define([m4_shiftn], _m4_shiftn($@)]) m4_define([_m4_shiftn], -[ifelse([$1], 0, - [m4_shift($@)], - [_m4_shiftn(m4_eval([$1]-1), m4_shift(m4_shift($@)))])]) +[m4_if([$1], 0, + [m4_shift($@)], + [_m4_shiftn(m4_eval([$1]-1), m4_shift(m4_shift($@)))])]) @@ -520,15 +522,15 @@ m4_define([m4_for], 1, [m4_assert(m4_sign(m4_default($4, 1)) == 1)], -1, [m4_assert(m4_sign(m4_default($4, -1)) == -1)])dnl m4_pushdef([$1], [$2])dnl -ifelse(m4_eval([$3 > $2]), 1, - [_m4_for([$1], [$3], m4_default([$4], 1), [$5])], - [_m4_for([$1], [$3], m4_default([$4], -1), [$5])])dnl +m4_if(m4_eval([$3 > $2]), 1, + [_m4_for([$1], [$3], m4_default([$4], 1), [$5])], + [_m4_for([$1], [$3], m4_default([$4], -1), [$5])])dnl m4_popdef([$1])]) m4_define([_m4_for], [$4[]dnl -ifelse($1, [$2], [], - [m4_define([$1], m4_eval($1+[$3]))_m4_for([$1], [$2], [$3], [$4])])]) +m4_if($1, [$2], [], + [m4_define([$1], m4_eval($1+[$3]))_m4_for([$1], [$2], [$3], [$4])])]) # Implementing `foreach' loops in m4 is much more tricky than it may @@ -543,10 +545,10 @@ ifelse($1, [$2], [], # | [m4_pushdef([$1])_foreach([$1], [$2], [$3])m4_popdef([$1])]) # | m4_define([_arg1], [$1]) # | m4_define([_foreach], -# | [ifelse([$2], [()], , -# | [m4_define([$1], _arg1$2)$3[]_foreach([$1], -# | (shift$2), -# | [$3])])]) +# | [m4_if([$2], [()], , +# | [m4_define([$1], _arg1$2)$3[]_foreach([$1], +# | (shift$2), +# | [$3])])]) # # But then if you run # @@ -573,10 +575,10 @@ ifelse($1, [$2], [], # | m4_define([foreach], [m4_pushdef([$1])_foreach($@)m4_popdef([$1])]) # | m4_define([_arg1], [[$1]]) # | m4_define([_foreach], -# | [ifelse($2, [()], , -# | [m4_define([$1], [_arg1$2])$3[]_foreach([$1], -# | [(shift$2)], -# | [$3])])]) +# | [m4_if($2, [()], , +# | [m4_define([$1], [_arg1$2])$3[]_foreach([$1], +# | [(shift$2)], +# | [$3])])]) # # which this time answers # @@ -598,13 +600,13 @@ ifelse($1, [$2], [], # | m4_define([foreach], [m4_pushdef([$1])_foreach($@)m4_popdef([$1])]) # | m4_define([_arg1], [$1]) # | m4_define([_foreach], -# | [ifelse($2, [], , -# | [m4_define([$1], [_arg1($2)])$3[]_foreach([$1], -# | [shift($2)], -# | [$3])])]) +# | [m4_if($2, [], , +# | [m4_define([$1], [_arg1($2)])$3[]_foreach([$1], +# | [shift($2)], +# | [$3])])]) # # -# Now, just replace the `$2' with `m4_quote($2)' in the outer `ifelse' +# Now, just replace the `$2' with `m4_quote($2)' in the outer `m4_if' # to improve robustness, and you come up with a quite satisfactory # implementation. @@ -633,10 +635,10 @@ m4_define([m4_foreach], # Low level macros used to define m4_foreach. m4_define([m4_car], [$1]) m4_define([_m4_foreach], -[ifelse(m4_quote($2), [], [], - [m4_define([$1], [m4_car($2)])$3[]_m4_foreach([$1], - [m4_shift($2)], - [$3])])]) +[m4_if(m4_quote($2), [], [], + [m4_define([$1], [m4_car($2)])$3[]_m4_foreach([$1], + [m4_shift($2)], + [$3])])]) @@ -1087,8 +1089,8 @@ m4_divert_push([GROW])])dnl # the PRO/EPI pairs. m4_define([_m4_defun_epi], [m4_divert_pop()dnl -ifelse(_m4_divert_dump, _m4_divert_diversion, - [m4_undivert(_m4_divert([GROW]))dnl +m4_if(_m4_divert_dump, _m4_divert_diversion, + [m4_undivert(_m4_divert([GROW]))dnl m4_undefine([_m4_divert_dump])])dnl m4_popdef([_m4_expansion_stack])dnl m4_popdef([_m4_expanding($1)])dnl @@ -1321,10 +1323,10 @@ m4_define([m4_toupper], m4_changequote(<<, >>) m4_define(<>, <>) m4_changequote([, ]) @@ -1429,8 +1431,8 @@ m4_define([m4_foreach_quoted], # Low level macros used to define m4_foreach. m4_define([m4_car_quoted], [[$1]]) m4_define([_m4_foreach_quoted], -[ifelse($2, [()], , - [m4_define([$1], [m4_car_quoted$2])$3[]_m4_foreach_quoted([$1], +[m4_if($2, [()], , + [m4_define([$1], [m4_car_quoted$2])$3[]_m4_foreach_quoted([$1], [(m4_shift$2)], [$3])])]) @@ -1479,16 +1481,16 @@ m4_pushdef([m4_Width], m4_default([$4], 79))dnl m4_pushdef([m4_Cursor], m4_len(m4_Prefix1))dnl m4_pushdef([m4_Separator], [])dnl m4_Prefix1[]dnl -ifelse(m4_eval(m4_Cursor > m4_len(m4_Prefix)), - 1, [m4_define([m4_Cursor], m4_len(m4_Prefix)) +m4_if(m4_eval(m4_Cursor > m4_len(m4_Prefix)), + 1, [m4_define([m4_Cursor], m4_len(m4_Prefix)) m4_Prefix])[]dnl m4_foreach_quoted([m4_Word], (m4_split(m4_strip(m4_join([$1])))), [m4_define([m4_Cursor], m4_eval(m4_Cursor + len(m4_Word) + 1))dnl dnl New line if too long, else insert a space unless it is the first dnl of the words. -ifelse(m4_eval(m4_Cursor > m4_Width), - 1, [m4_define([m4_Cursor], - m4_eval(m4_len(m4_Prefix) + m4_len(m4_Word) + 1))] +m4_if(m4_eval(m4_Cursor > m4_Width), + 1, [m4_define([m4_Cursor], + m4_eval(m4_len(m4_Prefix) + m4_len(m4_Word) + 1))] m4_Prefix, [m4_Separator])[]dnl m4_Word[]dnl @@ -1539,13 +1541,13 @@ m4_define([m4_cmp], # m4_list_cmp((1, 0), (1, 2)) -> -1 # m4_list_cmp((1), (1, 2)) -> -1 m4_define([m4_list_cmp], -[ifelse([$1$2], [()()], 0, - [$1], [()], [m4_list_cmp((0), [$2])], - [$2], [()], [m4_list_cmp([$1], (0))], - [m4_case(m4_cmp(m4_car$1, m4_car$2), - -1, -1, - 1, 1, - 0, [m4_list_cmp((m4_shift$1), (m4_shift$2))])])]) +[m4_if([$1$2], [()()], 0, + [$1], [()], [m4_list_cmp((0), [$2])], + [$2], [()], [m4_list_cmp([$1], (0))], + [m4_case(m4_cmp(m4_car$1, m4_car$2), + -1, -1, + 1, 1, + 0, [m4_list_cmp((m4_shift$1), (m4_shift$2))])])]) @@ -1603,8 +1605,8 @@ m4_define([m4_file_append], [m4_syscmd([cat >>$1 <<_m4eof $2 _m4eof]) -ifelse(m4_sysval, [0], [], - [m4_fatal([$0: cannot write: $1])])]) +m4_if(m4_sysval, [0], [], + [m4_fatal([$0: cannot write: $1])])]) diff --git a/m4sh.m4 b/m4sh.m4 index 8ad614ba0..b9ac4a885 100644 --- a/m4sh.m4 +++ b/m4sh.m4 @@ -172,11 +172,11 @@ $as_unset $1 || test "${$1+set}" != set || { $1=$2; export $1; }]) # Otherwise it's modern. # We use two quotes in the pattern to keep highlighting tools at peace. m4_define([_AS_QUOTE_IFELSE], -[ifelse(m4_regexp([$1], [\\[\\$]]), - [-1], [ifelse(m4_regexp([$1], [\\[`""]]), - [-1], [$2], - [$3])], - [$2])]) +[m4_if(m4_regexp([$1], [\\[\\$]]), + [-1], [m4_if(m4_regexp([$1], [\\[`""]]), + [-1], [$2], + [$3])], + [$2])]) # _AS_ECHO_UNQUOTED(STRING, [FD = AS_MESSAGE_FD]) diff --git a/m4sugar.m4 b/m4sugar.m4 index 2a8b2460a..1622e3086 100644 --- a/m4sugar.m4 +++ b/m4sugar.m4 @@ -122,6 +122,7 @@ m4_rename_m4([esyscmd]) m4_rename_m4([eval]) m4_rename_m4([format]) m4_rename_m4([ifdef]) +m4_rename([ifelse], [m4_if]) m4_rename_m4([incr]) m4_rename_m4([index]) m4_rename_m4([indir]) @@ -176,7 +177,7 @@ m4_define([m4_warning], m4_define([m4_fatal], [m4_errprintn(m4_location[: error: $1])dnl m4_expansion_stack_dump()dnl -m4_exit(ifelse([$2],, 1, [$2]))]) +m4_exit(m4_if([$2],, 1, [$2]))]) # m4_assert(EXPRESSION, [EXIT-STATUS = 1]) @@ -184,9 +185,8 @@ m4_exit(ifelse([$2],, 1, [$2]))]) # This macro ensures that EXPRESSION evaluates to true, and exits if # EXPRESSION evaluates to false. m4_define([m4_assert], -[ifelse(m4_eval([$1]), 0, - [m4_fatal([assert failed: $1], [$2])], - [])]) +[m4_if(m4_eval([$1]), 0, + [m4_fatal([assert failed: $1], [$2])])]) ## ------------- ## @@ -215,12 +215,13 @@ m4_define([m4_warning_ifelse], # -------------------------------------------------------------- # Implementation of the loop described above. m4_define([_m4_warning_ifelse], -[ifelse([$4], [$1], [$2], - [$4], [all], [$2], - [$4], [], [$3], - [$4], [none], [$3], - [$4], [no-$1], [$3], - [$0([$1], [$2], [$3], m4_shiftn(4, $@))])]) +[m4_case([$4], + [$1], [$2], + [all], [$2], + [], [$3], + [none], [$3], + [no-$1], [$3], + [$0([$1], [$2], [$3], m4_shiftn(4, $@))])]) # _m4_warning_error_ifelse(IF-TRUE, IF-FALSE) @@ -234,10 +235,11 @@ m4_define([_m4_warning_error_ifelse], # -------------------------------------------- # The same as _m4_warning_ifelse, but scan for `error' only. m4_define([__m4_warning_error_ifelse], -[ifelse([$3], [error], [$1], - [$3], [], [$2], - [$3], [no-error], [$2], - [$0([$1], [$2], m4_shiftn(3, $@))])]) +[m4_case([$3], + [error], [$1], + [], [$2], + [no-error], [$2], + [$0([$1], [$2], m4_shiftn(3, $@))])]) @@ -329,16 +331,16 @@ m4_undefine([sinclude]) # If COND is not the empty string, expand IF-TRUE, otherwise IF-FALSE. # Comparable to m4_ifdef. m4_define([m4_ifval], -[ifelse([$1], [], [$3], [$2])]) +[m4_if([$1], [], [$3], [$2])]) # m4_n(TEXT) # ---------- # If TEXT is not empty, return TEXT and a new line, otherwise nothing. m4_define([m4_n], -[ifelse([$1], - [], [], - [$1 +[m4_if([$1], + [], [], + [$1 ])]) @@ -347,9 +349,9 @@ m4_define([m4_n], # Same as `m4_ifval', but add an extra newline to IF-TRUE or IF-FALSE # unless that argument is empty. m4_define([m4_ifvaln], -[ifelse([$1], - [], [m4_n([$3])], - [m4_n([$2])])]) +[m4_if([$1], + [], [m4_n([$3])], + [m4_n([$2])])]) # m4_ifset(MACRO, [IF-TRUE], [IF-FALSE]) @@ -358,7 +360,7 @@ m4_define([m4_ifvaln], # expand IF-FALSE, otherwise IF-TRUE. m4_define([m4_ifset], [m4_ifdef([$1], - [ifelse(m4_defn([$1]), [], [$3], [$2])], + [m4_if(m4_defn([$1]), [], [$3], [$2])], [$3])]) @@ -387,11 +389,11 @@ m4_define([m4_ifndef], # All the values are optional, and the macro is robust to active # symbols properly quoted. m4_define([m4_case], -[ifelse([$#], 0, [], - [$#], 1, [], - [$#], 2, [$2], - [$1], [$2], [$3], - [m4_case([$1], m4_shiftn(3, $@))])]) +[m4_if([$#], 0, [], + [$#], 1, [], + [$#], 2, [$2], + [$1], [$2], [$3], + [m4_case([$1], m4_shiftn(3, $@))])]) # m4_match(SWITCH, RE1, VAL1, RE2, VAL2, ..., DEFAULT) @@ -410,11 +412,11 @@ m4_define([m4_case], # All the values are optional, and the macro is robust to active symbols # properly quoted. m4_define([m4_match], -[ifelse([$#], 0, [], - [$#], 1, [], - [$#], 2, [$2], - m4_regexp([$1], [$2]), -1, [m4_match([$1], m4_shiftn(3, $@))], - [$3])]) +[m4_if([$#], 0, [], + [$#], 1, [], + [$#], 2, [$2], + m4_regexp([$1], [$2]), -1, [m4_match([$1], m4_shiftn(3, $@))], + [$3])]) @@ -428,9 +430,9 @@ m4_define([m4_match], # useful for making your macros more structured and readable by dropping # unecessary dnl's and have the macros indented properly. m4_define([m4_do], - [ifelse($#, 0, [], - $#, 1, [$1], - [$1[]m4_do(m4_shift($@))])]) +[m4_if($#, 0, [], + $#, 1, [$1], + [$1[]m4_do(m4_shift($@))])]) # m4_default(EXP1, EXP2) @@ -448,9 +450,9 @@ m4_define([m4_shiftn], _m4_shiftn($@)]) m4_define([_m4_shiftn], -[ifelse([$1], 0, - [m4_shift($@)], - [_m4_shiftn(m4_eval([$1]-1), m4_shift(m4_shift($@)))])]) +[m4_if([$1], 0, + [m4_shift($@)], + [_m4_shiftn(m4_eval([$1]-1), m4_shift(m4_shift($@)))])]) @@ -520,15 +522,15 @@ m4_define([m4_for], 1, [m4_assert(m4_sign(m4_default($4, 1)) == 1)], -1, [m4_assert(m4_sign(m4_default($4, -1)) == -1)])dnl m4_pushdef([$1], [$2])dnl -ifelse(m4_eval([$3 > $2]), 1, - [_m4_for([$1], [$3], m4_default([$4], 1), [$5])], - [_m4_for([$1], [$3], m4_default([$4], -1), [$5])])dnl +m4_if(m4_eval([$3 > $2]), 1, + [_m4_for([$1], [$3], m4_default([$4], 1), [$5])], + [_m4_for([$1], [$3], m4_default([$4], -1), [$5])])dnl m4_popdef([$1])]) m4_define([_m4_for], [$4[]dnl -ifelse($1, [$2], [], - [m4_define([$1], m4_eval($1+[$3]))_m4_for([$1], [$2], [$3], [$4])])]) +m4_if($1, [$2], [], + [m4_define([$1], m4_eval($1+[$3]))_m4_for([$1], [$2], [$3], [$4])])]) # Implementing `foreach' loops in m4 is much more tricky than it may @@ -543,10 +545,10 @@ ifelse($1, [$2], [], # | [m4_pushdef([$1])_foreach([$1], [$2], [$3])m4_popdef([$1])]) # | m4_define([_arg1], [$1]) # | m4_define([_foreach], -# | [ifelse([$2], [()], , -# | [m4_define([$1], _arg1$2)$3[]_foreach([$1], -# | (shift$2), -# | [$3])])]) +# | [m4_if([$2], [()], , +# | [m4_define([$1], _arg1$2)$3[]_foreach([$1], +# | (shift$2), +# | [$3])])]) # # But then if you run # @@ -573,10 +575,10 @@ ifelse($1, [$2], [], # | m4_define([foreach], [m4_pushdef([$1])_foreach($@)m4_popdef([$1])]) # | m4_define([_arg1], [[$1]]) # | m4_define([_foreach], -# | [ifelse($2, [()], , -# | [m4_define([$1], [_arg1$2])$3[]_foreach([$1], -# | [(shift$2)], -# | [$3])])]) +# | [m4_if($2, [()], , +# | [m4_define([$1], [_arg1$2])$3[]_foreach([$1], +# | [(shift$2)], +# | [$3])])]) # # which this time answers # @@ -598,13 +600,13 @@ ifelse($1, [$2], [], # | m4_define([foreach], [m4_pushdef([$1])_foreach($@)m4_popdef([$1])]) # | m4_define([_arg1], [$1]) # | m4_define([_foreach], -# | [ifelse($2, [], , -# | [m4_define([$1], [_arg1($2)])$3[]_foreach([$1], -# | [shift($2)], -# | [$3])])]) +# | [m4_if($2, [], , +# | [m4_define([$1], [_arg1($2)])$3[]_foreach([$1], +# | [shift($2)], +# | [$3])])]) # # -# Now, just replace the `$2' with `m4_quote($2)' in the outer `ifelse' +# Now, just replace the `$2' with `m4_quote($2)' in the outer `m4_if' # to improve robustness, and you come up with a quite satisfactory # implementation. @@ -633,10 +635,10 @@ m4_define([m4_foreach], # Low level macros used to define m4_foreach. m4_define([m4_car], [$1]) m4_define([_m4_foreach], -[ifelse(m4_quote($2), [], [], - [m4_define([$1], [m4_car($2)])$3[]_m4_foreach([$1], - [m4_shift($2)], - [$3])])]) +[m4_if(m4_quote($2), [], [], + [m4_define([$1], [m4_car($2)])$3[]_m4_foreach([$1], + [m4_shift($2)], + [$3])])]) @@ -1087,8 +1089,8 @@ m4_divert_push([GROW])])dnl # the PRO/EPI pairs. m4_define([_m4_defun_epi], [m4_divert_pop()dnl -ifelse(_m4_divert_dump, _m4_divert_diversion, - [m4_undivert(_m4_divert([GROW]))dnl +m4_if(_m4_divert_dump, _m4_divert_diversion, + [m4_undivert(_m4_divert([GROW]))dnl m4_undefine([_m4_divert_dump])])dnl m4_popdef([_m4_expansion_stack])dnl m4_popdef([_m4_expanding($1)])dnl @@ -1321,10 +1323,10 @@ m4_define([m4_toupper], m4_changequote(<<, >>) m4_define(<>, <>) m4_changequote([, ]) @@ -1429,8 +1431,8 @@ m4_define([m4_foreach_quoted], # Low level macros used to define m4_foreach. m4_define([m4_car_quoted], [[$1]]) m4_define([_m4_foreach_quoted], -[ifelse($2, [()], , - [m4_define([$1], [m4_car_quoted$2])$3[]_m4_foreach_quoted([$1], +[m4_if($2, [()], , + [m4_define([$1], [m4_car_quoted$2])$3[]_m4_foreach_quoted([$1], [(m4_shift$2)], [$3])])]) @@ -1479,16 +1481,16 @@ m4_pushdef([m4_Width], m4_default([$4], 79))dnl m4_pushdef([m4_Cursor], m4_len(m4_Prefix1))dnl m4_pushdef([m4_Separator], [])dnl m4_Prefix1[]dnl -ifelse(m4_eval(m4_Cursor > m4_len(m4_Prefix)), - 1, [m4_define([m4_Cursor], m4_len(m4_Prefix)) +m4_if(m4_eval(m4_Cursor > m4_len(m4_Prefix)), + 1, [m4_define([m4_Cursor], m4_len(m4_Prefix)) m4_Prefix])[]dnl m4_foreach_quoted([m4_Word], (m4_split(m4_strip(m4_join([$1])))), [m4_define([m4_Cursor], m4_eval(m4_Cursor + len(m4_Word) + 1))dnl dnl New line if too long, else insert a space unless it is the first dnl of the words. -ifelse(m4_eval(m4_Cursor > m4_Width), - 1, [m4_define([m4_Cursor], - m4_eval(m4_len(m4_Prefix) + m4_len(m4_Word) + 1))] +m4_if(m4_eval(m4_Cursor > m4_Width), + 1, [m4_define([m4_Cursor], + m4_eval(m4_len(m4_Prefix) + m4_len(m4_Word) + 1))] m4_Prefix, [m4_Separator])[]dnl m4_Word[]dnl @@ -1539,13 +1541,13 @@ m4_define([m4_cmp], # m4_list_cmp((1, 0), (1, 2)) -> -1 # m4_list_cmp((1), (1, 2)) -> -1 m4_define([m4_list_cmp], -[ifelse([$1$2], [()()], 0, - [$1], [()], [m4_list_cmp((0), [$2])], - [$2], [()], [m4_list_cmp([$1], (0))], - [m4_case(m4_cmp(m4_car$1, m4_car$2), - -1, -1, - 1, 1, - 0, [m4_list_cmp((m4_shift$1), (m4_shift$2))])])]) +[m4_if([$1$2], [()()], 0, + [$1], [()], [m4_list_cmp((0), [$2])], + [$2], [()], [m4_list_cmp([$1], (0))], + [m4_case(m4_cmp(m4_car$1, m4_car$2), + -1, -1, + 1, 1, + 0, [m4_list_cmp((m4_shift$1), (m4_shift$2))])])]) @@ -1603,8 +1605,8 @@ m4_define([m4_file_append], [m4_syscmd([cat >>$1 <<_m4eof $2 _m4eof]) -ifelse(m4_sysval, [0], [], - [m4_fatal([$0: cannot write: $1])])]) +m4_if(m4_sysval, [0], [], + [m4_fatal([$0: cannot write: $1])])]) diff --git a/tests/aclocal.m4 b/tests/aclocal.m4 index 2e037827d..c4087ce85 100644 --- a/tests/aclocal.m4 +++ b/tests/aclocal.m4 @@ -5,9 +5,10 @@ # ------------------------ # Produce ARG1SEPARG2...SEPARGn. define([join], -[ifelse([$#], [1], [], - [$#], [2], [[$2]], - [[$2][$1]join([$1], m4_shift(m4_shift($@)))])]) +[m4_case([$#], + [1], [], + [2], [[$2]], + [[$2][$1]join([$1], m4_shift(m4_shift($@)))])]) # AC_STATE_SAVE(FILE) diff --git a/tests/atgeneral.m4 b/tests/atgeneral.m4 index 76d8052ba..efc7e1142 100644 --- a/tests/atgeneral.m4 +++ b/tests/atgeneral.m4 @@ -338,9 +338,9 @@ m4_divert([TEST])[]dnl # AT_CLEANUP_FILE_IFELSE(FILE, IF-REGISTERED, IF-NOT-REGISTERED) # -------------------------------------------------------------- m4_define([AT_CLEANUP_FILE_IFELSE], -[ifelse(m4_regexp(AT_data_files, m4_patsubst([ $1 ], [\([\[\]*.]\)], [\\\1])), - -1, - [$3], [$2])]) +[m4_if(m4_regexp(AT_data_files, m4_patsubst([ $1 ], [\([\[\]*.]\)], [\\\1])), + -1, + [$3], [$2])]) # AT_CLEANUP_FILE(FILE) diff --git a/tests/atspecific.m4 b/tests/atspecific.m4 index ff00d37c1..ccba2dad6 100644 --- a/tests/atspecific.m4 +++ b/tests/atspecific.m4 @@ -91,7 +91,7 @@ fi m4_define([AT_CHECK_MACRO], [AT_SETUP([$1]) -_AT_CHECK_AC_MACRO([ifelse([$2],,[$1], [$2])]) +_AT_CHECK_AC_MACRO([m4_default([$2], [$1])]) $3 AT_CLEANUP()dnl ])# AT_CHECK_MACRO