DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

(libtool14.info.gz) Using Automake

Info Catalog (libtool14.info.gz) Makefile rules (libtool14.info.gz) Integrating libtool (libtool14.info.gz) Configuring
 
 5.2 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' variable:
 
      bin_PROGRAMS = hell hell.debug
 
      # Build hell from main.c and libhello.la
      hell_SOURCES = main.c
      hell_LDADD = libhello.la
 
      # Create an easier-to-debug version of hell.
      hell_debug_SOURCES = main.c
      hell_debug_LDADD = libhello.la
      hell_debug_LDFLAGS = -static
 
    The flags `-dlopen' or `-dlpreopen' ( Link mode) would fit
 better in the PROGRAM_LDADD variable.  Unfortunately, GNU automake, up
 to release 1.4, doesn't accept these flags in a PROGRAM_LDADD variable,
 so you have the following alternatives:
 
    * add them to PROGRAM_LDFLAGS, and list the libraries in
      PROGRAM_DEPENDENCIES, then wait for a release of GNU automake that
      accepts these flags where they belong;
 
    * surround the flags between quotes, but then you must set
      PROGRAM_DEPENDENCIES too:
 
           program_LDADD = "-dlopen" libfoo.la
           program_DEPENDENCIES = libfoo.la
 
    * set and `AC_SUBST' variables DLOPEN and DLPREOPEN in
      `configure.in' and use `@DLOPEN@' and `@DLPREOPEN@' as
      replacements for the explicit flags `-dlopen' and `-dlpreopen' in
      `program_LDADD'.  Automake will discard `AC_SUBST'ed variables
      from dependencies, so it will behave exactly as we expect it to
      behave when it accepts these flags in `program_LDADD'.  But hey!,
      this is ugly!
 
    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' ( Versioning)
 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.
 
     Building a Shared Library (automake)A Shared Library, for
 more information.
 
Info Catalog (libtool14.info.gz) Makefile rules (libtool14.info.gz) Integrating libtool (libtool14.info.gz) Configuring
automatically generated byinfo2html