Disclaimer don't get the wrong idea about what you've found here

What appears below are my personal notes I wish were part of my long-term memory but don't always seem to fit. I strive for accuracy and clarity and appreciate feedback. If applying any of this information anywhere, confirm for youself the correctness of your work as what you see below might very well be, albeit unintentionally, incorrect or misleading. These notes are here as an easy reference for myself.

Information worthy of a more formal presentation will appear elsewhere than this "Scratch" area. - ksb


KSB's GNU's autotools notes

Table of Contents

References

Overview

The GNU autotool set (autoconf, automake, libtool, etc.) are a build system for making it easy to build and install programs from a source distribution. The idea is that your user only needs to do:

  $ ./configure
  $ make
  $ make check
  $ make install
to configure, build, test and install the package. This simplicity for the user comes at a great expense to the developer but these tools make it easier to write and distribute portable code. They also encourage following the GNU's Coding Standards which may not be the end all solution but it is at least a coding standard that people who write, build and release very portable have put a lot of thought into.

Commands

This above is in fact, the last of three steps (roughly speaking) - the only one the user of your package will need to do. The first two you (the developer of the package) do. The first is to setup and run autoconf and the second is to setup and run automake.

Commands Described

In (simplified) terms of input/output:

Commands Diagramed

The following diargrams are collected from the (highly recommended) "Goat Book" (Appendix C) which covers the GNU Autotools in complete detail. The programs to run in these diagrams are links into The Goat Book where more details about them can be found. (I've changed these diagrams by using the filename configure.ac rather than the older configure.in and removed references to deprecated files.) The diagrams are listed in the order you would likely run the commands.

user input files   optional input     process          output files
================   ==============     =======          ============

                    acinclude.m4 - - - - -.
                                          V
                                      .-------,
configure.ac ------------------------>|aclocal|
                 {user macro files} ->|       |------> aclocal.m4
                                      `-------'

                    aclocal.m4 - - - - - -.
                                          V
                                     .----------,
configure.ac ----------------------->|autoheader|----> config.h.in
                                     `----------'

user input files   optional input     process          output files
================   ==============     =======          ============

                                     .--------,
                                     |        | - - -> COPYING
                                     |        | - - -> INSTALL
                                     |        |------> install-sh
                                     |        |------> missing
                                     |automake|------> mkinstalldirs
configure.ac ----------------------->|        |
Makefile.am  ----------------------->|        |------> Makefile.in
                                     |        |------> stamp-h.in
                                 .---+        | - - -> config.guess
                                 |   |        | - - -> config.sub
                                 |   `------+-'
                                 |          | - - - -> config.guess
                                 |libtoolize| - - - -> config.sub
                                 |          |--------> ltmain.sh
                                 |          |--------> ltconfig
                                 `----------'

                   aclocal.m4 - - - - - -.
                                         V
                                     .--------,
configure.ac ----------------------->|autoconf|------> configure
                                     `--------'

user input files   optional input     process          output files
================   ==============     =======          ============

                                     .---------,
                   config.site - - ->|         |
                  config.cache - - ->|configure| - - -> config.cache
                                     |         +-,
                                     `-+-------' |
                                       |         |----> config.status
                   config.h.in ------->|config-  |----> config.h
                   Makefile.in ------->|  .status|----> Makefile
                                       |         |----> stamp-h
                                       |         +--,
                                     .-+         |  |
                                     | `------+--'  |
                   ltmain.sh ------->|ltconfig|-------> libtool
                                     |        |     |
                                     `-+------'     |
                                       |config.guess|
                                       | config.sub |
                                       `------------'

Example

The complete sequence of commands you might run as the developer of the package would be:

  $ vi Makefile.in   # Create/edit your the input for configure script.

  $ autoscan         # Done initially and then infrequently to create a configure.scan
                     # which is the starting point for your configure.in file.  Only done
                     # when significant changes are made to your package, safe to do
                     # multiple times.

  $ vi configure.in  # If needed, to incorporate new info from configure.scan.

  $ autoheader       # If needed, to create the config.h.in file as input to configure to
                     # create the config.h which holds all the #defines used in your code
                     # by #ifdef for writing portable code.  configure.in is used as it's
                     # so this only needs to be done if it has changed.

  $ autoconf         # Generate the configure script, from configure.in.

  $ configure        # Generate Makefiles based on your system and Makefile.in

  $ make             # Build from the Makefiles


Keith S. Beattie is responsible for this document, located at http://dst.lbl.gov/~ksb/Scratch/autotools.html, which is subject to LBNL's Privacy & Security Notice, Copyright Status and Disclaimers.

Last Modified: Monday, 25-Feb-2013 16:57:57 PST