The package version (see AC_INIT
) of my medium-sized autotools project changes quite often. When the package version changes, I suffer from unnecessary rebuild of the whole project, because PACKAGE_VERSION
and friends in config.h
has changed and config.h
is included in all source files.
The version is actually needed in just one source file and I'd like to put these definitions in a separate generated header and include it in this source file.
In file general.m4
belonging to autoconf I see the following:
m4_define([_AC_INIT_PREPARE],
...
AC_DEFINE_UNQUOTED([PACKAGE_VERSION], ["$PACKAGE_VERSION"],
[Define to the version of this package.])dnl
AC_DEFINE_UNQUOTED([PACKAGE_STRING], ["$PACKAGE_STRING"],
[Define to the full name and version of this package.])dnl
In file init.m4
belonging to automake:
AC_DEFUN([AM_INIT_AUTOMAKE],
...
AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
I'd like to undo the effects of all three.
Currently, my configure.ac
has these lines:
AC_INIT(pkgname, [1.2.3])
AC_CONFIG_HEADERS(config.h)
AM_INIT_AUTOMAKE([1.11 parallel-tests -Wno-portability tar-ustar])