Macro ordering and conditionals

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

 



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], [rra@xxxxxxxxxxxx])
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 (rra@xxxxxxxxxxxx)             <http://www.eyrie.org/~eagle/>


_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://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