This articleneeds additional citations forverification. Please helpimprove this article byadding citations to reliable sources. Unsourced material may be challenged and removed. Find sources: "GNU Autotools" – news ·newspapers ·books ·scholar ·JSTOR(September 2009) (Learn how and when to remove this message) |
| GNU Autotools | |
|---|---|
| Original author | Community |
| Developer | Free Software Foundation |
| Stable release | Multiple |
| Written in | M4 (computer language),C |
| Operating system | Cross-platform |
| Platform | GNU and others |
| Included with | GNU Operating System |
| Available in | English |
| License | GNU General Public License version 2 |
| Website | www |
TheGNU Autotools, also known as theGNU Build System, is a suite ofbuild automationtools designed to support buildingsource code andpackaging the resulting binaries. It supports building acodebase for multiple target systems without customizing or modifying thecode. It is available on manyLinux distributions andUnix-like environments.
Autotools is part of theGNU toolchain and is widely used in manyfree software andopen source packages. Its component tools arefree software, licensed under theGNU General Public License with special license exceptions[1][2] permitting its use withproprietary software.
It can be difficult to make a software program portable. Compilers differ from system to system. Certain library functions are missing on some systems. Compiler files (such as C headers) may have different names. Shared libraries may be compiled and installed in different ways. One way to handle platform differences is to write conditionally compiled code (i.e. via#ifdef), but because of the wide variety of build environments, this approach quickly becomes unmanageable. Autotools is designed to address this problem more manageably.
Autotools consists of theGNU utilitiesAutoconf,Automake, andLibtool.[3] Other related tools include GNUmake, GNUgettext,pkg-config, and theGNU Compiler Collection (GCC).

Autotools assists with sharingcross-platform software with a relatively broad user community. It facilitates sharing the source code by providing relatively robust cross-platform build support so that consumers can build the software themselves. Generally, the source code is distributed with ascript, namedconfigure, that has no dependencies other than aBourne-compatibleshell. Autotools need not be available. The consumer runsconfigure which generates various files including aMakefile which the consumer uses by runningmake.[4][5]
Autotools can be used both for building native programs on the build machine and also forcross-compiling to other architectures.[6]
Cross-compiling software to run on a Windows host from a Linux or other Unix-like build system is also possible, using MinGW, however native compilation is often desirable on operating systems (such as theMicrosoft Windows family of systems) that cannot run Bourne shell scripts on their own. This makes building such software on the Windows operating system a bit harder than on aUnix-like system which provides the Bourne shell as a standard component. One can install theCygwin orMSYS system on top of Windows to provide aUnix-likecompatibility layer, though, allowingconfigure scripts to run. Cygwin also provides theGNU Compiler Collection,GNU make, and other software that provides a nearly complete Unix-like system within Windows; MSYS also provides GNU make and other tools designed to work with theMinGW version of GCC.
A consumer can re-generate the configure script which might be necessary if they amend the source code. In this case, they need to have Autotools installed.
The autoconf-generated configure script can be slow because it executes programs such as a C compiler multiple times to test whether various libraries, header files, and language features are present. This particularly affectsCygwin, which, due to its lack of a nativefork system call, may execute configure scripts considerably slower than onLinux.[7]
In his column forACM Queue,FreeBSD developerPoul-Henning Kamp criticized the GNU Build System:[8]
The idea is that the configure script performs approximately 200 automated tests, so that the user is not burdened with configuring libtool manually. This is a horribly bad idea, already much criticized back in the 1980s when it appeared, as it allows source code to pretend to be portable behind the veneer of the configure script, rather than actually having the quality of portability to begin with. It is a travesty that the configure idea survived.
Kamp sketches the history of the build system in the portability problems inherent in themultitude of 1980s Unix variants, and bemoans the need for such build systems to exist:
the 31,085 lines of configure for libtool still check if<sys/stat.h> and<stdlib.h> exist, even though the Unixen, which lacked them, had neither sufficient memory to execute libtool nor disks big enough for its 16-MB source code.
Although critics of the Autotools frequently advocate for alternatives that provide greater simplicity to their users, some have argued that this is not necessarily a good thing. John Calcote, author[9] of theAutotools, 2nd Edition: A Practitioner's Guide to GNU Autoconf, Automake, and Libtool, opined:[10]
The Autotools are actually more transparent than any other build tools out there. All these other tools' (cmake, maven, etc) - that purport to be so much simpler because they insulate the user from the underlying details of the build process - these tool's primary failure is that this very insulation keeps users from being able to make the changes they need to accomplish their unique project-specific build goals.
Anyone who has nothing but good things to say about this aspect of cmake, maven, gradle, or whatever, has simply not worked on a project that requires them to move far enough away from the defaults. I've used them all and I've spent hours in frustration trying to determine how to work around the shortcomings of some "do-all" (except what I want) tool function. This is simply not an issue with the Autotools. As someone mentioned earlier in this thread, you can drop shell script into a configure.ac file, and make script into a Makefile.am file. That is the very definition of transparency. No other tool in existence allows this level of flexibility.