Chapter 22. Multi-Platform Configuration (Autoconf Functionality)

SCons has integrated support for multi-platform build configuration similar to that offered by GNU Autoconf, such as figuring out what libraries or header files are available on the local system. This section describes how to use this SCons feature.

Note

This chapter is still under development, so not everything is explained as well as it should be. See the SCons man page for additional information.

22.1. Configure Contexts

The basic framework for multi-platform build configuration in SCons is to attach a configure context to a construction environment by calling the Configure function, perform a number of checks for libraries, functions, header files, etc., and to then call the configure context's Finish method to finish off the configuration:


    env = Environment()
    conf = Configure(env)
    # Checks for libraries, header files, etc. go here!
    env = conf.Finish()
    

SCons provides a number of basic checks, as well as a mechanism for adding your own custom checks.

Note that SCons uses its own dependency mechanism to determine when a check needs to be run--that is, SCons does not run the checks every time it is invoked, but caches the values returned by previous checks and uses the cached values unless something has changed. This saves a tremendous amount of developer time while working on cross-platform build issues.

The next sections describe the basic checks that SCons supports, as well as how to add your own custom checks.