Content deleted Content added
m →Usage |
Kuromedayo (talk | contribs) m delete unnecessary newline |
||
(46 intermediate revisions by 28 users not shown) | |||
Line 1:
{{Short description|Shell script for generating build configuration files on a Unix-like environment}}
{{Lowercase title}}
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.
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:
==Usage==▼
# Generate build configuration files
./configure▼
# Build the code
make▼
# Install the result to an accessible ___location
make install▼
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.
One must type <code>./configure</code> (''dot slash'' configure) rather than simply <code>configure</code> 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.<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 |accessdate=20 November 2010}}</ref>▼
▲
<syntaxhighlight lang="sh">
</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.
Software developers simplify the challenge of [[cross-platform]] software development by using GNU's [[Autotools]].<ref>{{cite web |url=http://www.gnu.org/software/autoconf/ |title=Autoconf - GNU Project - Free Software Foundation (FSF) |publisher=GNU Operating System |accessdate=20 November 2010}}</ref> 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 <code>configure.ac</code> or (the now deprecated) <code>configure.in</code> to be read by <code>configure</code> during the installation phase.▼
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.
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. 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.▼
==
▲
Since then, an ecosystem of programs has grown up to automate the creation of '''Configure script'''s as far as possible, of which the most common is the GNU Autoconf system described above.▼
▲In new development, library dependency checking
== See also ==▼
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
== References ==
|