Configure script (computing)
Encyclopedia
Developing a program
Computer program
A computer program is a sequence of instructions written to perform a specified task with a computer. A computer requires programs to function, typically executing the program's instructions in a central processor. The program has an executable form that the computer can use directly to execute...

 to be run on a wide number of different computers is a complex task. A Configure script matches the libraries
Library (computer science)
In computer science, a library is a collection of resources used to develop software. These may include pre-written code and subroutines, classes, values or type specifications....

 on the user's computer, with those required by the program, just before compiling
Compiler
A compiler is a computer program that transforms source code written in a programming language into another computer language...

 it from its source code
Source code
In computer science, source code is text written using the format and syntax of the programming language that it is being written in. Such a language is specially designed to facilitate the work of computer programmers, who specify the actions to be performed by a computer mostly by writing source...

.

Obtaining software directly from the source code (a standard procedure on Unix
Unix
Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...

 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.

How to use them

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"

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

Software developers simplify the challenge of cross-platform
Cross-platform
In computing, cross-platform, or multi-platform, is an attribute conferred to computer software or computing methods and concepts that are implemented and inter-operate on multiple computer platforms...

 software development by using GNU's Autotools. 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.

Dependency checking

In new development, library dependency checking has been done in great part using pkg-config
Pkg-config
pkg-config is computer software that provides a unified interface for querying installed libraries for the purpose of compiling software from its source code. pkg-config was originally designed for Linux but is now also available for the various BSDs, Microsoft Windows, Mac OS X, and Solaris.It...

 via the m4
M4 (computer language)
m4 is a general purpose macro processor designed by Brian Kernighan and Dennis Ritchie. m4 is an extension of an earlier macro processor m3, written by Ritchie for the AP-3 minicomputer.-Use:...

 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.

See also

  • A succinct introduction
  • A verbose introduction
  • Autoconf
    Autoconf
    GNU Autoconf is a tool for producing configure scripts for building, installing and packaging software on computer systems where a Bourne shell is available....

  • GNU build system
    GNU build system
    The GNU build system, also known as the Autotools, is a suite of programming tools designed to assist in making source-code packages portable to many Unix-like systems....

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK