If you encounter a message, “warning: The macro 'AC_PROG_LIBTOOL' is obsolete“, when running an autogen.sh script in a software project which uses GNU Autotools, I may be able to help you understand it. I encountered this message recently, when working on the Freeciv codebase. In short, this message misled me greatly. What it is really saying is that you should replace the macro name 'AC_PROG_LIBTOOL' with the newer name 'LT_INIT'. Because I had a hard time finding clear documentation, I wrote this blog post to be alternative documentation for others in this situation.

I encountered this message while working on a codebase, an elderly branch “2_6” of the game Freeciv. This code is written mostly in C, with a complex set of makefiles which are generated by the GNU Autotools suite of Autoconf, Automake, autogen.sh, libtool, and other parts. These tools allow a single codebase to run on many different kinds of computers and operating systems. autogen.sh is a script which calls Autoconf, Automake, and other tools to prepare makefiles which are customised for the computer and OS in which the code finds itself.

In context the message is:
% ../src/autogen.sh --no-configure-run
+ checking for autoconf >= 2.61 ... found 2.71, ok.
+ checking for autoheader >= 2.61 ... found 2.71, ok.
+ checking for automake >= 1.10 ... found 1.16.5, ok.
+ checking for aclocal >= 1.10 ... found 1.16.5, ok.
+ checking for libtoolize >= 1.5.2 ...
You must have libtoolize installed to compile freeciv.
Download the appropriate package for your distribution,
or get the source tarball at ftp://ftp.gnu.org/pub/gnu/libtool/
+ checking for glibtoolize >= 1.5.2 ... found 2.4.6, ok.
+ checking for python3 ... found 3.8.12, ok.
+ checking for xgettext >= 0.14 ... found 0.21, ok.
+ checking for msgfmt >= 0.14 ... found 0.21, ok.
+ running aclocal ...
+ running autoheader ...
+ running glibtoolize ...
glibtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'bootstrap'.
glibtoolize: copying file 'bootstrap/ltmain.sh'
glibtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
glibtoolize: copying file 'm4/libtool.m4'
glibtoolize: copying file 'm4/ltoptions.m4'
glibtoolize: copying file 'm4/ltsugar.m4'
glibtoolize: copying file 'm4/ltversion.m4'
glibtoolize: copying file 'm4/lt~obsolete.m4'
glibtoolize: Consider adding '-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
+ running aclocal for libtool installed files...
+ running autoconf ...
configure.ac:586: warning: The macro 'AC_PROG_LIBTOOL' is obsolete.
configure.ac:586: You should run autoupdate.
m4/libtool.m4:99: AC_PROG_LIBTOOL is expanded from...
configure.ac:586: the top level
+ running automake ...
configure.ac:16: installing 'bootstrap/compile'
configure.ac:81: installing 'bootstrap/missing'
ai/Makefile.am: installing 'bootstrap/depcomp'
+ removing config.cache ...

Now type 'configure' to configure freeciv.

(N.B. if you are following along, use the code in Freeciv’s branch `2_6, preferably at commit d2c36a8.)

The message reads: “The macro ‘AC_PROG_LIBTOOL’ is obsolete”. I interpreted that to mean, “the body of the macro referred to by the name ‘AC_PROG_LIBTOOL’ has obsolete contents”. Running some tool, Autoupdate, should change the body of that macro to have up-to-date contents, and the message would go away. The message, “AC_PROG_LIBTOOL is expanded from… the top level”, said to me that the definition of the macro named AC_PROG_LIBTOOL would be at the top level of the file named “configure.ac”.

Sure enough, the top level of Freeciv’s file “configure.ac”, line 586 and surrounding, reads:

dnl Replace AC_PROG_LIBTOOL with LT_INIT when minimum libtool
dnl version 2.2
m4_ifdef([AM_PROG_AR], [AM_PROG_AR], [AC_CHECK_TOOL([AR], [ar])])

What I see on line 586 is the name “AC_PROG_LIBTOOL”, meaning an invocation of the associated macro. I did not see the definition of the macro which the warning message led me to expect.

Such warning messages bother me. I prefer my projects to compile with zero errors or warning messages. Messages I choose to ignore can hide messages which I want to act on. Most warning messages can be eliminated with reasonable changes, which usually improve the code.

As I write this, I see another interpretation of the message. It could mean, “The macro named ‘AC_PROG_LIBTOOL’ is obsolete, both its name and contents. You should replace usage of this macro with the replacement, LT_INIT, which is provided by Autoconf. The Autoupdate tool will perform this replacement in your script.”

It turns out that another GNU utility, Libtool, supplied the old “AC_PROG_LIBTOOL” macro, and supplies the replacement “LT_INIT” macro. I found only one reference to “AC_PROG_LIBTOOL” in the Libtool documentation, and that was in a section which describes how to use the “LT_INIT” macro.

I wish there was an explanation that AC_PROG_LIBTOOL was an obsolete name, replaced by “LT_INIT”. I wish that some appendix somewhere gave the text of this warning message as search fodder. But as far as I can see, there is not.

The first mention of “LT_INIT” which I could find was in the release notes for GNU Libtool version 1.9b, an alpha release, from an announcement email back in 2004. It included, in its list of new features, this brief item:


AC_LIBTOOL_WIN32_DLL and AC_LIBTOOL_PIC_MODE. Use autoupdate to modernise your configure.ac files after installing this release.

GNU Libtool 1.9b released (alpha release)., email to autotools-announce on 29 Aug 2004.

This feature of Libtool was finally officially released three and a half years later, in March 2008, as part of GNU Libtool 2.2.

I suspect that Libtool did not generate this warning message about the obsolete macro “AC_PROG_LIBTOOL” right away. I imagine it started at some later point. Libtool’s News file, with its release history, does not seem to have any clues. For reference, the current version of Libtool is 2.4.7.

Now we can understand better what the author’s of the Freeciv configure.ac file meant with their comment, “Replace AC_PROG_LIBTOOL with LT_INIT when minimum libtool version 2.2”. (Note: “dnl” marks the following line as a comment.) They obliquely acknowledge that the usage of AC_PROG_LIBTOOL is obsolete. But it seems that branch 2_6 of Freeciv is open to working with Libtool 1.x versions, even though they are more than 14 years old. Later branches of Freeciv apparently require Libtool to be a minimum of version 2.2, and in those branches the configure.ac file uses LT_INIT instead.

So, if you encounter this warning message, what do I advise you to do? First, if you can, modify your script to replace the macro call “AC_PROG_LIBTOOL” with a call to “LT_INIT”. Second, if you cannot or will not (and I think the Freeciv branch 2_6 is in this situation), at least add comments which mention the warning message explicitly. For instance,

dnl We call the obsolete macro AC_PROG_LIBTOOL for backwards 
dnl compatibility with libtool 1.x. Newer libtool versions issue a 
dnl warning, "The macro 'AC_PROG_LIBTOOL' is obsolete. You should run
dnl autoupdate." Live with that; or call macro LT_INIT, and require
dnl libtool 2.2 or later instead.
m4_ifdef([AM_PROG_AR], [AM_PROG_AR], [AC_CHECK_TOOL([AR], [ar])])