An Internationalized Software Project With Auto Tools
Prev Adding libtool Support Next

Adding libtool Support

Libtool handles the different ways of linking against libraries on different platform, especially shared libraries (if possible). Therefore it should be used, whenever an external library is used or whenever a project should build and install libraries. As this simple project so far does non of these, libtool is not necessary here. The next step will add gettext, so libtool might be usefull, as gettext has libraries to link against. But gettext allows the developer to compile the necessary functions directly into the project. So for gettext libtool is not a must. Lateron wxWindows libraries are used and then libtool support does make sence. As adding libtool is a small step often required, it is done here.

The drawback should be mentioned as well: the size of the compressed source tarball increases by about 150kB, the number of checks 'configure' performs is much larger (which takes time) and the compilation itself takes more time.

Adding libtool support is quite easy: just run libtoolize.
# libtoolize
Remember to add `AC_PROG_LIBTOOL' to `configure.ac'.
Using `AC_PROG_RANLIB' is rendered obsolete by `AC_PROG_LIBTOOL'
You should update your `aclocal.m4' by running aclocal.
The output gives an important hint: configure.ac needs a small change:

configure.ac

...
AM_INIT_AUTOMAKE
AC_PROG_RANLIB
AC_LIBTOOL_DLOPEN
AC_PROG_LIBTOOL

...
AC_LIBTOOL_DLOPEN was recommended to use by the libtool documentation, so it was added as well. The hint "run aclocal" does not work here: aclocal just prints some warnings but does not change aclocal.m4, even if --force was given. Instead adding acinclude.m4 helped:
# ln -s /usr/local/share/libtool/libltdl/acinclude.m4 acinclude.m4

Rebuilding the Project

Afterwards, a new 'configure' can be created. If all environment variables were correctly set during the creation of the current Makefile's (they should be correctly set now, too!), 'make' does the job. It will call all necessary auto tools, and run configure. It will not recompile, as the sources are not changed. To force a recompile, 'make clean' should be run first.
# gmake
cd . && aclocal19

...

 cd . && automake19 --gnu
cd . && autoconf259
/bin/sh ./config.status --recheck
running /bin/sh ./configure   --no-create --no-recursion
checking for a BSD-compatible install... /usr/bin/install -c

...

config.status: executing depfiles commands
cd . && autoheader259

...

The configue script itself now does a lot more tests. Some of th test results go into config.h: e
# cat config.h 
/* config.h.  Generated by configure.  */
/* config.h.in.  Generated from configure.ac by autoheader.  */

/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1

/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1

/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1

...
To get libtool support directly from a cvs checkout, createFromCvs needs a small change:

createFromCvs.freebsd

#!/bin/sh
libtoolize
ln -s /usr/local/share/libtool/libltdl/acinclude.m4 acinclude.m4
${ACLOCAL}

...
On gentoo, acinclude.m4 has a different location:

createFromCvs.gentoo

#!/bin/sh
libtoolize
ln -s /usr/share/libtool/libltdl/acinclude.m4 acinclude.m4
aclocal

...
The result source code can be downloaded here.

Next, the internationalization of a project is discussed.
Prev Home Next
Adding a Module gettext Overview