| Autoconf, Automake, and Libtool | ||
|---|---|---|
| <<< Previous | Using GNU Libtool with configure.in and Makefile.am | Next >>> |
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 the chapter called 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 [1] 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 abberation. If it was consistant 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 [2] , 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! |
| [1] | The functionality of @file{ltconfig} is slated for migration into @file{libtool.m4} for a future release of @command{libtool}, whereupon this file will no longer be necessary. |
| [2] | @uref{ftp://ftp.gnu.org/gnu/config/} |
| <<< Previous | Home | Next >>> |
| Integration with Makefile.am | Up | Library Versioning |