Automake and Libtool have revolutionized the free software world. .. Chapter 1: A brief introduction to the GNU Autotools. Chapter 2. This manual (26 July ) is for GNU Autoconf (version ), a package for creating scripts to .. Practical Advice for Signed Overflow Issues. This manual (24 April ) is for GNU Autoconf (version ), a package for for a to avoid unnecessary quotes, it is bad practice for Autoconf.

Author: Arasho Vogul
Country: Argentina
Language: English (Spanish)
Genre: Finance
Published (Last): 28 October 2013
Pages: 260
PDF File Size: 15.57 Mb
ePub File Size: 13.61 Mb
ISBN: 522-1-85498-276-6
Downloads: 13102
Price: Free* [*Free Regsitration Required]
Uploader: Dishura

A set of tools for portable software packages Making configure Scripts: How to organize and produce Autoconf scripts Setup: Initialization and output Existing Tests: Macros that check for particular features Writing Tests: How to write new feature checks Results: What to do with results from feature checks Programming in M4: Layers on top of which Autoconf is written Programming in M4sh: Shell portability layer Writing Autoconf Macros: Adding new macros to Autoconf Portable Shell: Shell script portability pitfalls Portable Make: Selecting features that can’t be guessed Site Configuration: Local defaults for configure Running configure Scripts: How to use the Autoconf output config.

Recreating a configuration Obsolete Constructs: Kept for backward compatibility Using Autotest: Creating portable test suites FAQ: Frequent Autoconf Questions, with answers History: License for copying this manual Indices: Indices of symbols, concepts, etc. Top 1 Introduction A physicist, an engineer, and a computer scientist were discussing the nature of God. The configuration scripts produced by Autoconf are independent of Autoconf when they are run, so their users do not need to have Autoconf.

The configuration scripts produced by Autoconf require no manual user intervention when run; they do not normally even need an argument specifying the system type.

Instead, they individually test for the presence of each feature that the software package they are for might need. Before each check, they print a one-line message stating what they are checking for, so the user doesn’t get too bored while waiting for the script to finish. As a result, they deal well with systems that are hybrids or customized from the more common Posix variants. There is no need to maintain files that list the features supported by each release of each variant of Posix. For each software package that Autoconf is used with, it creates a configuration script from a template file that lists the system features that the package needs or can use.

After the shell code to recognize and respond to a system feature has been written, Autoconf allows it to be shared by many software packages that can use or need that feature. If it later turns out that the shell code needs adjustment for some reason, it needs to be changed in only one place; all of the configuration scripts can be regenerated automatically to take advantage of the updated code.

Those who do not understand Autoconf are condemned to reinvent it, poorly. The primary goal of Autoconf is making the user’s life easier; making the maintainer’s life easier is only a secondary goal. Put another way, the primary goal is not to make the generation of configure automatic for package maintainers although patches along that front are welcome, since package maintainers form the user base of Autoconf ; rather, the goal is to make configure painless, portable, and predictable for the end user of each autoconfiscated package.

And to this degree, Autoconf is highly successful at its goal — most complaints to the Autoconf list are about difficulties in writing Autoconf input, and not in the behavior of the resulting configure.


Even packages that don’t use Autoconf will generally provide a configure script, and the most common complaint about these alternative home-grown scripts is that they fail to meet one or more of the GNU Coding Standards see Configuration that users have come to expect from Autoconf-generated configure scripts. The Metaconfig autpconf is similar in purpose to Autoconf, but the scripts it produces require manual user intervention, which is quite inconvenient when configuring xutoconf source trees.

Unlike Metaconfig scripts, Autoconf scripts can support cross-compiling, if some care is taken in writing them. Autoconf does not solve all problems related to making portable software packages—for a more complete solution, it should be used in concert with other GNU build tools like Automake and Libtool.

These other tools take on jobs like the creation of a portable, recursive makefile with all of the standard targets, linking of shared autocof, and so on.

Book Review: Autotools by John Calcote – Flameeyes’s Weblog

Autoconf imposes some restrictions on the names of macros used with if in C programs see Preprocessor Symbol Index. Autoconf requires GNU M4 version 1. Autoconf works better with GNU M4 version 1. See Autoconf 1for information about upgrading from version 1. See Historyfor the story of Autoconf’s development. See FAQfor answers to some common questions about Autoconf. See the Autoconf web page for up-to-date information, details on the mailing lists, pointers to a list of known bugs, etc.

