[...]
Win32 does not use dlopen so link in -ldl only when not on win32 and display what ldflags are being passed on ./configure.
[...]
FreeBSD doesn't have a separate -ldl either, since dlopen() and dlclose() are part of the FreeBSD libc library. The same might be true for MacOSX and any other BSD OS.