Hello Niels,

* Niels Lohmann wrote on Fri, Feb 05, 2010 at 11:50:10AM CET:
> we have a project where we use the configure script to search for some
> helper tools and write the paths to the package.m4 for the autotest
> test suite. We do this with
> 
> configure.ac:
>       AC_PATH_PROGS(WGET, [wget], not found)
>       AC_PATH_PROGS(HEAD, [head], not found)
>       AC_PATH_PROGS(TAIL, [tail], not found)
>       ...
>       AC_CONFIG_FILES(tests/package.m4)
> 
> tests/package.m4.in:
>       m4_define([WGET], [...@wget@])
>       m4_define([HEAD], [...@head@])
>       m4_define([TAIL], [...@tail@])
>       ...
> 
> A testcase using WGET can then check whether or not it is set to "not
> found" and either continue the test or skip it.
> 
> This all works, but if (by accident), a check in configure.ac is
> deleted, say than one for WGET, then tests/package.m4 ends up with an
> unresolved substitution:
> 
>       m4_define([WGET], [...@wget@])
[...]
> I have very little knowledge about what's going on in autom4te, and I
> know that this scenario is a user error. However, I think that
> Autoconf should give a warning if substitution remain unresolved --
> anything but an infinite loop would be helpful.

autom4te can give user errors for strings that should not appear in the
output; see the m4_pattern_forbid documentation.

But say, why don't you just use simple shell variables instead?

tests/package.m4.in:
        WGET='@WGET@'

That would strike me as a more natural approach.

Cheers,
Ralf


Reply via email to