Eli Zaretskii wrote:
> > On the system that Bruno was testing, "awk" didn't work so "nawk" was
> > preferred.
> 
> So maybe we should verify that the "awk": we found satisfies our
> needs, and not just rely on the name?

Yes, that would be most in line with the Autoconf principles.

> E.g., we could see what "awk"
> outputs for "--version", and judge by that?

  $prog --version
does not help here, because nawk and mawk don't implement it. But what
works, is a test whether $prog supports the function syntax: On this
platform,

  gawk 'function foo () {}' 2>/dev/null
  nawk 'function foo () {}' 2>/dev/null

both have exit code 0, whereas

  awk 'function foo () {}' 2>/dev/null

has exit code 2.

To implement this, use a variant of AC_CHECK_PROGS that accepts a test
argument. (AM_PATH_PROG_WITH_TEST from gnulib/m4/progtest.m4 is not the
right there here, because it searches only for a single program name,
not multiple ones.)

Bruno




Reply via email to