GNU bug report logs - #8718
error when using nested conditionals

Previous Next

Package: automake;

Reported by: Bruno Haible <bruno <at> clisp.org>

Date: Sun, 22 May 2011 22:31:02 UTC

Severity: normal

Tags: wontfix

Done: Stefano Lattarini <stefano.lattarini <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Bruno Haible <bruno <at> clisp.org>
To: Stefano Lattarini <stefano.lattarini <at> gmail.com>
Cc: 8718 <at> debbugs.gnu.org
Subject: bug#8718: error when using nested conditionals
Date: Fri, 10 Jun 2011 11:24:20 +0200
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>




This bug report was last modified 13 years and 345 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.