autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

61-m4-if.patch


From: Akim Demaille
Subject: 61-m4-if.patch
Date: Tue, 05 Dec 2000 09:44:22 +0100

Index: ChangeLog
from  Akim Demaille  <address@hidden>
        * m4sugar.m4 (ifelse): Rename as...
        (m4_if): this.
        * autoconf.m4 (ifelse): Restore.

Index: acgeneral.m4
--- acgeneral.m4 Sat, 02 Dec 2000 12:42:02 +0100 akim (ace/27_acgeneral. 
1.169.8.99 644)
+++ acgeneral.m4 Sat, 02 Dec 2000 13:13:21 +0100 akim (ace/27_acgeneral. 
1.169.8.99 644)
@@ -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 @@ m4_define([AC_REVISION],
 # ------------------
 # 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 @@ m4_define([AC_CACHE_SAVE],
 # 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)
address@hidden:@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 <<EOF
-[#define] $1 ifelse($#, 2, [$2], $#, 3, [$2], 1)
address@hidden:@define] $1 m4_if($#, 2, [$2], $#, 3, [$2], 1)
 EOF
 ])

@@ -2302,8 +2302,9 @@ AC_DEFUN([AC_TRY_COMMAND],
 # brokenness of AC_TRY_COMPILE, we are doomed to leave a extra new
 # line here.
 m4_define([AC_INCLUDES_DEFAULT],
-[ifelse([$1], [], [$ac_includes_default], [$1
-])])
+[m4_ifval([$1], [$1
+],
+          [$ac_includes_default])])



