> I have a list of 'test' directories containing Makefiles. I want to
> omit two of those tests if GNU Bison is not found, because they
> depend on GNU bison. How do I do this?
>
> AC_CHECK_PROG(BISON,bison,bison)
>
> dnl Below, I want the last two directories to be omitted.
> dnl I could do it with two calls to AC_OUTPUT, wrapped in an
> dnl if/else statement, but it would look really messy.
> dnl Is there a way to build this list beforehand, then add to it
> dnl only if bison is found?
>
> AC_OUTPUT(Makefile test-1/Makefile test-2/Makefile
> test-bison1/Makefile test-bison2/Makefile)
>
In current CVS autoconf (and the soon-to-be-released 2.50), this is
easy. Simply conditionally use AC_CONFIG_FILES:
AC_CONFIG_FILES(Makefile test-1/Makefile test-2/Makefile)
if test x$ac_cv_prog_BISON = xbison; then
AC_CONFIG_FILES(test-bison1/Makefile test-bison2/Makefile)
fi
AC_OUTPUT
In autoconf 2.13, you might get away with:
if test x$ac_cv_prog_BISON = xbison; then
extra_makefiles="test-bison1/Makefile test-bison2/Makefile"
fi
AC_OUTPUT(Makefile test-1/Makefile test-2/Makefile $extra_makefiles)