libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: exclusive static or shared


From: Ralf Wildenhues
Subject: Re: exclusive static or shared
Date: Wed, 15 Feb 2006 10:11:17 +0100
User-agent: Mutt/1.5.11

Hi Christopher,

* Christopher Hulbert wrote on Tue, Feb 14, 2006 at 11:08:28PM CET:
> I have a number of directories most of which I ONLY want to build
> shared libraries from.  There are a couple that I ONLY want static
> libraries.  Is there a way to turn on/off shared/static libraries.  I
> saw -static which would work IF both build_old_libs=yes.  Is there any
> way to have -static set build_old_libs=yes?  This is on cygwin with
> libtool 1.5.22.  Is there a -shared equivelent to disable static and
> enable shared library building?

Here's a set of rules.

The developer can set preferences on a per-(sub)package basis by using
  AC_ENABLE_SHARED
  AC_DISABLE_SHARED
  AC_ENABLE_STATIC
  AC_DISABLE_STATIC
in the respective configure.ac files. 

The user can do so per-(sub)package with
  --enable-shared=pkgs
  --disable-shared=pkgs
  --enable-static=pkgs
  --disable-static=pkgs
and override above macros thusly.

Assuming a package that uses Automake, the developer can control this on
a per-library basis by putting
  -static
into the *LDFLAGS that affect libtool-created libraries.  The user can
override this (usually on a per-make invocation basis) by using the flag
in LDFLAGS, but has to make sure only libtool-created libraries (and not
any other linked targets) are affected.

The developer or the user can possibly limit the types of libraries
created by using the
  --tag=disable-shared
  --tag=disable-static
tags for libtool.  To use these correctly, there are a few things to be
noted though:
- Shared libraries may not have been disabled at configure time.
- These tags work with both 1.5.x and CVS libtool versions, but
  are not (yet) documented.
- These flags need to go before the compiler: speaking in Automake
  terms, they would fit in LIBTOOLFLAGS but not in LDFLAGS.
- We took liberty to change (fix) their semantics in 1.5.22 to this:
  If you pass
    --tag=disable-shared --tag=CXX
  then previously, the CXX configuration could overwrite the disabling
  of shared libraries.  Now that does not happen any more.
  The new behavior (in branch-1-5 and HEAD) gives the disable-* tags
  precedence over the language tags.
- Until we document the tags, we'll probably take liberty to change them
  again if we encounter more issues that we don't like.


With all of the aforementioned measures, one has to take the following
additional rule into account:
Libtool will never disable all types of libraries.  That means, it will
usually fall back to static libraries because it is usually possible to
create them everywhere.

It is furthermore important to note that there are systems where libtool
will not build static libraries by default (AIX without runtimelinking)
or not build shared libraries at all.

Hope that helps (and gives enough flexibility).

Cheers,
Ralf




reply via email to

[Prev in Thread] Current Thread [Next in Thread]