autoconf
[Top][All Lists]
Advanced

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

Re: autoconf linking with shared object


From: Braden McDaniel
Subject: Re: autoconf linking with shared object
Date: Wed, 29 Mar 2006 11:18:02 -0500

On Wed, 2006-03-29 at 10:41 +0200, Ralf Wildenhues wrote:
> Hi Braden,
> 
> * Braden McDaniel wrote on Wed, Mar 29, 2006 at 10:32:37AM CEST:
> > On Wed, 2006-03-29 at 10:02 +0200, Ralf Wildenhues wrote:
> > 
> > > You definitely want to put dependent libraries (those `-lfoolib' flags)
> > > into one of the automake Makefile macros LIBS, someprogram_LDADD,
> > > libsomelibrary_LIBADD, or similar, and not into *_LDFLAGS.
> > 
> > I hear this advice from time to time (and I have read what the autoconf
> > and automake manuals have to say). Yet, as a practical matter, -l and -L
> > flags frequently wind up as part of the same autoconf substitution in
> > many build systems (e.g., such falls out of the typical usage pattern
> > for pkg-config) and consequently get put into *_LDFLAGS as a unit. I do
> > not think I have observed any bad effects from this to date.
> 
> That's very likely because you rarely do static linking.

While as a matter of convenience during development I build dynamic
libraries much more often than static ones, I do ensure my package works
in the static case. I do use libtool, so perhaps it is insulating me
from problems.

> > Is this advice really still relevant? Are all those packages that apply
> > -l and -L together as a unit Doing It Wrong?
> 
> Yes.  And anybody trying to link completely statically in this case will
> be hurt: the linker will only search the static libraries when it
> encounters them on the command line; if a later library needs some
> object from an earlier one pulled in (that wasn't already pulled in by
> something else), then you will get a link failure.

You seem to be saying "make sure all your -l flags are in the right
order", which is a concept (I think) I understand. But I believe I've
been doing that while putting the -l flags in *_LDFLAGS just fine. Are
you saying that use of *_LDFLAGS is somehow fundamentally incompatible
with this goal?

-- 
Braden McDaniel <address@hidden>





reply via email to

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