Previous: , Up: The GNU Build System   [Contents][Index]

5.4.4 Setting site defaults using CONFIG_SITE

Another way to pass options to configure is to use a site configuration file. This file will be “sourced” by configure to set some values and options, and will save you some bytes on your command line when you’ll invoke configure.

First, write a file:

# -*- shell-script -*-

echo "Loading for $PACKAGE_TARNAME"
echo "(srcdir: $srcdir)"


echo " $package"

# Configuration specific to EPITA KB machines (GNU/Linux on x86-64).
case $package in
    # Turn off optimization when building with debugging information
    # (the build dir must have ``debug'' in its name).
    case `pwd` in
      *debug*) :
        : ${CFLAGS="-ggdb -O0"}
        : ${CXXFLAGS="-ggdb -O0 -D_GLIBCXX_DEBUG"}
    # Help configure to find the Boost libraries on NetBSD.
    if test -f /usr/pkg/include/boost/config.hpp; then

    # Set CC, CXX, BISON, MONOBURG, and other programs as well.
    : ${CC=/u/prof/acu/pub/NetBSD/bin/gcc}
    : ${CXX=/u/prof/acu/pub/NetBSD/bin/g++}
    : ${BISON=/u/prof/yaka/bin/bison}
    : ${MONOBURG=/u/prof/yaka/bin/monoburg}
    # ...

set +vx

Then, set the environment variable CONFIG_SITE to the path to this file, and run configure:

$ export CONFIG_SITE="$HOME/src/"
$ ../configure

or if you use a C-shell:

$ setenv CONFIG_SITE "$HOME/src/"
$ ../configure

This is useful when invoking make distcheck: you don’t need to pollute your environment, nor use Automake’s DISTCHECK_CONFIGURE_FLAGS (see Making a Tarball).

Of course, you can have several files, one for each architecture you work on for example, and set the CONFIG_SITE variable according to the host/system.