This is the mail archive of the automake@gnu.org mailing list for the automake project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Plan: Wednesday


>>>>> "Robert" == Robert Collins <robert.collins@itdomain.com.au> 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 :)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]