Mail suggestions to the Autoconf mailing list. Past suggestions are archived. Mail bug reports to the Autoconf Bugs mailing list. Past bug reports are archived. If possible, first check that your bug is not already solved in current development versions, and that it has not been reported yet.

Be sure to include all the needed information and a short configure. Autoconf’s development tree is accessible via git ; see the Autoconf Summary for details, or view the actual repository. Patches relative to the current git version can be sent for review to the Autoconf Patches mailing listwith discussion on prior patches archived ; and all commits are posted in the read-only Autoconf Commit mailing listwhich is also archived. Because of its mission, the Autoconf package itself includes only a set of often-used macros that have already demonstrated their usefulness.

Nevertheless, if you wish to share your macros, or find existing ones, see the Autoconf Macro Archivewhich is kindly run by Peter Simons. Making configure ScriptsPrevious: Top 2 The GNU Build System Autoconf solves an important problem—reliable discovery of system-specific build and runtime information—but this is only one piece of the puzzle for the development of portable software.

To this end, the GNU project has developed a suite of integrated utilities to finish the job Autoconf started: In this chapter, we introduce you to those tools, point you to sources of more information, and try to convince you to use the entire GNU build system for your software.

Escaping makefile hell Gnulib: The GNU portability library Libtool: Building libraries portably Pointers: More info on the GNU build system Next: Its lack of support for automatic dependency tracking, recursive builds in subdirectories, reliable timestamps e. Portability is non-trivial, thanks to the quirks of make on many systems.

On top of all this is the manual labor required to implement the many standard targets that users have come to expect make installmake distcleanmake uninstalletc. Since you are, of course, using Autoconf, you also have to insert repetitive code in your Makefile. Into this mess steps Automake. Automake allows you to specify your build needs in a Makefile. For example, the Makefile.


Find the best price for books and DVDs

The benefits of Automake increase for larger packages especially ones with subdirectoriesbut even for small programs the added convenience and portability can be substantial.

And that’s not all While our primary goal is to write software for the GNU system, many users and developers have been introduced to us through the systems that they were already using. Gnulib is a central location for common GNU code, intended to be shared among free software packages.

Its components are typically shared at the source level, rather than being a library that gets built, installed, and linked against. The idea is to copy files from Gnulib into your own source tree. There is no distribution tarball; developers should just grab source modules from the repository. Gnulib modules typically contain C source code along with Autoconf macros used to configure the source code.

For example, the Gnulib stdbool module implements a stdbool. This module contains a source file for the replacement header, along with an Autoconf macro that arranges to use the replacement header on old-fashioned systems. Ideally, one would z to produce shared dynamically linked libraries, which can be used by multiple programs without duplication on disk or in memory and can be updated independently of the linked programs.

Producing shared libraries portably, however, is the stuff of nightmares—each system has its own incompatible tools, compiler flags, and magic incantations. Fortunately, GNU provides a solution: Libtool handles all the requirements zutotools building shared libraries for you, and at this time seems to be the only way to do so with any portability. It also handles autocoonf other headaches, such as: Although Libtool, like Autoconf, can be used without Automake, it is most simply utilized in conjunction with Automake—there, Libtool is used automatically whenever shared libraries are needed, and you need not know its syntax.

As your software is distributed to more and more users, however, you otherwise quickly find yourself putting lots of effort into reinventing the services that the GNU build tools provide, and making the same mistakes that they once made and overcame. Besides, since you’re already learning Autoconf, Automake is a piece of cake.

There are a number of places that you can go to for more ajtoconf on the GNU build tools.

Automake Manual See Automakefor more information on Automake. You can also find the entire book on-line.

Top 3 Making configure Scripts The configuration scripts that Autoconf produces are by convention called configure. When run, configure creates several files, replacing configuration parameters in them with appropriate values. The files that configure creates are: To create a configure script with Autoconf, you need to write an Autoconf input file configure. If you write your own feature tests to supplement those that come with Autoconf, you might also write files called aclocal.

If you use a C header file to contain define directives, you might also run autoheaderand you can distribute the generated file config. Here is a diagram showing how the files that can be used in configuration are produced.

Files used in preparing a software package for distribution, when using just Autoconf:

Author: admin