Ralf Wildenhues <Ralf.Wildenhues <at> gmx.de> writes: > > (better: I can't reproduce them with that, with a number of shells), > which means the number of currently known-problematic places in Autoconf > code is quite small, I found one in status.m4 and one in the test suite.
Thanks for the audit. > > This is what I've got now. Thoughts? > > I'm pretty sure that any remaining test failure I'm seeing are not > introduced by this patch, so if you are ok with it I'll apply. Any help I can offer on tracking down the (unrelated) AS_IF failures? At any rate, please apply, after addressing these nits: > > Cheers, > Ralf > > 2008-08-19 Jim Meyering <jim <at> meyering.net> > Eric Blake <ebb9 <at> byu.net> > Ralf Wildenhues <Ralf.Wildenhues <at> gmx.de> > > Avoid shell parse errors after interrupt due to empty command > substitutions. Let's shorten that to fit on one line, to make the git log easier to manage. I'm thinking: Avoid shell parse errors due to interrupted ``. > > +# AS_VAR_IF(VARIABLE, [VALUE = yes], IF-TRUE, IF-FALSE) > +# ----------------------------------------------------- Based on your argument that we are likely to forget that [] defaults to [yes], and that saving three characters at the expense of readability is awkward, how about just dropping the default, and always requiring clients to explicitly specify what they are comparing against: # AS_VAR_IF(VARIABLE, VALUE, IF-TRUE, IF-FALSE) > +# Implement a shell `if test $VARIABLE = VALUE; then-else'. > +# Polymorphic, and avoids pdksh expansion error upon interrupt. > +m4_define([AS_VAR_IF], > +[AS_LITERAL_IF([$1], > + [AS_IF([test "x$$1" = x""m4_default([$2], [yes])], [$3], [$4])], > + [as_val=AS_VAR_GET([$1]) > + AS_IF([test "x$as_val" = x""m4_default([$2], [yes])], [$3], [$4])])]) so that you s/m4_default.*yes.)/$2/ here (twice). We can always change our mind and add a default when we are ready to document AS_VAR_IF in the manual, but for now, the default does nothing since it is undocumented. -- Eric Blake
