Re: M4 syntax $11 vs. ${11}

Paul Eggert <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.patches,gmane.comp.gnu.m4.patches,gmane.comp.gnu.m4.general
Message-ID <[email protected]>
Eric Blake <[email protected]> writes:

> +fatal "need GNU m4 1.4.5 or later: $m4"
> +  unless system "echo 'ifdef(mac,bug)dnl' | $m4 --trace=mac 2>&1 | grep bug >/dev/null";
> +
> +# Detect if we can use feature added in M4 1.4.9 to warn user about $10.
> +# Override the user's choice of --warn-macro-sequence, since the default
> +# macro sequence rejects ${1} even though we guarantee it is safe.
> +$m4 .= " --warn-macro-sequence='\\\$\\([0-9][0-9]+\\|{{\\)'"
> +  if ! system "$m4 --help | grep warn-macro-sequence >/dev/null";

Can you please rewrite this so that it invokes m4 once instead of
twice, and doesn't use grep at all?  You can use Perl's pattern
matching instead of grep.  And I think you can test for both features
by a single call to 'm4'.  This will help autom4te start up a bit
faster.

Perhaps it would be even better to test for these things at
configure-time: that way, we won't have to invoke 'm4' at all, at
run-time.

A nit: the "+" isn't needed.  Once you see two digits, you don't need
to look for more.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.