[Top][All Lists]

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

Re: AM_COND_IF with m4_foreach+m4_include

From: Eric Blake
Subject: Re: AM_COND_IF with m4_foreach+m4_include
Date: Thu, 10 Feb 2011 14:23:07 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.7

On 02/10/2011 02:02 PM, Dave Goodell wrote:
> m4_foreach([subsys_i],[[subconfigure]],[m4_include(subsys_i[.m4])])

So you are indirectly including a file whose name is not immediately
apparent in the parent file...

> #end
> AC_OUTPUT([Makefile])
> ----8<----
> and here's subconfigure.m4:
> ----8<----
> # begin subconfigure.m4
> # this AM_COND_IF doesn't get expanded for some reason...
> AM_COND_IF([COND],[echo COND is true],[echo COND is false])

And only the subfile references the AM_COND_IF macro.

My initial take is that the problem is that aclocal is trying to figure
out which files to include in order to provide all the necessary macro
definitions, but you have obfuscated the name of the included file in
such a way that aclocal cannot figure out that it needs to trace
subconfigure.m4, and thus does not include the automake-internal files
that define AM_COND_IF because it couldn't see anyone using that macro.

> here's the resulting snippet of configure between "#begin" and "#end":

> # begin subconfigure.m4
> # this AM_COND_IF doesn't get expanded for some reason...
> AM_COND_IF(COND,echo COND is true,echo COND is false)

Perhaps you could m4_include the automake file that defines AM_COND_IF,
or work around it by using AM_COND_IF from directly within
where aclocal can trace it, or m4_include subconfigure.m4 in such a way
that aclocal can trace it.  Since aclocal belongs to automake, you may
get a slightly better response on that list on how to teach aclocal how
to recognize that it needs to suck in the definition for AM_COND_IF.

> Many variations of this script work as expected, including non-looped 
> "m4_include" and looped "m4_include" but explicitly naming "subconfigure.m4" 
> instead of attempting to compute it from the loop variable.  Have I botched 
> the m4 quoting somehow?

You haven't botched m4 quoting, but you did make it much harder for
aclocal to do its job.

> I believe I have several possible workarounds,

Glad to hear it.

Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

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