From: Eric Blake Date: Mon, 20 Oct 2008 22:43:41 +0000 (-0600) Subject: Allow AS_CASE in shell lists. X-Git-Tag: v2.63b~220 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e84e41e106b75ee368627a8c93d49c564d7dec15;p=thirdparty%2Fautoconf.git 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. Signed-off-by: Eric Blake --- diff --git a/ChangeLog b/ChangeLog index 93f29c059..dba8c315e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2008-10-21 Eric Blake + 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 4ac8e8adc..8b682b840 100644 --- 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. + * Major changes in Autoconf 2.63 (2008-09-09) [stable] Released by Eric Blake, based on git versions 2.62.*. diff --git a/lib/autoconf/c.m4 b/lib/autoconf/c.m4 index e62797fe5..f3b3e5fc7 100644 --- a/lib/autoconf/c.m4 +++ b/lib/autoconf/c.m4 @@ -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], diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4 index 94572e0de..57da252ad 100644 --- a/lib/m4sugar/m4sh.m4 +++ b/lib/m4sugar/m4sh.m4 @@ -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]) diff --git a/tests/m4sh.at b/tests/m4sh.at index 8e3e6d2d5..75938139d 100644 --- a/tests/m4sh.at +++ b/tests/m4sh.at @@ -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=