automake
[Top][All Lists]
Advanced

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

Re: What is meant by, "XXX does not appear in AM_CONDITIONAL"?


From: Ralf Corsepius
Subject: Re: What is meant by, "XXX does not appear in AM_CONDITIONAL"?
Date: Tue, 11 Jan 2005 12:26:58 +0100

On Tue, 2005-01-11 at 11:09 +0100, Stepan Kasal wrote:
> Hi Bruce,
> 
> On Mon, Jan 10, 2005 at 08:35:27AM -0800, Bruce Korb wrote:
> > > if [some-shell-script-test]
> > > then
> > >   ...
> > >   AM_CONDITIONAL([XXX], [true])
> > > else
> > >   ...
> > >   AM_CONDITIONAL([XXX], [false])
> > > fi
> 
> > reading the docs some more, they explicitly state to not do this.
> 
> I re-read the node ``Conditionals'' of automake manual (CVS version) just
> now.  I don't see any problem:
> 
> ``you must arrange for _every_ `AM_CONDITIONAL' to be invoked every
>   time `configure' is run''
> 
> and you are doing this.
> 
> But Ralf said that this practice is not reliable, and I'd believe his
> experience.
The "_every_" is the crucial word in your sentence.

In practice this "_every_" is very easy to miss, esp. if packing
conditionals into macros, splitting "setting up conditionals"/"using
conditionals" into different macro files and trying to "AC_REQUIRE" the
these macros:

A semi-classic example of such a situation is this one:

# cat configure.ac:
AC_PREREQ(2.59)
AC_INIT(autobug, 20040111, address@hidden)
AM_INIT_AUTOMAKE([foreign 1.9.4])
AC_ARG_ENABLE(cxx)
AS_IF([test "$enable_cxx" = yes],
  [AC_PROG_CXX])
AM_CONDITIONAL(USECXX,[test "enable_cxx" = yes])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT

# cat Makefile.am
if USECXX
noinst_PROGRAMS = foo
foo_SOURCES = foo.cc
endif

automake will not complain, but configure will yell at runtime:

# ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
configure: error: conditional "AMDEP" was never defined.
Usually this means the macro was only invoked conditionally.

=> Not even automake and autoconf are to treat this situation properly.


Even more bizarre situations can be constructed when adding AC_PROG_CC
to the configure.ac above. Depending on where you insert it either this
happens:

# ./configure
...
hecking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
configure: error: conditional "am__fastdepCXX" was never defined.
Usually this means the macro was only invoked conditionally.

or this

# ./configure
...
checking whether we are using the GNU C compiler... no
checking whether gcc accepts -g... no
checking for gcc option to accept ANSI C... none needed
checking dependency style of gcc... none
configure: error: conditional "AMDEP" was never defined.
Usually this means the macro was only invoked conditionally.

[Note: this is the same system, same environment!]

In a real-world example, I once encountered a case were such breakdown
occurred conditionally, depending on the --enable/--disable arguments
being passed to a configure script ;(

Ralf






reply via email to

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