home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / autoconf.10 / autoconf / autoconf-2.10 / autoconf.info < prev    next >
Encoding:
GNU Info File  |  1996-03-08  |  227.8 KB  |  5,460 lines

  1. This is Info file ../autoconf.info, produced by Makeinfo-1.63 from the
  2. input file ../autoconf.texi.
  3.  
  4. START-INFO-DIR-ENTRY
  5. * Autoconf: (autoconf).         Create source code configuration scripts.
  6. END-INFO-DIR-ENTRY
  7.  
  8.    Autoconf: Creating Automatic Configuration Scripts, by David
  9. MacKenzie.
  10.  
  11.    This file documents the GNU Autoconf package for creating scripts to
  12. configure source code packages using templates and an `m4' macro
  13. package.
  14.  
  15.    Copyright (C) 1992, 1993, 1994, 1995, 1996 Free Software Foundation,
  16. Inc.
  17.  
  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.
  21.  
  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.
  26.  
  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.
  31.  
  32. 
  33. File: autoconf.info,  Node: Top,  Next: Introduction,  Up: (dir)
  34.  
  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.8, for Autoconf version 2.8.
  38.  
  39. * Menu:
  40.  
  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.
  60.  
  61.  -- The Detailed Node Listing --
  62.  
  63. Making `configure' Scripts
  64.  
  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.
  70.  
  71. Initialization and Output Files
  72.  
  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'.
  80.  
  81. Substitutions in Makefiles
  82.  
  83. * Preset Output Variables::    Output variables that are always set.
  84. * Build Directories::       Supporting multiple concurrent compiles.
  85. * Automatic Remaking::        Makefile rules for configuring.
  86.  
  87. Configuration Header Files
  88.  
  89. * Header Templates::            Input for the configuration headers.
  90. * Invoking autoheader::        How to create configuration templates.
  91.  
  92. Existing Tests
  93.  
  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. * Compiler Characteristics::    C compiler or machine architecture features.
  101. * System Services::        Operating system services.
  102. * UNIX Variants::        Special kludges for specific UNIX variants.
  103.  
  104. Alternative Programs
  105.  
  106. * Particular Programs::         Special handling to find certain programs.
  107. * Generic Programs::            How to find other programs.
  108.  
  109. Library Functions
  110.  
  111. * Particular Functions::        Special handling to find certain functions.
  112. * Generic Functions::           How to find other functions.
  113.  
  114. Header Files
  115.  
  116. * Particular Headers::          Special handling to find certain headers.
  117. * Generic Headers::             How to find other headers.
  118.  
  119. Typedefs
  120.  
  121. * Particular Typedefs::         Special handling to find certain types.
  122. * Generic Typedefs::            How to find other types.
  123.  
  124. Writing Tests
  125.  
  126. * Examining Declarations::    Detecting header files and declarations.
  127. * Examining Syntax::            Detecting language syntax features.
  128. * Examining Libraries::         Detecting functions and global variables.
  129. * Run Time::                Testing for run-time features.
  130. * Portable Shell::              Shell script portability pitfalls.
  131. * Testing Values and Files::    Checking strings and files.
  132. * Multiple Cases::        Tests for several possible values.
  133. * Language Choice::             Selecting which language to use for testing.
  134.  
  135. Checking Run Time Behavior
  136.  
  137. * Test Programs::               Running test programs.
  138. * Guidelines::            General rules for writing test programs.
  139. * Test Functions::        Avoiding pitfalls in test programs.
  140.  
  141. Results of Tests
  142.  
  143. * Defining Symbols::            Defining C preprocessor symbols.
  144. * Setting Output Variables::    Replacing variables in output files.
  145. * Caching Results::             Speeding up subsequent `configure' runs.
  146. * Printing Messages::           Notifying users of progress or problems.
  147.  
  148. Caching Results
  149.  
  150. * Cache Variable Names::        Shell variables used in caches.
  151. * Cache Files::                Files `configure' uses for caching.
  152.  
  153. Writing Macros
  154.  
  155. * Macro Definitions::        Basic format of an Autoconf macro.
  156. * Macro Names::                 What to call your new macros.
  157. * Quoting::            Protecting macros from unwanted expansion.
  158. * Dependencies Between Macros::    What to do when macros depend on other macros.
  159.  
  160. Dependencies Between Macros
  161.  
  162. * Prerequisite Macros::        Ensuring required information.
  163. * Suggested Ordering::        Warning about possible ordering problems.
  164. * Obsolete Macros::             Warning about old ways of doing things.
  165.  
  166. Manual Configuration
  167.  
  168. * Specifying Names::            Specifying the system type.
  169. * Canonicalizing::              Getting the canonical system type.
  170. * System Type Variables::       Variables containing the system type.
  171. * Using System Type::           What to do with the system type.
  172.  
  173. Site Configuration
  174.  
  175. * External Software::           Working with other optional software.
  176. * Package Options::             Selecting optional features.
  177. * Site Details::                Configuring site details.
  178. * Transforming Names::          Changing program names when installing.
  179. * Site Defaults::               Giving `configure' local defaults.
  180.  
  181. Transforming Program Names When Installing
  182.  
  183. * Transformation Options::      `configure' options to transform names.
  184. * Transformation Examples::     Sample uses of transforming names.
  185. * Transformation Rules::        `Makefile' uses of transforming names.
  186.  
  187. Running `configure' Scripts
  188.  
  189. * Basic Installation::          Instructions for typical cases.
  190. * Compilers and Options::       Selecting compilers and optimization.
  191. * Multiple Architectures::      Compiling for multiple architectures at once.
  192. * Installation Names::          Installing in different directories.
  193. * Optional Features::           Selecting optional features.
  194. * System Type::                 Specifying the system type.
  195. * Sharing Defaults::            Setting site-wide defaults for `configure'.
  196. * Operation Controls::          Changing how `configure' runs.
  197.  
  198. Questions About Autoconf
  199.  
  200. * Distributing::                Distributing `configure' scripts.
  201. * Why GNU m4::                  Why not use the standard `m4'?
  202. * Bootstrapping::               Autoconf and GNU `m4' require each other?
  203. * Why Not Imake::               Why GNU uses `configure' instead of Imake.
  204.  
  205. Upgrading From Version 1
  206.  
  207. * Changed File Names::          Files you might rename.
  208. * Changed Makefiles::           New things to put in `Makefile.in'.
  209. * Changed Macros::              Macro calls you might replace.
  210. * Invoking autoupdate::         Replacing old macro names in `configure.in'.
  211. * Changed Results::             Changes in how to check test results.
  212. * Changed Macro Writing::       Better ways to write your own macros.
  213.  
  214. History of Autoconf
  215.  
  216. * Genesis::            Prehistory and naming of `configure'.
  217. * Exodus::            The plagues of `m4' and Perl.
  218. * Leviticus::            The priestly code of portability arrives.
  219. * Numbers::            Growth and contributors.
  220. * Deuteronomy::            Approaching the promises of easy configuration.
  221.  
  222. 
  223. File: autoconf.info,  Node: Introduction,  Next: Making configure Scripts,  Prev: Top,  Up: Top
  224.  
  225. Introduction
  226. ************
  227.  
  228.      A physicist, an engineer, and a computer scientist were
  229.      discussing the nature of God.  Surely a Physicist, said the
  230.      physicist, because early in the Creation, God made Light; and you
  231.      know, Maxwell's equations, the dual nature of electro-magnetic
  232.      waves, the relativist consequences... An Engineer!, said the
  233.      engineer, because before making Light, God split the Chaos into
  234.      Land and Water; it takes a hell of an engineer to handle that big
  235.      amount of mud, and orderly separation of solids from
  236.      liquids... The computer scientist shouted: And the Chaos,
  237.      where do you think it was coming from, hmm?
  238.      
  239.      ---Anonymous
  240.  
  241.    Autoconf is a tool for producing shell scripts that automatically
  242. configure software source code packages to adapt to many kinds of
  243. UNIX-like systems.  The configuration scripts produced by Autoconf are
  244. independent of Autoconf when they are run, so their users do not need to
  245. have Autoconf.
  246.  
  247.    The configuration scripts produced by Autoconf require no manual user
  248. intervention when run; they do not normally even need an argument
  249. specifying the system type.  Instead, they test for the presence of each
  250. feature that the software package they are for might need individually.
  251. (Before each check, they print a one-line message stating what they are
  252. checking for, so the user doesn't get too bored while waiting for the
  253. script to finish.)  As a result, they deal well with systems that are
  254. hybrids or customized from the more common UNIX variants.  There is no
  255. need to maintain files that list the features supported by each release
  256. of each variant of UNIX.
  257.  
  258.    For each software package that Autoconf is used with, it creates a
  259. configuration script from a template file that lists the system
  260. features that the package needs or can use.  After the shell code to
  261. recognize and respond to a system feature has been written, Autoconf
  262. allows it to be shared by many software packages that can use (or need)
  263. that feature.  If it later turns out that the shell code needs
  264. adjustment for some reason, it needs to be changed in only one place;
  265. all of the configuration scripts can be regenerated automatically to
  266. take advantage of the updated code.
  267.  
  268.    The Metaconfig package is similar in purpose to Autoconf, but the
  269. scripts it produces require manual user intervention, which is quite
  270. inconvenient when configuring large source trees.  Unlike Metaconfig
  271. scripts, Autoconf scripts can support cross-compiling, if some care is
  272. taken in writing them.
  273.  
  274.    There are several jobs related to making portable software packages
  275. that Autoconf currently does not do.  Among these are automatically
  276. creating `Makefile' files with all of the standard targets, and
  277. supplying replacements for standard library functions and header files
  278. on systems that lack them.  Work is in progress to add those features in
  279. the future.
  280.  
  281.    Autoconf imposes some restrictions on the names of macros used with
  282. `#ifdef' in C programs (*note Preprocessor Symbol Index::.).
  283.  
  284.    Autoconf requires GNU `m4' in order to generate the scripts.  It
  285. uses features that some UNIX versions of `m4' do not have.  It also
  286. overflows internal limits of some versions of `m4', including GNU `m4'
  287. 1.0.  You must use version 1.1 or later of GNU `m4'.  Using version 1.3
  288. or later will be much faster than 1.1 or 1.2.
  289.  
  290.    *Note Upgrading::, for information about upgrading from version 1.
  291. *Note History::, for the story of Autoconf's development.  *Note
  292. Questions::, for answers to some common questions about Autoconf.
  293.  
  294.    Mail suggestions and bug reports for Autoconf to
  295. `bug-gnu-utils@prep.ai.mit.edu'.  Please include the Autoconf version
  296. number, which you can get by running `autoconf --version'.
  297.  
  298. 
  299. File: autoconf.info,  Node: Making configure Scripts,  Next: Setup,  Prev: Introduction,  Up: Top
  300.  
  301. Making `configure' Scripts
  302. **************************
  303.  
  304.    The configuration scripts that Autoconf produces are by convention
  305. called `configure'.  When run, `configure' creates several files,
  306. replacing configuration parameters in them with appropriate values.
  307. The files that `configure' creates are:
  308.  
  309.    * one or more `Makefile' files, one in each subdirectory of the
  310.      package (*note Makefile Substitutions::.);
  311.  
  312.    * optionally, a C header file, the name of which is configurable,
  313.      containing `#define' directives (*note Configuration Headers::.);
  314.  
  315.    * a shell script called `config.status' that, when run, will recreate
  316.      the files listed above (*note Invoking config.status::.);
  317.  
  318.    * a shell script called `config.cache' that saves the results of
  319.      running many of the tests (*note Cache Files::.);
  320.  
  321.    * a file called `config.log' containing any messages produced by
  322.      compilers, to help debugging if `configure' makes a mistake.
  323.  
  324.    To create a `configure' script with Autoconf, you need to write an
  325. Autoconf input file `configure.in' and run `autoconf' on it.  If you
  326. write your own feature tests to supplement those that come with
  327. Autoconf, you might also write files called `aclocal.m4' and
  328. `acsite.m4'.  If you use a C header file to contain `#define'
  329. directives, you might also write `acconfig.h', and you will distribute
  330. the Autoconf-generated file `config.h.in' with the package.
  331.  
  332.    Here is a diagram showing how the files that can be used in
  333. configuration are produced.  Programs that are executed are suffixed by
  334. `*'.  Optional files are enclosed in square brackets (`[]').
  335. `autoconf' and `autoheader' also read the installed Autoconf macro
  336. files (by reading `autoconf.m4').
  337.  
  338. Files used in preparing a software package for distribution:
  339.      your source files --> [autoscan*] --> [configure.scan] --> configure.in
  340.      
  341.      configure.in --.   .------> autoconf* -----> configure
  342.                     +---+
  343.      [aclocal.m4] --+   `---.
  344.      [acsite.m4] ---'       |
  345.                             +--> [autoheader*] -> [config.h.in]
  346.      [acconfig.h] ----.     |
  347.                       +-----'
  348.      [config.h.top] --+
  349.      [config.h.bot] --'
  350.      
  351.      Makefile.in -------------------------------> Makefile.in
  352.  
  353. Files used in configuring a software package:
  354.                             .-------------> config.cache
  355.      configure* ------------+-------------> config.log
  356.                             |
  357.      [config.h.in] -.       v            .-> [config.h] -.
  358.                     +--> config.status* -+               +--> make*
  359.      Makefile.in ---'                    `-> Makefile ---'
  360.  
  361. * Menu:
  362.  
  363. * Writing configure.in::    What to put in an Autoconf input file.
  364. * Invoking autoscan::           Semi-automatic `configure.in' writing.
  365. * Invoking ifnames::            Listing the conditionals in source code.
  366. * Invoking autoconf::        How to create configuration scripts.
  367. * Invoking autoreconf::         Remaking multiple `configure' scripts.
  368.  
  369. 
  370. File: autoconf.info,  Node: Writing configure.in,  Next: Invoking autoscan,  Up: Making configure Scripts
  371.  
  372. Writing `configure.in'
  373. ======================
  374.  
  375.    To produce a `configure' script for a software package, create a
  376. file called `configure.in' that contains invocations of the Autoconf
  377. macros that test the system features your package needs or can use.
  378. Autoconf macros already exist to check for many features; see *Note
  379. Existing Tests::, for their descriptions.  For most other features, you
  380. can use Autoconf template macros to produce custom checks; see *Note
  381. Writing Tests::, for information about them.  For especially tricky or
  382. specialized features, `configure.in' might need to contain some
  383. hand-crafted shell commands.  The `autoscan' program can give you a
  384. good start in writing `configure.in' (*note Invoking autoscan::., for
  385. more information).
  386.  
  387.    The order in which `configure.in' calls the Autoconf macros is not
  388. important, with a few exceptions.  Every `configure.in' must contain a
  389. call to `AC_INIT' before the checks, and a call to `AC_OUTPUT' at the
  390. end (*note Output::.).  Additionally, some macros rely on other macros
  391. having been called first, because they check previously set values of
  392. some variables to decide what to do.  These macros are noted in the
  393. individual descriptions (*note Existing Tests::.), and they also warn
  394. you when creating `configure' if they are called out of order.
  395.  
  396.    To encourage consistency, here is a suggested order for calling the
  397. Autoconf macros.  Generally speaking, the things near the end of this
  398. list could depend on things earlier in it.  For example, library
  399. functions could be affected by typedefs and libraries.
  400.  
  401.      `AC_INIT(FILE)'
  402.      checks for programs
  403.      checks for libraries
  404.      checks for header files
  405.      checks for typedefs
  406.      checks for structures
  407.      checks for compiler characteristics
  408.      checks for library functions
  409.      checks for system services
  410.      `AC_OUTPUT([FILE...])'
  411.  
  412.    It is best to put each macro call on its own line in `configure.in'.
  413. Most of the macros don't add extra newlines; they rely on the newline
  414. after the macro call to terminate the commands.  This approach makes
  415. the generated `configure' script a little easier to read by not
  416. inserting lots of blank lines.  It is generally safe to set shell
  417. variables on the same line as a macro call, because the shell allows
  418. assignments without intervening newlines.
  419.  
  420.    When calling macros that take arguments, there must not be any blank
  421. space between the macro name and the open parenthesis.  Arguments can be
  422. more than one line long if they are enclosed within the `m4' quote
  423. characters `[' and `]'.  If you have a long line such as a list of file
  424. names, you can generally use a backslash at the end of a line to
  425. continue it logically on the next line (this is implemented by the
  426. shell, not by anything special that Autoconf does).
  427.  
  428.    Some macros handle two cases: what to do if the given condition is
  429. met, and what to do if the condition is not met.  In some places you
  430. might want to do something if a condition is true but do nothing if it's
  431. false, or vice versa.  To omit the true case, pass an empty value for
  432. the ACTION-IF-FOUND argument to the macro.  To omit the false case,
  433. omit the ACTION-IF-NOT-FOUND argument to the macro, including the comma
  434. before it.
  435.  
  436.    You can include comments in `configure.in' files by starting them
  437. with the `m4' builtin macro `dnl', which discards text up through the
  438. next newline.  These comments do not appear in the generated
  439. `configure' scripts.  For example, it is helpful to begin
  440. `configure.in' files with a line like this:
  441.  
  442.      dnl Process this file with autoconf to produce a configure script.
  443.  
  444. 
  445. File: autoconf.info,  Node: Invoking autoscan,  Next: Invoking ifnames,  Prev: Writing configure.in,  Up: Making configure Scripts
  446.  
  447. Using `autoscan' to Create `configure.in'
  448. =========================================
  449.  
  450.    The `autoscan' program can help you create a `configure.in' file for
  451. a software package.  `autoscan' examines source files in the directory
  452. tree rooted at a directory given as a command line argument, or the
  453. current directory if none is given.  It searches the source files for
  454. common portability problems and creates a file `configure.scan' which
  455. is a preliminary `configure.in' for that package.
  456.  
  457.    You should manually examine `configure.scan' before renaming it to
  458. `configure.in'; it will probably need some adjustments.  Occasionally
  459. `autoscan' outputs a macro in the wrong order relative to another
  460. macro, so that `autoconf' produces a warning; you need to move such
  461. macros manually.  Also, if you want the package to use a configuration
  462. header file, you must add a call to `AC_CONFIG_HEADER' (*note
  463. Configuration Headers::.).  You might also have to change or add some
  464. `#if' directives to your program in order to make it work with Autoconf
  465. (*note Invoking ifnames::., for information about a program that can
  466. help with that job).
  467.  
  468.    `autoscan' uses several data files, which are installed along with
  469. the distributed Autoconf macro files, to determine which macros to
  470. output when it finds particular symbols in a package's source files.
  471. These files all have the same format.  Each line consists of a symbol,
  472. whitespace, and the Autoconf macro to output if that symbol is
  473. encountered.  Lines starting with `#' are comments.
  474.  
  475.    `autoscan' is only installed if you already have Perl installed.
  476. `autoscan' accepts the following options:
  477.  
  478. `--help'
  479.      Print a summary of the command line options and exit.
  480.  
  481. `--macrodir=DIR'
  482.      Look for the data files in directory DIR instead of the default
  483.      installation directory.  You can also set the `AC_MACRODIR'
  484.      environment variable to a directory; this option overrides the
  485.      environment variable.
  486.  
  487. `--verbose'
  488.      Print the names of the files it examines and the potentially
  489.      interesting symbols it finds in them.  This output can be
  490.      voluminous.
  491.  
  492. `--version'
  493.      Print the version number of Autoconf and exit.
  494.  
  495. 
  496. File: autoconf.info,  Node: Invoking ifnames,  Next: Invoking autoconf,  Prev: Invoking autoscan,  Up: Making configure Scripts
  497.  
  498. Using `ifnames' to List Conditionals
  499. ====================================
  500.  
  501.    `ifnames' can help when writing a `configure.in' for a software
  502. package.  It prints the identifiers that the package already uses in C
  503. preprocessor conditionals.  If a package has already been set up to
  504. have some portability, this program can help you figure out what its
  505. `configure' needs to check for.  It may help fill in some gaps in a
  506. `configure.in' generated by `autoscan' (*note Invoking autoscan::.).
  507.  
  508.    `ifnames' scans all of the C source files named on the command line
  509. (or the standard input, if none are given) and writes to the standard
  510. output a sorted list of all the identifiers that appear in those files
  511. in `#if', `#elif', `#ifdef', or `#ifndef' directives.  It prints each
  512. identifier on a line, followed by a space-separated list of the files
  513. in which that identifier occurs.
  514.  
  515. `ifnames' accepts the following options:
  516.  
  517. `--help'
  518. `-h'
  519.      Print a summary of the command line options and exit.
  520.  
  521. `--macrodir=DIR'
  522. `-m DIR'
  523.      Look for the Autoconf macro files in directory DIR instead of the
  524.      default installation directory.  Only used to get the version
  525.      number.  You can also set the `AC_MACRODIR' environment variable
  526.      to a directory; this option overrides the environment variable.
  527.  
  528. `--version'
  529.      Print the version number of Autoconf and exit.
  530.  
  531. 
  532. File: autoconf.info,  Node: Invoking autoconf,  Next: Invoking autoreconf,  Prev: Invoking ifnames,  Up: Making configure Scripts
  533.  
  534. Using `autoconf' to Create `configure'
  535. ======================================
  536.  
  537.    To create `configure' from `configure.in', run the `autoconf'
  538. program with no arguments.  `autoconf' processes `configure.in' with
  539. the `m4' macro processor, using the Autoconf macros.  If you give
  540. `autoconf' an argument, it reads that file instead of `configure.in'
  541. and writes the configuration script to the standard output instead of
  542. to `configure'.  If you give `autoconf' the argument `-', it reads the
  543. standard input instead of `configure.in' and writes the configuration
  544. script on the standard output.
  545.  
  546.    The Autoconf macros are defined in several files.  Some of the files
  547. are distributed with Autoconf; `autoconf' reads them first.  Then it
  548. looks for the optional file `acsite.m4' in the directory that contains
  549. the distributed Autoconf macro files, and for the optional file
  550. `aclocal.m4' in the current directory.  Those files can contain your
  551. site's or the package's own Autoconf macro definitions (*note Writing
  552. Macros::., for more information).  If a macro is defined in more than
  553. one of the files that `autoconf' reads, the last definition it reads
  554. overrides the earlier ones.
  555.  
  556.    `autoconf' accepts the following options:
  557.  
  558. `--help'
  559. `-h'
  560.      Print a summary of the command line options and exit.
  561.  
  562. `--localdir=DIR'
  563. `-l DIR'
  564.      Look for the package file `aclocal.m4' in directory DIR instead of
  565.      in the current directory.
  566.  
  567. `--macrodir=DIR'
  568. `-m DIR'
  569.      Look for the installed macro files in directory DIR.  You can also
  570.      set the `AC_MACRODIR' environment variable to a directory; this
  571.      option overrides the environment variable.
  572.  
  573. `--version'
  574.      Print the version number of Autoconf and exit.
  575.  
  576. 
  577. File: autoconf.info,  Node: Invoking autoreconf,  Prev: Invoking autoconf,  Up: Making configure Scripts
  578.  
  579. Using `autoreconf' to Update `configure' Scripts
  580. ================================================
  581.  
  582.    If you have a lot of Autoconf-generated `configure' scripts, the
  583. `autoreconf' program can save you some work.  It runs `autoconf' (and
  584. `autoheader', where appropriate) repeatedly to remake the Autoconf
  585. `configure' scripts and configuration header templates in the directory
  586. tree rooted at the current directory.  By default, it only remakes
  587. those files that are older than their `configure.in' or (if present)
  588. `aclocal.m4'.  Since `autoheader' does not change the timestamp of its
  589. output file if the file wouldn't be changing, this is not necessarily
  590. the minimum amount of work.  If you install a new version of Autoconf,
  591. you can make `autoreconf' remake *all* of the files by giving it the
  592. `--force' option.
  593.  
  594.    If you give `autoreconf' the `--macrodir=DIR' or `--localdir=DIR'
  595. options, it passes them down to `autoconf' and `autoheader' (with
  596. relative paths adjusted properly).
  597.  
  598.    *Note Automatic Remaking::, for `Makefile' rules to automatically
  599. remake `configure' scripts when their source files change.  That method
  600. handles the timestamps of configuration header templates properly, but
  601. does not pass `--macrodir=DIR' or `--localdir=DIR'.
  602.  
  603. `autoreconf' accepts the following options:
  604.  
  605. `--help'
  606. `-h'
  607.      Print a summary of the command line options and exit.
  608.  
  609. `--force'
  610. `-f'
  611.      Remake even `configure' scripts and configuration headers that are
  612.      newer than their input files (`configure.in' and, if present,
  613.      `aclocal.m4').
  614.  
  615. `--localdir=DIR'
  616. `-l DIR'
  617.      Look for the package files `aclocal.m4' and `acconfig.h' (but not
  618.      `FILE.top' and `FILE.bot') in directory DIR instead of in the
  619.      directory containing each `configure.in'.
  620.  
  621. `--macrodir=DIR'
  622. `-m DIR'
  623.      Look for the Autoconf macro files in directory DIR instead of the
  624.      default installation directory.  You can also set the `AC_MACRODIR'
  625.      environment variable to a directory; this option overrides the
  626.      environment variable.
  627.  
  628. `--verbose'
  629.      Print the name of each directory where `autoreconf' runs
  630.      `autoconf' (and `autoheader', if appropriate).
  631.  
  632. `--version'
  633.      Print the version number of Autoconf and exit.
  634.  
  635. 
  636. File: autoconf.info,  Node: Setup,  Next: Existing Tests,  Prev: Making configure Scripts,  Up: Top
  637.  
  638. Initialization and Output Files
  639. *******************************
  640.  
  641.    Autoconf-generated `configure' scripts need some information about
  642. how to initialize, such as how to find the package's source files; and
  643. about the output files to produce.  The following sections describe
  644. initialization and creating output files.
  645.  
  646. * Menu:
  647.  
  648. * Input::                       Where Autoconf should find files.
  649. * Output::            Creating output files.
  650. * Makefile Substitutions::      Using output variables in `Makefile's.
  651. * Configuration Headers::       Creating a configuration header file.
  652. * Subdirectories::              Configuring independent packages together.
  653. * Default Prefix::              Changing the default installation prefix.
  654. * Versions::                    Version numbers in `configure'.
  655.  
  656. 
  657. File: autoconf.info,  Node: Input,  Next: Output,  Up: Setup
  658.  
  659. Finding `configure' Input
  660. =========================
  661.  
  662.    Every `configure' script must call `AC_INIT' before doing anything
  663. else.  The only other required macro is `AC_OUTPUT' (*note Output::.).
  664.  
  665.  - Macro: AC_INIT (UNIQUE-FILE-IN-SOURCE-DIR)
  666.      Process any command-line arguments and find the source code
  667.      directory.  UNIQUE-FILE-IN-SOURCE-DIR is some file that is in the
  668.      package's source directory; `configure' checks for this file's
  669.      existence to make sure that the directory that it is told contains
  670.      the source code in fact does.  Occasionally people accidentally
  671.      specify the wrong directory with `--srcdir'; this is a safety
  672.      check.  *Note Invoking configure::, for more information.
  673.  
  674.    Packages that do manual configuration or use the `install' program
  675. might need to tell `configure' where to find some other shell scripts
  676. by calling `AC_CONFIG_AUX_DIR', though the default places it looks are
  677. correct for most cases.
  678.  
  679.  - Macro: AC_CONFIG_AUX_DIR(DIR)
  680.      Use the `install-sh', `config.sub', `config.guess', and Cygnus
  681.      `configure' scripts that are in directory DIR.  These are
  682.      auxiliary files used in configuration.  DIR can be either absolute
  683.      or relative to `SRCDIR'.  The default is `SRCDIR' or `SRCDIR/..' or
  684.      `SRCDIR/../..', whichever is the first that contains `install-sh'.
  685.      The other files are not checked for, so that using
  686.      `AC_PROG_INSTALL' does not automatically require distributing the
  687.      other auxiliary files.  It checks for `install.sh' also, but that
  688.      name is obsolete because some `make' programs have a rule that
  689.      creates `install' from it if there is no `Makefile'.
  690.  
  691. 
  692. File: autoconf.info,  Node: Output,  Next: Makefile Substitutions,  Prev: Input,  Up: Setup
  693.  
  694. Creating Output Files
  695. =====================
  696.  
  697.    Every Autoconf-generated `configure' script must finish by calling
  698. `AC_OUTPUT'.  It is the macro that creates the `Makefile's and optional
  699. other files resulting from configuration.  The only other required
  700. macro is `AC_INIT' (*note Input::.).
  701.  
  702.  - Macro: AC_OUTPUT ([FILE...] [,EXTRA-CMDS] [,INIT-CMDS])
  703.      Create output files.  The FILE... argument is a
  704.      whitespace-separated list of output files; it may be empty.  This
  705.      macro creates each file `FILE' by copying an input file (by default
  706.      named `FILE.in'), substituting the output variable values.  *Note
  707.      Makefile Substitutions::, for more information on using output
  708.      variables.  *Note Setting Output Variables::, for more information
  709.      on creating them.  This macro creates the directory that the file
  710.      is in if it doesn't exist (but not the parents of that directory).
  711.      Usually, `Makefile's are created this way, but other files, such
  712.      as `.gdbinit', can be specified as well.
  713.  
  714.      If `AC_CONFIG_HEADER', `AC_LINK_FILES', or `AC_CONFIG_SUBDIRS' has
  715.      been called, this macro also creates the files named as their
  716.      arguments.
  717.  
  718.      A typical call to `AC_OUTPUT' looks like this:
  719.           AC_OUTPUT(Makefile src/Makefile man/Makefile X/Imakefile)
  720.  
  721.      You can override an input file name by appending it to FILE,
  722.      separated by a colon.  For example,
  723.           AC_OUTPUT(Makefile:templates/top.mk lib/Makefile:templates/lib.mk)
  724.  
  725.      If you pass EXTRA-CMDS, those commands will be inserted into
  726.      `config.status' to be run after all its other processing.  If
  727.      INIT-CMDS are given, they are inserted just before EXTRA-CMDS,
  728.      with shell variable, command, and backslash substitutions
  729.      performed on them in `configure'.  You can use INIT-CMDS to pass
  730.      variables from `configure' to the EXTRA-CMDS.
  731.  
  732.    If you run `make' on subdirectories, you should run it using the
  733. `make' variable `MAKE'.  Most versions of `make' set `MAKE' to the name
  734. of the `make' program plus any options it was given.  (But many do not
  735. include in it the values of any variables set on the command line, so
  736. those are not passed on automatically.) Some old versions of `make' do
  737. not set this variable.  The following macro allows you to use it even
  738. with those versions.
  739.  
  740.  - Macro: AC_PROG_MAKE_SET
  741.      If `make' predefines the variable `MAKE', define output variable
  742.      `SET_MAKE' to be empty.  Otherwise, define `SET_MAKE' to contain
  743.      `MAKE=make'.  Calls `AC_SUBST' for `SET_MAKE'.
  744.  
  745.    To use this macro, place a line like this in each `Makefile.in' that
  746. runs `MAKE' on other directories:
  747.  
  748.      @SET_MAKE@
  749.  
  750. 
  751. File: autoconf.info,  Node: Makefile Substitutions,  Next: Configuration Headers,  Prev: Output,  Up: Setup
  752.  
  753. Substitutions in Makefiles
  754. ==========================
  755.  
  756.    Each subdirectory in a distribution that contains something to be
  757. compiled or installed should come with a file `Makefile.in', from which
  758. `configure' will create a `Makefile' in that directory.  To create a
  759. `Makefile', `configure' performs a simple variable substitution,
  760. replacing occurrences of `@VARIABLE@' in `Makefile.in' with the value
  761. that `configure' has determined for that variable.  Variables that are
  762. substituted into output files in this way are called "output
  763. variables".  They are ordinary shell variables that are set in
  764. `configure'.  To make `configure' substitute a particular variable into
  765. the output files, the macro `AC_SUBST' must be called with that
  766. variable name as an argument.  Any occurrences of `@VARIABLE@' for
  767. other variables are left unchanged.  *Note Setting Output Variables::,
  768. for more information on creating output variables with `AC_SUBST'.
  769.  
  770.    A software package that uses a `configure' script should be
  771. distributed with a file `Makefile.in', but no `Makefile'; that way, the
  772. user has to properly configure the package for the local system before
  773. compiling it.
  774.  
  775.    *Note Makefile Conventions: (standards)Makefile Conventions, for
  776. more information on what to put in `Makefile's.
  777.  
  778. * Menu:
  779.  
  780. * Preset Output Variables::    Output variables that are always set.
  781. * Build Directories::       Supporting multiple concurrent compiles.
  782. * Automatic Remaking::        Makefile rules for configuring.
  783.  
  784. 
  785. File: autoconf.info,  Node: Preset Output Variables,  Next: Build Directories,  Up: Makefile Substitutions
  786.  
  787. Preset Output Variables
  788. -----------------------
  789.  
  790.    Some output variables are preset by the Autoconf macros.  Some of the
  791. Autoconf macros set additional output variables, which are mentioned in
  792. the descriptions for those macros.  *Note Output Variable Index::, for a
  793. complete list of output variables.  Here is what each of the preset ones
  794. contains.  *Note Variables for Installation Directories:
  795. (standards)Directory Variables, for more information about the
  796. variables with names that end in `dir'.
  797.  
  798.  - Variable: bindir
  799.      The directory for installing executables that users run.
  800.  
  801.  - Variable: configure_input
  802.      A comment saying that the file was generated automatically by
  803.      `configure' and giving the name of the input file.  `AC_OUTPUT'
  804.      adds a comment line containing this variable to the top of every
  805.      `Makefile' it creates.  For other files, you should reference this
  806.      variable in a comment at the top of each input file.  For example,
  807.      an input shell script should begin like this:
  808.  
  809.           #! /bin/sh
  810.           # @configure_input@
  811.  
  812.      The presence of that line also reminds people editing the file
  813.      that it needs to be processed by `configure' in order to be used.
  814.  
  815.  - Variable: datadir
  816.      The directory for installing read-only architecture-independent
  817.      data.
  818.  
  819.  - Variable: exec_prefix
  820.      The installation prefix for architecture-dependent files.
  821.  
  822.  - Variable: includedir
  823.      The directory for installing C header files.
  824.  
  825.  - Variable: infodir
  826.      The directory for installing documentation in Info format.
  827.  
  828.  - Variable: libdir
  829.      The directory for installing object code libraries.
  830.  
  831.  - Variable: libexecdir
  832.      The directory for installing executables that other programs run.
  833.  
  834.  - Variable: localstatedir
  835.      The directory for installing modifiable single-machine data.
  836.  
  837.  - Variable: mandir
  838.      The top-level directory for installing documentation in man format.
  839.  
  840.  - Variable: oldincludedir
  841.      The directory for installing C header files for non-gcc compilers.
  842.  
  843.  - Variable: prefix
  844.      The installation prefix for architecture-independent files.
  845.  
  846.  - Variable: sbindir
  847.      The directory for installing executables that system
  848.      administrators run.
  849.  
  850.  - Variable: sharedstatedir
  851.      The directory for installing modifiable architecture-independent
  852.      data.
  853.  
  854.  - Variable: srcdir
  855.      The directory that contains the source code for that `Makefile'.
  856.  
  857.  - Variable: sysconfdir
  858.      The directory for installing read-only single-machine data.
  859.  
  860.  - Variable: top_srcdir
  861.      The top-level source code directory for the package.  In the
  862.      top-level directory, this is the same as `srcdir'.
  863.  
  864.  - Variable: CFLAGS
  865.      Debugging and optimization options for the C compiler.  If it is
  866.      not set in the environment when `configure' runs, the default
  867.      value is set when you call `AC_PROG_CC' (or empty if you don't).
  868.      `configure' uses this variable when compiling programs to test for
  869.      C features.
  870.  
  871.  - Variable: CPPFLAGS
  872.      Header file search directory (`-IDIR') and any other miscellaneous
  873.      options for the C preprocessor and compiler.  If it is not set in
  874.      the environment when `configure' runs, the default value is empty.
  875.      `configure' uses this variable when compiling or preprocessing
  876.      programs to test for C features.
  877.  
  878.  - Variable: CXXFLAGS
  879.      Debugging and optimization options for the C++ compiler.  If it is
  880.      not set in the environment when `configure' runs, the default
  881.      value is set when you call `AC_PROG_CXX' (or empty if you don't).
  882.      `configure' uses this variable when compiling programs to test for
  883.      C++ features.
  884.  
  885.  - Variable: DEFS
  886.      `-D' options to pass to the C compiler.  If `AC_CONFIG_HEADER' is
  887.      called, `configure' replaces `@DEFS@' with `-DHAVE_CONFIG_H'
  888.      instead (*note Configuration Headers::.).  This variable is not
  889.      defined while `configure' is performing its tests, only when
  890.      creating the output files.  *Note Setting Output Variables::, for
  891.      how to check the results of previous tests.
  892.  
  893.  - Variable: LDFLAGS
  894.      Stripping (`-s') and any other miscellaneous options for the
  895.      linker.  If it is not set in the environment when `configure' runs,
  896.      the default value is empty.  `configure' uses this variable when
  897.      linking programs to test for C features.
  898.  
  899.  - Variable: LIBS
  900.      `-l' and `-L' options to pass to the linker.
  901.  
  902. 
  903. File: autoconf.info,  Node: Build Directories,  Next: Automatic Remaking,  Prev: Preset Output Variables,  Up: Makefile Substitutions
  904.  
  905. Build Directories
  906. -----------------
  907.  
  908.    You can support compiling a software package for several
  909. architectures simultaneously from the same copy of the source code.
  910. The object files for each architecture are kept in their own directory.
  911.  
  912.    To support doing this, `make' uses the `VPATH' variable to find the
  913. files that are in the source directory.  GNU `make' and most other
  914. recent `make' programs can do this.  Older `make' programs do not
  915. support `VPATH'; when using them, the source code must be in the same
  916. directory as the object files.
  917.  
  918.    To support `VPATH', each `Makefile.in' should contain two lines that
  919. look like:
  920.  
  921.      srcdir = @srcdir@
  922.      VPATH = @srcdir@
  923.  
  924.    Do not set `VPATH' to the value of another variable, for example
  925. `VPATH = $(srcdir)', because some versions of `make' do not do variable
  926. substitutions on the value of `VPATH'.
  927.  
  928.    `configure' substitutes in the correct value for `srcdir' when it
  929. produces `Makefile'.
  930.  
  931.    Do not use the `make' variable `$<', which expands to the pathname
  932. of the file in the source directory (found with `VPATH'), except in
  933. implicit rules.  (An implicit rule is one such as `.c.o', which tells
  934. how to create a `.o' file from a `.c' file.)  Some versions of `make'
  935. do not set `$<' in explicit rules; they expand it to an empty value.
  936.  
  937.    Instead, `Makefile' command lines should always refer to source
  938. files by prefixing them with `$(srcdir)/'.  For example:
  939.  
  940.      time.info: time.texinfo
  941.              $(MAKEINFO) $(srcdir)/time.texinfo
  942.  
  943. 
  944. File: autoconf.info,  Node: Automatic Remaking,  Prev: Build Directories,  Up: Makefile Substitutions
  945.  
  946. Automatic Remaking
  947. ------------------
  948.  
  949.    You can put rules like the following in the top-level `Makefile.in'
  950. for a package to automatically update the configuration information when
  951. you change the configuration files.  This example includes all of the
  952. optional files, such as `aclocal.m4' and those related to configuration
  953. header files.  Omit from the `Makefile.in' rules any of these files
  954. that your package does not use.
  955.  
  956.    The `${srcdir}/' prefix is included because of limitations in the
  957. `VPATH' mechanism.
  958.  
  959.    The `stamp-' files are necessary because the timestamps of
  960. `config.h.in' and `config.h' will not be changed if remaking them does
  961. not change their contents.  This feature avoids unnecessary
  962. recompilation.  You should include the file `stamp-h.in' your package's
  963. distribution, so `make' will consider `config.h.in' up to date.  On
  964. some old BSD systems, `touch' or any command that results in an empty
  965. file does not update the timestamps, so use a command like `echo' as a
  966. workaround.
  967.  
  968.      ${srcdir}/configure: configure.in aclocal.m4
  969.              cd ${srcdir} && autoconf
  970.      
  971.      # autoheader might not change config.h.in, so touch a stamp file.
  972.      ${srcdir}/config.h.in: stamp-h.in
  973.      ${srcdir}/stamp-h.in: configure.in aclocal.m4 acconfig.h \
  974.          config.h.top config.h.bot
  975.              cd ${srcdir} && autoheader
  976.              echo timestamp > ${srcdir}/stamp-h.in
  977.      
  978.      config.h: stamp-h
  979.      stamp-h: config.h.in config.status
  980.              ./config.status
  981.      
  982.      Makefile: Makefile.in config.status
  983.              ./config.status
  984.      
  985.      config.status: configure
  986.              ./config.status --recheck
  987.  
  988.    In addition, you should pass `echo timestamp > stamp-h' in the
  989. EXTRA-CMDS argument to `AC_OUTPUT', so `config.status' will ensure that
  990. `config.h' is considered up to date.  *Note Output::, for more
  991. information about `AC_OUTPUT'.
  992.  
  993.    *Note Invoking config.status::, for more examples of handling
  994. configuration-related dependencies.
  995.  
  996. 
  997. File: autoconf.info,  Node: Configuration Headers,  Next: Subdirectories,  Prev: Makefile Substitutions,  Up: Setup
  998.  
  999. Configuration Header Files
  1000. ==========================
  1001.  
  1002.    When a package tests more than a few C preprocessor symbols, the
  1003. command lines to pass `-D' options to the compiler can get quite long.
  1004. This causes two problems.  One is that the `make' output is hard to
  1005. visually scan for errors.  More seriously, the command lines can exceed
  1006. the length limits of some operating systems.  As an alternative to
  1007. passing `-D' options to the compiler, `configure' scripts can create a
  1008. C header file containing `#define' directives.  The `AC_CONFIG_HEADER'
  1009. macro selects this kind of output.  It should be called right after
  1010. `AC_INIT'.
  1011.  
  1012.    The package should `#include' the configuration header file before
  1013. any other header files, to prevent inconsistencies in declarations (for
  1014. example, if it redefines `const').  Use `#include <config.h>' instead
  1015. of `#include "config.h"', and pass the C compiler a `-I.' option (or
  1016. `-I..'; whichever directory contains `config.h').  That way, even if
  1017. the source directory is configured itself (perhaps to make a
  1018. distribution), other build directories can also be configured without
  1019. finding the `config.h' from the source directory.
  1020.  
  1021.  - Macro: AC_CONFIG_HEADER (HEADER-TO-CREATE ...)
  1022.      Make `AC_OUTPUT' create the file(s) in the whitespace-separated
  1023.      list HEADER-TO-CREATE containing C preprocessor `#define'
  1024.      statements, and replace `@DEFS@' in generated files with
  1025.      `-DHAVE_CONFIG_H' instead of the value of `DEFS'.  The usual name
  1026.      for HEADER-TO-CREATE is `config.h'.
  1027.  
  1028.      If HEADER-TO-CREATE already exists and its contents are identical
  1029.      to what `AC_OUTPUT' would put in it, it is left alone.  Doing this
  1030.      allows some changes in configuration without needlessly causing
  1031.      object files that depend on the header file to be recompiled.
  1032.  
  1033.      Usually the input file is named `HEADER-TO-CREATE.in'; however,
  1034.      you can override the input file name by appending it to
  1035.      HEADER-TO-CREATE, separated by a colon.  For example,
  1036.           AC_CONFIG_HEADER(defines.h:defines.hin)
  1037.  
  1038.      Doing this allows you to keep your filenames acceptable to MS-DOS.
  1039.  
  1040. * Menu:
  1041.  
  1042. * Header Templates::            Input for the configuration headers.
  1043. * Invoking autoheader::        How to create configuration templates.
  1044.  
  1045. 
  1046. File: autoconf.info,  Node: Header Templates,  Next: Invoking autoheader,  Up: Configuration Headers
  1047.  
  1048. Configuration Header Templates
  1049. ------------------------------
  1050.  
  1051.    Your distribution should contain a template file that looks as you
  1052. want the final header file to look, including comments, with default
  1053. values in the `#define' statements.  For example, suppose your
  1054. `configure.in' makes these calls:
  1055.  
  1056.      AC_CONFIG_HEADER(conf.h)
  1057.      AC_CHECK_HEADERS(unistd.h)
  1058.  
  1059. Then you could have code like the following in `conf.h.in'.  On systems
  1060. that have `unistd.h', `configure' will change the 0 to a 1.  On other
  1061. systems, it will leave the line unchanged.
  1062.  
  1063.      /* Define as 1 if you have unistd.h.  */
  1064.      #define HAVE_UNISTD_H 0
  1065.  
  1066.    Alternately, if your code tests for configuration options using
  1067. `#ifdef' instead of `#if', a default value can be to `#undef' the
  1068. variable instead of to define it to a value.  On systems that have
  1069. `unistd.h', `configure' will change the second line to read `#define
  1070. HAVE_UNISTD_H 1'.  On other systems, it will comment that line out (in
  1071. case the system predefines that symbol).
  1072.  
  1073.      /* Define if you have unistd.h.  */
  1074.      #undef HAVE_UNISTD_H
  1075.  
  1076. 
  1077. File: autoconf.info,  Node: Invoking autoheader,  Prev: Header Templates,  Up: Configuration Headers
  1078.  
  1079. Using `autoheader' to Create `config.h.in'
  1080. ------------------------------------------
  1081.  
  1082.    The `autoheader' program can create a template file of C `#define'
  1083. statements for `configure' to use.  If `configure.in' invokes
  1084. `AC_CONFIG_HEADER(FILE)', `autoheader' creates `FILE.in'; if multiple
  1085. file arguments are given, the first one is used.  Otherwise,
  1086. `autoheader' creates `config.h.in'.
  1087.  
  1088.    If you give `autoheader' an argument, it uses that file instead of
  1089. `configure.in' and writes the header file to the standard output
  1090. instead of to `config.h.in'.  If you give `autoheader' an argument of
  1091. `-', it reads the standard input instead of `configure.in' and writes
  1092. the header file to the standard output.
  1093.  
  1094.    `autoheader' scans `configure.in' and figures out which C
  1095. preprocessor symbols it might define.  It copies comments and `#define'
  1096. and `#undef' statements from a file called `acconfig.h', which comes
  1097. with and is installed with Autoconf.  It also uses a file called
  1098. `acconfig.h' in the current directory, if present.  If you `AC_DEFINE'
  1099. any additional symbols, you must create that file with entries for
  1100. them.  For symbols defined by `AC_CHECK_HEADERS', `AC_CHECK_FUNCS',
  1101. `AC_CHECK_SIZEOF', or `AC_CHECK_LIB', `autoheader' generates comments
  1102. and `#undef' statements itself rather than copying them from a file,
  1103. since the possible symbols are effectively limitless.
  1104.  
  1105.    The file that `autoheader' creates contains mainly `#define' and
  1106. `#undef' statements and their accompanying comments.  If `./acconfig.h'
  1107. contains the string `@TOP@', `autoheader' copies the lines before the
  1108. line containing `@TOP@' into the top of the file that it generates.
  1109. Similarly, if `./acconfig.h' contains the string `@BOTTOM@',
  1110. `autoheader' copies the lines after that line to the end of the file it
  1111. generates.  Either or both of those strings may be omitted.
  1112.  
  1113.    An alternate way to produce the same effect is to create the files
  1114. `FILE.top' (typically `config.h.top') and/or `FILE.bot' in the current
  1115. directory.  If they exist, `autoheader' copies them to the beginning
  1116. and end, respectively, of its output.  Their use is discouraged because
  1117. they have file names that contain two periods, and so can not be stored
  1118. on MS-DOS; also, they are two more files to clutter up the directory.
  1119. But if you use the `--localdir=DIR' option to use an `acconfig.h' in
  1120. another directory, they give you a way to put custom boilerplate in each
  1121. individual `config.h.in'.
  1122.  
  1123.    `autoheader' accepts the following options:
  1124.  
  1125. `--help'
  1126. `-h'
  1127.      Print a summary of the command line options and exit.
  1128.  
  1129. `--localdir=DIR'
  1130. `-l DIR'
  1131.      Look for the package files `aclocal.m4' and `acconfig.h' (but not
  1132.      `FILE.top' and `FILE.bot') in directory DIR instead of in the
  1133.      current directory.
  1134.  
  1135. `--macrodir=DIR'
  1136. `-m DIR'
  1137.      Look for the installed macro files and `acconfig.h' in directory
  1138.      DIR.  You can also set the `AC_MACRODIR' environment variable to a
  1139.      directory; this option overrides the environment variable.
  1140.  
  1141. `--version'
  1142.      Print the version number of Autoconf and exit.
  1143.  
  1144. 
  1145. File: autoconf.info,  Node: Subdirectories,  Next: Default Prefix,  Prev: Configuration Headers,  Up: Setup
  1146.  
  1147. Configuring Other Packages in Subdirectories
  1148. ============================================
  1149.  
  1150.    In most situations, calling `AC_OUTPUT' is sufficient to produce
  1151. `Makefile's in subdirectories.  However, `configure' scripts that
  1152. control more than one independent package can use `AC_CONFIG_SUBDIRS'
  1153. to run `configure' scripts for other packages in subdirectories.
  1154.  
  1155.  - Macro: AC_CONFIG_SUBDIRS (DIR ...)
  1156.      Make `AC_OUTPUT' run `configure' in each subdirectory DIR in the
  1157.      given whitespace-separated list.  If a given DIR is not found, no
  1158.      error is reported, so a `configure' script can configure whichever
  1159.      parts of a large source tree are present.  If a given DIR contains
  1160.      `configure.in' but no `configure', the Cygnus `configure' script
  1161.      found by `AC_CONFIG_AUXDIR' is used.  The subdirectory `configure'
  1162.      scripts are given the same command line options that were given to
  1163.      this `configure' script, with minor changes if needed (e.g., to
  1164.      adjust a relative path for the cache file or source directory).
  1165.      This macro also sets the output variable `subdirs' to the list of
  1166.      directories `DIR ...'.  `Makefile' rules can use this variable to
  1167.      determine which subdirectories to recurse into.
  1168.  
  1169. 
  1170. File: autoconf.info,  Node: Default Prefix,  Next: Versions,  Prev: Subdirectories,  Up: Setup
  1171.  
  1172. Default Prefix
  1173. ==============
  1174.  
  1175.    By default, `configure' sets the prefix for files it installs to
  1176. `/usr/local'.  The user of `configure' can select a different prefix
  1177. using the `--prefix' and `--exec-prefix' options.  There are two ways
  1178. to change the default: when creating `configure', and when running it.
  1179.  
  1180.    Some software packages might want to install in a directory besides
  1181. `/usr/local' by default.  To accomplish that, use the
  1182. `AC_PREFIX_DEFAULT' macro.
  1183.  
  1184.  - Macro: AC_PREFIX_DEFAULT (PREFIX)
  1185.      Set the default installation prefix to PREFIX instead of
  1186.      `/usr/local'.
  1187.  
  1188.    It may be convenient for users to have `configure' guess the
  1189. installation prefix from the location of a related program that they
  1190. have already installed.  If you wish to do that, you can call
  1191. `AC_PREFIX_PROGRAM'.
  1192.  
  1193.  - Macro: AC_PREFIX_PROGRAM (PROGRAM)
  1194.      If the user did not specify an installation prefix (using the
  1195.      `--prefix' option), guess a value for it by looking for PROGRAM in
  1196.      `PATH', the way the shell does.  If PROGRAM is found, set the
  1197.      prefix to the parent of the directory containing PROGRAM;
  1198.      otherwise leave the prefix specified in `Makefile.in' unchanged.
  1199.      For example, if PROGRAM is `gcc' and the `PATH' contains
  1200.      `/usr/local/gnu/bin/gcc', set the prefix to `/usr/local/gnu'.
  1201.  
  1202. 
  1203. File: autoconf.info,  Node: Versions,  Prev: Default Prefix,  Up: Setup
  1204.  
  1205. Version Numbers in `configure'
  1206. ==============================
  1207.  
  1208.    The following macros manage version numbers for `configure' scripts.
  1209. Using them is optional.
  1210.  
  1211.  - Macro: AC_PREREQ (VERSION)
  1212.      Ensure that a recent enough version of Autoconf is being used.  If
  1213.      the version of Autoconf being used to create `configure' is earlier
  1214.      than VERSION, print an error message on the standard error output
  1215.      and do not create `configure'.  For example:
  1216.  
  1217.           AC_PREREQ(1.8)
  1218.  
  1219.      This macro is useful if your `configure.in' relies on non-obvious
  1220.      behavior that changed between Autoconf releases.  If it merely
  1221.      needs recently added macros, then `AC_PREREQ' is less useful,
  1222.      because the `autoconf' program already tells the user which macros
  1223.      are not found.  The same thing happens if `configure.in' is
  1224.      processed by a version of Autoconf older than when `AC_PREREQ' was
  1225.      added.
  1226.  
  1227.  - Macro: AC_REVISION (REVISION-INFO)
  1228.      Copy revision stamp REVISION-INFO into the `configure' script,
  1229.      with any dollar signs or double-quotes removed.  This macro lets
  1230.      you put a revision stamp from `configure.in' into `configure'
  1231.      without RCS or CVS changing it when you check in `configure'.  That
  1232.      way, you can determine easily which revision of `configure.in' a
  1233.      particular `configure' corresponds to.
  1234.  
  1235.      It is a good idea to call this macro before `AC_INIT' so that the
  1236.      revision number is near the top of both `configure.in' and
  1237.      `configure'.  To support doing that, the `AC_REVISION' output
  1238.      begins with `#! /bin/sh', like the normal start of a `configure'
  1239.      script does.
  1240.  
  1241.      For example, this line in `configure.in':
  1242.  
  1243.           AC_REVISION($Revision: 1.30 $)dnl
  1244.  
  1245.      produces this in `configure':
  1246.  
  1247.           #! /bin/sh
  1248.           # From configure.in Revision: 1.30
  1249.  
  1250. 
  1251. File: autoconf.info,  Node: Existing Tests,  Next: Writing Tests,  Prev: Setup,  Up: Top
  1252.  
  1253. Existing Tests
  1254. **************
  1255.  
  1256.    These macros test for particular system features that packages might
  1257. need or want to use.  If you need to test for a kind of feature that
  1258. none of these macros check for, you can probably do it by calling
  1259. primitive test macros with appropriate arguments (*note Writing
  1260. Tests::.).
  1261.  
  1262.    These tests print messages telling the user which feature they're
  1263. checking for, and what they find.  They cache their results for future
  1264. `configure' runs (*note Caching Results::.).
  1265.  
  1266.    Some of these macros set output variables.  *Note Makefile
  1267. Substitutions::, for how to get their values.  The phrase "define NAME"
  1268. is used below as a shorthand to mean "define C preprocessor symbol NAME
  1269. to the value 1".  *Note Defining Symbols::, for how to get those symbol
  1270. definitions into your program.
  1271.  
  1272. * Menu:
  1273.  
  1274. * Alternative Programs::    Selecting between alternative programs.
  1275. * Libraries::                   Library archives that might be missing.
  1276. * Library Functions::        C library functions that might be missing.
  1277. * Header Files::        Header files that might be missing.
  1278. * Structures::            Structures or members that might be missing.
  1279. * Typedefs::            `typedef's that might be missing.
  1280. * Compiler Characteristics::    C compiler or machine architecture features.
  1281. * System Services::        Operating system services.
  1282. * UNIX Variants::        Special kludges for specific UNIX variants.
  1283.  
  1284. 
  1285. File: autoconf.info,  Node: Alternative Programs,  Next: Libraries,  Up: Existing Tests
  1286.  
  1287. Alternative Programs
  1288. ====================
  1289.  
  1290.    These macros check for the presence or behavior of particular
  1291. programs.  They are used to choose between several alternative programs
  1292. and to decide what to do once one has been chosen.  If there is no
  1293. macro specifically defined to check for a program you need, and you
  1294. don't need to check for any special properties of it, then you can use
  1295. one of the general program check macros.
  1296.  
  1297. * Menu:
  1298.  
  1299. * Particular Programs::         Special handling to find certain programs.
  1300. * Generic Programs::            How to find other programs.
  1301.  
  1302. 
  1303. File: autoconf.info,  Node: Particular Programs,  Next: Generic Programs,  Up: Alternative Programs
  1304.  
  1305. Particular Program Checks
  1306. -------------------------
  1307.  
  1308.    These macros check for particular programs--whether they exist, and
  1309. in some cases whether they support certain features.
  1310.  
  1311.  - Macro: AC_DECL_YYTEXT
  1312.      Define `YYTEXT_POINTER' if `yytext' is a `char *' instead of a
  1313.      `char []'.  Also set output variable `LEX_OUTPUT_ROOT' to the base
  1314.      of the file name that the lexer generates; usually `lex.yy', but
  1315.      sometimes something else.  These results vary according to whether
  1316.      `lex' or `flex' is being used.
  1317.  
  1318.  - Macro: AC_PROG_AWK
  1319.      Check for `mawk', `gawk', `nawk', and `awk', in that order, and
  1320.      set output variable `AWK' to the first one that it finds.  It
  1321.      tries `mawk' first because that is reported to be the fastest
  1322.      implementation.
  1323.  
  1324.  - Macro: AC_PROG_CC
  1325.      Determine a C compiler to use.  If `CC' is not already set in the
  1326.      environment, check for `gcc', and use `cc' if it's not found.  Set
  1327.      output variable `CC' to the name of the compiler found.
  1328.  
  1329.      If using the GNU C compiler, set shell variable `GCC' to `yes',
  1330.      empty otherwise.  If output variable `CFLAGS' was not already set,
  1331.      set it to `-g -O' for the GNU C compiler (`-O' on systems where
  1332.      GCC does not accept `-g'), or `-g' for other compilers.
  1333.  
  1334.  - Macro: AC_PROG_CC_C_O
  1335.      If the C compiler does not accept the `-c' and `-o' options
  1336.      simultaneously, define `NO_MINUS_C_MINUS_O'.
  1337.  
  1338.  - Macro: AC_PROG_CPP
  1339.      Set output variable `CPP' to a command that runs the C
  1340.      preprocessor.  If `$CC -E' doesn't work, it uses `/lib/cpp'.  It
  1341.      is only portable to run `CPP' on files with a `.c' extension.
  1342.  
  1343.      If the current language is C (*note Language Choice::.), many of
  1344.      the specific test macros use the value of `CPP' indirectly by
  1345.      calling `AC_TRY_CPP', `AC_CHECK_HEADER', `AC_EGREP_HEADER', or
  1346.      `AC_EGREP_CPP'.
  1347.  
  1348.  - Macro: AC_PROG_CXX
  1349.      Determine a C++ compiler to use.  Check if the environment variable
  1350.      `CXX' or `CCC' (in that order) is set; if so, set output variable
  1351.      `CXX' to its value.  Otherwise search for a C++ compiler under
  1352.      likely names (`c++', `g++', `gcc', `CC', and `cxx').  If none of
  1353.      those checks succeed, as a last resort set `CXX' to `gcc'.
  1354.  
  1355.      If using the GNU C++ compiler, set shell variable `GXX' to `yes',
  1356.      empty otherwise.  If output variable `CXXFLAGS' was not already
  1357.      set, set it to `-g -O' for the GNU C++ compiler (`-O' on systems
  1358.      where G++ does not accept `-g'), or `-g' for other compilers.
  1359.  
  1360.  - Macro: AC_PROG_CXXCPP
  1361.      Set output variable `CXXCPP' to a command that runs the C++
  1362.      preprocessor.  If `$CXX -E' doesn't work, it uses `/lib/cpp'.  It
  1363.      is only portable to run `CXXCPP' on files with a `.c', `.C', or
  1364.      `.cc' extension.
  1365.  
  1366.      If the current language is C++ (*note Language Choice::.), many of
  1367.      the specific test macros use the value of `CXXCPP' indirectly by
  1368.      calling `AC_TRY_CPP', `AC_CHECK_HEADER', `AC_EGREP_HEADER', or
  1369.      `AC_EGREP_CPP'.
  1370.  
  1371.  - Macro: AC_PROG_GCC_TRADITIONAL
  1372.      Add `-traditional' to output variable `CC' if using the GNU C
  1373.      compiler and `ioctl' does not work properly without
  1374.      `-traditional'.  That usually happens when the fixed header files
  1375.      have not been installed on an old system.  Since recent versions
  1376.      of the GNU C compiler fix the header files automatically when
  1377.      installed, this is becoming a less prevalent problem.
  1378.  
  1379.  - Macro: AC_PROG_INSTALL
  1380.      Set output variable `INSTALL' to the path of a BSD compatible
  1381.      `install' program, if one is found in the current `PATH'.
  1382.      Otherwise, set `INSTALL' to `DIR/install-sh -c', checking the
  1383.      directories specified to `AC_CONFIG_AUX_DIR' (or its default
  1384.      directories) to determine DIR (*note Output::.).  Also set the
  1385.      variable `INSTALL_PROGRAM' to `${INSTALL}' and `INSTALL_DATA' to
  1386.      `${INSTALL} -m 644'.
  1387.  
  1388.      This macro screens out various instances of `install' known to not
  1389.      work.  It prefers to find a C program rather than a shell script,
  1390.      for speed.  Instead of `install-sh', it can also use `install.sh',
  1391.      but that name is obsolete because some `make' programs have a rule
  1392.      that creates `install' from it if there is no `Makefile'.
  1393.  
  1394.      A copy of `install-sh' which you may use comes with Autoconf.  If
  1395.      you use `AC_PROG_INSTALL', you must include either `install-sh' or
  1396.      `install.sh' in your distribution, or `configure' will produce an
  1397.      error message saying it can't find them--even if the system you're
  1398.      on has a good `install' program.  This check is a safety measure
  1399.      to prevent you from accidentally leaving that file out, which
  1400.      would prevent your package from installing on systems that don't
  1401.      have a BSD-compatible `install' program.
  1402.  
  1403.      If you need to use your own installation program because it has
  1404.      features not found in standard `install' programs, there is no
  1405.      reason to use `AC_PROG_INSTALL'; just put the pathname of your
  1406.      program into your `Makefile.in' files.
  1407.  
  1408.  - Macro: AC_PROG_LEX
  1409.      If `flex' is found, set output variable `LEX' to `flex' and
  1410.      `LEXLIB' to `-lfl', if that library is in a standard place.
  1411.      Otherwise set `LEX' to `lex' and `LEXLIB' to `-ll'.
  1412.  
  1413.  - Macro: AC_PROG_LN_S
  1414.      If `ln -s' works on the current filesystem (the operating system
  1415.      and filesystem support symbolic links), set output variable `LN_S'
  1416.      to `ln -s', otherwise set it to `ln'.
  1417.  
  1418.  - Macro: AC_PROG_RANLIB
  1419.      Set output variable `RANLIB' to `ranlib' if `ranlib' is found,
  1420.      otherwise to `:' (do nothing).
  1421.  
  1422.  - Macro: AC_PROG_YACC
  1423.      If `bison' is found, set output variable `YACC' to `bison -y'.
  1424.      Otherwise, if `byacc' is found, set `YACC' to `byacc'.  Otherwise
  1425.      set `YACC' to `yacc'.
  1426.  
  1427. 
  1428. File: autoconf.info,  Node: Generic Programs,  Prev: Particular Programs,  Up: Alternative Programs
  1429.  
  1430. Generic Program Checks
  1431. ----------------------
  1432.  
  1433.    These macros are used to find programs not covered by the particular
  1434. test macros.  If you need to check the behavior of a program as well as
  1435. find out whether it is present, you have to write your own test for it
  1436. (*note Writing Tests::.).  By default, these macros use the environment
  1437. variable `PATH'.  If you need to check for a program that might not be
  1438. in the user's `PATH', you can pass a modified path to use instead, like
  1439. this:
  1440.  
  1441.      AC_PATH_PROG(INETD, inetd, /usr/libexec/inetd,
  1442.        $PATH:/usr/libexec:/usr/sbin:/usr/etc:etc)
  1443.  
  1444.  - Macro: AC_CHECK_PROG (VARIABLE, PROG-TO-CHECK-FOR, VALUE-IF-FOUND [,
  1445.           VALUE-IF-NOT-FOUND [, PATH, [ REJECT ]]])
  1446.      Check whether program PROG-TO-CHECK-FOR exists in `PATH'.  If it
  1447.      is found, set VARIABLE to VALUE-IF-FOUND, otherwise to
  1448.      VALUE-IF-NOT-FOUND, if given.  Always pass over REJECT (an
  1449.      absolute file name) even if it is the first found in the search
  1450.      path; in that case, set VARIABLE using the absolute file name of
  1451.      the PROG-TO-CHECK-FOR found that is not REJECT.  If VARIABLE was
  1452.      already set, do nothing.  Calls `AC_SUBST' for VARIABLE.
  1453.  
  1454.  - Macro: AC_CHECK_PROGS (VARIABLE, PROGS-TO-CHECK-FOR [,
  1455.           VALUE-IF-NOT-FOUND [, PATH]])
  1456.      Check for each program in the whitespace-separated list
  1457.      PROGS-TO-CHECK-FOR exists in `PATH'.  If it is found, set VARIABLE
  1458.      to the name of that program.  Otherwise, continue checking the
  1459.      next program in the list.  If none of the programs in the list are
  1460.      found, set VARIABLE to VALUE-IF-NOT-FOUND; if VALUE-IF-NOT-FOUND
  1461.      is not specified, the value of VARIABLE is not changed.  Calls
  1462.      `AC_SUBST' for VARIABLE.
  1463.  
  1464.  - Macro: AC_CHECK_TOOL (VARIABLE, PROG-TO-CHECK-FOR [,
  1465.           VALUE-IF-NOT-FOUND [, PATH]])
  1466.      Like `AC_CHECK_PROG', but first looks for PROG-TO-CHECK-FOR with a
  1467.      prefix of the host type as determined by `AC_CANONICAL_HOST',
  1468.      followed by a dash (*note Canonicalizing::.).  For example, if the
  1469.      user runs `configure --host=i386-gnu', then this call:
  1470.           AC_CHECK_TOOL(RANLIB, ranlib, :)
  1471.  
  1472.      sets `RANLIB' to `i386-gnu-ranlib' if that program exists in
  1473.      `PATH', or to `ranlib' if that program exists in `PATH', or to `:'
  1474.      if neither program exists.
  1475.  
  1476.  - Macro: AC_PATH_PROG (VARIABLE, PROG-TO-CHECK-FOR [,
  1477.           VALUE-IF-NOT-FOUND [, PATH]])
  1478.      Like `AC_CHECK_PROG', but set VARIABLE to the entire path of
  1479.      PROG-TO-CHECK-FOR if found.
  1480.  
  1481.  - Macro: AC_PATH_PROGS (VARIABLE, PROGS-TO-CHECK-FOR [,
  1482.           VALUE-IF-NOT-FOUND [, PATH]])
  1483.      Like `AC_CHECK_PROGS', but if any of PROGS-TO-CHECK-FOR are found,
  1484.      set VARIABLE to the entire path of the program found.
  1485.  
  1486. 
  1487. File: autoconf.info,  Node: Libraries,  Next: Library Functions,  Prev: Alternative Programs,  Up: Existing Tests
  1488.  
  1489. Library Files
  1490. =============
  1491.  
  1492.    The following macros check for the presence of certain C library
  1493. archive files.
  1494.  
  1495.  - Macro: AC_CHECK_LIB (LIBRARY, FUNCTION [, ACTION-IF-FOUND [,
  1496.           ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]])
  1497.      Try to ensure that C function FUNCTION is available by checking
  1498.      whether a test C program can be linked with the library LIBRARY to
  1499.      get the function.  LIBRARY is the base name of the library; e.g.,
  1500.      to check for `-lmp', use `mp' as the LIBRARY argument.
  1501.  
  1502.      ACTION-IF-FOUND is a list of shell commands to run if the link
  1503.      with the library succeeds; ACTION-IF-NOT-FOUND is a list of shell
  1504.      commands to run if the link fails.  If ACTION-IF-FOUND and
  1505.      ACTION-IF-NOT-FOUND are not specified, the default action is to
  1506.      add `-lLIBRARY' to `LIBS' and define `HAVE_LIBLIBRARY' (in all
  1507.      capitals).
  1508.  
  1509.      If linking with LIBRARY results in unresolved symbols, which would
  1510.      be resolved by linking with additional libraries, give those
  1511.      libraries as the OTHER-LIBRARIES argument, separated by spaces:
  1512.      `-lXt -lX11'.  Otherwise this macro will fail to detect that
  1513.      LIBRARY is present, because linking the test program will always
  1514.      fail with unresolved symbols.
  1515.  
  1516.  - Macro: AC_HAVE_LIBRARY (LIBRARY, [, ACTION-IF-FOUND [,
  1517.           ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]])
  1518.      This macro is equivalent to calling `AC_CHECK_LIB' with a FUNCTION
  1519.      argument of `main'.  In addition, LIBRARY can be written as any of
  1520.      `foo', `-lfoo', or `libfoo.a'.  In all of those cases, the
  1521.      compiler is passed `-lfoo'.  However, LIBRARY can not be a shell
  1522.      variable; it must be a literal name.  This macro is considered
  1523.      obsolete.
  1524.  
  1525. 
  1526. File: autoconf.info,  Node: Library Functions,  Next: Header Files,  Prev: Libraries,  Up: Existing Tests
  1527.  
  1528. Library Functions
  1529. =================
  1530.  
  1531.    The following macros check for particular C library functions.  If
  1532. there is no macro specifically defined to check for a function you need,
  1533. and you don't need to check for any special properties of it, then you
  1534. can use one of the general function check macros.
  1535.  
  1536. * Menu:
  1537.  
  1538. * Particular Functions::        Special handling to find certain functions.
  1539. * Generic Functions::           How to find other functions.
  1540.  
  1541. 
  1542. File: autoconf.info,  Node: Particular Functions,  Next: Generic Functions,  Up: Library Functions
  1543.  
  1544. Particular Function Checks
  1545. --------------------------
  1546.  
  1547.    These macros check for particular C functions--whether they exist,
  1548. and in some cases how they respond when given certain arguments.
  1549.  
  1550.  - Macro: AC_FUNC_ALLOCA
  1551.      Check how to get `alloca'.  Tries to get a builtin version by
  1552.      checking for `alloca.h' or the predefined C preprocessor macros
  1553.      `__GNUC__' and `_AIX'.  If this macro finds `alloca.h', it defines
  1554.      `HAVE_ALLOCA_H'.
  1555.  
  1556.      If those attempts fail, it looks for the function in the standard C
  1557.      library.  If any of those methods succeed, it defines
  1558.      `HAVE_ALLOCA'.  Otherwise, it sets the output variable `ALLOCA' to
  1559.      `alloca.o' and defines `C_ALLOCA' (so programs can periodically
  1560.      call `alloca(0)' to garbage collect).  This variable is separate
  1561.      from `LIBOBJS' so multiple programs can share the value of
  1562.      `ALLOCA' without needing to create an actual library, in case only
  1563.      some of them use the code in `LIBOBJS'.
  1564.  
  1565.      This macro does not try to get `alloca' from the System V R3
  1566.      `libPW' or the System V R4 `libucb' because those libraries
  1567.      contain some incompatible functions that cause trouble.  Some
  1568.      versions do not even contain `alloca' or contain a buggy version.
  1569.      If you still want to use their `alloca', use `ar' to extract
  1570.      `alloca.o' from them instead of compiling `alloca.c'.
  1571.  
  1572.      Source files that use `alloca' should start with a piece of code
  1573.      like the following, to declare it properly.  In some versions of
  1574.      AIX, the declaration of `alloca' must precede everything else
  1575.      except for comments and preprocessor directives.  The `#pragma'
  1576.      directive is indented so that pre-ANSI C compilers will ignore it,
  1577.      rather than choke on it.
  1578.  
  1579.           /* AIX requires this to be the first thing in the file.  */
  1580.           #ifdef __GNUC__
  1581.           # define alloca __builtin_alloca
  1582.           #else
  1583.           # if HAVE_ALLOCA_H
  1584.           #  include <alloca.h>
  1585.           # else
  1586.           #  ifdef _AIX
  1587.            #pragma alloca
  1588.           #  else
  1589.           #   ifndef alloca /* predefined by HP cc +Olibcalls */
  1590.           char *alloca ();
  1591.           #   endif
  1592.           #  endif
  1593.           # endif
  1594.           #endif
  1595.  
  1596.  - Macro: AC_FUNC_CLOSEDIR_VOID
  1597.      If the `closedir' function does not return a meaningful value,
  1598.      define `CLOSEDIR_VOID'.  Otherwise, callers ought to check its
  1599.      return value for an error indicator.
  1600.  
  1601.  - Macro: AC_FUNC_GETLOADAVG
  1602.      Check how to get the system load averages.  If the system has the
  1603.      `getloadavg' function, this macro defines `HAVE_GETLOADAVG', and
  1604.      adds to `LIBS' any libraries needed to get that function.
  1605.  
  1606.      Otherwise, it adds `getloadavg.o' to the output variable
  1607.      `LIBOBJS', and possibly defines several other C preprocessor
  1608.      macros and output variables:
  1609.  
  1610.        1. It defines `SVR4', `DGUX', `UMAX', or `UMAX4_3' if on those
  1611.           systems.
  1612.  
  1613.        2. If it finds `nlist.h', it defines `NLIST_STRUCT'.
  1614.  
  1615.        3. If `struct nlist' has an `n_un' member, it defines
  1616.           `NLIST_NAME_UNION'.
  1617.  
  1618.        4. If compiling `getloadavg.c' defines `LDAV_PRIVILEGED',
  1619.           programs need to be installed specially on this system for
  1620.           `getloadavg' to work, and this macro defines
  1621.           `GETLOADAVG_PRIVILEGED'.
  1622.  
  1623.        5. This macro sets the output variable `NEED_SETGID'.  The value
  1624.           is `true' if special installation is required, `false' if not.
  1625.           If `NEED_SETGID' is `true', this macro sets `KMEM_GROUP' to
  1626.           the name of the group that should own the installed program.
  1627.  
  1628.  - Macro: AC_FUNC_GETMNTENT
  1629.      Check for `getmntent' in the `sun', `seq', and `gen' libraries,
  1630.      for Irix 4, PTX, and Unixware, respectively.  Then, if `getmntent'
  1631.      is available, define `HAVE_GETMNTENT'.
  1632.  
  1633.  - Macro: AC_FUNC_GETPGRP
  1634.      If `getpgrp' takes no argument (the POSIX.1 version), define
  1635.      `GETPGRP_VOID'.  Otherwise, it is the BSD version, which takes a
  1636.      process ID as an argument.  This macro does not check whether
  1637.      `getpgrp' exists at all; if you need to work in that situation,
  1638.      first call `AC_CHECK_FUNC' for `getpgrp'.
  1639.  
  1640.  - Macro: AC_FUNC_MEMCMP
  1641.      If the `memcmp' function is not available, or does not work on
  1642.      8-bit data (like the one on SunOS 4.1.3), add `memcmp.o' to output
  1643.      variable `LIBOBJS'.
  1644.  
  1645.  - Macro: AC_FUNC_MMAP
  1646.      If the `mmap' function exists and works correctly on memory mapped
  1647.      files, define `HAVE_MMAP'.
  1648.  
  1649.  - Macro: AC_FUNC_SETVBUF_REVERSED
  1650.      If `setvbuf' takes the buffering type as its second argument and
  1651.      the buffer pointer as the third, instead of the other way around,
  1652.      define `SETVBUF_REVERSED'.  This is the case on System V before
  1653.      release 3.
  1654.  
  1655.  - Macro: AC_FUNC_STRCOLL
  1656.      If the `strcoll' function exists and works correctly, define
  1657.      `HAVE_STRCOLL'.  This does a bit more than
  1658.      `AC_CHECK_FUNCS(strcoll)', because some systems have incorrect
  1659.      definitions of `strcoll', which should not be used.
  1660.  
  1661.  - Macro: AC_FUNC_STRFTIME
  1662.      Check for `strftime' in the `intl' library, for SCO UNIX.  Then,
  1663.      if `strftime' is available, define `HAVE_STRFTIME'.
  1664.  
  1665.  - Macro: AC_FUNC_UTIME_NULL
  1666.      If `utime(FILE, NULL)' sets FILE's timestamp to the present,
  1667.      define `HAVE_UTIME_NULL'.
  1668.  
  1669.  - Macro: AC_FUNC_VFORK
  1670.      If `vfork.h' is found, define `HAVE_VFORK_H'.  If a working
  1671.      `vfork' is not found, define `vfork' to be `fork'.  This macro
  1672.      checks for several known errors in implementations of `vfork' and
  1673.      considers the system to not have a working `vfork' if it detects
  1674.      any of them.  It is not considered to be an implementation error
  1675.      if a child's invocation of `signal' modifies the parent's signal
  1676.      handler, since child processes rarely change their signal handlers.
  1677.  
  1678.  - Macro: AC_FUNC_VPRINTF
  1679.      If `vprintf' is found, define `HAVE_VPRINTF'.  Otherwise, if
  1680.      `_doprnt' is found, define `HAVE_DOPRNT'.  (If `vprintf' is
  1681.      available, you may assume that `vfprintf' and `vsprintf' are also
  1682.      available.)
  1683.  
  1684.  - Macro: AC_FUNC_WAIT3
  1685.      If `wait3' is found and fills in the contents of its third argument
  1686.      (a `struct rusage *'), which HP-UX does not do, define
  1687.      `HAVE_WAIT3'.
  1688.  
  1689. 
  1690. File: autoconf.info,  Node: Generic Functions,  Prev: Particular Functions,  Up: Library Functions
  1691.  
  1692. Generic Function Checks
  1693. -----------------------
  1694.  
  1695.    These macros are used to find functions not covered by the particular
  1696. test macros.  If the functions might be in libraries other than the
  1697. default C library, first call `AC_CHECK_LIB' for those libraries.  If
  1698. you need to check the behavior of a function as well as find out
  1699. whether it is present, you have to write your own test for it (*note
  1700. Writing Tests::.).
  1701.  
  1702.  - Macro: AC_CHECK_FUNC (FUNCTION, [ACTION-IF-FOUND [,
  1703.           ACTION-IF-NOT-FOUND]])
  1704.      If C function FUNCTION is available, run shell commands
  1705.      ACTION-IF-FOUND, otherwise ACTION-IF-NOT-FOUND.  If you just want
  1706.      to define a symbol if the function is available, consider using
  1707.      `AC_CHECK_FUNCS' instead.  This macro checks for functions with C
  1708.      linkage even when `AC_LANG_CPLUSPLUS' has been called, since C++ is
  1709.      more standardized than C is.  (*note Language Choice::., for more
  1710.      information about selecting the language for checks.)
  1711.  
  1712.  - Macro: AC_CHECK_FUNCS (FUNCTION... [, ACTION-IF-FOUND [,
  1713.           ACTION-IF-NOT-FOUND]])
  1714.      For each given FUNCTION in the whitespace-separated argument list
  1715.      that is available, define `HAVE_FUNCTION' (in all capitals).  If
  1716.      ACTION-IF-FOUND is given, it is additional shell code to execute
  1717.      when one of the functions is found.  You can give it a value of
  1718.      `break' to break out of the loop on the first match.  If
  1719.      ACTION-IF-NOT-FOUND is given, it is executed when one of the
  1720.      functions is not found.
  1721.  
  1722.  - Macro: AC_REPLACE_FUNCS (FUNCTION-NAME...)
  1723.      For each given FUNCTION-NAME in the whitespace-separated argument
  1724.      list that is not in the C library, add `FUNCTION-NAME.o' to the
  1725.      value of the output variable `LIBOBJS'.
  1726.  
  1727. 
  1728. File: autoconf.info,  Node: Header Files,  Next: Structures,  Prev: Library Functions,  Up: Existing Tests
  1729.  
  1730. Header Files
  1731. ============
  1732.  
  1733.    The following macros check for the presence of certain C header
  1734. files.  If there is no macro specifically defined to check for a header
  1735. file you need, and you don't need to check for any special properties of
  1736. it, then you can use one of the general header file check macros.
  1737.  
  1738. * Menu:
  1739.  
  1740. * Particular Headers::          Special handling to find certain headers.
  1741. * Generic Headers::             How to find other headers.
  1742.  
  1743. 
  1744. File: autoconf.info,  Node: Particular Headers,  Next: Generic Headers,  Up: Header Files
  1745.  
  1746. Particular Header Checks
  1747. ------------------------
  1748.  
  1749.    These macros check for particular system header files--whether they
  1750. exist, and in some cases whether they declare certain symbols.
  1751.  
  1752.  - Macro: AC_DECL_SYS_SIGLIST
  1753.      Define `SYS_SIGLIST_DECLARED' if the variable `sys_siglist' is
  1754.      declared in a system header file, either `signal.h' or `unistd.h'.
  1755.  
  1756.  - Macro: AC_DIR_HEADER
  1757.      Like calling `AC_HEADER_DIRENT' and `AC_FUNC_CLOSEDIR_VOID', but
  1758.      defines a different set of C preprocessor macros to indicate which
  1759.      header file is found.  This macro and the names it defines are
  1760.      considered obsolete.  The names it defines are:
  1761.  
  1762.     `dirent.h'
  1763.           `DIRENT'
  1764.  
  1765.     `sys/ndir.h'
  1766.           `SYSNDIR'
  1767.  
  1768.     `sys/dir.h'
  1769.           `SYSDIR'
  1770.  
  1771.     `ndir.h'
  1772.           `NDIR'
  1773.  
  1774.      In addition, if the `closedir' function does not return a
  1775.      meaningful value, define `VOID_CLOSEDIR'.
  1776.  
  1777.  - Macro: AC_HEADER_DIRENT
  1778.      Check for the following header files, and for the first one that is
  1779.      found and defines `DIR', define the listed C preprocessor macro:
  1780.  
  1781.     `dirent.h'
  1782.           `HAVE_DIRENT_H'
  1783.  
  1784.     `sys/ndir.h'
  1785.           `HAVE_SYS_NDIR_H'
  1786.  
  1787.     `sys/dir.h'
  1788.           `HAVE_SYS_DIR_H'
  1789.  
  1790.     `ndir.h'
  1791.           `HAVE_NDIR_H'
  1792.  
  1793.      The directory library declarations in the source code should look
  1794.      something like the following:
  1795.  
  1796.           #if HAVE_DIRENT_H
  1797.           # include <dirent.h>
  1798.           # define NAMLEN(dirent) strlen((dirent)->d_name)
  1799.           #else
  1800.           # define dirent direct
  1801.           # define NAMLEN(dirent) (dirent)->d_namlen
  1802.           # if HAVE_SYS_NDIR_H
  1803.           #  include <sys/ndir.h>
  1804.           # endif
  1805.           # if HAVE_SYS_DIR_H
  1806.           #  include <sys/dir.h>
  1807.           # endif
  1808.           # if HAVE_NDIR_H
  1809.           #  include <ndir.h>
  1810.           # endif
  1811.           #endif
  1812.  
  1813.      Using the above declarations, the program would declare variables
  1814.      to be type `struct dirent', not `struct direct', and would access
  1815.      the length of a directory entry name by passing a pointer to a
  1816.      `struct dirent' to the `NAMLEN' macro.
  1817.  
  1818.      This macro also checks for the SCO Xenix `dir' and `x' libraries.
  1819.  
  1820.  - Macro: AC_HEADER_MAJOR
  1821.      If `sys/types.h' does not define `major', `minor', and `makedev',
  1822.      but `sys/mkdev.h' does, define `MAJOR_IN_MKDEV'; otherwise, if
  1823.      `sys/sysmacros.h' does, define `MAJOR_IN_SYSMACROS'.
  1824.  
  1825.  - Macro: AC_HEADER_STDC
  1826.      Define `STDC_HEADERS' if the system has ANSI C header files.
  1827.      Specifically, this macro checks for `stdlib.h', `stdarg.h',
  1828.      `string.h', and `float.h'; if the system has those, it probably
  1829.      has the rest of the ANSI C header files.  This macro also checks
  1830.      whether `string.h' declares `memchr' (and thus presumably the
  1831.      other `mem' functions), whether `stdlib.h' declare `free' (and
  1832.      thus presumably `malloc' and other related functions), and whether
  1833.      the `ctype.h' macros work on characters with the high bit set, as
  1834.      ANSI C requires.
  1835.  
  1836.      Use `STDC_HEADERS' instead of `__STDC__' to determine whether the
  1837.      system has ANSI-compliant header files (and probably C library
  1838.      functions) because many systems that have GCC do not have ANSI C
  1839.      header files.
  1840.  
  1841.      On systems without ANSI C headers, there is so much variation that
  1842.      it is probably easier to declare the functions you use than to
  1843.      figure out exactly what the system header files declare.  Some
  1844.      systems contain a mix of functions ANSI and BSD; some are mostly
  1845.      ANSI but lack `memmove'; some define the BSD functions as macros in
  1846.      `string.h' or `strings.h'; some have only the BSD functions but
  1847.      `string.h'; some declare the memory functions in `memory.h', some
  1848.      in `string.h'; etc.  It is probably sufficient to check for one
  1849.      string function and one memory function; if the library has the
  1850.      ANSI versions of those then it probably has most of the others.
  1851.      If you put the following in `configure.in':
  1852.  
  1853.           AC_HEADER_STDC
  1854.           AC_CHECK_FUNCS(strchr memcpy)
  1855.  
  1856.      then, in your code, you can put declarations like this:
  1857.  
  1858.           #if STDC_HEADERS
  1859.           # include <string.h>
  1860.           #else
  1861.           # ifndef HAVE_STRCHR
  1862.           #  define strchr index
  1863.           #  define strrchr rindex
  1864.           # endif
  1865.           char *strchr (), *strrchr ();
  1866.           # ifndef HAVE_MEMCPY
  1867.           #  define memcpy(d, s, n) bcopy ((s), (d), (n))
  1868.           #  define memmove(d, s, n) bcopy ((s), (d), (n))
  1869.           # endif
  1870.           #endif
  1871.  
  1872.      If you use a function like `memchr', `memset', `strtok', or
  1873.      `strspn', which have no BSD equivalent, then macros won't suffice;
  1874.      you must provide an implementation of each function.  An easy way
  1875.      to incorporate your implementations only when needed (since the
  1876.      ones in system C libraries may be hand optimized) is to, taking
  1877.      `memchr' for example, put it in `memchr.c' and use
  1878.      `AC_REPLACE_FUNCS(memchr)'.
  1879.  
  1880.  - Macro: AC_HEADER_SYS_WAIT
  1881.      If `sys/wait.h' exists and is compatible with POSIX.1, define
  1882.      `HAVE_SYS_WAIT_H'.  Incompatibility can occur if `sys/wait.h' does
  1883.      not exist, or if it uses the old BSD `union wait' instead of `int'
  1884.      to store a status value.  If `sys/wait.h' is not POSIX.1
  1885.      compatible, then instead of including it, define the POSIX.1
  1886.      macros with their usual interpretations.  Here is an example:
  1887.  
  1888.           #include <sys/types.h>
  1889.           #if HAVE_SYS_WAIT_H
  1890.           # include <sys/wait.h>
  1891.           #endif
  1892.           #ifndef WEXITSTATUS
  1893.           # define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
  1894.           #endif
  1895.           #ifndef WIFEXITED
  1896.           # define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
  1897.           #endif
  1898.  
  1899.  - Macro: AC_MEMORY_H
  1900.      Define `NEED_MEMORY_H' if `memcpy', `memcmp', etc. are not
  1901.      declared in `string.h' and `memory.h' exists.  This macro is
  1902.      obsolete; instead, use `AC_CHECK_HEADERS(memory.h)'.  See the
  1903.      example for `AC_HEADER_STDC'.
  1904.  
  1905.  - Macro: AC_UNISTD_H
  1906.      Define `HAVE_UNISTD_H' if the system has `unistd.h'.  This macro
  1907.      is obsolete; instead, use `AC_CHECK_HEADERS(unistd.h)'.
  1908.  
  1909.      The way to check if the system supports POSIX.1 is:
  1910.  
  1911.           #if HAVE_UNISTD_H
  1912.           # include <sys/types.h>
  1913.           # include <unistd.h>
  1914.           #endif
  1915.           
  1916.           #ifdef _POSIX_VERSION
  1917.           /* Code for POSIX.1 systems.  */
  1918.           #endif
  1919.  
  1920.      `_POSIX_VERSION' is defined when `unistd.h' is included on POSIX.1
  1921.      systems.  If there is no `unistd.h', it is definitely not a
  1922.      POSIX.1 system.  However, some non-POSIX.1 systems do have
  1923.      `unistd.h'.
  1924.  
  1925.  - Macro: AC_USG
  1926.      Define `USG' if the system does not have `strings.h', `rindex',
  1927.      `bzero', etc.  This implies that it has `string.h', `strrchr',
  1928.      `memset', etc.
  1929.  
  1930.      The symbol `USG' is obsolete.  Instead of this macro, see the
  1931.      example for `AC_HEADER_STDC'.
  1932.  
  1933. 
  1934. File: autoconf.info,  Node: Generic Headers,  Prev: Particular Headers,  Up: Header Files
  1935.  
  1936. Generic Header Checks
  1937. ---------------------
  1938.  
  1939.    These macros are used to find system header files not covered by the
  1940. particular test macros.  If you need to check the contents of a header
  1941. as well as find out whether it is present, you have to write your own
  1942. test for it (*note Writing Tests::.).
  1943.  
  1944.  - Macro: AC_CHECK_HEADER (HEADER-FILE, [ACTION-IF-FOUND [,
  1945.           ACTION-IF-NOT-FOUND]])
  1946.      If the system header file HEADER-FILE exists, execute shell
  1947.      commands ACTION-IF-FOUND, otherwise execute ACTION-IF-NOT-FOUND.
  1948.      If you just want to define a symbol if the header file is
  1949.      available, consider using `AC_CHECK_HEADERS' instead.
  1950.  
  1951.  - Macro: AC_CHECK_HEADERS (HEADER-FILE... [, ACTION-IF-FOUND [,
  1952.           ACTION-IF-NOT-FOUND]])
  1953.      For each given system header file HEADER-FILE in the
  1954.      whitespace-separated argument list that exists, define
  1955.      `HAVE_HEADER-FILE' (in all capitals).  If ACTION-IF-FOUND is
  1956.      given, it is additional shell code to execute when one of the
  1957.      header files is found.  You can give it a value of `break' to
  1958.      break out of the loop on the first match.  If ACTION-IF-NOT-FOUND
  1959.      is given, it is executed when one of the header files is not found.
  1960.  
  1961. 
  1962. File: autoconf.info,  Node: Structures,  Next: Typedefs,  Prev: Header Files,  Up: Existing Tests
  1963.  
  1964. Structures
  1965. ==========
  1966.  
  1967.    The following macros check for certain structures or structure
  1968. members.  To check structures not listed here, use `AC_EGREP_CPP'
  1969. (*note Examining Declarations::.) or `AC_TRY_COMPILE' (*note Examining
  1970. Syntax::.).
  1971.  
  1972.  - Macro: AC_HEADER_STAT
  1973.      If the macros `S_ISDIR', `S_ISREG' et al. defined in `sys/stat.h'
  1974.      do not work properly (returning false positives), define
  1975.      `STAT_MACROS_BROKEN'.  This is the case on Tektronix UTekV, Amdahl
  1976.      UTS and Motorola System V/88.
  1977.  
  1978.  - Macro: AC_HEADER_TIME
  1979.      If a program may include both `time.h' and `sys/time.h', define
  1980.      `TIME_WITH_SYS_TIME'.  On some older systems, `sys/time.h'
  1981.      includes `time.h', but `time.h' is not protected against multiple
  1982.      inclusion, so programs should not explicitly include both files.
  1983.      This macro is useful in programs that use, for example, `struct
  1984.      timeval' or `struct timezone' as well as `struct tm'.  It is best
  1985.      used in conjunction with `HAVE_SYS_TIME_H', which can be checked
  1986.      for using `AC_CHECK_HEADERS(sys/time.h)'.
  1987.  
  1988.           #if TIME_WITH_SYS_TIME
  1989.           # include <sys/time.h>
  1990.           # include <time.h>
  1991.           #else
  1992.           # if HAVE_SYS_TIME_H
  1993.           #  include <sys/time.h>
  1994.           # else
  1995.           #  include <time.h>
  1996.           # endif
  1997.           #endif
  1998.  
  1999.  - Macro: AC_STRUCT_ST_BLKSIZE
  2000.      If `struct stat' contains an `st_blksize' member, define
  2001.      `HAVE_ST_BLKSIZE'.
  2002.  
  2003.  - Macro: AC_STRUCT_ST_BLOCKS
  2004.      If `struct stat' contains an `st_blocks' member, define
  2005.      `HAVE_ST_BLOCKS'.  Otherwise, add `fileblocks.o' to the output
  2006.      variable `LIBOBJS'.
  2007.  
  2008.  - Macro: AC_STRUCT_ST_RDEV
  2009.      If `struct stat' contains an `st_rdev' member, define
  2010.      `HAVE_ST_RDEV'.
  2011.  
  2012.  - Macro: AC_STRUCT_TM
  2013.      If `time.h' does not define `struct tm', define `TM_IN_SYS_TIME',
  2014.      which means that including `sys/time.h' had better define `struct
  2015.      tm'.
  2016.  
  2017.  - Macro: AC_STRUCT_TIMEZONE
  2018.      Figure out how to get the current timezone.  If `struct tm' has a
  2019.      `tm_zone' member, define `HAVE_TM_ZONE'.  Otherwise, if the
  2020.      external array `tzname' is found, define `HAVE_TZNAME'.
  2021.  
  2022. 
  2023. File: autoconf.info,  Node: Typedefs,  Next: Compiler Characteristics,  Prev: Structures,  Up: Existing Tests
  2024.  
  2025. Typedefs
  2026. ========
  2027.  
  2028.    The following macros check for C typedefs.  If there is no macro
  2029. specifically defined to check for a typedef you need, and you don't need
  2030. to check for any special properties of it, then you can use a general
  2031. typedef check macro.
  2032.  
  2033. * Menu:
  2034.  
  2035. * Particular Typedefs::         Special handling to find certain types.
  2036. * Generic Typedefs::            How to find other types.
  2037.  
  2038. 
  2039. File: autoconf.info,  Node: Particular Typedefs,  Next: Generic Typedefs,  Up: Typedefs
  2040.  
  2041. Particular Typedef Checks
  2042. -------------------------
  2043.  
  2044.    These macros check for particular C typedefs in `sys/types.h' and
  2045. `stdlib.h' (if it exists).
  2046.  
  2047.  - Macro: AC_TYPE_GETGROUPS
  2048.      Define `GETGROUPS_T' to be whichever of `gid_t' or `int' is the
  2049.      base type of the array argument to `getgroups'.
  2050.  
  2051.  - Macro: AC_TYPE_MODE_T
  2052.      If `mode_t' is not defined, define `mode_t' to be `int'.
  2053.  
  2054.  - Macro: AC_TYPE_OFF_T
  2055.      If `off_t' is not defined, define `off_t' to be `long'.
  2056.  
  2057.  - Macro: AC_TYPE_PID_T
  2058.      If `pid_t' is not defined, define `pid_t' to be `int'.
  2059.  
  2060.  - Macro: AC_TYPE_SIGNAL
  2061.      If `signal.h' declares `signal' as returning a pointer to a
  2062.      function returning `void', define `RETSIGTYPE' to be `void';
  2063.      otherwise, define it to be `int'.
  2064.  
  2065.      Define signal handlers as returning type `RETSIGTYPE':
  2066.  
  2067.           RETSIGTYPE
  2068.           hup_handler ()
  2069.           {
  2070.           ...
  2071.           }
  2072.  
  2073.  - Macro: AC_TYPE_SIZE_T
  2074.      If `size_t' is not defined, define `size_t' to be `unsigned'.
  2075.  
  2076.  - Macro: AC_TYPE_UID_T
  2077.      If `uid_t' is not defined, define `uid_t' to be `int' and `gid_t'
  2078.      to be `int'.
  2079.  
  2080. 
  2081. File: autoconf.info,  Node: Generic Typedefs,  Prev: Particular Typedefs,  Up: Typedefs
  2082.  
  2083. Generic Typedef Checks
  2084. ----------------------
  2085.  
  2086.    This macro is used to check for typedefs not covered by the
  2087. particular test macros.
  2088.  
  2089.  - Macro: AC_CHECK_TYPE (TYPE, DEFAULT)
  2090.      If the type TYPE is not defined in `sys/types.h' or `stdlib.h' (if
  2091.      it exists), define it to be the C (or C++) builtin type DEFAULT;
  2092.      e.g., `short' or `unsigned'.
  2093.  
  2094. 
  2095. File: autoconf.info,  Node: Compiler Characteristics,  Next: System Services,  Prev: Typedefs,  Up: Existing Tests
  2096.  
  2097. Compiler Characteristics
  2098. ========================
  2099.  
  2100.    The following macros check for C compiler or machine architecture
  2101. features.  To check for characteristics not listed here, use
  2102. `AC_TRY_COMPILE' (*note Examining Syntax::.) or `AC_TRY_RUN' (*note Run
  2103. Time::.)
  2104.  
  2105.  - Macro: AC_C_BIGENDIAN
  2106.      If words are stored with the most significant byte first (like
  2107.      Motorola and SPARC, but not Intel and VAX, CPUs), define
  2108.      `WORDS_BIGENDIAN'.
  2109.  
  2110.  - Macro: AC_C_CONST
  2111.      If the C compiler does not fully support the keyword `const',
  2112.      define `const' to be empty.  Some C compilers that do not define
  2113.      `__STDC__' do support `const'; some compilers that define
  2114.      `__STDC__' do not completely support `const'.  Programs can simply
  2115.      use `const' as if every C compiler supported it; for those that
  2116.      don't, the `Makefile' or configuration header file will define it
  2117.      as empty.
  2118.  
  2119.  - Macro: AC_C_INLINE
  2120.      If the C compiler supports the keyword `inline', do nothing.
  2121.      Otherwise define `inline' to `__inline__' or `__inline' if it
  2122.      accepts one of those, otherwise define `inline' to be empty.
  2123.  
  2124.  - Macro: AC_C_CHAR_UNSIGNED
  2125.      If the C type `char' is unsigned, define `__CHAR_UNSIGNED__',
  2126.      unless the C compiler predefines it.
  2127.  
  2128.  - Macro: AC_C_LONG_DOUBLE
  2129.      If the C compiler supports the `long double' type, define
  2130.      `HAVE_LONG_DOUBLE'.  Some C compilers that do not define
  2131.      `__STDC__' do support the `long double' type; some compilers that
  2132.      define `__STDC__' do not support `long double'.
  2133.  
  2134.  - Macro: AC_CHECK_SIZEOF (TYPE [, CROSS-SIZE])
  2135.      Define `SIZEOF_UCTYPE' to be the size in bytes of the C (or C++)
  2136.      builtin type TYPE, e.g. `int' or `char *'.  If `type' is unknown
  2137.      to the compiler, it gets a size of 0.  UCTYPE is TYPE, with
  2138.      lowercase converted to uppercase, spaces changed to underscores,
  2139.      and asterisks changed to `P'.  If cross-compiling, the value
  2140.      CROSS-SIZE is used if given, otherwise `configure' exits with an
  2141.      error message.
  2142.  
  2143.      For example, the call
  2144.           AC_CHECK_SIZEOF(int *)
  2145.  
  2146.      defines `SIZEOF_INT_P' to be 8 on DEC Alpha AXP systems.
  2147.  
  2148.  - Macro: AC_INT_16_BITS
  2149.      If the C type `int' is 16 bits wide, define `INT_16_BITS'.  This
  2150.      macro is obsolete; it is more general to use
  2151.      `AC_CHECK_SIZEOF(int)' instead.
  2152.  
  2153.  - Macro: AC_LONG_64_BITS
  2154.      If the C type `long int' is 64 bits wide, define `LONG_64_BITS'.
  2155.      This macro is obsolete; it is more general to use
  2156.      `AC_CHECK_SIZEOF(long)' instead.
  2157.  
  2158. 
  2159. File: autoconf.info,  Node: System Services,  Next: UNIX Variants,  Prev: Compiler Characteristics,  Up: Existing Tests
  2160.  
  2161. System Services
  2162. ===============
  2163.  
  2164.    The following macros check for operating system services or
  2165. capabilities.
  2166.  
  2167.  - Macro: AC_SYS_INTERPRETER
  2168.      Check whether the system supports starting scripts with a line of
  2169.      the form `#! /bin/csh' to select the interpreter to use for the
  2170.      script.  After running this macro, shell code in `configure.in'
  2171.      can check the variable `ac_cv_sys_interpreter'; it will be set to
  2172.      `yes' if the system supports `#!', `no' if not.
  2173.  
  2174.  - Macro: AC_PATH_X
  2175.      Try to locate the X Window System include files and libraries.  If
  2176.      the user gave the command line options `--x-includes=DIR' and
  2177.      `--x-libraries=DIR', use those directories.  If either or both
  2178.      were not given, get the missing values by running `xmkmf' on a
  2179.      trivial `Imakefile' and examining the `Makefile' that it produces.
  2180.      If that fails (such as if `xmkmf' is not present), look for them
  2181.      in several directories where they often reside.  If either method
  2182.      is successful, set the shell variables `x_includes' and
  2183.      `x_libraries' to their locations, unless they are in directories
  2184.      the compiler searches by default.
  2185.  
  2186.      If both methods fail, or the user gave the command line option
  2187.      `--without-x', set the shell variable `no_x' to `yes'; otherwise
  2188.      set it to the empty string.
  2189.  
  2190.  - Macro: AC_PATH_XTRA
  2191.      An enhanced version of `AC_PATH_X'.  It adds the C compiler flags
  2192.      that X needs to output variable `X_CFLAGS', and the X linker flags
  2193.      to `X_LIBS'.  If X is not available, adds `-DX_DISPLAY_MISSING' to
  2194.      `X_CFLAGS'.
  2195.  
  2196.      This macro also checks for special libraries that some systems
  2197.      need in order to compile X programs.  It adds any that the system
  2198.      needs to output variable `X_EXTRA_LIBS'.  And it checks for
  2199.      special X11R6 libraries that need to be linked with before
  2200.      `-lX11', and adds any found to the output variable `X_PRE_LIBS'.
  2201.  
  2202.  
  2203.  - Macro: AC_SYS_LONG_FILE_NAMES
  2204.      If the system supports file names longer than 14 characters, define
  2205.      `HAVE_LONG_FILE_NAMES'.
  2206.  
  2207.  - Macro: AC_SYS_RESTARTABLE_SYSCALLS
  2208.      If the system automatically restarts a system call that is
  2209.      interrupted by a signal, define `HAVE_RESTARTABLE_SYSCALLS'.
  2210.  
  2211. 
  2212. File: autoconf.info,  Node: UNIX Variants,  Prev: System Services,  Up: Existing Tests
  2213.  
  2214. UNIX Variants
  2215. =============
  2216.  
  2217.    The following macros check for certain operating systems that need
  2218. special treatment for some programs, due to exceptional oddities in
  2219. their header files or libraries.  These macros are warts; they will be
  2220. replaced by a more systematic approach, based on the functions they make
  2221. available or the environments they provide.
  2222.  
  2223.  - Macro: AC_AIX
  2224.      If on AIX, define `_ALL_SOURCE'.  Allows the use of some BSD
  2225.      functions.  Should be called before any macros that run the C
  2226.      compiler.
  2227.  
  2228.  - Macro: AC_DYNIX_SEQ
  2229.      If on Dynix/PTX (Sequent UNIX), add `-lseq' to output variable
  2230.      `LIBS'.  This macro is obsolete; instead, use `AC_FUNC_GETMNTENT'.
  2231.  
  2232.  - Macro: AC_IRIX_SUN
  2233.      If on IRIX (Silicon Graphics UNIX), add `-lsun' to output variable
  2234.      `LIBS'.  This macro is obsolete.  If you were using it to get
  2235.      `getmntent', use `AC_FUNC_GETMNTENT' instead.  If you used it for
  2236.      the NIS versions of the password and group functions, use
  2237.      `AC_CHECK_LIB(sun, getpwnam)'.
  2238.  
  2239.  - Macro: AC_ISC_POSIX
  2240.      If on a POSIXized ISC UNIX, define `_POSIX_SOURCE' and add
  2241.      `-posix' (for the GNU C compiler) or `-Xp' (for other C compilers)
  2242.      to output variable `CC'.  This allows the use of POSIX facilities.
  2243.      Must be called after `AC_PROG_CC' and before any other macros
  2244.      that run the C compiler.
  2245.  
  2246.  - Macro: AC_MINIX
  2247.      If on Minix, define `_MINIX' and `_POSIX_SOURCE' and define
  2248.      `_POSIX_1_SOURCE' to be 2.  This allows the use of POSIX
  2249.      facilities.  Should be called before any macros that run the C
  2250.      compiler.
  2251.  
  2252.  - Macro: AC_SCO_INTL
  2253.      If on SCO UNIX, add `-lintl' to output variable `LIBS'.  This
  2254.      macro is obsolete; instead, use `AC_FUNC_STRFTIME'.
  2255.  
  2256.  - Macro: AC_XENIX_DIR
  2257.      If on Xenix, add `-lx' to output variable `LIBS'.  Also, if
  2258.      `dirent.h' is being used, add `-ldir' to `LIBS'.  This macro is
  2259.      obsolete; use `AC_HEADER_DIRENT' instead.
  2260.  
  2261. 
  2262. File: autoconf.info,  Node: Writing Tests,  Next: Results,  Prev: Existing Tests,  Up: Top
  2263.  
  2264. Writing Tests
  2265. *************
  2266.  
  2267.    If the existing feature tests don't do something you need, you have
  2268. to write new ones.  These macros are the building blocks.  They provide
  2269. ways for other macros to check whether various kinds of features are
  2270. available and report the results.
  2271.  
  2272.    This chapter contains some suggestions and some of the reasons why
  2273. the existing tests are written the way they are.  You can also learn a
  2274. lot about how to write Autoconf tests by looking at the existing ones.
  2275. If something goes wrong in one or more of the Autoconf tests, this
  2276. information can help you understand the assumptions behind them, which
  2277. might help you figure out how to best solve the problem.
  2278.  
  2279.    These macros check the output of the C compiler system.  They do not
  2280. cache the results of their tests for future use (*note Caching
  2281. Results::.), because they don't know enough about the information they
  2282. are checking for to generate a cache variable name.  They also do not
  2283. print any messages, for the same reason.  The checks for particular
  2284. kinds of C features call these macros and do cache their results and
  2285. print messages about what they're checking for.
  2286.  
  2287.    When you write a feature test that could be applicable to more than
  2288. one software package, the best thing to do is encapsulate it in a new
  2289. macro.  *Note Writing Macros::, for how to do that.
  2290.  
  2291. * Menu:
  2292.  
  2293. * Examining Declarations::    Detecting header files and declarations.
  2294. * Examining Syntax::            Detecting language syntax features.
  2295. * Examining Libraries::         Detecting functions and global variables.
  2296. * Run Time::                Testing for run-time features.
  2297. * Portable Shell::              Shell script portability pitfalls.
  2298. * Testing Values and Files::    Checking strings and files.
  2299. * Multiple Cases::        Tests for several possible values.
  2300. * Language Choice::             Selecting which language to use for testing.
  2301.  
  2302. 
  2303. File: autoconf.info,  Node: Examining Declarations,  Next: Examining Syntax,  Up: Writing Tests
  2304.  
  2305. Examining Declarations
  2306. ======================
  2307.  
  2308.    The macro `AC_TRY_CPP' is used to check whether particular header
  2309. files exist.  You can check for one at a time, or more than one if you
  2310. need several header files to all exist for some purpose.
  2311.  
  2312.  - Macro: AC_TRY_CPP (INCLUDES, [ACTION-IF-TRUE [, ACTION-IF-FALSE]])
  2313.      INCLUDES is C or C++ `#include' statements and declarations, on
  2314.      which shell variable, backquote, and backslash substitutions are
  2315.      performed.  (Actually, it can be any C program, but other
  2316.      statements are probably not useful.)  If the preprocessor produces
  2317.      no error messages while processing it, run shell commands
  2318.      ACTION-IF-TRUE.  Otherwise run shell commands ACTION-IF-FALSE.
  2319.  
  2320.      This macro uses `CPPFLAGS', but not `CFLAGS', because `-g', `-O',
  2321.      etc. are not valid options to many C preprocessors.
  2322.  
  2323.    Here is how to find out whether a header file contains a particular
  2324. declaration, such as a typedef, a structure, a structure member, or a
  2325. function.  Use `AC_EGREP_HEADER' instead of running `grep' directly on
  2326. the header file; on some systems the symbol might be defined in another
  2327. header file that the file you are checking `#include's.
  2328.  
  2329.  - Macro: AC_EGREP_HEADER (PATTERN, HEADER-FILE, ACTION-IF-FOUND [,
  2330.           ACTION-IF-NOT-FOUND])
  2331.      If the output of running the preprocessor on the system header file
  2332.      HEADER-FILE matches the `egrep' regular expression PATTERN,
  2333.      execute shell commands ACTION-IF-FOUND, otherwise execute
  2334.      ACTION-IF-NOT-FOUND.
  2335.  
  2336.    To check for C preprocessor symbols, either defined by header files
  2337. or predefined by the C preprocessor, use `AC_EGREP_CPP'.  Here is an
  2338. example of the latter:
  2339.  
  2340.      AC_EGREP_CPP(yes,
  2341.      [#ifdef _AIX
  2342.        yes
  2343.      #endif
  2344.      ], is_aix=yes, is_aix=no)
  2345.  
  2346.  - Macro: AC_EGREP_CPP (PATTERN, PROGRAM, [ACTION-IF-FOUND [,
  2347.           ACTION-IF-NOT-FOUND]])
  2348.      PROGRAM is the text of a C or C++ program, on which shell
  2349.      variable, backquote, and backslash substitutions are performed.
  2350.      If the output of running the preprocessor on PROGRAM matches the
  2351.      `egrep' regular expression PATTERN, execute shell commands
  2352.      ACTION-IF-FOUND, otherwise execute ACTION-IF-NOT-FOUND.
  2353.  
  2354.      This macro calls `AC_PROG_CPP' or `AC_PROG_CXXCPP' (depending on
  2355.      which language is current, *note Language Choice::.), if it hasn't
  2356.      been called already.
  2357.  
  2358. 
  2359. File: autoconf.info,  Node: Examining Syntax,  Next: Examining Libraries,  Prev: Examining Declarations,  Up: Writing Tests
  2360.  
  2361. Examining Syntax
  2362. ================
  2363.  
  2364.    To check for a syntax feature of the C or C++ compiler, such as
  2365. whether it recognizes a certain keyword, use `AC_TRY_COMPILE' to try to
  2366. compile a small program that uses that feature.  You can also use it to
  2367. check for structures and structure members that are not present on all
  2368. systems.
  2369.  
  2370.  - Macro: AC_TRY_COMPILE (INCLUDES, FUNCTION-BODY, [ACTION-IF-FOUND [,
  2371.           ACTION-IF-NOT-FOUND]])
  2372.      Create a test C program to see whether a function whose body
  2373.      consists of FUNCTION-BODY can be compiled; INCLUDES is any
  2374.      `#include' statements needed by the code in FUNCTION-BODY.  If the
  2375.      file compiles successfully, run shell commands ACTION-IF-FOUND,
  2376.      otherwise run ACTION-IF-NOT-FOUND.  This macro uses `CFLAGS' or
  2377.      `CXXFLAGS', and `CPPFLAGS', when compiling.  It does not try to
  2378.      link; use `AC_TRY_LINK' if you need to do that (*note Examining
  2379.      Libraries::.).
  2380.  
  2381. 
  2382. File: autoconf.info,  Node: Examining Libraries,  Next: Run Time,  Prev: Examining Syntax,  Up: Writing Tests
  2383.  
  2384. Examining Libraries
  2385. ===================
  2386.  
  2387.    To check for a library, a function, or a global variable, Autoconf
  2388. `configure' scripts try to compile and link a small program that uses
  2389. it.  This is unlike Metaconfig, which by default uses `nm' or `ar' on
  2390. the C library to try to figure out which functions are available.
  2391. Trying to link with the function is usually a more reliable approach
  2392. because it avoids dealing with the variations in the options and output
  2393. formats of `nm' and `ar' and in the location of the standard libraries.
  2394. It also allows configuring for cross-compilation or checking a
  2395. function's runtime behavior if needed.  On the other hand, it can be
  2396. slower than scanning the libraries once.
  2397.  
  2398.    A few systems have linkers that do not return a failure exit status
  2399. when there are unresolved functions in the link.  This bug makes the
  2400. configuration scripts produced by Autoconf unusable on those systems.
  2401. However, some of them can be given options that make the exit status
  2402. correct.  This is a problem that Autoconf does not currently handle
  2403. automatically.  If users encounter this problem, they might be able to
  2404. solve it by setting `LDFLAGS' in the environment to pass whatever
  2405. options the linker needs (for example, `-Wl,-dn' on MIPS RISC/OS).
  2406.  
  2407.    `AC_TRY_LINK' is used to compile test programs to test for functions
  2408. and global variables.  It is also used (by `AC_CHECK_LIB') to check for
  2409. libraries, by adding the library being checked for to `LIBS'
  2410. temporarily and trying to link a small program.
  2411.  
  2412.  - Macro: AC_TRY_LINK (INCLUDES, FUNCTION-BODY, [ACTION-IF-FOUND [,
  2413.           ACTION-IF-NOT-FOUND]])
  2414.      Create a test C program to see whether a function whose body
  2415.      consists of FUNCTION-BODY can be compiled and linked; INCLUDES is
  2416.      any `#include' statements needed by the code in FUNCTION-BODY.  If
  2417.      the file compiles and links successfully, run shell commands
  2418.      ACTION-IF-FOUND, otherwise run ACTION-IF-NOT-FOUND.  This macro
  2419.      uses `CFLAGS' or `CXXFLAGS', `CPPFLAGS', `LDFLAGS', and `LIBS'
  2420.      when compiling.
  2421.  
  2422.  - Macro: AC_COMPILE_CHECK (ECHO-TEXT, INCLUDES, FUNCTION-BODY,
  2423.           ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
  2424.      This is an obsolete version of `AC_TRY_LINK', with the addition
  2425.      that it prints `checking for ECHO-TEXT' to the standard output
  2426.      first, if ECHO-TEXT is non-empty.  Use `AC_MSG_CHECKING' and
  2427.      `AC_MSG_RESULT' instead to print messages (*note Printing
  2428.      Messages::.).
  2429.  
  2430. 
  2431. File: autoconf.info,  Node: Run Time,  Next: Portable Shell,  Prev: Examining Libraries,  Up: Writing Tests
  2432.  
  2433. Checking Run Time Behavior
  2434. ==========================
  2435.  
  2436.    Sometimes you need to find out how a system performs at run time,
  2437. such as whether a given function has a certain capability or bug.  If
  2438. you can, make such checks when your program runs instead of when it is
  2439. configured.  You can check for things like the machine's endianness when
  2440. your program initializes itself.
  2441.  
  2442.    If you really need to test for a run-time behavior while configuring,
  2443. you can write a test program to determine the result, and compile and
  2444. run it using `AC_TRY_RUN'.  Avoid running test programs if possible,
  2445. because using them prevents people from configuring your package for
  2446. cross-compiling.
  2447.  
  2448. * Menu:
  2449.  
  2450. * Test Programs::               Running test programs.
  2451. * Guidelines::            General rules for writing test programs.
  2452. * Test Functions::        Avoiding pitfalls in test programs.
  2453.  
  2454. 
  2455. File: autoconf.info,  Node: Test Programs,  Next: Guidelines,  Up: Run Time
  2456.  
  2457. Running Test Programs
  2458. ---------------------
  2459.  
  2460.    Use the following macro if you need to test run-time behavior of the
  2461. system while configuring.
  2462.  
  2463.  - Macro: AC_TRY_RUN (PROGRAM, [ACTION-IF-TRUE [, ACTION-IF-FALSE [,
  2464.           ACTION-IF-CROSS-COMPILING]]])
  2465.      PROGRAM is the text of a C program, on which shell variable and
  2466.      backquote substitutions are performed.  If it compiles and links
  2467.      successfully and returns an exit status of 0 when executed, run
  2468.      shell commands ACTION-IF-TRUE.  Otherwise run shell commands
  2469.      ACTION-IF-FALSE; the exit status of the program is available in
  2470.      the shell variable `$?'.  This macro uses `CFLAGS' or `CXXFLAGS',
  2471.      `CPPFLAGS', `LDFLAGS', and `LIBS' when compiling.
  2472.  
  2473.      If the C compiler being used does not produce executables that run
  2474.      on the system where `configure' is being run, then the test
  2475.      program is not run.  If the optional shell commands
  2476.      ACTION-IF-CROSS-COMPILING are given, they are run instead and this
  2477.      macro calls `AC_C_CROSS' if it has not already been called.
  2478.      Otherwise, `configure' prints an error message and exits.
  2479.  
  2480.    Try to provide a pessimistic default value to use when
  2481. cross-compiling makes run-time tests impossible.  You do this by
  2482. passing the optional last argument to `AC_TRY_RUN'.  `autoconf' prints
  2483. a warning message when creating `configure' each time it encounters a
  2484. call to `AC_TRY_RUN' with no ACTION-IF-CROSS-COMPILING argument given.
  2485. You may ignore the warning, though users will not be able to configure
  2486. your package for cross-compiling.  A few of the macros distributed with
  2487. Autoconf produce this warning message.
  2488.  
  2489.    To configure for cross-compiling you can also choose a value for
  2490. those parameters based on the canonical system name (*note Manual
  2491. Configuration::.).  Alternatively, set up a test results cache file with
  2492. the correct values for the target system (*note Caching Results::.).
  2493.  
  2494.    To provide a default for calls of `AC_TRY_RUN' that are embedded in
  2495. other macros, including a few of the ones that come with Autoconf, you
  2496. can call `AC_C_CROSS' before running them.  Then, if the shell variable
  2497. `cross_compiling' is set to `yes', use an alternate method to get the
  2498. results instead of calling the macros.
  2499.  
  2500.  - Macro: AC_C_CROSS
  2501.      If the C compiler being used does not produce executables that can
  2502.      run on the system where `configure' is being run, set the shell
  2503.      variable `cross_compiling' to `yes', otherwise `no'.
  2504.  
  2505. 
  2506. File: autoconf.info,  Node: Guidelines,  Next: Test Functions,  Prev: Test Programs,  Up: Run Time
  2507.  
  2508. Guidelines for Test Programs
  2509. ----------------------------
  2510.  
  2511.    Test programs should not write anything to the standard output.  They
  2512. should return 0 if the test succeeds, nonzero otherwise, so that success
  2513. can be distinguished easily from a core dump or other failure;
  2514. segmentation violations and other failures produce a nonzero exit
  2515. status.  Test programs should `exit', not `return', from `main',
  2516. because on some systems (old Suns, at least) the argument to `return'
  2517. in `main' is ignored.
  2518.  
  2519.    Test programs can use `#if' or `#ifdef' to check the values of
  2520. preprocessor macros defined by tests that have already run.  For
  2521. example, if you call `AC_HEADER_STDC', then later on in `configure.in'
  2522. you can have a test program that includes an ANSI C header file
  2523. conditionally:
  2524.  
  2525.      #if STDC_HEADERS
  2526.      # include <stdlib.h>
  2527.      #endif
  2528.  
  2529.    If a test program needs to use or create a data file, give it a name
  2530. that starts with `conftest', such as `conftestdata'.  The `configure'
  2531. script cleans up by running `rm -rf conftest*' after running test
  2532. programs and if the script is interrupted.
  2533.  
  2534. 
  2535. File: autoconf.info,  Node: Test Functions,  Prev: Guidelines,  Up: Run Time
  2536.  
  2537. Test Functions
  2538. --------------
  2539.  
  2540.    Function declarations in test programs should have a prototype
  2541. conditionalized for C++.  In practice, though, test programs rarely need
  2542. functions that take arguments.
  2543.  
  2544.      #ifdef __cplusplus
  2545.      foo(int i)
  2546.      #else
  2547.      foo(i) int i;
  2548.      #endif
  2549.  
  2550.    Functions that test programs declare should also be conditionalized
  2551. for C++, which requires `extern "C"' prototypes.  Make sure to not
  2552. include any header files containing clashing prototypes.
  2553.  
  2554.      #ifdef __cplusplus
  2555.      extern "C" void *malloc(size_t);
  2556.      #else
  2557.      char *malloc();
  2558.      #endif
  2559.  
  2560.    If a test program calls a function with invalid parameters (just to
  2561. see whether it exists), organize the program to ensure that it never
  2562. invokes that function.  You can do this by calling it in another
  2563. function that is never invoked.  You can't do it by putting it after a
  2564. call to `exit', because GCC version 2 knows that `exit' never returns
  2565. and optimizes out any code that follows it in the same block.
  2566.  
  2567.    If you include any header files, make sure to call the functions
  2568. relevant to them with the correct number of arguments, even if they are
  2569. just 0, to avoid compilation errors due to prototypes.  GCC version 2
  2570. has internal prototypes for several functions that it automatically
  2571. inlines; for example, `memcpy'.  To avoid errors when checking for
  2572. them, either pass them the correct number of arguments or redeclare them
  2573. with a different return type (such as `char').
  2574.  
  2575. 
  2576. File: autoconf.info,  Node: Portable Shell,  Next: Testing Values and Files,  Prev: Run Time,  Up: Writing Tests
  2577.  
  2578. Portable Shell Programming
  2579. ==========================
  2580.  
  2581.    When writing your own checks, there are some shell script programming
  2582. techniques you should avoid in order to make your code portable.  The
  2583. Bourne shell and upward-compatible shells like Bash and the Korn shell
  2584. have evolved over the years, but to prevent trouble, do not take
  2585. advantage of features that were added after UNIX version 7, circa 1977.
  2586. You should not use shell functions, aliases, negated character classes,
  2587. or other features that are not found in all Bourne-compatible shells;
  2588. restrict yourself to the lowest common denominator.  Even `unset' is
  2589. not supported by all shells!  Also, include a space after the
  2590. exclamation point in interpreter specifications, like this:
  2591.      #! /usr/bin/perl
  2592.    If you omit the space before the path, then 4.2BSD based systems
  2593. (such as Sequent DYNIX) will ignore the line, because they interpret
  2594. `#! /' as a 4-byte magic number.
  2595.  
  2596.    The set of external programs you should run in a `configure' script
  2597. is fairly small.  *Note Utilities in Makefiles: (standards)Utilities in
  2598. Makefiles, for the list.  This restriction allows users to start out
  2599. with a fairly small set of programs and build the rest, avoiding too
  2600. many interdependencies between packages.
  2601.  
  2602.    Some of these external utilities have a portable subset of features,
  2603. as well; for example, don't rely on `ln' having a `-f' option or `cat'
  2604. having any options.  `sed' scripts should not contain comments or use
  2605. branch labels longer than 8 characters.  Don't use `grep -s' to
  2606. suppress output, because `grep -s' on System V does not suppress
  2607. output, only error messages.  Instead, redirect the standard output and
  2608. standard error (in case the file doesn't exist) of `grep' to
  2609. `/dev/null'.  Check the exit status of `grep' to determine whether it
  2610. found a match.
  2611.  
  2612. 
  2613. File: autoconf.info,  Node: Testing Values and Files,  Next: Multiple Cases,  Prev: Portable Shell,  Up: Writing Tests
  2614.  
  2615. Testing Values and Files
  2616. ========================
  2617.  
  2618.    `configure' scripts need to test properties of many files and
  2619. strings.  Here are some portability problems to watch out for when doing
  2620. those tests.
  2621.  
  2622.    The `test' program is the way to perform many file and string tests.
  2623. It is often invoked by the alternate name `[', but using that name in
  2624. Autoconf code is asking for trouble since it is an `m4' quote character.
  2625.  
  2626.    If you need to make multiple checks using `test', combine them with
  2627. the shell operators `&&' and `||' instead of using the `test' operators
  2628. `-a' and `-o'.  On System V, the precedence of `-a' and `-o' is wrong
  2629. relative to the unary operators; consequently, POSIX does not specify
  2630. them, so using them is nonportable.  If you combine `&&' and `||' in
  2631. the same statement, keep in mind that they have equal precedence.
  2632.  
  2633.    To enable `configure' scripts to support cross-compilation, they
  2634. shouldn't do anything that tests features of the host system instead of
  2635. the target system.  But occasionally you may find it necessary to check
  2636. whether some arbitrary file exists.  To do so, use `test -f' or `test
  2637. -r'.  Do not use `test -x', because 4.3BSD does not have it.
  2638.  
  2639.    Another nonportable shell programming construction is
  2640.      VAR=${VAR:-VALUE}
  2641.  
  2642. The intent is to set VAR to VALUE only if it is not already set, but if
  2643. VAR has any value, even the empty string, to leave it alone.  Old BSD
  2644. shells, including the Ultrix `sh', don't accept the colon, and complain
  2645. and die.  A portable equivalent is
  2646.      : ${VAR=VALUE}
  2647.  
  2648. 
  2649. File: autoconf.info,  Node: Multiple Cases,  Next: Language Choice,  Prev: Testing Values and Files,  Up: Writing Tests
  2650.  
  2651. Multiple Cases
  2652. ==============
  2653.  
  2654.    Some operations are accomplished in several possible ways, depending
  2655. on the UNIX variant.  Checking for them essentially requires a "case
  2656. statement".  Autoconf does not directly provide one; however, it is
  2657. easy to simulate by using a shell variable to keep track of whether a
  2658. way to perform the operation has been found yet.
  2659.  
  2660.    Here is an example that uses the shell variable `fstype' to keep
  2661. track of whether the remaining cases need to be checked.
  2662.  
  2663.      AC_MSG_CHECKING(how to get filesystem type)
  2664.      fstype=no
  2665.      # The order of these tests is important.
  2666.      AC_TRY_CPP([#include <sys/statvfs.h>
  2667.      #include <sys/fstyp.h>], AC_DEFINE(FSTYPE_STATVFS) fstype=SVR4)
  2668.      if test $fstype = no; then
  2669.      AC_TRY_CPP([#include <sys/statfs.h>
  2670.      #include <sys/fstyp.h>], AC_DEFINE(FSTYPE_USG_STATFS) fstype=SVR3)
  2671.      fi
  2672.      if test $fstype = no; then
  2673.      AC_TRY_CPP([#include <sys/statfs.h>
  2674.      #include <sys/vmount.h>], AC_DEFINE(FSTYPE_AIX_STATFS) fstype=AIX)
  2675.      fi
  2676.      # (more cases omitted here)
  2677.      AC_MSG_RESULT($fstype)
  2678.  
  2679. 
  2680. File: autoconf.info,  Node: Language Choice,  Prev: Multiple Cases,  Up: Writing Tests
  2681.  
  2682. Language Choice
  2683. ===============
  2684.  
  2685.    Packages that use both C and C++ need to test features of both
  2686. compilers.  Autoconf-generated `configure' scripts check for C features
  2687. by default.  The following macros determine which language's compiler
  2688. is used in tests that follow in `configure.in'.
  2689.  
  2690.  - Macro: AC_LANG_C
  2691.      Do compilation tests using `CC' and `CPP' and use extension `.c'
  2692.      for test programs.
  2693.  
  2694.  - Macro: AC_LANG_CPLUSPLUS
  2695.      Do compilation tests using `CXX' and `CXXCPP' and use extension
  2696.      `.C' for test programs.
  2697.  
  2698.  - Macro: AC_LANG_SAVE
  2699.      Remember the current language (as set by `AC_LANG_C' or
  2700.      `AC_LANG_CPLUSPLUS') on a stack.  Does not change which language is
  2701.      current.  Use this macro and `AC_LANG_RESTORE' in macros that need
  2702.      to temporarily switch to a particular language.
  2703.  
  2704.  - Macro: AC_LANG_RESTORE
  2705.      Select the language that is saved on the top of the stack, as set
  2706.      by `AC_LANG_SAVE', and remove it from the stack.  This macro is
  2707.      equivalent to either `AC_LANG_C' or `AC_LANG_CPLUSPLUS', whichever
  2708.      had been run most recently when `AC_LANG_SAVE' was last called.
  2709.  
  2710.      Do not call this macro more times than `AC_LANG_SAVE'.
  2711.  
  2712.  - Macro: AC_REQUIRE_CPP
  2713.      Ensure that whichever preprocessor would currently be used for
  2714.      tests has been found.  Calls `AC_REQUIRE' (*note Prerequisite
  2715.      Macros::.) with an argument of either `AC_PROG_CPP' or
  2716.      `AC_PROG_CXXCPP', depending on which language is current.
  2717.  
  2718. 
  2719. File: autoconf.info,  Node: Results,  Next: Writing Macros,  Prev: Writing Tests,  Up: Top
  2720.  
  2721. Results of Tests
  2722. ****************
  2723.  
  2724.    Once `configure' has determined whether a feature exists, what can
  2725. it do to record that information?  There are four sorts of things it can
  2726. do: define a C preprocessor symbol, set a variable in the output files,
  2727. save the result in a cache file for future `configure' runs, and print
  2728. a message letting the user know the result of the test.
  2729.  
  2730. * Menu:
  2731.  
  2732. * Defining Symbols::            Defining C preprocessor symbols.
  2733. * Setting Output Variables::    Replacing variables in output files.
  2734. * Caching Results::             Speeding up subsequent `configure' runs.
  2735. * Printing Messages::           Notifying users of progress or problems.
  2736.  
  2737. 
  2738. File: autoconf.info,  Node: Defining Symbols,  Next: Setting Output Variables,  Up: Results
  2739.  
  2740. Defining C Preprocessor Symbols
  2741. ===============================
  2742.  
  2743.    A common action to take in response to a feature test is to define a
  2744. C preprocessor symbol indicating the results of the test.  That is done
  2745. by calling `AC_DEFINE' or `AC_DEFINE_UNQUOTED'.
  2746.  
  2747.    By default, `AC_OUTPUT' places the symbols defined by these macros
  2748. into the output variable `DEFS', which contains an option
  2749. `-DSYMBOL=VALUE' for each symbol defined.  Unlike in Autoconf version
  2750. 1, there is no variable `DEFS' defined while `configure' is running.
  2751. To check whether Autoconf macros have already defined a certain C
  2752. preprocessor symbol, test the value of the appropriate cache variable,
  2753. as in this example:
  2754.  
  2755.      AC_CHECK_FUNC(vprintf, AC_DEFINE(HAVE_VPRINTF))
  2756.      if test "$ac_cv_func_vprintf" != yes; then
  2757.      AC_CHECK_FUNC(_doprnt, AC_DEFINE(HAVE_DOPRNT))
  2758.      fi
  2759.  
  2760.    If `AC_CONFIG_HEADER' has been called, then instead of creating
  2761. `DEFS', `AC_OUTPUT' creates a header file by substituting the correct
  2762. values into `#define' statements in a template file.  *Note
  2763. Configuration Headers::, for more information about this kind of output.
  2764.  
  2765.  - Macro: AC_DEFINE (VARIABLE [, VALUE])
  2766.      Define C preprocessor variable VARIABLE.  If VALUE is given, set
  2767.      VARIABLE to that value (verbatim), otherwise set it to 1.  VALUE
  2768.      should not contain literal newlines, and if you are not using
  2769.      `AC_CONFIG_HEADER' it should not contain any `#' characters, as
  2770.      `make' tends to eat them.  To use a shell variable (which you need
  2771.      to do in order to define a value containing the `m4' quote
  2772.      characters `[' or `]'), use `AC_DEFINE_UNQUOTED' instead.  The
  2773.      following example defines the C preprocessor variable `EQUATION'
  2774.      to be the string constant `"$a > $b"':
  2775.  
  2776.           AC_DEFINE(EQUATION, "$a > $b")
  2777.  
  2778.  - Macro: AC_DEFINE_UNQUOTED (VARIABLE [, VALUE])
  2779.      Like `AC_DEFINE', but three shell expansions are
  2780.      performed--once--on VARIABLE and VALUE: variable expansion (`$'),
  2781.      command substitution (``'), and backslash escaping (`\').  Single
  2782.      and double quote characters in the value have no special meaning.
  2783.      Use this macro instead of `AC_DEFINE' when VARIABLE or VALUE is a
  2784.      shell variable.  Examples:
  2785.  
  2786.           AC_DEFINE_UNQUOTED(config_machfile, "${machfile}")
  2787.           AC_DEFINE_UNQUOTED(GETGROUPS_T, $ac_cv_type_getgroups)
  2788.           AC_DEFINE_UNQUOTED(${ac_tr_hdr})
  2789.  
  2790.    Due to the syntactical bizarreness of the Bourne shell, do not use
  2791. semicolons to separate `AC_DEFINE' or `AC_DEFINE_UNQUOTED' calls from
  2792. other macro calls or shell code; that can cause syntax errors in the
  2793. resulting `configure' script.  Use either spaces or newlines.  That is,
  2794. do this:
  2795.  
  2796.      AC_CHECK_HEADER(elf.h, AC_DEFINE(SVR4) LIBS="$LIBS -lelf")
  2797.  
  2798. or this:
  2799.  
  2800.      AC_CHECK_HEADER(elf.h,
  2801.        AC_DEFINE(SVR4)
  2802.        LIBS="$LIBS -lelf")
  2803.  
  2804. instead of this:
  2805.  
  2806.      AC_CHECK_HEADER(elf.h, AC_DEFINE(SVR4); LIBS="$LIBS -lelf")
  2807.  
  2808. 
  2809. File: autoconf.info,  Node: Setting Output Variables,  Next: Caching Results,  Prev: Defining Symbols,  Up: Results
  2810.  
  2811. Setting Output Variables
  2812. ========================
  2813.  
  2814.    One way to record the results of tests is to set "output variables",
  2815. which are shell variables whose values are substituted into files that
  2816. `configure' outputs.  The two macros below create new output variables.
  2817. *Note Preset Output Variables::, for a list of output variables that
  2818. are always available.
  2819.  
  2820.  - Macro: AC_SUBST (VARIABLE)
  2821.      Create an output variable from a shell variable.  Make `AC_OUTPUT'
  2822.      substitute the variable VARIABLE into output files (typically one
  2823.      or more `Makefile's).  This means that `AC_OUTPUT' will replace
  2824.      instances of `@VARIABLE@' in input files with the value that the
  2825.      shell variable VARIABLE has when `AC_OUTPUT' is called.  The value
  2826.      of VARIABLE should not contain literal newlines.
  2827.  
  2828.  - Macro: AC_SUBST_FILE (VARIABLE)
  2829.      Another way to create an output variable from a shell variable.
  2830.      Make `AC_OUTPUT' insert (without substitutions) the contents of
  2831.      the file named by shell variable VARIABLE into output files.  This
  2832.      means that `AC_OUTPUT' will replace instances of `@VARIABLE@' in
  2833.      output files (such as `Makefile.in') with the contents of the file
  2834.      that the shell variable VARIABLE names when `AC_OUTPUT' is called.
  2835.      Set the variable to `/dev/null' for cases that do not have a file
  2836.      to insert.
  2837.  
  2838.      This macro is useful for inserting `Makefile' fragments containing
  2839.      special dependencies or other `make' directives for particular host
  2840.      or target types into `Makefile's.  For example, `configure.in'
  2841.      could contain:
  2842.  
  2843.           AC_SUBST_FILE(host_frag)dnl
  2844.           host_frag=$srcdir/conf/sun4.mh
  2845.  
  2846.      and then a `Makefile.in' could contain:
  2847.  
  2848.           @host_frag@
  2849.  
  2850. 
  2851. File: autoconf.info,  Node: Caching Results,  Next: Printing Messages,  Prev: Setting Output Variables,  Up: Results
  2852.  
  2853. Caching Results
  2854. ===============
  2855.  
  2856.    To avoid checking for the same features repeatedly in various
  2857. `configure' scripts (or repeated runs of one script), `configure' saves
  2858. the results of many of its checks in a "cache file".  If, when a
  2859. `configure' script runs, it finds a cache file, it reads from it the
  2860. results from previous runs and avoids rerunning those checks.  As a
  2861. result, `configure' can run much faster than if it had to perform all
  2862. of the checks every time.
  2863.  
  2864.  - Macro: AC_CACHE_VAL (CACHE-ID, COMMANDS-TO-SET-IT)
  2865.      Ensure that the results of the check identified by CACHE-ID are
  2866.      available.  If the results of the check were in the cache file
  2867.      that was read, and `configure' was not given the `--quiet' or
  2868.      `--silent' option, print a message saying that the result was
  2869.      cached; otherwise, run the shell commands COMMANDS-TO-SET-IT.
  2870.      Those commands should have no side effects except for setting the
  2871.      variable CACHE-ID.  In particular, they should not call
  2872.      `AC_DEFINE'; the code that follows the call to `AC_CACHE_VAL'
  2873.      should do that, based on the cached value.  Also, they should not
  2874.      print any messages, for example with `AC_MSG_CHECKING'; do that
  2875.      before calling `AC_CACHE_VAL', so the messages are printed
  2876.      regardless of whether the results of the check are retrieved from
  2877.      the cache or determined by running the shell commands.  If the
  2878.      shell commands are run to determine the value, the value will be
  2879.      saved in the cache file just before `configure' creates its output
  2880.      files.  *Note Cache Variable Names::, for how to choose the name
  2881.      of the CACHE-ID variable.
  2882.  
  2883.  - Macro: AC_CACHE_CHECK (MESSAGE, CACHE-ID, COMMANDS)
  2884.      A wrapper for `AC_CACHE_VAL' that takes care of printing the
  2885.      messages.  This macro provides a convenient shorthand for the most
  2886.      common way to use these macros.  It calls `AC_MSG_CHECKING' for
  2887.      MESSAGE, then `AC_CACHE_VAL' with the CACHE-ID and COMMANDS
  2888.      arguments, and `AC_MSG_RESULT' with CACHE-ID.
  2889.  
  2890. * Menu:
  2891.  
  2892. * Cache Variable Names::        Shell variables used in caches.
  2893. * Cache Files::                Files `configure' uses for caching.
  2894.  
  2895. 
  2896. File: autoconf.info,  Node: Cache Variable Names,  Next: Cache Files,  Up: Caching Results
  2897.  
  2898. Cache Variable Names
  2899. --------------------
  2900.  
  2901.    The names of cache variables should have the following format:
  2902.  
  2903.      PACKAGE-PREFIX_cv_VALUE-TYPE_SPECIFIC-VALUE[_ADDITIONAL-OPTIONS]
  2904.  
  2905. for example, `ac_cv_header_stat_broken' or
  2906. `ac_cv_prog_gcc_traditional'.  The parts of the variable name are:
  2907.  
  2908. PACKAGE-PREFIX
  2909.      An abbreviation for your package or organization; the same prefix
  2910.      you begin local Autoconf macros with, except lowercase by
  2911.      convention.  For cache values used by the distributed Autoconf
  2912.      macros, this value is `ac'.
  2913.  
  2914. `_cv_'
  2915.      Indicates that this shell variable is a cache value.
  2916.  
  2917. VALUE-TYPE
  2918.      A convention for classifying cache values, to produce a rational
  2919.      naming system.  The values used in Autoconf are listed in *Note
  2920.      Macro Names::.
  2921.  
  2922. SPECIFIC-VALUE
  2923.      Which member of the class of cache values this test applies to.
  2924.      For example, which function (`alloca'), program (`gcc'), or output
  2925.      variable (`INSTALL').
  2926.  
  2927. ADDITIONAL-OPTIONS
  2928.      Any particular behavior of the specific member that this test
  2929.      applies to.  For example, `broken' or `set'.  This part of the
  2930.      name may be omitted if it does not apply.
  2931.  
  2932.    Like their names, the values that may be assigned to cache variables
  2933. have a few restrictions.  The values may not contain single quotes or
  2934. curly braces.  Usually, their values will be boolean (`yes' or `no') or
  2935. the names of files or functions; so this is not an important
  2936. restriction.
  2937.  
  2938. 
  2939. File: autoconf.info,  Node: Cache Files,  Prev: Cache Variable Names,  Up: Caching Results
  2940.  
  2941. Cache Files
  2942. -----------
  2943.  
  2944.    A cache file is a shell script that caches the results of configure
  2945. tests run on one system so they can be shared between configure scripts
  2946. and configure runs.  It is not useful on other systems.  If its contents
  2947. are invalid for some reason, the user may delete or edit it.
  2948.  
  2949.    By default, configure uses `./config.cache' as the cache file,
  2950. creating it if it does not exist already.  `configure' accepts the
  2951. `--cache-file=FILE' option to use a different cache file; that is what
  2952. `configure' does when it calls `configure' scripts in subdirectories,
  2953. so they share the cache.  *Note Subdirectories::, for information on
  2954. configuring subdirectories with the `AC_CONFIG_SUBDIRS' macro.
  2955.  
  2956.    Giving `--cache-file=/dev/null' disables caching, for debugging
  2957. `configure'.  `config.status' only pays attention to the cache file if
  2958. it is given the `--recheck' option, which makes it rerun `configure'.
  2959. If you are anticipating a long debugging period, you can also disable
  2960. cache loading and saving for a `configure' script by redefining the
  2961. cache macros at the start of `configure.in':
  2962.  
  2963.      define([AC_CACHE_LOAD], )dnl
  2964.      define([AC_CACHE_SAVE], )dnl
  2965.      AC_INIT(whatever)
  2966.       ... rest of configure.in ...
  2967.  
  2968.    It is wrong to try to distribute cache files for particular system
  2969. types.  There is too much room for error in doing that, and too much
  2970. administrative overhead in maintaining them.  For any features that
  2971. can't be guessed automatically, use the standard method of the canonical
  2972. system type and linking files (*note Manual Configuration::.).
  2973.  
  2974.    The cache file on a particular system will gradually accumulate
  2975. whenever someone runs a `configure' script; it will be initially
  2976. nonexistent.  Running `configure' merges the new cache results with the
  2977. existing cache file.  The site initialization script can specify a
  2978. site-wide cache file to use instead of the default, to make it work
  2979. transparently, as long as the same C compiler is used every time (*note
  2980. Site Defaults::.).
  2981.  
  2982. 
  2983. File: autoconf.info,  Node: Printing Messages,  Prev: Caching Results,  Up: Results
  2984.  
  2985. Printing Messages
  2986. =================
  2987.  
  2988.    `configure' scripts need to give users running them several kinds of
  2989. information.  The following macros print messages in ways appropriate
  2990. for each kind.  The arguments to all of them get enclosed in shell
  2991. double quotes, so the shell performs variable and backquote substitution
  2992. on them.
  2993.  
  2994.    These macros are all wrappers around the `echo' shell command.
  2995. `configure' scripts should rarely need to run `echo' directly to print
  2996. messages for the user.  Using these macros makes it easy to change how
  2997. and when each kind of message is printed; such changes need only be
  2998. made to the macro definitions, and all of the callers change
  2999. automatically.
  3000.  
  3001.  - Macro: AC_MSG_CHECKING (FEATURE-DESCRIPTION)
  3002.      Notify the user that `configure' is checking for a particular
  3003.      feature.  This macro prints a message that starts with `checking '
  3004.      and ends with `...' and no newline.  It must be followed by a call
  3005.      to `AC_MSG_RESULT' to print the result of the check and the
  3006.      newline.  The FEATURE-DESCRIPTION should be something like
  3007.      `whether the Fortran compiler accepts C++ comments' or `for c89'.
  3008.  
  3009.      This macro prints nothing if `configure' is run with the `--quiet'
  3010.      or `--silent' option.
  3011.  
  3012.  - Macro: AC_MSG_RESULT (RESULT-DESCRIPTION)
  3013.      Notify the user of the results of a check.  RESULT-DESCRIPTION is
  3014.      almost always the value of the cache variable for the check,
  3015.      typically `yes', `no', or a file name.  This macro should follow a
  3016.      call to `AC_MSG_CHECKING', and the RESULT-DESCRIPTION should be
  3017.      the completion of the message printed by the call to
  3018.      `AC_MSG_CHECKING'.
  3019.  
  3020.      This macro prints nothing if `configure' is run with the `--quiet'
  3021.      or `--silent' option.
  3022.  
  3023.  - Macro: AC_MSG_ERROR (ERROR-DESCRIPTION)
  3024.      Notify the user of an error that prevents `configure' from
  3025.      completing.  This macro prints an error message on the standard
  3026.      error output and exits `configure' with a nonzero status.
  3027.      ERROR-DESCRIPTION should be something like `invalid value $HOME
  3028.      for \$HOME'.
  3029.  
  3030.  - Macro: AC_MSG_WARN (PROBLEM-DESCRIPTION)
  3031.      Notify the `configure' user of a possible problem.  This macro
  3032.      prints the message on the standard error output; `configure'
  3033.      continues running afterward, so macros that call `AC_MSG_WARN'
  3034.      should provide a default (back-up) behavior for the situations
  3035.      they warn about.  PROBLEM-DESCRIPTION should be something like `ln
  3036.      -s seems to make hard links'.
  3037.  
  3038.    The following two macros are an obsolete alternative to
  3039. `AC_MSG_CHECKING' and `AC_MSG_RESULT'.
  3040.  
  3041.  - Macro: AC_CHECKING (FEATURE-DESCRIPTION)
  3042.      This macro is similar to `AC_MSG_CHECKING', except that it prints a
  3043.      newline after the FEATURE-DESCRIPTION.  It is useful mainly to
  3044.      print a general description of the overall purpose of a group of
  3045.      feature checks, e.g.,
  3046.  
  3047.           AC_CHECKING(if stack overflow is detectable)
  3048.  
  3049.  - Macro: AC_VERBOSE (RESULT-DESCRIPTION)
  3050.      This macro is similar to `AC_MSG_RESULT', except that it is meant
  3051.      to follow a call to `AC_CHECKING' instead of `AC_MSG_CHECKING'; it
  3052.      starts the message it prints with a tab.  It is considered
  3053.      obsolete.
  3054.  
  3055. 
  3056. File: autoconf.info,  Node: Writing Macros,  Next: Manual Configuration,  Prev: Results,  Up: Top
  3057.  
  3058. Writing Macros
  3059. **************
  3060.  
  3061.    When you write a feature test that could be applicable to more than
  3062. one software package, the best thing to do is encapsulate it in a new
  3063. macro.  Here are some instructions and guidelines for writing Autoconf
  3064. macros.
  3065.  
  3066. * Menu:
  3067.  
  3068. * Macro Definitions::        Basic format of an Autoconf macro.
  3069. * Macro Names::                 What to call your new macros.
  3070. * Quoting::            Protecting macros from unwanted expansion.
  3071. * Dependencies Between Macros::    What to do when macros depend on other macros.
  3072.  
  3073. 
  3074. File: autoconf.info,  Node: Macro Definitions,  Next: Macro Names,  Up: Writing Macros
  3075.  
  3076. Macro Definitions
  3077. =================
  3078.  
  3079.    Autoconf macros are defined using the `AC_DEFUN' macro, which is
  3080. similar to the `m4' builtin `define' macro.  In addition to defining a
  3081. macro, `AC_DEFUN' adds to it some code which is used to constrain the
  3082. order in which macros are called (*note Prerequisite Macros::.).
  3083.  
  3084.    An Autoconf macro definition looks like this:
  3085.  
  3086.      AC_DEFUN(MACRO-NAME, [MACRO-BODY])
  3087.  
  3088. The square brackets here do not indicate optional text: they should
  3089. literally be present in the macro definition to avoid macro expansion
  3090. problems (*note Quoting::.).  You can refer to any arguments passed to
  3091. the macro as `$1', `$2', etc.
  3092.  
  3093.    To introduce comments in `m4', use the `m4' builtin `dnl'; it causes
  3094. `m4' to discard the text through the next newline.  It is not needed
  3095. between macro definitions in `acsite.m4' and `aclocal.m4', because all
  3096. output is discarded until `AC_INIT' is called.
  3097.  
  3098.    *Note How to define new macros: (m4.info)Definitions, for more
  3099. complete information on writing `m4' macros.
  3100.  
  3101. 
  3102. File: autoconf.info,  Node: Macro Names,  Next: Quoting,  Prev: Macro Definitions,  Up: Writing Macros
  3103.  
  3104. Macro Names
  3105. ===========
  3106.  
  3107.    All of the Autoconf macros have all-uppercase names starting with
  3108. `AC_' to prevent them from accidentally conflicting with other text.
  3109. All shell variables that they use for internal purposes have
  3110. mostly-lowercase names starting with `ac_'.  To ensure that your macros
  3111. don't conflict with present or future Autoconf macros, you should
  3112. prefix your own macro names and any shell variables they use with some
  3113. other sequence.  Possibilities include your initials, or an abbreviation
  3114. for the name of your organization or software package.
  3115.  
  3116.    Most of the Autoconf macros' names follow a structured naming
  3117. convention that indicates the kind of feature check by the name.  The
  3118. macro names consist of several words, separated by underscores, going
  3119. from most general to most specific.   The names of their cache
  3120. variables use the same convention (*note Cache Variable Names::., for
  3121. more information on them).
  3122.  
  3123.    The first word of the name after `AC_' usually tells the category of
  3124. feature being tested.  Here are the categories used in Autoconf for
  3125. specific test macros, the kind of macro that you are more likely to
  3126. write.  They are also used for cache variables, in all-lowercase.  Use
  3127. them where applicable; where they're not, invent your own categories.
  3128.  
  3129. `C'
  3130.      C language builtin features.
  3131.  
  3132. `DECL'
  3133.      Declarations of C variables in header files.
  3134.  
  3135. `FUNC'
  3136.      Functions in libraries.
  3137.  
  3138. `GROUP'
  3139.      UNIX group owners of files.
  3140.  
  3141. `HEADER'
  3142.      Header files.
  3143.  
  3144. `LIB'
  3145.      C libraries.
  3146.  
  3147. `PATH'
  3148.      The full path names to files, including programs.
  3149.  
  3150. `PROG'
  3151.      The base names of programs.
  3152.  
  3153. `STRUCT'
  3154.      Definitions of C structures in header files.
  3155.  
  3156. `SYS'
  3157.      Operating system features.
  3158.  
  3159. `TYPE'
  3160.      C builtin or declared types.
  3161.  
  3162. `VAR'
  3163.      C variables in libraries.
  3164.  
  3165.    After the category comes the name of the particular feature being
  3166. tested.  Any further words in the macro name indicate particular aspects
  3167. of the feature.  For example, `AC_FUNC_UTIME_NULL' checks the behavior
  3168. of the `utime' function when called with a `NULL' pointer.
  3169.  
  3170.    A macro that is an internal subroutine of another macro should have a
  3171. name that starts with the name of that other macro, followed by one or
  3172. more words saying what the internal macro does.  For example,
  3173. `AC_PATH_X' has internal macros `AC_PATH_X_XMKMF' and
  3174. `AC_PATH_X_DIRECT'.
  3175.  
  3176. 
  3177. File: autoconf.info,  Node: Quoting,  Next: Dependencies Between Macros,  Prev: Macro Names,  Up: Writing Macros
  3178.  
  3179. Quoting
  3180. =======
  3181.  
  3182.    Macros that are called by other macros are evaluated by `m4' several
  3183. times; each evaluation might require another layer of quotes to prevent
  3184. unwanted expansions of macros or `m4' builtins, such as `define' and
  3185. `$1'.  Quotes are also required around macro arguments that contain
  3186. commas, since commas separate the arguments from each other.  It's a
  3187. good idea to quote any macro arguments that contain newlines or calls
  3188. to other macros, as well.
  3189.  
  3190.    Autoconf changes the `m4' quote characters from the default ``' and
  3191. `'' to `[' and `]', because many of the macros use ``' and `'',
  3192. mismatched.  However, in a few places the macros need to use brackets
  3193. (usually in C program text or regular expressions).  In those places,
  3194. they use the `m4' builtin command `changequote' to temporarily change
  3195. the quote characters to `<<' and `>>'.  (Sometimes, if they don't need
  3196. to quote anything, they disable quoting entirely instead by setting the
  3197. quote characters to empty strings.)  Here is an example:
  3198.  
  3199.      AC_TRY_LINK(
  3200.      changequote(<<, >>)dnl
  3201.      <<#include <time.h>
  3202.      #ifndef tzname /* For SGI.  */
  3203.      extern char *tzname[]; /* RS6000 and others reject char **tzname.  */
  3204.      #endif>>,
  3205.      changequote([, ])dnl
  3206.      [atoi(*tzname);], ac_cv_var_tzname=yes, ac_cv_var_tzname=no)
  3207.  
  3208.    When you create a `configure' script using newly written macros,
  3209. examine it carefully to check whether you need to add more quotes in
  3210. your macros.  If one or more words have disappeared in the `m4' output,
  3211. you need more quotes.  When in doubt, quote.
  3212.  
  3213.    However, it's also possible to put on too many layers of quotes.  If
  3214. this happens, the resulting `configure' script will contain unexpanded
  3215. macros.  The `autoconf' program checks for this problem by doing `grep
  3216. AC_ configure'.
  3217.  
  3218. 
  3219. File: autoconf.info,  Node: Dependencies Between Macros,  Prev: Quoting,  Up: Writing Macros
  3220.  
  3221. Dependencies Between Macros
  3222. ===========================
  3223.  
  3224.    Some Autoconf macros depend on other macros having been called first
  3225. in order to work correctly.  Autoconf provides a way to ensure that
  3226. certain macros are called if needed and a way to warn the user if
  3227. macros are called in an order that might cause incorrect operation.
  3228.  
  3229. * Menu:
  3230.  
  3231. * Prerequisite Macros::        Ensuring required information.
  3232. * Suggested Ordering::        Warning about possible ordering problems.
  3233. * Obsolete Macros::             Warning about old ways of doing things.
  3234.  
  3235. 
  3236. File: autoconf.info,  Node: Prerequisite Macros,  Next: Suggested Ordering,  Up: Dependencies Between Macros
  3237.  
  3238. Prerequisite Macros
  3239. -------------------
  3240.  
  3241.    A macro that you write might need to use values that have previously
  3242. been computed by other macros.  For example, `AC_DECL_YYTEXT' examines
  3243. the output of `flex' or `lex', so it depends on `AC_PROG_LEX' having
  3244. been called first to set the shell variable `LEX'.
  3245.  
  3246.    Rather than forcing the user of the macros to keep track of the
  3247. dependencies between them, you can use the `AC_REQUIRE' macro to do it
  3248. automatically.  `AC_REQUIRE' can ensure that a macro is only called if
  3249. it is needed, and only called once.
  3250.  
  3251.  - Macro: AC_REQUIRE (MACRO-NAME)
  3252.      If the `m4' macro MACRO-NAME has not already been called, call it
  3253.      (without any arguments).  Make sure to quote MACRO-NAME with
  3254.      square brackets.  MACRO-NAME must have been defined using
  3255.      `AC_DEFUN' or else contain a call to `AC_PROVIDE' to indicate that
  3256.      it has been called.
  3257.  
  3258.    An alternative to using `AC_DEFUN' is to use `define' and call
  3259. `AC_PROVIDE'.  Because this technique does not prevent nested messages,
  3260. it is considered obsolete.
  3261.  
  3262.  - Macro: AC_PROVIDE (THIS-MACRO-NAME)
  3263.      Record the fact that THIS-MACRO-NAME has been called.
  3264.      THIS-MACRO-NAME should be the name of the macro that is calling
  3265.      `AC_PROVIDE'.  An easy way to get it is from the `m4' builtin
  3266.      variable `$0', like this:
  3267.  
  3268.           AC_PROVIDE([$0])
  3269.  
  3270. 
  3271. File: autoconf.info,  Node: Suggested Ordering,  Next: Obsolete Macros,  Prev: Prerequisite Macros,  Up: Dependencies Between Macros
  3272.  
  3273. Suggested Ordering
  3274. ------------------
  3275.  
  3276.    Some macros should be run before another macro if both are called,
  3277. but neither *requires* that the other be called.  For example, a macro
  3278. that changes the behavior of the C compiler should be called before any
  3279. macros that run the C compiler.  Many of these dependencies are noted in
  3280. the documentation.
  3281.  
  3282.    Autoconf provides the `AC_BEFORE' macro to warn users when macros
  3283. with this kind of dependency appear out of order in a `configure.in'
  3284. file.  The warning occurs when creating `configure' from
  3285. `configure.in', not when running `configure'.  For example,
  3286. `AC_PROG_CPP' checks whether the C compiler can run the C preprocessor
  3287. when given the `-E' option.  It should therefore be called after any
  3288. macros that change which C compiler is being used, such as
  3289. `AC_PROG_CC'.  So `AC_PROG_CC' contains:
  3290.  
  3291.      AC_BEFORE([$0], [AC_PROG_CPP])dnl
  3292.  
  3293. This warns the user if a call to `AC_PROG_CPP' has already occurred
  3294. when `AC_PROG_CC' is called.
  3295.  
  3296.  - Macro: AC_BEFORE (THIS-MACRO-NAME, CALLED-MACRO-NAME)
  3297.      Make `m4' print a warning message on the standard error output if
  3298.      CALLED-MACRO-NAME has already been called.  THIS-MACRO-NAME should
  3299.      be the name of the macro that is calling `AC_BEFORE'.  The macro
  3300.      CALLED-MACRO-NAME must have been defined using `AC_DEFUN' or else
  3301.      contain a call to `AC_PROVIDE' to indicate that it has been called.
  3302.  
  3303. 
  3304. File: autoconf.info,  Node: Obsolete Macros,  Prev: Suggested Ordering,  Up: Dependencies Between Macros
  3305.  
  3306. Obsolete Macros
  3307. ---------------
  3308.  
  3309.    Configuration and portability technology has evolved over the years.
  3310. Often better ways of solving a particular problem are developed, or
  3311. ad-hoc approaches are systematized.  This process has occurred in many
  3312. parts of Autoconf.  One result is that some of the macros are now
  3313. considered "obsolete"; they still work, but are no longer considered
  3314. the best thing to do.  Autoconf provides the `AC_OBSOLETE' macro to
  3315. warn users producing `configure' scripts when they use obsolete macros,
  3316. to encourage them to modernize.  A sample call is:
  3317.  
  3318.      AC_OBSOLETE([$0], [; use AC_CHECK_HEADERS(unistd.h) instead])dnl
  3319.  
  3320.  - Macro: AC_OBSOLETE (THIS-MACRO-NAME [, SUGGESTION])
  3321.      Make `m4' print a message on the standard error output warning that
  3322.      THIS-MACRO-NAME is obsolete, and giving the file and line number
  3323.      where it was called.  THIS-MACRO-NAME should be the name of the
  3324.      macro that is calling `AC_OBSOLETE'.  If SUGGESTION is given, it
  3325.      is printed at the end of the warning message; for example, it can
  3326.      be a suggestion for what to use instead of THIS-MACRO-NAME.
  3327.  
  3328. 
  3329. File: autoconf.info,  Node: Manual Configuration,  Next: Site Configuration,  Prev: Writing Macros,  Up: Top
  3330.  
  3331. Manual Configuration
  3332. ********************
  3333.  
  3334.    A few kinds of features can't be guessed automatically by running
  3335. test programs.  For example, the details of the object file format, or
  3336. special options that need to be passed to the compiler or linker.  You
  3337. can check for such features using ad-hoc means, such as having
  3338. `configure' check the output of the `uname' program, or looking for
  3339. libraries that are unique to particular systems.  However, Autoconf
  3340. provides a uniform method for handling unguessable features.
  3341.  
  3342. * Menu:
  3343.  
  3344. * Specifying Names::            Specifying the system type.
  3345. * Canonicalizing::              Getting the canonical system type.
  3346. * System Type Variables::       Variables containing the system type.
  3347. * Using System Type::           What to do with the system type.
  3348.  
  3349. 
  3350. File: autoconf.info,  Node: Specifying Names,  Next: Canonicalizing,  Up: Manual Configuration
  3351.  
  3352. Specifying the System Type
  3353. ==========================
  3354.  
  3355.    Like other GNU `configure' scripts, Autoconf-generated `configure'
  3356. scripts can make decisions based on a canonical name for the system
  3357. type, which has the form:
  3358.  
  3359.      CPU-COMPANY-SYSTEM
  3360.  
  3361.    `configure' can usually guess the canonical name for the type of
  3362. system it's running on.  To do so it runs a script called
  3363. `config.guess', which derives the name using the `uname' command or
  3364. symbols predefined by the C preprocessor.
  3365.  
  3366.    Alternately, the user can specify the system type with command line
  3367. arguments to `configure'.  Doing so is necessary when cross-compiling.
  3368. In the most complex case of cross-compiling, three system types are
  3369. involved.  The options to specify them are:
  3370.  
  3371. `--build=BUILD-TYPE'
  3372.      the type of system on which the package is being configured and
  3373.      compiled (rarely needed);
  3374.  
  3375. `--host=HOST-TYPE'
  3376.      the type of system on which the package will run;
  3377.  
  3378. `--target=TARGET-TYPE'
  3379.      the type of system for which any compiler tools in the package will
  3380.      produce code.
  3381.  
  3382. If the user gives `configure' a non-option argument, it is used as the
  3383. default for the host, target, and build system types if the user does
  3384. not specify them explicitly with options.  The target and build types
  3385. default to the host type if it is given and they are not.  If you are
  3386. cross-compiling, you still have to specify the names of the cross-tools
  3387. you use, in particular the C compiler, on the `configure' command line,
  3388. e.g.,
  3389.  
  3390.      CC=m68k-coff-gcc configure --target=m68k-coff
  3391.  
  3392.    `configure' recognizes short aliases for many system types; for
  3393. example, `decstation' can be given on the command line instead of
  3394. `mips-dec-ultrix4.2'.  `configure' runs a script called `config.sub' to
  3395. canonicalize system type aliases.
  3396.  
  3397. 
  3398. File: autoconf.info,  Node: Canonicalizing,  Next: System Type Variables,  Prev: Specifying Names,  Up: Manual Configuration
  3399.  
  3400. Getting the Canonical System Type
  3401. =================================
  3402.  
  3403.    The following macros make the system type available to `configure'
  3404. scripts.  They run the shell script `config.guess' to determine any
  3405. values for the host, target, and build types that they need and the user
  3406. did not specify on the command line.  They run `config.sub' to
  3407. canonicalize any aliases the user gave.  If you use these macros, you
  3408. must distribute those two shell scripts along with your source code.
  3409. *Note Output::, for information about the `AC_CONFIG_AUX_DIR' macro
  3410. which you can use to control which directory `configure' looks for
  3411. those scripts in.  If you do not use either of these macros,
  3412. `configure' ignores any `--host', `--target', and `--build' options
  3413. given to it.
  3414.  
  3415.  - Macro: AC_CANONICAL_SYSTEM
  3416.      Determine the system type and set output variables to the names of
  3417.      the canonical system types.  *Note System Type Variables::, for
  3418.      details about the variables this macro sets.
  3419.  
  3420.  - Macro: AC_CANONICAL_HOST
  3421.      Perform only the subset of `AC_CANONICAL_SYSTEM' relevant to the
  3422.      host type.  This is all that is needed for programs that are not
  3423.      part of a compiler toolchain.
  3424.  
  3425. 
  3426. File: autoconf.info,  Node: System Type Variables,  Next: Using System Type,  Prev: Canonicalizing,  Up: Manual Configuration
  3427.  
  3428. System Type Variables
  3429. =====================
  3430.  
  3431.    After calling `AC_CANONICAL_SYSTEM', the following output variables
  3432. contain the system type information.  After `AC_CANONICAL_HOST', only
  3433. the `host' variables below are set.
  3434.  
  3435. ``build', `host', `target''
  3436.      the canonical system names;
  3437.  
  3438. ``build_alias', `host_alias', `target_alias''
  3439.      the names the user specified, or the canonical names if
  3440.      `config.guess' was used;
  3441.  
  3442. ``build_cpu', `build_vendor', `build_os''
  3443. ``host_cpu', `host_vendor', `host_os''
  3444. ``target_cpu', `target_vendor', `target_os''
  3445.      the individual parts of the canonical names (for convenience).
  3446.  
  3447. 
  3448. File: autoconf.info,  Node: Using System Type,  Prev: System Type Variables,  Up: Manual Configuration
  3449.  
  3450. Using the System Type
  3451. =====================
  3452.  
  3453.    How do you use a canonical system type?  Usually, you use it in one
  3454. or more `case' statements in `configure.in' to select system-specific C
  3455. files.  Then link those files, which have names based on the system
  3456. name, to generic names, such as `host.h' or `target.c'.  The `case'
  3457. statement patterns can use shell wildcards to group several cases
  3458. together, like in this fragment:
  3459.  
  3460.      case "$target" in
  3461.      i386-*-mach* | i386-*-gnu*) obj_format=aout emulation=mach bfd_gas=yes ;;
  3462.      i960-*-bout) obj_format=bout ;;
  3463.      esac
  3464.  
  3465.  - Macro: AC_LINK_FILES (SOURCE..., DEST...)
  3466.      Make `AC_OUTPUT' link each of the existing files SOURCE to the
  3467.      corresponding link name DEST.  Makes a symbolic link if possible,
  3468.      otherwise a hard link.  The DEST and SOURCE names should be
  3469.      relative to the top level source or build directory.
  3470.  
  3471.      For example, this call:
  3472.  
  3473.           AC_LINK_FILES(config/${machine}.h config/${obj_format}.h, host.h object.h)
  3474.  
  3475.      creates in the current directory `host.h', which is a link to
  3476.      `SRCDIR/config/${machine}.h', and `object.h', which is a link to
  3477.      `SRCDIR/config/${obj_format}.h'.
  3478.  
  3479.    You can also use the host system type to find cross-compilation
  3480. tools.  *Note Generic Programs::, for information about the
  3481. `AC_CHECK_TOOL' macro which does that.
  3482.  
  3483. 
  3484. File: autoconf.info,  Node: Site Configuration,  Next: Invoking configure,  Prev: Manual Configuration,  Up: Top
  3485.  
  3486. Site Configuration
  3487. ******************
  3488.  
  3489.    `configure' scripts support several kinds of local configuration
  3490. decisions.  There are ways for users to specify where external software
  3491. packages are, include or exclude optional features, install programs
  3492. under modified names, and set default values for `configure' options.
  3493.  
  3494. * Menu:
  3495.  
  3496. * External Software::           Working with other optional software.
  3497. * Package Options::             Selecting optional features.
  3498. * Site Details::                Configuring site details.
  3499. * Transforming Names::          Changing program names when installing.
  3500. * Site Defaults::               Giving `configure' local defaults.
  3501.  
  3502. 
  3503. File: autoconf.info,  Node: External Software,  Next: Package Options,  Up: Site Configuration
  3504.  
  3505. Working With External Software
  3506. ==============================
  3507.  
  3508.    Some packages require, or can optionally use, other software packages
  3509. which are already installed.  The user can give `configure' command
  3510. line options to specify which such external software to use.  The
  3511. options have one of these forms:
  3512.  
  3513.      --with-PACKAGE[=ARG]
  3514.      --without-PACKAGE
  3515.  
  3516.    For example, `--with-gnu-ld' means work with the GNU linker instead
  3517. of some other linker.  `--with-x' means work with The X Window System.
  3518.  
  3519.    The user can give an argument by following the package name with `='
  3520. and the argument.  Giving an argument of `no' is for packages that are
  3521. used by default; it says to *not* use the package.  An argument that is
  3522. neither `yes' nor `no' could include a name or number of a version of
  3523. the other package, to specify more precisely which other package this
  3524. program is supposed to work with.  If no argument is given, it defaults
  3525. to `yes'.  `--without-PACKAGE' is equivalent to `--with-PACKAGE=no'.
  3526.  
  3527.    For each external software package that may be used, `configure.in'
  3528. should call `AC_ARG_WITH' to detect whether the `configure' user asked
  3529. to use it.  Whether each package is used or not by default, and which
  3530. arguments are valid, is up to you.
  3531.  
  3532.  - Macro: AC_ARG_WITH (PACKAGE, HELP-STRING [, ACTION-IF-GIVEN [,
  3533.           ACTION-IF-NOT-GIVEN]])
  3534.      If the user gave `configure' the option `--with-PACKAGE' or
  3535.      `--without-PACKAGE', run shell commands ACTION-IF-GIVEN.  If
  3536.      neither option was given, run shell commands ACTION-IF-NOT-GIVEN.
  3537.      The name PACKAGE indicates another software package that this
  3538.      program should work with.  It should consist only of alphanumeric
  3539.      characters and dashes.
  3540.  
  3541.      The option's argument is available to the shell commands
  3542.      ACTION-IF-GIVEN in the shell variable `withval', which is actually
  3543.      just the value of the shell variable `with_PACKAGE', with any `-'
  3544.      characters changed into `_'.  You may use that variable instead,
  3545.      if you wish.
  3546.  
  3547.      The argument HELP-STRING is a description of the option which
  3548.      looks like this:
  3549.             --with-readline         support fancy command line editing
  3550.  
  3551.      HELP-STRING may be more than one line long, if more detail is
  3552.      needed.  Just make sure the columns line up in `configure --help'.
  3553.      Avoid tabs in the help string.  You'll need to enclose it in `['
  3554.      and `]' in order to produce the leading spaces.
  3555.  
  3556.  - Macro: AC_WITH (PACKAGE, ACTION-IF-GIVEN [, ACTION-IF-NOT-GIVEN])
  3557.      This is an obsolete version of `AC_ARG_WITH' that does not support
  3558.      providing a help string.
  3559.  
  3560. 
  3561. File: autoconf.info,  Node: Package Options,  Next: Site Details,  Prev: External Software,  Up: Site Configuration
  3562.  
  3563. Choosing Package Options
  3564. ========================
  3565.  
  3566.    If a software package has optional compile-time features, the user
  3567. can give `configure' command line options to specify whether to compile
  3568. them.  The options have one of these forms:
  3569.  
  3570.      --enable-FEATURE[=ARG]
  3571.      --disable-FEATURE
  3572.  
  3573.    These options allow users to choose which optional features to build
  3574. and install.  `--enable-FEATURE' options should never make a feature
  3575. behave differently or cause one feature to replace another.  They
  3576. should only cause parts of the program to be built rather than left out.
  3577.  
  3578.    The user can give an argument by following the feature name with `='
  3579. and the argument.  Giving an argument of `no' requests that the feature
  3580. *not* be made available.  A feature with an argument looks like
  3581. `--enable-debug=stabs'.  If no argument is given, it defaults to `yes'.
  3582. `--disable-FEATURE' is equivalent to `--enable-FEATURE=no'.
  3583.  
  3584.    For each optional feature, `configure.in' should call
  3585. `AC_ARG_ENABLE' to detect whether the `configure' user asked to include
  3586. it.  Whether each feature is included or not by default, and which
  3587. arguments are valid, is up to you.
  3588.  
  3589.  - Macro: AC_ARG_ENABLE (FEATURE, HELP-STRING [, ACTION-IF-GIVEN [,
  3590.           ACTION-IF-NOT-GIVEN]])
  3591.      If the user gave `configure' the option `--enable-FEATURE' or
  3592.      `--disable-FEATURE', run shell commands ACTION-IF-GIVEN.  If
  3593.      neither option was given, run shell commands ACTION-IF-NOT-GIVEN.
  3594.      The name FEATURE indicates an optional user-level facility.  It
  3595.      should consist only of alphanumeric characters and dashes.
  3596.  
  3597.      The option's argument is available to the shell commands
  3598.      ACTION-IF-GIVEN in the shell variable `enableval', which is
  3599.      actually just the value of the shell variable `enable_PACKAGE',
  3600.      with any `-' characters changed into `_'.  You may use that
  3601.      variable instead, if you wish.  The HELP-STRING argument is like
  3602.      that of `AC_ARG_WITH' (*note External Software::.).
  3603.  
  3604.  - Macro: AC_ENABLE (FEATURE, ACTION-IF-GIVEN [, ACTION-IF-NOT-GIVEN])
  3605.      This is an obsolete version of `AC_ARG_ENABLE' that does not
  3606.      support providing a help string.
  3607.  
  3608. 
  3609. File: autoconf.info,  Node: Site Details,  Next: Transforming Names,  Prev: Package Options,  Up: Site Configuration
  3610.  
  3611. Configuring Site Details
  3612. ========================
  3613.  
  3614.    Some software packages require complex site-specific information.
  3615. Some examples are host names to use for certain services, company
  3616. names, and email addresses to contact.  Since some configuration
  3617. scripts generated by Metaconfig ask for such information interactively,
  3618. people sometimes wonder how to get that information in
  3619. Autoconf-generated configuration scripts, which aren't interactive.
  3620.  
  3621.    Such site configuration information should be put in a file that is
  3622. edited *only by users*, not by programs.  The location of the file can
  3623. either be based on the `prefix' variable, or be a standard location
  3624. such as the user's home directory.  It could even be specified by an
  3625. environment variable.  The programs should examine that file at run
  3626. time, rather than at compile time.  Run time configuration is more
  3627. convenient for users and makes the configuration process simpler than
  3628. getting the information while configuring.  *Note Variables for
  3629. Installation Directories: (standards)Directory Variables, for more
  3630. information on where to put data files.
  3631.  
  3632. 
  3633. File: autoconf.info,  Node: Transforming Names,  Next: Site Defaults,  Prev: Site Details,  Up: Site Configuration
  3634.  
  3635. Transforming Program Names When Installing
  3636. ==========================================
  3637.  
  3638.    Autoconf supports changing the names of programs when installing
  3639. them.  In order to use these transformations, `configure.in' must call
  3640. the macro `AC_ARG_PROGRAM'.
  3641.  
  3642.  - Macro: AC_ARG_PROGRAM
  3643.      Place in output variable `program_transform_name' a sequence of
  3644.      `sed' commands for changing the names of installed programs.
  3645.  
  3646.      If any of the options described below are given to `configure',
  3647.      program names are transformed accordingly.  Otherwise, if
  3648.      `AC_CANONICAL_SYSTEM' has been called and a `--target' value is
  3649.      given that differs from the host type (specified with `--host' or
  3650.      defaulted by `config.sub'), the target type followed by a dash is
  3651.      used as a prefix.  Otherwise, no program name transformation is
  3652.      done.
  3653.  
  3654. * Menu:
  3655.  
  3656. * Transformation Options::      `configure' options to transform names.
  3657. * Transformation Examples::     Sample uses of transforming names.
  3658. * Transformation Rules::        `Makefile' uses of transforming names.
  3659.  
  3660. 
  3661. File: autoconf.info,  Node: Transformation Options,  Next: Transformation Examples,  Up: Transforming Names
  3662.  
  3663. Transformation Options
  3664. ----------------------
  3665.  
  3666.    You can specify name transformations by giving `configure' these
  3667. command line options:
  3668.  
  3669. `--program-prefix=PREFIX'
  3670.      prepend PREFIX to the names;
  3671.  
  3672. `--program-suffix=SUFFIX'
  3673.      append SUFFIX to the names;
  3674.  
  3675. `--program-transform-name=EXPRESSION'
  3676.      perform `sed' substitution EXPRESSION on the names.
  3677.  
  3678. 
  3679. File: autoconf.info,  Node: Transformation Examples,  Next: Transformation Rules,  Prev: Transformation Options,  Up: Transforming Names
  3680.  
  3681. Transformation Examples
  3682. -----------------------
  3683.  
  3684.    These transformations are useful with programs that can be part of a
  3685. cross-compilation development environment.  For example, a
  3686. cross-assembler running on a Sun 4 configured with
  3687. `--target=i960-vxworks' is normally installed as `i960-vxworks-as',
  3688. rather than `as', which could be confused with a native Sun 4 assembler.
  3689.  
  3690.    You can force a program name to begin with `g', if you don't want
  3691. GNU programs installed on your system to shadow other programs with the
  3692. same name.  For example, if you configure GNU `diff' with
  3693. `--program-prefix=g', then when you run `make install' it is installed
  3694. as `/usr/local/bin/gdiff'.
  3695.  
  3696.    As a more sophisticated example, you could use
  3697.      --program-transform-name='s/^/g/; s/^gg/g/; s/^gless/less/'
  3698.  
  3699. to prepend `g' to most of the program names in a source tree, excepting
  3700. those like `gdb' that already have one and those like `less' and
  3701. `lesskey' that aren't GNU programs.  (That is assuming that you have a
  3702. source tree containing those programs that is set up to use this
  3703. feature.)
  3704.  
  3705.    One way to install multiple versions of some programs simultaneously
  3706. is to append a version number to the name of one or both.  For example,
  3707. if you want to keep Autoconf version 1 around for awhile, you can
  3708. configure Autoconf version 2 using `--program-suffix=2' to install the
  3709. programs as `/usr/local/bin/autoconf2', `/usr/local/bin/autoheader2',
  3710. etc.
  3711.  
  3712. 
  3713. File: autoconf.info,  Node: Transformation Rules,  Prev: Transformation Examples,  Up: Transforming Names
  3714.  
  3715. Transformation Rules
  3716. --------------------
  3717.  
  3718.    Here is how to use the variable `program_transform_name' in a
  3719. `Makefile.in':
  3720.  
  3721.      transform=@program_transform_name@
  3722.      install: all
  3723.              $(INSTALL_PROGRAM) myprog $(bindir)/`echo myprog|sed '$(transform)'`
  3724.      
  3725.      uninstall:
  3726.              rm -f $(bindir)/`echo myprog|sed '$(transform)'`
  3727.  
  3728. If you have more than one program to install, you can do it in a loop:
  3729.  
  3730.      PROGRAMS=cp ls rm
  3731.      install:
  3732.              for p in $(PROGRAMS); do \
  3733.                $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p|sed '$(transform)'`; \
  3734.              done
  3735.      
  3736.      uninstall:
  3737.              for p in $(PROGRAMS); do \
  3738.                rm -f $(bindir)/`echo $$p|sed '$(transform)'`; \
  3739.              done
  3740.  
  3741.    Whether to do the transformations on documentation files (Texinfo or
  3742. `man') is a tricky question; there seems to be no perfect answer, due
  3743. to the several reasons for name transforming.  Documentation is not
  3744. usually particular to a specific architecture, and Texinfo files do not
  3745. conflict with system documentation.  But they might conflict with
  3746. earlier versions of the same files, and `man' pages sometimes do
  3747. conflict with system documentation.  As a compromise, it is probably
  3748. best to do name transformations on `man' pages but not on Texinfo
  3749. manuals.
  3750.  
  3751. 
  3752. File: autoconf.info,  Node: Site Defaults,  Prev: Transforming Names,  Up: Site Configuration
  3753.  
  3754. Setting Site Defaults
  3755. =====================
  3756.  
  3757.    Autoconf-generated `configure' scripts allow your site to provide
  3758. default values for some configuration values.  You do this by creating
  3759. site- and system-wide initialization files.
  3760.  
  3761.    If the environment variable `CONFIG_SITE' is set, `configure' uses
  3762. its value as the name of a shell script to read.  Otherwise, it reads
  3763. the shell script `PREFIX/share/config.site' if it exists, then
  3764. `PREFIX/etc/config.site' if it exists.  Thus, settings in
  3765. machine-specific files override those in machine-independent ones in
  3766. case of conflict.
  3767.  
  3768.    Site files can be arbitrary shell scripts, but only certain kinds of
  3769. code are really appropriate to be in them.  Because `configure' reads
  3770. any cache file after it has read any site files, a site file can define
  3771. a default cache file to be shared between all Autoconf-generated
  3772. `configure' scripts run on that system.  If you set a default cache
  3773. file in a site file, it is a good idea to also set the output variable
  3774. `CC' in that site file, because the cache file is only valid for a
  3775. particular compiler, but many systems have several available.
  3776.  
  3777.    You can examine or override the value set by a command line option to
  3778. `configure' in a site file; options set shell variables that have the
  3779. same names as the options, with any dashes turned into underscores.
  3780. The exceptions are that `--without-' and `--disable-' options are like
  3781. giving the corresponding `--with-' or `--enable-' option and the value
  3782. `no'.  Thus, `--cache-file=localcache' sets the variable `cache_file'
  3783. to the value `localcache'; `--enable-warnings=no' or
  3784. `--disable-warnings' sets the variable `enable_warnings' to the value
  3785. `no'; `--prefix=/usr' sets the variable `prefix' to the value `/usr';
  3786. etc.
  3787.  
  3788.    Site files are also good places to set default values for other
  3789. output variables, such as `CFLAGS', if you need to give them non-default
  3790. values: anything you would normally do, repetitively, on the command
  3791. line.  If you use non-default values for PREFIX or EXEC_PREFIX
  3792. (wherever you locate the site file), you can set them in the site file
  3793. if you specify it with the `CONFIG_SITE' environment variable.
  3794.  
  3795.    You can set some cache values in the site file itself.  Doing this is
  3796. useful if you are cross-compiling, so it is impossible to check features
  3797. that require running a test program.  You could "prime the cache" by
  3798. setting those values correctly for that system in
  3799. `PREFIX/etc/config.site'.  To find out the names of the cache variables
  3800. you need to set, look for shell variables with `_cv_' in their names in
  3801. the affected `configure' scripts, or in the Autoconf `m4' source code
  3802. for those macros.
  3803.  
  3804.    The cache file is careful to not override any variables set in the
  3805. site files.  Similarly, you should not override command-line options in
  3806. the site files.  Your code should check that variables such as `prefix'
  3807. and `cache_file' have their default values (as set near the top of
  3808. `configure') before changing them.
  3809.  
  3810.    Here is a sample file `/usr/share/local/gnu/share/config.site'.  The
  3811. command `configure --prefix=/usr/share/local/gnu' would read this file
  3812. (if `CONFIG_SITE' is not set to a different file).
  3813.  
  3814.      # config.site for configure
  3815.      #
  3816.      # Default --prefix and --exec-prefix.
  3817.      test "$prefix" = NONE && prefix=/usr/share/local/gnu
  3818.      test "$exec_prefix" = NONE && exec_prefix=/usr/local/gnu
  3819.      #
  3820.      # Give Autoconf 2.x generated configure scripts a shared default
  3821.      # cache file for feature test results, architecture-specific.
  3822.      if test "$cache_file" = ./config.cache; then
  3823.        cache_file="$prefix/var/config.cache"
  3824.        # A cache file is only valid for one C compiler.
  3825.        CC=gcc
  3826.      fi
  3827.  
  3828. 
  3829. File: autoconf.info,  Node: Invoking configure,  Next: Invoking config.status,  Prev: Site Configuration,  Up: Top
  3830.  
  3831. Running `configure' Scripts
  3832. ***************************
  3833.  
  3834.    Below are instructions on how to configure a package that uses a
  3835. `configure' script, suitable for inclusion as an `INSTALL' file in the
  3836. package.  A plain-text version of `INSTALL' which you may use comes
  3837. with Autoconf.
  3838.  
  3839. * Menu:
  3840.  
  3841. * Basic Installation::          Instructions for typical cases.
  3842. * Compilers and Options::       Selecting compilers and optimization.
  3843. * Multiple Architectures::      Compiling for multiple architectures at once.
  3844. * Installation Names::          Installing in different directories.
  3845. * Optional Features::           Selecting optional features.
  3846. * System Type::                 Specifying the system type.
  3847. * Sharing Defaults::            Setting site-wide defaults for `configure'.
  3848. * Operation Controls::          Changing how `configure' runs.
  3849.  
  3850. 
  3851. File: autoconf.info,  Node: Basic Installation,  Next: Compilers and Options,  Up: Invoking configure
  3852.  
  3853. Basic Installation
  3854. ==================
  3855.  
  3856.    These are generic installation instructions.
  3857.  
  3858.    The `configure' shell script attempts to guess correct values for
  3859. various system-dependent variables used during compilation.  It uses
  3860. those values to create a `Makefile' in each directory of the package.
  3861. It may also create one or more `.h' files containing system-dependent
  3862. definitions.  Finally, it creates a shell script `config.status' that
  3863. you can run in the future to recreate the current configuration, a file
  3864. `config.cache' that saves the results of its tests to speed up
  3865. reconfiguring, and a file `config.log' containing compiler output
  3866. (useful mainly for debugging `configure').
  3867.  
  3868.    If you need to do unusual things to compile the package, please try
  3869. to figure out how `configure' could check whether to do them, and mail
  3870. diffs or instructions to the address given in the `README' so they can
  3871. be considered for the next release.  If at some point `config.cache'
  3872. contains results you don't want to keep, you may remove or edit it.
  3873.  
  3874.    The file `configure.in' is used to create `configure' by a program
  3875. called `autoconf'.  You only need `configure.in' if you want to change
  3876. it or regenerate `configure' using a newer version of `autoconf'.
  3877.  
  3878. The simplest way to compile this package is:
  3879.  
  3880.   1. `cd' to the directory containing the package's source code and type
  3881.      `./configure' to configure the package for your system.  If you're
  3882.      using `csh' on an old version of System V, you might need to type
  3883.      `sh ./configure' instead to prevent `csh' from trying to execute
  3884.      `configure' itself.
  3885.  
  3886.      Running `configure' takes awhile.  While running, it prints some
  3887.      messages telling which features it is checking for.
  3888.  
  3889.   2. Type `make' to compile the package.
  3890.  
  3891.   3. Optionally, type `make check' to run any self-tests that come with
  3892.      the package.
  3893.  
  3894.   4. Type `make install' to install the programs and any data files and
  3895.      documentation.
  3896.  
  3897.   5. You can remove the program binaries and object files from the
  3898.      source code directory by typing `make clean'.  To also remove the
  3899.      files that `configure' created (so you can compile the package for
  3900.      a different kind of computer), type `make distclean'.  There is
  3901.      also a `make maintainer-clean' target, but that is intended mainly
  3902.      for the package's developers.  If you use it, you may have to get
  3903.      all sorts of other programs in order to regenerate files that came
  3904.      with the distribution.
  3905.  
  3906. 
  3907. File: autoconf.info,  Node: Compilers and Options,  Next: Multiple Architectures,  Prev: Basic Installation,  Up: Invoking configure
  3908.  
  3909. Compilers and Options
  3910. =====================
  3911.  
  3912.    Some systems require unusual options for compilation or linking that
  3913. the `configure' script does not know about.  You can give `configure'
  3914. initial values for variables by setting them in the environment.  Using
  3915. a Bourne-compatible shell, you can do that on the command line like
  3916. this:
  3917.      CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
  3918.  
  3919. Or on systems that have the `env' program, you can do it like this:
  3920.      env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
  3921.  
  3922. 
  3923. File: autoconf.info,  Node: Multiple Architectures,  Next: Installation Names,  Prev: Compilers and Options,  Up: Invoking configure
  3924.  
  3925. Compiling For Multiple Architectures
  3926. ====================================
  3927.  
  3928.    You can compile the package for more than one kind of computer at the
  3929. same time, by placing the object files for each architecture in their
  3930. own directory.  To do this, you must use a version of `make' that
  3931. supports the `VPATH' variable, such as GNU `make'.  `cd' to the
  3932. directory where you want the object files and executables to go and run
  3933. the `configure' script.  `configure' automatically checks for the
  3934. source code in the directory that `configure' is in and in `..'.
  3935.  
  3936.    If you have to use a `make' that does not supports the `VPATH'
  3937. variable, you have to compile the package for one architecture at a time
  3938. in the source code directory.  After you have installed the package for
  3939. one architecture, use `make distclean' before reconfiguring for another
  3940. architecture.
  3941.  
  3942. 
  3943. File: autoconf.info,  Node: Installation Names,  Next: Optional Features,  Prev: Multiple Architectures,  Up: Invoking configure
  3944.  
  3945. Installation Names
  3946. ==================
  3947.  
  3948.    By default, `make install' will install the package's files in
  3949. `/usr/local/bin', `/usr/local/man', etc.  You can specify an
  3950. installation prefix other than `/usr/local' by giving `configure' the
  3951. option `--prefix=PATH'.
  3952.  
  3953.    You can specify separate installation prefixes for
  3954. architecture-specific files and architecture-independent files.  If you
  3955. give `configure' the option `--exec-prefix=PATH', the package will use
  3956. PATH as the prefix for installing programs and libraries.
  3957. Documentation and other data files will still use the regular prefix.
  3958.  
  3959.    In addition, if you use an unusual directory layout you can give
  3960. options like `--bindir=PATH' to specify different values for particular
  3961. kinds of files.  Run `configure --help' for a list of the directories
  3962. you can set and what kinds of files go in them.
  3963.  
  3964.    If the package supports it, you can cause programs to be installed
  3965. with an extra prefix or suffix on their names by giving `configure' the
  3966. option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
  3967.  
  3968. 
  3969. File: autoconf.info,  Node: Optional Features,  Next: System Type,  Prev: Installation Names,  Up: Invoking configure
  3970.  
  3971. Optional Features
  3972. =================
  3973.  
  3974.    Some packages pay attention to `--enable-FEATURE' options to
  3975. `configure', where FEATURE indicates an optional part of the package.
  3976. They may also pay attention to `--with-PACKAGE' options, where PACKAGE
  3977. is something like `gnu-as' or `x' (for the X Window System).  The
  3978. `README' should mention any `--enable-' and `--with-' options that the
  3979. package recognizes.
  3980.  
  3981.    For packages that use the X Window System, `configure' can usually
  3982. find the X include and library files automatically, but if it doesn't,
  3983. you can use the `configure' options `--x-includes=DIR' and
  3984. `--x-libraries=DIR' to specify their locations.
  3985.  
  3986. 
  3987. File: autoconf.info,  Node: System Type,  Next: Sharing Defaults,  Prev: Optional Features,  Up: Invoking configure
  3988.  
  3989. Specifying the System Type
  3990. ==========================
  3991.  
  3992.    There may be some features `configure' can not figure out
  3993. automatically, but needs to determine by the type of host the package
  3994. will run on.  Usually `configure' can figure that out, but if it prints
  3995. a message saying it can not guess the host type, give it the
  3996. `--host=TYPE' option.  TYPE can either be a short name for the system
  3997. type, such as `sun4', or a canonical name with three fields:
  3998.      CPU-COMPANY-SYSTEM
  3999.  
  4000. See the file `config.sub' for the possible values of each field.  If
  4001. `config.sub' isn't included in this package, then this package doesn't
  4002. need to know the host type.
  4003.  
  4004.    If you are building compiler tools for cross-compiling, you can also
  4005. use the `--target=TYPE' option to select the type of system they will
  4006. produce code for and the `--build=TYPE' option to select the type of
  4007. system on which you are compiling the package.
  4008.  
  4009. 
  4010. File: autoconf.info,  Node: Sharing Defaults,  Next: Operation Controls,  Prev: System Type,  Up: Invoking configure
  4011.  
  4012. Sharing Defaults
  4013. ================
  4014.  
  4015.    If you want to set default values for `configure' scripts to share,
  4016. you can create a site shell script called `config.site' that gives
  4017. default values for variables like `CC', `cache_file', and `prefix'.
  4018. `configure' looks for `PREFIX/share/config.site' if it exists, then
  4019. `PREFIX/etc/config.site' if it exists.  Or, you can set the
  4020. `CONFIG_SITE' environment variable to the location of the site script.
  4021. A warning: not all `configure' scripts look for a site script.
  4022.  
  4023. 
  4024. File: autoconf.info,  Node: Operation Controls,  Prev: Sharing Defaults,  Up: Invoking configure
  4025.  
  4026. Operation Controls
  4027. ==================
  4028.  
  4029.    `configure' recognizes the following options to control how it
  4030. operates.
  4031.  
  4032. `--cache-file=FILE'
  4033.      Use and save the results of the tests in FILE instead of
  4034.      `./config.cache'.  Set FILE to `/dev/null' to disable caching, for
  4035.      debugging `configure'.
  4036.  
  4037. `--help'
  4038.      Print a summary of the options to `configure', and exit.
  4039.  
  4040. `--quiet'
  4041. `--silent'
  4042. `-q'
  4043.      Do not print messages saying which checks are being made.
  4044.  
  4045. `--srcdir=DIR'
  4046.      Look for the package's source code in directory DIR.  Usually
  4047.      `configure' can determine that directory automatically.
  4048.  
  4049. `--version'
  4050.      Print the version of Autoconf used to generate the `configure'
  4051.      script, and exit.
  4052.  
  4053. `configure' also accepts some other, not widely useful, options.
  4054.  
  4055. 
  4056. File: autoconf.info,  Node: Invoking config.status,  Next: Questions,  Prev: Invoking configure,  Up: Top
  4057.  
  4058. Recreating a Configuration
  4059. **************************
  4060.  
  4061.    The `configure' script creates a file named `config.status' which
  4062. describes which configuration options were specified when the package
  4063. was last configured.  This file is a shell script which, if run, will
  4064. recreate the same configuration.
  4065.  
  4066.    You can give `config.status' the `--recheck' option to update
  4067. itself.  This option is useful if you change `configure', so that the
  4068. results of some tests might be different from the previous run.  The
  4069. `--recheck' option re-runs `configure' with the same arguments you used
  4070. before, plus the `--no-create' option, which prevent `configure' from
  4071. running `config.status' and creating `Makefile' and other files, and
  4072. the `--no-recursion' option, which prevents `configure' from running
  4073. other `configure' scripts in subdirectories.  (This is so other
  4074. `Makefile' rules can run `config.status' when it changes; *note
  4075. Automatic Remaking::., for an example).
  4076.  
  4077.    `config.status' also accepts the options `--help', which prints a
  4078. summary of the options to `config.status', and `--version', which
  4079. prints the version of Autoconf used to create the `configure' script
  4080. that generated `config.status'.
  4081.  
  4082.    `config.status' checks several optional environment variables that
  4083. can alter its behavior:
  4084.  
  4085.  - Variable: CONFIG_SHELL
  4086.      The shell with which to run `configure' for the `--recheck'
  4087.      option.  It must be Bourne-compatible.  The default is `/bin/sh'.
  4088.  
  4089.  - Variable: CONFIG_STATUS
  4090.      The file name to use for the shell script that records the
  4091.      configuration.  The default is `./config.status'.  This variable is
  4092.      useful when one package uses parts of another and the `configure'
  4093.      scripts shouldn't be merged because they are maintained separately.
  4094.  
  4095.    The following variables provide one way for separately distributed
  4096. packages to share the values computed by `configure'.  Doing so can be
  4097. useful if some of the packages need a superset of the features that one
  4098. of them, perhaps a common library, does.  These variables allow a
  4099. `config.status' file to create files other than the ones that its
  4100. `configure.in' specifies, so it can be used for a different package.
  4101.  
  4102.  - Variable: CONFIG_FILES
  4103.      The files in which to perform `@VARIABLE@' substitutions.  The
  4104.      default is the arguments given to `AC_OUTPUT' in `configure.in'.
  4105.  
  4106.  - Variable: CONFIG_HEADERS
  4107.      The files in which to substitute C `#define' statements.  The
  4108.      default is the arguments given to `AC_CONFIG_HEADER'; if that
  4109.      macro was not called, `config.status' ignores this variable.
  4110.  
  4111.    These variables also allow you to write `Makefile' rules that
  4112. regenerate only some of the files.  For example, in the dependencies
  4113. given above (*note Automatic Remaking::.), `config.status' is run twice
  4114. when `configure.in' has changed.  If that bothers you, you can make
  4115. each run only regenerate the files for that rule:
  4116.  
  4117.      config.h: stamp-h
  4118.      stamp-h: config.h.in config.status
  4119.              CONFIG_FILES= CONFIG_HEADERS=config.h ./config.status
  4120.              echo > stamp-h
  4121.      
  4122.      Makefile: Makefile.in config.status
  4123.              CONFIG_FILES=Makefile CONFIG_HEADERS= ./config.status
  4124.  
  4125. (If `configure.in' does not call `AC_CONFIG_HEADER', there is no need
  4126. to set `CONFIG_HEADERS' in the `make' rules.)
  4127.  
  4128. 
  4129. File: autoconf.info,  Node: Questions,  Next: Upgrading,  Prev: Invoking config.status,  Up: Top
  4130.  
  4131. Questions About Autoconf
  4132. ************************
  4133.  
  4134.    Several questions about Autoconf come up occasionally.  Here some of
  4135. them are addressed.
  4136.  
  4137. * Menu:
  4138.  
  4139. * Distributing::                Distributing `configure' scripts.
  4140. * Why GNU m4::                  Why not use the standard `m4'?
  4141. * Bootstrapping::               Autoconf and GNU `m4' require each other?
  4142. * Why Not Imake::               Why GNU uses `configure' instead of Imake.
  4143.  
  4144. 
  4145. File: autoconf.info,  Node: Distributing,  Next: Why GNU m4,  Up: Questions
  4146.  
  4147. Distributing `configure' Scripts
  4148. ================================
  4149.  
  4150.      What are the restrictions on distributing `configure'
  4151.      scripts that Autoconf generates?  How does that affect my
  4152.      programs that use them?
  4153.  
  4154.    There are no restrictions on how the configuration scripts that
  4155. Autoconf produces may be distributed or used.  In Autoconf version 1,
  4156. they were covered by the GNU General Public License.  We still
  4157. encourage software authors to distribute their work under terms like
  4158. those of the GPL, but doing so is not required to use Autoconf.
  4159.  
  4160.    Of the other files that might be used with `configure',
  4161. `config.h.in' is under whatever copyright you use for your
  4162. `configure.in', since it is derived from that file and from the public
  4163. domain file `acconfig.h'.  `config.sub' and `config.guess' have an
  4164. exception to the GPL when they are used with an Autoconf-generated
  4165. `configure' script, which permits you to distribute them under the same
  4166. terms as the rest of your package.  `install-sh' is from the X
  4167. Consortium and is not copyrighted.
  4168.  
  4169. 
  4170. File: autoconf.info,  Node: Why GNU m4,  Next: Bootstrapping,  Prev: Distributing,  Up: Questions
  4171.  
  4172. Why Require GNU `m4'?
  4173. =====================
  4174.  
  4175.      Why does Autoconf require GNU `m4'?
  4176.  
  4177.    Many `m4' implementations have hard-coded limitations on the size
  4178. and number of macros, which Autoconf exceeds.  They also lack several
  4179. builtin macros that it would be difficult to get along without in a
  4180. sophisticated application like Autoconf, including:
  4181.  
  4182.      builtin
  4183.      indir
  4184.      patsubst
  4185.      __file__
  4186.      __line__
  4187.  
  4188.    Since only software maintainers need to use Autoconf, and since GNU
  4189. `m4' is simple to configure and install, it seems reasonable to require
  4190. GNU `m4' to be installed also.  Many maintainers of GNU and other free
  4191. software already have most of the GNU utilities installed, since they
  4192. prefer them.
  4193.  
  4194. 
  4195. File: autoconf.info,  Node: Bootstrapping,  Next: Why Not Imake,  Prev: Why GNU m4,  Up: Questions
  4196.  
  4197. How Can I Bootstrap?
  4198. ====================
  4199.  
  4200.      If Autoconf requires GNU `m4' and GNU `m4' has an
  4201.      Autoconf `configure' script, how do I bootstrap?  It seems
  4202.      like a chicken and egg problem!
  4203.  
  4204.    This is a misunderstanding.  Although GNU `m4' does come with a
  4205. `configure' script produced by Autoconf, Autoconf is not required in
  4206. order to run the script and install GNU `m4'.  Autoconf is only
  4207. required if you want to change the `m4' `configure' script, which few
  4208. people have to do (mainly its maintainer).
  4209.  
  4210. 
  4211. File: autoconf.info,  Node: Why Not Imake,  Prev: Bootstrapping,  Up: Questions
  4212.  
  4213. Why Not Imake?
  4214. ==============
  4215.  
  4216.      Why not use Imake instead of `configure' scripts?
  4217.  
  4218.    Several people have written addressing this question, so I include
  4219. adaptations of their explanations here.
  4220.  
  4221.    The following answer is based on one written by Richard Pixley:
  4222.  
  4223.    Autoconf generated scripts frequently work on machines which it has
  4224. never been set up to handle before.  That is, it does a good job of
  4225. inferring a configuration for a new system.  Imake cannot do this.
  4226.  
  4227.    Imake uses a common database of host specific data.  For X11, this
  4228. makes sense because the distribution is made as a collection of tools,
  4229. by one central authority who has control over the database.
  4230.  
  4231.    GNU tools are not released this way.  Each GNU tool has a maintainer;
  4232. these maintainers are scattered across the world.  Using a common
  4233. database would be a maintenance nightmare.  Autoconf may appear to be
  4234. this kind of database, but in fact it is not.  Instead of listing host
  4235. dependencies, it lists program requirements.
  4236.  
  4237.    If you view the GNU suite as a collection of native tools, then the
  4238. problems are similar.  But the GNU development tools can be configured
  4239. as cross tools in almost any host+target permutation.  All of these
  4240. configurations can be installed concurrently.  They can even be
  4241. configured to share host independent files across hosts.  Imake doesn't
  4242. address these issues.
  4243.  
  4244.    Imake templates are a form of standardization.  The GNU coding
  4245. standards address the same issues without necessarily imposing the same
  4246. restrictions.
  4247.  
  4248.    Here is some further explanation, written by Per Bothner:
  4249.  
  4250.    One of the advantages of Imake is that it easy to generate large
  4251. Makefiles using `cpp''s `#include' and macro mechanisms.  However,
  4252. `cpp' is not programmable: it has limited conditional facilities, and
  4253. no looping.  And `cpp' cannot inspect its environment.
  4254.  
  4255.    All of these problems are solved by using `sh' instead of `cpp'.
  4256. The shell is fully programmable, has macro substitution, can execute
  4257. (or source) other shell scripts, and can inspect its environment.
  4258.  
  4259.    Paul Eggert elaborates more:
  4260.  
  4261.    With Autoconf, installers need not assume that Imake itself is
  4262. already installed and working well.  This may not seem like much of an
  4263. advantage to people who are accustomed to Imake.  But on many hosts
  4264. Imake is not installed or the default installation is not working well,
  4265. and requiring Imake to install a package hinders the acceptance of that
  4266. package on those hosts.  For example, the Imake template and
  4267. configuration files might not be installed properly on a host, or the
  4268. Imake build procedure might wrongly assume that all source files are in
  4269. one big directory tree, or the Imake configuration might assume one
  4270. compiler whereas the package or the installer needs to use another, or
  4271. there might be a version mismatch between the Imake expected by the
  4272. package and the Imake supported by the host.  These problems are much
  4273. rarer with Autoconf, where each package comes with its own independent
  4274. configuration processor.
  4275.  
  4276.    Also, Imake often suffers from unexpected interactions between
  4277. `make' and the installer's C preprocessor.  The fundamental problem
  4278. here is that the C preprocessor was designed to preprocess C programs,
  4279. not `Makefile's.  This is much less of a problem with Autoconf, which
  4280. uses the general-purpose preprocessor `m4', and where the package's
  4281. author (rather than the installer) does the preprocessing in a standard
  4282. way.
  4283.  
  4284.    Finally, Mark Eichin notes:
  4285.  
  4286.    Imake isn't all that extensible, either.  In order to add new
  4287. features to Imake, you need to provide your own project template, and
  4288. duplicate most of the features of the existing one.  This means that
  4289. for a sophisticated project, using the vendor-provided Imake templates
  4290. fails to provide any leverage--since they don't cover anything that
  4291. your own project needs (unless it is an X11 program).
  4292.  
  4293.    On the other side, though:
  4294.  
  4295.    The one advantage that Imake has over `configure': `Imakefile's tend
  4296. to be much shorter (likewise, less redundant) than `Makefile.in's.
  4297. There is a fix to this, however--at least for the Kerberos V5 tree,
  4298. we've modified things to call in common `post.in' and `pre.in'
  4299. `Makefile' fragments for the entire tree.  This means that a lot of
  4300. common things don't have to be duplicated, even though they normally
  4301. are in `configure' setups.
  4302.  
  4303. 
  4304. File: autoconf.info,  Node: Upgrading,  Next: History,  Prev: Questions,  Up: Top
  4305.  
  4306. Upgrading From Version 1
  4307. ************************
  4308.  
  4309.    Autoconf version 2 is mostly backward compatible with version 1.
  4310. However, it introduces better ways to do some things, and doesn't
  4311. support some of the ugly things in version 1.  So, depending on how
  4312. sophisticated your `configure.in' files are, you might have to do some
  4313. manual work in order to upgrade to version 2.  This chapter points out
  4314. some problems to watch for when upgrading.  Also, perhaps your
  4315. `configure' scripts could benefit from some of the new features in
  4316. version 2; the changes are summarized in the file `NEWS' in the
  4317. Autoconf distribution.
  4318.  
  4319.    First, make sure you have GNU `m4' version 1.1 or higher installed,
  4320. preferably 1.3 or higher.  Versions before 1.1 have bugs that prevent
  4321. them from working with Autoconf version 2.  Versions 1.3 and later are
  4322. much faster than earlier versions, because as of version 1.3, GNU `m4'
  4323. has a more efficient implementation of diversions and can freeze its
  4324. internal state in a file that it can read back quickly.
  4325.  
  4326. * Menu:
  4327.  
  4328. * Changed File Names::          Files you might rename.
  4329. * Changed Makefiles::           New things to put in `Makefile.in'.
  4330. * Changed Macros::              Macro calls you might replace.
  4331. * Invoking autoupdate::         Replacing old macro names in `configure.in'.
  4332. * Changed Results::             Changes in how to check test results.
  4333. * Changed Macro Writing::       Better ways to write your own macros.
  4334.  
  4335. 
  4336. File: autoconf.info,  Node: Changed File Names,  Next: Changed Makefiles,  Up: Upgrading
  4337.  
  4338. Changed File Names
  4339. ==================
  4340.  
  4341.    If you have an `aclocal.m4' installed with Autoconf (as opposed to
  4342. in a particular package's source directory), you must rename it to
  4343. `acsite.m4'.  *Note Invoking autoconf::.
  4344.  
  4345.    If you distribute `install.sh' with your package, rename it to
  4346. `install-sh' so `make' builtin rules won't inadvertently create a file
  4347. called `install' from it.  `AC_PROG_INSTALL' looks for the script under
  4348. both names, but it is best to use the new name.
  4349.  
  4350.    If you were using `config.h.top' or `config.h.bot', you still can,
  4351. but you will have less clutter if you merge them into `acconfig.h'.
  4352. *Note Invoking autoheader::.
  4353.  
  4354. 
  4355. File: autoconf.info,  Node: Changed Makefiles,  Next: Changed Macros,  Prev: Changed File Names,  Up: Upgrading
  4356.  
  4357. Changed Makefiles
  4358. =================
  4359.  
  4360.    Add `@CFLAGS@', `@CPPFLAGS@', and `@LDFLAGS@' in your `Makefile.in'
  4361. files, so they can take advantage of the values of those variables in
  4362. the environment when `configure' is run.  Doing this isn't necessary,
  4363. but it's a convenience for users.
  4364.  
  4365.    Also add `@configure_input@' in a comment to each non-`Makefile'
  4366. input file for `AC_OUTPUT', so that the output files will contain a
  4367. comment saying they were produced by `configure'.  Automatically
  4368. selecting the right comment syntax for all the kinds of files that
  4369. people call `AC_OUTPUT' on became too much work.
  4370.  
  4371.    Add `config.log' and `config.cache' to the list of files you remove
  4372. in `distclean' targets.
  4373.  
  4374.    If you have the following in `Makefile.in':
  4375.  
  4376.      prefix = /usr/local
  4377.      exec_prefix = ${prefix}
  4378.  
  4379. you must change it to:
  4380.  
  4381.      prefix = @prefix@
  4382.      exec_prefix = @exec_prefix@
  4383.  
  4384. The old behavior of replacing those variables without `@' characters
  4385. around them has been removed.
  4386.  
  4387. 
  4388. File: autoconf.info,  Node: Changed Macros,  Next: Invoking autoupdate,  Prev: Changed Makefiles,  Up: Upgrading
  4389.  
  4390. Changed Macros
  4391. ==============
  4392.  
  4393.    Many of the macros were renamed in Autoconf version 2.  You can still
  4394. use the old names, but the new ones are clearer, and it's easier to find
  4395. the documentation for them.  *Note Old Macro Names::, for a table
  4396. showing the new names for the old macros.  Use the `autoupdate' program
  4397. to convert your `configure.in' to using the new macro names.  *Note
  4398. Invoking autoupdate::.
  4399.  
  4400.    Some macros have been superseded by similar ones that do the job
  4401. better, but are not call-compatible.  If you get warnings about calling
  4402. obsolete macros while running `autoconf', you may safely ignore them,
  4403. but your `configure' script will generally work better if you follow
  4404. the advice it prints about what to replace the obsolete macros with.  In
  4405. particular, the mechanism for reporting the results of tests has
  4406. changed.  If you were using `echo' or `AC_VERBOSE' (perhaps via
  4407. `AC_COMPILE_CHECK'), your `configure' script's output will look better
  4408. if you switch to `AC_MSG_CHECKING' and `AC_MSG_RESULT'.  *Note Printing
  4409. Messages::.  Those macros work best in conjunction with cache
  4410. variables.  *Note Caching Results::.
  4411.  
  4412. 
  4413. File: autoconf.info,  Node: Invoking autoupdate,  Next: Changed Results,  Prev: Changed Macros,  Up: Upgrading
  4414.  
  4415. Using `autoupdate' to Modernize `configure'
  4416. ===========================================
  4417.  
  4418.    The `autoupdate' program updates a `configure.in' file that calls
  4419. Autoconf macros by their old names to use the current macro names.  In
  4420. version 2 of Autoconf, most of the macros were renamed to use a more
  4421. uniform and descriptive naming scheme.  *Note Macro Names::, for a
  4422. description of the new scheme.  Although the old names still work
  4423. (*note Old Macro Names::., for a list of the old macro names and the
  4424. corresponding new names), you can make your `configure.in' files more
  4425. readable and make it easier to use the current Autoconf documentation
  4426. if you update them to use the new macro names.
  4427.  
  4428.    If given no arguments, `autoupdate' updates `configure.in', backing
  4429. up the original version with the suffix `~' (or the value of the
  4430. environment variable `SIMPLE_BACKUP_SUFFIX', if that is set).  If you
  4431. give `autoupdate' an argument, it reads that file instead of
  4432. `configure.in' and writes the updated file to the standard output.
  4433.  
  4434. `autoupdate' accepts the following options:
  4435.  
  4436. `--help'
  4437. `-h'
  4438.      Print a summary of the command line options and exit.
  4439.  
  4440. `--macrodir=DIR'
  4441. `-m DIR'
  4442.      Look for the Autoconf macro files in directory DIR instead of the
  4443.      default installation directory.  You can also set the `AC_MACRODIR'
  4444.      environment variable to a directory; this option overrides the
  4445.      environment variable.
  4446.  
  4447. `--version'
  4448.      Print the version number of `autoupdate' and exit.
  4449.  
  4450. 
  4451. File: autoconf.info,  Node: Changed Results,  Next: Changed Macro Writing,  Prev: Invoking autoupdate,  Up: Upgrading
  4452.  
  4453. Changed Results
  4454. ===============
  4455.  
  4456.    If you were checking the results of previous tests by examining the
  4457. shell variable `DEFS', you need to switch to checking the values of the
  4458. cache variables for those tests.  `DEFS' no longer exists while
  4459. `configure' is running; it is only created when generating output
  4460. files.  This difference from version 1 is because properly quoting the
  4461. contents of that variable turned out to be too cumbersome and
  4462. inefficient to do every time `AC_DEFINE' is called.  *Note Cache
  4463. Variable Names::.
  4464.  
  4465.    For example, here is a `configure.in' fragment written for Autoconf
  4466. version 1:
  4467.  
  4468.      AC_HAVE_FUNCS(syslog)
  4469.      case "$DEFS" in
  4470.      *-DHAVE_SYSLOG*) ;;
  4471.      *) # syslog is not in the default libraries.  See if it's in some other.
  4472.        saved_LIBS="$LIBS"
  4473.        for lib in bsd socket inet; do
  4474.          AC_CHECKING(for syslog in -l$lib)
  4475.          LIBS="$saved_LIBS -l$lib"
  4476.          AC_HAVE_FUNCS(syslog)
  4477.          case "$DEFS" in
  4478.          *-DHAVE_SYSLOG*) break ;;
  4479.          *) ;;
  4480.          esac
  4481.          LIBS="$saved_LIBS"
  4482.        done ;;
  4483.      esac
  4484.  
  4485.    Here is a way to write it for version 2:
  4486.  
  4487.      AC_CHECK_FUNCS(syslog)
  4488.      if test $ac_cv_func_syslog = no; then
  4489.        # syslog is not in the default libraries.  See if it's in some other.
  4490.        for lib in bsd socket inet; do
  4491.          AC_CHECK_LIB($lib, syslog, [AC_DEFINE(HAVE_SYSLOG)
  4492.            LIBS="$LIBS $lib"; break])
  4493.        done
  4494.      fi
  4495.  
  4496.    If you were working around bugs in `AC_DEFINE_UNQUOTED' by adding
  4497. backslashes before quotes, you need to remove them.  It now works
  4498. predictably, and does not treat quotes (except backquotes) specially.
  4499. *Note Setting Output Variables::.
  4500.  
  4501.    All of the boolean shell variables set by Autoconf macros now use
  4502. `yes' for the true value.  Most of them use `no' for false, though for
  4503. backward compatibility some use the empty string instead.  If you were
  4504. relying on a shell variable being set to something like 1 or `t' for
  4505. true, you need to change your tests.
  4506.  
  4507. 
  4508. File: autoconf.info,  Node: Changed Macro Writing,  Prev: Changed Results,  Up: Upgrading
  4509.  
  4510. Changed Macro Writing
  4511. =====================
  4512.  
  4513.    When defining your own macros, you should now use `AC_DEFUN' instead
  4514. of `define'.  `AC_DEFUN' automatically calls `AC_PROVIDE' and ensures
  4515. that macros called via `AC_REQUIRE' do not interrupt other macros, to
  4516. prevent nested `checking...' messages on the screen.  There's no actual
  4517. harm in continuing to use the older way, but it's less convenient and
  4518. attractive.  *Note Macro Definitions::.
  4519.  
  4520.    You probably looked at the macros that came with Autoconf as a guide
  4521. for how to do things.  It would be a good idea to take a look at the new
  4522. versions of them, as the style is somewhat improved and they take
  4523. advantage of some new features.
  4524.  
  4525.    If you were doing tricky things with undocumented Autoconf internals
  4526. (macros, variables, diversions), check whether you need to change
  4527. anything to account for changes that have been made.  Perhaps you can
  4528. even use an officially supported technique in version 2 instead of
  4529. kludging.  Or perhaps not.
  4530.  
  4531.    To speed up your locally written feature tests, add caching to them.
  4532. See whether any of your tests are of general enough usefulness to
  4533. encapsulate into macros that you can share.
  4534.  
  4535. 
  4536. File: autoconf.info,  Node: History,  Next: Old Macro Names,  Prev: Upgrading,  Up: Top
  4537.  
  4538. History of Autoconf
  4539. *******************
  4540.  
  4541.    You may be wondering, Why was Autoconf originally written?  How did
  4542. it get into its present form?  (Why does it look like gorilla spit?)  If
  4543. you're not wondering, then this chapter contains no information useful
  4544. to you, and you might as well skip it.  If you *are* wondering, then
  4545. let there be light...
  4546.  
  4547. * Menu:
  4548.  
  4549. * Genesis::            Prehistory and naming of `configure'.
  4550. * Exodus::            The plagues of `m4' and Perl.
  4551. * Leviticus::            The priestly code of portability arrives.
  4552. * Numbers::            Growth and contributors.
  4553. * Deuteronomy::            Approaching the promises of easy configuration.
  4554.  
  4555. 
  4556. File: autoconf.info,  Node: Genesis,  Next: Exodus,  Up: History
  4557.  
  4558. Genesis
  4559. =======
  4560.  
  4561.    In June 1991 I was maintaining many of the GNU utilities for the Free
  4562. Software Foundation.  As they were ported to more platforms and more
  4563. programs were added, the number of `-D' options that users had to
  4564. select in the `Makefile' (around 20) became burdensome.  Especially for
  4565. me--I had to test each new release on a bunch of different systems.  So
  4566. I wrote a little shell script to guess some of the correct settings for
  4567. the fileutils package, and released it as part of fileutils 2.0.  That
  4568. `configure' script worked well enough that the next month I adapted it
  4569. (by hand) to create similar `configure' scripts for several other GNU
  4570. utilities packages.  Brian Berliner also adapted one of my scripts for
  4571. his CVS revision control system.
  4572.  
  4573.    Later that summer, I learned that Richard Stallman and Richard Pixley
  4574. were developing similar scripts to use in the GNU compiler tools; so I
  4575. adapted my `configure' scripts to support their evolving interface:
  4576. using the file name `Makefile.in' as the templates; adding `+srcdir',
  4577. the first option (of many); and creating `config.status' files.
  4578.  
  4579. 
  4580. File: autoconf.info,  Node: Exodus,  Next: Leviticus,  Prev: Genesis,  Up: History
  4581.  
  4582. Exodus
  4583. ======
  4584.  
  4585.    As I got feedback from users, I incorporated many improvements, using
  4586. Emacs to search and replace, cut and paste, similar changes in each of
  4587. the scripts.  As I adapted more GNU utilities packages to use
  4588. `configure' scripts, updating them all by hand became impractical.
  4589. Rich Murphey, the maintainer of the GNU graphics utilities, sent me mail
  4590. saying that the `configure' scripts were great, and asking if I had a
  4591. tool for generating them that I could send him.  No, I thought, but I
  4592. should!  So I started to work out how to generate them.  And the
  4593. journey from the slavery of hand-written `configure' scripts to the
  4594. abundance and ease of Autoconf began.
  4595.  
  4596.    Cygnus `configure', which was being developed at around that time,
  4597. is table driven; it is meant to deal mainly with a discrete number of
  4598. system types with a small number of mainly unguessable features (such as
  4599. details of the object file format).  The automatic configuration system
  4600. that Brian Fox had developed for Bash takes a similar approach.  For
  4601. general use, it seems to me a hopeless cause to try to maintain an
  4602. up-to-date database of which features each variant of each operating
  4603. system has.  It's easier and more reliable to check for most features on
  4604. the fly--especially on hybrid systems that people have hacked on
  4605. locally or that have patches from vendors installed.
  4606.  
  4607.    I considered using an architecture similar to that of Cygnus
  4608. `configure', where there is a single `configure' script that reads
  4609. pieces of `configure.in' when run.  But I didn't want to have to
  4610. distribute all of the feature tests with every package, so I settled on
  4611. having a different `configure' made from each `configure.in' by a
  4612. preprocessor.  That approach also offered more control and flexibility.
  4613.  
  4614.    I looked briefly into using the Metaconfig package, by Larry Wall,
  4615. Harlan Stenn, and Raphael Manfredi, but I decided not to for several
  4616. reasons.  The `Configure' scripts it produces are interactive, which I
  4617. find quite inconvenient; I didn't like the ways it checked for some
  4618. features (such as library functions); I didn't know that it was still
  4619. being maintained, and the `Configure' scripts I had seen didn't work on
  4620. many modern systems (such as System V R4 and NeXT); it wasn't very
  4621. flexible in what it could do in response to a feature's presence or
  4622. absence; I found it confusing to learn; and it was too big and complex
  4623. for my needs (I didn't realize then how much Autoconf would eventually
  4624. have to grow).
  4625.  
  4626.    I considered using Perl to generate my style of `configure' scripts,
  4627. but decided that `m4' was better suited to the job of simple textual
  4628. substitutions: it gets in the way less, because output is implicit.
  4629. Plus, everyone already has it.  (Initially I didn't rely on the GNU
  4630. extensions to `m4'.)  Also, some of my friends at the University of
  4631. Maryland had recently been putting `m4' front ends on several programs,
  4632. including `tvtwm', and I was interested in trying out a new language.
  4633.  
  4634. 
  4635. File: autoconf.info,  Node: Leviticus,  Next: Numbers,  Prev: Exodus,  Up: History
  4636.  
  4637. Leviticus
  4638. =========
  4639.  
  4640.    Since my `configure' scripts determine the system's capabilities
  4641. automatically, with no interactive user intervention, I decided to call
  4642. the program that generates them Autoconfig.  But with a version number
  4643. tacked on, that name would be too long for old UNIX file systems, so I
  4644. shortened it to Autoconf.
  4645.  
  4646.    In the fall of 1991 I called together a group of fellow questers
  4647. after the Holy Grail of portability (er, that is, alpha testers) to
  4648. give me feedback as I encapsulated pieces of my handwritten scripts in
  4649. `m4' macros and continued to add features and improve the techniques
  4650. used in the checks.  Prominent among the testers were Franc,ois Pinard,
  4651. who came up with the idea of making an `autoconf' shell script to run
  4652. `m4' and check for unresolved macro calls; Richard Pixley, who
  4653. suggested running the compiler instead of searching the file system to
  4654. find include files and symbols, for more accurate results; Karl Berry,
  4655. who got Autoconf to configure TeX and added the macro index to the
  4656. documentation; and Ian Taylor, who added support for creating a C
  4657. header file as an alternative to putting `-D' options in a `Makefile',
  4658. so he could use Autoconf for his UUCP package.  The alpha testers
  4659. cheerfully adjusted their files again and again as the names and
  4660. calling conventions of the Autoconf macros changed from release to
  4661. release.  They all contributed many specific checks, great ideas, and
  4662. bug fixes.
  4663.  
  4664. 
  4665. File: autoconf.info,  Node: Numbers,  Next: Deuteronomy,  Prev: Leviticus,  Up: History
  4666.  
  4667. Numbers
  4668. =======
  4669.  
  4670.    In July 1992, after months of alpha testing, I released Autoconf 1.0,
  4671. and converted many GNU packages to use it.  I was surprised by how
  4672. positive the reaction to it was.  More people started using it than I
  4673. could keep track of, including people working on software that wasn't
  4674. part of the GNU Project (such as TCL, FSP, and Kerberos V5).  Autoconf
  4675. continued to improve rapidly, as many people using the `configure'
  4676. scripts reported problems they encountered.
  4677.  
  4678.    Autoconf turned out to be a good torture test for `m4'
  4679. implementations.  UNIX `m4' started to dump core because of the length
  4680. of the macros that Autoconf defined, and several bugs showed up in GNU
  4681. `m4' as well.  Eventually, we realized that we needed to use some
  4682. features that only GNU `m4' has.  4.3BSD `m4', in particular, has an
  4683. impoverished set of builtin macros; the System V version is better, but
  4684. still doesn't provide everything we need.
  4685.  
  4686.    More development occurred as people put Autoconf under more stresses
  4687. (and to uses I hadn't anticipated).  Karl Berry added checks for X11.
  4688. david zuhn contributed C++ support.  Franc,ois Pinard made it diagnose
  4689. invalid arguments.  Jim Blandy bravely coerced it into configuring GNU
  4690. Emacs, laying the groundwork for several later improvements.  Roland
  4691. McGrath got it to configure the GNU C Library, wrote the `autoheader'
  4692. script to automate the creation of C header file templates, and added a
  4693. `--verbose' option to `configure'.  Noah Friedman added the
  4694. `--macrodir' option and `AC_MACRODIR' environment variable.  (He also
  4695. coined the term "autoconfiscate" to mean "adapt a software package to
  4696. use Autoconf".)  Roland and Noah improved the quoting protection in
  4697. `AC_DEFINE' and fixed many bugs, especially when I got sick of dealing
  4698. with portability problems from February through June, 1993.
  4699.  
  4700. 
  4701. File: autoconf.info,  Node: Deuteronomy,  Prev: Numbers,  Up: History
  4702.  
  4703. Deuteronomy
  4704. ===========
  4705.  
  4706.    A long wish list for major features had accumulated, and the effect
  4707. of several years of patching by various people had left some residual
  4708. cruft.  In April 1994, while working for Cygnus Support, I began a major
  4709. revision of Autoconf.  I added most of the features of the Cygnus
  4710. `configure' that Autoconf had lacked, largely by adapting the relevant
  4711. parts of Cygnus `configure' with the help of david zuhn and Ken
  4712. Raeburn.  These features include support for using `config.sub',
  4713. `config.guess', `--host', and `--target'; making links to files; and
  4714. running `configure' scripts in subdirectories.  Adding these features
  4715. enabled Ken to convert GNU `as', and Rob Savoye to convert DejaGNU, to
  4716. using Autoconf.
  4717.  
  4718.    I added more features in response to other peoples' requests.  Many
  4719. people had asked for `configure' scripts to share the results of the
  4720. checks between runs, because (particularly when configuring a large
  4721. source tree, like Cygnus does) they were frustratingly slow.  Mike
  4722. Haertel suggested adding site-specific initialization scripts.  People
  4723. distributing software that had to unpack on MS-DOS asked for a way to
  4724. override the `.in' extension on the file names, which produced file
  4725. names like `config.h.in' containing two dots.  Jim Avera did an
  4726. extensive examination of the problems with quoting in `AC_DEFINE' and
  4727. `AC_SUBST'; his insights led to significant improvements.  Richard
  4728. Stallman asked that compiler output be sent to `config.log' instead of
  4729. `/dev/null', to help people debug the Emacs `configure' script.
  4730.  
  4731.    I made some other changes because of my dissatisfaction with the
  4732. quality of the program.  I made the messages showing results of the
  4733. checks less ambiguous, always printing a result.  I regularized the
  4734. names of the macros and cleaned up coding style inconsistencies.  I
  4735. added some auxiliary utilities that I had developed to help convert
  4736. source code packages to use Autoconf.  With the help of Franc,ois
  4737. Pinard, I made the macros not interrupt each others' messages.  (That
  4738. feature revealed some performance bottlenecks in GNU `m4', which he
  4739. hastily corrected!) I reorganized the documentation around problems
  4740. people want to solve.  And I began a testsuite, because experience had
  4741. shown that Autoconf has a pronounced tendency to regress when we change
  4742. it.
  4743.  
  4744.    Again, several alpha testers gave invaluable feedback, especially
  4745. Franc,ois Pinard, Jim Meyering, Karl Berry, Rob Savoye, Ken Raeburn,
  4746. and Mark Eichin.
  4747.  
  4748.    Finally, version 2.0 was ready.  And there was much rejoicing.  (And
  4749. I have free time again.  I think.  Yeah, right.)
  4750.  
  4751. 
  4752. File: autoconf.info,  Node: Old Macro Names,  Next: Environment Variable Index,  Prev: History,  Up: Top
  4753.  
  4754. Old Macro Names
  4755. ***************
  4756.  
  4757.    In version 2 of Autoconf, most of the macros were renamed to use a
  4758. more uniform and descriptive naming scheme.  Here are the old names of
  4759. the macros that were renamed, followed by the current names of those
  4760. macros.  Although the old names are still accepted by the `autoconf'
  4761. program for backward compatibility, the old names are considered
  4762. obsolete.  *Note Macro Names::, for a description of the new naming
  4763. scheme.
  4764.  
  4765. `AC_ALLOCA'
  4766.      `AC_FUNC_ALLOCA'
  4767.  
  4768. `AC_ARG_ARRAY'
  4769.      removed because of limited usefulness
  4770.  
  4771. `AC_CHAR_UNSIGNED'
  4772.      `AC_C_CHAR_UNSIGNED'
  4773.  
  4774. `AC_CONST'
  4775.      `AC_C_CONST'
  4776.  
  4777. `AC_CROSS_CHECK'
  4778.      `AC_C_CROSS'
  4779.  
  4780. `AC_ERROR'
  4781.      `AC_MSG_ERROR'
  4782.  
  4783. `AC_FIND_X'
  4784.      `AC_PATH_X'
  4785.  
  4786. `AC_FIND_XTRA'
  4787.      `AC_PATH_XTRA'
  4788.  
  4789. `AC_FUNC_CHECK'
  4790.      `AC_CHECK_FUNC'
  4791.  
  4792. `AC_GCC_TRADITIONAL'
  4793.      `AC_PROG_GCC_TRADITIONAL'
  4794.  
  4795. `AC_GETGROUPS_T'
  4796.      `AC_TYPE_GETGROUPS'
  4797.  
  4798. `AC_GETLOADAVG'
  4799.      `AC_FUNC_GETLOADAVG'
  4800.  
  4801. `AC_HAVE_FUNCS'
  4802.      `AC_CHECK_FUNCS'
  4803.  
  4804. `AC_HAVE_HEADERS'
  4805.      `AC_CHECK_HEADERS'
  4806.  
  4807. `AC_HAVE_POUNDBANG'
  4808.      `AC_SYS_INTERPRETER' (different calling convention)
  4809.  
  4810. `AC_HEADER_CHECK'
  4811.      `AC_CHECK_HEADER'
  4812.  
  4813. `AC_HEADER_EGREP'
  4814.      `AC_EGREP_HEADER'
  4815.  
  4816. `AC_INLINE'
  4817.      `AC_C_INLINE'
  4818.  
  4819. `AC_LN_S'
  4820.      `AC_PROG_LN_S'
  4821.  
  4822. `AC_LONG_DOUBLE'
  4823.      `AC_C_LONG_DOUBLE'
  4824.  
  4825. `AC_LONG_FILE_NAMES'
  4826.      `AC_SYS_LONG_FILE_NAMES'
  4827.  
  4828. `AC_MAJOR_HEADER'
  4829.      `AC_HEADER_MAJOR'
  4830.  
  4831. `AC_MINUS_C_MINUS_O'
  4832.      `AC_PROG_CC_C_O'
  4833.  
  4834. `AC_MMAP'
  4835.      `AC_FUNC_MMAP'
  4836.  
  4837. `AC_MODE_T'
  4838.      `AC_TYPE_MODE_T'
  4839.  
  4840. `AC_OFF_T'
  4841.      `AC_TYPE_OFF_T'
  4842.  
  4843. `AC_PID_T'
  4844.      `AC_TYPE_PID_T'
  4845.  
  4846. `AC_PREFIX'
  4847.      `AC_PREFIX_PROGRAM'
  4848.  
  4849. `AC_PROGRAMS_CHECK'
  4850.      `AC_CHECK_PROGS'
  4851.  
  4852. `AC_PROGRAMS_PATH'
  4853.      `AC_PATH_PROGS'
  4854.  
  4855. `AC_PROGRAM_CHECK'
  4856.      `AC_CHECK_PROG'
  4857.  
  4858. `AC_PROGRAM_EGREP'
  4859.      `AC_EGREP_CPP'
  4860.  
  4861. `AC_PROGRAM_PATH'
  4862.      `AC_PATH_PROG'
  4863.  
  4864. `AC_REMOTE_TAPE'
  4865.      removed because of limited usefulness
  4866.  
  4867. `AC_RESTARTABLE_SYSCALLS'
  4868.      `AC_SYS_RESTARTABLE_SYSCALLS'
  4869.  
  4870. `AC_RETSIGTYPE'
  4871.      `AC_TYPE_SIGNAL'
  4872.  
  4873. `AC_RSH'
  4874.      removed because of limited usefulness
  4875.  
  4876. `AC_SETVBUF_REVERSED'
  4877.      `AC_FUNC_SETVBUF_REVERSED'
  4878.  
  4879. `AC_SET_MAKE'
  4880.      `AC_PROG_MAKE_SET'
  4881.  
  4882. `AC_SIZEOF_TYPE'
  4883.      `AC_CHECK_SIZEOF'
  4884.  
  4885. `AC_SIZE_T'
  4886.      `AC_TYPE_SIZE_T'
  4887.  
  4888. `AC_STAT_MACROS_BROKEN'
  4889.      `AC_HEADER_STAT'
  4890.  
  4891. `AC_STDC_HEADERS'
  4892.      `AC_HEADER_STDC'
  4893.  
  4894. `AC_STRCOLL'
  4895.      `AC_FUNC_STRCOLL'
  4896.  
  4897. `AC_ST_BLKSIZE'
  4898.      `AC_STRUCT_ST_BLKSIZE'
  4899.  
  4900. `AC_ST_BLOCKS'
  4901.      `AC_STRUCT_ST_BLOCKS'
  4902.  
  4903. `AC_ST_RDEV'
  4904.      `AC_STRUCT_ST_RDEV'
  4905.  
  4906. `AC_SYS_SIGLIST_DECLARED'
  4907.      `AC_DECL_SYS_SIGLIST'
  4908.  
  4909. `AC_TEST_CPP'
  4910.      `AC_TRY_CPP'
  4911.  
  4912. `AC_TEST_PROGRAM'
  4913.      `AC_TRY_RUN'
  4914.  
  4915. `AC_TIMEZONE'
  4916.      `AC_STRUCT_TIMEZONE'
  4917.  
  4918. `AC_TIME_WITH_SYS_TIME'
  4919.      `AC_HEADER_TIME'
  4920.  
  4921. `AC_UID_T'
  4922.      `AC_TYPE_UID_T'
  4923.  
  4924. `AC_UTIME_NULL'
  4925.      `AC_FUNC_UTIME_NULL'
  4926.  
  4927. `AC_VFORK'
  4928.      `AC_FUNC_VFORK'
  4929.  
  4930. `AC_VPRINTF'
  4931.      `AC_FUNC_VPRINTF'
  4932.  
  4933. `AC_WAIT3'
  4934.      `AC_FUNC_WAIT3'
  4935.  
  4936. `AC_WARN'
  4937.      `AC_MSG_WARN'
  4938.  
  4939. `AC_WORDS_BIGENDIAN'
  4940.      `AC_C_BIGENDIAN'
  4941.  
  4942. `AC_YYTEXT_POINTER'
  4943.      `AC_DECL_YYTEXT'
  4944.  
  4945. 
  4946. File: autoconf.info,  Node: Environment Variable Index,  Next: Output Variable Index,  Prev: Old Macro Names,  Up: Top
  4947.  
  4948. Environment Variable Index
  4949. **************************
  4950.  
  4951.    This is an alphabetical list of the environment variables that
  4952. Autoconf checks.
  4953.  
  4954. * Menu:
  4955.  
  4956. * AC_MACRODIR <1>:                      Invoking autoupdate.
  4957. * AC_MACRODIR <1>:                      Invoking autoheader.
  4958. * AC_MACRODIR <1>:                      Invoking autoreconf.
  4959. * AC_MACRODIR <1>:                      Invoking autoconf.
  4960. * AC_MACRODIR <1>:                      Invoking ifnames.
  4961. * AC_MACRODIR:                          Invoking autoscan.
  4962. * CONFIG_FILES:                         Invoking config.status.
  4963. * CONFIG_HEADERS:                       Invoking config.status.
  4964. * CONFIG_SHELL:                         Invoking config.status.
  4965. * CONFIG_SITE:                          Site Defaults.
  4966. * CONFIG_STATUS:                        Invoking config.status.
  4967. * SIMPLE_BACKUP_SUFFIX:                 Invoking autoupdate.
  4968.  
  4969. 
  4970. File: autoconf.info,  Node: Output Variable Index,  Next: Preprocessor Symbol Index,  Prev: Environment Variable Index,  Up: Top
  4971.  
  4972. Output Variable Index
  4973. *********************
  4974.  
  4975.    This is an alphabetical list of the variables that Autoconf can
  4976. substitute into files that it creates, typically one or more
  4977. `Makefile's.  *Note Setting Output Variables::, for more information on
  4978. how this is done.
  4979.  
  4980. * Menu:
  4981.  
  4982. * ALLOCA:                               Particular Functions.
  4983. * AWK:                                  Particular Programs.
  4984. * bindir:                               Preset Output Variables.
  4985. * build:                                System Type Variables.
  4986. * build_alias:                          System Type Variables.
  4987. * build_cpu:                            System Type Variables.
  4988. * build_os:                             System Type Variables.
  4989. * build_vendor:                         System Type Variables.
  4990. * CC <1>:                               UNIX Variants.
  4991. * CC:                                   Particular Programs.
  4992. * CFLAGS <1>:                           Particular Programs.
  4993. * CFLAGS:                               Preset Output Variables.
  4994. * configure_input:                      Preset Output Variables.
  4995. * CPP:                                  Particular Programs.
  4996. * CPPFLAGS:                             Preset Output Variables.
  4997. * CXX:                                  Particular Programs.
  4998. * CXXCPP:                               Particular Programs.
  4999. * CXXFLAGS <1>:                         Particular Programs.
  5000. * CXXFLAGS:                             Preset Output Variables.
  5001. * datadir:                              Preset Output Variables.
  5002. * DEFS:                                 Preset Output Variables.
  5003. * exec_prefix:                          Preset Output Variables.
  5004. * host:                                 System Type Variables.
  5005. * host_alias:                           System Type Variables.
  5006. * host_cpu:                             System Type Variables.
  5007. * host_os:                              System Type Variables.
  5008. * host_vendor:                          System Type Variables.
  5009. * includedir:                           Preset Output Variables.
  5010. * infodir:                              Preset Output Variables.
  5011. * INSTALL:                              Particular Programs.
  5012. * INSTALL_DATA:                         Particular Programs.
  5013. * INSTALL_PROGRAM:                      Particular Programs.
  5014. * KMEM_GROUP:                           Particular Functions.
  5015. * LDFLAGS:                              Preset Output Variables.
  5016. * LEX:                                  Particular Programs.
  5017. * LEX_OUTPUT_ROOT:                      Particular Programs.
  5018. * LEXLIB:                               Particular Programs.
  5019. * libdir:                               Preset Output Variables.
  5020. * libexecdir:                           Preset Output Variables.
  5021. * LIBOBJS <1>:                          Structures.
  5022. * LIBOBJS <1>:                          Generic Functions.
  5023. * LIBOBJS:                              Particular Functions.
  5024. * LIBS <1>:                             UNIX Variants.
  5025. * LIBS:                                 Preset Output Variables.
  5026. * LN_S:                                 Particular Programs.
  5027. * localstatedir:                        Preset Output Variables.
  5028. * mandir:                               Preset Output Variables.
  5029. * NEED_SETGID:                          Particular Functions.
  5030. * oldincludedir:                        Preset Output Variables.
  5031. * prefix:                               Preset Output Variables.
  5032. * program_transform_name:               Transforming Names.
  5033. * RANLIB:                               Particular Programs.
  5034. * sbindir:                              Preset Output Variables.
  5035. * SET_MAKE:                             Output.
  5036. * sharedstatedir:                       Preset Output Variables.
  5037. * srcdir:                               Preset Output Variables.
  5038. * subdirs:                              Subdirectories.
  5039. * sysconfdir:                           Preset Output Variables.
  5040. * target:                               System Type Variables.
  5041. * target_alias:                         System Type Variables.
  5042. * target_cpu:                           System Type Variables.
  5043. * target_os:                            System Type Variables.
  5044. * target_vendor:                        System Type Variables.
  5045. * top_srcdir:                           Preset Output Variables.
  5046. * X_CFLAGS:                             System Services.
  5047. * X_EXTRA_LIBS:                         System Services.
  5048. * X_LIBS:                               System Services.
  5049. * X_PRE_LIBS:                           System Services.
  5050. * YACC:                                 Particular Programs.
  5051.  
  5052. 
  5053. File: autoconf.info,  Node: Preprocessor Symbol Index,  Next: Macro Index,  Prev: Output Variable Index,  Up: Top
  5054.  
  5055. Preprocessor Symbol Index
  5056. *************************
  5057.  
  5058.    This is an alphabetical list of the C preprocessor symbols that the
  5059. Autoconf macros define.  To work with Autoconf, C source code needs to
  5060. use these names in `#if' directives.
  5061.  
  5062. * Menu:
  5063.  
  5064. * __CHAR_UNSIGNED__:                    Compiler Characteristics.
  5065. * _ALL_SOURCE:                          UNIX Variants.
  5066. * _MINIX:                               UNIX Variants.
  5067. * _POSIX_1_SOURCE:                      UNIX Variants.
  5068. * _POSIX_SOURCE:                        UNIX Variants.
  5069. * _POSIX_VERSION:                       Particular Headers.
  5070. * C_ALLOCA:                             Particular Functions.
  5071. * CLOSEDIR_VOID:                        Particular Functions.
  5072. * const:                                Compiler Characteristics.
  5073. * DGUX:                                 Particular Functions.
  5074. * DIRENT:                               Particular Headers.
  5075. * GETGROUPS_T:                          Particular Typedefs.
  5076. * GETLODAVG_PRIVILEGED:                 Particular Functions.
  5077. * GETPGRP_VOID:                         Particular Functions.
  5078. * gid_t:                                Particular Typedefs.
  5079. * HAVE_FUNCTION:                        Generic Functions.
  5080. * HAVE_HEADER:                          Generic Headers.
  5081. * HAVE_ALLOCA_H:                        Particular Functions.
  5082. * HAVE_CONFIG_H:                        Configuration Headers.
  5083. * HAVE_DIRENT_H:                        Particular Headers.
  5084. * HAVE_DOPRNT:                          Particular Functions.
  5085. * HAVE_GETMNTENT:                       Particular Functions.
  5086. * HAVE_LONG_DOUBLE:                     Compiler Characteristics.
  5087. * HAVE_LONG_FILE_NAMES:                 System Services.
  5088. * HAVE_MMAP:                            Particular Functions.
  5089. * HAVE_NDIR_H:                          Particular Headers.
  5090. * HAVE_RESTARTABLE_SYSCALLS:            System Services.
  5091. * HAVE_ST_BLKSIZE:                      Structures.
  5092. * HAVE_ST_BLOCKS:                       Structures.
  5093. * HAVE_ST_RDEV:                         Structures.
  5094. * HAVE_STRCOLL:                         Particular Functions.
  5095. * HAVE_STRFTIME:                        Particular Functions.
  5096. * HAVE_SYS_DIR_H:                       Particular Headers.
  5097. * HAVE_SYS_NDIR_H:                      Particular Headers.
  5098. * HAVE_SYS_WAIT_H:                      Particular Headers.
  5099. * HAVE_TM_ZONE:                         Structures.
  5100. * HAVE_TZNAME:                          Structures.
  5101. * HAVE_UNISTD_H:                        Particular Headers.
  5102. * HAVE_UTIME_NULL:                      Particular Functions.
  5103. * HAVE_VFORK_H:                         Particular Functions.
  5104. * HAVE_VPRINTF:                         Particular Functions.
  5105. * HAVE_WAIT3:                           Particular Functions.
  5106. * inline:                               Compiler Characteristics.
  5107. * INT_16_BITS:                          Compiler Characteristics.
  5108. * LONG_64_BITS:                         Compiler Characteristics.
  5109. * MAJOR_IN_MKDEV:                       Particular Headers.
  5110. * MAJOR_IN_SYSMACROS:                   Particular Headers.
  5111. * mode_t:                               Particular Typedefs.
  5112. * NDIR:                                 Particular Headers.
  5113. * NEED_MEMORY_H:                        Particular Headers.
  5114. * NEED_SETGID:                          Particular Functions.
  5115. * NLIST_NAME_UNION:                     Particular Functions.
  5116. * NLIST_STRUCT:                         Particular Functions.
  5117. * NO_MINUS_C_MINUS_O:                   Particular Programs.
  5118. * off_t:                                Particular Typedefs.
  5119. * pid_t:                                Particular Typedefs.
  5120. * RETSIGTYPE:                           Particular Typedefs.
  5121. * SETVBUF_REVERSED:                     Particular Functions.
  5122. * size_t:                               Particular Typedefs.
  5123. * STDC_HEADERS:                         Particular Headers.
  5124. * SVR4:                                 Particular Functions.
  5125. * SYS_SIGLIST_DECLARED:                 Particular Headers.
  5126. * SYSDIR:                               Particular Headers.
  5127. * SYSNDIR:                              Particular Headers.
  5128. * TIME_WITH_SYS_TIME:                   Structures.
  5129. * TM_IN_SYS_TIME:                       Structures.
  5130. * uid_t:                                Particular Typedefs.
  5131. * UMAX:                                 Particular Functions.
  5132. * UMAX4_3:                              Particular Functions.
  5133. * USG:                                  Particular Headers.
  5134. * vfork:                                Particular Functions.
  5135. * VOID_CLOSEDIR:                        Particular Headers.
  5136. * WORDS_BIGENDIAN:                      Compiler Characteristics.
  5137. * YYTEXT_POINTER:                       Particular Programs.
  5138.  
  5139. 
  5140. File: autoconf.info,  Node: Macro Index,  Prev: Preprocessor Symbol Index,  Up: Top
  5141.  
  5142. Macro Index
  5143. ***********
  5144.  
  5145.    This is an alphabetical list of the Autoconf macros.  To make the
  5146. list easier to use, the macros are listed without their preceding `AC_'.
  5147.  
  5148. * Menu:
  5149.  
  5150. * AIX:                                  UNIX Variants.
  5151. * ALLOCA:                               Old Macro Names.
  5152. * ARG_ARRAY:                            Old Macro Names.
  5153. * ARG_ENABLE:                           Package Options.
  5154. * ARG_PROGRAM:                          Transforming Names.
  5155. * ARG_WITH:                             External Software.
  5156. * BEFORE:                               Suggested Ordering.
  5157. * C_BIGENDIAN:                          Compiler Characteristics.
  5158. * C_CHAR_UNSIGNED:                      Compiler Characteristics.
  5159. * C_CONST:                              Compiler Characteristics.
  5160. * C_CROSS:                              Test Programs.
  5161. * C_INLINE:                             Compiler Characteristics.
  5162. * C_LONG_DOUBLE:                        Compiler Characteristics.
  5163. * CACHE_CHECK:                          Caching Results.
  5164. * CACHE_VAL:                            Caching Results.
  5165. * CANONICAL_HOST:                       Canonicalizing.
  5166. * CANONICAL_SYSTEM:                     Canonicalizing.
  5167. * CHAR_UNSIGNED:                        Old Macro Names.
  5168. * CHECK_FUNC:                           Generic Functions.
  5169. * CHECK_FUNCS:                          Generic Functions.
  5170. * CHECK_HEADER:                         Generic Headers.
  5171. * CHECK_HEADERS:                        Generic Headers.
  5172. * CHECK_LIB:                            Libraries.
  5173. * CHECK_PROG:                           Generic Programs.
  5174. * CHECK_PROGS:                          Generic Programs.
  5175. * CHECK_SIZEOF:                         Compiler Characteristics.
  5176. * CHECK_TOOL:                           Generic Programs.
  5177. * CHECK_TYPE:                           Generic Typedefs.
  5178. * CHECKING:                             Printing Messages.
  5179. * COMPILE_CHECK:                        Examining Libraries.
  5180. * CONFIG_AUX_DIR:                       Input.
  5181. * CONFIG_HEADER:                        Configuration Headers.
  5182. * CONFIG_SUBDIRS:                       Subdirectories.
  5183. * CONST:                                Old Macro Names.
  5184. * CROSS_CHECK:                          Old Macro Names.
  5185. * DECL_SYS_SIGLIST:                     Particular Headers.
  5186. * DECL_YYTEXT:                          Particular Programs.
  5187. * DEFINE:                               Defining Symbols.
  5188. * DEFINE_UNQUOTED:                      Defining Symbols.
  5189. * DEFUN:                                Macro Definitions.
  5190. * DIR_HEADER:                           Particular Headers.
  5191. * DYNIX_SEQ:                            UNIX Variants.
  5192. * EGREP_CPP:                            Examining Declarations.
  5193. * EGREP_HEADER:                         Examining Declarations.
  5194. * ENABLE:                               Package Options.
  5195. * ERROR:                                Old Macro Names.
  5196. * FIND_X:                               Old Macro Names.
  5197. * FIND_XTRA:                            Old Macro Names.
  5198. * FUNC_ALLOCA:                          Particular Functions.
  5199. * FUNC_CHECK:                           Old Macro Names.
  5200. * FUNC_CLOSEDIR_VOID:                   Particular Functions.
  5201. * FUNC_GETLOADAVG:                      Particular Functions.
  5202. * FUNC_GETMNTENT:                       Particular Functions.
  5203. * FUNC_GETPGRP:                         Particular Functions.
  5204. * FUNC_MEMCMP:                          Particular Functions.
  5205. * FUNC_MMAP:                            Particular Functions.
  5206. * FUNC_SETVBUF_REVERSED:                Particular Functions.
  5207. * FUNC_STRCOLL:                         Particular Functions.
  5208. * FUNC_STRFTIME:                        Particular Functions.
  5209. * FUNC_UTIME_NULL:                      Particular Functions.
  5210. * FUNC_VFORK:                           Particular Functions.
  5211. * FUNC_VPRINTF:                         Particular Functions.
  5212. * FUNC_WAIT3:                           Particular Functions.
  5213. * GCC_TRADITIONAL:                      Old Macro Names.
  5214. * GETGROUPS_T:                          Old Macro Names.
  5215. * GETLOADAVG:                           Old Macro Names.
  5216. * HAVE_FUNCS:                           Old Macro Names.
  5217. * HAVE_HEADERS:                         Old Macro Names.
  5218. * HAVE_LIBRARY:                         Libraries.
  5219. * HAVE_POUNDBANG:                       Old Macro Names.
  5220. * HEADER_CHECK:                         Old Macro Names.
  5221. * HEADER_DIRENT:                        Particular Headers.
  5222. * HEADER_EGREP:                         Old Macro Names.
  5223. * HEADER_MAJOR:                         Particular Headers.
  5224. * HEADER_STAT:                          Structures.
  5225. * HEADER_STDC:                          Particular Headers.
  5226. * HEADER_SYS_WAIT:                      Particular Headers.
  5227. * HEADER_TIME:                          Structures.
  5228. * INIT:                                 Input.
  5229. * INLINE:                               Old Macro Names.
  5230. * INT_16_BITS:                          Compiler Characteristics.
  5231. * IRIX_SUN:                             UNIX Variants.
  5232. * ISC_POSIX:                            UNIX Variants.
  5233. * LANG_C:                               Language Choice.
  5234. * LANG_CPLUSPLUS:                       Language Choice.
  5235. * LANG_RESTORE:                         Language Choice.
  5236. * LANG_SAVE:                            Language Choice.
  5237. * LINK_FILES:                           Using System Type.
  5238. * LN_S:                                 Old Macro Names.
  5239. * LONG_64_BITS:                         Compiler Characteristics.
  5240. * LONG_DOUBLE:                          Old Macro Names.
  5241. * LONG_FILE_NAMES:                      Old Macro Names.
  5242. * MAJOR_HEADER:                         Old Macro Names.
  5243. * MEMORY_H:                             Particular Headers.
  5244. * MINIX:                                UNIX Variants.
  5245. * MINUS_C_MINUS_O:                      Old Macro Names.
  5246. * MMAP:                                 Old Macro Names.
  5247. * MODE_T:                               Old Macro Names.
  5248. * MSG_CHECKING:                         Printing Messages.
  5249. * MSG_ERROR:                            Printing Messages.
  5250. * MSG_RESULT:                           Printing Messages.
  5251. * MSG_WARN:                             Printing Messages.
  5252. * OBSOLETE:                             Obsolete Macros.
  5253. * OFF_T:                                Old Macro Names.
  5254. * OUTPUT:                               Output.
  5255. * PATH_PROG:                            Generic Programs.
  5256. * PATH_PROGS:                           Generic Programs.
  5257. * PATH_X:                               System Services.
  5258. * PATH_XTRA:                            System Services.
  5259. * PID_T:                                Old Macro Names.
  5260. * PREFIX:                               Old Macro Names.
  5261. * PREFIX_PROGRAM:                       Default Prefix.
  5262. * PREREQ:                               Versions.
  5263. * PROG_AWK:                             Particular Programs.
  5264. * PROG_CC:                              Particular Programs.
  5265. * PROG_CC_C_O:                          Particular Programs.
  5266. * PROG_CPP:                             Particular Programs.
  5267. * PROG_CXX:                             Particular Programs.
  5268. * PROG_CXXCPP:                          Particular Programs.
  5269. * PROG_GCC_TRADITIONAL:                 Particular Programs.
  5270. * PROG_INSTALL:                         Particular Programs.
  5271. * PROG_LEX:                             Particular Programs.
  5272. * PROG_LN_S:                            Particular Programs.
  5273. * PROG_MAKE_SET:                        Output.
  5274. * PROG_RANLIB:                          Particular Programs.
  5275. * PROG_YACC:                            Particular Programs.
  5276. * PROGRAM_CHECK:                        Old Macro Names.
  5277. * PROGRAM_EGREP:                        Old Macro Names.
  5278. * PROGRAM_PATH:                         Old Macro Names.
  5279. * PROGRAMS_CHECK:                       Old Macro Names.
  5280. * PROGRAMS_PATH:                        Old Macro Names.
  5281. * PROVIDE:                              Prerequisite Macros.
  5282. * REMOTE_TAPE:                          Old Macro Names.
  5283. * REPLACE_FUNCS:                        Generic Functions.
  5284. * REQUIRE:                              Prerequisite Macros.
  5285. * REQUIRE_CPP:                          Language Choice.
  5286. * RESTARTABLE_SYSCALLS:                 Old Macro Names.
  5287. * RETSIGTYPE:                           Old Macro Names.
  5288. * REVISION:                             Versions.
  5289. * RSH:                                  Old Macro Names.
  5290. * SCO_INTL:                             UNIX Variants.
  5291. * SET_MAKE:                             Old Macro Names.
  5292. * SETVBUF_REVERSED:                     Old Macro Names.
  5293. * SIZE_T:                               Old Macro Names.
  5294. * SIZEOF_TYPE:                          Old Macro Names.
  5295. * ST_BLKSIZE:                           Old Macro Names.
  5296. * ST_BLOCKS:                            Old Macro Names.
  5297. * ST_RDEV:                              Old Macro Names.
  5298. * STAT_MACROS_BROKEN <1>:               Old Macro Names.
  5299. * STAT_MACROS_BROKEN:                   Structures.
  5300. * STDC_HEADERS:                         Old Macro Names.
  5301. * STRCOLL:                              Old Macro Names.
  5302. * STRUCT_ST_BLKSIZE:                    Structures.
  5303. * STRUCT_ST_BLOCKS:                     Structures.
  5304. * STRUCT_ST_RDEV:                       Structures.
  5305. * STRUCT_TIMEZONE:                      Structures.
  5306. * STRUCT_TM:                            Structures.
  5307. * SUBST:                                Setting Output Variables.
  5308. * SUBST_FILE:                           Setting Output Variables.
  5309. * SYS_INTERPRETER:                      System Services.
  5310. * SYS_LONG_FILE_NAMES:                  System Services.
  5311. * SYS_RESTARTABLE_SYSCALLS:             System Services.
  5312. * SYS_SIGLIST_DECLARED:                 Old Macro Names.
  5313. * TEST_CPP:                             Old Macro Names.
  5314. * TEST_PROGRAM:                         Old Macro Names.
  5315. * TIME_WITH_SYS_TIME:                   Old Macro Names.
  5316. * TIMEZONE:                             Old Macro Names.
  5317. * TRY_COMPILE:                          Examining Syntax.
  5318. * TRY_CPP:                              Examining Declarations.
  5319. * TRY_LINK:                             Examining Libraries.
  5320. * TRY_RUN:                              Test Programs.
  5321. * TYPE_GETGROUPS:                       Particular Typedefs.
  5322. * TYPE_MODE_T:                          Particular Typedefs.
  5323. * TYPE_OFF_T:                           Particular Typedefs.
  5324. * TYPE_PID_T:                           Particular Typedefs.
  5325. * TYPE_SIGNAL:                          Particular Typedefs.
  5326. * TYPE_SIZE_T:                          Particular Typedefs.
  5327. * TYPE_UID_T:                           Particular Typedefs.
  5328. * UID_T:                                Old Macro Names.
  5329. * UNISTD_H:                             Particular Headers.
  5330. * USG:                                  Particular Headers.
  5331. * UTIME_NULL:                           Old Macro Names.
  5332. * VERBOSE:                              Printing Messages.
  5333. * VFORK:                                Old Macro Names.
  5334. * VPRINTF:                              Old Macro Names.
  5335. * WAIT3:                                Old Macro Names.
  5336. * WARN:                                 Old Macro Names.
  5337. * WITH:                                 External Software.
  5338. * WORDS_BIGENDIAN:                      Old Macro Names.
  5339. * XENIX_DIR:                            UNIX Variants.
  5340. * YYTEXT_POINTER:                       Old Macro Names.
  5341.  
  5342.  
  5343. 
  5344. Tag Table:
  5345. Node: Top1177
  5346. Node: Introduction9316
  5347. Node: Making configure Scripts13156
  5348. Node: Writing configure.in16221
  5349. Node: Invoking autoscan19921
  5350. Node: Invoking ifnames22226
  5351. Node: Invoking autoconf23716
  5352. Node: Invoking autoreconf25554
  5353. Node: Setup27874
  5354. Node: Input28760
  5355. Node: Output30483
  5356. Node: Makefile Substitutions33233
  5357. Node: Preset Output Variables34817
  5358. Node: Build Directories39319
  5359. Node: Automatic Remaking40952
  5360. Node: Configuration Headers43038
  5361. Node: Header Templates45405
  5362. Node: Invoking autoheader46584
  5363. Node: Subdirectories49732
  5364. Node: Default Prefix51075
  5365. Node: Versions52479
  5366. Node: Existing Tests54383
  5367. Node: Alternative Programs55848
  5368. Node: Particular Programs56512
  5369. Node: Generic Programs62362
  5370. Node: Libraries65188
  5371. Node: Library Functions67017
  5372. Node: Particular Functions67575
  5373. Node: Generic Functions73878
  5374. Node: Header Files75721
  5375. Node: Particular Headers76280
  5376. Node: Generic Headers83251
  5377. Node: Structures84553
  5378. Node: Typedefs86790
  5379. Node: Particular Typedefs87294
  5380. Node: Generic Typedefs88494
  5381. Node: Compiler Characteristics88937
  5382. Node: System Services91562
  5383. Node: UNIX Variants93911
  5384. Node: Writing Tests95930
  5385. Node: Examining Declarations97896
  5386. Node: Examining Syntax100366
  5387. Node: Examining Libraries101423
  5388. Node: Run Time103982
  5389. Node: Test Programs104943
  5390. Node: Guidelines107480
  5391. Node: Test Functions108669
  5392. Node: Portable Shell110212
  5393. Node: Testing Values and Files112144
  5394. Node: Multiple Cases113799
  5395. Node: Language Choice114997
  5396. Node: Results116555
  5397. Node: Defining Symbols117314
  5398. Node: Setting Output Variables120323
  5399. Node: Caching Results122169
  5400. Node: Cache Variable Names124450
  5401. Node: Cache Files125999
  5402. Node: Printing Messages128097
  5403. Node: Writing Macros131384
  5404. Node: Macro Definitions132003
  5405. Node: Macro Names133108
  5406. Node: Quoting135559
  5407. Node: Dependencies Between Macros137461
  5408. Node: Prerequisite Macros138093
  5409. Node: Suggested Ordering139548
  5410. Node: Obsolete Macros141078
  5411. Node: Manual Configuration142302
  5412. Node: Specifying Names143201
  5413. Node: Canonicalizing145073
  5414. Node: System Type Variables146387
  5415. Node: Using System Type147134
  5416. Node: Site Configuration148581
  5417. Node: External Software149354
  5418. Node: Package Options152052
  5419. Node: Site Details154319
  5420. Node: Transforming Names155542
  5421. Node: Transformation Options156720
  5422. Node: Transformation Examples157186
  5423. Node: Transformation Rules158754
  5424. Node: Site Defaults160163
  5425. Node: Invoking configure163947
  5426. Node: Basic Installation164896
  5427. Node: Compilers and Options167476
  5428. Node: Multiple Architectures168125
  5429. Node: Installation Names169111
  5430. Node: Optional Features170295
  5431. Node: System Type171065
  5432. Node: Sharing Defaults172087
  5433. Node: Operation Controls172711
  5434. Node: Invoking config.status173586
  5435. Node: Questions176974
  5436. Node: Distributing177506
  5437. Node: Why GNU m4178632
  5438. Node: Bootstrapping179445
  5439. Node: Why Not Imake180061
  5440. Node: Upgrading184470
  5441. Node: Changed File Names185991
  5442. Node: Changed Makefiles186727
  5443. Node: Changed Macros187823
  5444. Node: Invoking autoupdate189070
  5445. Node: Changed Results190661
  5446. Node: Changed Macro Writing192763
  5447. Node: History194026
  5448. Node: Genesis194733
  5449. Node: Exodus195906
  5450. Node: Leviticus198955
  5451. Node: Numbers200478
  5452. Node: Deuteronomy202394
  5453. Node: Old Macro Names205058
  5454. Node: Environment Variable Index208107
  5455. Node: Output Variable Index209109
  5456. Node: Preprocessor Symbol Index213792
  5457. Node: Macro Index218607
  5458. 
  5459. End Tag Table
  5460.