manpagez: man pages & more
info libtool
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.3 Using Automake with libtool

Libtool library support is implemented under the ‘LTLIBRARIES’ primary.

Here are some samples from the Automake ‘Makefile.am’ in the libtool distribution’s ‘demo’ subdirectory.

First, to link a program against a libtool library, just use the ‘program_LDADD(5) variable:

bin_PROGRAMS = hell hell_static

# Build hell from main.c and libhello.la
hell_SOURCES = main.c
hell_LDADD = libhello.la

# Create a statically linked version of hell.
hell_static_SOURCES = main.c
hell_static_LDADD = libhello.la
hell_static_LDFLAGS = -static

You may use the ‘program_LDFLAGS’ variable to stuff in any flags you want to pass to libtool while linking ‘program’ (such as ‘-static’ to avoid linking uninstalled shared libtool libraries).

Building a libtool library is almost as trivial… note the use of ‘libhello_la_LDFLAGS’ to pass the ‘-version-info’ (see section Library interface versions) option to libtool:

# Build a libtool library, libhello.la for installation in libdir.
lib_LTLIBRARIES = libhello.la
libhello_la_SOURCES = hello.c foo.c
libhello_la_LDFLAGS = -version-info 3:12:1

The ‘-rpath’ option is passed automatically by Automake (except for libraries listed as noinst_LTLIBRARIES), so you should not specify it.

See The Automake Manual in The Automake Manual, for more information.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on December 1, 2011 using texi2html 5.0.

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.