]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Allow AS_CASE in shell lists.
authorEric Blake <ebb9@byu.net>
Mon, 20 Oct 2008 22:43:41 +0000 (16:43 -0600)
committerEric Blake <ebb9@byu.net>
Wed, 22 Oct 2008 03:04:02 +0000 (21:04 -0600)
* lib/m4sugar/m4sh.m4 (AS_CASE): Always execute test, in case of
side effects.  Allow continuation of script on same line as esac.
* lib/autoconf/c.m4 (AC_PROG_CC_STDC): Adjust client.
* tests/m4sh.at (AS@&t@_IF and AS@&t@_CASE): Enhance test.
* NEWS: Document the subtle change.

Signed-off-by: Eric Blake <ebb9@byu.net>
ChangeLog
NEWS
lib/autoconf/c.m4
lib/m4sugar/m4sh.m4
tests/m4sh.at

index 93f29c059a5b9042db442ae081ba8180e76bc3ba..dba8c315eea1018b53382fac4cf28e866e4b6726 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2008-10-21  Eric Blake  <ebb9@byu.net>
 
+       Allow AS_CASE in shell lists.
+       * lib/m4sugar/m4sh.m4 (AS_CASE): Always execute test, in case of
+       side effects.  Allow continuation of script on same line as esac.
+       * lib/autoconf/c.m4 (AC_PROG_CC_STDC): Adjust client.
+       * tests/m4sh.at (AS@&t@_IF and AS@&t@_CASE): Enhance test.
+       * NEWS: Document the subtle change.
+
        Allow AS_IF in shell lists.
        * lib/m4sugar/m4sh.m4 (AS_IF): Always execute test, in case of
        side effects.  Allow continuation of script on same line as fi.
diff --git a/NEWS b/NEWS
index 4ac8e8adc28f0214e974186c2ae09b5e2e70bf2c..8b682b84031c557ec75e361154db37197747a1d5 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -24,6 +24,11 @@ GNU Autoconf NEWS - User visible changes.
    AS_VAR_PUSHDEF  AS_VAR_SET  AS_VAR_SET_IF  AS_VAR_TEST_SET
    AS_VERSION_COMPARE
 
+** The m4sh macros AS_IF and AS_CASE can now be used in shell lists.
+   The responsibility for supplying a trailing newline now belongs to
+   the call site, but since most users did not add dnl, this generally
+   results in fewer empty lines in configure.
+
 \f
 * Major changes in Autoconf 2.63 (2008-09-09) [stable]
   Released by Eric Blake, based on git versions 2.62.*.
index e62797fe5ea888375b612e06ccae2a4c5121825f..f3b3e5fc7e48299ba35d456eebe48d7d0802be22 100644 (file)
@@ -1337,7 +1337,7 @@ AC_DEFUN([AC_PROG_CC_STDC],
     [no], [ac_cv_prog_cc_c99=no; ac_cv_prog_cc_c89=no],
          [_AC_PROG_CC_C99([ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99],
             [_AC_PROG_CC_C89([ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89],
-                             [ac_cv_prog_cc_stdc=no])])])dnl
+                             [ac_cv_prog_cc_stdc=no])])])
   AC_MSG_CHECKING([for $CC option to accept ISO Standard C])
   AC_CACHE_VAL([ac_cv_prog_cc_stdc], [])
   AS_CASE([$ac_cv_prog_cc_stdc],
index 94572e0defd5f4899e2b99096939d326e20c78f5..57da252ad29fa6075f51e5696b3ca0232eb51ed4 100644 (file)
@@ -498,12 +498,9 @@ m4_define([_AS_CASE_DEFAULT],
 [  *[)] $1 ;;
 ])
 m4_defun([AS_CASE],
-[m4_ifval([$2$3],
 [case $1 in
 m4_map_args_pair([_$0], [_$0_DEFAULT], m4_shift($@))dnl
-esac
-])dnl
-])# AS_CASE
+esac])# AS_CASE
 
 
 # AS_EXIT([EXIT-CODE = 1])
index 8e3e6d2d55cd02758cc60f1459a2114101ce3bb2..75938139d25d80e5c6269cd6914ba53d07db56bf 100644 (file)
@@ -801,10 +801,12 @@ AS_CASE([foo],
 
 # check for nesting, lists, and side effects
 empty=
-AS_IF([AS_IF([$empty], [echo eleven])]) && echo twelve
+AS_IF([AS_IF([$empty], [echo eleven])]) && AS_CASE([foo]) && echo twelve
 rm -f file
 AS_IF([touch file; false]) && echo thirteen
 test -f file && echo fourteen
+rm -f file
+AS_CASE([`touch file; false`]) && test -f file && echo fifteen
 
 # check that require works correctly
 m4_for([n], 1, 9, [],
@@ -855,6 +857,7 @@ eleven
 twelve
 thirteen
 fourteen
+fifteen
 foo1=1 bar1=1
 foo2=2 bar2=
 foo3=3 bar3=