Back: Using GNU Libtool
Forward: Extra Configure Options
FastBack: Using GNU Libtool
Up: Using GNU Libtool
FastForward: Integration with
Top: Autoconf, Automake, and Libtool
Contents: Table of Contents
Index: Index
About: About this document

11.1 Integration with `'

Declaring your use of libtool in the project's `' is a simple matter of adding the `AC_PROG_LIBTOOL'(18) somewhere near the top of the file. I always put it immediately after the other `AC_PROG_...' macros. If you are converting an old project to use libtool, then you will also need to remove any calls to `AC_PROG_RANLIB'. Since Libtool will be handling all of the libraries, it will decide whether or not to call ranlib as appropriate for the build environment.

The code generated by `AC_PROG_LIBTOOL' relies on the shell variable $top_builddir to hold the relative path to the directory which contains the configure script. If you are using Automake, $top_builddir is set in the environment by the generated `Makefile'. If you use Autoconf without Automake then you must ensure that $top_builddir is set before the call to `AC_PROG_LIBTOOL' in `'.

Adding the following code to `' is often sufficient:

for top_builddir in . .. ../.. $ac_auxdir $ac_auxdir/..; do
  test -f $top_builddir/configure && break

Having made these changes to add libtool support to your project, you will need to regenerate the `aclocal.m4' file to pick up the macro definitions required for `AC_PROG_LIBTOOL', and then rebuild your configure script with these new definitions in place. After you have done that, there will be some new options available from configure:

$ aclocal
$ autoconf
$ ./configure --help
--enable and --with options recognized:
  --enable-shared[=PKGS]  build shared libraries [yes]
  --enable-static[=PKGS]  build static libraries [yes]
  --enable-fast-install[=PKGS]  optimize for fast installation [yes]
  --with-gnu-ld           assume the C compiler uses GNU ld [no]
  --disable-libtool-lock  avoid locking (might break parallel builds)
  --with-pic              try to use only PIC/non-PIC objects [both]

These new options allow the end user of your project some control over how they want to build the project's libraries. The opposites of each of these switches are also accepted, even though they are not listed by configure --help. You can equally pass, `--disable-fast-install' or `--without-gnu-ld' for example.

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