On FreeBSD 12.0, NetBSD 9.0, OpenBSD 6.5, "make check" reports a couple
of skipped tests:
no-ctx.sh: skipped test: $CC -shared ... failed to build a shared lib
r-root.sh: skipped test: $CC -shared ... failed to build a shared lib
rm-readdir-fail.sh: skipped test: $CC -shared ... failed to build a shared lib
csplit-io-err.sh: skipped test: $CC -shared ... failed to build a shared lib
nfs-removal-race.sh: skipped test: $CC -shared ... failed to build a shared lib
no-mtab-status.sh: skipped test: $CC -shared ... failed to build a shared lib
skip-duplicates.sh: skipped test: $CC -shared ... failed to build a shared lib
getxattr-speedup.sh: skipped test: $CC -shared ... failed to build a shared lib
The prereq check tests not only whether a shared library can be built, but
also whether linking it with -ldl works.
However, on the following platforms, the dlopen() etc. functions exist in libc,
and a libdl does not exist:
macOS, FreeBSD, NetBSD, OpenBSD, IRIX, OSF/1, Cygwin, Haiku.
The attached patch removes the requirement of a libdl. It enables 4 more tests
to be executed on FreeBSD, and produces no additional test failures on
FreeBSD, NetBSD, OpenBSD.