guard symbol usage of link.h only when we have it

This should fix compilation on mac os, where we have no link.h. Note that
we are not calling get_names_of_shared_libs() in this case anyway.