autoconf
[Top][All Lists]
Advanced

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

Macro ordering and conditionals


From: Russ Allbery
Subject: Macro ordering and conditionals
Date: Sat, 24 Mar 2007 18:55:14 -0700
User-agent: Gnus/5.110006 (No Gnus v0.6) XEmacs/21.4.19 (linux)

I have a feeling that this is a known problem with no good solution, but
in poking around a bit in the Autoconf manual, I didn't see where it was
mentioned.  This is probably a documentation bug report asking for a
mention somewhere in Dependencies Between Macros.

The following configure.ac does very strange things:

AC_INIT([test], [1.0], address@hidden)
if test true = false ; then
    AC_CHECK_HEADERS([foo.h])
fi
if test true = true ; then
    AC_CHECK_HEADERS([stdio.h])
fi

windlord:~/tmp/test> ./configure
checking stdio.h usability... no
checking stdio.h presence... no
checking for stdio.h... no

Inspecting config.log reveals that Autoconf is quietly using empty
variables for the preprocessor and compiler.  Presumably what's happened
is that the prerequisite macros for AC_CHECK_HEADERS were expanded in the
first conditional and therefore never run.

The only real solution that I can think of for this is to put the code for
all prerequisite macros at the top of configure outside of any user
conditionals, but that too may break in some circumstances.

Obviously, this is a reduced test case; the actual case that triggered
this involved several layers of complex macros that just happened to
create, on one system, a situation equivalent to the above.

-- 
Russ Allbery (address@hidden)             <http://www.eyrie.org/~eagle/>




reply via email to

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