Hi Bruce, On Mon, Jan 10, 2005 at 08:35:27AM -0800, Bruce Korb wrote: > > if [some-shell-script-test] > > then > > ... > > AM_CONDITIONAL([XXX], [true]) > > else > > ... > > AM_CONDITIONAL([XXX], [false]) > > fi
> reading the docs some more, they explicitly state to not do this. I re-read the node ``Conditionals'' of automake manual (CVS version) just now. I don't see any problem: ``you must arrange for _every_ `AM_CONDITIONAL' to be invoked every time `configure' is run'' and you are doing this. But Ralf said that this practice is not reliable, and I'd believe his experience. If I can add a bit of my experience, then I witness that using commands `true' or `false' as the second part of AM_CONDITIONAL is often sign of bad style. This might apply to your ``set_XXX'' too. Let me explain: You said: > This is more-or-less exactly what is going on, except that > the "some-shell-script-test" includes (but is not exactly > limited to) some compile-and-link macros. Oh, then the following if should not probably test for `$?', but for a variable value, or something else which represents the result of the previous tests. In most cases, you can follow this pattern: AC_CHECK_FOR_ELEPHANTS(...) if test "x$ELEPHANTS_FOUND" = xyes; then ... else ... fi AM_CONDITIONAL([XXX], [test "x$ELEPHANTS_FOUND" = xyes]) or perhaps this pattern: AC_CHECK_FOR_ELEPHANTS(...) HAVE_ELEPHANTS=yes case $ELEPHANT_TYPE in indian) ...;; african) ...;; *) HAVE_ELEPHANTS=no;; esac AM_CONDITIONAL([HAVE_ELEPHANTS], [test $HAVE_ELEPHANTS = yes]) AM_CONDITIONAL([INDIAN_ELEPHANTS], [test "x$ELEPHANT_TYPE" = xindian]) A side note: yes, you could set HAVE_ELEPHANTS to `true' or `false' here and call ``AM_CONDITIONAL([HAVE_ELEPHANTS], [$HAVE_ELEPHANTS])''. It's a matter of taste. Another side note: this example probably explains the Ralf's recommendation to have AM_CONDITIONALa out of any if is right: you could easily imagine that one forgets to set INDIAN_ELEPHANTS when no elephants are available. Have a nice day, Stepan