Subject: bug#8718: error when using nested conditionals

From: Bruno Haible <[email-masked]>
Date: Fri, 10 Jun 2011 01:29:57 +0200

Hi Stefano,

> Cannot you simply initialize the 
> automake conditionals you might need and that you know might be called
> conditionally to (possibly dummy) defaults in gl_INIT or gl_EARLY or
> something like that?

No, I cannot do that. The gnulib users write code like this:

=================================== foo.m4 ====================================
AC_DEFUN([gl_FOO],
[
  if test 7 = 7; then
    use_variant_a=true
  else
    use_variant_a=false
  fi
  AM_CONDITIONAL([USE_VARIANT_A], [$use_variant_a])
])
=================================== foo.mk ====================================
if USE_VARIANT_A
libgnu_a_SOURCES += foo_a.c
else
libgnu_a_SOURCES += foo_b.c
endif
===============================================================================

on which I have no influence, and from which I cannot extract/collect the
USE_VARIANT_A identifier.

> autoconf 
> knows nothing about the Makefile.am files, and the current autotools
> "layerization" does not allow autoconf to use any sort of "callback" to
> automake to get such information

But when autoconf's generated configure file produces the error

  configure: error: conditional "USE_VARIANT_A" was never defined.

it must have gotten the info "please check that USE_VARIANT_A is defined".
From Automake, when it scanned the Makefile.am.

What I'm asking for is that
  - Automake's scanning of Makefile.am keeps track of which conditionals
    are enabled at each line.
  - Automake passes to Autoconf the info "please check that either USE_FOO
    has the value 'false' or USE_VARIANT_A is defined".

> it could be easily done with
> a new m4 macro, say 'AM_IGNORE_UNDEFINED_CONDITIONALS'.

Or with an Automake option that I add to the Makefile.am. I don't mind which
way.

Bruno
-- 
In memoriam Johanna Kirchner <http://en.wikipedia.org/wiki/Johanna_Kirchner>