Only link libdl and librt where required
BSDs do not have libdl at all, so would fail to link. This patch fixes the build for FreeBSD.
Even on modern Glibc libdl and librt are empty libraries provided only for backwards compatibility, because the corresponding functionality has moved into libc.
Edited by Alyssa Ross