Here is the solution that I put together after reading the documentation, tutorials, help streams, mailing lists, etc., and just tried everything until they worked, I could explain why they worked.
In configure.ac I put the following lines of code
# This adds the option of compiling without using the ctemplate library, # which has proved troublesome for compilation on some platforms AC_ARG_ENABLE(ctemplate, [ --disable-ctemplate Disable compilation with ctemplate and HTML output], [case "${enableval}" in yes | no ) WITH_CTEMPLATE="${enableval}" ;; *) AC_MSG_ERROR(bad value ${enableval} for --disable-ctemplate) ;; esac], [WITH_CTEMPLATE="yes"] ) dnl Make sure we register this option with Automake, so we know whether to dnl descend into ctemplate for more configuration or not AM_CONDITIONAL([WITH_CTEMPLATE], [test "x$WITH_CTEMPLATE" = "xyes"]) # Define CTEMPLATE in config.h if we're going to compile against it if test "x$WITH_CTEMPLATE" = "xyes"; then AC_DEFINE([CTEMPLATE], [], ["build using ctemplate library"]) AC_MSG_NOTICE([ctemplate will be used, HTML output enabled]) else AC_MSG_NOTICE([ctemplate will not be used, HTML output disabled]) fi
In the next step, I changed Makefile.am at the top level to the following:
if WITH_CTEMPLATE MAYBE_CTEMPLATE = ctemplate endif SUBDIRS = boost libgsl $(MAYBE_CTEMPLATE) libutil ...
At the bottom level of Makefile.am s I added
if WITH_CTEMPLATE
Finally, I had to make sure that one of the key C ++ header files (included by other parts of the code) has the following:
#ifdef HAVE_CONFIG_H # include "config.h" #endif
config.h contains any new definitions created using AC_DEFINE , so this file should be included in the parts that check if the macro definition created by this route (or undefined) is defined.
It took me a long time and with disappointment, for my part; I can only hope that documenting this explanation here saves someone from the same fate.