Configure script: Difference between revisions

Content deleted Content added
Kuromedayo (talk | contribs)
m delete unnecessary newline
 
(112 intermediate revisions by 69 users not shown)
Line 1:
{{Short description|Shell script for generating build configuration files on a Unix-like environment}}
{{context}} {{Unreferenced|date=March 2007}}
{{Lowercase title}}
[[Image:Autoconf.svg|thumb|300px|Flow diagram including configure, [[autoconf]] and [[automake]], three tools in the GNU build system]]
When installing a package on a [[Unix]] or [[Unix-like]] environment, a '''configure script''' is a [[shell script]] that generates [[software build|build]] configuration files for a [[codebase]] to facilitate cross-platform support. It generates files tailoring for the host system {{endash}} 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]] which generates a [[Bash (Unix shell)|Bash]] script.
'''Configure scripts''' are an automated method of modifying [[source code]] before compilation in order to produce code tailored to the system on which a binary [[executable]] is to be compiled and run. Configure scripts are typically run immediately before compilation on the machine on which the software is to be used.
 
Obtaining a software package as [[source code]] and [[compiler|compiling]] it locally is a common scenario on [[Unix]] and [[Unix-like]] environments. Typically, this process involves the following steps:
Configure scripts are generated by the [[Autotools]] suite of build management tools. 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 then use the gathered [[Intelligence (information gathering)|information]] to process and fill out templates, customarily ending in <code>.in</code>. After successful completion, it is common for configure scripts to print a report to the developer invoking them.
 
# Generate build configuration files
Because of the platform independence and broad developer experience with the configure script interface, many popular pieces of [[free software]] and [[proprietary software]] use this system during their system detection and [[makefile]] generation phase. After configure scripts have been created, building software that makes use of them is as simple as
# Build the code
# Install the result to an accessible ___location
 
A configure script accomplishes the first step by generating a [[makefile]] that is configured for the host system. This includes using the [[Library (computer science)|libraries]] of the host as required by the codebase.
<code>./configure && make && make install </code>
 
== Use ==
=== Free software that uses configure ===
 
After navigating a command-line [[Shell (computing)|shell]] to the directory that contains the source code, the following commands are typically executed:<ref>{{cite web |url=http://www.control-escape.com/linux/lx-swinstall-tar.html |title=Compiling Linux Software from Source Code |publisher=Control-Escape's Linux Help Engine |access-date=20 November 2010}}</ref>
* [[Apache HTTP Server]]
* [[MySQL]]
* [[PHP]]
* [[GNU Compiler Collection|GCC]]
* [[Mono (software)|Mono]]
* [[X.Org Server]]
* [[GNOME]] and [[GTK+]]
* [[NcFTP]]
* [[OpenTTD]]
 
<syntaxhighlight lang="sh">
And many more.
./configure
for all you dumbos out there- configure means to '''load.'''
make
make install
</syntaxhighlight>
 
For the Autotools, the configure script logs status and errors to file ''config.log'', and the command <code>./configure --help</code> outputs command line help information.
=== Proprietary software that uses configure ===
 
Often, a document with instructions is included with the codebase; often in a file named <code>INSTALL</code>. It can be helpful if the configure script fails.
(These are difficult to cite due to the nature of [[proprietary software]].)
 
== Generating ==
* [[NcFTPd]] {{Fact|date=March 2007}}
 
Autotools simplifies some of the challenges of [[cross-platform software]] development.<ref>{{cite web |url=https://www.gnu.org/software/autoconf/ |title=Autoconf - GNU Project - Free Software Foundation (FSF) |publisher=GNU Operating System |access-date=20 November 2010}}</ref> 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 <code>configure.ac</code> to be read by <code>configure</code> during the installation phase.
=== Dependency checking ===
In new development, library dependency checking has been done in great part using [[pkg-config]] via the [[M4_(computer_language)|m4]] macro, PKG_CHECK_MODULES. Prior to pkg-config's popularity, separate m4 macros were created to locate files known to be included in the distribution of libraries depended upon.
 
In new development, library dependency checking hascan beenbe doneaccomplished in great part usingvia [[pkg-config]] via the [[M4_M4 (computer_languagecomputer language)|m4]] macro, PKG_CHECK_MODULES. Prior toBefore pkg-config's gained popularity, separate m4 macros were created to locate files known to be included in the distribution of libraries depended upon.
{{compu-prog-stub}}
 
== History ==
The first program to come with a configure script was [[rn (newsreader)|rn]] by [[Larry Wall]] 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.<ref>{{cite web |url=https://github.com/acli/trn/blob/613a7e97aca06dd807fb225990fa804e8c744574/Configure|title= Configure script of trn |publisher=GitHub |access-date=10 December 2020}}</ref>
 
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}}
 
[[Category:Compiling tools]]
[[Category:UnixLinux softwareconfiguration utilities]]
[[Category:Unix programming tools]]
[[Category:Build automation|configure]]
 
[[pl:Configure]]
[[pt:Configure]]
[[tr:Configure]]