[JATS-300] Support for linking against shared libraries that have dependencies on other shared libraries
use -rpath-link to have the linker search for such libraries
Modified usages of LIBDIRS, such that only directories that exit at the time the command is executed will be used.