* Eric Blake wrote on Fri, Apr 10, 2009 at 07:11:45AM CEST: > [moving to autoconf-patches]
[ dropping autoconf ] > According to Eric Blake on 4/7/2009 7:13 AM: > > According to Andreas Schwab on 4/7/2009 7:01 AM: > >> According to <http://www.in-ulm.de/~mascheck/bourne/> this was fixed in > >> the System III shell. > > > > Which pre-dates shell functions. Therefore, since AS_IF is part of m4sh, > > which guarantees a shell with functions, can elide empty else statements > > with impunity. Thanks for the research. > > I'm thinking of applying this patch; any objections to the wording? Can you hold back on this for a couple of days? I'm still in the process of going through Automake testsuite results, and might have found a tangent issue. Thanks, Ralf > 2009-04-09 Eric Blake <[email protected]> > > + Improve documentation about if exit status. > + * doc/autoconf.texi (Limitations of Builtins) <if>: Mention that > + exit status bugs don't affect modern targets. > + Reported by Andreas Schwab. > + > Make AS_IF, AS_CASE, and AS_FOR more robust to blank arguments. > * lib/m4sugar/m4sh.m4 (_AS_CASE, _AS_CASE_DEFAULT, AS_FOR, _AS_IF) > (_AS_IF_ELSE, AS_IF): Avoid syntax error on blank argument. > diff --git a/doc/autoconf.texi b/doc/autoconf.texi > index a47d3c8..c3033cd 100644 > --- a/doc/autoconf.texi > +++ b/doc/autoconf.texi > @@ -15829,7 +15829,8 @@ Limitations of Builtins > This is especially useful in other M4 macros, where the @dfn{then} and > @dfn{else} branches might be macro arguments. > > -There are shells that do not reset the exit status from an @command{if}: > +Some very old shells did not reset the exit status from an @command{if} > +with no @command{else}: > > @example > $ @kbd{if (exit 42); then true; fi; echo $?} > @@ -15837,9 +15838,10 @@ Limitations of Builtins > @end example > > @noindent > -whereas a proper shell should have printed @samp{0}. This is especially > -bad in makefiles since it produces false failures. This is why properly > -written makefiles, such as Automake's, have such hairy constructs: > +whereas a proper shell should have printed @samp{0}. But this is no > +longer a portability problem; any shell that supports functions gets it > +correct. However, it explains why some makefiles have such hairy > +constructs: > > @example > if test -f "$file"; then
