Static linking with libtool, without modifying dependency_libs in .la file
libtool, static-libraries
Solution
Here's the best solution we've found, for posterity:
It seems there's no very neat way to get this to work. The nicest I've found is to avoid `-L` and `-l` flags when "internally" linking like this, and instead to directly put `$(builddir)/extralib/libmy-secret-lib.a` in the LDFLAGS/LIBADD variable for the final shared lib.
This unfortunately produces a libtool warning about non-portability and the need to build the "hand-made convenience lib" with `-fPIC` -- even it has been built that way and is fully portable. `...LIBTOOLFLAGS = --silent` isn't enough to hide that cry-wolf warning, sadly, but the result is good: required symbols copied into the final library, `dependency_libs` unsullied, and no hacks (like this: https://gitorious.org/libguestfs/libguestfs/source/c46bedf925cd9c6c9a9cbaee115358fd1dffcbfe:libtool-kill-dependency_libs.sh) required.
Problem
In an autotools-based project I am bundling another, small static library, and linking this into my final shared library in a safe way (the static is built with -fPIC, etc.) In the end there should be no evidence at all of the existence of the internal static lib as part of the build process, and its symbols should all be "copied" into the shared lib. The last condition is certainly met, checked with `nm`, and using `ldd` on the shared lib reveals no "needed" ELF section dependency on the static lib. But libtool's `.la` archive file is a different story: the `dependency_libs` variable in there picks up a `-lmy-secret-temp-lib` (names have been changed to protect the innocent) entry which then breaks any libtool-based project which tries to build against the final library since that dependency can never be met. Non-libtool projects are of course fine since nothing other than libtool looks in `.la` files. Is there a way that I can tell libtool to not add a library to the `dependency_libs` variable in its `.la` file when it is included in the `xxxx_la_LIBADD` variable? Maybe there are some before-and-after args like `-flibtool_ignore -lmy-secret-lib -flibtool_payattention` to allow the developer to tell libtool to stop getting in the way? It'd be nice to be able to tell autotools/libtool to not make/install the `.la` file at all, but that doesn't seem to be an option!