How to quickly bootstrap an Autotools project
Table of Contents
sh autogen.sh && configure && make install
It’s 2025… why would I do that? #
If you are asking yourself this, then… probably Autotools isn’t the right build system for your project 😁.
Let’s be honest; the GNU Build System aka Autotools is old, slow and quirky (but not as much its reputation suggests). Why then?
One word: portability. Autotools is still the choice when you need a build system that works across a wide range of operating systems and platforms, including - especially - obscure UNIX variants and unusual hardware architectures.
So, if none of the above applies (lucky you!), take a look at alternatives such as CMake, Bazel, Meson, Xmake, Build2 etc.
With that out of the way, let’s get started. We will use a very minimalistic autotools skeleton I use for all my projects:
Steps #
1. Clone the autotools-skeleton
repository #
git clone https://github.com/msune/autotools-skeleton my_project
cd my-project
rm .git -rf
2. Verify #
mkdir build
sh autogen.sh
cd build && ../configure
make
sudo make install
You should now be able to run the test binary my_program
(usually installed
under /usr/local/bin
).
sudo make uninstall
.3. Edit configure.ac
#
Modify the AC_INIT()
macro in configure.ac
with the information of your
project:
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,6 @@
m4_include([VERSION]) #Force reconf on VERSION change
-AC_INIT(MY_PROJECT, m4_esyscmd_s(cat VERSION), john@doe.com, MyProject, http://github.com/msune/autotools-skeleton)
+AC_INIT(COOL_PROJECT, m4_esyscmd_s(cat VERSION), bugs-project@cool.io, CoolProject, http://github.com/cool/project)
4. Add your code #
Add your code, track it (see .gitignore
),
and modify Makefile.am
s and directories for your project structure.
This puff isn’t meant to be a full introduction to Autotools, but the project has examples on how to:
- work with libtool libraries in subdirectories (noinst_lib), and set them as dependencies.
- distribute binaries that depend on libtool libraries.
- distribute libraries and headers.
Next #
Some useful links:
Keep on hacking!