automake
[Top][All Lists]
Advanced

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

Re: Creating a partial library


From: John Calcote
Subject: Re: Creating a partial library
Date: Wed, 03 Feb 2010 00:33:11 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.7) Gecko/20100111 Thunderbird/3.0.1

Hi Justin,

On 2/2/2010 6:39 PM, Justin Seyster wrote:

I'm pretty sure that making the framework a convenience library is my
ideal solution: the plug-in author will be able to distribute a single
shared object without any non-standard dependencies.  However, I read
that Automake does not allow installing a convenience library.  I
verified that a regular static library (not specified with
noinst_LTLIBRARIES) definitely does not work: the resulting .a file is
not position independent and won't link into a plug-in.  I don't want
to use noinst_LTLIBRARIES, though, for the simple reason that I want
to be able to install the library!

A convenience library is so named because it provides the convenient effect of encapsulating a set of code that multiple products can link to within a package. That's it's only purpose - to bundle up code that can then be linked into multiple products within your package. Hence, it's not intended to be consumed outside of your package.

You're correct in understanding that a non-libtool (*_LIBRARY) product is a non-PIC static library, and you are also correct in understanding that they can't be linked into a shared library for this reason.

You can build installed LTLIBRARIES as shared libraries, static libraries, or both, and you can configure the default in your configure.ac file, but unfortunately, I haven't found a way to make this default apply only to a subset of the installed LTLIBRARIES built within a package. It appears to be all or nothing. Furthermore, it's just a default. The user can always override your defaults with command line options to configure. Personally, I think it would be a nice enhancement to Automake to allow you to specify that you want specifically to build an installed static (only) LTLIBRARY that can then be linked into a shared library in another package. The Libtool manual states that there's no good reason for doing this, but you and I have both encountered situations when we want to do just this.

For the reasons outlined above, automake doesn't allow you to build a convenience library and install it. The only way to build a convenience (PIC-based static only) library is to use the "noinst" prefix. But libtool can be used to manually install a convenience library, so you could use libtool to do this in an install-exec-local rule in the Makefile.am file that builds (for instance) libhello.a (untested):

install-exec-local:
libtool --mode=install ./install-sh -c libhello.a $(DESTDIR)$(lib)/libhello.a

This example came from the libtool manual (modified slightly for Automake context).

Regards,
John




reply via email to

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