Context:
After a recent version upgrade of a bunch of our server software, I've found myself in a dilemma:
I have two sets of applications (Zend server and assorted utils, and a bunch of PostgreSQL management utilities) that both heavily use a certain library file (libpq.so). Zend ships with its own libpq, which is the only version (that I've found) that will work with all of the Zend stuff. Postgres also ships with its own version of the library. The two are mutually exclusive: if Postgres's version of the library comes first in the LD_LIBRARY_PATH of whatever user is doing something, all of the Postgres utils will work, but none of the Zend ones will. If Zend's comes first, the Zend stuff will work, but the Postgres stuff won't.
The libraries both have the same names. The PostgreSQL compatibility libs package doesn't work.
In our environment, both sets of applications are used under a lot of different, unpredictable user accounts on a lot of different CentOS machines, so using the "right way" and setting LD_LIBRARY_PATH per-user, and telling people to "only use X applications under Y account" will not work.
Question:
Is there a per application way to say "for these binaries/apps executed in X folder, link against a library at path Y, but for these other binaries, link against library Z"? Basically, a per-application library path, without having to set LD_LIBRARY_PATH or DYLD_* every time I access one of the applications.
I'd prefer to avoid having to recompile libraries, since that would sign me up for a significant additional amount of hassle and testing every time a new version of either set of software comes out. I already have libraries that work, they just won't work for both sets of apps.