automake: Libtool Libraries
1
1 8.3.2 Building Libtool Libraries
1 --------------------------------
1
1 Automake uses libtool to build libraries declared with the ‘LTLIBRARIES’
1 primary. Each ‘_LTLIBRARIES’ variable is a list of libtool libraries to
1 build. For instance, to create a libtool library named ‘libgettext.la’,
1 and install it in ‘libdir’, write:
1
1 lib_LTLIBRARIES = libgettext.la
1 libgettext_la_SOURCES = gettext.c gettext.h ...
1
1 Automake predefines the variable ‘pkglibdir’, so you can use
1 ‘pkglib_LTLIBRARIES’ to install libraries in ‘$(libdir)/@PACKAGE@/’.
1
1 If ‘gettext.h’ is a public header file that needs to be installed in
1 order for people to use the library, it should be declared using a
1 ‘_HEADERS’ variable, not in ‘libgettext_la_SOURCES’. Headers listed in
1 the latter should be internal headers that are not part of the public
1 interface.
1
1 lib_LTLIBRARIES = libgettext.la
1 libgettext_la_SOURCES = gettext.c ...
1 include_HEADERS = gettext.h ...
1
1 A package can build and install such a library along with other
1 programs that use it. This dependency should be specified using
1 ‘LDADD’. The following example builds a program named ‘hello’ that is
1 linked with ‘libgettext.la’.
1
1 lib_LTLIBRARIES = libgettext.la
1 libgettext_la_SOURCES = gettext.c ...
1
1 bin_PROGRAMS = hello
1 hello_SOURCES = hello.c ...
1 hello_LDADD = libgettext.la
1
1 Whether ‘hello’ is statically or dynamically linked with ‘libgettext.la’
1 is not yet known: this will depend on the configuration of libtool and
1 the capabilities of the host.
1