[cairo] Automake conditional variable problem...

James Henstridge james at daa.com.au
Sun Mar 21 16:58:41 PST 2004


On 20/03/2004 6:25 AM, Carlos Noguera wrote:

>Hi all,
>
>I'm in the process of creating some CVS ebuils for Gentoo, and in the
>course of building the Cairo and libglc CVS trees (with the GLX and
>shading patches) I've come across some issues.
>
>Aparently automake (version 1.8.2) really doesn't like the conditional
>variable assignments pkg-config generates for these builds. The
>autogen.sh dies with a "automake does not support conditional definition
>of ... in ...". (eg. libglc_glx_extra_dist in EXTRA_DIST)
>
>So far I've gotten around these by explicitly changing the definitions
>to what I want in the Makefiles, but this isn't the "right" way to do
>it.
>
>Does anyone on this list have any suggestions? I'm sorry if the question
>is simple or stupid, but I'm just starting out... :-/
>  
>
It indicates a bug in the Cairo configure scripts.

AM_CONDITIONAL() should never be called from within a branch of an "if" 
statement or similar.  Instead, it should be placed outside of the if 
statement, using an appropriate condition.

The reason why automake is a bit more strict about this in newer 
versions is that it can cause hard to debug build problems.  It is quite 
easy to see why when you look at how it is implemented.

If you call AM_CONDITIONAL(foo, ...) with a true expression, it will 
substitute @FOO_TRUE@ with "" in the makefiles, and @FOO_FALSE@ with 
"#".  If called with a false expression, @FOO_TRUE@ will be substituted 
with "#" and @FOO_FALSE@ with "".  This way, one section of the makefile 
will be commented out and the other will be active.

However, if the AM_CONDITIONAL doesn't get run when configure executes, 
both @FOO_TRUE@ and @FOO_FALSE@ will both be substituted as "" and the 
two branches of the makefile will be active at the same time.

So a good rule of thumb is to never put an AM_CONDITIONAL() call inside 
an if statement.

James.

-- 
Email: james at daa.com.au
WWW:   http://www.daa.com.au/~james/






More information about the cairo mailing list