1 This is Info file autoconf.info, produced by Makeinfo version 1.67 from
2 the input file /home/bje/autoconf-2.13/autoconf.texi.
5 * Autoconf: (autoconf). Create source code configuration scripts.
8 Autoconf: Creating Automatic Configuration Scripts, by David
11 This file documents the GNU Autoconf package for creating scripts to
12 configure source code packages using templates and an `m4' macro
15 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998 Free Software
18 Permission is granted to make and distribute verbatim copies of this
19 manual provided the copyright notice and this permission notice are
20 preserved on all copies.
22 Permission is granted to copy and distribute modified versions of
23 this manual under the conditions for verbatim copying, provided that
24 the entire resulting derived work is distributed under the terms of a
25 permission notice identical to this one.
27 Permission is granted to copy and distribute translations of this
28 manual into another language, under the above conditions for modified
29 versions, except that this permission notice may be stated in a
30 translation approved by the Foundation.
33 File: autoconf.info, Node: Top, Next: Introduction, Prev: (dir), Up: (dir)
35 This file documents the GNU Autoconf package for creating scripts to
36 configure source code packages using templates and an `m4' macro
37 package. This is edition 2.13, for Autoconf version 2.13.
41 * Introduction:: Autoconf's purpose, strengths, and weaknesses.
42 * Making configure Scripts:: How to organize and produce Autoconf scripts.
43 * Setup:: Initialization and output.
44 * Existing Tests:: Macros that check for particular features.
45 * Writing Tests:: How to write new feature checks.
46 * Results:: What to do with results from feature checks.
47 * Writing Macros:: Adding new macros to Autoconf.
48 * Manual Configuration:: Selecting features that can't be guessed.
49 * Site Configuration:: Local defaults for `configure'.
50 * Invoking configure:: How to use the Autoconf output.
51 * Invoking config.status:: Recreating a configuration.
52 * Questions:: Questions about Autoconf, with answers.
53 * Upgrading:: Tips for upgrading from version 1.
54 * History:: History of Autoconf.
55 * Old Macro Names:: Backward compatibility macros.
56 * Environment Variable Index:: Index of environment variables used.
57 * Output Variable Index:: Index of variables set in output files.
58 * Preprocessor Symbol Index:: Index of C preprocessor symbols defined.
59 * Macro Index:: Index of Autoconf macros.
61 -- The Detailed Node Listing --
63 Making `configure' Scripts
65 * Writing configure.in:: What to put in an Autoconf input file.
66 * Invoking autoscan:: Semi-automatic `configure.in' writing.
67 * Invoking ifnames:: Listing the conditionals in source code.
68 * Invoking autoconf:: How to create configuration scripts.
69 * Invoking autoreconf:: Remaking multiple `configure' scripts.
71 Initialization and Output Files
73 * Input:: Where Autoconf should find files.
74 * Output:: Creating output files.
75 * Makefile Substitutions:: Using output variables in `Makefile's.
76 * Configuration Headers:: Creating a configuration header file.
77 * Subdirectories:: Configuring independent packages together.
78 * Default Prefix:: Changing the default installation prefix.
79 * Versions:: Version numbers in `configure'.
81 Substitutions in Makefiles
83 * Preset Output Variables:: Output variables that are always set.
84 * Build Directories:: Supporting multiple concurrent compiles.
85 * Automatic Remaking:: Makefile rules for configuring.
87 Configuration Header Files
89 * Header Templates:: Input for the configuration headers.
90 * Invoking autoheader:: How to create configuration templates.
94 * Alternative Programs:: Selecting between alternative programs.
95 * Libraries:: Library archives that might be missing.
96 * Library Functions:: C library functions that might be missing.
97 * Header Files:: Header files that might be missing.
98 * Structures:: Structures or members that might be missing.
99 * Typedefs:: `typedef's that might be missing.
100 * C Compiler Characteristics::
101 * Fortran 77 Compiler Characteristics::
102 * System Services:: Operating system services.
103 * UNIX Variants:: Special kludges for specific UNIX variants.
107 * Particular Programs:: Special handling to find certain programs.
108 * Generic Programs:: How to find other programs.
112 * Particular Functions:: Special handling to find certain functions.
113 * Generic Functions:: How to find other functions.
117 * Particular Headers:: Special handling to find certain headers.
118 * Generic Headers:: How to find other headers.
122 * Particular Typedefs:: Special handling to find certain types.
123 * Generic Typedefs:: How to find other types.
127 * Examining Declarations:: Detecting header files and declarations.
128 * Examining Syntax:: Detecting language syntax features.
129 * Examining Libraries:: Detecting functions and global variables.
130 * Run Time:: Testing for run-time features.
131 * Portable Shell:: Shell script portability pitfalls.
132 * Testing Values and Files:: Checking strings and files.
133 * Multiple Cases:: Tests for several possible values.
134 * Language Choice:: Selecting which language to use for testing.
136 Checking Run Time Behavior
138 * Test Programs:: Running test programs.
139 * Guidelines:: General rules for writing test programs.
140 * Test Functions:: Avoiding pitfalls in test programs.
144 * Defining Symbols:: Defining C preprocessor symbols.
145 * Setting Output Variables:: Replacing variables in output files.
146 * Caching Results:: Speeding up subsequent `configure' runs.
147 * Printing Messages:: Notifying users of progress or problems.
151 * Cache Variable Names:: Shell variables used in caches.
152 * Cache Files:: Files `configure' uses for caching.
156 * Macro Definitions:: Basic format of an Autoconf macro.
157 * Macro Names:: What to call your new macros.
158 * Quoting:: Protecting macros from unwanted expansion.
159 * Dependencies Between Macros:: What to do when macros depend on other macros.
161 Dependencies Between Macros
163 * Prerequisite Macros:: Ensuring required information.
164 * Suggested Ordering:: Warning about possible ordering problems.
165 * Obsolete Macros:: Warning about old ways of doing things.
169 * Specifying Names:: Specifying the system type.
170 * Canonicalizing:: Getting the canonical system type.
171 * System Type Variables:: Variables containing the system type.
172 * Using System Type:: What to do with the system type.
176 * External Software:: Working with other optional software.
177 * Package Options:: Selecting optional features.
178 * Site Details:: Configuring site details.
179 * Transforming Names:: Changing program names when installing.
180 * Site Defaults:: Giving `configure' local defaults.
182 Transforming Program Names When Installing
184 * Transformation Options:: `configure' options to transform names.
185 * Transformation Examples:: Sample uses of transforming names.
186 * Transformation Rules:: `Makefile' uses of transforming names.
188 Running `configure' Scripts
190 * Basic Installation:: Instructions for typical cases.
191 * Compilers and Options:: Selecting compilers and optimization.
192 * Multiple Architectures:: Compiling for multiple architectures at once.
193 * Installation Names:: Installing in different directories.
194 * Optional Features:: Selecting optional features.
195 * System Type:: Specifying the system type.
196 * Sharing Defaults:: Setting site-wide defaults for `configure'.
197 * Operation Controls:: Changing how `configure' runs.
199 Questions About Autoconf
201 * Distributing:: Distributing `configure' scripts.
202 * Why GNU m4:: Why not use the standard `m4'?
203 * Bootstrapping:: Autoconf and GNU `m4' require each other?
204 * Why Not Imake:: Why GNU uses `configure' instead of Imake.
206 Upgrading From Version 1
208 * Changed File Names:: Files you might rename.
209 * Changed Makefiles:: New things to put in `Makefile.in'.
210 * Changed Macros:: Macro calls you might replace.
211 * Invoking autoupdate:: Replacing old macro names in `configure.in'.
212 * Changed Results:: Changes in how to check test results.
213 * Changed Macro Writing:: Better ways to write your own macros.
217 * Genesis:: Prehistory and naming of `configure'.
218 * Exodus:: The plagues of `m4' and Perl.
219 * Leviticus:: The priestly code of portability arrives.
220 * Numbers:: Growth and contributors.
221 * Deuteronomy:: Approaching the promises of easy configuration.
224 File: autoconf.info, Node: Introduction, Next: Making configure Scripts, Prev: Top, Up: Top
229 A physicist, an engineer, and a computer scientist were
230 discussing the nature of God. Surely a Physicist, said the
231 physicist, because early in the Creation, God made Light; and you
232 know, Maxwell's equations, the dual nature of electro-magnetic
233 waves, the relativist consequences... An Engineer!, said the
234 engineer, because before making Light, God split the Chaos into
235 Land and Water; it takes a hell of an engineer to handle that big
236 amount of mud, and orderly separation of solids from
237 liquids... The computer scientist shouted: And the Chaos,
238 where do you think it was coming from, hmm?
242 Autoconf is a tool for producing shell scripts that automatically
243 configure software source code packages to adapt to many kinds of
244 UNIX-like systems. The configuration scripts produced by Autoconf are
245 independent of Autoconf when they are run, so their users do not need to
248 The configuration scripts produced by Autoconf require no manual user
249 intervention when run; they do not normally even need an argument
250 specifying the system type. Instead, they test for the presence of each
251 feature that the software package they are for might need individually.
252 (Before each check, they print a one-line message stating what they are
253 checking for, so the user doesn't get too bored while waiting for the
254 script to finish.) As a result, they deal well with systems that are
255 hybrids or customized from the more common UNIX variants. There is no
256 need to maintain files that list the features supported by each release
257 of each variant of UNIX.
259 For each software package that Autoconf is used with, it creates a
260 configuration script from a template file that lists the system
261 features that the package needs or can use. After the shell code to
262 recognize and respond to a system feature has been written, Autoconf
263 allows it to be shared by many software packages that can use (or need)
264 that feature. If it later turns out that the shell code needs
265 adjustment for some reason, it needs to be changed in only one place;
266 all of the configuration scripts can be regenerated automatically to
267 take advantage of the updated code.
269 The Metaconfig package is similar in purpose to Autoconf, but the
270 scripts it produces require manual user intervention, which is quite
271 inconvenient when configuring large source trees. Unlike Metaconfig
272 scripts, Autoconf scripts can support cross-compiling, if some care is
273 taken in writing them.
275 There are several jobs related to making portable software packages
276 that Autoconf currently does not do. Among these are automatically
277 creating `Makefile' files with all of the standard targets, and
278 supplying replacements for standard library functions and header files
279 on systems that lack them. Work is in progress to add those features in
282 Autoconf imposes some restrictions on the names of macros used with
283 `#ifdef' in C programs (*note Preprocessor Symbol Index::.).
285 Autoconf requires GNU `m4' in order to generate the scripts. It
286 uses features that some UNIX versions of `m4' do not have. It also
287 overflows internal limits of some versions of `m4', including GNU `m4'
288 1.0. You must use version 1.1 or later of GNU `m4'. Using version 1.3
289 or later will be much faster than 1.1 or 1.2.
291 *Note Upgrading::, for information about upgrading from version 1.
292 *Note History::, for the story of Autoconf's development. *Note
293 Questions::, for answers to some common questions about Autoconf.
295 Mail suggestions and bug reports for Autoconf to
296 `bug-gnu-utils@prep.ai.mit.edu'. Please include the Autoconf version
297 number, which you can get by running `autoconf --version'.
300 File: autoconf.info, Node: Making configure Scripts, Next: Setup, Prev: Introduction, Up: Top
302 Making `configure' Scripts
303 **************************
305 The configuration scripts that Autoconf produces are by convention
306 called `configure'. When run, `configure' creates several files,
307 replacing configuration parameters in them with appropriate values.
308 The files that `configure' creates are:
310 * one or more `Makefile' files, one in each subdirectory of the
311 package (*note Makefile Substitutions::.);
313 * optionally, a C header file, the name of which is configurable,
314 containing `#define' directives (*note Configuration Headers::.);
316 * a shell script called `config.status' that, when run, will recreate
317 the files listed above (*note Invoking config.status::.);
319 * a shell script called `config.cache' that saves the results of
320 running many of the tests (*note Cache Files::.);
322 * a file called `config.log' containing any messages produced by
323 compilers, to help debugging if `configure' makes a mistake.
325 To create a `configure' script with Autoconf, you need to write an
326 Autoconf input file `configure.in' and run `autoconf' on it. If you
327 write your own feature tests to supplement those that come with
328 Autoconf, you might also write files called `aclocal.m4' and
329 `acsite.m4'. If you use a C header file to contain `#define'
330 directives, you might also write `acconfig.h', and you will distribute
331 the Autoconf-generated file `config.h.in' with the package.
333 Here is a diagram showing how the files that can be used in
334 configuration are produced. Programs that are executed are suffixed by
335 `*'. Optional files are enclosed in square brackets (`[]').
336 `autoconf' and `autoheader' also read the installed Autoconf macro
337 files (by reading `autoconf.m4').
339 Files used in preparing a software package for distribution:
340 your source files --> [autoscan*] --> [configure.scan] --> configure.in
342 configure.in --. .------> autoconf* -----> configure
344 [aclocal.m4] --+ `---.
346 +--> [autoheader*] -> [config.h.in]
352 Makefile.in -------------------------------> Makefile.in
354 Files used in configuring a software package:
355 .-------------> config.cache
356 configure* ------------+-------------> config.log
358 [config.h.in] -. v .-> [config.h] -.
359 +--> config.status* -+ +--> make*
360 Makefile.in ---' `-> Makefile ---'
364 * Writing configure.in:: What to put in an Autoconf input file.
365 * Invoking autoscan:: Semi-automatic `configure.in' writing.
366 * Invoking ifnames:: Listing the conditionals in source code.
367 * Invoking autoconf:: How to create configuration scripts.
368 * Invoking autoreconf:: Remaking multiple `configure' scripts.
371 File: autoconf.info, Node: Writing configure.in, Next: Invoking autoscan, Prev: Making configure Scripts, Up: Making configure Scripts
373 Writing `configure.in'
374 ======================
376 To produce a `configure' script for a software package, create a
377 file called `configure.in' that contains invocations of the Autoconf
378 macros that test the system features your package needs or can use.
379 Autoconf macros already exist to check for many features; see *Note
380 Existing Tests::, for their descriptions. For most other features, you
381 can use Autoconf template macros to produce custom checks; see *Note
382 Writing Tests::, for information about them. For especially tricky or
383 specialized features, `configure.in' might need to contain some
384 hand-crafted shell commands. The `autoscan' program can give you a
385 good start in writing `configure.in' (*note Invoking autoscan::., for
388 The order in which `configure.in' calls the Autoconf macros is not
389 important, with a few exceptions. Every `configure.in' must contain a
390 call to `AC_INIT' before the checks, and a call to `AC_OUTPUT' at the
391 end (*note Output::.). Additionally, some macros rely on other macros
392 having been called first, because they check previously set values of
393 some variables to decide what to do. These macros are noted in the
394 individual descriptions (*note Existing Tests::.), and they also warn
395 you when creating `configure' if they are called out of order.
397 To encourage consistency, here is a suggested order for calling the
398 Autoconf macros. Generally speaking, the things near the end of this
399 list could depend on things earlier in it. For example, library
400 functions could be affected by typedefs and libraries.
405 checks for header files
407 checks for structures
408 checks for compiler characteristics
409 checks for library functions
410 checks for system services
411 `AC_OUTPUT([FILE...])'
413 It is best to put each macro call on its own line in `configure.in'.
414 Most of the macros don't add extra newlines; they rely on the newline
415 after the macro call to terminate the commands. This approach makes
416 the generated `configure' script a little easier to read by not
417 inserting lots of blank lines. It is generally safe to set shell
418 variables on the same line as a macro call, because the shell allows
419 assignments without intervening newlines.
421 When calling macros that take arguments, there must not be any blank
422 space between the macro name and the open parenthesis. Arguments can be
423 more than one line long if they are enclosed within the `m4' quote
424 characters `[' and `]'. If you have a long line such as a list of file
425 names, you can generally use a backslash at the end of a line to
426 continue it logically on the next line (this is implemented by the
427 shell, not by anything special that Autoconf does).
429 Some macros handle two cases: what to do if the given condition is
430 met, and what to do if the condition is not met. In some places you
431 might want to do something if a condition is true but do nothing if it's
432 false, or vice versa. To omit the true case, pass an empty value for
433 the ACTION-IF-FOUND argument to the macro. To omit the false case,
434 omit the ACTION-IF-NOT-FOUND argument to the macro, including the comma
437 You can include comments in `configure.in' files by starting them
438 with the `m4' builtin macro `dnl', which discards text up through the
439 next newline. These comments do not appear in the generated
440 `configure' scripts. For example, it is helpful to begin
441 `configure.in' files with a line like this:
443 dnl Process this file with autoconf to produce a configure script.
446 File: autoconf.info, Node: Invoking autoscan, Next: Invoking ifnames, Prev: Writing configure.in, Up: Making configure Scripts
448 Using `autoscan' to Create `configure.in'
449 =========================================
451 The `autoscan' program can help you create a `configure.in' file for
452 a software package. `autoscan' examines source files in the directory
453 tree rooted at a directory given as a command line argument, or the
454 current directory if none is given. It searches the source files for
455 common portability problems and creates a file `configure.scan' which
456 is a preliminary `configure.in' for that package.
458 You should manually examine `configure.scan' before renaming it to
459 `configure.in'; it will probably need some adjustments. Occasionally
460 `autoscan' outputs a macro in the wrong order relative to another
461 macro, so that `autoconf' produces a warning; you need to move such
462 macros manually. Also, if you want the package to use a configuration
463 header file, you must add a call to `AC_CONFIG_HEADER' (*note
464 Configuration Headers::.). You might also have to change or add some
465 `#if' directives to your program in order to make it work with Autoconf
466 (*note Invoking ifnames::., for information about a program that can
469 `autoscan' uses several data files, which are installed along with
470 the distributed Autoconf macro files, to determine which macros to
471 output when it finds particular symbols in a package's source files.
472 These files all have the same format. Each line consists of a symbol,
473 whitespace, and the Autoconf macro to output if that symbol is
474 encountered. Lines starting with `#' are comments.
476 `autoscan' is only installed if you already have Perl installed.
477 `autoscan' accepts the following options:
480 Print a summary of the command line options and exit.
483 Look for the data files in directory DIR instead of the default
484 installation directory. You can also set the `AC_MACRODIR'
485 environment variable to a directory; this option overrides the
486 environment variable.
489 Print the names of the files it examines and the potentially
490 interesting symbols it finds in them. This output can be
494 Print the version number of Autoconf and exit.
497 File: autoconf.info, Node: Invoking ifnames, Next: Invoking autoconf, Prev: Invoking autoscan, Up: Making configure Scripts
499 Using `ifnames' to List Conditionals
500 ====================================
502 `ifnames' can help when writing a `configure.in' for a software
503 package. It prints the identifiers that the package already uses in C
504 preprocessor conditionals. If a package has already been set up to
505 have some portability, this program can help you figure out what its
506 `configure' needs to check for. It may help fill in some gaps in a
507 `configure.in' generated by `autoscan' (*note Invoking autoscan::.).
509 `ifnames' scans all of the C source files named on the command line
510 (or the standard input, if none are given) and writes to the standard
511 output a sorted list of all the identifiers that appear in those files
512 in `#if', `#elif', `#ifdef', or `#ifndef' directives. It prints each
513 identifier on a line, followed by a space-separated list of the files
514 in which that identifier occurs.
516 `ifnames' accepts the following options:
520 Print a summary of the command line options and exit.
524 Look for the Autoconf macro files in directory DIR instead of the
525 default installation directory. Only used to get the version
526 number. You can also set the `AC_MACRODIR' environment variable
527 to a directory; this option overrides the environment variable.
530 Print the version number of Autoconf and exit.
533 File: autoconf.info, Node: Invoking autoconf, Next: Invoking autoreconf, Prev: Invoking ifnames, Up: Making configure Scripts
535 Using `autoconf' to Create `configure'
536 ======================================
538 To create `configure' from `configure.in', run the `autoconf'
539 program with no arguments. `autoconf' processes `configure.in' with
540 the `m4' macro processor, using the Autoconf macros. If you give
541 `autoconf' an argument, it reads that file instead of `configure.in'
542 and writes the configuration script to the standard output instead of
543 to `configure'. If you give `autoconf' the argument `-', it reads the
544 standard input instead of `configure.in' and writes the configuration
545 script on the standard output.
547 The Autoconf macros are defined in several files. Some of the files
548 are distributed with Autoconf; `autoconf' reads them first. Then it
549 looks for the optional file `acsite.m4' in the directory that contains
550 the distributed Autoconf macro files, and for the optional file
551 `aclocal.m4' in the current directory. Those files can contain your
552 site's or the package's own Autoconf macro definitions (*note Writing
553 Macros::., for more information). If a macro is defined in more than
554 one of the files that `autoconf' reads, the last definition it reads
555 overrides the earlier ones.
557 `autoconf' accepts the following options:
561 Print a summary of the command line options and exit.
565 Look for the package file `aclocal.m4' in directory DIR instead of
566 in the current directory.
570 Look for the installed macro files in directory DIR. You can also
571 set the `AC_MACRODIR' environment variable to a directory; this
572 option overrides the environment variable.
575 Print the version number of Autoconf and exit.
578 File: autoconf.info, Node: Invoking autoreconf, Prev: Invoking autoconf, Up: Making configure Scripts
580 Using `autoreconf' to Update `configure' Scripts
581 ================================================
583 If you have a lot of Autoconf-generated `configure' scripts, the
584 `autoreconf' program can save you some work. It runs `autoconf' (and
585 `autoheader', where appropriate) repeatedly to remake the Autoconf
586 `configure' scripts and configuration header templates in the directory
587 tree rooted at the current directory. By default, it only remakes
588 those files that are older than their `configure.in' or (if present)
589 `aclocal.m4'. Since `autoheader' does not change the timestamp of its
590 output file if the file wouldn't be changing, this is not necessarily
591 the minimum amount of work. If you install a new version of Autoconf,
592 you can make `autoreconf' remake *all* of the files by giving it the
595 If you give `autoreconf' the `--macrodir=DIR' or `--localdir=DIR'
596 options, it passes them down to `autoconf' and `autoheader' (with
597 relative paths adjusted properly).
599 `autoreconf' does not support having, in the same directory tree,
600 both directories that are parts of a larger package (sharing
601 `aclocal.m4' and `acconfig.h'), and directories that are independent
602 packages (each with their own `aclocal.m4' and `acconfig.h'). It
603 assumes that they are all part of the same package, if you use
604 `--localdir', or that each directory is a separate package, if you
605 don't use it. This restriction may be removed in the future.
607 *Note Automatic Remaking::, for `Makefile' rules to automatically
608 remake `configure' scripts when their source files change. That method
609 handles the timestamps of configuration header templates properly, but
610 does not pass `--macrodir=DIR' or `--localdir=DIR'.
612 `autoreconf' accepts the following options:
616 Print a summary of the command line options and exit.
620 Remake even `configure' scripts and configuration headers that are
621 newer than their input files (`configure.in' and, if present,
626 Have `autoconf' and `autoheader' look for the package files
627 `aclocal.m4' and (`autoheader' only) `acconfig.h' (but not
628 `FILE.top' and `FILE.bot') in directory DIR instead of in the
629 directory containing each `configure.in'.
633 Look for the Autoconf macro files in directory DIR instead of the
634 default installation directory. You can also set the `AC_MACRODIR'
635 environment variable to a directory; this option overrides the
636 environment variable.
639 Print the name of each directory where `autoreconf' runs
640 `autoconf' (and `autoheader', if appropriate).
643 Print the version number of Autoconf and exit.
646 File: autoconf.info, Node: Setup, Next: Existing Tests, Prev: Making configure Scripts, Up: Top
648 Initialization and Output Files
649 *******************************
651 Autoconf-generated `configure' scripts need some information about
652 how to initialize, such as how to find the package's source files; and
653 about the output files to produce. The following sections describe
654 initialization and creating output files.
658 * Input:: Where Autoconf should find files.
659 * Output:: Creating output files.
660 * Makefile Substitutions:: Using output variables in `Makefile's.
661 * Configuration Headers:: Creating a configuration header file.
662 * Subdirectories:: Configuring independent packages together.
663 * Default Prefix:: Changing the default installation prefix.
664 * Versions:: Version numbers in `configure'.
667 File: autoconf.info, Node: Input, Next: Output, Prev: Setup, Up: Setup
669 Finding `configure' Input
670 =========================
672 Every `configure' script must call `AC_INIT' before doing anything
673 else. The only other required macro is `AC_OUTPUT' (*note Output::.).
675 - Macro: AC_INIT (UNIQUE-FILE-IN-SOURCE-DIR)
676 Process any command-line arguments and find the source code
677 directory. UNIQUE-FILE-IN-SOURCE-DIR is some file that is in the
678 package's source directory; `configure' checks for this file's
679 existence to make sure that the directory that it is told contains
680 the source code in fact does. Occasionally people accidentally
681 specify the wrong directory with `--srcdir'; this is a safety
682 check. *Note Invoking configure::, for more information.
684 Packages that do manual configuration or use the `install' program
685 might need to tell `configure' where to find some other shell scripts
686 by calling `AC_CONFIG_AUX_DIR', though the default places it looks are
687 correct for most cases.
689 - Macro: AC_CONFIG_AUX_DIR(DIR)
690 Use the `install-sh', `config.sub', `config.guess', and Cygnus
691 `configure' scripts that are in directory DIR. These are
692 auxiliary files used in configuration. DIR can be either absolute
693 or relative to `SRCDIR'. The default is `SRCDIR' or `SRCDIR/..' or
694 `SRCDIR/../..', whichever is the first that contains `install-sh'.
695 The other files are not checked for, so that using
696 `AC_PROG_INSTALL' does not automatically require distributing the
697 other auxiliary files. It checks for `install.sh' also, but that
698 name is obsolete because some `make' programs have a rule that
699 creates `install' from it if there is no `Makefile'.
702 File: autoconf.info, Node: Output, Next: Makefile Substitutions, Prev: Input, Up: Setup
704 Creating Output Files
705 =====================
707 Every Autoconf-generated `configure' script must finish by calling
708 `AC_OUTPUT'. It is the macro that creates the `Makefile's and optional
709 other files resulting from configuration. The only other required
710 macro is `AC_INIT' (*note Input::.).
712 - Macro: AC_OUTPUT ([FILE... [, EXTRA-CMDS [, INIT-CMDS]]])
713 Create output files. Call this macro once, at the end of
714 `configure.in'. The FILE... argument is a whitespace-separated
715 list of output files; it may be empty. This macro creates each
716 file `FILE' by copying an input file (by default named `FILE.in'),
717 substituting the output variable values. *Note Makefile
718 Substitutions::, for more information on using output variables.
719 *Note Setting Output Variables::, for more information on creating
720 them. This macro creates the directory that the file is in if it
721 doesn't exist (but not the parents of that directory). Usually,
722 `Makefile's are created this way, but other files, such as
723 `.gdbinit', can be specified as well.
725 If `AC_CONFIG_HEADER', `AC_LINK_FILES', or `AC_CONFIG_SUBDIRS' has
726 been called, this macro also creates the files named as their
729 A typical call to `AC_OUTPUT' looks like this:
730 AC_OUTPUT(Makefile src/Makefile man/Makefile X/Imakefile)
732 You can override an input file name by appending to FILE a
733 colon-separated list of input files. Examples:
734 AC_OUTPUT(Makefile:templates/top.mk lib/Makefile:templates/lib.mk)
735 AC_OUTPUT(Makefile:templates/vars.mk:Makefile.in:templates/rules.mk)
736 Doing this allows you to keep your file names acceptable to
737 MS-DOS, or to prepend and/or append boilerplate to the file.
739 If you pass EXTRA-CMDS, those commands will be inserted into
740 `config.status' to be run after all its other processing. If
741 INIT-CMDS are given, they are inserted just before EXTRA-CMDS,
742 with shell variable, command, and backslash substitutions
743 performed on them in `configure'. You can use INIT-CMDS to pass
744 variables from `configure' to the EXTRA-CMDS. If
745 `AC_OUTPUT_COMMANDS' has been called, the commands given to it are
746 run just before the commands passed to this macro.
748 - Macro: AC_OUTPUT_COMMANDS (EXTRA-CMDS [, INIT-CMDS])
749 Specify additional shell commands to run at the end of
750 `config.status', and shell commands to initialize any variables
751 from `configure'. This macro may be called multiple times. Here
752 is an unrealistic example:
755 AC_OUTPUT_COMMANDS([echo this is extra $fubar, and so on.], fubar=$fubar)
756 AC_OUTPUT_COMMANDS([echo this is another, extra, bit], [echo init bit])
758 If you run `make' on subdirectories, you should run it using the
759 `make' variable `MAKE'. Most versions of `make' set `MAKE' to the name
760 of the `make' program plus any options it was given. (But many do not
761 include in it the values of any variables set on the command line, so
762 those are not passed on automatically.) Some old versions of `make' do
763 not set this variable. The following macro allows you to use it even
766 - Macro: AC_PROG_MAKE_SET
767 If `make' predefines the variable `MAKE', define output variable
768 `SET_MAKE' to be empty. Otherwise, define `SET_MAKE' to contain
769 `MAKE=make'. Calls `AC_SUBST' for `SET_MAKE'.
771 To use this macro, place a line like this in each `Makefile.in' that
772 runs `MAKE' on other directories:
777 File: autoconf.info, Node: Makefile Substitutions, Next: Configuration Headers, Prev: Output, Up: Setup
779 Substitutions in Makefiles
780 ==========================
782 Each subdirectory in a distribution that contains something to be
783 compiled or installed should come with a file `Makefile.in', from which
784 `configure' will create a `Makefile' in that directory. To create a
785 `Makefile', `configure' performs a simple variable substitution,
786 replacing occurrences of `@VARIABLE@' in `Makefile.in' with the value
787 that `configure' has determined for that variable. Variables that are
788 substituted into output files in this way are called "output
789 variables". They are ordinary shell variables that are set in
790 `configure'. To make `configure' substitute a particular variable into
791 the output files, the macro `AC_SUBST' must be called with that
792 variable name as an argument. Any occurrences of `@VARIABLE@' for
793 other variables are left unchanged. *Note Setting Output Variables::,
794 for more information on creating output variables with `AC_SUBST'.
796 A software package that uses a `configure' script should be
797 distributed with a file `Makefile.in', but no `Makefile'; that way, the
798 user has to properly configure the package for the local system before
801 *Note Makefile Conventions: (standards)Makefile Conventions, for
802 more information on what to put in `Makefile's.
806 * Preset Output Variables:: Output variables that are always set.
807 * Build Directories:: Supporting multiple concurrent compiles.
808 * Automatic Remaking:: Makefile rules for configuring.
811 File: autoconf.info, Node: Preset Output Variables, Next: Build Directories, Prev: Makefile Substitutions, Up: Makefile Substitutions
813 Preset Output Variables
814 -----------------------
816 Some output variables are preset by the Autoconf macros. Some of the
817 Autoconf macros set additional output variables, which are mentioned in
818 the descriptions for those macros. *Note Output Variable Index::, for a
819 complete list of output variables. Here is what each of the preset ones
820 contains. *Note Variables for Installation Directories:
821 (standards)Directory Variables, for more information about the
822 variables with names that end in `dir'.
825 The directory for installing executables that users run.
827 - Variable: configure_input
828 A comment saying that the file was generated automatically by
829 `configure' and giving the name of the input file. `AC_OUTPUT'
830 adds a comment line containing this variable to the top of every
831 `Makefile' it creates. For other files, you should reference this
832 variable in a comment at the top of each input file. For example,
833 an input shell script should begin like this:
838 The presence of that line also reminds people editing the file
839 that it needs to be processed by `configure' in order to be used.
842 The directory for installing read-only architecture-independent
845 - Variable: exec_prefix
846 The installation prefix for architecture-dependent files.
848 - Variable: includedir
849 The directory for installing C header files.
852 The directory for installing documentation in Info format.
855 The directory for installing object code libraries.
857 - Variable: libexecdir
858 The directory for installing executables that other programs run.
860 - Variable: localstatedir
861 The directory for installing modifiable single-machine data.
864 The top-level directory for installing documentation in man format.
866 - Variable: oldincludedir
867 The directory for installing C header files for non-gcc compilers.
870 The installation prefix for architecture-independent files.
873 The directory for installing executables that system
876 - Variable: sharedstatedir
877 The directory for installing modifiable architecture-independent
881 The directory that contains the source code for that `Makefile'.
883 - Variable: sysconfdir
884 The directory for installing read-only single-machine data.
886 - Variable: top_srcdir
887 The top-level source code directory for the package. In the
888 top-level directory, this is the same as `srcdir'.
891 Debugging and optimization options for the C compiler. If it is
892 not set in the environment when `configure' runs, the default
893 value is set when you call `AC_PROG_CC' (or empty if you don't).
894 `configure' uses this variable when compiling programs to test for
898 Header file search directory (`-IDIR') and any other miscellaneous
899 options for the C preprocessor and compiler. If it is not set in
900 the environment when `configure' runs, the default value is empty.
901 `configure' uses this variable when compiling or preprocessing
902 programs to test for C features.
905 Debugging and optimization options for the C++ compiler. If it is
906 not set in the environment when `configure' runs, the default
907 value is set when you call `AC_PROG_CXX' (or empty if you don't).
908 `configure' uses this variable when compiling programs to test for
912 Debugging and optimization options for the Fortran 77 compiler.
913 If it is not set in the environment when `configure' runs, the
914 default value is set when you call `AC_PROG_F77' (or empty if you
915 don't). `configure' uses this variable when compiling programs to
916 test for Fortran 77 features.
919 `-D' options to pass to the C compiler. If `AC_CONFIG_HEADER' is
920 called, `configure' replaces `@DEFS@' with `-DHAVE_CONFIG_H'
921 instead (*note Configuration Headers::.). This variable is not
922 defined while `configure' is performing its tests, only when
923 creating the output files. *Note Setting Output Variables::, for
924 how to check the results of previous tests.
927 Stripping (`-s') and any other miscellaneous options for the
928 linker. If it is not set in the environment when `configure' runs,
929 the default value is empty. `configure' uses this variable when
930 linking programs to test for C features.
933 `-l' and `-L' options to pass to the linker.
936 File: autoconf.info, Node: Build Directories, Next: Automatic Remaking, Prev: Preset Output Variables, Up: Makefile Substitutions
941 You can support compiling a software package for several
942 architectures simultaneously from the same copy of the source code.
943 The object files for each architecture are kept in their own directory.
945 To support doing this, `make' uses the `VPATH' variable to find the
946 files that are in the source directory. GNU `make' and most other
947 recent `make' programs can do this. Older `make' programs do not
948 support `VPATH'; when using them, the source code must be in the same
949 directory as the object files.
951 To support `VPATH', each `Makefile.in' should contain two lines that
957 Do not set `VPATH' to the value of another variable, for example
958 `VPATH = $(srcdir)', because some versions of `make' do not do variable
959 substitutions on the value of `VPATH'.
961 `configure' substitutes in the correct value for `srcdir' when it
964 Do not use the `make' variable `$<', which expands to the pathname
965 of the file in the source directory (found with `VPATH'), except in
966 implicit rules. (An implicit rule is one such as `.c.o', which tells
967 how to create a `.o' file from a `.c' file.) Some versions of `make'
968 do not set `$<' in explicit rules; they expand it to an empty value.
970 Instead, `Makefile' command lines should always refer to source
971 files by prefixing them with `$(srcdir)/'. For example:
973 time.info: time.texinfo
974 $(MAKEINFO) $(srcdir)/time.texinfo
977 File: autoconf.info, Node: Automatic Remaking, Prev: Build Directories, Up: Makefile Substitutions
982 You can put rules like the following in the top-level `Makefile.in'
983 for a package to automatically update the configuration information when
984 you change the configuration files. This example includes all of the
985 optional files, such as `aclocal.m4' and those related to configuration
986 header files. Omit from the `Makefile.in' rules any of these files
987 that your package does not use.
989 The `${srcdir}/' prefix is included because of limitations in the
992 The `stamp-' files are necessary because the timestamps of
993 `config.h.in' and `config.h' will not be changed if remaking them does
994 not change their contents. This feature avoids unnecessary
995 recompilation. You should include the file `stamp-h.in' your package's
996 distribution, so `make' will consider `config.h.in' up to date. On
997 some old BSD systems, `touch' or any command that results in an empty
998 file does not update the timestamps, so use a command like `echo' as a
1001 ${srcdir}/configure: configure.in aclocal.m4
1002 cd ${srcdir} && autoconf
1004 # autoheader might not change config.h.in, so touch a stamp file.
1005 ${srcdir}/config.h.in: stamp-h.in
1006 ${srcdir}/stamp-h.in: configure.in aclocal.m4 acconfig.h \
1007 config.h.top config.h.bot
1008 cd ${srcdir} && autoheader
1009 echo timestamp > ${srcdir}/stamp-h.in
1012 stamp-h: config.h.in config.status
1015 Makefile: Makefile.in config.status
1018 config.status: configure
1019 ./config.status --recheck
1021 In addition, you should pass `echo timestamp > stamp-h' in the
1022 EXTRA-CMDS argument to `AC_OUTPUT', so `config.status' will ensure that
1023 `config.h' is considered up to date. *Note Output::, for more
1024 information about `AC_OUTPUT'.
1026 *Note Invoking config.status::, for more examples of handling
1027 configuration-related dependencies.
1030 File: autoconf.info, Node: Configuration Headers, Next: Subdirectories, Prev: Makefile Substitutions, Up: Setup
1032 Configuration Header Files
1033 ==========================
1035 When a package tests more than a few C preprocessor symbols, the
1036 command lines to pass `-D' options to the compiler can get quite long.
1037 This causes two problems. One is that the `make' output is hard to
1038 visually scan for errors. More seriously, the command lines can exceed
1039 the length limits of some operating systems. As an alternative to
1040 passing `-D' options to the compiler, `configure' scripts can create a
1041 C header file containing `#define' directives. The `AC_CONFIG_HEADER'
1042 macro selects this kind of output. It should be called right after
1045 The package should `#include' the configuration header file before
1046 any other header files, to prevent inconsistencies in declarations (for
1047 example, if it redefines `const'). Use `#include <config.h>' instead
1048 of `#include "config.h"', and pass the C compiler a `-I.' option (or
1049 `-I..'; whichever directory contains `config.h'). That way, even if
1050 the source directory is configured itself (perhaps to make a
1051 distribution), other build directories can also be configured without
1052 finding the `config.h' from the source directory.
1054 - Macro: AC_CONFIG_HEADER (HEADER-TO-CREATE ...)
1055 Make `AC_OUTPUT' create the file(s) in the whitespace-separated
1056 list HEADER-TO-CREATE containing C preprocessor `#define'
1057 statements, and replace `@DEFS@' in generated files with
1058 `-DHAVE_CONFIG_H' instead of the value of `DEFS'. The usual name
1059 for HEADER-TO-CREATE is `config.h'.
1061 If HEADER-TO-CREATE already exists and its contents are identical
1062 to what `AC_OUTPUT' would put in it, it is left alone. Doing this
1063 allows some changes in configuration without needlessly causing
1064 object files that depend on the header file to be recompiled.
1066 Usually the input file is named `HEADER-TO-CREATE.in'; however,
1067 you can override the input file name by appending to
1068 HEADER-TO-CREATE, a colon-separated list of input files. Examples:
1069 AC_CONFIG_HEADER(defines.h:defines.hin)
1070 AC_CONFIG_HEADER(defines.h:defs.pre:defines.h.in:defs.post)
1072 Doing this allows you to keep your file names acceptable to
1073 MS-DOS, or to prepend and/or append boilerplate to the file.
1077 * Header Templates:: Input for the configuration headers.
1078 * Invoking autoheader:: How to create configuration templates.
1081 File: autoconf.info, Node: Header Templates, Next: Invoking autoheader, Prev: Configuration Headers, Up: Configuration Headers
1083 Configuration Header Templates
1084 ------------------------------
1086 Your distribution should contain a template file that looks as you
1087 want the final header file to look, including comments, with default
1088 values in the `#define' statements. For example, suppose your
1089 `configure.in' makes these calls:
1091 AC_CONFIG_HEADER(conf.h)
1092 AC_CHECK_HEADERS(unistd.h)
1094 Then you could have code like the following in `conf.h.in'. On systems
1095 that have `unistd.h', `configure' will change the 0 to a 1. On other
1096 systems, it will leave the line unchanged.
1098 /* Define as 1 if you have unistd.h. */
1099 #define HAVE_UNISTD_H 0
1101 Alternately, if your code tests for configuration options using
1102 `#ifdef' instead of `#if', a default value can be to `#undef' the
1103 variable instead of to define it to a value. On systems that have
1104 `unistd.h', `configure' will change the second line to read `#define
1105 HAVE_UNISTD_H 1'. On other systems, it will comment that line out (in
1106 case the system predefines that symbol).
1108 /* Define if you have unistd.h. */
1109 #undef HAVE_UNISTD_H
1112 File: autoconf.info, Node: Invoking autoheader, Prev: Header Templates, Up: Configuration Headers
1114 Using `autoheader' to Create `config.h.in'
1115 ------------------------------------------
1117 The `autoheader' program can create a template file of C `#define'
1118 statements for `configure' to use. If `configure.in' invokes
1119 `AC_CONFIG_HEADER(FILE)', `autoheader' creates `FILE.in'; if multiple
1120 file arguments are given, the first one is used. Otherwise,
1121 `autoheader' creates `config.h.in'.
1123 If you give `autoheader' an argument, it uses that file instead of
1124 `configure.in' and writes the header file to the standard output
1125 instead of to `config.h.in'. If you give `autoheader' an argument of
1126 `-', it reads the standard input instead of `configure.in' and writes
1127 the header file to the standard output.
1129 `autoheader' scans `configure.in' and figures out which C
1130 preprocessor symbols it might define. It copies comments and `#define'
1131 and `#undef' statements from a file called `acconfig.h', which comes
1132 with and is installed with Autoconf. It also uses a file called
1133 `acconfig.h' in the current directory, if present. If you `AC_DEFINE'
1134 any additional symbols, you must create that file with entries for
1135 them. For symbols defined by `AC_CHECK_HEADERS', `AC_CHECK_FUNCS',
1136 `AC_CHECK_SIZEOF', or `AC_CHECK_LIB', `autoheader' generates comments
1137 and `#undef' statements itself rather than copying them from a file,
1138 since the possible symbols are effectively limitless.
1140 The file that `autoheader' creates contains mainly `#define' and
1141 `#undef' statements and their accompanying comments. If `./acconfig.h'
1142 contains the string `@TOP@', `autoheader' copies the lines before the
1143 line containing `@TOP@' into the top of the file that it generates.
1144 Similarly, if `./acconfig.h' contains the string `@BOTTOM@',
1145 `autoheader' copies the lines after that line to the end of the file it
1146 generates. Either or both of those strings may be omitted.
1148 An alternate way to produce the same effect is to create the files
1149 `FILE.top' (typically `config.h.top') and/or `FILE.bot' in the current
1150 directory. If they exist, `autoheader' copies them to the beginning
1151 and end, respectively, of its output. Their use is discouraged because
1152 they have file names that contain two periods, and so can not be stored
1153 on MS-DOS; also, they are two more files to clutter up the directory.
1154 But if you use the `--localdir=DIR' option to use an `acconfig.h' in
1155 another directory, they give you a way to put custom boilerplate in each
1156 individual `config.h.in'.
1158 `autoheader' accepts the following options:
1162 Print a summary of the command line options and exit.
1166 Look for the package files `aclocal.m4' and `acconfig.h' (but not
1167 `FILE.top' and `FILE.bot') in directory DIR instead of in the
1172 Look for the installed macro files and `acconfig.h' in directory
1173 DIR. You can also set the `AC_MACRODIR' environment variable to a
1174 directory; this option overrides the environment variable.
1177 Print the version number of Autoconf and exit.
1180 File: autoconf.info, Node: Subdirectories, Next: Default Prefix, Prev: Configuration Headers, Up: Setup
1182 Configuring Other Packages in Subdirectories
1183 ============================================
1185 In most situations, calling `AC_OUTPUT' is sufficient to produce
1186 `Makefile's in subdirectories. However, `configure' scripts that
1187 control more than one independent package can use `AC_CONFIG_SUBDIRS'
1188 to run `configure' scripts for other packages in subdirectories.
1190 - Macro: AC_CONFIG_SUBDIRS (DIR ...)
1191 Make `AC_OUTPUT' run `configure' in each subdirectory DIR in the
1192 given whitespace-separated list. If a given DIR is not found, no
1193 error is reported, so a `configure' script can configure whichever
1194 parts of a large source tree are present. If a given DIR contains
1195 `configure.in' but no `configure', the Cygnus `configure' script
1196 found by `AC_CONFIG_AUXDIR' is used.
1198 The subdirectory `configure' scripts are given the same command
1199 line options that were given to this `configure' script, with
1200 minor changes if needed (e.g., to adjust a relative path for the
1201 cache file or source directory). This macro also sets the output
1202 variable `subdirs' to the list of directories `DIR ...'.
1203 `Makefile' rules can use this variable to determine which
1204 subdirectories to recurse into. This macro may be called multiple
1208 File: autoconf.info, Node: Default Prefix, Next: Versions, Prev: Subdirectories, Up: Setup
1213 By default, `configure' sets the prefix for files it installs to
1214 `/usr/local'. The user of `configure' can select a different prefix
1215 using the `--prefix' and `--exec-prefix' options. There are two ways
1216 to change the default: when creating `configure', and when running it.
1218 Some software packages might want to install in a directory besides
1219 `/usr/local' by default. To accomplish that, use the
1220 `AC_PREFIX_DEFAULT' macro.
1222 - Macro: AC_PREFIX_DEFAULT (PREFIX)
1223 Set the default installation prefix to PREFIX instead of
1226 It may be convenient for users to have `configure' guess the
1227 installation prefix from the location of a related program that they
1228 have already installed. If you wish to do that, you can call
1229 `AC_PREFIX_PROGRAM'.
1231 - Macro: AC_PREFIX_PROGRAM (PROGRAM)
1232 If the user did not specify an installation prefix (using the
1233 `--prefix' option), guess a value for it by looking for PROGRAM in
1234 `PATH', the way the shell does. If PROGRAM is found, set the
1235 prefix to the parent of the directory containing PROGRAM;
1236 otherwise leave the prefix specified in `Makefile.in' unchanged.
1237 For example, if PROGRAM is `gcc' and the `PATH' contains
1238 `/usr/local/gnu/bin/gcc', set the prefix to `/usr/local/gnu'.
1241 File: autoconf.info, Node: Versions, Prev: Default Prefix, Up: Setup
1243 Version Numbers in `configure'
1244 ==============================
1246 The following macros manage version numbers for `configure' scripts.
1247 Using them is optional.
1249 - Macro: AC_PREREQ (VERSION)
1250 Ensure that a recent enough version of Autoconf is being used. If
1251 the version of Autoconf being used to create `configure' is earlier
1252 than VERSION, print an error message on the standard error output
1253 and do not create `configure'. For example:
1257 This macro is useful if your `configure.in' relies on non-obvious
1258 behavior that changed between Autoconf releases. If it merely
1259 needs recently added macros, then `AC_PREREQ' is less useful,
1260 because the `autoconf' program already tells the user which macros
1261 are not found. The same thing happens if `configure.in' is
1262 processed by a version of Autoconf older than when `AC_PREREQ' was
1265 - Macro: AC_REVISION (REVISION-INFO)
1266 Copy revision stamp REVISION-INFO into the `configure' script,
1267 with any dollar signs or double-quotes removed. This macro lets
1268 you put a revision stamp from `configure.in' into `configure'
1269 without RCS or CVS changing it when you check in `configure'. That
1270 way, you can determine easily which revision of `configure.in' a
1271 particular `configure' corresponds to.
1273 It is a good idea to call this macro before `AC_INIT' so that the
1274 revision number is near the top of both `configure.in' and
1275 `configure'. To support doing that, the `AC_REVISION' output
1276 begins with `#! /bin/sh', like the normal start of a `configure'
1279 For example, this line in `configure.in':
1281 AC_REVISION($Revision: 1.30 $)dnl
1283 produces this in `configure':
1286 # From configure.in Revision: 1.30
1289 File: autoconf.info, Node: Existing Tests, Next: Writing Tests, Prev: Setup, Up: Top
1294 These macros test for particular system features that packages might
1295 need or want to use. If you need to test for a kind of feature that
1296 none of these macros check for, you can probably do it by calling
1297 primitive test macros with appropriate arguments (*note Writing
1300 These tests print messages telling the user which feature they're
1301 checking for, and what they find. They cache their results for future
1302 `configure' runs (*note Caching Results::.).
1304 Some of these macros set output variables. *Note Makefile
1305 Substitutions::, for how to get their values. The phrase "define NAME"
1306 is used below as a shorthand to mean "define C preprocessor symbol NAME
1307 to the value 1". *Note Defining Symbols::, for how to get those symbol
1308 definitions into your program.
1312 * Alternative Programs:: Selecting between alternative programs.
1313 * Libraries:: Library archives that might be missing.
1314 * Library Functions:: C library functions that might be missing.
1315 * Header Files:: Header files that might be missing.
1316 * Structures:: Structures or members that might be missing.
1317 * Typedefs:: `typedef's that might be missing.
1318 * C Compiler Characteristics::
1319 * Fortran 77 Compiler Characteristics::
1320 * System Services:: Operating system services.
1321 * UNIX Variants:: Special kludges for specific UNIX variants.
1324 File: autoconf.info, Node: Alternative Programs, Next: Libraries, Prev: Existing Tests, Up: Existing Tests
1326 Alternative Programs
1327 ====================
1329 These macros check for the presence or behavior of particular
1330 programs. They are used to choose between several alternative programs
1331 and to decide what to do once one has been chosen. If there is no
1332 macro specifically defined to check for a program you need, and you
1333 don't need to check for any special properties of it, then you can use
1334 one of the general program check macros.
1338 * Particular Programs:: Special handling to find certain programs.
1339 * Generic Programs:: How to find other programs.
1342 File: autoconf.info, Node: Particular Programs, Next: Generic Programs, Prev: Alternative Programs, Up: Alternative Programs
1344 Particular Program Checks
1345 -------------------------
1347 These macros check for particular programs--whether they exist, and
1348 in some cases whether they support certain features.
1350 - Macro: AC_DECL_YYTEXT
1351 Define `YYTEXT_POINTER' if `yytext' is a `char *' instead of a
1352 `char []'. Also set output variable `LEX_OUTPUT_ROOT' to the base
1353 of the file name that the lexer generates; usually `lex.yy', but
1354 sometimes something else. These results vary according to whether
1355 `lex' or `flex' is being used.
1357 - Macro: AC_PROG_AWK
1358 Check for `mawk', `gawk', `nawk', and `awk', in that order, and
1359 set output variable `AWK' to the first one that it finds. It
1360 tries `mawk' first because that is reported to be the fastest
1364 Determine a C compiler to use. If `CC' is not already set in the
1365 environment, check for `gcc', and use `cc' if that's not found.
1366 Set output variable `CC' to the name of the compiler found.
1368 If using the GNU C compiler, set shell variable `GCC' to `yes',
1369 empty otherwise. If output variable `CFLAGS' was not already set,
1370 set it to `-g -O2' for the GNU C compiler (`-O2' on systems where
1371 GCC does not accept `-g'), or `-g' for other compilers.
1373 If the C compiler being used does not produce executables that can
1374 run on the system where `configure' is being run, set the shell
1375 variable `cross_compiling' to `yes', otherwise `no'. In other
1376 words, this tests whether the build system type is different from
1377 the host system type (the target system type is irrelevant to this
1378 test). *Note Manual Configuration::, for more on support for
1381 - Macro: AC_PROG_CC_C_O
1382 If the C compiler does not accept the `-c' and `-o' options
1383 simultaneously, define `NO_MINUS_C_MINUS_O'.
1385 - Macro: AC_PROG_CPP
1386 Set output variable `CPP' to a command that runs the C
1387 preprocessor. If `$CC -E' doesn't work, it uses `/lib/cpp'. It
1388 is only portable to run `CPP' on files with a `.c' extension.
1390 If the current language is C (*note Language Choice::.), many of
1391 the specific test macros use the value of `CPP' indirectly by
1392 calling `AC_TRY_CPP', `AC_CHECK_HEADER', `AC_EGREP_HEADER', or
1395 - Macro: AC_PROG_CXX
1396 Determine a C++ compiler to use. Check if the environment variable
1397 `CXX' or `CCC' (in that order) is set; if so, set output variable
1398 `CXX' to its value. Otherwise search for a C++ compiler under
1399 likely names (`c++', `g++', `gcc', `CC', `cxx', and `cc++'). If
1400 none of those checks succeed, as a last resort set `CXX' to `gcc'.
1402 If using the GNU C++ compiler, set shell variable `GXX' to `yes',
1403 empty otherwise. If output variable `CXXFLAGS' was not already
1404 set, set it to `-g -O2' for the GNU C++ compiler (`-O2' on systems
1405 where G++ does not accept `-g'), or `-g' for other compilers.
1407 If the C++ compiler being used does not produce executables that
1408 can run on the system where `configure' is being run, set the shell
1409 variable `cross_compiling' to `yes', otherwise `no'. In other
1410 words, this tests whether the build system type is different from
1411 the host system type (the target system type is irrelevant to this
1412 test). *Note Manual Configuration::, for more on support for
1415 - Macro: AC_PROG_CXXCPP
1416 Set output variable `CXXCPP' to a command that runs the C++
1417 preprocessor. If `$CXX -E' doesn't work, it uses `/lib/cpp'. It
1418 is only portable to run `CXXCPP' on files with a `.c', `.C', or
1421 If the current language is C++ (*note Language Choice::.), many of
1422 the specific test macros use the value of `CXXCPP' indirectly by
1423 calling `AC_TRY_CPP', `AC_CHECK_HEADER', `AC_EGREP_HEADER', or
1426 - Macro: AC_PROG_F77
1427 Determine a Fortran 77 compiler to use. If `F77' is not already
1428 set in the environment, check for `g77', `f77' and `f2c', in that
1429 order. Set the output variable `F77' to the name of the compiler
1432 If using `g77' (the GNU Fortran 77 compiler), then `AC_PROG_F77'
1433 will set the shell variable `G77' to `yes', and empty otherwise.
1434 If the output variable `FFLAGS' was not already set in the
1435 environment, then set it to `-g -02' for `g77' (or `-O2' where
1436 `g77' does not accept `-g'). Otherwise, set `FFLAGS' to `-g' for
1437 all other Fortran 77 compilers.
1439 - Macro: AC_PROG_F77_C_O
1440 Test if the Fortran 77 compiler accepts the options `-c' and `-o'
1441 simultaneously, and define `F77_NO_MINUS_C_MINUS_O' if it does not.
1443 - Macro: AC_PROG_GCC_TRADITIONAL
1444 Add `-traditional' to output variable `CC' if using the GNU C
1445 compiler and `ioctl' does not work properly without
1446 `-traditional'. That usually happens when the fixed header files
1447 have not been installed on an old system. Since recent versions
1448 of the GNU C compiler fix the header files automatically when
1449 installed, this is becoming a less prevalent problem.
1451 - Macro: AC_PROG_INSTALL
1452 Set output variable `INSTALL' to the path of a BSD compatible
1453 `install' program, if one is found in the current `PATH'.
1454 Otherwise, set `INSTALL' to `DIR/install-sh -c', checking the
1455 directories specified to `AC_CONFIG_AUX_DIR' (or its default
1456 directories) to determine DIR (*note Output::.). Also set the
1457 variables `INSTALL_PROGRAM' and `INSTALL_SCRIPT' to `${INSTALL}'
1458 and `INSTALL_DATA' to `${INSTALL} -m 644'.
1460 This macro screens out various instances of `install' known to not
1461 work. It prefers to find a C program rather than a shell script,
1462 for speed. Instead of `install-sh', it can also use `install.sh',
1463 but that name is obsolete because some `make' programs have a rule
1464 that creates `install' from it if there is no `Makefile'.
1466 A copy of `install-sh' which you may use comes with Autoconf. If
1467 you use `AC_PROG_INSTALL', you must include either `install-sh' or
1468 `install.sh' in your distribution, or `configure' will produce an
1469 error message saying it can't find them--even if the system you're
1470 on has a good `install' program. This check is a safety measure
1471 to prevent you from accidentally leaving that file out, which
1472 would prevent your package from installing on systems that don't
1473 have a BSD-compatible `install' program.
1475 If you need to use your own installation program because it has
1476 features not found in standard `install' programs, there is no
1477 reason to use `AC_PROG_INSTALL'; just put the pathname of your
1478 program into your `Makefile.in' files.
1480 - Macro: AC_PROG_LEX
1481 If `flex' is found, set output variable `LEX' to `flex' and
1482 `LEXLIB' to `-lfl', if that library is in a standard place.
1483 Otherwise set `LEX' to `lex' and `LEXLIB' to `-ll'.
1485 - Macro: AC_PROG_LN_S
1486 If `ln -s' works on the current filesystem (the operating system
1487 and filesystem support symbolic links), set output variable `LN_S'
1488 to `ln -s', otherwise set it to `ln'.
1490 If the link is put in a directory other than the current
1491 directory, its meaning depends on whether `ln' or `ln -s' is used.
1492 To safely create links using `$(LN_S)', either find out which
1493 form is used and adjust the arguments, or always invoke `ln' in
1494 the directory where the link is to be created.
1496 In other words, it does not work to do
1501 (cd /x && $(LN_S) foo bar)
1503 - Macro: AC_PROG_RANLIB
1504 Set output variable `RANLIB' to `ranlib' if `ranlib' is found,
1505 otherwise to `:' (do nothing).
1507 - Macro: AC_PROG_YACC
1508 If `bison' is found, set output variable `YACC' to `bison -y'.
1509 Otherwise, if `byacc' is found, set `YACC' to `byacc'. Otherwise
1510 set `YACC' to `yacc'.
1513 File: autoconf.info, Node: Generic Programs, Prev: Particular Programs, Up: Alternative Programs
1515 Generic Program and File Checks
1516 -------------------------------
1518 These macros are used to find programs not covered by the particular
1519 test macros. If you need to check the behavior of a program as well as
1520 find out whether it is present, you have to write your own test for it
1521 (*note Writing Tests::.). By default, these macros use the environment
1522 variable `PATH'. If you need to check for a program that might not be
1523 in the user's `PATH', you can pass a modified path to use instead, like
1526 AC_PATH_PROG(INETD, inetd, /usr/libexec/inetd,
1527 $PATH:/usr/libexec:/usr/sbin:/usr/etc:etc)
1529 - Macro: AC_CHECK_FILE (FILE [, ACTION-IF-FOUND [,
1530 ACTION-IF-NOT-FOUND]])
1531 Check whether file FILE exists on the native system. If it is
1532 found, execute ACTION-IF-FOUND, otherwise do ACTION-IF-NOT-FOUND,
1535 - Macro: AC_CHECK_FILES (FILES[, ACTION-IF-FOUND [,
1536 ACTION-IF-NOT-FOUND]])
1537 Executes `AC_CHECK_FILE' once for each file listed in FILES.
1538 Additionally, defines `HAVEFILE' for each file found, set to 1.
1540 - Macro: AC_CHECK_PROG (VARIABLE, PROG-TO-CHECK-FOR, VALUE-IF-FOUND [,
1541 VALUE-IF-NOT-FOUND [, PATH, [ REJECT ]]])
1542 Check whether program PROG-TO-CHECK-FOR exists in `PATH'. If it
1543 is found, set VARIABLE to VALUE-IF-FOUND, otherwise to
1544 VALUE-IF-NOT-FOUND, if given. Always pass over REJECT (an
1545 absolute file name) even if it is the first found in the search
1546 path; in that case, set VARIABLE using the absolute file name of
1547 the PROG-TO-CHECK-FOR found that is not REJECT. If VARIABLE was
1548 already set, do nothing. Calls `AC_SUBST' for VARIABLE.
1550 - Macro: AC_CHECK_PROGS (VARIABLE, PROGS-TO-CHECK-FOR [,
1551 VALUE-IF-NOT-FOUND [, PATH]])
1552 Check for each program in the whitespace-separated list
1553 PROGS-TO-CHECK-FOR exists in `PATH'. If it is found, set VARIABLE
1554 to the name of that program. Otherwise, continue checking the
1555 next program in the list. If none of the programs in the list are
1556 found, set VARIABLE to VALUE-IF-NOT-FOUND; if VALUE-IF-NOT-FOUND
1557 is not specified, the value of VARIABLE is not changed. Calls
1558 `AC_SUBST' for VARIABLE.
1560 - Macro: AC_CHECK_TOOL (VARIABLE, PROG-TO-CHECK-FOR [,
1561 VALUE-IF-NOT-FOUND [, PATH]])
1562 Like `AC_CHECK_PROG', but first looks for PROG-TO-CHECK-FOR with a
1563 prefix of the host type as determined by `AC_CANONICAL_HOST',
1564 followed by a dash (*note Canonicalizing::.). For example, if the
1565 user runs `configure --host=i386-gnu', then this call:
1566 AC_CHECK_TOOL(RANLIB, ranlib, :)
1568 sets `RANLIB' to `i386-gnu-ranlib' if that program exists in
1569 `PATH', or to `ranlib' if that program exists in `PATH', or to `:'
1570 if neither program exists.
1572 - Macro: AC_PATH_PROG (VARIABLE, PROG-TO-CHECK-FOR [,
1573 VALUE-IF-NOT-FOUND [, PATH]])
1574 Like `AC_CHECK_PROG', but set VARIABLE to the entire path of
1575 PROG-TO-CHECK-FOR if found.
1577 - Macro: AC_PATH_PROGS (VARIABLE, PROGS-TO-CHECK-FOR [,
1578 VALUE-IF-NOT-FOUND [, PATH]])
1579 Like `AC_CHECK_PROGS', but if any of PROGS-TO-CHECK-FOR are found,
1580 set VARIABLE to the entire path of the program found.
1583 File: autoconf.info, Node: Libraries, Next: Library Functions, Prev: Alternative Programs, Up: Existing Tests
1588 The following macros check for the presence of certain C, C++ or
1589 Fortran 77 library archive files.
1591 - Macro: AC_CHECK_LIB (LIBRARY, FUNCTION [, ACTION-IF-FOUND [,
1592 ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]])
1593 Depending on the current language(*note Language Choice::.), try to
1594 ensure that the C, C++ or Fortran 77 function FUNCTION is
1595 available by checking whether a test program can be linked with the
1596 library LIBRARY to get the function. LIBRARY is the base name of
1597 the library; e.g., to check for `-lmp', use `mp' as the LIBRARY
1600 ACTION-IF-FOUND is a list of shell commands to run if the link
1601 with the library succeeds; ACTION-IF-NOT-FOUND is a list of shell
1602 commands to run if the link fails. If ACTION-IF-FOUND is not
1603 specified, the default action will add `-lLIBRARY' to `LIBS' and
1604 define `HAVE_LIBLIBRARY' (in all capitals).
1606 If linking with LIBRARY results in unresolved symbols, which would
1607 be resolved by linking with additional libraries, give those
1608 libraries as the OTHER-LIBRARIES argument, separated by spaces:
1609 `-lXt -lX11'. Otherwise this macro will fail to detect that
1610 LIBRARY is present, because linking the test program will always
1611 fail with unresolved symbols.
1613 - Macro: AC_HAVE_LIBRARY (LIBRARY, [, ACTION-IF-FOUND [,
1614 ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]])
1615 This macro is equivalent to calling `AC_CHECK_LIB' with a FUNCTION
1616 argument of `main'. In addition, LIBRARY can be written as any of
1617 `foo', `-lfoo', or `libfoo.a'. In all of those cases, the
1618 compiler is passed `-lfoo'. However, LIBRARY can not be a shell
1619 variable; it must be a literal name. This macro is considered
1622 - Macro: AC_SEARCH_LIBS (FUNCTION, SEARCH-LIBS [, ACTION-IF-FOUND [,
1623 ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]])
1624 Search for a library defining FUNCTION, if it's not already
1625 available. This equates to calling `AC_TRY_LINK_FUNC' first with
1626 no libraries, then for each library listed in SEARCH-LIBS.
1628 If the function is found, run ACTION-IF-FOUND, otherwise run
1629 ACTION-IF-NOT-FOUND.
1631 If linking with LIBRARY results in unresolved symbols, which would
1632 be resolved by linking with additional libraries, give those
1633 libraries as the OTHER-LIBRARIES argument, separated by spaces:
1634 `-lXt -lX11'. Otherwise this macro will fail to detect that
1635 FUNCTION is present, because linking the test program will always
1636 fail with unresolved symbols.
1638 - Macro: AC_SEARCH_LIBS (FUNCTION, SEARCH-LIBS[, ACTION-IF-FOUND [,
1639 ACTION-IF-NOT-FOUND]])
1640 This macro is equivalent to calling `AC_TRY_LINK_FUNC' once for
1641 each library listed in SEARCH-LIBS. Add `-lLIBRARY' to `LIBS' for
1642 the first library found to contain FUNCTION, and execute
1643 ACTION-IF-FOUND. Otherwise execute ACTION-IF-NOT-FOUND.
1646 File: autoconf.info, Node: Library Functions, Next: Header Files, Prev: Libraries, Up: Existing Tests
1651 The following macros check for particular C library functions. If
1652 there is no macro specifically defined to check for a function you need,
1653 and you don't need to check for any special properties of it, then you
1654 can use one of the general function check macros.
1658 * Particular Functions:: Special handling to find certain functions.
1659 * Generic Functions:: How to find other functions.
1662 File: autoconf.info, Node: Particular Functions, Next: Generic Functions, Prev: Library Functions, Up: Library Functions
1664 Particular Function Checks
1665 --------------------------
1667 These macros check for particular C functions--whether they exist,
1668 and in some cases how they respond when given certain arguments.
1670 - Macro: AC_FUNC_ALLOCA
1671 Check how to get `alloca'. Tries to get a builtin version by
1672 checking for `alloca.h' or the predefined C preprocessor macros
1673 `__GNUC__' and `_AIX'. If this macro finds `alloca.h', it defines
1676 If those attempts fail, it looks for the function in the standard C
1677 library. If any of those methods succeed, it defines
1678 `HAVE_ALLOCA'. Otherwise, it sets the output variable `ALLOCA' to
1679 `alloca.o' and defines `C_ALLOCA' (so programs can periodically
1680 call `alloca(0)' to garbage collect). This variable is separate
1681 from `LIBOBJS' so multiple programs can share the value of
1682 `ALLOCA' without needing to create an actual library, in case only
1683 some of them use the code in `LIBOBJS'.
1685 This macro does not try to get `alloca' from the System V R3
1686 `libPW' or the System V R4 `libucb' because those libraries
1687 contain some incompatible functions that cause trouble. Some
1688 versions do not even contain `alloca' or contain a buggy version.
1689 If you still want to use their `alloca', use `ar' to extract
1690 `alloca.o' from them instead of compiling `alloca.c'.
1692 Source files that use `alloca' should start with a piece of code
1693 like the following, to declare it properly. In some versions of
1694 AIX, the declaration of `alloca' must precede everything else
1695 except for comments and preprocessor directives. The `#pragma'
1696 directive is indented so that pre-ANSI C compilers will ignore it,
1697 rather than choke on it.
1699 /* AIX requires this to be the first thing in the file. */
1702 # include <alloca.h>
1707 # ifndef alloca /* predefined by HP cc +Olibcalls */
1714 - Macro: AC_FUNC_CLOSEDIR_VOID
1715 If the `closedir' function does not return a meaningful value,
1716 define `CLOSEDIR_VOID'. Otherwise, callers ought to check its
1717 return value for an error indicator.
1719 - Macro: AC_FUNC_FNMATCH
1720 If the `fnmatch' function is available and works (unlike the one on
1721 SunOS 5.4), define `HAVE_FNMATCH'.
1723 - Macro: AC_FUNC_GETLOADAVG
1724 Check how to get the system load averages. If the system has the
1725 `getloadavg' function, this macro defines `HAVE_GETLOADAVG', and
1726 adds to `LIBS' any libraries needed to get that function.
1728 Otherwise, it adds `getloadavg.o' to the output variable
1729 `LIBOBJS', and possibly defines several other C preprocessor
1730 macros and output variables:
1732 1. It defines `SVR4', `DGUX', `UMAX', or `UMAX4_3' if on those
1735 2. If it finds `nlist.h', it defines `NLIST_STRUCT'.
1737 3. If `struct nlist' has an `n_un' member, it defines
1740 4. If compiling `getloadavg.c' defines `LDAV_PRIVILEGED',
1741 programs need to be installed specially on this system for
1742 `getloadavg' to work, and this macro defines
1743 `GETLOADAVG_PRIVILEGED'.
1745 5. This macro sets the output variable `NEED_SETGID'. The value
1746 is `true' if special installation is required, `false' if not.
1747 If `NEED_SETGID' is `true', this macro sets `KMEM_GROUP' to
1748 the name of the group that should own the installed program.
1750 - Macro: AC_FUNC_GETMNTENT
1751 Check for `getmntent' in the `sun', `seq', and `gen' libraries,
1752 for Irix 4, PTX, and Unixware, respectively. Then, if `getmntent'
1753 is available, define `HAVE_GETMNTENT'.
1755 - Macro: AC_FUNC_GETPGRP
1756 If `getpgrp' takes no argument (the POSIX.1 version), define
1757 `GETPGRP_VOID'. Otherwise, it is the BSD version, which takes a
1758 process ID as an argument. This macro does not check whether
1759 `getpgrp' exists at all; if you need to work in that situation,
1760 first call `AC_CHECK_FUNC' for `getpgrp'.
1762 - Macro: AC_FUNC_MEMCMP
1763 If the `memcmp' function is not available, or does not work on
1764 8-bit data (like the one on SunOS 4.1.3), add `memcmp.o' to output
1767 - Macro: AC_FUNC_MMAP
1768 If the `mmap' function exists and works correctly, define
1769 `HAVE_MMAP'. Only checks private fixed mapping of already-mapped
1772 - Macro: AC_FUNC_SELECT_ARGTYPES
1773 Determines the correct type to be passed to each of the `select'
1774 function's arguments, and defines those types in
1775 `SELECT_TYPE_ARG1', `SELECT_TYPE_ARG234', and `SELECT_TYPE_ARG5'
1776 respectively. `SELECT_TYPE_ARG1' defaults to `int',
1777 `SELECT_TYPE_ARG234' defaults to `int *', and `SELECT_TYPE_ARG5'
1778 defaults to `struct timeval *'.
1780 - Macro: AC_FUNC_SETPGRP
1781 If `setpgrp' takes no argument (the POSIX.1 version), define
1782 `SETPGRP_VOID'. Otherwise, it is the BSD version, which takes two
1783 process ID as arguments. This macro does not check whether
1784 `setpgrp' exists at all; if you need to work in that situation,
1785 first call `AC_CHECK_FUNC' for `setpgrp'.
1787 - Macro: AC_FUNC_SETVBUF_REVERSED
1788 If `setvbuf' takes the buffering type as its second argument and
1789 the buffer pointer as the third, instead of the other way around,
1790 define `SETVBUF_REVERSED'. This is the case on System V before
1793 - Macro: AC_FUNC_STRCOLL
1794 If the `strcoll' function exists and works correctly, define
1795 `HAVE_STRCOLL'. This does a bit more than
1796 `AC_CHECK_FUNCS(strcoll)', because some systems have incorrect
1797 definitions of `strcoll', which should not be used.
1799 - Macro: AC_FUNC_STRFTIME
1800 Check for `strftime' in the `intl' library, for SCO UNIX. Then,
1801 if `strftime' is available, define `HAVE_STRFTIME'.
1803 - Macro: AC_FUNC_UTIME_NULL
1804 If `utime(FILE, NULL)' sets FILE's timestamp to the present,
1805 define `HAVE_UTIME_NULL'.
1807 - Macro: AC_FUNC_VFORK
1808 If `vfork.h' is found, define `HAVE_VFORK_H'. If a working
1809 `vfork' is not found, define `vfork' to be `fork'. This macro
1810 checks for several known errors in implementations of `vfork' and
1811 considers the system to not have a working `vfork' if it detects
1812 any of them. It is not considered to be an implementation error
1813 if a child's invocation of `signal' modifies the parent's signal
1814 handler, since child processes rarely change their signal handlers.
1816 - Macro: AC_FUNC_VPRINTF
1817 If `vprintf' is found, define `HAVE_VPRINTF'. Otherwise, if
1818 `_doprnt' is found, define `HAVE_DOPRNT'. (If `vprintf' is
1819 available, you may assume that `vfprintf' and `vsprintf' are also
1822 - Macro: AC_FUNC_WAIT3
1823 If `wait3' is found and fills in the contents of its third argument
1824 (a `struct rusage *'), which HP-UX does not do, define
1828 File: autoconf.info, Node: Generic Functions, Prev: Particular Functions, Up: Library Functions
1830 Generic Function Checks
1831 -----------------------
1833 These macros are used to find functions not covered by the particular
1834 test macros. If the functions might be in libraries other than the
1835 default C library, first call `AC_CHECK_LIB' for those libraries. If
1836 you need to check the behavior of a function as well as find out
1837 whether it is present, you have to write your own test for it (*note
1840 - Macro: AC_CHECK_FUNC (FUNCTION, [ACTION-IF-FOUND [,
1841 ACTION-IF-NOT-FOUND]])
1842 If C function FUNCTION is available, run shell commands
1843 ACTION-IF-FOUND, otherwise ACTION-IF-NOT-FOUND. If you just want
1844 to define a symbol if the function is available, consider using
1845 `AC_CHECK_FUNCS' instead. This macro checks for functions with C
1846 linkage even when `AC_LANG_CPLUSPLUS' has been called, since C++ is
1847 more standardized than C is. (*note Language Choice::., for more
1848 information about selecting the language for checks.)
1850 - Macro: AC_CHECK_FUNCS (FUNCTION... [, ACTION-IF-FOUND [,
1851 ACTION-IF-NOT-FOUND]])
1852 For each given FUNCTION in the whitespace-separated argument list
1853 that is available, define `HAVE_FUNCTION' (in all capitals). If
1854 ACTION-IF-FOUND is given, it is additional shell code to execute
1855 when one of the functions is found. You can give it a value of
1856 `break' to break out of the loop on the first match. If
1857 ACTION-IF-NOT-FOUND is given, it is executed when one of the
1858 functions is not found.
1860 - Macro: AC_REPLACE_FUNCS (FUNCTION...)
1861 Like calling `AC_CHECK_FUNCS' using an ACTION-IF-NOT-FOUND that
1862 adds `FUNCTION.o' to the value of the output variable `LIBOBJS'.
1863 You can declare a function for which your replacement version is
1864 used by enclosing the prototype in `#ifndef HAVE_FUNCTION'. If
1865 the system has the function, it probably declares it in a header
1866 file you should be including, so you shouldn't redeclare it, lest
1867 your declaration conflict.
1870 File: autoconf.info, Node: Header Files, Next: Structures, Prev: Library Functions, Up: Existing Tests
1875 The following macros check for the presence of certain C header
1876 files. If there is no macro specifically defined to check for a header
1877 file you need, and you don't need to check for any special properties of
1878 it, then you can use one of the general header file check macros.
1882 * Particular Headers:: Special handling to find certain headers.
1883 * Generic Headers:: How to find other headers.
1886 File: autoconf.info, Node: Particular Headers, Next: Generic Headers, Prev: Header Files, Up: Header Files
1888 Particular Header Checks
1889 ------------------------
1891 These macros check for particular system header files--whether they
1892 exist, and in some cases whether they declare certain symbols.
1894 - Macro: AC_DECL_SYS_SIGLIST
1895 Define `SYS_SIGLIST_DECLARED' if the variable `sys_siglist' is
1896 declared in a system header file, either `signal.h' or `unistd.h'.
1898 - Macro: AC_DIR_HEADER
1899 Like calling `AC_HEADER_DIRENT' and `AC_FUNC_CLOSEDIR_VOID', but
1900 defines a different set of C preprocessor macros to indicate which
1901 header file is found. This macro and the names it defines are
1902 considered obsolete. The names it defines are:
1916 In addition, if the `closedir' function does not return a
1917 meaningful value, define `VOID_CLOSEDIR'.
1919 - Macro: AC_HEADER_DIRENT
1920 Check for the following header files, and for the first one that is
1921 found and defines `DIR', define the listed C preprocessor macro:
1935 The directory library declarations in the source code should look
1936 something like the following:
1939 # include <dirent.h>
1940 # define NAMLEN(dirent) strlen((dirent)->d_name)
1942 # define dirent direct
1943 # define NAMLEN(dirent) (dirent)->d_namlen
1944 # if HAVE_SYS_NDIR_H
1945 # include <sys/ndir.h>
1948 # include <sys/dir.h>
1955 Using the above declarations, the program would declare variables
1956 to be type `struct dirent', not `struct direct', and would access
1957 the length of a directory entry name by passing a pointer to a
1958 `struct dirent' to the `NAMLEN' macro.
1960 This macro also checks for the SCO Xenix `dir' and `x' libraries.
1962 - Macro: AC_HEADER_MAJOR
1963 If `sys/types.h' does not define `major', `minor', and `makedev',
1964 but `sys/mkdev.h' does, define `MAJOR_IN_MKDEV'; otherwise, if
1965 `sys/sysmacros.h' does, define `MAJOR_IN_SYSMACROS'.
1967 - Macro: AC_HEADER_STDC
1968 Define `STDC_HEADERS' if the system has ANSI C header files.
1969 Specifically, this macro checks for `stdlib.h', `stdarg.h',
1970 `string.h', and `float.h'; if the system has those, it probably
1971 has the rest of the ANSI C header files. This macro also checks
1972 whether `string.h' declares `memchr' (and thus presumably the
1973 other `mem' functions), whether `stdlib.h' declare `free' (and
1974 thus presumably `malloc' and other related functions), and whether
1975 the `ctype.h' macros work on characters with the high bit set, as
1978 Use `STDC_HEADERS' instead of `__STDC__' to determine whether the
1979 system has ANSI-compliant header files (and probably C library
1980 functions) because many systems that have GCC do not have ANSI C
1983 On systems without ANSI C headers, there is so much variation that
1984 it is probably easier to declare the functions you use than to
1985 figure out exactly what the system header files declare. Some
1986 systems contain a mix of functions ANSI and BSD; some are mostly
1987 ANSI but lack `memmove'; some define the BSD functions as macros in
1988 `string.h' or `strings.h'; some have only the BSD functions but
1989 `string.h'; some declare the memory functions in `memory.h', some
1990 in `string.h'; etc. It is probably sufficient to check for one
1991 string function and one memory function; if the library has the
1992 ANSI versions of those then it probably has most of the others.
1993 If you put the following in `configure.in':
1996 AC_CHECK_FUNCS(strchr memcpy)
1998 then, in your code, you can put declarations like this:
2001 # include <string.h>
2003 # ifndef HAVE_STRCHR
2004 # define strchr index
2005 # define strrchr rindex
2007 char *strchr (), *strrchr ();
2008 # ifndef HAVE_MEMCPY
2009 # define memcpy(d, s, n) bcopy ((s), (d), (n))
2010 # define memmove(d, s, n) bcopy ((s), (d), (n))
2014 If you use a function like `memchr', `memset', `strtok', or
2015 `strspn', which have no BSD equivalent, then macros won't suffice;
2016 you must provide an implementation of each function. An easy way
2017 to incorporate your implementations only when needed (since the
2018 ones in system C libraries may be hand optimized) is to, taking
2019 `memchr' for example, put it in `memchr.c' and use
2020 `AC_REPLACE_FUNCS(memchr)'.
2022 - Macro: AC_HEADER_SYS_WAIT
2023 If `sys/wait.h' exists and is compatible with POSIX.1, define
2024 `HAVE_SYS_WAIT_H'. Incompatibility can occur if `sys/wait.h' does
2025 not exist, or if it uses the old BSD `union wait' instead of `int'
2026 to store a status value. If `sys/wait.h' is not POSIX.1
2027 compatible, then instead of including it, define the POSIX.1
2028 macros with their usual interpretations. Here is an example:
2030 #include <sys/types.h>
2032 # include <sys/wait.h>
2035 # define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
2038 # define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
2041 - Macro: AC_MEMORY_H
2042 Define `NEED_MEMORY_H' if `memcpy', `memcmp', etc. are not
2043 declared in `string.h' and `memory.h' exists. This macro is
2044 obsolete; instead, use `AC_CHECK_HEADERS(memory.h)'. See the
2045 example for `AC_HEADER_STDC'.
2047 - Macro: AC_UNISTD_H
2048 Define `HAVE_UNISTD_H' if the system has `unistd.h'. This macro
2049 is obsolete; instead, use `AC_CHECK_HEADERS(unistd.h)'.
2051 The way to check if the system supports POSIX.1 is:
2054 # include <sys/types.h>
2055 # include <unistd.h>
2058 #ifdef _POSIX_VERSION
2059 /* Code for POSIX.1 systems. */
2062 `_POSIX_VERSION' is defined when `unistd.h' is included on POSIX.1
2063 systems. If there is no `unistd.h', it is definitely not a
2064 POSIX.1 system. However, some non-POSIX.1 systems do have
2068 Define `USG' if the system does not have `strings.h', `rindex',
2069 `bzero', etc. This implies that it has `string.h', `strrchr',
2072 The symbol `USG' is obsolete. Instead of this macro, see the
2073 example for `AC_HEADER_STDC'.
2076 File: autoconf.info, Node: Generic Headers, Prev: Particular Headers, Up: Header Files
2078 Generic Header Checks
2079 ---------------------
2081 These macros are used to find system header files not covered by the
2082 particular test macros. If you need to check the contents of a header
2083 as well as find out whether it is present, you have to write your own
2084 test for it (*note Writing Tests::.).
2086 - Macro: AC_CHECK_HEADER (HEADER-FILE, [ACTION-IF-FOUND [,
2087 ACTION-IF-NOT-FOUND]])
2088 If the system header file HEADER-FILE exists, execute shell
2089 commands ACTION-IF-FOUND, otherwise execute ACTION-IF-NOT-FOUND.
2090 If you just want to define a symbol if the header file is
2091 available, consider using `AC_CHECK_HEADERS' instead.
2093 - Macro: AC_CHECK_HEADERS (HEADER-FILE... [, ACTION-IF-FOUND [,
2094 ACTION-IF-NOT-FOUND]])
2095 For each given system header file HEADER-FILE in the
2096 whitespace-separated argument list that exists, define
2097 `HAVE_HEADER-FILE' (in all capitals). If ACTION-IF-FOUND is
2098 given, it is additional shell code to execute when one of the
2099 header files is found. You can give it a value of `break' to
2100 break out of the loop on the first match. If ACTION-IF-NOT-FOUND
2101 is given, it is executed when one of the header files is not found.
2104 File: autoconf.info, Node: Structures, Next: Typedefs, Prev: Header Files, Up: Existing Tests
2109 The following macros check for certain structures or structure
2110 members. To check structures not listed here, use `AC_EGREP_CPP'
2111 (*note Examining Declarations::.) or `AC_TRY_COMPILE' (*note Examining
2114 - Macro: AC_HEADER_STAT
2115 If the macros `S_ISDIR', `S_ISREG' et al. defined in `sys/stat.h'
2116 do not work properly (returning false positives), define
2117 `STAT_MACROS_BROKEN'. This is the case on Tektronix UTekV, Amdahl
2118 UTS and Motorola System V/88.
2120 - Macro: AC_HEADER_TIME
2121 If a program may include both `time.h' and `sys/time.h', define
2122 `TIME_WITH_SYS_TIME'. On some older systems, `sys/time.h'
2123 includes `time.h', but `time.h' is not protected against multiple
2124 inclusion, so programs should not explicitly include both files.
2125 This macro is useful in programs that use, for example, `struct
2126 timeval' or `struct timezone' as well as `struct tm'. It is best
2127 used in conjunction with `HAVE_SYS_TIME_H', which can be checked
2128 for using `AC_CHECK_HEADERS(sys/time.h)'.
2130 #if TIME_WITH_SYS_TIME
2131 # include <sys/time.h>
2134 # if HAVE_SYS_TIME_H
2135 # include <sys/time.h>
2141 - Macro: AC_STRUCT_ST_BLKSIZE
2142 If `struct stat' contains an `st_blksize' member, define
2145 - Macro: AC_STRUCT_ST_BLOCKS
2146 If `struct stat' contains an `st_blocks' member, define
2147 `HAVE_ST_BLOCKS'. Otherwise, add `fileblocks.o' to the output
2150 - Macro: AC_STRUCT_ST_RDEV
2151 If `struct stat' contains an `st_rdev' member, define
2154 - Macro: AC_STRUCT_TM
2155 If `time.h' does not define `struct tm', define `TM_IN_SYS_TIME',
2156 which means that including `sys/time.h' had better define `struct
2159 - Macro: AC_STRUCT_TIMEZONE
2160 Figure out how to get the current timezone. If `struct tm' has a
2161 `tm_zone' member, define `HAVE_TM_ZONE'. Otherwise, if the
2162 external array `tzname' is found, define `HAVE_TZNAME'.
2165 File: autoconf.info, Node: Typedefs, Next: C Compiler Characteristics, Prev: Structures, Up: Existing Tests
2170 The following macros check for C typedefs. If there is no macro
2171 specifically defined to check for a typedef you need, and you don't need
2172 to check for any special properties of it, then you can use a general
2173 typedef check macro.
2177 * Particular Typedefs:: Special handling to find certain types.
2178 * Generic Typedefs:: How to find other types.
2181 File: autoconf.info, Node: Particular Typedefs, Next: Generic Typedefs, Prev: Typedefs, Up: Typedefs
2183 Particular Typedef Checks
2184 -------------------------
2186 These macros check for particular C typedefs in `sys/types.h' and
2187 `stdlib.h' (if it exists).
2189 - Macro: AC_TYPE_GETGROUPS
2190 Define `GETGROUPS_T' to be whichever of `gid_t' or `int' is the
2191 base type of the array argument to `getgroups'.
2193 - Macro: AC_TYPE_MODE_T
2194 If `mode_t' is not defined, define `mode_t' to be `int'.
2196 - Macro: AC_TYPE_OFF_T
2197 If `off_t' is not defined, define `off_t' to be `long'.
2199 - Macro: AC_TYPE_PID_T
2200 If `pid_t' is not defined, define `pid_t' to be `int'.
2202 - Macro: AC_TYPE_SIGNAL
2203 If `signal.h' declares `signal' as returning a pointer to a
2204 function returning `void', define `RETSIGTYPE' to be `void';
2205 otherwise, define it to be `int'.
2207 Define signal handlers as returning type `RETSIGTYPE':
2215 - Macro: AC_TYPE_SIZE_T
2216 If `size_t' is not defined, define `size_t' to be `unsigned'.
2218 - Macro: AC_TYPE_UID_T
2219 If `uid_t' is not defined, define `uid_t' to be `int' and `gid_t'
2223 File: autoconf.info, Node: Generic Typedefs, Prev: Particular Typedefs, Up: Typedefs
2225 Generic Typedef Checks
2226 ----------------------
2228 This macro is used to check for typedefs not covered by the
2229 particular test macros.
2231 - Macro: AC_CHECK_TYPE (TYPE, DEFAULT)
2232 If the type TYPE is not defined in `sys/types.h', or `stdlib.h' or
2233 `stddef.h' if they exist, define it to be the C (or C++) builtin
2234 type DEFAULT; e.g., `short' or `unsigned'.
2237 File: autoconf.info, Node: C Compiler Characteristics, Next: Fortran 77 Compiler Characteristics, Prev: Typedefs, Up: Existing Tests
2239 C Compiler Characteristics
2240 ==========================
2242 The following macros check for C compiler or machine architecture
2243 features. To check for characteristics not listed here, use
2244 `AC_TRY_COMPILE' (*note Examining Syntax::.) or `AC_TRY_RUN' (*note Run
2247 - Macro: AC_C_BIGENDIAN
2248 If words are stored with the most significant byte first (like
2249 Motorola and SPARC, but not Intel and VAX, CPUs), define
2253 If the C compiler does not fully support the keyword `const',
2254 define `const' to be empty. Some C compilers that do not define
2255 `__STDC__' do support `const'; some compilers that define
2256 `__STDC__' do not completely support `const'. Programs can simply
2257 use `const' as if every C compiler supported it; for those that
2258 don't, the `Makefile' or configuration header file will define it
2261 - Macro: AC_C_INLINE
2262 If the C compiler supports the keyword `inline', do nothing.
2263 Otherwise define `inline' to `__inline__' or `__inline' if it
2264 accepts one of those, otherwise define `inline' to be empty.
2266 - Macro: AC_C_CHAR_UNSIGNED
2267 If the C type `char' is unsigned, define `__CHAR_UNSIGNED__',
2268 unless the C compiler predefines it.
2270 - Macro: AC_C_LONG_DOUBLE
2271 If the C compiler supports the `long double' type, define
2272 `HAVE_LONG_DOUBLE'. Some C compilers that do not define
2273 `__STDC__' do support the `long double' type; some compilers that
2274 define `__STDC__' do not support `long double'.
2276 - Macro: AC_C_STRINGIZE
2277 If the C preprocessor supports the stringizing operator, define
2278 `HAVE_STRINGIZE'. The stringizing operator is `#' and is found in
2279 macros such as this:
2283 - Macro: AC_CHECK_SIZEOF (TYPE [, CROSS-SIZE])
2284 Define `SIZEOF_UCTYPE' to be the size in bytes of the C (or C++)
2285 builtin type TYPE, e.g. `int' or `char *'. If `type' is unknown
2286 to the compiler, it gets a size of 0. UCTYPE is TYPE, with
2287 lowercase converted to uppercase, spaces changed to underscores,
2288 and asterisks changed to `P'. If cross-compiling, the value
2289 CROSS-SIZE is used if given, otherwise `configure' exits with an
2292 For example, the call
2293 AC_CHECK_SIZEOF(int *)
2295 defines `SIZEOF_INT_P' to be 8 on DEC Alpha AXP systems.
2297 - Macro: AC_INT_16_BITS
2298 If the C type `int' is 16 bits wide, define `INT_16_BITS'. This
2299 macro is obsolete; it is more general to use
2300 `AC_CHECK_SIZEOF(int)' instead.
2302 - Macro: AC_LONG_64_BITS
2303 If the C type `long int' is 64 bits wide, define `LONG_64_BITS'.
2304 This macro is obsolete; it is more general to use
2305 `AC_CHECK_SIZEOF(long)' instead.
2308 File: autoconf.info, Node: Fortran 77 Compiler Characteristics, Next: System Services, Prev: C Compiler Characteristics, Up: Existing Tests
2310 Fortran 77 Compiler Characteristics
2311 ===================================
2313 The following macros check for Fortran 77 compiler characteristics.
2314 To check for characteristics not listed here, use `AC_TRY_COMPILE'
2315 (*note Examining Syntax::.) or `AC_TRY_RUN' (*note Run Time::.), making
2316 sure to first set the current lanuage to Fortran 77 `AC_LANG_FORTRAN77'
2317 (*note Language Choice::.).
2319 - Macro: AC_F77_LIBRARY_LDFLAGS
2320 Determine the linker flags (e.g. `-L' and `-l') for the "Fortran
2321 77 intrinsic and run-time libraries" that are required to
2322 successfully link a Fortran 77 program or shared library. The
2323 output variable `FLIBS' is set to these flags.
2325 This macro is intended to be used in those situations when it is
2326 necessary to mix, e.g. C++ and Fortran 77 source code into a single
2327 program or shared library (*note Mixing Fortran 77 With C and C++:
2328 (automake)Mixing Fortran 77 With C and C++.).
2330 For example, if object files from a C++ and Fortran 77 compiler
2331 must be linked together, then the C++ compiler/linker must be used
2332 for linking (since special C++-ish things need to happen at link
2333 time like calling global constructors, instantiating templates,
2334 enabling exception support, etc.).
2336 However, the Fortran 77 intrinsic and run-time libraries must be
2337 linked in as well, but the C++ compiler/linker doesn't know by
2338 default how to add these Fortran 77 libraries. Hence, the macro
2339 `AC_F77_LIBRARY_LDFLAGS' was created to determine these Fortran 77
2343 File: autoconf.info, Node: System Services, Next: UNIX Variants, Prev: Fortran 77 Compiler Characteristics, Up: Existing Tests
2348 The following macros check for operating system services or
2352 Checks for the Cygwin environment. If present, sets shell variable
2353 `CYGWIN' to `yes'. If not present, sets `CYGWIN' to the empty
2357 Defines substitute variable `EXEEXT' based on the output of the
2358 compiler, after .c, .o, and .obj files have been excluded.
2359 Typically set to empty string if Unix, `.exe' or `.EXE' if Win32.
2362 Defines substitute variable `OBJEXT' based on the output of the
2363 compiler, after .c files have been excluded. Typically set to
2364 `.o' if Unix, `.obj' if Win32.
2367 Checks for the MingW32 compiler environment. If present, sets
2368 shell variable `MINGW32' to `yes'. If not present, sets `MINGW32'
2369 to the empty string.
2372 Try to locate the X Window System include files and libraries. If
2373 the user gave the command line options `--x-includes=DIR' and
2374 `--x-libraries=DIR', use those directories. If either or both
2375 were not given, get the missing values by running `xmkmf' on a
2376 trivial `Imakefile' and examining the `Makefile' that it produces.
2377 If that fails (such as if `xmkmf' is not present), look for them
2378 in several directories where they often reside. If either method
2379 is successful, set the shell variables `x_includes' and
2380 `x_libraries' to their locations, unless they are in directories
2381 the compiler searches by default.
2383 If both methods fail, or the user gave the command line option
2384 `--without-x', set the shell variable `no_x' to `yes'; otherwise
2385 set it to the empty string.
2387 - Macro: AC_PATH_XTRA
2388 An enhanced version of `AC_PATH_X'. It adds the C compiler flags
2389 that X needs to output variable `X_CFLAGS', and the X linker flags
2390 to `X_LIBS'. If X is not available, adds `-DX_DISPLAY_MISSING' to
2393 This macro also checks for special libraries that some systems
2394 need in order to compile X programs. It adds any that the system
2395 needs to output variable `X_EXTRA_LIBS'. And it checks for
2396 special X11R6 libraries that need to be linked with before
2397 `-lX11', and adds any found to the output variable `X_PRE_LIBS'.
2400 - Macro: AC_SYS_INTERPRETER
2401 Check whether the system supports starting scripts with a line of
2402 the form `#! /bin/csh' to select the interpreter to use for the
2403 script. After running this macro, shell code in `configure.in'
2404 can check the shell variable `interpval'; it will be set to `yes'
2405 if the system supports `#!', `no' if not.
2407 - Macro: AC_SYS_LONG_FILE_NAMES
2408 If the system supports file names longer than 14 characters, define
2409 `HAVE_LONG_FILE_NAMES'.
2411 - Macro: AC_SYS_RESTARTABLE_SYSCALLS
2412 If the system automatically restarts a system call that is
2413 interrupted by a signal, define `HAVE_RESTARTABLE_SYSCALLS'.
2416 File: autoconf.info, Node: UNIX Variants, Prev: System Services, Up: Existing Tests
2421 The following macros check for certain operating systems that need
2422 special treatment for some programs, due to exceptional oddities in
2423 their header files or libraries. These macros are warts; they will be
2424 replaced by a more systematic approach, based on the functions they make
2425 available or the environments they provide.
2428 If on AIX, define `_ALL_SOURCE'. Allows the use of some BSD
2429 functions. Should be called before any macros that run the C
2432 - Macro: AC_DYNIX_SEQ
2433 If on Dynix/PTX (Sequent UNIX), add `-lseq' to output variable
2434 `LIBS'. This macro is obsolete; instead, use `AC_FUNC_GETMNTENT'.
2436 - Macro: AC_IRIX_SUN
2437 If on IRIX (Silicon Graphics UNIX), add `-lsun' to output variable
2438 `LIBS'. This macro is obsolete. If you were using it to get
2439 `getmntent', use `AC_FUNC_GETMNTENT' instead. If you used it for
2440 the NIS versions of the password and group functions, use
2441 `AC_CHECK_LIB(sun, getpwnam)'.
2443 - Macro: AC_ISC_POSIX
2444 If on a POSIXized ISC UNIX, define `_POSIX_SOURCE' and add
2445 `-posix' (for the GNU C compiler) or `-Xp' (for other C compilers)
2446 to output variable `CC'. This allows the use of POSIX facilities.
2447 Must be called after `AC_PROG_CC' and before any other macros
2448 that run the C compiler.
2451 If on Minix, define `_MINIX' and `_POSIX_SOURCE' and define
2452 `_POSIX_1_SOURCE' to be 2. This allows the use of POSIX
2453 facilities. Should be called before any macros that run the C
2456 - Macro: AC_SCO_INTL
2457 If on SCO UNIX, add `-lintl' to output variable `LIBS'. This
2458 macro is obsolete; instead, use `AC_FUNC_STRFTIME'.
2460 - Macro: AC_XENIX_DIR
2461 If on Xenix, add `-lx' to output variable `LIBS'. Also, if
2462 `dirent.h' is being used, add `-ldir' to `LIBS'. This macro is
2463 obsolete; use `AC_HEADER_DIRENT' instead.
2466 File: autoconf.info, Node: Writing Tests, Next: Results, Prev: Existing Tests, Up: Top
2471 If the existing feature tests don't do something you need, you have
2472 to write new ones. These macros are the building blocks. They provide
2473 ways for other macros to check whether various kinds of features are
2474 available and report the results.
2476 This chapter contains some suggestions and some of the reasons why
2477 the existing tests are written the way they are. You can also learn a
2478 lot about how to write Autoconf tests by looking at the existing ones.
2479 If something goes wrong in one or more of the Autoconf tests, this
2480 information can help you understand the assumptions behind them, which
2481 might help you figure out how to best solve the problem.
2483 These macros check the output of the C compiler system. They do not
2484 cache the results of their tests for future use (*note Caching
2485 Results::.), because they don't know enough about the information they
2486 are checking for to generate a cache variable name. They also do not
2487 print any messages, for the same reason. The checks for particular
2488 kinds of C features call these macros and do cache their results and
2489 print messages about what they're checking for.
2491 When you write a feature test that could be applicable to more than
2492 one software package, the best thing to do is encapsulate it in a new
2493 macro. *Note Writing Macros::, for how to do that.
2497 * Examining Declarations:: Detecting header files and declarations.
2498 * Examining Syntax:: Detecting language syntax features.
2499 * Examining Libraries:: Detecting functions and global variables.
2500 * Run Time:: Testing for run-time features.
2501 * Portable Shell:: Shell script portability pitfalls.
2502 * Testing Values and Files:: Checking strings and files.
2503 * Multiple Cases:: Tests for several possible values.
2504 * Language Choice:: Selecting which language to use for testing.
2507 File: autoconf.info, Node: Examining Declarations, Next: Examining Syntax, Prev: Writing Tests, Up: Writing Tests
2509 Examining Declarations
2510 ======================
2512 The macro `AC_TRY_CPP' is used to check whether particular header
2513 files exist. You can check for one at a time, or more than one if you
2514 need several header files to all exist for some purpose.
2516 - Macro: AC_TRY_CPP (INCLUDES, [ACTION-IF-TRUE [, ACTION-IF-FALSE]])
2517 INCLUDES is C or C++ `#include' statements and declarations, on
2518 which shell variable, backquote, and backslash substitutions are
2519 performed. (Actually, it can be any C program, but other
2520 statements are probably not useful.) If the preprocessor produces
2521 no error messages while processing it, run shell commands
2522 ACTION-IF-TRUE. Otherwise run shell commands ACTION-IF-FALSE.
2524 This macro uses `CPPFLAGS', but not `CFLAGS', because `-g', `-O',
2525 etc. are not valid options to many C preprocessors.
2527 Here is how to find out whether a header file contains a particular
2528 declaration, such as a typedef, a structure, a structure member, or a
2529 function. Use `AC_EGREP_HEADER' instead of running `grep' directly on
2530 the header file; on some systems the symbol might be defined in another
2531 header file that the file you are checking `#include's.
2533 - Macro: AC_EGREP_HEADER (PATTERN, HEADER-FILE, ACTION-IF-FOUND [,
2534 ACTION-IF-NOT-FOUND])
2535 If the output of running the preprocessor on the system header file
2536 HEADER-FILE matches the `egrep' regular expression PATTERN,
2537 execute shell commands ACTION-IF-FOUND, otherwise execute
2538 ACTION-IF-NOT-FOUND.
2540 To check for C preprocessor symbols, either defined by header files
2541 or predefined by the C preprocessor, use `AC_EGREP_CPP'. Here is an
2542 example of the latter:
2548 ], is_aix=yes, is_aix=no)
2550 - Macro: AC_EGREP_CPP (PATTERN, PROGRAM, [ACTION-IF-FOUND [,
2551 ACTION-IF-NOT-FOUND]])
2552 PROGRAM is the text of a C or C++ program, on which shell
2553 variable, backquote, and backslash substitutions are performed.
2554 If the output of running the preprocessor on PROGRAM matches the
2555 `egrep' regular expression PATTERN, execute shell commands
2556 ACTION-IF-FOUND, otherwise execute ACTION-IF-NOT-FOUND.
2558 This macro calls `AC_PROG_CPP' or `AC_PROG_CXXCPP' (depending on
2559 which language is current, *note Language Choice::.), if it hasn't
2560 been called already.
2563 File: autoconf.info, Node: Examining Syntax, Next: Examining Libraries, Prev: Examining Declarations, Up: Writing Tests
2568 To check for a syntax feature of the C, C++ or Fortran 77 compiler,
2569 such as whether it recognizes a certain keyword, use `AC_TRY_COMPILE' to
2570 try to compile a small program that uses that feature. You can also use
2571 it to check for structures and structure members that are not present on
2574 - Macro: AC_TRY_COMPILE (INCLUDES, FUNCTION-BODY, [ACTION-IF-FOUND [,
2575 ACTION-IF-NOT-FOUND]])
2576 Create a C, C++ or Fortran 77 test program (depending on which
2577 language is current, *note Language Choice::.), to see whether a
2578 function whose body consists of FUNCTION-BODY can be compiled.
2580 For C and C++, INCLUDES is any `#include' statements needed by the
2581 code in FUNCTION-BODY (INCLUDES will be ignored if the currently
2582 selected language is Fortran 77). This macro also uses `CFLAGS'
2583 or `CXXFLAGS' if either C or C++ is the currently selected
2584 language, as well as `CPPFLAGS', when compiling. If Fortran 77 is
2585 the currently selected language then `FFLAGS' will be used when
2588 If the file compiles successfully, run shell commands
2589 ACTION-IF-FOUND, otherwise run ACTION-IF-NOT-FOUND.
2591 This macro does not try to link; use `AC_TRY_LINK' if you need to
2592 do that (*note Examining Libraries::.).
2595 File: autoconf.info, Node: Examining Libraries, Next: Run Time, Prev: Examining Syntax, Up: Writing Tests
2600 To check for a library, a function, or a global variable, Autoconf
2601 `configure' scripts try to compile and link a small program that uses
2602 it. This is unlike Metaconfig, which by default uses `nm' or `ar' on
2603 the C library to try to figure out which functions are available.
2604 Trying to link with the function is usually a more reliable approach
2605 because it avoids dealing with the variations in the options and output
2606 formats of `nm' and `ar' and in the location of the standard libraries.
2607 It also allows configuring for cross-compilation or checking a
2608 function's runtime behavior if needed. On the other hand, it can be
2609 slower than scanning the libraries once.
2611 A few systems have linkers that do not return a failure exit status
2612 when there are unresolved functions in the link. This bug makes the
2613 configuration scripts produced by Autoconf unusable on those systems.
2614 However, some of them can be given options that make the exit status
2615 correct. This is a problem that Autoconf does not currently handle
2616 automatically. If users encounter this problem, they might be able to
2617 solve it by setting `LDFLAGS' in the environment to pass whatever
2618 options the linker needs (for example, `-Wl,-dn' on MIPS RISC/OS).
2620 `AC_TRY_LINK' is used to compile test programs to test for functions
2621 and global variables. It is also used by `AC_CHECK_LIB' to check for
2622 libraries (*note Libraries::.), by adding the library being checked for
2623 to `LIBS' temporarily and trying to link a small program.
2625 - Macro: AC_TRY_LINK (INCLUDES, FUNCTION-BODY, [ACTION-IF-FOUND [,
2626 ACTION-IF-NOT-FOUND]])
2627 Depending on the current language (*note Language Choice::.),
2628 create a test program to see whether a function whose body
2629 consists of FUNCTION-BODY can be compiled and linked.
2631 For C and C++, INCLUDES is any `#include' statements needed by the
2632 code in FUNCTION-BODY (INCLUDES will be ignored if the currently
2633 selected language is Fortran 77). This macro also uses `CFLAGS'
2634 or `CXXFLAGS' if either C or C++ is the currently selected
2635 language, as well as `CPPFLAGS', when compiling. If Fortran 77 is
2636 the currently selected language then `FFLAGS' will be used when
2637 compiling. However, both `LDFLAGS' and `LIBS' will be used during
2638 linking in all cases.
2640 If the file compiles and links successfully, run shell commands
2641 ACTION-IF-FOUND, otherwise run ACTION-IF-NOT-FOUND.
2643 - Macro: AC_TRY_LINK_FUNC (FUNCTION, [ACTION-IF-FOUND [,
2644 ACTION-IF-NOT-FOUND]])
2645 Depending on the current language (*note Language Choice::.),
2646 create a test program to see whether a program whose body consists
2647 of a prototype of and a call to FUNCTION can be compiled and
2650 If the file compiles and links successfully, run shell commands
2651 ACTION-IF-FOUND, otherwise run ACTION-IF-NOT-FOUND.
2653 - Macro: AC_TRY_LINK_FUNC (FUNCTION, [ACTION-IF-FOUND [,
2654 ACTION-IF-NOT-FOUND]])
2655 Attempt to compile and link a small program that links with
2656 FUNCTION. If the file compiles and links successfully, run shell
2657 commands ACTION-IF-FOUND, otherwise run ACTION-IF-NOT-FOUND.
2659 - Macro: AC_COMPILE_CHECK (ECHO-TEXT, INCLUDES, FUNCTION-BODY,
2660 ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
2661 This is an obsolete version of `AC_TRY_LINK', with the addition
2662 that it prints `checking for ECHO-TEXT' to the standard output
2663 first, if ECHO-TEXT is non-empty. Use `AC_MSG_CHECKING' and
2664 `AC_MSG_RESULT' instead to print messages (*note Printing
2668 File: autoconf.info, Node: Run Time, Next: Portable Shell, Prev: Examining Libraries, Up: Writing Tests
2670 Checking Run Time Behavior
2671 ==========================
2673 Sometimes you need to find out how a system performs at run time,
2674 such as whether a given function has a certain capability or bug. If
2675 you can, make such checks when your program runs instead of when it is
2676 configured. You can check for things like the machine's endianness when
2677 your program initializes itself.
2679 If you really need to test for a run-time behavior while configuring,
2680 you can write a test program to determine the result, and compile and
2681 run it using `AC_TRY_RUN'. Avoid running test programs if possible,
2682 because using them prevents people from configuring your package for
2687 * Test Programs:: Running test programs.
2688 * Guidelines:: General rules for writing test programs.
2689 * Test Functions:: Avoiding pitfalls in test programs.
2692 File: autoconf.info, Node: Test Programs, Next: Guidelines, Prev: Run Time, Up: Run Time
2694 Running Test Programs
2695 ---------------------
2697 Use the following macro if you need to test run-time behavior of the
2698 system while configuring.
2700 - Macro: AC_TRY_RUN (PROGRAM, [ACTION-IF-TRUE [, ACTION-IF-FALSE [,
2701 ACTION-IF-CROSS-COMPILING]]])
2702 PROGRAM is the text of a C program, on which shell variable and
2703 backquote substitutions are performed. If it compiles and links
2704 successfully and returns an exit status of 0 when executed, run
2705 shell commands ACTION-IF-TRUE. Otherwise run shell commands
2706 ACTION-IF-FALSE; the exit status of the program is available in
2707 the shell variable `$?'. This macro uses `CFLAGS' or `CXXFLAGS',
2708 `CPPFLAGS', `LDFLAGS', and `LIBS' when compiling.
2710 If the C compiler being used does not produce executables that run
2711 on the system where `configure' is being run, then the test
2712 program is not run. If the optional shell commands
2713 ACTION-IF-CROSS-COMPILING are given, they are run instead.
2714 Otherwise, `configure' prints an error message and exits.
2716 Try to provide a pessimistic default value to use when
2717 cross-compiling makes run-time tests impossible. You do this by
2718 passing the optional last argument to `AC_TRY_RUN'. `autoconf' prints
2719 a warning message when creating `configure' each time it encounters a
2720 call to `AC_TRY_RUN' with no ACTION-IF-CROSS-COMPILING argument given.
2721 You may ignore the warning, though users will not be able to configure
2722 your package for cross-compiling. A few of the macros distributed with
2723 Autoconf produce this warning message.
2725 To configure for cross-compiling you can also choose a value for
2726 those parameters based on the canonical system name (*note Manual
2727 Configuration::.). Alternatively, set up a test results cache file with
2728 the correct values for the target system (*note Caching Results::.).
2730 To provide a default for calls of `AC_TRY_RUN' that are embedded in
2731 other macros, including a few of the ones that come with Autoconf, you
2732 can call `AC_PROG_CC' before running them. Then, if the shell variable
2733 `cross_compiling' is set to `yes', use an alternate method to get the
2734 results instead of calling the macros.
2737 This macro is obsolete; it does nothing.
2740 File: autoconf.info, Node: Guidelines, Next: Test Functions, Prev: Test Programs, Up: Run Time
2742 Guidelines for Test Programs
2743 ----------------------------
2745 Test programs should not write anything to the standard output. They
2746 should return 0 if the test succeeds, nonzero otherwise, so that success
2747 can be distinguished easily from a core dump or other failure;
2748 segmentation violations and other failures produce a nonzero exit
2749 status. Test programs should `exit', not `return', from `main',
2750 because on some systems (old Suns, at least) the argument to `return'
2751 in `main' is ignored.
2753 Test programs can use `#if' or `#ifdef' to check the values of
2754 preprocessor macros defined by tests that have already run. For
2755 example, if you call `AC_HEADER_STDC', then later on in `configure.in'
2756 you can have a test program that includes an ANSI C header file
2760 # include <stdlib.h>
2763 If a test program needs to use or create a data file, give it a name
2764 that starts with `conftest', such as `conftestdata'. The `configure'
2765 script cleans up by running `rm -rf conftest*' after running test
2766 programs and if the script is interrupted.
2769 File: autoconf.info, Node: Test Functions, Prev: Guidelines, Up: Run Time
2774 Function declarations in test programs should have a prototype
2775 conditionalized for C++. In practice, though, test programs rarely need
2776 functions that take arguments.
2784 Functions that test programs declare should also be conditionalized
2785 for C++, which requires `extern "C"' prototypes. Make sure to not
2786 include any header files containing clashing prototypes.
2789 extern "C" void *malloc(size_t);
2794 If a test program calls a function with invalid parameters (just to
2795 see whether it exists), organize the program to ensure that it never
2796 invokes that function. You can do this by calling it in another
2797 function that is never invoked. You can't do it by putting it after a
2798 call to `exit', because GCC version 2 knows that `exit' never returns
2799 and optimizes out any code that follows it in the same block.
2801 If you include any header files, make sure to call the functions
2802 relevant to them with the correct number of arguments, even if they are
2803 just 0, to avoid compilation errors due to prototypes. GCC version 2
2804 has internal prototypes for several functions that it automatically
2805 inlines; for example, `memcpy'. To avoid errors when checking for
2806 them, either pass them the correct number of arguments or redeclare them
2807 with a different return type (such as `char').
2810 File: autoconf.info, Node: Portable Shell, Next: Testing Values and Files, Prev: Run Time, Up: Writing Tests
2812 Portable Shell Programming
2813 ==========================
2815 When writing your own checks, there are some shell script programming
2816 techniques you should avoid in order to make your code portable. The
2817 Bourne shell and upward-compatible shells like Bash and the Korn shell
2818 have evolved over the years, but to prevent trouble, do not take
2819 advantage of features that were added after UNIX version 7, circa 1977.
2820 You should not use shell functions, aliases, negated character classes,
2821 or other features that are not found in all Bourne-compatible shells;
2822 restrict yourself to the lowest common denominator. Even `unset' is
2823 not supported by all shells! Also, include a space after the
2824 exclamation point in interpreter specifications, like this:
2826 If you omit the space before the path, then 4.2BSD based systems
2827 (such as Sequent DYNIX) will ignore the line, because they interpret
2828 `#! /' as a 4-byte magic number.
2830 The set of external programs you should run in a `configure' script
2831 is fairly small. *Note Utilities in Makefiles: (standards)Utilities in
2832 Makefiles, for the list. This restriction allows users to start out
2833 with a fairly small set of programs and build the rest, avoiding too
2834 many interdependencies between packages.
2836 Some of these external utilities have a portable subset of features,
2837 as well; for example, don't rely on `ln' having a `-f' option or `cat'
2838 having any options. `sed' scripts should not contain comments or use
2839 branch labels longer than 8 characters. Don't use `grep -s' to
2840 suppress output, because `grep -s' on System V does not suppress
2841 output, only error messages. Instead, redirect the standard output and
2842 standard error (in case the file doesn't exist) of `grep' to
2843 `/dev/null'. Check the exit status of `grep' to determine whether it
2847 File: autoconf.info, Node: Testing Values and Files, Next: Multiple Cases, Prev: Portable Shell, Up: Writing Tests
2849 Testing Values and Files
2850 ========================
2852 `configure' scripts need to test properties of many files and
2853 strings. Here are some portability problems to watch out for when doing
2856 The `test' program is the way to perform many file and string tests.
2857 It is often invoked by the alternate name `[', but using that name in
2858 Autoconf code is asking for trouble since it is an `m4' quote character.
2860 If you need to make multiple checks using `test', combine them with
2861 the shell operators `&&' and `||' instead of using the `test' operators
2862 `-a' and `-o'. On System V, the precedence of `-a' and `-o' is wrong
2863 relative to the unary operators; consequently, POSIX does not specify
2864 them, so using them is nonportable. If you combine `&&' and `||' in
2865 the same statement, keep in mind that they have equal precedence.
2867 To enable `configure' scripts to support cross-compilation, they
2868 shouldn't do anything that tests features of the host system instead of
2869 the target system. But occasionally you may find it necessary to check
2870 whether some arbitrary file exists. To do so, use `test -f' or `test
2871 -r'. Do not use `test -x', because 4.3BSD does not have it.
2873 Another nonportable shell programming construction is
2876 The intent is to set VAR to VALUE only if it is not already set, but if
2877 VAR has any value, even the empty string, to leave it alone. Old BSD
2878 shells, including the Ultrix `sh', don't accept the colon, and complain
2879 and die. A portable equivalent is
2883 File: autoconf.info, Node: Multiple Cases, Next: Language Choice, Prev: Testing Values and Files, Up: Writing Tests
2888 Some operations are accomplished in several possible ways, depending
2889 on the UNIX variant. Checking for them essentially requires a "case
2890 statement". Autoconf does not directly provide one; however, it is
2891 easy to simulate by using a shell variable to keep track of whether a
2892 way to perform the operation has been found yet.
2894 Here is an example that uses the shell variable `fstype' to keep
2895 track of whether the remaining cases need to be checked.
2897 AC_MSG_CHECKING(how to get filesystem type)
2899 # The order of these tests is important.
2900 AC_TRY_CPP([#include <sys/statvfs.h>
2901 #include <sys/fstyp.h>], AC_DEFINE(FSTYPE_STATVFS) fstype=SVR4)
2902 if test $fstype = no; then
2903 AC_TRY_CPP([#include <sys/statfs.h>
2904 #include <sys/fstyp.h>], AC_DEFINE(FSTYPE_USG_STATFS) fstype=SVR3)
2906 if test $fstype = no; then
2907 AC_TRY_CPP([#include <sys/statfs.h>
2908 #include <sys/vmount.h>], AC_DEFINE(FSTYPE_AIX_STATFS) fstype=AIX)
2910 # (more cases omitted here)
2911 AC_MSG_RESULT($fstype)
2914 File: autoconf.info, Node: Language Choice, Prev: Multiple Cases, Up: Writing Tests
2919 Packages that use both C and C++ need to test features of both
2920 compilers. Autoconf-generated `configure' scripts check for C features
2921 by default. The following macros determine which language's compiler
2922 is used in tests that follow in `configure.in'.
2925 Do compilation tests using `CC' and `CPP' and use extension `.c'
2926 for test programs. Set the shell variable `cross_compiling' to
2927 the value computed by `AC_PROG_CC' if it has been run, empty
2930 - Macro: AC_LANG_CPLUSPLUS
2931 Do compilation tests using `CXX' and `CXXCPP' and use extension
2932 `.C' for test programs. Set the shell variable `cross_compiling'
2933 to the value computed by `AC_PROG_CXX' if it has been run, empty
2936 - Macro: AC_LANG_FORTRAN77
2937 Do compilation tests using `F77' and use extension `.f' for test
2938 programs. Set the shell variable `cross_compiling' to the value
2939 computed by `AC_PROG_F77' if it has been run, empty otherwise.
2941 - Macro: AC_LANG_SAVE
2942 Remember the current language (as set by `AC_LANG_C',
2943 `AC_LANG_CPLUSPLUS' or `AC_LANG_FORTRAN77') on a stack. Does not
2944 change which language is current. Use this macro and
2945 `AC_LANG_RESTORE' in macros that need to temporarily switch to a
2946 particular language.
2948 - Macro: AC_LANG_RESTORE
2949 Select the language that is saved on the top of the stack, as set
2950 by `AC_LANG_SAVE', and remove it from the stack. This macro is
2951 equivalent to either `AC_LANG_C', `AC_LANG_CPLUSPLUS' or
2952 `AC_LANG_FORTRAN77', whichever had been run most recently when
2953 `AC_LANG_SAVE' was last called.
2955 Do not call this macro more times than `AC_LANG_SAVE'.
2957 - Macro: AC_REQUIRE_CPP
2958 Ensure that whichever preprocessor would currently be used for
2959 tests has been found. Calls `AC_REQUIRE' (*note Prerequisite
2960 Macros::.) with an argument of either `AC_PROG_CPP' or
2961 `AC_PROG_CXXCPP', depending on which language is current.
2964 File: autoconf.info, Node: Results, Next: Writing Macros, Prev: Writing Tests, Up: Top
2969 Once `configure' has determined whether a feature exists, what can
2970 it do to record that information? There are four sorts of things it can
2971 do: define a C preprocessor symbol, set a variable in the output files,
2972 save the result in a cache file for future `configure' runs, and print
2973 a message letting the user know the result of the test.
2977 * Defining Symbols:: Defining C preprocessor symbols.
2978 * Setting Output Variables:: Replacing variables in output files.
2979 * Caching Results:: Speeding up subsequent `configure' runs.
2980 * Printing Messages:: Notifying users of progress or problems.
2983 File: autoconf.info, Node: Defining Symbols, Next: Setting Output Variables, Prev: Results, Up: Results
2985 Defining C Preprocessor Symbols
2986 ===============================
2988 A common action to take in response to a feature test is to define a
2989 C preprocessor symbol indicating the results of the test. That is done
2990 by calling `AC_DEFINE' or `AC_DEFINE_UNQUOTED'.
2992 By default, `AC_OUTPUT' places the symbols defined by these macros
2993 into the output variable `DEFS', which contains an option
2994 `-DSYMBOL=VALUE' for each symbol defined. Unlike in Autoconf version
2995 1, there is no variable `DEFS' defined while `configure' is running.
2996 To check whether Autoconf macros have already defined a certain C
2997 preprocessor symbol, test the value of the appropriate cache variable,
3000 AC_CHECK_FUNC(vprintf, AC_DEFINE(HAVE_VPRINTF))
3001 if test "$ac_cv_func_vprintf" != yes; then
3002 AC_CHECK_FUNC(_doprnt, AC_DEFINE(HAVE_DOPRNT))
3005 If `AC_CONFIG_HEADER' has been called, then instead of creating
3006 `DEFS', `AC_OUTPUT' creates a header file by substituting the correct
3007 values into `#define' statements in a template file. *Note
3008 Configuration Headers::, for more information about this kind of output.
3010 - Macro: AC_DEFINE (VARIABLE [, VALUE [, DESCRIPTION]])
3011 Define C preprocessor variable VARIABLE. If VALUE is given, set
3012 VARIABLE to that value (verbatim), otherwise set it to 1. VALUE
3013 should not contain literal newlines, and if you are not using
3014 `AC_CONFIG_HEADER' it should not contain any `#' characters, as
3015 `make' tends to eat them. To use a shell variable (which you need
3016 to do in order to define a value containing the `m4' quote
3017 characters `[' or `]'), use `AC_DEFINE_UNQUOTED' instead.
3018 DESCRIPTION is only useful if you are using `AC_CONFIG_HEADER'.
3019 In this case, DESCRIPTION is put into the generated `config.h.in'
3020 as the comment before the macro define; the macro need not be
3021 mentioned in `acconfig.h'. The following example defines the C
3022 preprocessor variable `EQUATION' to be the string constant `"$a >
3025 AC_DEFINE(EQUATION, "$a > $b")
3027 - Macro: AC_DEFINE_UNQUOTED (VARIABLE [, VALUE [, DESCRIPTION]])
3028 Like `AC_DEFINE', but three shell expansions are
3029 performed--once--on VARIABLE and VALUE: variable expansion (`$'),
3030 command substitution (``'), and backslash escaping (`\'). Single
3031 and double quote characters in the value have no special meaning.
3032 Use this macro instead of `AC_DEFINE' when VARIABLE or VALUE is a
3033 shell variable. Examples:
3035 AC_DEFINE_UNQUOTED(config_machfile, "${machfile}")
3036 AC_DEFINE_UNQUOTED(GETGROUPS_T, $ac_cv_type_getgroups)
3037 AC_DEFINE_UNQUOTED(${ac_tr_hdr})
3039 Due to the syntactical bizarreness of the Bourne shell, do not use
3040 semicolons to separate `AC_DEFINE' or `AC_DEFINE_UNQUOTED' calls from
3041 other macro calls or shell code; that can cause syntax errors in the
3042 resulting `configure' script. Use either spaces or newlines. That is,
3045 AC_CHECK_HEADER(elf.h, AC_DEFINE(SVR4) LIBS="$LIBS -lelf")
3049 AC_CHECK_HEADER(elf.h,
3055 AC_CHECK_HEADER(elf.h, AC_DEFINE(SVR4); LIBS="$LIBS -lelf")
3058 File: autoconf.info, Node: Setting Output Variables, Next: Caching Results, Prev: Defining Symbols, Up: Results
3060 Setting Output Variables
3061 ========================
3063 One way to record the results of tests is to set "output variables",
3064 which are shell variables whose values are substituted into files that
3065 `configure' outputs. The two macros below create new output variables.
3066 *Note Preset Output Variables::, for a list of output variables that
3067 are always available.
3069 - Macro: AC_SUBST (VARIABLE)
3070 Create an output variable from a shell variable. Make `AC_OUTPUT'
3071 substitute the variable VARIABLE into output files (typically one
3072 or more `Makefile's). This means that `AC_OUTPUT' will replace
3073 instances of `@VARIABLE@' in input files with the value that the
3074 shell variable VARIABLE has when `AC_OUTPUT' is called. The value
3075 of VARIABLE should not contain literal newlines.
3077 - Macro: AC_SUBST_FILE (VARIABLE)
3078 Another way to create an output variable from a shell variable.
3079 Make `AC_OUTPUT' insert (without substitutions) the contents of
3080 the file named by shell variable VARIABLE into output files. This
3081 means that `AC_OUTPUT' will replace instances of `@VARIABLE@' in
3082 output files (such as `Makefile.in') with the contents of the file
3083 that the shell variable VARIABLE names when `AC_OUTPUT' is called.
3084 Set the variable to `/dev/null' for cases that do not have a file
3087 This macro is useful for inserting `Makefile' fragments containing
3088 special dependencies or other `make' directives for particular host
3089 or target types into `Makefile's. For example, `configure.in'
3092 AC_SUBST_FILE(host_frag)dnl
3093 host_frag=$srcdir/conf/sun4.mh
3095 and then a `Makefile.in' could contain:
3100 File: autoconf.info, Node: Caching Results, Next: Printing Messages, Prev: Setting Output Variables, Up: Results
3105 To avoid checking for the same features repeatedly in various
3106 `configure' scripts (or repeated runs of one script), `configure' saves
3107 the results of many of its checks in a "cache file". If, when a
3108 `configure' script runs, it finds a cache file, it reads from it the
3109 results from previous runs and avoids rerunning those checks. As a
3110 result, `configure' can run much faster than if it had to perform all
3111 of the checks every time.
3113 - Macro: AC_CACHE_VAL (CACHE-ID, COMMANDS-TO-SET-IT)
3114 Ensure that the results of the check identified by CACHE-ID are
3115 available. If the results of the check were in the cache file
3116 that was read, and `configure' was not given the `--quiet' or
3117 `--silent' option, print a message saying that the result was
3118 cached; otherwise, run the shell commands COMMANDS-TO-SET-IT.
3119 Those commands should have no side effects except for setting the
3120 variable CACHE-ID. In particular, they should not call
3121 `AC_DEFINE'; the code that follows the call to `AC_CACHE_VAL'
3122 should do that, based on the cached value. Also, they should not
3123 print any messages, for example with `AC_MSG_CHECKING'; do that
3124 before calling `AC_CACHE_VAL', so the messages are printed
3125 regardless of whether the results of the check are retrieved from
3126 the cache or determined by running the shell commands. If the
3127 shell commands are run to determine the value, the value will be
3128 saved in the cache file just before `configure' creates its output
3129 files. *Note Cache Variable Names::, for how to choose the name
3130 of the CACHE-ID variable.
3132 - Macro: AC_CACHE_CHECK (MESSAGE, CACHE-ID, COMMANDS)
3133 A wrapper for `AC_CACHE_VAL' that takes care of printing the
3134 messages. This macro provides a convenient shorthand for the most
3135 common way to use these macros. It calls `AC_MSG_CHECKING' for
3136 MESSAGE, then `AC_CACHE_VAL' with the CACHE-ID and COMMANDS
3137 arguments, and `AC_MSG_RESULT' with CACHE-ID.
3139 - Macro: AC_CACHE_LOAD
3140 Loads values from existing cache file, or creates a new cache file
3141 if a cache file is not found. Called automatically from `AC_INIT'.
3143 - Macro: AC_CACHE_SAVE
3144 Flushes all cached values to the cache file. Called automatically
3145 from `AC_OUTPUT', but it can be quite useful to call
3146 `AC_CACHE_SAVE' at key points in configure.in. Doing so
3147 checkpoints the cache in case of an early configure script abort.
3151 * Cache Variable Names:: Shell variables used in caches.
3152 * Cache Files:: Files `configure' uses for caching.
3155 File: autoconf.info, Node: Cache Variable Names, Next: Cache Files, Prev: Caching Results, Up: Caching Results
3157 Cache Variable Names
3158 --------------------
3160 The names of cache variables should have the following format:
3162 PACKAGE-PREFIX_cv_VALUE-TYPE_SPECIFIC-VALUE[_ADDITIONAL-OPTIONS]
3164 for example, `ac_cv_header_stat_broken' or
3165 `ac_cv_prog_gcc_traditional'. The parts of the variable name are:
3168 An abbreviation for your package or organization; the same prefix
3169 you begin local Autoconf macros with, except lowercase by
3170 convention. For cache values used by the distributed Autoconf
3171 macros, this value is `ac'.
3174 Indicates that this shell variable is a cache value.
3177 A convention for classifying cache values, to produce a rational
3178 naming system. The values used in Autoconf are listed in *Note
3182 Which member of the class of cache values this test applies to.
3183 For example, which function (`alloca'), program (`gcc'), or output
3184 variable (`INSTALL').
3187 Any particular behavior of the specific member that this test
3188 applies to. For example, `broken' or `set'. This part of the
3189 name may be omitted if it does not apply.
3191 The values assigned to cache variables may not contain newlines.
3192 Usually, their values will be boolean (`yes' or `no') or the names of
3193 files or functions; so this is not an important restriction.
3196 File: autoconf.info, Node: Cache Files, Prev: Cache Variable Names, Up: Caching Results
3201 A cache file is a shell script that caches the results of configure
3202 tests run on one system so they can be shared between configure scripts
3203 and configure runs. It is not useful on other systems. If its contents
3204 are invalid for some reason, the user may delete or edit it.
3206 By default, configure uses `./config.cache' as the cache file,
3207 creating it if it does not exist already. `configure' accepts the
3208 `--cache-file=FILE' option to use a different cache file; that is what
3209 `configure' does when it calls `configure' scripts in subdirectories,
3210 so they share the cache. *Note Subdirectories::, for information on
3211 configuring subdirectories with the `AC_CONFIG_SUBDIRS' macro.
3213 Giving `--cache-file=/dev/null' disables caching, for debugging
3214 `configure'. `config.status' only pays attention to the cache file if
3215 it is given the `--recheck' option, which makes it rerun `configure'.
3216 If you are anticipating a long debugging period, you can also disable
3217 cache loading and saving for a `configure' script by redefining the
3218 cache macros at the start of `configure.in':
3220 define([AC_CACHE_LOAD], )dnl
3221 define([AC_CACHE_SAVE], )dnl
3223 ... rest of configure.in ...
3225 It is wrong to try to distribute cache files for particular system
3226 types. There is too much room for error in doing that, and too much
3227 administrative overhead in maintaining them. For any features that
3228 can't be guessed automatically, use the standard method of the canonical
3229 system type and linking files (*note Manual Configuration::.).
3231 The cache file on a particular system will gradually accumulate
3232 whenever someone runs a `configure' script; it will be initially
3233 nonexistent. Running `configure' merges the new cache results with the
3234 existing cache file. The site initialization script can specify a
3235 site-wide cache file to use instead of the default, to make it work
3236 transparently, as long as the same C compiler is used every time (*note
3239 If your configure script, or a macro called from configure.in,
3240 happens to abort the configure process, it may be useful to checkpoint
3241 the cache a few times at key points. Doing so will reduce the amount
3242 of time it takes to re-run the configure script with (hopefully) the
3243 error that caused the previous abort corrected.
3245 ... AC_INIT, etc. ...
3246 dnl checks for programs
3248 AC_PROG_GCC_TRADITIONAL
3249 ... more program checks ...
3252 dnl checks for libraries
3253 AC_CHECK_LIB(nsl, gethostbyname)
3254 AC_CHECK_LIB(socket, connect)
3255 ... more lib checks ...
3259 AM_PATH_GTK(1.0.2, , exit 1)
3260 AM_PATH_GTKMM(0.9.5, , exit 1)
3263 File: autoconf.info, Node: Printing Messages, Prev: Caching Results, Up: Results
3268 `configure' scripts need to give users running them several kinds of
3269 information. The following macros print messages in ways appropriate
3270 for each kind. The arguments to all of them get enclosed in shell
3271 double quotes, so the shell performs variable and backquote substitution
3272 on them. You can print a message containing a comma by quoting the
3273 message with the `m4' quote characters:
3275 AC_MSG_RESULT([never mind, I found the BASIC compiler])
3277 These macros are all wrappers around the `echo' shell command.
3278 `configure' scripts should rarely need to run `echo' directly to print
3279 messages for the user. Using these macros makes it easy to change how
3280 and when each kind of message is printed; such changes need only be
3281 made to the macro definitions, and all of the callers change
3284 - Macro: AC_MSG_CHECKING (FEATURE-DESCRIPTION)
3285 Notify the user that `configure' is checking for a particular
3286 feature. This macro prints a message that starts with `checking '
3287 and ends with `...' and no newline. It must be followed by a call
3288 to `AC_MSG_RESULT' to print the result of the check and the
3289 newline. The FEATURE-DESCRIPTION should be something like
3290 `whether the Fortran compiler accepts C++ comments' or `for c89'.
3292 This macro prints nothing if `configure' is run with the `--quiet'
3293 or `--silent' option.
3295 - Macro: AC_MSG_RESULT (RESULT-DESCRIPTION)
3296 Notify the user of the results of a check. RESULT-DESCRIPTION is
3297 almost always the value of the cache variable for the check,
3298 typically `yes', `no', or a file name. This macro should follow a
3299 call to `AC_MSG_CHECKING', and the RESULT-DESCRIPTION should be
3300 the completion of the message printed by the call to
3303 This macro prints nothing if `configure' is run with the `--quiet'
3304 or `--silent' option.
3306 - Macro: AC_MSG_ERROR (ERROR-DESCRIPTION)
3307 Notify the user of an error that prevents `configure' from
3308 completing. This macro prints an error message on the standard
3309 error output and exits `configure' with a nonzero status.
3310 ERROR-DESCRIPTION should be something like `invalid value $HOME
3313 - Macro: AC_MSG_WARN (PROBLEM-DESCRIPTION)
3314 Notify the `configure' user of a possible problem. This macro
3315 prints the message on the standard error output; `configure'
3316 continues running afterward, so macros that call `AC_MSG_WARN'
3317 should provide a default (back-up) behavior for the situations
3318 they warn about. PROBLEM-DESCRIPTION should be something like `ln
3319 -s seems to make hard links'.
3321 The following two macros are an obsolete alternative to
3322 `AC_MSG_CHECKING' and `AC_MSG_RESULT'.
3324 - Macro: AC_CHECKING (FEATURE-DESCRIPTION)
3325 This macro is similar to `AC_MSG_CHECKING', except that it prints a
3326 newline after the FEATURE-DESCRIPTION. It is useful mainly to
3327 print a general description of the overall purpose of a group of
3328 feature checks, e.g.,
3330 AC_CHECKING(if stack overflow is detectable)
3332 - Macro: AC_VERBOSE (RESULT-DESCRIPTION)
3333 This macro is similar to `AC_MSG_RESULT', except that it is meant
3334 to follow a call to `AC_CHECKING' instead of `AC_MSG_CHECKING'; it
3335 starts the message it prints with a tab. It is considered
3339 File: autoconf.info, Node: Writing Macros, Next: Manual Configuration, Prev: Results, Up: Top
3344 When you write a feature test that could be applicable to more than
3345 one software package, the best thing to do is encapsulate it in a new
3346 macro. Here are some instructions and guidelines for writing Autoconf
3351 * Macro Definitions:: Basic format of an Autoconf macro.
3352 * Macro Names:: What to call your new macros.
3353 * Quoting:: Protecting macros from unwanted expansion.
3354 * Dependencies Between Macros:: What to do when macros depend on other macros.
3357 File: autoconf.info, Node: Macro Definitions, Next: Macro Names, Prev: Writing Macros, Up: Writing Macros
3362 Autoconf macros are defined using the `AC_DEFUN' macro, which is
3363 similar to the `m4' builtin `define' macro. In addition to defining a
3364 macro, `AC_DEFUN' adds to it some code which is used to constrain the
3365 order in which macros are called (*note Prerequisite Macros::.).
3367 An Autoconf macro definition looks like this:
3369 AC_DEFUN(MACRO-NAME, [MACRO-BODY])
3371 The square brackets here do not indicate optional text: they should
3372 literally be present in the macro definition to avoid macro expansion
3373 problems (*note Quoting::.). You can refer to any arguments passed to
3374 the macro as `$1', `$2', etc.
3376 To introduce comments in `m4', use the `m4' builtin `dnl'; it causes
3377 `m4' to discard the text through the next newline. It is not needed
3378 between macro definitions in `acsite.m4' and `aclocal.m4', because all
3379 output is discarded until `AC_INIT' is called.
3381 *Note How to define new macros: (m4.info)Definitions, for more
3382 complete information on writing `m4' macros.
3385 File: autoconf.info, Node: Macro Names, Next: Quoting, Prev: Macro Definitions, Up: Writing Macros
3390 All of the Autoconf macros have all-uppercase names starting with
3391 `AC_' to prevent them from accidentally conflicting with other text.
3392 All shell variables that they use for internal purposes have
3393 mostly-lowercase names starting with `ac_'. To ensure that your macros
3394 don't conflict with present or future Autoconf macros, you should
3395 prefix your own macro names and any shell variables they use with some
3396 other sequence. Possibilities include your initials, or an abbreviation
3397 for the name of your organization or software package.
3399 Most of the Autoconf macros' names follow a structured naming
3400 convention that indicates the kind of feature check by the name. The
3401 macro names consist of several words, separated by underscores, going
3402 from most general to most specific. The names of their cache
3403 variables use the same convention (*note Cache Variable Names::., for
3404 more information on them).
3406 The first word of the name after `AC_' usually tells the category of
3407 feature being tested. Here are the categories used in Autoconf for
3408 specific test macros, the kind of macro that you are more likely to
3409 write. They are also used for cache variables, in all-lowercase. Use
3410 them where applicable; where they're not, invent your own categories.
3413 C language builtin features.
3416 Declarations of C variables in header files.
3419 Functions in libraries.
3422 UNIX group owners of files.
3431 The full path names to files, including programs.
3434 The base names of programs.
3437 Definitions of C structures in header files.
3440 Operating system features.
3443 C builtin or declared types.
3446 C variables in libraries.
3448 After the category comes the name of the particular feature being
3449 tested. Any further words in the macro name indicate particular aspects
3450 of the feature. For example, `AC_FUNC_UTIME_NULL' checks the behavior
3451 of the `utime' function when called with a `NULL' pointer.
3453 A macro that is an internal subroutine of another macro should have a
3454 name that starts with the name of that other macro, followed by one or
3455 more words saying what the internal macro does. For example,
3456 `AC_PATH_X' has internal macros `AC_PATH_X_XMKMF' and
3460 File: autoconf.info, Node: Quoting, Next: Dependencies Between Macros, Prev: Macro Names, Up: Writing Macros
3465 Macros that are called by other macros are evaluated by `m4' several
3466 times; each evaluation might require another layer of quotes to prevent
3467 unwanted expansions of macros or `m4' builtins, such as `define' and
3468 `$1'. Quotes are also required around macro arguments that contain
3469 commas, since commas separate the arguments from each other. It's a
3470 good idea to quote any macro arguments that contain newlines or calls
3471 to other macros, as well.
3473 Autoconf changes the `m4' quote characters from the default ``' and
3474 `'' to `[' and `]', because many of the macros use ``' and `'',
3475 mismatched. However, in a few places the macros need to use brackets
3476 (usually in C program text or regular expressions). In those places,
3477 they use the `m4' builtin command `changequote' to temporarily change
3478 the quote characters to `<<' and `>>'. (Sometimes, if they don't need
3479 to quote anything, they disable quoting entirely instead by setting the
3480 quote characters to empty strings.) Here is an example:
3483 changequote(<<, >>)dnl
3485 #ifndef tzname /* For SGI. */
3486 extern char *tzname[]; /* RS6000 and others reject char **tzname. */
3488 changequote([, ])dnl
3489 [atoi(*tzname);], ac_cv_var_tzname=yes, ac_cv_var_tzname=no)
3491 When you create a `configure' script using newly written macros,
3492 examine it carefully to check whether you need to add more quotes in
3493 your macros. If one or more words have disappeared in the `m4' output,
3494 you need more quotes. When in doubt, quote.
3496 However, it's also possible to put on too many layers of quotes. If
3497 this happens, the resulting `configure' script will contain unexpanded
3498 macros. The `autoconf' program checks for this problem by doing `grep
3502 File: autoconf.info, Node: Dependencies Between Macros, Prev: Quoting, Up: Writing Macros
3504 Dependencies Between Macros
3505 ===========================
3507 Some Autoconf macros depend on other macros having been called first
3508 in order to work correctly. Autoconf provides a way to ensure that
3509 certain macros are called if needed and a way to warn the user if
3510 macros are called in an order that might cause incorrect operation.
3514 * Prerequisite Macros:: Ensuring required information.
3515 * Suggested Ordering:: Warning about possible ordering problems.
3516 * Obsolete Macros:: Warning about old ways of doing things.
3519 File: autoconf.info, Node: Prerequisite Macros, Next: Suggested Ordering, Prev: Dependencies Between Macros, Up: Dependencies Between Macros
3524 A macro that you write might need to use values that have previously
3525 been computed by other macros. For example, `AC_DECL_YYTEXT' examines
3526 the output of `flex' or `lex', so it depends on `AC_PROG_LEX' having
3527 been called first to set the shell variable `LEX'.
3529 Rather than forcing the user of the macros to keep track of the
3530 dependencies between them, you can use the `AC_REQUIRE' macro to do it
3531 automatically. `AC_REQUIRE' can ensure that a macro is only called if
3532 it is needed, and only called once.
3534 - Macro: AC_REQUIRE (MACRO-NAME)
3535 If the `m4' macro MACRO-NAME has not already been called, call it
3536 (without any arguments). Make sure to quote MACRO-NAME with
3537 square brackets. MACRO-NAME must have been defined using
3538 `AC_DEFUN' or else contain a call to `AC_PROVIDE' to indicate that
3541 An alternative to using `AC_DEFUN' is to use `define' and call
3542 `AC_PROVIDE'. Because this technique does not prevent nested messages,
3543 it is considered obsolete.
3545 - Macro: AC_PROVIDE (THIS-MACRO-NAME)
3546 Record the fact that THIS-MACRO-NAME has been called.
3547 THIS-MACRO-NAME should be the name of the macro that is calling
3548 `AC_PROVIDE'. An easy way to get it is from the `m4' builtin
3549 variable `$0', like this:
3554 File: autoconf.info, Node: Suggested Ordering, Next: Obsolete Macros, Prev: Prerequisite Macros, Up: Dependencies Between Macros
3559 Some macros should be run before another macro if both are called,
3560 but neither *requires* that the other be called. For example, a macro
3561 that changes the behavior of the C compiler should be called before any
3562 macros that run the C compiler. Many of these dependencies are noted in
3565 Autoconf provides the `AC_BEFORE' macro to warn users when macros
3566 with this kind of dependency appear out of order in a `configure.in'
3567 file. The warning occurs when creating `configure' from
3568 `configure.in', not when running `configure'. For example,
3569 `AC_PROG_CPP' checks whether the C compiler can run the C preprocessor
3570 when given the `-E' option. It should therefore be called after any
3571 macros that change which C compiler is being used, such as
3572 `AC_PROG_CC'. So `AC_PROG_CC' contains:
3574 AC_BEFORE([$0], [AC_PROG_CPP])dnl
3576 This warns the user if a call to `AC_PROG_CPP' has already occurred
3577 when `AC_PROG_CC' is called.
3579 - Macro: AC_BEFORE (THIS-MACRO-NAME, CALLED-MACRO-NAME)
3580 Make `m4' print a warning message on the standard error output if
3581 CALLED-MACRO-NAME has already been called. THIS-MACRO-NAME should
3582 be the name of the macro that is calling `AC_BEFORE'. The macro
3583 CALLED-MACRO-NAME must have been defined using `AC_DEFUN' or else
3584 contain a call to `AC_PROVIDE' to indicate that it has been called.
3587 File: autoconf.info, Node: Obsolete Macros, Prev: Suggested Ordering, Up: Dependencies Between Macros
3592 Configuration and portability technology has evolved over the years.
3593 Often better ways of solving a particular problem are developed, or
3594 ad-hoc approaches are systematized. This process has occurred in many
3595 parts of Autoconf. One result is that some of the macros are now
3596 considered "obsolete"; they still work, but are no longer considered
3597 the best thing to do. Autoconf provides the `AC_OBSOLETE' macro to
3598 warn users producing `configure' scripts when they use obsolete macros,
3599 to encourage them to modernize. A sample call is:
3601 AC_OBSOLETE([$0], [; use AC_CHECK_HEADERS(unistd.h) instead])dnl
3603 - Macro: AC_OBSOLETE (THIS-MACRO-NAME [, SUGGESTION])
3604 Make `m4' print a message on the standard error output warning that
3605 THIS-MACRO-NAME is obsolete, and giving the file and line number
3606 where it was called. THIS-MACRO-NAME should be the name of the
3607 macro that is calling `AC_OBSOLETE'. If SUGGESTION is given, it
3608 is printed at the end of the warning message; for example, it can
3609 be a suggestion for what to use instead of THIS-MACRO-NAME.
3612 File: autoconf.info, Node: Manual Configuration, Next: Site Configuration, Prev: Writing Macros, Up: Top
3614 Manual Configuration
3615 ********************
3617 A few kinds of features can't be guessed automatically by running
3618 test programs. For example, the details of the object file format, or
3619 special options that need to be passed to the compiler or linker. You
3620 can check for such features using ad-hoc means, such as having
3621 `configure' check the output of the `uname' program, or looking for
3622 libraries that are unique to particular systems. However, Autoconf
3623 provides a uniform method for handling unguessable features.
3627 * Specifying Names:: Specifying the system type.
3628 * Canonicalizing:: Getting the canonical system type.
3629 * System Type Variables:: Variables containing the system type.
3630 * Using System Type:: What to do with the system type.
3633 File: autoconf.info, Node: Specifying Names, Next: Canonicalizing, Prev: Manual Configuration, Up: Manual Configuration
3635 Specifying the System Type
3636 ==========================
3638 Like other GNU `configure' scripts, Autoconf-generated `configure'
3639 scripts can make decisions based on a canonical name for the system
3640 type, which has the form:
3644 `configure' can usually guess the canonical name for the type of
3645 system it's running on. To do so it runs a script called
3646 `config.guess', which derives the name using the `uname' command or
3647 symbols predefined by the C preprocessor.
3649 Alternately, the user can specify the system type with command line
3650 arguments to `configure'. Doing so is necessary when cross-compiling.
3651 In the most complex case of cross-compiling, three system types are
3652 involved. The options to specify them are:
3654 `--build=BUILD-TYPE'
3655 the type of system on which the package is being configured and
3656 compiled (rarely needed);
3659 the type of system on which the package will run;
3661 `--target=TARGET-TYPE'
3662 the type of system for which any compiler tools in the package will
3665 If the user gives `configure' a non-option argument, it is used as the
3666 default for the host, target, and build system types if the user does
3667 not specify them explicitly with options. The target and build types
3668 default to the host type if it is given and they are not. If you are
3669 cross-compiling, you still have to specify the names of the cross-tools
3670 you use, in particular the C compiler, on the `configure' command line,
3673 CC=m68k-coff-gcc configure --target=m68k-coff
3675 `configure' recognizes short aliases for many system types; for
3676 example, `decstation' can be given on the command line instead of
3677 `mips-dec-ultrix4.2'. `configure' runs a script called `config.sub' to
3678 canonicalize system type aliases.
3681 File: autoconf.info, Node: Canonicalizing, Next: System Type Variables, Prev: Specifying Names, Up: Manual Configuration
3683 Getting the Canonical System Type
3684 =================================
3686 The following macros make the system type available to `configure'
3687 scripts. They run the shell script `config.guess' to determine any
3688 values for the host, target, and build types that they need and the user
3689 did not specify on the command line. They run `config.sub' to
3690 canonicalize any aliases the user gave. If you use these macros, you
3691 must distribute those two shell scripts along with your source code.
3692 *Note Output::, for information about the `AC_CONFIG_AUX_DIR' macro
3693 which you can use to control which directory `configure' looks for
3694 those scripts in. If you do not use either of these macros,
3695 `configure' ignores any `--host', `--target', and `--build' options
3698 - Macro: AC_CANONICAL_SYSTEM
3699 Determine the system type and set output variables to the names of
3700 the canonical system types. *Note System Type Variables::, for
3701 details about the variables this macro sets.
3703 - Macro: AC_CANONICAL_HOST
3704 Perform only the subset of `AC_CANONICAL_SYSTEM' relevant to the
3705 host type. This is all that is needed for programs that are not
3706 part of a compiler toolchain.
3708 - Macro: AC_VALIDATE_CACHED_SYSTEM_TUPLE (CMD)
3709 If the cache file is inconsistent with the current host, target
3710 and build system types, execute CMD or print a default error
3714 File: autoconf.info, Node: System Type Variables, Next: Using System Type, Prev: Canonicalizing, Up: Manual Configuration
3716 System Type Variables
3717 =====================
3719 After calling `AC_CANONICAL_SYSTEM', the following output variables
3720 contain the system type information. After `AC_CANONICAL_HOST', only
3721 the `host' variables below are set.
3723 ``build', `host', `target''
3724 the canonical system names;
3726 ``build_alias', `host_alias', `target_alias''
3727 the names the user specified, or the canonical names if
3728 `config.guess' was used;
3730 ``build_cpu', `build_vendor', `build_os''
3731 ``host_cpu', `host_vendor', `host_os''
3732 ``target_cpu', `target_vendor', `target_os''
3733 the individual parts of the canonical names (for convenience).
3736 File: autoconf.info, Node: Using System Type, Prev: System Type Variables, Up: Manual Configuration
3738 Using the System Type
3739 =====================
3741 How do you use a canonical system type? Usually, you use it in one
3742 or more `case' statements in `configure.in' to select system-specific C
3743 files. Then link those files, which have names based on the system
3744 name, to generic names, such as `host.h' or `target.c'. The `case'
3745 statement patterns can use shell wildcards to group several cases
3746 together, like in this fragment:
3749 i386-*-mach* | i386-*-gnu*) obj_format=aout emulation=mach bfd_gas=yes ;;
3750 i960-*-bout) obj_format=bout ;;
3753 - Macro: AC_LINK_FILES (SOURCE..., DEST...)
3754 Make `AC_OUTPUT' link each of the existing files SOURCE to the
3755 corresponding link name DEST. Makes a symbolic link if possible,
3756 otherwise a hard link. The DEST and SOURCE names should be
3757 relative to the top level source or build directory. This macro
3758 may be called multiple times.
3760 For example, this call:
3762 AC_LINK_FILES(config/${machine}.h config/${obj_format}.h, host.h object.h)
3764 creates in the current directory `host.h', which is a link to
3765 `SRCDIR/config/${machine}.h', and `object.h', which is a link to
3766 `SRCDIR/config/${obj_format}.h'.
3768 You can also use the host system type to find cross-compilation
3769 tools. *Note Generic Programs::, for information about the
3770 `AC_CHECK_TOOL' macro which does that.
3773 File: autoconf.info, Node: Site Configuration, Next: Invoking configure, Prev: Manual Configuration, Up: Top
3778 `configure' scripts support several kinds of local configuration
3779 decisions. There are ways for users to specify where external software
3780 packages are, include or exclude optional features, install programs
3781 under modified names, and set default values for `configure' options.
3785 * External Software:: Working with other optional software.
3786 * Package Options:: Selecting optional features.
3787 * Site Details:: Configuring site details.
3788 * Transforming Names:: Changing program names when installing.
3789 * Site Defaults:: Giving `configure' local defaults.
3792 File: autoconf.info, Node: External Software, Next: Package Options, Prev: Site Configuration, Up: Site Configuration
3794 Working With External Software
3795 ==============================
3797 Some packages require, or can optionally use, other software packages
3798 which are already installed. The user can give `configure' command
3799 line options to specify which such external software to use. The
3800 options have one of these forms:
3802 --with-PACKAGE[=ARG]
3805 For example, `--with-gnu-ld' means work with the GNU linker instead
3806 of some other linker. `--with-x' means work with The X Window System.
3808 The user can give an argument by following the package name with `='
3809 and the argument. Giving an argument of `no' is for packages that are
3810 used by default; it says to *not* use the package. An argument that is
3811 neither `yes' nor `no' could include a name or number of a version of
3812 the other package, to specify more precisely which other package this
3813 program is supposed to work with. If no argument is given, it defaults
3814 to `yes'. `--without-PACKAGE' is equivalent to `--with-PACKAGE=no'.
3816 `configure' scripts do not complain about `--with-PACKAGE' options
3817 that they do not support. This behavior permits configuring a source
3818 tree containing multiple packages with a top-level `configure' script
3819 when the packages support different options, without spurious error
3820 messages about options that some of the packages support. An
3821 unfortunate side effect is that option spelling errors are not
3822 diagnosed. No better approach to this problem has been suggested so
3825 For each external software package that may be used, `configure.in'
3826 should call `AC_ARG_WITH' to detect whether the `configure' user asked
3827 to use it. Whether each package is used or not by default, and which
3828 arguments are valid, is up to you.
3830 - Macro: AC_ARG_WITH (PACKAGE, HELP-STRING [, ACTION-IF-GIVEN [,
3831 ACTION-IF-NOT-GIVEN]])
3832 If the user gave `configure' the option `--with-PACKAGE' or
3833 `--without-PACKAGE', run shell commands ACTION-IF-GIVEN. If
3834 neither option was given, run shell commands ACTION-IF-NOT-GIVEN.
3835 The name PACKAGE indicates another software package that this
3836 program should work with. It should consist only of alphanumeric
3837 characters and dashes.
3839 The option's argument is available to the shell commands
3840 ACTION-IF-GIVEN in the shell variable `withval', which is actually
3841 just the value of the shell variable `with_PACKAGE', with any `-'
3842 characters changed into `_'. You may use that variable instead,
3845 The argument HELP-STRING is a description of the option which
3847 --with-readline support fancy command line editing
3849 HELP-STRING may be more than one line long, if more detail is
3850 needed. Just make sure the columns line up in `configure --help'.
3851 Avoid tabs in the help string. You'll need to enclose it in `['
3852 and `]' in order to produce the leading spaces.
3854 - Macro: AC_WITH (PACKAGE, ACTION-IF-GIVEN [, ACTION-IF-NOT-GIVEN])
3855 This is an obsolete version of `AC_ARG_WITH' that does not support
3856 providing a help string.
3859 File: autoconf.info, Node: Package Options, Next: Site Details, Prev: External Software, Up: Site Configuration
3861 Choosing Package Options
3862 ========================
3864 If a software package has optional compile-time features, the user
3865 can give `configure' command line options to specify whether to compile
3866 them. The options have one of these forms:
3868 --enable-FEATURE[=ARG]
3871 These options allow users to choose which optional features to build
3872 and install. `--enable-FEATURE' options should never make a feature
3873 behave differently or cause one feature to replace another. They
3874 should only cause parts of the program to be built rather than left out.
3876 The user can give an argument by following the feature name with `='
3877 and the argument. Giving an argument of `no' requests that the feature
3878 *not* be made available. A feature with an argument looks like
3879 `--enable-debug=stabs'. If no argument is given, it defaults to `yes'.
3880 `--disable-FEATURE' is equivalent to `--enable-FEATURE=no'.
3882 `configure' scripts do not complain about `--enable-FEATURE' options
3883 that they do not support. This behavior permits configuring a source
3884 tree containing multiple packages with a top-level `configure' script
3885 when the packages support different options, without spurious error
3886 messages about options that some of the packages support. An
3887 unfortunate side effect is that option spelling errors are not
3888 diagnosed. No better approach to this problem has been suggested so
3891 For each optional feature, `configure.in' should call
3892 `AC_ARG_ENABLE' to detect whether the `configure' user asked to include
3893 it. Whether each feature is included or not by default, and which
3894 arguments are valid, is up to you.
3896 - Macro: AC_ARG_ENABLE (FEATURE, HELP-STRING [, ACTION-IF-GIVEN [,
3897 ACTION-IF-NOT-GIVEN]])
3898 If the user gave `configure' the option `--enable-FEATURE' or
3899 `--disable-FEATURE', run shell commands ACTION-IF-GIVEN. If
3900 neither option was given, run shell commands ACTION-IF-NOT-GIVEN.
3901 The name FEATURE indicates an optional user-level facility. It
3902 should consist only of alphanumeric characters and dashes.
3904 The option's argument is available to the shell commands
3905 ACTION-IF-GIVEN in the shell variable `enableval', which is
3906 actually just the value of the shell variable `enable_FEATURE',
3907 with any `-' characters changed into `_'. You may use that
3908 variable instead, if you wish. The HELP-STRING argument is like
3909 that of `AC_ARG_WITH' (*note External Software::.).
3911 - Macro: AC_ENABLE (FEATURE, ACTION-IF-GIVEN [, ACTION-IF-NOT-GIVEN])
3912 This is an obsolete version of `AC_ARG_ENABLE' that does not
3913 support providing a help string.
3916 File: autoconf.info, Node: Site Details, Next: Transforming Names, Prev: Package Options, Up: Site Configuration
3918 Configuring Site Details
3919 ========================
3921 Some software packages require complex site-specific information.
3922 Some examples are host names to use for certain services, company
3923 names, and email addresses to contact. Since some configuration
3924 scripts generated by Metaconfig ask for such information interactively,
3925 people sometimes wonder how to get that information in
3926 Autoconf-generated configuration scripts, which aren't interactive.
3928 Such site configuration information should be put in a file that is
3929 edited *only by users*, not by programs. The location of the file can
3930 either be based on the `prefix' variable, or be a standard location
3931 such as the user's home directory. It could even be specified by an
3932 environment variable. The programs should examine that file at run
3933 time, rather than at compile time. Run time configuration is more
3934 convenient for users and makes the configuration process simpler than
3935 getting the information while configuring. *Note Variables for
3936 Installation Directories: (standards)Directory Variables, for more
3937 information on where to put data files.
3940 File: autoconf.info, Node: Transforming Names, Next: Site Defaults, Prev: Site Details, Up: Site Configuration
3942 Transforming Program Names When Installing
3943 ==========================================
3945 Autoconf supports changing the names of programs when installing
3946 them. In order to use these transformations, `configure.in' must call
3947 the macro `AC_ARG_PROGRAM'.
3949 - Macro: AC_ARG_PROGRAM
3950 Place in output variable `program_transform_name' a sequence of
3951 `sed' commands for changing the names of installed programs.
3953 If any of the options described below are given to `configure',
3954 program names are transformed accordingly. Otherwise, if
3955 `AC_CANONICAL_SYSTEM' has been called and a `--target' value is
3956 given that differs from the host type (specified with `--host' or
3957 defaulted by `config.sub'), the target type followed by a dash is
3958 used as a prefix. Otherwise, no program name transformation is
3963 * Transformation Options:: `configure' options to transform names.
3964 * Transformation Examples:: Sample uses of transforming names.
3965 * Transformation Rules:: `Makefile' uses of transforming names.
3968 File: autoconf.info, Node: Transformation Options, Next: Transformation Examples, Prev: Transforming Names, Up: Transforming Names
3970 Transformation Options
3971 ----------------------
3973 You can specify name transformations by giving `configure' these
3974 command line options:
3976 `--program-prefix=PREFIX'
3977 prepend PREFIX to the names;
3979 `--program-suffix=SUFFIX'
3980 append SUFFIX to the names;
3982 `--program-transform-name=EXPRESSION'
3983 perform `sed' substitution EXPRESSION on the names.
3986 File: autoconf.info, Node: Transformation Examples, Next: Transformation Rules, Prev: Transformation Options, Up: Transforming Names
3988 Transformation Examples
3989 -----------------------
3991 These transformations are useful with programs that can be part of a
3992 cross-compilation development environment. For example, a
3993 cross-assembler running on a Sun 4 configured with
3994 `--target=i960-vxworks' is normally installed as `i960-vxworks-as',
3995 rather than `as', which could be confused with a native Sun 4 assembler.
3997 You can force a program name to begin with `g', if you don't want
3998 GNU programs installed on your system to shadow other programs with the
3999 same name. For example, if you configure GNU `diff' with
4000 `--program-prefix=g', then when you run `make install' it is installed
4001 as `/usr/local/bin/gdiff'.
4003 As a more sophisticated example, you could use
4004 --program-transform-name='s/^/g/; s/^gg/g/; s/^gless/less/'
4006 to prepend `g' to most of the program names in a source tree, excepting
4007 those like `gdb' that already have one and those like `less' and
4008 `lesskey' that aren't GNU programs. (That is assuming that you have a
4009 source tree containing those programs that is set up to use this
4012 One way to install multiple versions of some programs simultaneously
4013 is to append a version number to the name of one or both. For example,
4014 if you want to keep Autoconf version 1 around for awhile, you can
4015 configure Autoconf version 2 using `--program-suffix=2' to install the
4016 programs as `/usr/local/bin/autoconf2', `/usr/local/bin/autoheader2',
4020 File: autoconf.info, Node: Transformation Rules, Prev: Transformation Examples, Up: Transforming Names
4022 Transformation Rules
4023 --------------------
4025 Here is how to use the variable `program_transform_name' in a
4028 transform=@program_transform_name@
4030 $(INSTALL_PROGRAM) myprog $(bindir)/`echo myprog|sed '$(transform)'`
4033 rm -f $(bindir)/`echo myprog|sed '$(transform)'`
4035 If you have more than one program to install, you can do it in a loop:
4039 for p in $(PROGRAMS); do \
4040 $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p|sed '$(transform)'`; \
4044 for p in $(PROGRAMS); do \
4045 rm -f $(bindir)/`echo $$p|sed '$(transform)'`; \
4048 Whether to do the transformations on documentation files (Texinfo or
4049 `man') is a tricky question; there seems to be no perfect answer, due
4050 to the several reasons for name transforming. Documentation is not
4051 usually particular to a specific architecture, and Texinfo files do not
4052 conflict with system documentation. But they might conflict with
4053 earlier versions of the same files, and `man' pages sometimes do
4054 conflict with system documentation. As a compromise, it is probably
4055 best to do name transformations on `man' pages but not on Texinfo
4059 File: autoconf.info, Node: Site Defaults, Prev: Transforming Names, Up: Site Configuration
4061 Setting Site Defaults
4062 =====================
4064 Autoconf-generated `configure' scripts allow your site to provide
4065 default values for some configuration values. You do this by creating
4066 site- and system-wide initialization files.
4068 If the environment variable `CONFIG_SITE' is set, `configure' uses
4069 its value as the name of a shell script to read. Otherwise, it reads
4070 the shell script `PREFIX/share/config.site' if it exists, then
4071 `PREFIX/etc/config.site' if it exists. Thus, settings in
4072 machine-specific files override those in machine-independent ones in
4075 Site files can be arbitrary shell scripts, but only certain kinds of
4076 code are really appropriate to be in them. Because `configure' reads
4077 any cache file after it has read any site files, a site file can define
4078 a default cache file to be shared between all Autoconf-generated
4079 `configure' scripts run on that system. If you set a default cache
4080 file in a site file, it is a good idea to also set the output variable
4081 `CC' in that site file, because the cache file is only valid for a
4082 particular compiler, but many systems have several available.
4084 You can examine or override the value set by a command line option to
4085 `configure' in a site file; options set shell variables that have the
4086 same names as the options, with any dashes turned into underscores.
4087 The exceptions are that `--without-' and `--disable-' options are like
4088 giving the corresponding `--with-' or `--enable-' option and the value
4089 `no'. Thus, `--cache-file=localcache' sets the variable `cache_file'
4090 to the value `localcache'; `--enable-warnings=no' or
4091 `--disable-warnings' sets the variable `enable_warnings' to the value
4092 `no'; `--prefix=/usr' sets the variable `prefix' to the value `/usr';
4095 Site files are also good places to set default values for other
4096 output variables, such as `CFLAGS', if you need to give them non-default
4097 values: anything you would normally do, repetitively, on the command
4098 line. If you use non-default values for PREFIX or EXEC_PREFIX
4099 (wherever you locate the site file), you can set them in the site file
4100 if you specify it with the `CONFIG_SITE' environment variable.
4102 You can set some cache values in the site file itself. Doing this is
4103 useful if you are cross-compiling, so it is impossible to check features
4104 that require running a test program. You could "prime the cache" by
4105 setting those values correctly for that system in
4106 `PREFIX/etc/config.site'. To find out the names of the cache variables
4107 you need to set, look for shell variables with `_cv_' in their names in
4108 the affected `configure' scripts, or in the Autoconf `m4' source code
4111 The cache file is careful to not override any variables set in the
4112 site files. Similarly, you should not override command-line options in
4113 the site files. Your code should check that variables such as `prefix'
4114 and `cache_file' have their default values (as set near the top of
4115 `configure') before changing them.
4117 Here is a sample file `/usr/share/local/gnu/share/config.site'. The
4118 command `configure --prefix=/usr/share/local/gnu' would read this file
4119 (if `CONFIG_SITE' is not set to a different file).
4121 # config.site for configure
4123 # Change some defaults.
4124 test "$prefix" = NONE && prefix=/usr/share/local/gnu
4125 test "$exec_prefix" = NONE && exec_prefix=/usr/local/gnu
4126 test "$sharedstatedir" = '${prefix}/com' && sharedstatedir=/var
4127 test "$localstatedir" = '${prefix}/var' && localstatedir=/var
4129 # Give Autoconf 2.x generated configure scripts a shared default
4130 # cache file for feature test results, architecture-specific.
4131 if test "$cache_file" = ./config.cache; then
4132 cache_file="$prefix/var/config.cache"
4133 # A cache file is only valid for one C compiler.
4138 File: autoconf.info, Node: Invoking configure, Next: Invoking config.status, Prev: Site Configuration, Up: Top
4140 Running `configure' Scripts
4141 ***************************
4143 Below are instructions on how to configure a package that uses a
4144 `configure' script, suitable for inclusion as an `INSTALL' file in the
4145 package. A plain-text version of `INSTALL' which you may use comes
4150 * Basic Installation:: Instructions for typical cases.
4151 * Compilers and Options:: Selecting compilers and optimization.
4152 * Multiple Architectures:: Compiling for multiple architectures at once.
4153 * Installation Names:: Installing in different directories.
4154 * Optional Features:: Selecting optional features.
4155 * System Type:: Specifying the system type.
4156 * Sharing Defaults:: Setting site-wide defaults for `configure'.
4157 * Operation Controls:: Changing how `configure' runs.
4160 File: autoconf.info, Node: Basic Installation, Next: Compilers and Options, Up: Invoking configure
4165 These are generic installation instructions.
4167 The `configure' shell script attempts to guess correct values for
4168 various system-dependent variables used during compilation. It uses
4169 those values to create a `Makefile' in each directory of the package.
4170 It may also create one or more `.h' files containing system-dependent
4171 definitions. Finally, it creates a shell script `config.status' that
4172 you can run in the future to recreate the current configuration, a file
4173 `config.cache' that saves the results of its tests to speed up
4174 reconfiguring, and a file `config.log' containing compiler output
4175 (useful mainly for debugging `configure').
4177 If you need to do unusual things to compile the package, please try
4178 to figure out how `configure' could check whether to do them, and mail
4179 diffs or instructions to the address given in the `README' so they can
4180 be considered for the next release. If at some point `config.cache'
4181 contains results you don't want to keep, you may remove or edit it.
4183 The file `configure.in' is used to create `configure' by a program
4184 called `autoconf'. You only need `configure.in' if you want to change
4185 it or regenerate `configure' using a newer version of `autoconf'.
4187 The simplest way to compile this package is:
4189 1. `cd' to the directory containing the package's source code and type
4190 `./configure' to configure the package for your system. If you're
4191 using `csh' on an old version of System V, you might need to type
4192 `sh ./configure' instead to prevent `csh' from trying to execute
4195 Running `configure' takes awhile. While running, it prints some
4196 messages telling which features it is checking for.
4198 2. Type `make' to compile the package.
4200 3. Optionally, type `make check' to run any self-tests that come with
4203 4. Type `make install' to install the programs and any data files and
4206 5. You can remove the program binaries and object files from the
4207 source code directory by typing `make clean'. To also remove the
4208 files that `configure' created (so you can compile the package for
4209 a different kind of computer), type `make distclean'. There is
4210 also a `make maintainer-clean' target, but that is intended mainly
4211 for the package's developers. If you use it, you may have to get
4212 all sorts of other programs in order to regenerate files that came
4213 with the distribution.
4216 File: autoconf.info, Node: Compilers and Options, Next: Multiple Architectures, Prev: Basic Installation, Up: Invoking configure
4218 Compilers and Options
4219 =====================
4221 Some systems require unusual options for compilation or linking that
4222 the `configure' script does not know about. You can give `configure'
4223 initial values for variables by setting them in the environment. Using
4224 a Bourne-compatible shell, you can do that on the command line like
4226 CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
4228 Or on systems that have the `env' program, you can do it like this:
4229 env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
4232 File: autoconf.info, Node: Multiple Architectures, Next: Installation Names, Prev: Compilers and Options, Up: Invoking configure
4234 Compiling For Multiple Architectures
4235 ====================================
4237 You can compile the package for more than one kind of computer at the
4238 same time, by placing the object files for each architecture in their
4239 own directory. To do this, you must use a version of `make' that
4240 supports the `VPATH' variable, such as GNU `make'. `cd' to the
4241 directory where you want the object files and executables to go and run
4242 the `configure' script. `configure' automatically checks for the
4243 source code in the directory that `configure' is in and in `..'.
4245 If you have to use a `make' that does not supports the `VPATH'
4246 variable, you have to compile the package for one architecture at a time
4247 in the source code directory. After you have installed the package for
4248 one architecture, use `make distclean' before reconfiguring for another
4252 File: autoconf.info, Node: Installation Names, Next: Optional Features, Prev: Multiple Architectures, Up: Invoking configure
4257 By default, `make install' will install the package's files in
4258 `/usr/local/bin', `/usr/local/man', etc. You can specify an
4259 installation prefix other than `/usr/local' by giving `configure' the
4260 option `--prefix=PATH'.
4262 You can specify separate installation prefixes for
4263 architecture-specific files and architecture-independent files. If you
4264 give `configure' the option `--exec-prefix=PATH', the package will use
4265 PATH as the prefix for installing programs and libraries.
4266 Documentation and other data files will still use the regular prefix.
4268 In addition, if you use an unusual directory layout you can give
4269 options like `--bindir=PATH' to specify different values for particular
4270 kinds of files. Run `configure --help' for a list of the directories
4271 you can set and what kinds of files go in them.
4273 If the package supports it, you can cause programs to be installed
4274 with an extra prefix or suffix on their names by giving `configure' the
4275 option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
4278 File: autoconf.info, Node: Optional Features, Next: System Type, Prev: Installation Names, Up: Invoking configure
4283 Some packages pay attention to `--enable-FEATURE' options to
4284 `configure', where FEATURE indicates an optional part of the package.
4285 They may also pay attention to `--with-PACKAGE' options, where PACKAGE
4286 is something like `gnu-as' or `x' (for the X Window System). The
4287 `README' should mention any `--enable-' and `--with-' options that the
4290 For packages that use the X Window System, `configure' can usually
4291 find the X include and library files automatically, but if it doesn't,
4292 you can use the `configure' options `--x-includes=DIR' and
4293 `--x-libraries=DIR' to specify their locations.
4296 File: autoconf.info, Node: System Type, Next: Sharing Defaults, Prev: Optional Features, Up: Invoking configure
4298 Specifying the System Type
4299 ==========================
4301 There may be some features `configure' can not figure out
4302 automatically, but needs to determine by the type of host the package
4303 will run on. Usually `configure' can figure that out, but if it prints
4304 a message saying it can not guess the host type, give it the
4305 `--host=TYPE' option. TYPE can either be a short name for the system
4306 type, such as `sun4', or a canonical name with three fields:
4309 See the file `config.sub' for the possible values of each field. If
4310 `config.sub' isn't included in this package, then this package doesn't
4311 need to know the host type.
4313 If you are building compiler tools for cross-compiling, you can also
4314 use the `--target=TYPE' option to select the type of system they will
4315 produce code for and the `--build=TYPE' option to select the type of
4316 system on which you are compiling the package.
4319 File: autoconf.info, Node: Sharing Defaults, Next: Operation Controls, Prev: System Type, Up: Invoking configure
4324 If you want to set default values for `configure' scripts to share,
4325 you can create a site shell script called `config.site' that gives
4326 default values for variables like `CC', `cache_file', and `prefix'.
4327 `configure' looks for `PREFIX/share/config.site' if it exists, then
4328 `PREFIX/etc/config.site' if it exists. Or, you can set the
4329 `CONFIG_SITE' environment variable to the location of the site script.
4330 A warning: not all `configure' scripts look for a site script.
4333 File: autoconf.info, Node: Operation Controls, Prev: Sharing Defaults, Up: Invoking configure
4338 `configure' recognizes the following options to control how it
4342 Use and save the results of the tests in FILE instead of
4343 `./config.cache'. Set FILE to `/dev/null' to disable caching, for
4344 debugging `configure'.
4347 Print a summary of the options to `configure', and exit.
4352 Do not print messages saying which checks are being made. To
4353 suppress all normal output, redirect it to `/dev/null' (any error
4354 messages will still be shown).
4357 Look for the package's source code in directory DIR. Usually
4358 `configure' can determine that directory automatically.
4361 Print the version of Autoconf used to generate the `configure'
4364 `configure' also accepts some other, not widely useful, options.
4367 File: autoconf.info, Node: Invoking config.status, Next: Questions, Prev: Invoking configure, Up: Top
4369 Recreating a Configuration
4370 **************************
4372 The `configure' script creates a file named `config.status' which
4373 describes which configuration options were specified when the package
4374 was last configured. This file is a shell script which, if run, will
4375 recreate the same configuration.
4377 You can give `config.status' the `--recheck' option to update
4378 itself. This option is useful if you change `configure', so that the
4379 results of some tests might be different from the previous run. The
4380 `--recheck' option re-runs `configure' with the same arguments you used
4381 before, plus the `--no-create' option, which prevent `configure' from
4382 running `config.status' and creating `Makefile' and other files, and
4383 the `--no-recursion' option, which prevents `configure' from running
4384 other `configure' scripts in subdirectories. (This is so other
4385 `Makefile' rules can run `config.status' when it changes; *note
4386 Automatic Remaking::., for an example).
4388 `config.status' also accepts the options `--help', which prints a
4389 summary of the options to `config.status', and `--version', which
4390 prints the version of Autoconf used to create the `configure' script
4391 that generated `config.status'.
4393 `config.status' checks several optional environment variables that
4394 can alter its behavior:
4396 - Variable: CONFIG_SHELL
4397 The shell with which to run `configure' for the `--recheck'
4398 option. It must be Bourne-compatible. The default is `/bin/sh'.
4400 - Variable: CONFIG_STATUS
4401 The file name to use for the shell script that records the
4402 configuration. The default is `./config.status'. This variable is
4403 useful when one package uses parts of another and the `configure'
4404 scripts shouldn't be merged because they are maintained separately.
4406 The following variables provide one way for separately distributed
4407 packages to share the values computed by `configure'. Doing so can be
4408 useful if some of the packages need a superset of the features that one
4409 of them, perhaps a common library, does. These variables allow a
4410 `config.status' file to create files other than the ones that its
4411 `configure.in' specifies, so it can be used for a different package.
4413 - Variable: CONFIG_FILES
4414 The files in which to perform `@VARIABLE@' substitutions. The
4415 default is the arguments given to `AC_OUTPUT' in `configure.in'.
4417 - Variable: CONFIG_HEADERS
4418 The files in which to substitute C `#define' statements. The
4419 default is the arguments given to `AC_CONFIG_HEADER'; if that
4420 macro was not called, `config.status' ignores this variable.
4422 These variables also allow you to write `Makefile' rules that
4423 regenerate only some of the files. For example, in the dependencies
4424 given above (*note Automatic Remaking::.), `config.status' is run twice
4425 when `configure.in' has changed. If that bothers you, you can make
4426 each run only regenerate the files for that rule:
4429 stamp-h: config.h.in config.status
4430 CONFIG_FILES= CONFIG_HEADERS=config.h ./config.status
4433 Makefile: Makefile.in config.status
4434 CONFIG_FILES=Makefile CONFIG_HEADERS= ./config.status
4436 (If `configure.in' does not call `AC_CONFIG_HEADER', there is no need
4437 to set `CONFIG_HEADERS' in the `make' rules.)
4440 File: autoconf.info, Node: Questions, Next: Upgrading, Prev: Invoking config.status, Up: Top
4442 Questions About Autoconf
4443 ************************
4445 Several questions about Autoconf come up occasionally. Here some of
4450 * Distributing:: Distributing `configure' scripts.
4451 * Why GNU m4:: Why not use the standard `m4'?
4452 * Bootstrapping:: Autoconf and GNU `m4' require each other?
4453 * Why Not Imake:: Why GNU uses `configure' instead of Imake.
4456 File: autoconf.info, Node: Distributing, Next: Why GNU m4, Prev: Questions, Up: Questions
4458 Distributing `configure' Scripts
4459 ================================
4461 What are the restrictions on distributing `configure'
4462 scripts that Autoconf generates? How does that affect my
4463 programs that use them?
4465 There are no restrictions on how the configuration scripts that
4466 Autoconf produces may be distributed or used. In Autoconf version 1,
4467 they were covered by the GNU General Public License. We still
4468 encourage software authors to distribute their work under terms like
4469 those of the GPL, but doing so is not required to use Autoconf.
4471 Of the other files that might be used with `configure',
4472 `config.h.in' is under whatever copyright you use for your
4473 `configure.in', since it is derived from that file and from the public
4474 domain file `acconfig.h'. `config.sub' and `config.guess' have an
4475 exception to the GPL when they are used with an Autoconf-generated
4476 `configure' script, which permits you to distribute them under the same
4477 terms as the rest of your package. `install-sh' is from the X
4478 Consortium and is not copyrighted.
4481 File: autoconf.info, Node: Why GNU m4, Next: Bootstrapping, Prev: Distributing, Up: Questions
4483 Why Require GNU `m4'?
4484 =====================
4486 Why does Autoconf require GNU `m4'?
4488 Many `m4' implementations have hard-coded limitations on the size
4489 and number of macros, which Autoconf exceeds. They also lack several
4490 builtin macros that it would be difficult to get along without in a
4491 sophisticated application like Autoconf, including:
4499 Since only software maintainers need to use Autoconf, and since GNU
4500 `m4' is simple to configure and install, it seems reasonable to require
4501 GNU `m4' to be installed also. Many maintainers of GNU and other free
4502 software already have most of the GNU utilities installed, since they
4506 File: autoconf.info, Node: Bootstrapping, Next: Why Not Imake, Prev: Why GNU m4, Up: Questions
4508 How Can I Bootstrap?
4509 ====================
4511 If Autoconf requires GNU `m4' and GNU `m4' has an
4512 Autoconf `configure' script, how do I bootstrap? It seems
4513 like a chicken and egg problem!
4515 This is a misunderstanding. Although GNU `m4' does come with a
4516 `configure' script produced by Autoconf, Autoconf is not required in
4517 order to run the script and install GNU `m4'. Autoconf is only
4518 required if you want to change the `m4' `configure' script, which few
4519 people have to do (mainly its maintainer).
4522 File: autoconf.info, Node: Why Not Imake, Prev: Bootstrapping, Up: Questions
4527 Why not use Imake instead of `configure' scripts?
4529 Several people have written addressing this question, so I include
4530 adaptations of their explanations here.
4532 The following answer is based on one written by Richard Pixley:
4534 Autoconf generated scripts frequently work on machines which it has
4535 never been set up to handle before. That is, it does a good job of
4536 inferring a configuration for a new system. Imake cannot do this.
4538 Imake uses a common database of host specific data. For X11, this
4539 makes sense because the distribution is made as a collection of tools,
4540 by one central authority who has control over the database.
4542 GNU tools are not released this way. Each GNU tool has a maintainer;
4543 these maintainers are scattered across the world. Using a common
4544 database would be a maintenance nightmare. Autoconf may appear to be
4545 this kind of database, but in fact it is not. Instead of listing host
4546 dependencies, it lists program requirements.
4548 If you view the GNU suite as a collection of native tools, then the
4549 problems are similar. But the GNU development tools can be configured
4550 as cross tools in almost any host+target permutation. All of these
4551 configurations can be installed concurrently. They can even be
4552 configured to share host independent files across hosts. Imake doesn't
4553 address these issues.
4555 Imake templates are a form of standardization. The GNU coding
4556 standards address the same issues without necessarily imposing the same
4559 Here is some further explanation, written by Per Bothner:
4561 One of the advantages of Imake is that it easy to generate large
4562 Makefiles using `cpp''s `#include' and macro mechanisms. However,
4563 `cpp' is not programmable: it has limited conditional facilities, and
4564 no looping. And `cpp' cannot inspect its environment.
4566 All of these problems are solved by using `sh' instead of `cpp'.
4567 The shell is fully programmable, has macro substitution, can execute
4568 (or source) other shell scripts, and can inspect its environment.
4570 Paul Eggert elaborates more:
4572 With Autoconf, installers need not assume that Imake itself is
4573 already installed and working well. This may not seem like much of an
4574 advantage to people who are accustomed to Imake. But on many hosts
4575 Imake is not installed or the default installation is not working well,
4576 and requiring Imake to install a package hinders the acceptance of that
4577 package on those hosts. For example, the Imake template and
4578 configuration files might not be installed properly on a host, or the
4579 Imake build procedure might wrongly assume that all source files are in
4580 one big directory tree, or the Imake configuration might assume one
4581 compiler whereas the package or the installer needs to use another, or
4582 there might be a version mismatch between the Imake expected by the
4583 package and the Imake supported by the host. These problems are much
4584 rarer with Autoconf, where each package comes with its own independent
4585 configuration processor.
4587 Also, Imake often suffers from unexpected interactions between
4588 `make' and the installer's C preprocessor. The fundamental problem
4589 here is that the C preprocessor was designed to preprocess C programs,
4590 not `Makefile's. This is much less of a problem with Autoconf, which
4591 uses the general-purpose preprocessor `m4', and where the package's
4592 author (rather than the installer) does the preprocessing in a standard
4595 Finally, Mark Eichin notes:
4597 Imake isn't all that extensible, either. In order to add new
4598 features to Imake, you need to provide your own project template, and
4599 duplicate most of the features of the existing one. This means that
4600 for a sophisticated project, using the vendor-provided Imake templates
4601 fails to provide any leverage--since they don't cover anything that
4602 your own project needs (unless it is an X11 program).
4604 On the other side, though:
4606 The one advantage that Imake has over `configure': `Imakefile's tend
4607 to be much shorter (likewise, less redundant) than `Makefile.in's.
4608 There is a fix to this, however--at least for the Kerberos V5 tree,
4609 we've modified things to call in common `post.in' and `pre.in'
4610 `Makefile' fragments for the entire tree. This means that a lot of
4611 common things don't have to be duplicated, even though they normally
4612 are in `configure' setups.
4615 File: autoconf.info, Node: Upgrading, Next: History, Prev: Questions, Up: Top
4617 Upgrading From Version 1
4618 ************************
4620 Autoconf version 2 is mostly backward compatible with version 1.
4621 However, it introduces better ways to do some things, and doesn't
4622 support some of the ugly things in version 1. So, depending on how
4623 sophisticated your `configure.in' files are, you might have to do some
4624 manual work in order to upgrade to version 2. This chapter points out
4625 some problems to watch for when upgrading. Also, perhaps your
4626 `configure' scripts could benefit from some of the new features in
4627 version 2; the changes are summarized in the file `NEWS' in the
4628 Autoconf distribution.
4630 First, make sure you have GNU `m4' version 1.1 or higher installed,
4631 preferably 1.3 or higher. Versions before 1.1 have bugs that prevent
4632 them from working with Autoconf version 2. Versions 1.3 and later are
4633 much faster than earlier versions, because as of version 1.3, GNU `m4'
4634 has a more efficient implementation of diversions and can freeze its
4635 internal state in a file that it can read back quickly.
4639 * Changed File Names:: Files you might rename.
4640 * Changed Makefiles:: New things to put in `Makefile.in'.
4641 * Changed Macros:: Macro calls you might replace.
4642 * Invoking autoupdate:: Replacing old macro names in `configure.in'.
4643 * Changed Results:: Changes in how to check test results.
4644 * Changed Macro Writing:: Better ways to write your own macros.
4647 File: autoconf.info, Node: Changed File Names, Next: Changed Makefiles, Prev: Upgrading, Up: Upgrading
4652 If you have an `aclocal.m4' installed with Autoconf (as opposed to
4653 in a particular package's source directory), you must rename it to
4654 `acsite.m4'. *Note Invoking autoconf::.
4656 If you distribute `install.sh' with your package, rename it to
4657 `install-sh' so `make' builtin rules won't inadvertently create a file
4658 called `install' from it. `AC_PROG_INSTALL' looks for the script under
4659 both names, but it is best to use the new name.
4661 If you were using `config.h.top' or `config.h.bot', you still can,
4662 but you will have less clutter if you merge them into `acconfig.h'.
4663 *Note Invoking autoheader::.
4666 File: autoconf.info, Node: Changed Makefiles, Next: Changed Macros, Prev: Changed File Names, Up: Upgrading
4671 Add `@CFLAGS@', `@CPPFLAGS@', and `@LDFLAGS@' in your `Makefile.in'
4672 files, so they can take advantage of the values of those variables in
4673 the environment when `configure' is run. Doing this isn't necessary,
4674 but it's a convenience for users.
4676 Also add `@configure_input@' in a comment to each non-`Makefile'
4677 input file for `AC_OUTPUT', so that the output files will contain a
4678 comment saying they were produced by `configure'. Automatically
4679 selecting the right comment syntax for all the kinds of files that
4680 people call `AC_OUTPUT' on became too much work.
4682 Add `config.log' and `config.cache' to the list of files you remove
4683 in `distclean' targets.
4685 If you have the following in `Makefile.in':
4688 exec_prefix = ${prefix}
4690 you must change it to:
4693 exec_prefix = @exec_prefix@
4695 The old behavior of replacing those variables without `@' characters
4696 around them has been removed.
4699 File: autoconf.info, Node: Changed Macros, Next: Invoking autoupdate, Prev: Changed Makefiles, Up: Upgrading
4704 Many of the macros were renamed in Autoconf version 2. You can still
4705 use the old names, but the new ones are clearer, and it's easier to find
4706 the documentation for them. *Note Old Macro Names::, for a table
4707 showing the new names for the old macros. Use the `autoupdate' program
4708 to convert your `configure.in' to using the new macro names. *Note
4709 Invoking autoupdate::.
4711 Some macros have been superseded by similar ones that do the job
4712 better, but are not call-compatible. If you get warnings about calling
4713 obsolete macros while running `autoconf', you may safely ignore them,
4714 but your `configure' script will generally work better if you follow
4715 the advice it prints about what to replace the obsolete macros with. In
4716 particular, the mechanism for reporting the results of tests has
4717 changed. If you were using `echo' or `AC_VERBOSE' (perhaps via
4718 `AC_COMPILE_CHECK'), your `configure' script's output will look better
4719 if you switch to `AC_MSG_CHECKING' and `AC_MSG_RESULT'. *Note Printing
4720 Messages::. Those macros work best in conjunction with cache
4721 variables. *Note Caching Results::.
4724 File: autoconf.info, Node: Invoking autoupdate, Next: Changed Results, Prev: Changed Macros, Up: Upgrading
4726 Using `autoupdate' to Modernize `configure'
4727 ===========================================
4729 The `autoupdate' program updates a `configure.in' file that calls
4730 Autoconf macros by their old names to use the current macro names. In
4731 version 2 of Autoconf, most of the macros were renamed to use a more
4732 uniform and descriptive naming scheme. *Note Macro Names::, for a
4733 description of the new scheme. Although the old names still work
4734 (*note Old Macro Names::., for a list of the old macro names and the
4735 corresponding new names), you can make your `configure.in' files more
4736 readable and make it easier to use the current Autoconf documentation
4737 if you update them to use the new macro names.
4739 If given no arguments, `autoupdate' updates `configure.in', backing
4740 up the original version with the suffix `~' (or the value of the
4741 environment variable `SIMPLE_BACKUP_SUFFIX', if that is set). If you
4742 give `autoupdate' an argument, it reads that file instead of
4743 `configure.in' and writes the updated file to the standard output.
4745 `autoupdate' accepts the following options:
4749 Print a summary of the command line options and exit.
4753 Look for the Autoconf macro files in directory DIR instead of the
4754 default installation directory. You can also set the `AC_MACRODIR'
4755 environment variable to a directory; this option overrides the
4756 environment variable.
4759 Print the version number of `autoupdate' and exit.
4762 File: autoconf.info, Node: Changed Results, Next: Changed Macro Writing, Prev: Invoking autoupdate, Up: Upgrading
4767 If you were checking the results of previous tests by examining the
4768 shell variable `DEFS', you need to switch to checking the values of the
4769 cache variables for those tests. `DEFS' no longer exists while
4770 `configure' is running; it is only created when generating output
4771 files. This difference from version 1 is because properly quoting the
4772 contents of that variable turned out to be too cumbersome and
4773 inefficient to do every time `AC_DEFINE' is called. *Note Cache
4776 For example, here is a `configure.in' fragment written for Autoconf
4779 AC_HAVE_FUNCS(syslog)
4782 *) # syslog is not in the default libraries. See if it's in some other.
4784 for lib in bsd socket inet; do
4785 AC_CHECKING(for syslog in -l$lib)
4786 LIBS="$saved_LIBS -l$lib"
4787 AC_HAVE_FUNCS(syslog)
4789 *-DHAVE_SYSLOG*) break ;;
4796 Here is a way to write it for version 2:
4798 AC_CHECK_FUNCS(syslog)
4799 if test $ac_cv_func_syslog = no; then
4800 # syslog is not in the default libraries. See if it's in some other.
4801 for lib in bsd socket inet; do
4802 AC_CHECK_LIB($lib, syslog, [AC_DEFINE(HAVE_SYSLOG)
4803 LIBS="$LIBS $lib"; break])
4807 If you were working around bugs in `AC_DEFINE_UNQUOTED' by adding
4808 backslashes before quotes, you need to remove them. It now works
4809 predictably, and does not treat quotes (except backquotes) specially.
4810 *Note Setting Output Variables::.
4812 All of the boolean shell variables set by Autoconf macros now use
4813 `yes' for the true value. Most of them use `no' for false, though for
4814 backward compatibility some use the empty string instead. If you were
4815 relying on a shell variable being set to something like 1 or `t' for
4816 true, you need to change your tests.
4819 File: autoconf.info, Node: Changed Macro Writing, Prev: Changed Results, Up: Upgrading
4821 Changed Macro Writing
4822 =====================
4824 When defining your own macros, you should now use `AC_DEFUN' instead
4825 of `define'. `AC_DEFUN' automatically calls `AC_PROVIDE' and ensures
4826 that macros called via `AC_REQUIRE' do not interrupt other macros, to
4827 prevent nested `checking...' messages on the screen. There's no actual
4828 harm in continuing to use the older way, but it's less convenient and
4829 attractive. *Note Macro Definitions::.
4831 You probably looked at the macros that came with Autoconf as a guide
4832 for how to do things. It would be a good idea to take a look at the new
4833 versions of them, as the style is somewhat improved and they take
4834 advantage of some new features.
4836 If you were doing tricky things with undocumented Autoconf internals
4837 (macros, variables, diversions), check whether you need to change
4838 anything to account for changes that have been made. Perhaps you can
4839 even use an officially supported technique in version 2 instead of
4840 kludging. Or perhaps not.
4842 To speed up your locally written feature tests, add caching to them.
4843 See whether any of your tests are of general enough usefulness to
4844 encapsulate into macros that you can share.
4847 File: autoconf.info, Node: History, Next: Old Macro Names, Prev: Upgrading, Up: Top
4852 You may be wondering, Why was Autoconf originally written? How did
4853 it get into its present form? (Why does it look like gorilla spit?) If
4854 you're not wondering, then this chapter contains no information useful
4855 to you, and you might as well skip it. If you *are* wondering, then
4856 let there be light...
4860 * Genesis:: Prehistory and naming of `configure'.
4861 * Exodus:: The plagues of `m4' and Perl.
4862 * Leviticus:: The priestly code of portability arrives.
4863 * Numbers:: Growth and contributors.
4864 * Deuteronomy:: Approaching the promises of easy configuration.
4867 File: autoconf.info, Node: Genesis, Next: Exodus, Prev: History, Up: History
4872 In June 1991 I was maintaining many of the GNU utilities for the Free
4873 Software Foundation. As they were ported to more platforms and more
4874 programs were added, the number of `-D' options that users had to
4875 select in the `Makefile' (around 20) became burdensome. Especially for
4876 me--I had to test each new release on a bunch of different systems. So
4877 I wrote a little shell script to guess some of the correct settings for
4878 the fileutils package, and released it as part of fileutils 2.0. That
4879 `configure' script worked well enough that the next month I adapted it
4880 (by hand) to create similar `configure' scripts for several other GNU
4881 utilities packages. Brian Berliner also adapted one of my scripts for
4882 his CVS revision control system.
4884 Later that summer, I learned that Richard Stallman and Richard Pixley
4885 were developing similar scripts to use in the GNU compiler tools; so I
4886 adapted my `configure' scripts to support their evolving interface:
4887 using the file name `Makefile.in' as the templates; adding `+srcdir',
4888 the first option (of many); and creating `config.status' files.
4891 File: autoconf.info, Node: Exodus, Next: Leviticus, Prev: Genesis, Up: History
4896 As I got feedback from users, I incorporated many improvements, using
4897 Emacs to search and replace, cut and paste, similar changes in each of
4898 the scripts. As I adapted more GNU utilities packages to use
4899 `configure' scripts, updating them all by hand became impractical.
4900 Rich Murphey, the maintainer of the GNU graphics utilities, sent me mail
4901 saying that the `configure' scripts were great, and asking if I had a
4902 tool for generating them that I could send him. No, I thought, but I
4903 should! So I started to work out how to generate them. And the
4904 journey from the slavery of hand-written `configure' scripts to the
4905 abundance and ease of Autoconf began.
4907 Cygnus `configure', which was being developed at around that time,
4908 is table driven; it is meant to deal mainly with a discrete number of
4909 system types with a small number of mainly unguessable features (such as
4910 details of the object file format). The automatic configuration system
4911 that Brian Fox had developed for Bash takes a similar approach. For
4912 general use, it seems to me a hopeless cause to try to maintain an
4913 up-to-date database of which features each variant of each operating
4914 system has. It's easier and more reliable to check for most features on
4915 the fly--especially on hybrid systems that people have hacked on
4916 locally or that have patches from vendors installed.
4918 I considered using an architecture similar to that of Cygnus
4919 `configure', where there is a single `configure' script that reads
4920 pieces of `configure.in' when run. But I didn't want to have to
4921 distribute all of the feature tests with every package, so I settled on
4922 having a different `configure' made from each `configure.in' by a
4923 preprocessor. That approach also offered more control and flexibility.
4925 I looked briefly into using the Metaconfig package, by Larry Wall,
4926 Harlan Stenn, and Raphael Manfredi, but I decided not to for several
4927 reasons. The `Configure' scripts it produces are interactive, which I
4928 find quite inconvenient; I didn't like the ways it checked for some
4929 features (such as library functions); I didn't know that it was still
4930 being maintained, and the `Configure' scripts I had seen didn't work on
4931 many modern systems (such as System V R4 and NeXT); it wasn't very
4932 flexible in what it could do in response to a feature's presence or
4933 absence; I found it confusing to learn; and it was too big and complex
4934 for my needs (I didn't realize then how much Autoconf would eventually
4937 I considered using Perl to generate my style of `configure' scripts,
4938 but decided that `m4' was better suited to the job of simple textual
4939 substitutions: it gets in the way less, because output is implicit.
4940 Plus, everyone already has it. (Initially I didn't rely on the GNU
4941 extensions to `m4'.) Also, some of my friends at the University of
4942 Maryland had recently been putting `m4' front ends on several programs,
4943 including `tvtwm', and I was interested in trying out a new language.
4946 File: autoconf.info, Node: Leviticus, Next: Numbers, Prev: Exodus, Up: History
4951 Since my `configure' scripts determine the system's capabilities
4952 automatically, with no interactive user intervention, I decided to call
4953 the program that generates them Autoconfig. But with a version number
4954 tacked on, that name would be too long for old UNIX file systems, so I
4955 shortened it to Autoconf.
4957 In the fall of 1991 I called together a group of fellow questers
4958 after the Holy Grail of portability (er, that is, alpha testers) to
4959 give me feedback as I encapsulated pieces of my handwritten scripts in
4960 `m4' macros and continued to add features and improve the techniques
4961 used in the checks. Prominent among the testers were Franc,ois Pinard,
4962 who came up with the idea of making an `autoconf' shell script to run
4963 `m4' and check for unresolved macro calls; Richard Pixley, who
4964 suggested running the compiler instead of searching the file system to
4965 find include files and symbols, for more accurate results; Karl Berry,
4966 who got Autoconf to configure TeX and added the macro index to the
4967 documentation; and Ian Taylor, who added support for creating a C
4968 header file as an alternative to putting `-D' options in a `Makefile',
4969 so he could use Autoconf for his UUCP package. The alpha testers
4970 cheerfully adjusted their files again and again as the names and
4971 calling conventions of the Autoconf macros changed from release to
4972 release. They all contributed many specific checks, great ideas, and
4976 File: autoconf.info, Node: Numbers, Next: Deuteronomy, Prev: Leviticus, Up: History
4981 In July 1992, after months of alpha testing, I released Autoconf 1.0,
4982 and converted many GNU packages to use it. I was surprised by how
4983 positive the reaction to it was. More people started using it than I
4984 could keep track of, including people working on software that wasn't
4985 part of the GNU Project (such as TCL, FSP, and Kerberos V5). Autoconf
4986 continued to improve rapidly, as many people using the `configure'
4987 scripts reported problems they encountered.
4989 Autoconf turned out to be a good torture test for `m4'
4990 implementations. UNIX `m4' started to dump core because of the length
4991 of the macros that Autoconf defined, and several bugs showed up in GNU
4992 `m4' as well. Eventually, we realized that we needed to use some
4993 features that only GNU `m4' has. 4.3BSD `m4', in particular, has an
4994 impoverished set of builtin macros; the System V version is better, but
4995 still doesn't provide everything we need.
4997 More development occurred as people put Autoconf under more stresses
4998 (and to uses I hadn't anticipated). Karl Berry added checks for X11.
4999 david zuhn contributed C++ support. Franc,ois Pinard made it diagnose
5000 invalid arguments. Jim Blandy bravely coerced it into configuring GNU
5001 Emacs, laying the groundwork for several later improvements. Roland
5002 McGrath got it to configure the GNU C Library, wrote the `autoheader'
5003 script to automate the creation of C header file templates, and added a
5004 `--verbose' option to `configure'. Noah Friedman added the
5005 `--macrodir' option and `AC_MACRODIR' environment variable. (He also
5006 coined the term "autoconfiscate" to mean "adapt a software package to
5007 use Autoconf".) Roland and Noah improved the quoting protection in
5008 `AC_DEFINE' and fixed many bugs, especially when I got sick of dealing
5009 with portability problems from February through June, 1993.
5012 File: autoconf.info, Node: Deuteronomy, Prev: Numbers, Up: History
5017 A long wish list for major features had accumulated, and the effect
5018 of several years of patching by various people had left some residual
5019 cruft. In April 1994, while working for Cygnus Support, I began a major
5020 revision of Autoconf. I added most of the features of the Cygnus
5021 `configure' that Autoconf had lacked, largely by adapting the relevant
5022 parts of Cygnus `configure' with the help of david zuhn and Ken
5023 Raeburn. These features include support for using `config.sub',
5024 `config.guess', `--host', and `--target'; making links to files; and
5025 running `configure' scripts in subdirectories. Adding these features
5026 enabled Ken to convert GNU `as', and Rob Savoye to convert DejaGNU, to
5029 I added more features in response to other peoples' requests. Many
5030 people had asked for `configure' scripts to share the results of the
5031 checks between runs, because (particularly when configuring a large
5032 source tree, like Cygnus does) they were frustratingly slow. Mike
5033 Haertel suggested adding site-specific initialization scripts. People
5034 distributing software that had to unpack on MS-DOS asked for a way to
5035 override the `.in' extension on the file names, which produced file
5036 names like `config.h.in' containing two dots. Jim Avera did an
5037 extensive examination of the problems with quoting in `AC_DEFINE' and
5038 `AC_SUBST'; his insights led to significant improvements. Richard
5039 Stallman asked that compiler output be sent to `config.log' instead of
5040 `/dev/null', to help people debug the Emacs `configure' script.
5042 I made some other changes because of my dissatisfaction with the
5043 quality of the program. I made the messages showing results of the
5044 checks less ambiguous, always printing a result. I regularized the
5045 names of the macros and cleaned up coding style inconsistencies. I
5046 added some auxiliary utilities that I had developed to help convert
5047 source code packages to use Autoconf. With the help of Franc,ois
5048 Pinard, I made the macros not interrupt each others' messages. (That
5049 feature revealed some performance bottlenecks in GNU `m4', which he
5050 hastily corrected!) I reorganized the documentation around problems
5051 people want to solve. And I began a testsuite, because experience had
5052 shown that Autoconf has a pronounced tendency to regress when we change
5055 Again, several alpha testers gave invaluable feedback, especially
5056 Franc,ois Pinard, Jim Meyering, Karl Berry, Rob Savoye, Ken Raeburn,
5059 Finally, version 2.0 was ready. And there was much rejoicing. (And
5060 I have free time again. I think. Yeah, right.)
5063 File: autoconf.info, Node: Old Macro Names, Next: Environment Variable Index, Prev: History, Up: Top
5068 In version 2 of Autoconf, most of the macros were renamed to use a
5069 more uniform and descriptive naming scheme. Here are the old names of
5070 the macros that were renamed, followed by the current names of those
5071 macros. Although the old names are still accepted by the `autoconf'
5072 program for backward compatibility, the old names are considered
5073 obsolete. *Note Macro Names::, for a description of the new naming
5080 removed because of limited usefulness
5083 `AC_C_CHAR_UNSIGNED'
5103 `AC_GCC_TRADITIONAL'
5104 `AC_PROG_GCC_TRADITIONAL'
5110 `AC_FUNC_GETLOADAVG'
5119 `AC_SYS_INTERPRETER' (different calling convention)
5136 `AC_LONG_FILE_NAMES'
5137 `AC_SYS_LONG_FILE_NAMES'
5142 `AC_MINUS_C_MINUS_O'
5176 removed because of limited usefulness
5178 `AC_RESTARTABLE_SYSCALLS'
5179 `AC_SYS_RESTARTABLE_SYSCALLS'
5185 removed because of limited usefulness
5187 `AC_SETVBUF_REVERSED'
5188 `AC_FUNC_SETVBUF_REVERSED'
5199 `AC_STAT_MACROS_BROKEN'
5209 `AC_STRUCT_ST_BLKSIZE'
5212 `AC_STRUCT_ST_BLOCKS'
5217 `AC_SYS_SIGLIST_DECLARED'
5218 `AC_DECL_SYS_SIGLIST'
5227 `AC_STRUCT_TIMEZONE'
5229 `AC_TIME_WITH_SYS_TIME'
5236 `AC_FUNC_UTIME_NULL'
5250 `AC_WORDS_BIGENDIAN'
5257 File: autoconf.info, Node: Environment Variable Index, Next: Output Variable Index, Prev: Old Macro Names, Up: Top
5259 Environment Variable Index
5260 **************************
5262 This is an alphabetical list of the environment variables that
5267 * AC_MACRODIR <1>: Invoking autoupdate.
5268 * AC_MACRODIR <2>: Invoking autoheader.
5269 * AC_MACRODIR <3>: Invoking autoreconf.
5270 * AC_MACRODIR <4>: Invoking autoconf.
5271 * AC_MACRODIR <5>: Invoking ifnames.
5272 * AC_MACRODIR: Invoking autoscan.
5273 * CONFIG_FILES: Invoking config.status.
5274 * CONFIG_HEADERS: Invoking config.status.
5275 * CONFIG_SHELL: Invoking config.status.
5276 * CONFIG_SITE: Site Defaults.
5277 * CONFIG_STATUS: Invoking config.status.
5278 * SIMPLE_BACKUP_SUFFIX: Invoking autoupdate.
5281 File: autoconf.info, Node: Output Variable Index, Next: Preprocessor Symbol Index, Prev: Environment Variable Index, Up: Top
5283 Output Variable Index
5284 *********************
5286 This is an alphabetical list of the variables that Autoconf can
5287 substitute into files that it creates, typically one or more
5288 `Makefile's. *Note Setting Output Variables::, for more information on
5293 * ALLOCA: Particular Functions.
5294 * AWK: Particular Programs.
5295 * bindir: Preset Output Variables.
5296 * build: System Type Variables.
5297 * build_alias: System Type Variables.
5298 * build_cpu: System Type Variables.
5299 * build_os: System Type Variables.
5300 * build_vendor: System Type Variables.
5301 * CC <1>: UNIX Variants.
5302 * CC: Particular Programs.
5303 * CFLAGS <1>: Particular Programs.
5304 * CFLAGS: Preset Output Variables.
5305 * configure_input: Preset Output Variables.
5306 * CPP: Particular Programs.
5307 * CPPFLAGS: Preset Output Variables.
5308 * CXX: Particular Programs.
5309 * CXXCPP: Particular Programs.
5310 * CXXFLAGS <1>: Particular Programs.
5311 * CXXFLAGS: Preset Output Variables.
5312 * datadir: Preset Output Variables.
5313 * DEFS: Preset Output Variables.
5314 * exec_prefix: Preset Output Variables.
5315 * EXEEXT: System Services.
5316 * F77: Particular Programs.
5317 * FFLAGS <1>: Particular Programs.
5318 * FFLAGS: Preset Output Variables.
5319 * FLIBS: Fortran 77 Compiler Characteristics.
5320 * host: System Type Variables.
5321 * host_alias: System Type Variables.
5322 * host_cpu: System Type Variables.
5323 * host_os: System Type Variables.
5324 * host_vendor: System Type Variables.
5325 * includedir: Preset Output Variables.
5326 * infodir: Preset Output Variables.
5327 * INSTALL: Particular Programs.
5328 * INSTALL_DATA: Particular Programs.
5329 * INSTALL_PROGRAM: Particular Programs.
5330 * INSTALL_SCRIPT: Particular Programs.
5331 * KMEM_GROUP: Particular Functions.
5332 * LDFLAGS: Preset Output Variables.
5333 * LEX: Particular Programs.
5334 * LEX_OUTPUT_ROOT: Particular Programs.
5335 * LEXLIB: Particular Programs.
5336 * libdir: Preset Output Variables.
5337 * libexecdir: Preset Output Variables.
5338 * LIBOBJS <1>: Structures.
5339 * LIBOBJS <2>: Generic Functions.
5340 * LIBOBJS: Particular Functions.
5341 * LIBS <1>: UNIX Variants.
5342 * LIBS: Preset Output Variables.
5343 * LN_S: Particular Programs.
5344 * localstatedir: Preset Output Variables.
5345 * mandir: Preset Output Variables.
5346 * NEED_SETGID: Particular Functions.
5347 * OBJEXT: System Services.
5348 * oldincludedir: Preset Output Variables.
5349 * prefix: Preset Output Variables.
5350 * program_transform_name: Transforming Names.
5351 * RANLIB: Particular Programs.
5352 * sbindir: Preset Output Variables.
5354 * sharedstatedir: Preset Output Variables.
5355 * srcdir: Preset Output Variables.
5356 * subdirs: Subdirectories.
5357 * sysconfdir: Preset Output Variables.
5358 * target: System Type Variables.
5359 * target_alias: System Type Variables.
5360 * target_cpu: System Type Variables.
5361 * target_os: System Type Variables.
5362 * target_vendor: System Type Variables.
5363 * top_srcdir: Preset Output Variables.
5364 * X_CFLAGS: System Services.
5365 * X_EXTRA_LIBS: System Services.
5366 * X_LIBS: System Services.
5367 * X_PRE_LIBS: System Services.
5368 * YACC: Particular Programs.
5371 File: autoconf.info, Node: Preprocessor Symbol Index, Next: Macro Index, Prev: Output Variable Index, Up: Top
5373 Preprocessor Symbol Index
5374 *************************
5376 This is an alphabetical list of the C preprocessor symbols that the
5377 Autoconf macros define. To work with Autoconf, C source code needs to
5378 use these names in `#if' directives.
5382 * __CHAR_UNSIGNED__: C Compiler Characteristics.
5383 * _ALL_SOURCE: UNIX Variants.
5384 * _MINIX: UNIX Variants.
5385 * _POSIX_1_SOURCE: UNIX Variants.
5386 * _POSIX_SOURCE: UNIX Variants.
5387 * _POSIX_VERSION: Particular Headers.
5388 * C_ALLOCA: Particular Functions.
5389 * CLOSEDIR_VOID: Particular Functions.
5390 * const: C Compiler Characteristics.
5391 * DGUX: Particular Functions.
5392 * DIRENT: Particular Headers.
5393 * F77_NO_MINUS_C_MINUS_O: Particular Programs.
5394 * GETGROUPS_T: Particular Typedefs.
5395 * GETLODAVG_PRIVILEGED: Particular Functions.
5396 * GETPGRP_VOID: Particular Functions.
5397 * gid_t: Particular Typedefs.
5398 * HAVE_ALLOCA_H: Particular Functions.
5399 * HAVE_CONFIG_H: Configuration Headers.
5400 * HAVE_DIRENT_H: Particular Headers.
5401 * HAVE_DOPRNT: Particular Functions.
5402 * HAVE_FUNCTION: Generic Functions.
5403 * HAVE_GETMNTENT: Particular Functions.
5404 * HAVE_HEADER: Generic Headers.
5405 * HAVE_LONG_DOUBLE: C Compiler Characteristics.
5406 * HAVE_LONG_FILE_NAMES: System Services.
5407 * HAVE_MMAP: Particular Functions.
5408 * HAVE_NDIR_H: Particular Headers.
5409 * HAVE_RESTARTABLE_SYSCALLS: System Services.
5410 * HAVE_ST_BLKSIZE: Structures.
5411 * HAVE_ST_BLOCKS: Structures.
5412 * HAVE_ST_RDEV: Structures.
5413 * HAVE_STRCOLL: Particular Functions.
5414 * HAVE_STRFTIME: Particular Functions.
5415 * HAVE_STRINGIZE: C Compiler Characteristics.
5416 * HAVE_SYS_DIR_H: Particular Headers.
5417 * HAVE_SYS_NDIR_H: Particular Headers.
5418 * HAVE_SYS_WAIT_H: Particular Headers.
5419 * HAVE_TM_ZONE: Structures.
5420 * HAVE_TZNAME: Structures.
5421 * HAVE_UNISTD_H: Particular Headers.
5422 * HAVE_UTIME_NULL: Particular Functions.
5423 * HAVE_VFORK_H: Particular Functions.
5424 * HAVE_VPRINTF: Particular Functions.
5425 * HAVE_WAIT3: Particular Functions.
5426 * inline: C Compiler Characteristics.
5427 * INT_16_BITS: C Compiler Characteristics.
5428 * LONG_64_BITS: C Compiler Characteristics.
5429 * MAJOR_IN_MKDEV: Particular Headers.
5430 * MAJOR_IN_SYSMACROS: Particular Headers.
5431 * mode_t: Particular Typedefs.
5432 * NDIR: Particular Headers.
5433 * NEED_MEMORY_H: Particular Headers.
5434 * NEED_SETGID: Particular Functions.
5435 * NLIST_NAME_UNION: Particular Functions.
5436 * NLIST_STRUCT: Particular Functions.
5437 * NO_MINUS_C_MINUS_O: Particular Programs.
5438 * off_t: Particular Typedefs.
5439 * pid_t: Particular Typedefs.
5440 * RETSIGTYPE: Particular Typedefs.
5441 * SELECT_TYPE_ARG1: Particular Functions.
5442 * SELECT_TYPE_ARG234: Particular Functions.
5443 * SELECT_TYPE_ARG5: Particular Functions.
5444 * SETPGRP_VOID: Particular Functions.
5445 * SETVBUF_REVERSED: Particular Functions.
5446 * size_t: Particular Typedefs.
5447 * STDC_HEADERS: Particular Headers.
5448 * SVR4: Particular Functions.
5449 * SYS_SIGLIST_DECLARED: Particular Headers.
5450 * SYSDIR: Particular Headers.
5451 * SYSNDIR: Particular Headers.
5452 * TIME_WITH_SYS_TIME: Structures.
5453 * TM_IN_SYS_TIME: Structures.
5454 * uid_t: Particular Typedefs.
5455 * UMAX: Particular Functions.
5456 * UMAX4_3: Particular Functions.
5457 * USG: Particular Headers.
5458 * vfork: Particular Functions.
5459 * VOID_CLOSEDIR: Particular Headers.
5460 * WORDS_BIGENDIAN: C Compiler Characteristics.
5461 * YYTEXT_POINTER: Particular Programs.
5464 File: autoconf.info, Node: Macro Index, Prev: Preprocessor Symbol Index, Up: Top
5469 This is an alphabetical list of the Autoconf macros. To make the
5470 list easier to use, the macros are listed without their preceding `AC_'.
5474 * AIX: UNIX Variants.
5475 * ALLOCA: Old Macro Names.
5476 * ARG_ARRAY: Old Macro Names.
5477 * ARG_ENABLE: Package Options.
5478 * ARG_PROGRAM: Transforming Names.
5479 * ARG_WITH: External Software.
5480 * BEFORE: Suggested Ordering.
5481 * C_BIGENDIAN: C Compiler Characteristics.
5482 * C_CHAR_UNSIGNED: C Compiler Characteristics.
5483 * C_CONST: C Compiler Characteristics.
5484 * C_CROSS: Test Programs.
5485 * C_INLINE: C Compiler Characteristics.
5486 * C_LONG_DOUBLE: C Compiler Characteristics.
5487 * C_STRINGIZE: C Compiler Characteristics.
5488 * CACHE_CHECK: Caching Results.
5489 * CACHE_LOAD: Caching Results.
5490 * CACHE_SAVE: Caching Results.
5491 * CACHE_VAL: Caching Results.
5492 * CANONICAL_HOST: Canonicalizing.
5493 * CANONICAL_SYSTEM: Canonicalizing.
5494 * CHAR_UNSIGNED: Old Macro Names.
5495 * CHECK_FILE: Generic Programs.
5496 * CHECK_FILES: Generic Programs.
5497 * CHECK_FUNC: Generic Functions.
5498 * CHECK_FUNCS: Generic Functions.
5499 * CHECK_HEADER: Generic Headers.
5500 * CHECK_HEADERS: Generic Headers.
5501 * CHECK_LIB: Libraries.
5502 * CHECK_PROG: Generic Programs.
5503 * CHECK_PROGS: Generic Programs.
5504 * CHECK_SIZEOF: C Compiler Characteristics.
5505 * CHECK_TOOL: Generic Programs.
5506 * CHECK_TYPE: Generic Typedefs.
5507 * CHECKING: Printing Messages.
5508 * COMPILE_CHECK: Examining Libraries.
5509 * CONFIG_AUX_DIR: Input.
5510 * CONFIG_HEADER: Configuration Headers.
5511 * CONFIG_SUBDIRS: Subdirectories.
5512 * CONST: Old Macro Names.
5513 * CROSS_CHECK: Old Macro Names.
5514 * CYGWIN: System Services.
5515 * DECL_SYS_SIGLIST: Particular Headers.
5516 * DECL_YYTEXT: Particular Programs.
5517 * DEFINE: Defining Symbols.
5518 * DEFINE_UNQUOTED: Defining Symbols.
5519 * DEFUN: Macro Definitions.
5520 * DIR_HEADER: Particular Headers.
5521 * DYNIX_SEQ: UNIX Variants.
5522 * EGREP_CPP: Examining Declarations.
5523 * EGREP_HEADER: Examining Declarations.
5524 * ENABLE: Package Options.
5525 * ERROR: Old Macro Names.
5526 * EXEEXT: System Services.
5527 * F77_LIBRARY_LDFLAGS: Fortran 77 Compiler Characteristics.
5528 * FIND_X: Old Macro Names.
5529 * FIND_XTRA: Old Macro Names.
5530 * FUNC_ALLOCA: Particular Functions.
5531 * FUNC_CHECK: Old Macro Names.
5532 * FUNC_CLOSEDIR_VOID: Particular Functions.
5533 * FUNC_FNMATCH: Particular Functions.
5534 * FUNC_GETLOADAVG: Particular Functions.
5535 * FUNC_GETMNTENT: Particular Functions.
5536 * FUNC_GETPGRP: Particular Functions.
5537 * FUNC_MEMCMP: Particular Functions.
5538 * FUNC_MMAP: Particular Functions.
5539 * FUNC_SELECT_ARGTYPES: Particular Functions.
5540 * FUNC_SETPGRP: Particular Functions.
5541 * FUNC_SETVBUF_REVERSED: Particular Functions.
5542 * FUNC_STRCOLL: Particular Functions.
5543 * FUNC_STRFTIME: Particular Functions.
5544 * FUNC_UTIME_NULL: Particular Functions.
5545 * FUNC_VFORK: Particular Functions.
5546 * FUNC_VPRINTF: Particular Functions.
5547 * FUNC_WAIT3: Particular Functions.
5548 * GCC_TRADITIONAL: Old Macro Names.
5549 * GETGROUPS_T: Old Macro Names.
5550 * GETLOADAVG: Old Macro Names.
5551 * HAVE_FUNCS: Old Macro Names.
5552 * HAVE_HEADERS: Old Macro Names.
5553 * HAVE_LIBRARY: Libraries.
5554 * HAVE_POUNDBANG: Old Macro Names.
5555 * HEADER_CHECK: Old Macro Names.
5556 * HEADER_DIRENT: Particular Headers.
5557 * HEADER_EGREP: Old Macro Names.
5558 * HEADER_MAJOR: Particular Headers.
5559 * HEADER_STAT: Structures.
5560 * HEADER_STDC: Particular Headers.
5561 * HEADER_SYS_WAIT: Particular Headers.
5562 * HEADER_TIME: Structures.
5564 * INLINE: Old Macro Names.
5565 * INT_16_BITS: C Compiler Characteristics.
5566 * IRIX_SUN: UNIX Variants.
5567 * ISC_POSIX: UNIX Variants.
5568 * LANG_C: Language Choice.
5569 * LANG_CPLUSPLUS: Language Choice.
5570 * LANG_FORTRAN77: Language Choice.
5571 * LANG_RESTORE: Language Choice.
5572 * LANG_SAVE: Language Choice.
5573 * LINK_FILES: Using System Type.
5574 * LN_S: Old Macro Names.
5575 * LONG_64_BITS: C Compiler Characteristics.
5576 * LONG_DOUBLE: Old Macro Names.
5577 * LONG_FILE_NAMES: Old Macro Names.
5578 * MAJOR_HEADER: Old Macro Names.
5579 * MEMORY_H: Particular Headers.
5580 * MINGW32: System Services.
5581 * MINIX: UNIX Variants.
5582 * MINUS_C_MINUS_O: Old Macro Names.
5583 * MMAP: Old Macro Names.
5584 * MODE_T: Old Macro Names.
5585 * MSG_CHECKING: Printing Messages.
5586 * MSG_ERROR: Printing Messages.
5587 * MSG_RESULT: Printing Messages.
5588 * MSG_WARN: Printing Messages.
5589 * OBJEXT: System Services.
5590 * OBSOLETE: Obsolete Macros.
5591 * OFF_T: Old Macro Names.
5593 * PATH_PROG: Generic Programs.
5594 * PATH_PROGS: Generic Programs.
5595 * PATH_X: System Services.
5596 * PATH_XTRA: System Services.
5597 * PID_T: Old Macro Names.
5598 * PREFIX: Old Macro Names.
5599 * PREFIX_PROGRAM: Default Prefix.
5601 * PROG_AWK: Particular Programs.
5602 * PROG_CC: Particular Programs.
5603 * PROG_CC_C_O: Particular Programs.
5604 * PROG_CPP: Particular Programs.
5605 * PROG_CXX: Particular Programs.
5606 * PROG_CXXCPP: Particular Programs.
5607 * PROG_F77_C_O: Particular Programs.
5608 * PROG_FORTRAN: Particular Programs.
5609 * PROG_GCC_TRADITIONAL: Particular Programs.
5610 * PROG_INSTALL: Particular Programs.
5611 * PROG_LEX: Particular Programs.
5612 * PROG_LN_S: Particular Programs.
5613 * PROG_MAKE_SET: Output.
5614 * PROG_RANLIB: Particular Programs.
5615 * PROG_YACC: Particular Programs.
5616 * PROGRAM_CHECK: Old Macro Names.
5617 * PROGRAM_EGREP: Old Macro Names.
5618 * PROGRAM_PATH: Old Macro Names.
5619 * PROGRAMS_CHECK: Old Macro Names.
5620 * PROGRAMS_PATH: Old Macro Names.
5621 * PROVIDE: Prerequisite Macros.
5622 * REMOTE_TAPE: Old Macro Names.
5623 * REPLACE_FUNCS: Generic Functions.
5624 * REQUIRE: Prerequisite Macros.
5625 * REQUIRE_CPP: Language Choice.
5626 * RESTARTABLE_SYSCALLS: Old Macro Names.
5627 * RETSIGTYPE: Old Macro Names.
5628 * REVISION: Versions.
5629 * RSH: Old Macro Names.
5630 * SCO_INTL: UNIX Variants.
5631 * SEARCH_LIBS: Libraries.
5632 * SET_MAKE: Old Macro Names.
5633 * SETVBUF_REVERSED: Old Macro Names.
5634 * SIZE_T: Old Macro Names.
5635 * SIZEOF_TYPE: Old Macro Names.
5636 * ST_BLKSIZE: Old Macro Names.
5637 * ST_BLOCKS: Old Macro Names.
5638 * ST_RDEV: Old Macro Names.
5639 * STAT_MACROS_BROKEN <1>: Old Macro Names.
5640 * STAT_MACROS_BROKEN: Structures.
5641 * STDC_HEADERS: Old Macro Names.
5642 * STRCOLL: Old Macro Names.
5643 * STRUCT_ST_BLKSIZE: Structures.
5644 * STRUCT_ST_BLOCKS: Structures.
5645 * STRUCT_ST_RDEV: Structures.
5646 * STRUCT_TIMEZONE: Structures.
5647 * STRUCT_TM: Structures.
5648 * SUBST: Setting Output Variables.
5649 * SUBST_FILE: Setting Output Variables.
5650 * SYS_INTERPRETER: System Services.
5651 * SYS_LONG_FILE_NAMES: System Services.
5652 * SYS_RESTARTABLE_SYSCALLS: System Services.
5653 * SYS_SIGLIST_DECLARED: Old Macro Names.
5654 * TEST_CPP: Old Macro Names.
5655 * TEST_PROGRAM: Old Macro Names.
5656 * TIME_WITH_SYS_TIME: Old Macro Names.
5657 * TIMEZONE: Old Macro Names.
5658 * TRY_COMPILE: Examining Syntax.
5659 * TRY_CPP: Examining Declarations.
5660 * TRY_LINK: Examining Libraries.
5661 * TRY_LINK_FUNC: Examining Libraries.
5662 * TRY_RUN: Test Programs.
5663 * TYPE_GETGROUPS: Particular Typedefs.
5664 * TYPE_MODE_T: Particular Typedefs.
5665 * TYPE_OFF_T: Particular Typedefs.
5666 * TYPE_PID_T: Particular Typedefs.
5667 * TYPE_SIGNAL: Particular Typedefs.
5668 * TYPE_SIZE_T: Particular Typedefs.
5669 * TYPE_UID_T: Particular Typedefs.
5670 * UID_T: Old Macro Names.
5671 * UNISTD_H: Particular Headers.
5672 * USG: Particular Headers.
5673 * UTIME_NULL: Old Macro Names.
5674 * VALIDATE_CACHED_SYSTEM_TUPLE: Canonicalizing.
5675 * VERBOSE: Printing Messages.
5676 * VFORK: Old Macro Names.
5677 * VPRINTF: Old Macro Names.
5678 * WAIT3: Old Macro Names.
5679 * WARN: Old Macro Names.
5680 * WITH: External Software.
5681 * WORDS_BIGENDIAN: Old Macro Names.
5682 * XENIX_DIR: UNIX Variants.
5683 * YYTEXT_POINTER: Old Macro Names.
5689 Node: Introduction
\7f9711
5690 Node: Making configure Scripts
\7f13551
5691 Node: Writing configure.in
\7f16632
5692 Node: Invoking autoscan
\7f20365
5693 Node: Invoking ifnames
\7f22670
5694 Node: Invoking autoconf
\7f24160
5695 Node: Invoking autoreconf
\7f25998
5698 Node: Output
\7f31476
5699 Node: Makefile Substitutions
\7f35113
5700 Node: Preset Output Variables
\7f36716
5701 Node: Build Directories
\7f41585
5702 Node: Automatic Remaking
\7f43218
5703 Node: Configuration Headers
\7f45304
5704 Node: Header Templates
\7f47818
5705 Node: Invoking autoheader
\7f49027
5706 Node: Subdirectories
\7f52175
5707 Node: Default Prefix
\7f53570
5708 Node: Versions
\7f54974
5709 Node: Existing Tests
\7f56878
5710 Node: Alternative Programs
\7f58426
5711 Node: Particular Programs
\7f59113
5712 Node: Generic Programs
\7f67165
5713 Node: Libraries
\7f70471
5714 Node: Library Functions
\7f73545
5715 Node: Particular Functions
\7f74103
5716 Node: Generic Functions
\7f81297
5717 Node: Header Files
\7f83401
5718 Node: Particular Headers
\7f83960
5719 Node: Generic Headers
\7f90952
5720 Node: Structures
\7f92254
5721 Node: Typedefs
\7f94491
5722 Node: Particular Typedefs
\7f94997
5723 Node: Generic Typedefs
\7f96214
5724 Node: C Compiler Characteristics
\7f96671
5725 Node: Fortran 77 Compiler Characteristics
\7f99542
5726 Node: System Services
\7f101245
5727 Node: UNIX Variants
\7f104381
5728 Node: Writing Tests
\7f106400
5729 Node: Examining Declarations
\7f108393
5730 Node: Examining Syntax
\7f110885
5731 Node: Examining Libraries
\7f112330
5732 Node: Run Time
\7f116040
5733 Node: Test Programs
\7f117028
5734 Node: Guidelines
\7f119356
5735 Node: Test Functions
\7f120545
5736 Node: Portable Shell
\7f122088
5737 Node: Testing Values and Files
\7f124020
5738 Node: Multiple Cases
\7f125675
5739 Node: Language Choice
\7f126873
5740 Node: Results
\7f128975
5741 Node: Defining Symbols
\7f129737
5742 Node: Setting Output Variables
\7f133033
5743 Node: Caching Results
\7f134879
5744 Node: Cache Variable Names
\7f137625
5745 Node: Cache Files
\7f139109
5746 Node: Printing Messages
\7f141946
5747 Node: Writing Macros
\7f145394
5748 Node: Macro Definitions
\7f146041
5749 Node: Macro Names
\7f147169
5750 Node: Quoting
\7f149620
5751 Node: Dependencies Between Macros
\7f151522
5752 Node: Prerequisite Macros
\7f152169
5753 Node: Suggested Ordering
\7f153660
5754 Node: Obsolete Macros
\7f155190
5755 Node: Manual Configuration
\7f156414
5756 Node: Specifying Names
\7f157313
5757 Node: Canonicalizing
\7f159214
5758 Node: System Type Variables
\7f160726
5759 Node: Using System Type
\7f161473
5760 Node: Site Configuration
\7f162967
5761 Node: External Software
\7f163740
5762 Node: Package Options
\7f166943
5763 Node: Site Details
\7f169690
5764 Node: Transforming Names
\7f170913
5765 Node: Transformation Options
\7f172091
5766 Node: Transformation Examples
\7f172584
5767 Node: Transformation Rules
\7f174152
5768 Node: Site Defaults
\7f175561
5769 Node: Invoking configure
\7f179467
5770 Node: Basic Installation
\7f180416
5771 Node: Compilers and Options
\7f182996
5772 Node: Multiple Architectures
\7f183645
5773 Node: Installation Names
\7f184631
5774 Node: Optional Features
\7f185815
5775 Node: System Type
\7f186585
5776 Node: Sharing Defaults
\7f187607
5777 Node: Operation Controls
\7f188231
5778 Node: Invoking config.status
\7f189217
5779 Node: Questions
\7f192605
5780 Node: Distributing
\7f193137
5781 Node: Why GNU m4
\7f194281
5782 Node: Bootstrapping
\7f195094
5783 Node: Why Not Imake
\7f195710
5784 Node: Upgrading
\7f200119
5785 Node: Changed File Names
\7f201640
5786 Node: Changed Makefiles
\7f202394
5787 Node: Changed Macros
\7f203490
5788 Node: Invoking autoupdate
\7f204737
5789 Node: Changed Results
\7f206328
5790 Node: Changed Macro Writing
\7f208430
5791 Node: History
\7f209693
5792 Node: Genesis
\7f210485
5793 Node: Exodus
\7f211674
5794 Node: Leviticus
\7f214723
5795 Node: Numbers
\7f216246
5796 Node: Deuteronomy
\7f218162
5797 Node: Old Macro Names
\7f220826
5798 Node: Environment Variable Index
\7f223875
5799 Node: Output Variable Index
\7f224889
5800 Node: Preprocessor Symbol Index
\7f230087
5801 Node: Macro Index
\7f235373