Next: , Previous: Invoking libtool, Up: Top

5 Integrating libtool with your package

This chapter describes how to integrate libtool with your packages so that your users can install hassle-free shared libraries.

There are several ways in which Libtool may be integrated in your package, described in the following sections. Typically, the Libtool macro files as well as are copied into your package using libtoolize and aclocal after setting up the and toplevel, then autoconf adds the needed tests to the configure script. These individual steps are often automated with autoreconf.

Here is a diagram showing how such a typical Libtool configuration works when preparing a package for distribution, assuming that m4 has been chosen as location for additional Autoconf macros, and build-aux as location for auxiliary build tools (see The Autoconf Manual):

     libtool.m4 -----.                .--> aclocal.m4 -----.
     ltoptions.m4 ---+  .-> aclocal* -+                    +--> autoconf*
     ltversion.m4 ---+--+             `--> [copy in m4/] --+       |
     ltsugar.m4 -----+  |                    ^             |       \/
     lt~obsolete.m4 -+  +-> libtoolize* -----'             |    configure
     [ltdl.m4] ------+  |                                  |
  -----------> libtoolize* -> [copy in build-aux/]

During configuration, the libtool script is generated either through config.status or

                  .--> config.status* --.
     configure* --+                     +--> libtool
                  `--> [*] ----'      ^
                                               | --------------------------------'

At make run time, libtool is then invoked as needed as a wrapper around compilers, linkers, install and cleanup programs.

There are alternatives choices to several parts of the setup; for example, the Libtool macro files can either be copied or symlinked into the package, or copied into aclocal.m4. As another example, an external, pre-configured libtool script may be used, by-passing most of the tests and package-specific setup for Libtool.