diff --git a/meson.build b/meson.build index 4313d4d2a4f..5570a8a1f39 100644 --- a/meson.build +++ b/meson.build @@ -1535,12 +1535,14 @@ ld_args_build_id = cc.get_supported_link_arguments('-Wl,--build-id=sha1') # check for dl support dep_dl = null_dep -if not cc.has_function('dlopen') - dep_dl = cc.find_library('dl', required : host_machine.system() != 'windows') -endif -if cc.has_function('dladdr', dependencies : dep_dl) - # This is really only required for util/disk_cache.h - pre_args += '-DHAVE_DLADDR' +if host_machine.system() != 'windows' + if not cc.has_function('dlopen') + dep_dl = cc.find_library('dl', required : true) + endif + if cc.has_function('dladdr', dependencies : dep_dl) + # This is really only required for util/disk_cache.h + pre_args += '-DHAVE_DLADDR' + endif endif if cc.has_function('dl_iterate_phdr')