diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2020-10-15 06:09:27 -0400 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2020-10-17 10:45:51 -0400 |
commit | 5c53015a480b3fe137ebd8b3b584a595c65e8f21 (patch) | |
tree | 7df39b1dc2ff0be23d84686d057e61b62159e61b /meson.build | |
parent | 09e93326e448ab43fa26a9e2d9cc20ecf951f32b (diff) |
build: add --enable/--disable-libudev
Initially, libudev detection was bundled with --enable-mpath because
qemu-pr-helper was the only user of libudev. Recently however the USB
U2F emulation has also started using libudev, so add a separate
option. This also allows 1) disabling libudev if desired for static
builds and 2) for non-static builds, requiring libudev even if
multipath support is undesirable.
The multipath test is adjusted, because it is now possible to enter it
with configurations that should fail, such as --static --enable-mpath
--disable-libudev.
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 50 |
1 files changed, 28 insertions, 22 deletions
diff --git a/meson.build b/meson.build index 2c93e22382..0c0f4f9fd8 100644 --- a/meson.build +++ b/meson.build @@ -380,10 +380,11 @@ endif libudev = not_found if targetos == 'linux' and (have_system or have_tools) libudev = dependency('libudev', - required: get_option('mpath').enabled(), + required: get_option('libudev'), static: enable_static) endif +mpathlibs = [libudev] mpathpersist = not_found mpathpersist_new_api = false if targetos == 'linux' and have_tools and not get_option('mpath').disabled() @@ -414,35 +415,40 @@ if targetos == 'linux' and have_tools and not get_option('mpath').disabled() mpath_lib_init(udev); return 0; }''' - mpathlibs = [libudev] - if enable_static - mpathlibs += cc.find_library('devmapper', - required: get_option('mpath'), - static: enable_static) - endif - mpathlibs += cc.find_library('multipath', - required: get_option('mpath'), - static: enable_static) - mpathlibs += cc.find_library('mpathpersist', - required: get_option('mpath'), - static: enable_static) - foreach lib: mpathlibs - if not lib.found() - mpathlibs = [] - break + libmpathpersist = cc.find_library('mpathpersist', + required: get_option('mpath'), + static: enable_static) + if libmpathpersist.found() + mpathlibs += libmpathpersist + if enable_static + mpathlibs += cc.find_library('devmapper', + required: get_option('mpath'), + static: enable_static) endif - endforeach - if mpathlibs.length() > 0 - if cc.links(mpath_test_source_new, dependencies: mpathlibs) + mpathlibs += cc.find_library('multipath', + required: get_option('mpath'), + static: enable_static) + foreach lib: mpathlibs + if not lib.found() + mpathlibs = [] + break + endif + endforeach + if mpathlibs.length() == 0 + msg = 'Dependencies missing for libmpathpersist' + elif cc.links(mpath_test_source_new, dependencies: mpathlibs) mpathpersist = declare_dependency(dependencies: mpathlibs) mpathpersist_new_api = true elif cc.links(mpath_test_source_old, dependencies: mpathlibs) mpathpersist = declare_dependency(dependencies: mpathlibs) else + msg = 'Cannot detect libmpathpersist API' + endif + if not mpathpersist.found() if get_option('mpath').enabled() - error('Cannot detect libmpathpersist API') + error(msg) else - warning('Cannot detect libmpathpersist API, disabling') + warning(msg + ', disabling') endif endif endif |