Git and Autotools – a hate relation?
For a project where I contribute I started to rewrite the build system using autotools (autoconf/automake), since this is one of the most popular build systems as far as I know. The actual conversion turned out to be not too complicated. But it turned out that in modern world of git(hub), it seems that the autotools have lost their place.
Source of all the problems is the dreaded
WARNING: 'aclocal-1.16' is missing on your system. You should only need it if you modified 'acinclude.m4' or 'configure.ac' or m4 files included by 'configure.ac'.
which, when you search for it, appears all over projects hosted on some instance of git. The reason is rather simple: git does not preserve timestamps, and autotools try to rebuild each and everything from the most basic files upward if there is a timestamp squeeze.
Consequences of this PITA is that:
- Every developer needs to install the whole autotools stack, and before running anything always has to do a
- github generated tarballs might have arbitrary time stamps, so release management via git tags is borken, and users who want to install the software package might see the same errors
The best answer I have found to this problem is to use the
make dist generated tarballs and replace the github generated ones with the home-generated ones. Not an optimal solution that is purely git based.
Another option that seems to work is mentioned here: enable maintainer mode by adding
configure.ac. This is discouraged in the automake manual. But then, the automake manual’s only reference to a VCS is CVS – which is, well, slightly outdated nowadays.
If anyone has a working solution that fixes the above two problems I would be grateful to hear about it.
So where to go from here in the modern world? The answer is (for me) meson and ninja: no intermediate generation of files, no generated files that are necessary for distribution (
Makefile.in), no bunch of maintainer mode, distribution mode, extra complicated targets, readable source files, … For the named project I also created a meson/ninja build system and it turned out to be much easier to handle.
The other path I could take (and actually implemented) is dropping automake, and only use autoconf to build
Makefile from a pre-made
Makefile.in, without the
Makefile.am. This is in our case where there is no need for
Makefile.am probably the approach best when one wants to use autotools.
Bottomline for me: give up on automake if you want to use git – either meson/ninja or autoconf only.