[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: is LDADD line the place to put .a convenience libraries AS WELL AS -
Dale E Martin
Re: is LDADD line the place to put .a convenience libraries AS WELL AS -l switches?? like -lm??? how works?
Tue, 22 Apr 2003 09:20:50 -0400
> LDADD = helperfunctions/libhelperfunctions.a -lpthread -lm
> First of all, is the LDADD line the place to add .a files
> as well as -l switches???
Yes. Although you might be better off doing:
foo_LDFLAGS = -Lhelperfunctions
foo_LDADD = -lpthread -lm
Then again, if the helper functions will NEVER be installed and there's no
chance you'd ever link against installed libraries, maybe your way is
> I'm a little impressed and amazed Autotools was able to accept /both/
> types of animals on the LDADD line.
Why? gcc/g++ can do it when it's linking too.
> Did I get lucky or is LDADD the place to *always* add both of these guys?
Yes, that is correct, when linking you'd always use LDADD for both forms of
libraries. In one of your other posts you asked about LIBADD, and that is
to tell libtool that "this" library has a dependency on some other library.
The beauty of THAT is that when you use dynamic linking, it allows it to
preload the dependant libraries automatically. And when static linking,
(and you use libtool to link), it automatically generates the full list of
libraries to link to, presumably in the right order (if you specified them
this way.) As far as I'm concerned, this is the main benefit of using
Dale E. Martin, Clifton Labs, Inc.
Senior Computer Engineer
pgp key available