[Top][All Lists]

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

Re: AM_CONDITIONAL + AM_COND_IF does not work

From: Gavin Smith
Subject: Re: AM_CONDITIONAL + AM_COND_IF does not work
Date: Mon, 9 Mar 2015 17:45:11 +0000

On 9 March 2015 at 15:06, Marc Wäckerlin <address@hidden> wrote:
> According to the official documentation(*):
> ------------------------------------------
> Here is an example of how to define a conditional config file:
> AM_CONDITIONAL([SHELL_WRAPPER], [test "x$with_wrapper" = xtrue])
>            [AC_CONFIG_FILES([])])
> ------------------------------------------
> I try to generically find out, whether examples/ exists in a
> project and to automatically use it, if it exists:
> ------------------------------------------
> AM_CONDITIONAL([HAVE_EXAMPLES_DIR], [test -f examples/])
> AM_COND_IF([HAVE_EXAMPLES_DIR], [AC_CONFIG_FILES([examples/makefile])])
> ------------------------------------------
> But automake fails:
> ------------------------------------------
> error: required file 'examples/' not found
> ------------------------------------------
> So, what's the problem?
> It's nearly the same code as in the example ...

As you found automake gets information from It does this
using a macro "tracing" feature of autoconf. If you run "automake
--verbose" you will see the macros it is tracing, including
AC_CONFIG_FILES. With a setup like yours,

$autoconf --trace=AC_CONFIG_FILES:\$f:\$l::\$d::\$n::\${::}%

gives the output

automake doesn't know or care that one of these uses of
AC_CONFIG_FILES was conditional. It is looking for the input files to
automake (like ""), which it will derive from the arguments
to AC_CONFIG_FILES. It wouldn't be possible for these input files to
be defined conditionally in the configure script, because logically
automake runs before the configure script.

The automake manual says that automake won't recognize an argument to
AC_CONFIG_FILES if its value is given indirectly through a shell
variable (see "Requirements" node), so maybe you could try that.

reply via email to

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