LinuxCommandLibrary

aclocal

Find and copy Autoconf M4 macros

SYNOPSIS

aclocal [OPTION]... [configure.ac|configure.in]

PARAMETERS

--help
    display this help message and exit

--version
    print version information and exit

--print-ac-dir
    print standard aclocal data file directory

-I DIR, --acdir=DIR
    add directory DIR to search list for m4 files

--install[=DIR]
    install required m4 files (optionally to DIR)

--force
    overwrite aclocal.m4 even if newer than inputs

--dry-run
    print actions without modifying files

--warnings[=CATEGORY]
    enable warnings in specified CATEGORY (e.g., all, gnu, obsolete)

--output=FILE
    write output to FILE instead of aclocal.m4

--verbose[=N]
    set verbosity level to N (0-4)

--diff[=COMMAND]
    compare changes using COMMAND (default: diff -u)

--what-if=SCRIPT
    assume SCRIPT (e.g., automake) has been run

DESCRIPTION

The aclocal command is a key component of the GNU Autotools suite, used to generate the aclocal.m4 file from configure.ac or configure.in scripts. It scans these input files for m4 macro invocations, locates the corresponding macro definitions in specified directories (via -I), and assembles them into a single aclocal.m4 file. This consolidated file is then included by autoconf during the generation of the configure script, ensuring all required macros are available without external dependencies.

aclocal supports a macro search path, defaulting to system directories like /usr/share/aclocal, and user-specified paths. It handles macro copying or symlinking, with options to install missing macros or force regeneration. This tool simplifies portable build systems by automating macro distribution, avoiding manual maintenance of macro files. Commonly invoked via autoreconf in projects using Automake, it enables cross-platform compilation by standardizing macro handling.

Usage typically follows editing configure.ac: run aclocal, then autoconf and automake. It outputs warnings for undefined macros or version mismatches, promoting robust build configurations.

CAVEATS

Do not edit aclocal.m4 manually; regenerate with aclocal. Requires consistent macro versions across directories. May fail if m4 files have conflicts.

TYPICAL WORKFLOW

Run autoreconf -fiv to invoke aclocal automatically after changes to configure.ac.

SEARCH PATH

Defaults include $(datadir)/aclocal; override with ACLOCAL_PATH env var or -I.

HISTORY

Introduced in 1994 with GNU Automake 1.0 as a companion to autoconf. Evolved through Automake versions (current ~1.16), adding features like macro installation and warnings. Integral to Autotools since the mid-1990s for standardizing open-source builds.

SEE ALSO

Copied to clipboard