[PULL v5 31/44] meson.build: relax the libdl test to one for the function dlopen

Alex Bennée posted 44 patches 4 years, 7 months ago
Maintainers: Ryo ONODERA <ryoon@netbsd.org>, Kamil Rytarowski <kamil@netbsd.org>, Brad Smith <brad@comstyle.com>, Reinoud Zandijk <reinoud@netbsd.org>
[PULL v5 31/44] meson.build: relax the libdl test to one for the function dlopen
Posted by Alex Bennée 4 years, 7 months ago
For the *BSD family dlopen is already part of libc so it's not a hard
dependency to have a libdl.so library.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20210714101536.16016-1-alex.bennee@linaro.org>

diff --git a/meson.build b/meson.build
index c6dd70c400..e5de144233 100644
--- a/meson.build
+++ b/meson.build
@@ -455,7 +455,10 @@ endif
 rt = cc.find_library('rt', required: false)
 libdl = not_found
 if 'CONFIG_PLUGIN' in config_host
-  libdl = cc.find_library('dl', required: true)
+  libdl = cc.find_library('dl', required: false)
+  if not cc.has_function('dlopen', dependencies: libdl)
+    error('dlopen not found')
+  endif
 endif
 libiscsi = not_found
 if not get_option('libiscsi').auto() or have_block
-- 
2.20.1