build: fix dlfcn, sys/dl.h checks
We had a bug report downstream in Gentoo of a build failure on musl systems (https://bugs.gentoo.org/958375). It turns out that nothing defines HAVE_DLFCN_H or HAVE_DLFCN_H in configure.ac, and the logic in meson.build isn't ideal either.
Fix that by:
- Looking for dlfcn.h, sys/dl.h in the autotools build
 - Check for dlfcn.h rather than assuming in the Meson build
 - Look for sys/dl.h in the Meson build as well