Fix dependencies when using shared libraries.