Discussion:
sadf
Roman Neuhauser
2014-07-16 14:55:59 UTC
Permalink
i had some trouble figuring out how to get the include macro inside
another (parameterized) macro.

this works in m4:

changequote(`[', `]')

define([nodot], [[\([_0-9a-zA-Z]+\)]])
define([reversion], [^nodot\.nodot\.nodot$])
define([getver], [regexp($1, reversion, $2)])
define([readver], [getver(include($1), [\&])])

readver([VERSION])

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

i can get it to work by quoting the m4_include macro name:

m4_define([readver], [getver([m4_include]($1), [\&])])

why is this? can you point me to the relevant passages in the manual?
i admit i haven't read it all (yet).
--
roman
Loading...