manpagez: man pages & more
info autoconf
Home | html | info | man

File: autoconf.info,  Node: Making configure Scripts,  Next: Setup,  Prev: The GNU Build System,  Up: Top

3 Making ‘configure’ Scripts
****************************

The configuration scripts that Autoconf produces are by convention
called ‘configure’.  When run, ‘configure’ creates several files,
replacing configuration parameters in them with appropriate values.  The
files that ‘configure’ creates are:

   − one or more ‘Makefile’ files, usually one in each subdirectory of
     the package (*note Makefile Substitutions::);

   − optionally, a C header file, the name of which is configurable,
     containing ‘#define’ directives (*note Configuration Headers::);

   − a shell script called ‘config.status’ that, when run, recreates the
     files listed above (*note config.status Invocation::);

   − an optional shell script normally called ‘config.cache’ (created
     when using ‘configure --config-cache’) that saves the results of
     running many of the tests (*note Cache Files::);

   − a file called ‘config.log’ containing any messages produced by
     compilers, to help debugging if ‘configure’ makes a mistake.

   To create a ‘configure’ script with Autoconf, you need to write an
Autoconf input file ‘configure.ac’ and run ‘autoconf’ on it.  If you
write your own feature tests to supplement those that come with
Autoconf, you might also write files called ‘aclocal.m4’ and
‘acsite.m4’.  If you use a C header file to contain ‘#define’
directives, you might also run ‘autoheader’, and you can distribute the
generated file ‘config.h.in’ with the package.

   Here is a diagram showing how the files that can be used in
configuration are produced.  Programs that are executed are suffixed by
‘*’.  Optional files are enclosed in square brackets (‘[]’).  ‘autoconf’
and ‘autoheader’ also read the installed Autoconf macro files (by
reading ‘autoconf.m4’).

Files used in preparing a software package for distribution, when using
just Autoconf:
     your source files --> [autoscan*] --> [configure.scan] --> configure.ac

     configure.ac --.
                    |   .------> autoconf* -----> configure
     [aclocal.m4] --+---+
                    |   `-----> [autoheader*] --> [config.h.in]
     [acsite.m4] ---'

     Makefile.in

Additionally, if you use Automake, the following additional productions
come into play:

     [acinclude.m4] --.
                      |
     [local macros] --+--> aclocal* --> aclocal.m4
                      |
     configure.ac ----'

     configure.ac --.
                    +--> automake* --> Makefile.in
     Makefile.am ---'

Files used in configuring a software package:
                            .-------------> [config.cache]
     configure* ------------+-------------> config.log
                            |
     [config.h.in] -.       v            .-> [config.h] -.
                    +--> config.status* -+               +--> make*
     Makefile.in ---'                    `-> Makefile ---'

* Menu:

* Writing Autoconf Input::      What to put in an Autoconf input file
* autoscan Invocation::         Semi-automatic ‘configure.ac’ writing
* ifnames Invocation::          Listing the conditionals in source code
* autoconf Invocation::         How to create configuration scripts
* autoreconf Invocation::       Remaking multiple ‘configure’ scripts

© manpagez.com 2000-2025
Individual documents may contain additional copyright information.