Hi Paul, * Paul Elliott wrote on Tue, May 09, 2006 at 12:09:12PM CEST: > > Because one library is a constantly changing moving target, and is > small, I want to it link staticly. It is not a libtool library. It > comes in .a and .so versions in /usr/lib. > > How do I tell automake to link that one library static and not > the others.
The question is, how portable do you want it to be? > I tied to add ".a" to the _LDADD entries in Makefile.am > but that resulted in an error at link time: > /bin/ls: /usr/libboost_filesystem.a: No such file or directory This error message seems to come from 'ls' and not 'ld', so something seems wrong here. Other than that, is should've probably been /usr/lib/libboost_filesystem.a instead of /usr/libboost_filesystem.a. If you want to build your program on your host only, then hard-coding that as above would be fine. But in general you won't be able to assume that libboost_filesystem lives in /usr/lib, or the one that lives there is the one your users would like to use. On some systems[1], it works to use -Wl,-Bstatic -lLIB -Wl,-Bdynamic in order to link LIB statically. (Maybe a macro to provide this portably should be given, maybe even independent of Libtool; FWIW, there is a pending patch to provide this functionality portably with Libtool.) You could also imitate Libtool's walk over the list of directories to search, and look for $LIB.a, and list that hard-coded. Note that this will fail for AIX (where libfoo.a may be a shared library) and for some w32 environments (where static libraries may also end in '.lib', and where '.a' libraries may be import libraries for DLLs). Cheers, Ralf [1] http://wiki.azazil.net/GnuLibtoolProject/FeatureRequests/PerDeplibFlags