Skip to content
Latchkey

autoconf: Usage, Options & Common CI Errors

autoconf turns configure.ac into a portable configure shell script.

autoconf is the front of the GNU Autotools chain. In CI you usually run autoreconf to regenerate the whole build, and the recurring failure is a missing macro package (like pkg.m4 or libtool) that leaves "possibly undefined macro" in the log.

What it does

autoconf processes configure.ac (using m4 macros) to produce a portable configure script that probes the build host for compilers, headers, and libraries. It is typically driven by autoreconf, which also runs aclocal, automake, and libtoolize as needed.

Common usage

Terminal
autoreconf -fi                     # regenerate everything
autoconf                           # configure.ac -> configure
./configure --prefix=/usr/local
aclocal && autoconf                # refresh macros then generate
autoreconf --install --verbose

Options

Command / flagWhat it does
autoreconf -fiForce-rebuild + install missing aux files
--install / -iCopy missing auxiliary scripts
--force / -fRegenerate even if up to date
aclocalGather m4 macros into aclocal.m4
./configure --prefixRun the generated script

Common errors in CI

"configure.ac:NN: error: possibly undefined macro: AC_MSG_ERROR" (or PKG_CHECK_MODULES) means a macro package is not installed - install pkg-config/pkg.m4, libtool, or gettext and re-run autoreconf -fi. "aclocal: command not found" - install automake (it ships aclocal). "autoreconf: ‘configure.ac’ is required" - wrong directory. Always run autoreconf -fi in CI rather than relying on a committed (possibly stale) configure.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →