[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 11/22] build: add --enable/--disable-libudev
From: |
Paolo Bonzini |
Subject: |
[PULL 11/22] build: add --enable/--disable-libudev |
Date: |
Fri, 16 Oct 2020 07:48:03 -0400 |
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>
---
configure | 8 +++++++-
meson.build | 50 ++++++++++++++++++++++++++---------------------
meson_options.txt | 2 ++
3 files changed, 37 insertions(+), 23 deletions(-)
diff --git a/configure b/configure
index 9317349044..c83a2eeb9d 100755
--- a/configure
+++ b/configure
@@ -303,6 +303,7 @@ netmap="no"
sdl="auto"
sdl_image="auto"
virtfs=""
+libudev="auto"
mpath="auto"
vnc="enabled"
sparse="auto"
@@ -1002,6 +1003,10 @@ for opt do
;;
--enable-virtfs) virtfs="yes"
;;
+ --disable-libudev) libudev="disabled"
+ ;;
+ --enable-libudev) libudev="enabled"
+ ;;
--disable-mpath) mpath="disabled"
;;
--enable-mpath) mpath="enabled"
@@ -1759,6 +1764,7 @@ disabled with --disable-FEATURE, default is enabled if
available:
vnc-png PNG compression for VNC server
cocoa Cocoa UI (Mac OS X only)
virtfs VirtFS
+ libudev Use libudev to enumerate host devices
mpath Multipath persistent reservation passthrough
xen xen backend driver support
xen-pci-passthrough PCI passthrough support for Xen
@@ -7060,7 +7066,7 @@ NINJA=$ninja $meson setup \
-Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg
-Dvnc_png=$vnc_png \
-Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f \
-Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt \
- -Diconv=$iconv -Dcurses=$curses \
+ -Diconv=$iconv -Dcurses=$curses -Dlibudev=$libudev\
$cross_arg \
"$PWD" "$source_path"
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
diff --git a/meson_options.txt b/meson_options.txt
index e6cb1e589b..77b3fabd00 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -36,6 +36,8 @@ option('iconv', type : 'feature', value : 'auto',
description: 'Font glyph conversion support')
option('curses', type : 'feature', value : 'auto',
description: 'curses UI')
+option('libudev', type : 'feature', value : 'auto',
+ description: 'Use libudev to enumerate host devices')
option('sdl', type : 'feature', value : 'auto',
description: 'SDL user interface')
option('sdl_image', type : 'feature', value : 'auto',
--
2.26.2
- [PULL 00/22] Build system + misc changes for 2020-10-16, Paolo Bonzini, 2020/10/16
- [PULL 01/22] submodules: bump meson to 0.55.3, Paolo Bonzini, 2020/10/16
- [PULL 02/22] Makefile: Ensure cscope.out/tags/TAGS are generated in the source tree, Paolo Bonzini, 2020/10/16
- [PULL 03/22] tests/Makefile.include: unbreak non-tcg builds, Paolo Bonzini, 2020/10/16
- [PULL 06/22] configure: move QEMU_INCLUDES to meson, Paolo Bonzini, 2020/10/16
- [PULL 05/22] tests: add missing generated sources to testqapi, Paolo Bonzini, 2020/10/16
- [PULL 08/22] add ninja to dockerfiles, CI configurations and test VMs, Paolo Bonzini, 2020/10/16
- [PULL 11/22] build: add --enable/--disable-libudev,
Paolo Bonzini <=
- [PULL 04/22] make: run shell with pipefail, Paolo Bonzini, 2020/10/16
- [PULL 14/22] configure: fix handling of --docdir parameter, Paolo Bonzini, 2020/10/16
- [PULL 07/22] dockerfiles: enable Centos 8 PowerTools, Paolo Bonzini, 2020/10/16
- [PULL 13/22] meson: cleanup curses/iconv test, Paolo Bonzini, 2020/10/16
- [PULL 12/22] meson.build: don't condition iconv detection on library detection, Paolo Bonzini, 2020/10/16
- [PULL 09/22] build: cleanups to Makefile, Paolo Bonzini, 2020/10/16
- [PULL 15/22] meson: Only install icons and qemu.desktop if have_system, Paolo Bonzini, 2020/10/16
- [PULL 16/22] docs: Fix Sphinx configuration for msys2/mingw, Paolo Bonzini, 2020/10/16
- [PULL 18/22] meson: Move the detection logic for sphinx to meson, Paolo Bonzini, 2020/10/16