Re: m4/autoconf quoting difference in include()

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

 



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/)

_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
https://lists.gnu.org/mailman/listinfo/autoconf




[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux