Subject: bug#8718: error when using nested conditionals

From: "Ralf Wildenhues" <[email-masked]>
Date: Thu, 16 Jun 2011 21:48:59 +0200

Hello, and sorry for the delay,

* Bruno Haible wrote on Fri, Jun 10, 2011 at 01:29:57AM CEST:
> > 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:

Of course you can do that.

> =================================== 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])

Instead of this line, you could use
  AC_CONFIG_COMMANDS_PRE([AM_CONDITIONAL([...])])

to force the AM_CONDITIONAL statement to be executed at outer shell
level, late, and unconditionally.  Untested (if it gets the order
wrong wrt. the inner AC_CONFIG_COMMANDS_PRE, ping me, there should be
another way around it).

> ])

It's rather funny that this construct has been floated around this very
thread a couple of times without the implied conclusion.

I must say I don't like any of the other suggestions in this thread too
much.  You otherwise like being safe rather than sorry too, and there is
no compelling argument to weaken automake's consistency detection here.

Cheers,
Ralf