Toolkit: autoscan, autoupdate & Friends
Autoconf and automake ship a set of small helper programs. You will rarely need them every day, but they save hours when you start an Autotools build for existing code, upgrade an old one, or debug what a macro expanded into.
| Tool | Package | Does |
|---|---|---|
autoscan |
autoconf | scans C sources for portability-relevant headers and functions, writes configure.scan as a starting configure.ac |
autoupdate |
autoconf | rewrites obsolete macros in configure.ac to their modern forms |
ifnames |
autoconf | lists the #if/#ifdef identifiers in sources: the HAVE_* macros the code expects |
autoheader |
autoconf | writes config.h.in from configure.ac (run by autoreconf) |
autom4te |
autoconf | the M4 driver with a cache (autom4te.cache/); autoconf --trace uses it |
aclocal |
automake | collects third-party macros into aclocal.m4 |
libtoolize |
libtool | copies libtool's scripts and macros into the project |
autoreconf |
autoconf | runs all of the above in the right order; -v shows what it runs |
config.guess / config.sub |
shipped in build-aux/ |
detect and canonicalise system triplets (x86_64-pc-linux-gnu) |
Starting from existing code: autoscan and ifnames
bash · try it yourself
mkdir -p legacy && cd legacy
cat > main.c <<'SRC'
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/time.h>
#ifdef HAVE_STRLCPY
# define COPY(d, s, n) strlcpy(d, s, n)
#else
# define COPY(d, s, n) (strncpy(d, s, n), d[(n) - 1] = 0)
#endif
int main(void) {
char buf[8]; struct timeval tv;
COPY(buf, "hello world", sizeof buf);
gettimeofday(&tv, NULL);
printf("%s %d\n", buf, access("/", F_OK));
return 0;
}
SRC
autoscan
echo "--- configure.scan"
grep -vE '^#|^