bug-automake
[Top][All Lists]
Advanced

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

bug#8718: error when using nested conditionals


From: Bruno Haible
Subject: bug#8718: error when using nested conditionals
Date: Fri, 10 Jun 2011 11:24:20 +0200
User-agent: KMail/1.9.9

Hi Stefano,

> 'AM_IGNORE_UNDEFINED_CONDITIONALS' can accept two
> arguments, "yes" and "no" (defaulting to "yes" if no argument is given).
> The idea is that an usage like:
> 
>   AM_CONDITIONAL([FOO], [:])
>   AM_IGNORE_UNDEFINED_CONDITIONALS([yes])
>   if test -n "$user_flag"; then 
>     AM_CONDITIONAL([BAR], [test $user_flag = yes])
>   fi
>   AM_IGNORE_UNDEFINED_CONDITIONALS([no])
>   if test 1 = 1; then 
>     AM_CONDITIONAL([BAZ], [:])
>   fi
> 
> will cause the generated configure to check that the FOO and BAZ
> conditionals are defined, but not to check that the BAR conditional
> is defined.

This would fit gnulib's use-case. Thank you.

Actually this pair of AM_IGNORE_UNDEFINED_CONDITIONALS invocations looks
like something that should be nestable:

  AM_IGNORE_UNDEFINED_CONDITIONALS([yes])
  if test $enable_foo; then
    AM_CONDITIONAL([FOO], [:])
  fi
  AM_IGNORE_UNDEFINED_CONDITIONALS([yes])
  if test -n "$user_flag"; then 
    AM_CONDITIONAL([BAR], [test $user_flag = yes])
  fi
  AM_IGNORE_UNDEFINED_CONDITIONALS([no])
  if test 0 = 1; then 
    AM_CONDITIONAL([BAZ], [:])
  fi
  AM_IGNORE_UNDEFINED_CONDITIONALS([no])

should cause the generated configure to not check about FOO, BAR, BAZ.
Since the usual way to implement nestable behaviour in Autoconf is
m4_pushdef / m4_popdef, maybe it is sufficient to document a single
m4_define'd macro, say, AM_CHECK_CONDITIONALS_DEFINED, so that the
snippet above can be written as:

  m4_pushdef([AM_CHECK_CONDITIONALS_DEFINED], [])
  if test $enable_foo; then
    AM_CONDITIONAL([FOO], [:])
  fi
  m4_pushdef([AM_CHECK_CONDITIONALS_DEFINED], [])
  if test -n "$user_flag"; then 
    AM_CONDITIONAL([BAR], [test $user_flag = yes])
  fi
  m4_popdef([AM_CHECK_CONDITIONALS_DEFINED])
  if test 0 = 1; then 
    AM_CONDITIONAL([BAZ], [:])
  fi
  m4_popdef([AM_CHECK_CONDITIONALS_DEFINED])

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





reply via email to

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