3. Changes in libtool releases

3.1. libtool 2.2

The 2.2 series of libtool is a major overhaul and partial rewrite over the previous, widely adopted 1.5 series. Featuring an only partially compatible libltdl, this version introduced new macro names for initialisation and configuration, as well as new, slimmed down macro files, and smarter checks.

The number of problems related to porting to libtool 2.2 is quite high and some do require builder attention.

3.1.1. The C++ and Fortran support

Before libtool 2.2, as soon as a project started using the support provided by this package, checks for C++ and Fortran compilers were added. These checks, lengthy, and pointless for C-only projects, often caused grief to the point that many different hacks, using M4 directives, were used and suggested between different guides.

With the new release series, this problem has been solved, LT_INIT now only checks for the actual compilers as declared by the project itself. While this works for most projects, there are a few where this caused further problems, and further grief.

The problem appears evident when building packages written in C++ (but Fortran is mostly the same) that don't check for the proper compiler, since the automake execution will start reporting problems that “am__fastdepCXX does not appear in AM_CONDITIONAL”:

% automake --add-missing --copy --foreign
/usr/share/automake-1.10/am/depend2.am: am__fastdepCXX does not appear in AM_CONDITIONAL
/usr/share/automake-1.10/am/depend2.am:   The usual way to define `am__fastdepCXX' is to add `AC_PROG_CXX'
/usr/share/automake-1.10/am/depend2.am:   to `configure.ac' and run `aclocal' and `autoconf' again.
cjeca32/Makefile.am: C++ source seen but `CXX' is undefined
cjeca32/Makefile.am:   The usual way to define `CXX' is to add `AC_PROG_CXX'
cjeca32/Makefile.am:   to `configure.ac' and run `autoconf' again.

The main problem here is that the error (divided in two parts) is actually meaningful only in the second part, for most people, since the first three lines sound like gibberish for the common users.

The second part of the error actually tells you exactly what to do: adding AC_PROG_CXX to configure.ac; even better, before the initialisation call.

Example 5.2. Properly Fix missing C++ support with libtool 2.2

dnl configure.ac
AC_INIT
AM_INIT_AUTOMAKE

dnl add this
AC_PROG_CXX

AC_PROG_LIBTOOL

Please note here, that the function AC_PROG_LIBTOOL in this snipped is the deprecated 1.5-compatible form of LT_INIT. Since the error shown above happens during porting to libtool 2.2, it's unlikely that the new form is found.