configure script
   HOME

TheInfoList



OR:

When installing a package on a
Unix Unix (, ; trademarked as UNIX) is a family of multitasking, multi-user computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, a ...
or
Unix-like A Unix-like (sometimes referred to as UN*X, *nix or *NIX) operating system is one that behaves in a manner similar to a Unix system, although not necessarily conforming to or being certified to any version of the Single UNIX Specification. A Uni ...
environment, a configure script is a
shell script A shell script is a computer program designed to be run by a Unix shell, a command-line interpreter. The various dialects of shell scripts are considered to be command languages. Typical operations performed by shell scripts include file manipu ...
that generates build configuration files for a
codebase In software development, a codebase (or code base) is a collection of source code used to build a particular software system, application, or software component. Typically, a codebase includes only human-written source code system files; thu ...
to facilitate cross-platform support. It generates files tailoring for the host system the environment on which the codebase is built and run. Even though there are no standards for such a script, the pattern is so ubiquitous that many developers are familiar with and even expect a script named ''configure'' that has this functionality. The script can be and originally was hand-coded. Today, multiple tools are available for generating a configure script based on special configuration files. One commonly used tool is
Autotools The GNU Autotools, also known as the GNU Build System, is a suite of build automation tools designed to support building source code and packaging the resulting binaries. It supports building a codebase for multiple target systems without custom ...
which generates a Bash script. Obtaining a software package as
source code In computing, source code, or simply code or source, is a plain text computer program written in a programming language. A programmer writes the human readable source code to control the behavior of a computer. Since a computer, at base, only ...
and
compiling In computing, a compiler is a computer program that translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primarily used for programs tha ...
it locally is a common scenario on
Unix Unix (, ; trademarked as UNIX) is a family of multitasking, multi-user computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, a ...
and
Unix-like A Unix-like (sometimes referred to as UN*X, *nix or *NIX) operating system is one that behaves in a manner similar to a Unix system, although not necessarily conforming to or being certified to any version of the Single UNIX Specification. A Uni ...
environments. Typically, this process involves the following steps: # Generate build configuration files # Build the code # Install the result to an accessible location A configure script accomplishes the first step by generating a
makefile In software development, Make is a command-line interface software tool that performs actions ordered by configured Dependence analysis, dependencies as defined in a configuration file called a ''makefile''. It is commonly used for build automati ...
that is configured for the host system. This includes using the
libraries A library is a collection of Book, books, and possibly other Document, materials and Media (communication), media, that is accessible for use by its members and members of allied institutions. Libraries provide physical (hard copies) or electron ...
of the host as required by the codebase.


Use

After navigating a command-line
shell Shell may refer to: Architecture and design * Shell (structure), a thin structure ** Concrete shell, a thin shell of concrete, usually with no interior columns or exterior buttresses Science Biology * Seashell, a hard outer layer of a marine ani ...
to the directory that contains the source code, the following commands are typically executed: ./configure make make install For the Autotools, the configure script logs status and errors to file ''config.log'', and the command ./configure --help outputs command line help information. Often, a document with instructions is included with the codebase; often in a file named INSTALL. It can be helpful if the configure script fails.


Generating

Autotools simplifies some of the challenges of
cross-platform software Within computing, cross-platform software (also called multi-platform software, platform-agnostic software, or platform-independent software) is computer software that is designed to work in several computing platforms. Some cross-platform soft ...
development. These tools query the host system for environment settings, platform architecture, and the existence and location of required build and runtime dependencies. They store the gathered information in configure.ac to be read by configure during the installation phase. In new development, library dependency checking can be accomplished via
pkg-config pkg-config is a software development tool that queries information about libraries from a local, file-based database for the purpose of building a codebase that depends on them. It allows for sharing a codebase in a cross-platform way by using ...
via the m4 macro, PKG_CHECK_MODULES. Before pkg-config gained popularity, separate m4 macros were created to locate files known to be included in the distribution of libraries depended upon.


History

The first program to come with a configure script was rn by
Larry Wall Larry Arnold Wall (born September 27, 1954) is an American computer programmer, linguist, and author known for creating the Perl programming language and the patch tool. Early life and education Wall grew up in Los Angeles and Bremerton, Wash ...
in 1984. The script was written by hand and produced a jocular running commentary when executed. It still survives as part of the build system of the trn program. Since then, an ecosystem of tools have been developed to automate the creation of configure scripts, of which the most common is Autoconf.


References

{{Reflist Compiling tools Linux configuration utilities Unix programming tools configure