Using config.site to set default options

Date: September 21st, 2009 by Author: Daniel Elstner

Just a quick note about a little-used feature of GNU Autoconf: site defaults.

Until recently, I used to have a long list of assignments to module_autogenargs['...'] in my ~/.jhbuildrc file to set up default configure options for various modules. This became unwieldy and there was always one module I forgot.

Autoconf comes to the rescue with its support for site defaults. For illustration, here is my ${prefix}/etc/config.site file:

# Autoconf site defaults
test -n "$enable_silent_rules" || enable_silent_rules=yes
test -n "$enable_static" || enable_static=no
test -n "$enable_warnings" || enable_warnings=fatal

The effect is as if I had passed --enable-silent-rules --disable-static --enable-warnings=fatal to every module’s ./autogen.sh, except that I don’t get any annoying warnings if a module doesn’t actually support a particular option. The test conditionals ensure that command-line arguments have precedence over the default values in the config.site file.

Read the manual for the gory details, if you want to. Otherwise, enjoy!