@@ -2323,8 +2324,8 @@ m4_define([AC_INCLUDES_DEFAULT],
 AC_DEFUN([AC_CHECK_MEMBER],
 [AC_VAR_INDIR_IFELSE([$1],
                      [AC_FATAL([$0: requires literal arguments])])dnl
-ifelse(m4_regexp([$1], [\.]), -1,
-       [AC_FATAL([$0: Did not see any dot in `$1'])])dnl
+m4_if(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
 dnl Extract the aggregate name, and the member name
@@ -2422,7 +2423,7 @@ AC_DEFUN([AC_CHECK_PROG],
     set dummy "$ac_dir/$ac_word" ${1+"address@hidden"}
     shift
     ac_cv_prog_$1="address@hidden"
-ifelse([$2], [$4],
+m4_if([$2], [$4],
 [  else
     # Default is a loser.
     AC_MSG_ERROR([$1=$6 unacceptable, but no other $4 found in dnl
@@ -3272,9 +3273,9 @@ m4_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.
 m4_define([_AC_CHECK_TYPE_REPLACEMENT_TYPE_P],
-[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
+[m4_if(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


@@ -3282,8 +3283,8 @@ m4_define([_AC_CHECK_TYPE_REPLACEMENT_TY
 # -----------------------------------
 # Return `1' if STRING looks like a C/C++ type.
 m4_define([_AC_CHECK_TYPE_MAYBE_TYPE_P],
-[ifelse(m4_regexp([$1], [^[_a-zA-Z0-9 ]+\([_a-zA-Z0-9() *]\|\[\|\]\)*$]),
-       0, 1, 0)dnl
+[m4_if(m4_regexp([$1], [^[_a-zA-Z0-9 ]+\([_a-zA-Z0-9() *]\|\[\|\]\)*$]),
+       0, 1, 0)dnl
 ])# _AC_CHECK_TYPE_MAYBE_TYPE_P


@@ -3301,16 +3302,16 @@ m4_define([_AC_CHECK_TYPE_MAYBE_TYPE_P],
 # 3. $2 seems to be a type           => 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_DEFUN([AC_CONFIG_HEADERS],
 _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_DEFUN([AC_CONFIG_FILES],
 _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 @@ AC_DEFUN([AC_LINKER_OPTION],
 # 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
Index: aclang.m4
--- aclang.m4 Sun, 26 Nov 2000 17:18:55 +0100 akim (ace/b/32_aclang.m4 1.5.3.51 
644)
+++ aclang.m4 Sat, 02 Dec 2000 13:15:06 +0100 akim (ace/b/32_aclang.m4 1.5.3.51 
644)
@@ -134,8 +134,7 @@ m4_define([AC_LANG_PUSH],
 # 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 @@ m4_define([AC_LANG_PROGRAM(C)],
 # 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"
@@ -1783,7 +1782,7 @@ AC_DEFUN([AC_F77_FUNC],
   *)      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"
Index: autoconf.m4
--- autoconf.m4 Sun, 26 Nov 2000 17:18:55 +0100 akim (ace/28_autoconf.m 1.17 
644)
+++ autoconf.m4 Sat, 02 Dec 2000 13:17:34 +0100 akim (ace/28_autoconf.m 1.17 
644)
@@ -47,6 +47,7 @@
 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])
Index: m4sh.m4
--- m4sh.m4 Sat, 02 Dec 2000 12:27:01 +0100 akim (ace/b/41_m4sh.m4 1.11 644)
+++ m4sh.m4 Sat, 02 Dec 2000 13:06:19 +0100 akim (ace/b/41_m4sh.m4 1.11 644)
@@ -177,11 +177,11 @@ m4_define([AS_IFELSE],
 # 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])
Index: m4sugar.m4
--- m4sugar.m4 Sat, 02 Dec 2000 12:42:02 +0100 akim (ace/b/27_libm4.m4 1.44 644)
+++ m4sugar.m4 Sat, 02 Dec 2000 12:55:04 +0100 akim (ace/b/27_libm4.m4 1.44 644)
@@ -122,6 +122,7 @@ m4_define([m4_copy_unm4],
 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_define([m4_fatal],
 # 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_define([m4_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 @@ m4_define([_m4_for],
 # |        [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 @@ m4_define([_m4_for],
 # | 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 @@ m4_define([_m4_for],
 # | 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_define([_m4_defun_pro],
 # 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_split>>,
 <<m4_changequote(``, '')dnl
-[dnl Can't use m4_default here instead of ifelse, because m4_default uses
+[dnl Can't use m4_default here instead of m4_if, because m4_default uses
 dnl [ and ] as quotes.
 m4_patsubst(````$1'''',
-           ifelse(``$2'',, ``[         ]+'', ``$2''),
+           m4_if(``$2'',, ``[  ]+'', ``$2''),
            ``], ['')]dnl
 m4_changequote([, ])>>)
 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_define([m4_text_wrap],
 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])])])



Index: tests/aclocal.m4
--- tests/aclocal.m4 Thu, 26 Oct 2000 21:03:04 +0200 akim (ace/b/23_actest.m4 
1.18 644)
+++ tests/aclocal.m4 Sat, 02 Dec 2000 13:15:49 +0100 akim (ace/b/23_actest.m4 
1.18 644)
@@ -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)
Index: tests/atgeneral.m4
--- tests/atgeneral.m4 Mon, 27 Nov 2000 22:06:51 +0100 akim 
(ace/b/19_atgeneral. 1.36 644)
+++ tests/atgeneral.m4 Sat, 02 Dec 2000 13:16:07 +0100 akim 
(ace/b/19_atgeneral. 1.36 644)
@@ -338,9 +338,9 @@ m4_define([AT_SETUP],
 # 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)
Index: tests/atspecific.m4
--- tests/atspecific.m4 Sun, 26 Nov 2000 18:04:11 +0100 akim 
(ace/b/24_atspecific 1.25 644)
+++ tests/atspecific.m4 Sat, 02 Dec 2000 13:16:39 +0100 akim 
(ace/b/24_atspecific 1.25 644)
@@ -91,7 +91,7 @@ m4_define([_AT_CHECK_AC_MACRO],
 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]