HOME

TheInfoList



OR:

GNU Autoconf is a tool for producing
configure script 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 ...
s for building, installing, and packaging software on computer systems where a
Bourne shell The Bourne shell (sh) is a shell command-line interpreter for computer operating systems. The Bourne shell was the default shell for Version 7 Unix. Unix-like systems continue to have /bin/sh—which will be the Bourne shell, or a symbolic link ...
is available. Autoconf is agnostic about the programming languages used, but it is often used for projects using C, C++, Fortran, Fortran 77, Erlang, or
Objective-C Objective-C is a general-purpose, object-oriented programming language that adds Smalltalk-style messaging to the C programming language. Originally developed by Brad Cox and Tom Love in the early 1980s, it was selected by NeXT for its N ...
. A configure script configures a software package for installation on a particular target system. After running a series of tests on the target system, the configure script generates
header files Many programming languages and other computer files have a directive, often called include (sometimes copy or import), that causes the contents of the specified file to be inserted into the original file. These included files are called copybooks ...
and a
makefile 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 deve ...
from templates, thus customizing the software package for the target system. Together with
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. It automatically generates one or more ''Makefile.in' ...
and
Libtool 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 ...
, Autoconf forms the
GNU Build System 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. It can be difficult to make a software program portable: the C compile ...
, which comprises several other tools, notably Autoheader.


Usage overview

The developer specifies the desired behaviour of the configure script by writing a list of instructions in the
GNU m4 m4 is a general-purpose macro processor included in most Unix-like operating systems, and is a component of the POSIX standard. The language was designed by Brian Kernighan and Dennis Ritchie for the original versions of UNIX. It is an extensio ...
language in a file called "configure.ac". A library of pre-defined m4 macros is available to describe common configure script instructions. Autoconf transforms the instructions in "configure.ac" into a portable configure script. The system that will be doing the building need not have autoconf installed: autoconf is needed only to build the configure script, that is usually shipped with the software.


History

Autoconf was begun in the summer of 1991 by David Mackenzie to support his work at the
Free Software Foundation The Free Software Foundation (FSF) is a 501(c)(3) non-profit organization founded by Richard Stallman on October 4, 1985, to support the free software movement, with the organization's preference for software being distributed under copyleft ("s ...
. In the subsequent years it grew to include enhancements from a variety of authors and became the most widely used build configuration system for writing portable free or
open-source software Open-source software (OSS) is computer software that is released under a license in which the copyright holder grants users the rights to use, study, change, and distribute the software and its source code to anyone and for any purpose. Ope ...
.


Approach

Autoconf is similar to the Metaconfig package used by
Perl Perl is a family of two High-level programming language, high-level, General-purpose programming language, general-purpose, Interpreter (computing), interpreted, dynamic programming languages. "Perl" refers to Perl 5, but from 2000 to 2019 it ...
. The imake system formerly used by the
X Window System The X Window System (X11, or simply X) is a windowing system for bitmap displays, common on Unix-like operating systems. X provides the basic framework for a GUI environment: drawing and moving windows on the display device and interacting ...
(up to X11R6.9) is closely related, but has a different philosophy. The Autoconf approach to
portability Portability may refer to: *Portability (social security), the portability of social security benefits * Porting, the ability of a computer program to be ported from one system to another in computer science ** Software portability, the portability ...
is to test for
feature Feature may refer to: Computing * Feature (CAD), could be a hole, pocket, or notch * Feature (computer vision), could be an edge, corner or blob * Feature (software design) is an intentional distinguishing characteristic of a software item ...
s, not for versions. For example, the native C compiler on SunOS 4 did not support ISO C. However, it is possible for the user or administrator to have installed an ISO C-compliant compiler. A pure version-based approach would not detect the presence of the ISO C compiler, but a feature-testing approach would be able to discover the ISO C compiler the user had installed. The rationale of this approach is to gain the following advantages: * the configure script can get reasonable results on newer or unknown systems * it allows administrators to customize their machines and have the configure script take advantage of the customizations * there is no need to keep track of minute details of versions, patch numbers, etc., to figure out whether a particular feature is supported or not Autoconf provides extensive documentation around the non-portability of many POSIX shell constructs to older shells and bugs therein. It also provides M4SH, a macro-based replacement for shell syntax.


Criticism

There is some criticism that states that Autoconf uses dated technologies, has a lot of legacy restrictions, and complicates simple scenarios unnecessarily for the author of ''configure.ac'' scripts. In particular, often cited weak points of Autoconf are: * General complexity of used architecture, most projects use multiple repetitions. * Generated 'configure' is written in
Bourne shell The Bourne shell (sh) is a shell command-line interpreter for computer operating systems. The Bourne shell was the default shell for Version 7 Unix. Unix-like systems continue to have /bin/sh—which will be the Bourne shell, or a symbolic link ...
and thus Makefile generation is slow. * Some people think that 'configure' scripts generated by autoconf provide only manual-driven command-line interface without any standardization. While it is true that some developers do not respect common conventions, such conventions do exist and are widely used. * M4 is unusual and unknown to many developers. Developers will need to learn it to extend autoconf with non-standard checks. * Weak backward and forward compatibility requires a wrapper script. * Autoconf-generated scripts are usually large and rather complex. Although they produce extensive logging, debugging them can still be difficult. Due to these limitations, several projects that used GNU Build System switched to different build systems, such as
CMake 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 itself; it generates ano ...
and
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 targe ...
.


See also

*
CMake 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 itself; it generates ano ...
– Alternative build system *
Meson In particle physics, a meson ( or ) is a type of hadronic subatomic particle composed of an equal number of quarks and antiquarks, usually one of each, bound together by the strong interaction. Because mesons are composed of quark subparticle ...
Another build system *
Configure script 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 ...
*
GNU build system 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. It can be difficult to make a software program portable: the C compile ...
*
pkg-config 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 kn ...
– Detecting package dependencies


References


External links

*
GNU Autoconf macro archive

''The Goat Book'' homepage (aka the Autobook)

Using Automake and Autoconf with C++

Using C/C++ libraries with Automake and Autoconf

Autotoolset home page

Autotools: A practitioner's guide to Autoconf, Automake and Libtool

Autotools Mythbuster
{{GNU Build automation Computer configuration Cross-platform free software Free computer libraries GNU Project software de:GNU Build System#GNU Autoconf