configure script

From Wikipedia, the free encyclopedia
Jump to: navigation, search
Flow diagram including configure, autoconf and automake, three tools in the GNU build system

A Configure script is an executable script designed to aid in developing a program to be run on a wide number of different computers. It matches the libraries on the user's computer, with those required by the program, just before compiling it from its source code.

As a common practice, all configure scripts are named "configure". Usually, configure scripts are written for the Bourne shell, but they may be written for execution in any desired shell.

Usage[edit]

Obtaining software directly from the source code (a standard procedure on Unix computers) generally involves the following three steps: configuring the makefile, compiling the code, and finally installing the executable in the appropriate places. A configure script accomplishes the first of these steps. Using configure scripts 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. The final executable software is most commonly obtained by executing the following commands in a shell that is currently pointing to the directory containing the source code:

./configure
make
make install

One must type ./configure (dot slash configure) rather than simply configure to indicate to the shell that the script is in ".", i.e. 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 an error.[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.

Generating configure[edit]

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.ac or (the now deprecated) configure.in to be read by configure during the installation phase.

Dependency checking[edit]

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.

History[edit]

The first program to come with a Configure script was rn by Larry Wall in 1984. Notable for its wry and jocular running commentary, that script was written entirely by hand and still survives as part of the build system of the trn program.

Since then, an ecosystem of programs has grown up to automate the creation of Configure scripts as far as possible, of which the most common is the GNU Autoconf system described above.

See also[edit]

References[edit]

  1. ^ "Compiling Linux Software from Source Code". Control-Escape's Linux Help Engine. Retrieved 20 November 2010. 
  2. ^ "Autoconf - GNU Project - Free Software Foundation (FSF)". GNU Operating System. Retrieved 20 November 2010. 
  3. ^ Neelakanth Nadgir (June 2001). "Introduction to GNU Build Tools". Retrieved 4 April 2013. 
  4. ^ Taylor, Ian Lance. "The GNU configure and build system". airs.com. Retrieved 20 November 2010.