I looked around quite a bit before jimmying together this autogen.sh for autoconfiscating a project at work:
#!/bin/sh set -x autoscan libtoolize --automake --copy aclocal autoconf autoheader automake --foreign --add-missing --copy
The point of autoscan is to catch any new portability problems as they crop up.
To go with autogen.sh, here is a starter configure.in:
C_PREREQ(2.59) AC_INIT([aproject], [0.0.0], [firstname.lastname@example.org]) AC_CONFIG_SRCDIR([config.h.in]) AC_CONFIG_HEADER([config.h]) AM_INIT_AUTOMAKE AC_CONFIG_FILES([Makefile]) AC_OUTPUT
lib_LTLIBRARIES = libsample.la libsample_la_LDFLAGS = -version-info 0:0:0 libsample_la_SOURCES = sample.cc
It would have saved me considerable effort to begin with starter files such a these. Just plop them into the top-level of your project, and run ./autogen.sh. Correct for errors in the output and look at configure.scan for suggestion for updating configure.in. And update Makefile.am with a real list of your sources.
Rinse, lather, repeat.
UPDATE: With modern autotools installations, an even cleaner starter script:
#!/bin/sh autoscan # show autotools lint autoreconf --install "$@" # add -I dir for local M4 macros
NB — If you add
-I m4 (for example) to pick up custom M4 macros in the
m4/ directory of your project, remember to update
Makefile.am as well and add to the top:
ACLOCAL_AMFLAGS = -I m4
Unfortunate duplicity, but necessary with current tools (autoconf 2.59 / automake 1.95). See this post for details.