Should not change the behaviour of existing Linux, Apple or Windows targets
Not all systems require -ldl to pick up dlopen. Iff checking in
libdl fails, try libc. This should ensure behaviour does not change
for case that previously worked.
needing -ldl for dlopen is primarily a linuxism, so only force the
check for -ldl on host_os linux.
manual merged in fc27b6bd1c21d5e9a10cac5f1a043389c8c879be as it needed fixes for cross-compile.