14.4.1 DISTCHECK_CONFIGURE_FLAGS

Building the package involves running ‘./configure’. If you need to supply additional flags to configure, define them in the AM_DISTCHECK_CONFIGURE_FLAGS variable in your top-level Makefile.am. The user can still extend or override the flags provided there by defining the DISTCHECK_CONFIGURE_FLAGS variable, on the command line when invoking make. It’s worth noting that make distcheck needs complete control over the configure options --srcdir and --prefix, so those options cannot be overridden by AM_DISTCHECK_CONFIGURE_FLAGS nor by DISTCHECK_CONFIGURE_FLAGS.

Developers are encouraged to strive to make their code buildable without requiring any special configure option; thus, in general, you shouldn’t define AM_DISTCHECK_CONFIGURE_FLAGS. GNU m4 offers an example of when its use is justified, however. GNU m4 configures by default with its experimental and seldom used ‘changeword’ feature disabled; so in this case it is useful to have make distcheck run configure with the --with-changeword option, to ensure that the code for changeword support still compiles correctly. GNU m4 also employs the AM_DISTCHECK_CONFIGURE_FLAGS variable to stress-test the use of --program-prefix=g, since at one point the m4 build system had a bug where make installcheck was wrongly assuming it could blindly test ‘m4’, rather than the just-installed ‘gm4’.