LinuxCommandLibrary

autoconf

Create portable software configuration scripts

TLDR

Generate a configuration script from configure.ac (if present) or configure.in and save this script to configure

$ autoconf
copy

Generate a configuration script from the specified template; output to stdout
$ autoconf [template-file]
copy

Generate a configuration script from the specified template (even if the input file has not changed) and write the output to a file
$ autoconf [[-f|--force]] [[-o|--output]] [outfile] [template-file]
copy

SYNOPSIS

autoconf [OPTION]... [TEMPLATE[.in]]

PARAMETERS

-h, --help
    Print help message and exit

-V, --version
    Print version information and exit

-v, --verbose
    Enable verbose output

-q, --quiet
    Suppress warnings and progress messages

-f, --force
    Overwrite output file if it exists

-o OUTPUT
    Specify output file name

-l DIR
    Prepend DIR to macro search directories

-I DIR
    Add DIR to macro include path

--trace[=MACRO]
    Enable macro tracing for debugging

--warnings=CATEGORY
    Control warning categories (e.g., all, none, error)

DESCRIPTION

autoconf is a tool from the GNU Autotools suite used to create portable configure scripts for software packages.

It processes a configure.ac (or legacy configure.in) input file, which defines macros for feature tests, compiler checks, and library detection. Using the m4 macro processor, autoconf expands these macros into a full shell script that probes the build environment, determines system-specific settings, and generates Makefiles via Makefile.in templates.

This enables software to build across Unix-like systems (Linux, BSD, Solaris) without manual porting. Developers write high-level declarations like AC_CHECK_HEADERS([stdio.h]), and autoconf produces robust tests for headers, functions, types, and libraries.

Typically invoked after autoscan or autoreconf, it outputs configure, which users run with ./configure --prefix=/usr. Widely used in open-source projects, though modern alternatives like CMake reduce reliance on it.

CAVEATS

Generates large, slow configure scripts; requires GNU m4; deprecated for new projects in favor of CMake or Meson; output not portable to non-POSIX shells.

TYPICAL WORKFLOW

1. Write configure.ac.
2. Run autoconf to generate configure.
3. Run ./configure & make.

DEPENDENCIES

Requires GNU m4 (version 1.4+); often used with automake and libtool.

HISTORY

Developed in 1991 by David J. MacKenzie and Roland McGrath for GNU; evolved with Autotools for cross-platform builds; version 2.13 (2002) introduced configure.ac; current 2.71 (2023) focuses on stability.

SEE ALSO

autoreconf(1), autoheader(1), automake(1), aclocal(1), m4(1)

Copied to clipboard