Hello Ralf, > > =================================== foo.m4 > > ==================================== > > AC_DEFUN([gl_FOO], > > [ > > if test 7 = 7; then > > use_variant_a=true > > else > > use_variant_a=false > > fi > > AM_CONDITIONAL([USE_VARIANT_A], [$use_variant_a]) > > Instead of this line, you could use > AC_CONFIG_COMMANDS_PRE([AM_CONDITIONAL([...])])
I cannot force the gnulib users to write autoconf macros which deviate that much from the idioms promoted by the Automake manual. But I can override AM_CONDITIONAL like this: ================================= configure.ac ================================= AC_INIT([dummy], [0]) AM_INIT_AUTOMAKE([foreign]) AC_PROG_CC AC_PROG_RANLIB m4_define([gl_CONDITIONAL_COUNTER], [0]) AC_DEFUN([gl_CONDITIONAL_LATER], [ m4_define([gl_CONDITIONAL_COUNTER], m4_incr(gl_CONDITIONAL_COUNTER)) m4_divert_text([INIT_PREPARE], [[gl_CONDITIONAL_]gl_CONDITIONAL_COUNTER=false]) if [$2]; then [gl_CONDITIONAL_]gl_CONDITIONAL_COUNTER=true; else [gl_CONDITIONAL_]gl_CONDITIONAL_COUNTER=false; fi AC_CONFIG_COMMANDS_PRE([AM_CONDITIONAL([$1], [[$gl_CONDITIONAL_]]]gl_CONDITIONAL_COUNTER[)]) ]) m4_pushdef([AM_CONDITIONAL], m4_defn([gl_CONDITIONAL_LATER])) if test 4 = 5; then use_foo=true gl_FOO else use_foo=false fi AM_CONDITIONAL([USE_FOO], [$use_foo]) m4_popdef([AM_CONDITIONAL]) AC_CONFIG_FILES([Makefile]) AC_OUTPUT ================================================================================ This solves my problem. Thanks for the idea to use AC_CONFIG_COMMANDS_PRE. I will add this workaround to gnulib. > You otherwise like being safe rather than sorry too, and there is > no compelling argument to weaken automake's consistency detection here. This workaround also will have the effect of weakening Automake's consistency detection, by defining an arbitrary value (false) for each of the occurring conditionals. But that's inevitable as long as this consistency detection is too strict. There's no point in being _that_ safe that you check unused expressions for validity. C compilers don't do it either: When I compile a C program #if 0 #if syntax error ((((,$$?! #endif #endif the second line yields no error and no warning, because the condition in that line is ignored. It is a pity if Autoconf + Automake cannot do the same. Oh well. But at least we've got a workaround now. Thanks. Bruno -- In memoriam Imre Nagy <http://en.wikipedia.org/wiki/Imre_Nagy>