I'm building a program with autoconf, automake, and libtool.
My work requires that I statically link (most) libraries. This hasn't been
a problem in the past because I could statically link everything with
-all-static
. Now it's a problem because I have to use a library which is
only dynamic; it was given to us by a thirdparty, and we don't have the source.
Of course, -all-static
now causes the build to fail. Is it possible to
tell libtool to statically link everything, except for this one library?
Is it possible to have libtool do any combination of static and
dynamic linking, or is it all or nothing?
So far I've tried creating a convenience library with LDFLAGS = -static
, which depends on the libraries I want to statically link. But libtool doesn't concatenate the static libraries, like I would have hoped. The program depending on the convenience library still dynamically links everything.
I've also tried --disable-shared
, but that didn't affect the build.
These questions are similar, but don't really answer my question:
Force linking a static library into a shared one with Libtool
Is it possible to link some — but not all — libraries statically with libtool?
(I don't want to delete shared libraries from my system, and specifing the full path for everything is hardly better than linking by hand, but maybe it's the only way.)