templates and an M4 macro package.
Copyright @copyright{} 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000,
-2001, 2002, 2003 Free Software Foundation, Inc.
+2001, 2002, 2003, 2004 Free Software Foundation, Inc.
@quotation
Permission is granted to copy, distribute and/or modify this document
@node Introduction
@chapter Introduction
+@cindex Introduction
@flushright
A physicist, an engineer, and a computer scientist were discussing the
@node The GNU Build System
@chapter The @acronym{GNU} Build System
+@cindex GNU build system
Autoconf solves an important problem---reliable discovery of
system-specific build and run-time information---but this is only one
@node Notices
@section Notices in @command{configure}
+@cindex Notices in @command{configure}
The following macros manage version numbers for @command{configure}
scripts. Using them is optional.
@node Output
@section Outputting Files
+@cindex Outputting files
Every Autoconf script, e.g., @file{configure.ac}, should finish by
calling @code{AC_OUTPUT}. That is the macro that generates and runs
@node Configuration Actions
@section Performing Configuration Actions
+@cindex Configuration actions
@file{configure} is designed so that it appears to do everything itself,
but there is actually a hidden slave: @file{config.status}.
@node Configuration Files
@section Creating Configuration Files
+@cindex Creating configuration files
+@cindex Configuration file creation
Be sure to read the previous section, @ref{Configuration Actions}.
@node Makefile Substitutions
@section Substitutions in Makefiles
+@cindex Substitutions in makefiles
+@cindex Makefile substitutions
Each subdirectory in a distribution that contains something to be
compiled or installed should come with a file @file{Makefile.in}, from
@node Preset Output Variables
@subsection Preset Output Variables
+@cindex Output variables
Some output variables are preset by the Autoconf macros. Some of the
Autoconf macros set additional output variables, which are mentioned in
@node Installation Directory Variables
@subsection Installation Directory Variables
+@cindex Installation directories
+@cindex Directories, installation
The following variables specify the directories where the package will
be installed, see @ref{Directory Variables,, Variables for
@node Build Directories
@subsection Build Directories
+@cindex Build directories
+@cindex Directories, build
You can support compiling a software package for several architectures
simultaneously from the same copy of the source code. The object files
@node Automatic Remaking
@subsection Automatic Remaking
+@cindex Automatic remaking
+@cindex Remaking automatically
You can put rules like the following in the top-level @file{Makefile.in}
for a package to automatically update the configuration information when
@node Header Templates
@subsection Configuration Header Templates
@cindex Configuration Header Template
+@cindex Header templates
@cindex @file{config.h.in}
Your distribution should contain a template file that looks as you want
@node Autoheader Macros
@subsection Autoheader Macros
+@cindex Autoheader macros
@command{autoheader} scans @file{configure.ac} and figures out which C
preprocessor symbols it might define. It knows how to generate
@node Configuration Commands
@section Running Arbitrary Configuration Commands
+@cindex Configuration commands
+@cindex Commands for configuration
You can execute arbitrary commands before, during, and after
@file{config.status} is run. The three following macros accumulate the
@node Configuration Links
@section Creating Configuration Links
+@cindex Configuration links
+@cindex Links for configuration
You may find it convenient to create links whose destinations depend upon
results of tests. One can use @code{AC_CONFIG_COMMANDS} but the
@node Subdirectories
@section Configuring Other Packages in Subdirectories
+@section Configure subdirectories
+@section Subdirectory configure
In most situations, calling @code{AC_OUTPUT} is sufficient to produce
@file{Makefile}s in subdirectories. However, @command{configure} scripts
@node Default Prefix
@section Default Prefix
+@cindex Install prefix
+@cindex Prefix for install
By default, @command{configure} sets the prefix for files it installs to
@file{/usr/local}. The user of @command{configure} can select a different
@node Common Behavior
@section Common Behavior
+@cindex Common autoconf behavior
Much effort has been expended to make Autoconf easy to learn. The most
obvious way to reach this goal is simply to enforce standard interfaces
@node Standard Symbols
@subsection Standard Symbols
+@cindex Standard symbols
All the generic macros that @code{AC_DEFINE} a symbol as a result of
their test transform their @var{argument}s to a standard alphabet.
@node Default Includes
@subsection Default Includes
+@cindex Default includes
@cindex Includes, default
Several tests depend upon a set of header files. Since these headers
@node Function Portability
@subsection Portability of C Functions
+@cindex Portability of C functions
+@cindex C function portability
Most usual functions can either be missing, or be buggy, or be limited
on some architectures. This section tries to make an inventory of these
@node Header Portability
@subsection Portability of Headers
+@cindex Portability of headers
+@cindex Header portability
This section tries to collect knowledge about common headers, and the
problems they cause. By definition, this list will always require
@node Types
@section Types
+@cindex Types
+@cindex C types
The following macros check for C types, either builtin or typedefs. If
there is no macro specifically defined to check for a type you need, and
@node Compilers and Preprocessors
@section Compilers and Preprocessors
+@cindex Compilers
+@cindex Preprocessors
@ovindex EXEEXT
All the tests for compilers (@code{AC_PROG_CC}, @code{AC_PROG_CXX},
@node Fortran Compiler
@subsection Fortran Compiler Characteristics
+@cindex Fortran
+@cindex F77
The Autoconf Fortran support is divided into two categories: legacy
Fortran 77 macros (@code{F77}), and modern Fortran macros (@code{FC}).
@defmac AC_PATH_X
@acindex{PATH_X}
+@cindex X Window System
Try to locate the X Window System include files and libraries. If the
user gave the command line options @option{--x-includes=@var{dir}} and
@option{--x-libraries=@var{dir}}, use those directories. If either or
@cvindex _FILE_OFFSET_BITS
@cvindex _LARGE_FILES
@ovindex CC
+@cindex Large file support
+@cindex LFS
Arrange for
@href{http://www.unix-systems.org/version2/whatsnew/lfs20mar.html,
large-file support}. On some hosts, one must use special compiler
@node Systemology
@section Systemology
+@cindex Systemology
This section aims at presenting some systems and pointers to
documentation. It may help you addressing particular problems reported
@node Setting Output Variables
@section Setting Output Variables
+@cindex Output variables
Another way to record the results of tests is to set @dfn{output
variables}, which are shell variables whose values are substituted into
@node Programming in M4
@chapter Programming in M4
+@cindex M4
Autoconf is written on top of two layers: @dfn{M4sugar}, which provides
convenient macros for pure M4 programming, and @dfn{M4sh}, which
@node M4 Quotation
@section M4 Quotation
+@cindex M4 quotation
@cindex quotation
@c FIXME: Grmph, yet another quoting myth: quotation has *never*
@node Changequote is Evil
@subsection @code{changequote} is Evil
+@cindex @code{changequote}
The temptation is often high to bypass proper quotation, in particular
when it's late at night. Then, many experienced Autoconf hackers
@node Forbidden Patterns
@subsection Forbidden Patterns
+@cindex Forbidden patterns
+@cindex Patterns, forbidden
M4sugar provides a means to define suspicious patterns, patterns
describing tokens which should not be found in the output. For
@node Dependencies Between Macros
@section Dependencies Between Macros
+@cindex Dependencies between macros
Some Autoconf macros depend on other macros having been called first in
order to work correctly. Autoconf provides a way to ensure that certain
@node Prerequisite Macros
@subsection Prerequisite Macros
+@cindex Prerequisite macros
+@cindex Macros, prerequisites
A macro that you write might need to use values that have previously
been computed by other macros. For example, @code{AC_DECL_YYTEXT}
@node Suggested Ordering
@subsection Suggested Ordering
+@cindex Macros, ordering
+@cindex Ordering macros
Some macros should be run before another macro if both are called, but
neither @emph{requires} that the other be called. For example, a macro
@node Obsoleting Macros
@section Obsoleting Macros
+@cindex Obsoleting macros
+@cindex Macros, obsoleting
Configuration and portability technology has evolved over the years.
Often better ways of solving a particular problem are developed, or
@node Coding Style
@section Coding Style
+@cindex Coding style
The Autoconf macros follow a strict coding style. You are encouraged to
follow this style, especially if you intend to distribute your macro,
@node Portable Shell
@chapter Portable Shell Programming
+@cindex Portable shell programming
When writing your own checks, there are some shell-script programming
techniques you should avoid in order to make your code portable. The
@node Shellology
@section Shellology
+@cindex Shellology
There are several families of shells, most prominently the Bourne family
and the C shell family which are deeply incompatible. If you want to
you'll need to use @command{bash} 2.05 for all other build tasks as well.
@item Ksh
-@prindex Ksh
-@prindex Korn shell
+@cindex Ksh
+@cindex Korn shell
+@prindex @samp{ksh}
@prindex @samp{ksh88}
@prindex @samp{ksh93}
The Korn shell is compatible with the Bourne family and it mostly
@node Here-Documents
@section Here-Documents
+@cindex Here documents
+@cindex Shell here documents
Don't rely on @samp{\} being preserved just because it has no special
meaning together with the next symbol. In the native @command{/bin/sh}
@node File Descriptors
@section File Descriptors
+@cindex Descriptors
+@cindex File descriptors
+@cindex Shell file descriptors
Some file descriptors shall not be used, since some systems, admittedly
arcane, use them for special purpose:
@node File System Conventions
@section File System Conventions
+@cindex File system conventions
While @command{autoconf} and friends will usually be run on some Unix
variety, it can and will be used on other systems, most notably @acronym{DOS}
@node Shell Substitutions
@section Shell Substitutions
+@cindex Shell substitutions
Contrary to a persistent urban legend, the Bourne shell does not
systematically split variables and back-quoted expressions, in particular
@node Assignments
@section Assignments
+@cindex Shell assignments
When setting several variables in a row, be aware that the order of the
evaluation is undefined. For instance @samp{foo=1 foo=2; echo $foo}
@node Parentheses
@section Parentheses in Shell Scripts
+@cindex Shell parentheses
Beware of two opening parentheses in a row, as some shell
implementations mishandle them. For example, @samp{pdksh} 5.2.14
@node Special Shell Variables
@section Special Shell Variables
+@cindex Shell variables
+@cindex Special shell variables
Some shell variables should not be used, since they can have a deep
influence on the behavior of the shell. In order to recover a sane
@node Limitations of Builtins
@section Limitations of Shell Builtins
+@cindex Shell builtins
+@cindex Limitations of shell builtins
No, no, we are serious: some shells do have limitations! :)
@node Limitations of Usual Tools
@section Limitations of Usual Tools
+@cindex Limitations of usual tools
The small set of tools you can expect to find on any machine can still
include some limitations you should be aware of.
@item @command{cc}
@c ---------------
+@prindex @command{cc}
When a compilation such as @samp{cc foo.c -o foo} fails, some compilers
(such as @sc{cds} on Reliant @sc{unix}) leave a @file{foo.o}.
@item @command{find}
@c -----------------
+@prindex @command{find}
The option @option{-maxdepth} seems to be @acronym{GNU} specific.
Tru64 v5.1, Net@acronym{BSD} 1.5 and Solaris 2.5 @command{find}
commands do not understand it.
@node Limitations of Make
@section Limitations of Make
+@prindex @command{make}
+@cindex Limitations of @command{make}
@command{make} itself suffers a great number of limitations, only a few
of which are listed here. First of all, remember that since commands
@node Specifying Names
@section Specifying the System Type
+@cindex System type
Like other @acronym{GNU} @command{configure} scripts, Autoconf-generated
@command{configure} scripts can make decisions based on a canonical name
@node Canonicalizing
@section Getting the Canonical System Type
+@cindex System type
+@cindex Canonical system type
The following macros make the system type available to @command{configure}
scripts.
@node External Software
@section Working With External Software
+@cindex External software
Some packages require, or can optionally use, other software packages
that are already installed. The user can give @command{configure}
@node Package Options
@section Choosing Package Options
+@cindex Package options
+@cindex Options, package
If a software package has optional compile-time features, the user can
give @command{configure} command line options to specify whether to
@node Pretty Help Strings
@section Making Your Help Strings Look Pretty
+@cindex Help strings
Properly formatting the @samp{help strings} which are used in
@code{AC_ARG_WITH} (@pxref{External Software}) and @code{AC_ARG_ENABLE}
@node Site Details
@section Configuring Site Details
+@cindex Site details
Some software packages require complex site-specific information. Some
examples are host names to use for certain services, company names, and
@node Transforming Names
@section Transforming Program Names When Installing
+@cindex Transforming program names
+@cindex Program names, transforming
Autoconf supports changing the names of programs when installing them.
In order to use these transformations, @file{configure.ac} must call the
@node Site Defaults
@section Setting Site Defaults
+@cindex Site defaults
Autoconf-generated @command{configure} scripts allow your site to provide
default values for some configuration values. You do this by creating
@node Obsolete Constructs
@chapter Obsolete Constructs
+@cindex Obsolete constructs
Autoconf changes, and throughout the years some constructs have been
obsoleted. Most of the changes involve the macros, but in some cases
@node Autoconf 1
@section Upgrading From Version 1
+@cindex Upgrading autoconf
+@cindex Autoconf upgrading
Autoconf version 2 is mostly backward compatible with version 1.
However, it introduces better ways to do some things, and doesn't
@node Autoconf 2.13
@section Upgrading From Version 2.13
+@cindex Upgrading autoconf
+@cindex Autoconf upgrading
The introduction of the previous section (@pxref{Autoconf 1}) perfectly
suits this section@enddots{}
@node Hosts and Cross-Compilation
@subsection Hosts and Cross-Compilation
+@cindex Cross compilation
Based on the experience of compiler writers, and after long public
debates, many aspects of the cross-compilation chain have changed:
@node Distributing
@section Distributing @command{configure} Scripts
+@cindex License
@display
What are the restrictions on distributing @command{configure}
@node Bootstrapping
@section How Can I Bootstrap?
+@cindex Bootstrap
@display
If Autoconf requires @acronym{GNU} M4 and @acronym{GNU} M4 has an Autoconf
@node Why Not Imake
@section Why Not Imake?
+@cindex Imake
@display
Why not use Imake instead of @command{configure} scripts?
@node History
@chapter History of Autoconf
+@cindex History of autoconf
You may be wondering, Why was Autoconf originally written? How did it
get into its present form? (Why does it look like gorilla spit?) If
@node Copying This Manual
@appendix Copying This Manual
+@cindex License
@menu
* GNU Free Documentation License:: License for copying this manual