La policy di dove andare a cercare le librerie dinamiche dipende dal sistema operativo. Su linux è tutto scritto nella manpage di ld.so. Cito la parte che ti interessa:
Quando compili, usa
When resolving library dependencies, the dynamic linker first inspects each dependency string to see if it contains a slash (this can occur if a library pathname containing slashes was specified at link time). If a slash is found, then the dependency string is interpreted as a (relative or absolute) pathname, and the library is loaded using that pathname.
If a library dependency does not contain a slash, then it is searched for in the following order:
...
Quando compili, usa
-Wl,-rpath,./
. Meglio ancora se lasci tutto com'è di default e installi la libreria sul sistema.