GNU Libtool - Updating your Debian Package

All commands are intended to be run from your package's top-level source directory.

  1. Find out which version of Libtool your package uses:

    $ find . -name ltmain.sh -print0 | xargs -0 grep -H ^VERSION=
    

    If your package uses 1.5 or 1.5.x you want the libtool package.

    If your package uses 1.4 or 1.4.x you want the libtool1.4 package.

  2. Find out which version of Automake your package uses:

    $ head -1 Makefile.in
    

    If your package uses 1.8 or 1.8.x you want the automake1.8 package.

    If your package uses 1.7 or 1.7.x you want the automake1.7 package.

    If your package uses 1.6 or 1.6.x you want the automake1.6 package.

    If your package uses 1.4 or 1.4.x you want the automake1.4 package.

  3. Find out which version of Autoconf your package uses:

    $ grep Generated configure | head -1
    

    If yor package uses 2.5x you want the autoconf package.

    If yor package uses 2.13 you want the autoconf2.13 package.

  4. Install or upgrade the appropriate packages and the autotools-dev package:

    $ apt-get install libtool automake autoconf autotools-dev
    
  5. Use the libtoolize tool to bring the ltmain.sh, config.guess and config.sub scripts in your package up to date:

    $ libtoolize --copy --force
    
  6. Use the aclocal tool to place the latest version of the libtool.m4 macros into your aclocal.m4 file:

    $ aclocal-1.8
    

    Be sure to replace the 1.8 with either 1.7, 1.6 or 1.4 if appropriate.

  7. Use the autoconf to use the new macros to bring your configure script up to date:

    $ autoconf
    

    This should run the right version, if in doubt run either autoconf2.50 or autoconf2.13 instead.

  8. Repeat steps 5–7 for every additional directory containing a configure script and ltmain.sh alongside (or in a AC_CONFIG_AUX_DIR).

Problems running aclocal or autoconf?

Unfortunately aclocal is a somewhat brute-force tool. For every macro you use in your configure.{in,ac} file it includes a verbatim copy of all files in /usr/share/aclocal that define it.

This can cause problems if the original aclocal.m4 file contained macros not available on your system. These will be lost after aclocal is run.

Fortunately there's no magic behind the format of this file and it can be modified manually. This should be performed instead of step 6, you will still need to perform step 7 afterwards.

  1. Restore the original aclocal.m4 file.

  2. Open it in your favourite text editor.

  3. Locate the line beginning:

    # libtool.m4 - Configure libtool for the host system
    
    Remember this line number or place your editor's equivalent of a mark here.
  4. Locate the line beginning:

    AC_DEFUN([LT_AC_PROG_SED],
    
    Gradually scroll down until you see the following lines:
    AC_MSG_RESULT([$SED])
    ])
    
  5. Delete from the mark you placed in step 3 to the line containing just ]) from step 4.

  6. Save the new file and exit your editor.

  7. Append the new Libtool macros to this file:

    $ cat /usr/share/aclocal/libtool.m4 >> aclocal.m4
    

This can all, of course, be performed using UNIX utilities:

$ sed -e '/^# libtool.m4/,/^AC_MSG_RESULT(\[$SED])/{N;d}' \
        aclocal.m4 > aclocal.m4_
$ cat aclocal.m4_ /usr/share/aclocal/libtool.m4 > aclocal.m4

Still having problems?

If you've followed these steps correctly your problems should have gone. If they haven't then you've most likely got either an upstream of hasn't the faintest idea how to use the GNU AutoTools properly; or worse, one who thinks they know better than anyone else.

Here's some ideas of things to check for and remove:

Copyright © 2003–2004 Scott James Remnant <scott@netsplit.com>.
Permission is hereby granted, free of charge, to any person obtaining a copy of this document (the "Document"), to deal in the Document without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Document, and to permit persons to whom the Document is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Document.

THE DOCUMENT IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE DOCUMENT OR THE USE OR OTHER DEALINGS IN THE DOCUMENT.