Saturday, June 16, 2012

Building autotools from git

For developing GNU software, it is often needed to create the autoconf, automake, and libtool toolchain at the exact version specified, but it's not too hard to build them from source. In my case, I simply did:
  • git clone git://git.sv.gnu.org/autoconf.git
  • git clone git://git.sv.gnu.org/automake.git
  • git clone git://git.sv.gnu.org/libtool.git
And this will let me do a git checkout vN.NN to obtain the specific version of these tools. However, building them from upstream pristine source is different than building from tarball distribution. You will already need a recent version of these autotools to bootstrap the source's build system. Run:
git clean -f -X
will restore the working tree to the pristine condition.

To build autoconf from source:
  • aclocal -I m4 && automake --add-missing && autoconf
  • rm INSTALL
The aclocal -I m4 addresses the following issues:
  • automake complains:
    Makefile.am:40: MAKE_CASE_SENSITIVE does not appear in AM_CONDITIONAL
  • autoconf complains:
    configure.ac:116: error: possibly undefined macro: AC_PROG_GNU_M4
          If this token and others are legitimate, please use m4_pattern_allow.
          See the Autoconf documentation.
    configure.ac:184: error: possibly undefined macro: AC_PROG_MAKE_CASE_SENSITIVE
    
The rm INSTALL addresses the following issue during make, caused by build-aux/missing wanting to overwriting a symlink created by automake --add-missing before, pointing to a system INSTALL file (this would be pretty nasty if you ran make as the same user that installed the automake you used for bootstrapping autoconf, since you would never notice the overwriting).
Making all in .
/bin/sh something/autoconf/build-aux/missing --run makeinfo --no-headers --no-validate --no-split  --plaintext -o something/autoconf/INSTALL \
   something/autoconf/doc/install.texi
something/autoconf/INSTALL: Permission denied
Here are the specific versions of these autotools I needed for binutils:
  • autoconf v2.64, automake v1.11.1
In general, for the autoconf version, look for AC_PREREQ in configure.ac or configure.in; for the automake version, look for AM_AUTOMAKE_VERSION in aclocal.m4.

No comments: