automake
[Top][All Lists]
Advanced

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

Re: Plan: Wednesday


From: Akim Demaille
Subject: Re: Plan: Wednesday
Date: 22 Aug 2001 16:30:03 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Artificial Intelligence)

>>>>> "Robert" == Robert Collins <address@hidden> writes:

Robert> test ./pr220.test aclocal: macro `AM_CONDITIONAL_' required
Robert> but not defined FAIL: pr220.test

Err, sorry, I meant AC_DEFUN, not AC_DEFINE...

Of course this will work only with non-toplevel AM_CONDITIONAL (the
same old story: AC_REQUIRE at the top level is _wrong_):

AC_DEFUN([AM_CONDITIONAL],
[ifelse([$1], [TRUE],
        [errprint(__file__:__line__: [$0: invalid condition: $1
])dnl
m4exit(1)])dnl
ifelse([$1], [FALSE],
       [errprint(__file__:__line__: [$0: invalid condition: $1
])dnl
m4exit(1)])dnl

AC_DEFUN([AM_CONDITIONAL_$1],
[AC_SUBST([$1_TRUE], ['#'])
AC_SUBST([$1_FALSE], ['#'])
if $2; then
  $1_TRUE=
  $1_FALSE='#'
else
  $1_TRUE='#'
  $1_FALSE=
fi
])
AC_REQUIRE([AM_CONDITIONAL_$1])
# Leave something, macro expanding to nothing can provoke empty if's.
:
])

AC_DEFUN([MY_BAR],
[if false; then
  AM_CONDITIONAL([BAR], true)
fi
])

AC_INIT
if false; then
  AM_CONDITIONAL([FOO], true)
fi
MY_BAR
cat >foo.in <<eof
FT: @FOO_TRUE@
FF: @FOO_FALSE@
BT: @BAR_TRUE@
BF: @BAR_FALSE@
eof
AC_OUTPUT(foo)
cat foo


gives:

/tmp % ./configure
16:28 remo
configure: creating ./config.status
config.status: creating foo
FT: 
FF: 
BT: 
BF: #

but anyway, this is broken since it means that $2 will be evaluated
before the code given by the user, so chances are even higher to
perform unexpected things.  Well, very expectable to Autoconf gurus,
but not to users :)



reply via email to

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