configure.pl

The script configure.pl is a Perl script written to act as part of a build wrapper around an arbitrary collection of software modules. The modules are linked through some sort of (conceptual) dependency graph, in this case specified by a simple configuration file (see the section called “Build Configuration File”). configure.pl reads the configuration file and proceeds to configure the individual modules in an order that satisfies the dependencies. Along the way, environment variables are set or extended so that each subsequent module is configured with the correct settings. The processes of managing the dependencies and performing the configuration are the topics of this section.

Build Configuration File

Before explaining how configure.pl manages its dependencies, it will be helpful to understand the role played by the configuration file from which the dependencies are read. In the VR Juggler build system, the file is called juggler.cfg, and it is located in the top-level source directory. At a very high level, the configuration file defines one or more modules that must be configured and compiled. The modules may be independent of each other, or they may form a dependency graph. In the latter case, one module states that it depends on one or more other modules. The following code block shows an example of this:

module VPR                                                 (1)
{
   external;                                               (2)
   modules/vapor;                                          (2)
}

module Tweek                                               (1)
{
   depend VPR;                                             (3)
   modules/tweek;                                          (2)
}
1

These lines declare two modules named “VPR” and “Tweek” respectively.

2

These lines list directories upon which the containing module depends. Each of these directories must contain a script called configure that can be executed. This method of listing dependencies requires explicit paths, and it helps greatly if those dependencies exist within the local source tree.

3

This line indicates that the Tweek module depends on the VPR module. Here, note that depend is a keyword with special significance. In effect, the VPR module is included inside the Tweek module definition so that it picks up all of VPR's dependencies.

Going deeper into the module definition, we find that environment variables can be set with each directory listing using a comma-separated list. These variables provide extra information about the configuration environment after the configure script has completed successfully. To illustrate this, we extend the above example as follows:

module VPR
{
   external;
   modules/vapor: VPR_CONFIG=vpr-config, VPR_BASE_DIR=instlinks;          (1)
}

module Tweek
{
   depend VPR;
   modules/tweek: TWEEK_CONFIG=tweek-config, TWEEK_BASE_DIR=instlinks;    (1)
}
1

As before, these lines list directories upon which the containing module depends. This time, we have added environment variable settings for the variables $VPR_CONFIG, $VPR_BASE_DIR, $TWEEK_CONFIG, and $TWEEK_BASE_DIR.

While any environment variable can be set in the configuration file, those shown above have special significance[3]. Those variables ending in _CONFIG set the corresponding environment variable to include the full path to the named file (despite the fact that the full path is not given in the assignment). The path is constructed using the associated directory dependency. This directory is also added to the script's execution path. This extra little bit is needed so that a given -config script can be executed by another -config script if necessary. (The details about why all of this is necessary are discussed in the section called “The *-config Scripts and the *.m4 Macro Files”.)

Those variables ending in _BASE_DIR define the installation directory for the given module. In the VR Juggler build system, this is necessary for dependent modules to find the headers and libraries they need to compile. (Again, more information about this is given in the section called “The *-config Scripts and the *.m4 Macro Files”.) Once again, the value being assigned has special significance. If the value is the token instlinks, it is taken to mean that the full path to the installed module is in a directory relative to the current directory called instlinks. Any other value is used verbatim as the value of the environment variable.

Dependency Management

Dependencies within modules are maintained using a simple Perl data structure in the JugglerModule class. Parsing the configuration file results in instantiation of this data structure. There is one such instance for each module defined. Each instance contains an array of ModuleDependecy objects. Steps are taken to ensure that there is no duplication of dependencies within a single JugglerModule instance.



[3] The fact that any variable can be set but that some are treated as special cases is a deficiency in the design of configure.pl. The current use was put together out of necessity to provide the script with extra information needed for proper execution of each module's Autoconf-generated configure script.