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

11.1.2 Extra Macros for Libtool

There are several macros which can be added to `configure.in' which will change the default behaviour of libtool. If they are used they must appear before the call to the `AC_PROG_LIBTOOL' macro. Note that these macros only change the default behaviour, and options passed in to configure on the command line will always override the defaults. The most up to date information about these macros is available from the Libtool Manual.

`AC_DISABLE_FAST_INSTALL'
This macro tells libtool that on platforms which require relinking at install time, it should build executables so that they can be run from the build tree at the expense of relinking during installation, as if `--disable-fast-install' had been passed on the command line.

`AC_DISABLE_SHARED'
`AC_DISABLE_STATIC'
These macros tell libtool to not try and build either shared or static libraries respectively. libtool will always try to build something however, so even if you turn off static library building in `configure.in', building your package for a target host without shared library support will fallback to building static archives.

The time spent waiting for builds during development can be reduced a little by including these macros temporarily. Don't forget to remove them before you release the project though!

In addition to the macros provided with `AC_PROG_LIBTOOL', there are a few shell variables that you may need to set yourself, depending on the structure of your project:

`LTLIBOBJS'
If your project uses the `AC_REPLACE_FUNCS' macro, or any of the other macros which add object names to the `LIBOBJS' variable, you will also need to provide an equivalent `LTLIBOBJS' definition. At the moment, you must do it manually, but needing to do that is considered to be a bug and will fixed in a future release of Autoconf. The manual generation of `LTLIBOBJS' is a simple matter of replacing the names of the objects mentioned in `LIBOBJS' with equivalent .lo suffixed Libtool object names. The easiest way to do this is to add the following snippet to your `configure.in' near the end, just before the call to `AC_OUTPUT'.

 
Xsed="sed -e s/^X//"
LTLIBOBJS=`echo X"$LIBOBJS"|\
           [$Xsed -e "s,\.[^.]* ,.lo ,g;s,\.[^.]*$,.lo,"]`
AC_SUBST(LTLIBOBJS)

The Xsed is not usually necessary, though it can prevent problems with the echo command in the event that one of the `LIBOBJS' files begins with a `-' character. It is also a good habit to write shell code like this, as it will avoid problems in your programs.

`LTALLOCA'
If your project uses the `AC_FUNC_ALLOCA' macro, you will need to provide a definition of `LTALLOCA' equivalent to the `ALLOCA' value provided by the macro.

 
Xsed="sed -e s/^X//"
LTALLOCA=`echo X"$ALLOCA"|[$Xsed -e "s,\.$[^.]*,.lo,g"]`
AC_SUBST(LTALLOCA)

Obviously you don't need to redefine Xsed if you already use it for `LTLIBOBJS' above.

`LIBTOOL_DEPS'
To help you write make rules for automatic updating of the Libtool configuration files, you can use the value of `LIBTOOL_DEPS' after the call to `AC_PROG_LIBTOOL':

 
AC_PROG_LIBTOOL
AC_SUBST(LIBTOOL_DEPS)

Then add the following to the top level `Makefile.in':

 
libtool: @LIBTOOL_DEPS@
        cd $(srcdir) && \
          $(SHELL) ./config.status --recheck

If you are using automake in your project, it will generate equivalent rules automatically. You don't need to use this except in circumstances where you want to use libtool and autoconf, but not automake.


This document was generated by Gary V. Vaughan on May, 24 2001 using texi2html