automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: m4/autoconf quoting difference in include()


From: Nick Bowler
Subject: Re: m4/autoconf quoting difference in include()
Date: Wed, 16 Jul 2014 14:33:34 -0400
User-agent: Mutt/1.5.22 (2013-10-16)

Adding Automake list to Cc.

On 2014-07-16 17:17 +0200, Roman Neuhauser wrote:
> (this is a resend with a proper subject, sorry)
> 
> i had some trouble figuring out how to get the include macro inside
> another (parameterized) macro.
[...]
> this fails in configure.ac (autoconf 2.69):
> 
>   m4_define([nodot], [[\([_0-9a-zA-Z]+\)]])
>   m4_define([reversion], [^nodot\.nodot\.nodot$])
>   m4_define([getver], [regexp($1, reversion, $2)])
>   m4_define([readver], [getver(m4_include($1), [\&])])
>   m4_define([ver], readver([VERSION]))
> 
> messages:
> 
>   aclocal: error: configure.ac:7: file '$1' does not exist
>   autoreconf: aclocal failed with exit status: 1

Autoconf/m4 have no problem with using m4_include in this manner
(although you have some quoting issues).  The problem here is aclocal
(part of Automake) which basically works by grepping a bunch of input
files for magic strings (such as m4_include).

Unfortunately, as you have just discovered, this method comes with some
severe limitations.  I don't think the operation of aclocal is really
discussed in the Automake manual.  This is regrettable because it's
easy to run into these problems by accident.

> i can get it to work by quoting the m4_include macro name:
> 
>   m4_define([readver], [getver([m4_include]($1), [\&])])

You can trick aclocal really easily because it doesn't try to
understand m4 syntax at all.  If this approach works for your
package, go for it.

Cheers,
-- 
Nick Bowler, Elliptic Technologies (http://www.elliptictech.com/)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]