Configure script

Last updated
Flow diagram including configure, autoconf and automake, three tools in the GNU Build System Autoconf-automake-process.svg
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 before compiling it from its source code.

Contents

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

Obtaining software directly from the source code is a common procedure on Unix computers, and generally involves the following three steps: configuring the makefile, compiling the code, and finally installing the executable to standard locations. 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 rather than simply configure to indicate to the shell that the script is in the current directory. This is because, as a security precaution, Unix configurations don't search the current directory for executables. So, to execute programs in that directory, one must explicitly specify their location. [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/user/local 

The first line includes the mpfr and gmp libraries. The second line tells make to install the final version in /home/user/local.

Often, a document with instructions is included. This can be helpful if configure fails. This file is commonly named INSTALL.

Generating configure

Software developers simplify the challenge of cross-platform software development by using GNU 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

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 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 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. [3]

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.

See also

Related Research Articles

Cygwin Unix subsystem for Windows machines

Cygwin is a POSIX-compatible programming and runtime environment that runs natively on Microsoft Windows. Under Cygwin, source code designed for Unix-like operating systems may be compiled with minimal modification and executed.

Package manager Software tools for handling software packages

A package manager or package-management system is a collection of software tools that automates the process of installing, upgrading, configuring, and removing computer programs for a computer in a consistent manner.

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 Autotools

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

GNU Libtool Software development tool

In computer programming, GNU Libtool is a software development tool, part of the GNU build system, consisting of a shell script created to address the software portability problem when compiling shared libraries from source code. It hides the differences between computing platforms for the commands which compile shared libraries. It provides a commandline interface that is identical across platforms and it executes the platform's native commands.

In software development, Make is a build automation tool that automatically builds executable programs and libraries from source code by reading files called Makefiles which specify how to derive the target program. Though integrated development environments and language-specific compiler features can also be used to manage a build process, Make remains widely used, especially in Unix and Unix-like operating systems.

Automake

In software development, GNU Automake is a programming tool to automate parts of the compilation process. It eases usual compilation problems. For example, it points to needed dependencies.

Portage (software) Gentoo package management system

Portage is a package management system originally created for and used by Gentoo Linux and also by Chrome OS, Calculate, Sabayon, and Funtoo Linux among others. Portage is based on the concept of ports collections. Gentoo is sometimes referred to as a meta-distribution due to the extreme flexibility of Portage, which makes it operating-system-independent. The Gentoo/Alt project is concerned with using Portage to manage other operating systems, such as BSDs, macOS and Solaris. The most notable of these implementations is the Gentoo/FreeBSD project.

MinGW, formerly mingw32, is a free and open source software development environment to create Microsoft Windows applications.

Apache Ant Java software tool

Apache Ant is a software tool for automating software build processes which originated from the Apache Tomcat project in early 2000 as a replacement for the Make build tool of Unix. It is similar to Make, but is implemented using the Java language and requires the Java platform. Unlike Make, which uses the Makefile format, Ant uses XML to describe the code build process and its dependencies.

SCons

SCons is a computer software build tool that automatically analyzes source code file dependencies and operating system adaptation requirements from a software project description and generates final binary executables for installation on the target operating system platform. Its function is analogous to the traditional GNU build system based on the make utility and the autoconf tools.

menuconfig

make menuconfig is one of five similar tools that can configure Linux source, a necessary early step needed to compile the source code. make menuconfig, with a menu-driven user interface, allows the user to choose the features of Linux that will be compiled. It is normally invoked using the command make menuconfig; menuconfig is a target in Linux Makefile.

pkg-config is a computer program that defines and supports a unified interface for querying installed libraries for the purpose of compiling software that depends on them. It allows programmers and installation scripts to work without explicit knowledge of detailed library path information. pkg-config was originally designed for Linux, but it is now also available for BSD, Microsoft Windows, macOS, and Solaris.

In computing, a shebang is the character sequence consisting of the characters number sign and exclamation mark at the beginning of a script. It is also called sharp-exclamation, sha-bang, hashbang, pound-bang, or hash-pling.

CMake Cross-platform, compiler-independent build system generator

In software development, CMake is cross-platform free and open-source software for build automation, testing, packaging and installation of software by using a compiler-independent method. CMake is not a build system but rather it generates another system's build files. It supports directory hierarchies and applications that depend on multiple libraries. It is used in conjunction with native build environments such as Make, Qt Creator, Ninja, Android Studio, Apple's Xcode, and Microsoft Visual Studio. It has minimal dependencies, requiring only a C++ compiler on its own build system.

The FreeBSD Ports collection is a package management system for the FreeBSD operating system, providing an easy and consistent way of installing software packages. As of February 2020, there are over 38,487 ports available in the collection. It has also been adopted by NetBSD as the basis of its pkgsrc system.

The following outline is provided as an overview of and topical guide to the Perl programming language:

Meson (software) Build automation system

Meson is a software tool for automating the building (compiling) of software. The overall goal for Meson is to promote programmer productivity. Meson is free and open-source software written in Python, under the Apache License 2.0.

References

  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. "Configure script of trn". GitHub. Retrieved 10 December 2020.