This chapter describes how to integrate libtool with your packages so that your users can install hassle-free shared libraries.
There are several ways that Libtool may be integrated in your
package, described in the following sections. Typically, the Libtool
macro files as well as ltmain.sh are copied into your package
using libtoolize
and aclocal
after setting up the
configure.ac and toplevel Makefile.am, 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 the location for additional Autoconf macros, and build-aux as the location for auxiliary build tools (see The Autoconf Manual in 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] ------+ | | `----------------------------------' ltmain.sh -----------> libtoolize* -> [copy in build-aux/]
During configuration, the libtool script is generated either
through config.status
or config.lt
:
.--> config.status* --. configure* --+ +--> libtool `--> [config.lt*] ----' ^ | ltmain.sh --------------------------------'
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.