You will need to install config.h
if it affects the interface. In practical terms, if the #define
's are required by the header(s), not just the .cc
implementation / compilation units.
If config.h
is a problem, you can specify another name in the AC_CONFIG_HEADERS macro. e.g., AC_CONFIG_HEADERS([foo_config.h])
.
The easiest way to install the header, assuming automake, is with:
nodist_include_HEADERS = foo_config.h
in the top-level Makefile.am
. the nodist
prefix tells automake that foo_config.h
is generated rather than distributed with the package.
If not using automake, install foo_config.h
in $includedir
. $exec_prefix/include
is arguably a more correct location for a generated header, but in practice the former location is fine.
I avoid using config.h
, by passing relevant definitions in CPPFLAGS
or foo_CPPFLAGS
along with AC_SUBST
to Makefile.am
for source builds, or AC_SUBST
to foo.h.in
to generate headers at configure-time. A lot of config.h
is test-generated noise. It requires more infrastructure, but it's what I prefer. I wouldn't recommend this approach unless you're comfortable with the autotools.