Autoconf

Last updated
Original author(s) David Mackenzie
Developer(s) The GNU Project
Initial release1991
Stable release
2.72 / 22 December 2023;1 day ago (2023-12-22) [1]
Repository
Written in Perl
Operating system Cross-platform
Type Programming tool
License GNU GPL
Website www.gnu.org/software/autoconf/

GNU Autoconf is a tool for producing configure scripts for building, installing, and packaging software on computer systems where a Bourne shell is available.

Contents

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.

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 and a makefile from templates, thus customizing the software package for the target system. Together with Automake and Libtool, Autoconf forms the GNU Build System, which comprises several other tools, notably Autoheader.

Usage overview

Flow diagram of autoconf and automake. Note that "configure.ac" was named "configure.in" in early versions of autoconf. Autoconf-automake-process.svg
Flow diagram of autoconf and automake. Note that "configure.ac" was named "configure.in" in early versions of autoconf.

The developer specifies the desired behaviour of the configure script by writing a list of instructions in the GNU m4 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. 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.

Approach

Autoconf is similar to the Metaconfig package used by Perl. The imake system formerly used by the X Window System (up to X11R6.9) is closely related, but has a different philosophy.

The Autoconf approach to portability is to test for features, 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:

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

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:

Due to these limitations, several projects that used GNU Build System switched to different build systems, such as CMake and SCons. [3] [9]

See also

Related Research Articles

In computer science, a preprocessor is a program that processes its input data to produce output that is used as input in another program. The output is said to be a preprocessed form of the input data, which is often used by some subsequent programs like compilers. The amount and kind of processing done depends on the nature of the preprocessor; some preprocessors are only capable of performing relatively simple textual substitutions and macro expansions, while others have the power of full-fledged programming languages.

<span class="mw-page-title-main">GNU Autotools</span> Suite of programming tools

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.

<span class="mw-page-title-main">GNU Libtool</span> 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 command-line interface that is identical across platforms and it executes the platform's native commands.

In software development, Make is a build automation tool that 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.

<span class="mw-page-title-main">KDevelop</span> Integrated development environment

KDevelop is a free and open-source integrated development environment (IDE) for Unix-like computer operating systems and Windows. It provides editing, navigation and debugging features for several programming languages, and integration with build automation and version-control systems, using a plugin-based architecture.

<span class="mw-page-title-main">Automake</span> Programming tool to automate parts of the compilation process

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.

A cross compiler is a compiler capable of creating executable code for a platform other than the one on which the compiler is running. For example, a compiler that runs on a PC but generates code that runs on an Android smartphone is a cross compiler.

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

<span class="mw-page-title-main">MirOS BSD</span>

MirOS BSD is a free and open source operating system which started as a fork of OpenBSD 3.1 in August 2002. It was intended to maintain the security of OpenBSD with better support for European localisation. Since then it has also incorporated code from other free BSD descendants, including NetBSD, MicroBSD and FreeBSD. Code from MirOS BSD was also incorporated into ekkoBSD, and when ekkoBSD ceased to exist, artwork, code and developers ended up working on MirOS BSD for a while.

The GNU toolchain is a broad collection of programming tools produced by the GNU Project. These tools form a toolchain used for developing software applications and operating systems.

m4 is a general-purpose macro processor included in most Unix-like operating systems, and is a component of the POSIX standard.

<span class="mw-page-title-main">SCons</span>

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.

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.

<span class="mw-page-title-main">CMake</span> 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 itself; it generates another system's build files. It supports directory hierarchies and applications that depend on multiple libraries. It can invoke 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.

<span class="mw-page-title-main">Waf (build system)</span>

Waf is a build automation tool designed to assist in the automatic compilation and installation of computer software. It is written in Python and maintained by Thomas Nagy.

configure script Executable script used when building programs

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.

<span class="mw-page-title-main">Qt Creator</span> QT development environment

Qt Creator is a cross-platform C++, JavaScript, Python and QML integrated development environment (IDE) which simplifies GUI application development. It is part of the SDK for the Qt GUI application development framework and uses the Qt API, which encapsulates host OS GUI function calls. It includes a visual debugger and an integrated WYSIWYG GUI layout and forms designer. The editor has features such as syntax highlighting and autocompletion. Qt Creator uses the C++ compiler from the GNU Compiler Collection on Linux. On Windows it can use MinGW or MSVC with the default install and can also use Microsoft Console Debugger when compiled from source code. Clang is also supported.

<span class="mw-page-title-main">Meson (software)</span> 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. "autoconf-2.72 released [stable]". autoconf Archives. Retrieved 2023-12-23.
  2. "Portable Shell". Autoconf. Retrieved 20 January 2020.
  3. 1 2 Neundorf, Alexander (2006-06-21). "Why the KDE project switched to CMake -- and how".
  4. Kamp, Poul-Henning (2012-08-15). "A Generation Lost in the Bazaar". ACM Queue. 10 (8): 20–23. doi: 10.1145/2346916.2349257 . S2CID   11656592.
  5. 1 2 McCall, Andrew (2003-06-21). "Stop the autoconf insanity! Why we need a new build system".
  6. "GNU Coding Standards".
  7. Kamp, Poul-Henning (2010-04-20). "Did you call them autocrap tools?". Archived from the original on 2017-09-11. Retrieved 2017-08-16.
  8. Dickey, Thomas. "why i still use autoconf 2.13".
  9. "Blender.org - Build systems". Archived from the original on 2008-12-02. Retrieved 2009-06-10.