Although my issue is related to building Python, it could be considered generic. I have built Python with a custom TclTk installation, using --with-tcltk-includes and --with-tcltk-libs. Say I passed /foo/bar/spam path to the latter. The problem is, when I use strace to check where the binary looks for its shared libraries, I see /foo/bar/spam in the search path, although I do not want that because this application will be shipped and this path does not exist anywhere else beyond my own machine. So I want to use it just during the build, but not as a search path for the generated binary. Any ideas?
Static linking is probably your best bet, because you likely can't guarantee that your customers will have any of the other required libraries (like sqlite3, for example) either. Just don't pass the flag --enable-shared to ./configure and it will build a statically-linked lib by default.
Unfortunately, I don't see a way with the standard options to build a partial-static/partial dynamic lib. That doesn't mean it isn't possible with some creative tinkering with the Makefile, but conceptually I'm not sure how it would work anyway.
How to fine-tune where a binary looks for its shared libraries during configure/build (linux)?