Developing a program to be run on a wide number of different computers is a complex task. A Configure script matches the libraries on the user's computer, with those required by the program, just before compiling it from its source code.
Obtaining software directly from the source code (a standard procedure on Unix computers) involves the following steps: configuring the makefile, compiling the code, and finally installing the executable in the appropriate place. A configure script accomplishes the first of these steps.
Contents |
Using configure scripts (hereafter configure
) is an automated method of generating makefiles before compilation to tailor the software to the system on which the executable is to be compiled and run. Using configure
is the first of three straightforward steps in creating an executable from its source code.
./configure
make
make install
One must type ./configure
(dot slash configure) rather than configure
for the "dot slash" indicates the script is in the current directory ".". By default, for security reasons, unix operating systems do not search the current directory for executables so one must give the full path explicitly to avoid the following error:
"bash: configure: command not found"[1]
Upon its completion, configure
prints a report to config.log
. Running ./configure --help
gives a list of command line arguments, for enabling or disabling additional features such as:
./configure --libs="-lmpfr -lgmp"
./configure --prefix=/home/myname/apps
The first line includes the mpfr
and gmp
libraries. The second line tells make to install the final version in /home/myname/apps
. Note that if you have a space character in your argument, you will need to enclose the text in quotation marks as shown on the first line. The INSTALL
file contains instructions should the prescribed steps fail.
configure
Software developers simplify the challenge of cross-platform software development by using GNU's Autotools.[2] These scripts query the system on which they run for: environment settings, platform architecture, and the existence and location of required build and runtime dependencies. They store the gathered information in configure.in
or configure.ac
to be read by configure
during the installation phase.
In new development, library dependency checking has been done in great part using pkg-config via the m4 macro, PKG_CHECK_MODULES. Before pkg-config's gained popularity, separate m4 macros were created to locate files known to be included in the distribution of libraries depended upon.