GNU build system

GNU build system
GNU logo

The GNU build system, also known as the Autotools, 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 compiler differs from system to system; certain library functions are missing on some systems; header files may have different names. One way to handle this is write conditional code, with code blocks selected by means of preprocessor directives (#ifdef); but because of the wide variety of build environments this approach quickly becomes unmanageable. The GNU build system is designed to address this problem more manageably.

The GNU build system is part of the GNU toolchain and is widely used in many free-software and open-source packages. The tools comprising the GNU build system are free-software-licensed under the GNU General Public License with special license exceptions[1][2] permitting use of the GNU build system with proprietary software.

Contents

Tools included in the GNU build system

Flow diagram of autoconf and automake

The GNU build system comprises the GNU utility programs Autoconf, Automake, and Libtool.[3] Other related tools frequently used with the GNU build system are GNU’s make program, GNU gettext, pkg-config, and the GNU Compiler Collection, also called GCC.

GNU Autoconf

Autoconf generates a configure script based on the contents of a configure.ac file which characterizes a particular body of source code. The configure script, when run, scans the build environment and generates a subordinate config.status script which, in turn, converts other input files and most commonly Makefile.in into output files (Makefile) which are appropriate for that build environment. Finally the make program uses Makefile to generate executable programs from source code.

The complexity of the GNU build system reflects the variety of circumstances under which a body of source code may be built.

  • If a source code file is changed then it suffices to re-run make which only re-compiles that part of the body of the source code affected by the change.
  • If a .in file has changed then it suffices to re-run config.status and make.
  • If the body of source code is copied to another computer then it is suffices to re-run configure (which runs config.status) and make. (For this reason source code using the GNU build system is normally distributed without the files that configure generates.)
  • If the body of source code is changed more fundamentally then configure.ac and the .in files need to be changed and all subsequent steps also followed.

To process files, autoconf uses the GNU implementation of the m4 macro system.

Autoconf comes with several auxiliary programs such as Autoheader, which is used to help manage C header files; Autoscan, which can create an initial input file for Autoconf; and ifnames, which can list C pre-processor identifiers used in the program.

GNU Automake

Automake helps to create portable Makefiles, which are in turn processed with the make utility. It takes its input as Makefile.am, and turns it into Makefile.in, which is used by the configure script to generate the file Makefile output.

GNU Libtool

Libtool helps manage the creation of static and dynamic libraries on various Unix-like operating systems. Libtool accomplishes this by abstracting the library-creation process, hiding differences between various systems (e.g. GNU/Linux systems vs. Solaris).

Gnulib

Gnulib simplifies the process of making software that uses Autoconf and Automake portable to a wide range of systems.

Advantages of the GNU build system

The GNU build system allows a programmer to write cross-platform software. It also makes the build process easier on a user who wants to compile the program on his or her own computer. The user does not need to have GNU build system components installed on the computer but only needs to run the supplied configure script which has no dependencies other than the presence of a Bourne-compatible shell.

Limitations of the GNU build system

The GNU build system uses Bourne-compatible shell scripts to assist the user in the configuration and build process. The GNU build system can be used both for building native programs on the build machine and also for cross-compiling to other architectures.[4]

Cross-compiling software to run on a Windows host from a GNU/Linux or other Unix-like build system is also possible, using MinGW, however native compilation is often desirable on operating systems (such as the Microsoft 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 a Unix-like system which provides the Bourne shell as a standard component. One can install the Cygwin or MSYS system on top of Windows to provide a Unix-like compatibility layer, though, allowing configure scripts to run. Cygwin also provides the GNU 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 the MinGW version of GCC.

Projects which use the GNU build system may or may not provide a configure script within their Version control systems (such as CVS or Subversion). If a project that uses the GNU build system does not have a generated ./configure file available for the user, the user must generate it. One possible way this can be done is to execute the autoreconf tool at a shell prompt:

$ autoreconf

This will invoke aclocal, autoconf, autoheader and automake as needed. In some cases, more commands may be necessary. Another common convention is then to provide a script, often named autogen.sh or bootstrap, that runs all the needed pre-build tools.

One limitation has been that the autoconf-generated configure can be slow because it executes programs like the C compiler many times in order to test whether various libraries, header files, and language features are present.

See also

References

External links


Wikimedia Foundation. 2010.

Игры ⚽ Нужна курсовая?

Look at other dictionaries:

  • GNU Build System — Programmablaufplan von autoconf und automake, zwei Tools im GNU Build System Das GNU Build System, auch bekannt als Autotools, ist eine Sammlung von Tools für die Computerprogrammierung, die vom GNU Projekt entwickelt wurden. Diese Tools sind für …   Deutsch Wikipedia

  • GNU build system — Se ha sugerido que este artículo o sección sea fusionado con Sistema de construcción para GNU (discusión). Una vez que hayas realizado la fusión de artículos, pide la fusión de historiales aquí. El GNU build system conocido también como Autotools …   Wikipedia Español

  • GNU build system — …   Википедия

  • GNU toolchain — est un terme général utilisé par la communauté anglosaxonne pour désigner certains outils de développement (en) du projet GNU. Ces outils forment une suite d outils de développement utilisés en série, souvent appelée « toolchain »… …   Wikipédia en Français

  • GNU Pascal — (GPC) is a Pascal compiler comprised of a frontend to GCC, similar to the way Fortran and other languages were added to GCC. GNU Pascal is ISO 7185 compatible, and it implements most of the ISO 10206 Extended Pascal standard (according to the… …   Wikipedia

  • GNU Autotools — Programmablaufplan von autoconf und automake, zwei Tools im GNU Build System Das GNU Build System, auch bekannt als Autotools, ist eine Sammlung von Tools für die Computerprogrammierung, die vom GNU Projekt entwickelt wurden. Diese Tools sind für …   Deutsch Wikipedia

  • GNU autotools — Programmablaufplan von autoconf und automake, zwei Tools im GNU Build System Das GNU Build System, auch bekannt als Autotools, ist eine Sammlung von Tools für die Computerprogrammierung, die vom GNU Projekt entwickelt wurden. Diese Tools sind für …   Deutsch Wikipedia

  • GNU Libtool — Infobox Software name = GNU Libtool developer = The GNU Project latest release version = 2.2 latest release date = March 01, 2008 operating system = Cross platform genre = Library license = GPL website = http://www.gnu.org/software/libtool/ GNU… …   Wikipedia

  • GNU toolchain — The GNU toolchain is a blanket term for a collection of programming tools produced by the GNU Project. These tools form a toolchain (suite of tools used in a serial manner) used for developing applications and operating systems.The GNU toolchain… …   Wikipedia

  • GNU Toolchain — Die GNU Toolchain (deutsch: GNU Werkzeugkette) ist ein Gesamtbegriff für die Programmierwerkzeuge, die vom GNU Projekt produziert wurden. Diese Projekte bilden ein Gesamtsystem oder eine Werkzeugkette, die für die Programmierung von sowohl… …   Deutsch Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”