Subject: Re: bug#8718: error when using nested conditionals

From: Bruno Haible <[email-masked]>
Date: Fri, 10 Jun 2011 12:44:46 +0200

> Since the usual way to implement nestable behaviour in Autoconf is
> m4_pushdef / m4_popdef

Another idea would to be m4_pushdef AM_CONDITIONAL itself.

If you add a third parameter to AM_CONDITIONAL, denoting the conditions
in which the conditional needs to be defined, then gnulib could emit
code like this:

  m4_define([AM_CONDITIONAL_ORIG], m4_defn([AM_CONDITIONAL]))
  AC_DEFUN([gl_LENIENT_CONDITIONAL], [AM_CONDITIONAL_ORIG([$1],[$2],[USE_FOO])])
  m4_pushdef([AM_CONDITIONAL], [gl_LENIENT_CONDITIONAL])
  if test $enable_foo; then
    AM_CONDITIONAL([FOO], [:])
  fi
  m4_pushdef([AM_CONDITIONAL], [gl_LENIENT_CONDITIONAL])
  if test -n "$user_flag"; then 
    AM_CONDITIONAL([BAR], [test $user_flag = yes])
  fi
  m4_popdef([AM_CONDITIONAL])
  if test 0 = 1; then 
    AM_CONDITIONAL([BAZ], [:])
  fi
  m4_popdef([AM_CONDITIONAL])

But it certainly gets hairy...

Bruno
-- 
In memoriam Lamana Ould Bou <http://fr.wikipedia.org/wiki/Lamana_Ould_Bou>