Hello, On Tue, 12 Apr 2016 11:05:51 -0400, Nick Bowler wrote: > There are several basic solutions: > > - First, you can just expand AC_PROG_CPP directly and unconditionally > before your if. This will ensure the macro is available in both cases. > > - Second is to rewrite your condition using AS_IF, which automatically > "hoists" the dependency AC_PROG_CPP (and any other dependencies) > outside of the if condition. For example: > > AS_IF([test x"$host" = x"avr"], > [AC_CHECK_HEADER([avr/io.h], [], > [AC_MSG_ERROR([missing header: avr/io.h])]) > AC_CHECK_HEADER([util/delay.h], [], > [AC_MSG_ERROR([missing header: util/delay.h])])], > > [AC_CHECK_HEADER([stdio.h], [], > [AC_MSG_ERROR([missing header: stdio.h])]) > AC_CHECK_HEADER([time.h], [], > [AC_MSG_ERROR([missing header: time.h])])]) > > - Third, you can make the checks unconditional but the hard > failures conditional, e.g.: > > AC_CHECK_HEADER([avr/io.h], [], > [if test x"$host" = x"avr"; then > AC_MSG_ERROR([missing header: avr/io.h]) > fi]) I just wanted to thank you for this explanation. I was not affected by the original issue, but your answer was very useful. Until now, I thought AS_IF() was just a stupid wrapper around the shell's if clause, but your answer makes it clear that it is a lot smarter than that. Thanks! Thomas -- Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com _______________________________________________ Autoconf mailing list Autoconf@xxxxxxx https://lists.gnu.org/mailman/listinfo/autoconf