Autoconf, Automake, and Libtool: Using libtoolize

| ## 11.3 Using libtoolize Having made the necessary editions in ``configure.in'` and ``Makefile.am'`, all that remains is to add the Libtool infrastructure to your project. First of all you must ensure that the correct definitions for the new macros you use in ``configure.in'` are added to ``aclocal.m4'`, See section C. Generated File Dependencies. At the moment, the safest way to do this is to copy ``libtool.m4'` from the installed `libtool` to ``acinclude.m4'` in the toplevel source directory of your package. This is to ensure that when your package ships, there will be no mismatch errors between the M4 macros you provided in the version of `libtool` you built the distribution with, versus the version of the Libtool installation in another developer's environment. In a future release, `libtool` will check that the macros in aclocal.m4 are from the same Libtool distribution as the generated `libtool` script.
    $ cp /usr/share/libtool/libtool.m4 ./acinclude.m4
    $ aclocal
By naming the file ``acinclude.m4'` you ensure that `aclocal` can see it and will use macros from it, and that `automake` will add it to the distribution when you create the tarball. Next, you should run `libtoolize`, which adds some files to your distribution that are required by the macros from ``libtool.m4'`. In particular, you will get ``ltconfig'`(20) and ``ltmain.sh'` which are used to create a custom `libtool` script on the installer's machine. If you do not yet have them, `libtoolize` will also add ``config.guess'` and ``config.sub'` to your distribution. Sometimes you don't need to run `libtoolize` manually, since `automake` will run it for you when it sees the changes you have made to ``configure.in'`, as follows:
    $ automake --add-missing
    automake: configure.in: installing ./install-sh
    automake: configure.in: installing ./mkinstalldirs
    automake: configure.in: installing ./missing
    configure.in: 8: required file ./ltconfig not found
The error message in the last line is an aberration. If it were consistent with the other lines, it would say:
    automake: configure.in: installing ./ltconfig
    automake: configure.in: installing ./ltmain.sh
    automake: configure.in: installing ./config.guess
    automake: configure.in: installing ./config.sub
But the effect is the same, and the files are correctly added to the distribution despite the misleading message. Before you release a distribution of your project, it is wise to get the latest versions of ``config.guess'` and ``config.sub'` from the GNU site(21), since they may be newer than the versions automatically added by `libtoolize` and `automake`. Note that `automake --add-missing` will give you its own version of these two files if ``AC_PROG_LIBTOOL'` is not used in the project ``configure.in'`, but will give you the versions shipped with `libtool` if that macro is present!

This document was generated by Gary V. Vaughan on February, 8 2006 using texi2html