For compiling under WebAssembly with the wasi-sdk / wasi-libc. Even though the platforms have many POSIX functions implemented, they do not have dlopen etc. This checks if the header exists, and if it does it includes it, otherwise it provides stubs that always return null / errors. If a compiler does not support __has_include, it will just include dlfcn.h as a fallback. Most (if not all) wasm platforms are using at least clang 9, which is when native wasm was added to clang, and they support __has_include.
For compiling under WebAssembly with the wasi-sdk / wasi-libc. Even though the platforms have many POSIX functions implemented, they do not have dlopen etc. This checks if the header exists, and if it does it includes it, otherwise it provides stubs that always return null / errors. If a compiler does not support __has_include, it will just include dlfcn.h as a fallback. Most (if not all) wasm platforms are using at least clang 9, which is when native wasm was added to clang, and they support __has_include.