Message ID | 20220420153407.73926-35-pbonzini@redhat.com |
---|---|
State | New |
Headers | show |
Series | Misc meson conversions for QEMU 7.1 | expand |
On Wed, Apr 20, 2022 at 8:05 PM Paolo Bonzini <pbonzini@redhat.com> wrote: > Finish the conversion by moving all the definitions and the constraint > checks to meson_options.txt and meson.build respectively. > > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> > lgtm Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> > --- > configure | 82 ----------------------------------- > meson.build | 33 +++++++++++--- > meson_options.txt | 10 +++++ > scripts/meson-buildoptions.sh | 15 +++++++ > 4 files changed, 51 insertions(+), 89 deletions(-) > > diff --git a/configure b/configure > index 3b38ff3c63..0cedfcf5a9 100755 > --- a/configure > +++ b/configure > @@ -282,11 +282,6 @@ EXTRA_CXXFLAGS="" > EXTRA_OBJCFLAGS="" > EXTRA_LDFLAGS="" > > -vhost_kernel="$default_feature" > -vhost_net="$default_feature" > -vhost_crypto="$default_feature" > -vhost_user="no" > -vhost_vdpa="$default_feature" > debug_tcg="no" > sanitizers="no" > tsan="no" > @@ -526,7 +521,6 @@ haiku) > ;; > linux) > linux="yes" > - vhost_user=${default_feature:-yes} > ;; > esac > > @@ -863,14 +857,6 @@ for opt do > ;; > --with-coroutine=*) coroutine="$optarg" > ;; > - --disable-vhost-net) vhost_net="no" > - ;; > - --enable-vhost-net) vhost_net="yes" > - ;; > - --disable-vhost-crypto) vhost_crypto="no" > - ;; > - --enable-vhost-crypto) vhost_crypto="yes" > - ;; > --disable-zlib-test) > ;; > --disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane) > @@ -882,18 +868,6 @@ for opt do > --enable-uuid|--disable-uuid) > echo "$0: $opt is obsolete, UUID support is always built" >&2 > ;; > - --disable-vhost-user) vhost_user="no" > - ;; > - --enable-vhost-user) vhost_user="yes" > - ;; > - --disable-vhost-vdpa) vhost_vdpa="no" > - ;; > - --enable-vhost-vdpa) vhost_vdpa="yes" > - ;; > - --disable-vhost-kernel) vhost_kernel="no" > - ;; > - --enable-vhost-kernel) vhost_kernel="yes" > - ;; > --disable-capstone) capstone="disabled" > ;; > --enable-capstone) capstone="enabled" > @@ -1092,11 +1066,6 @@ cat << EOF > debug-info debugging information > safe-stack SafeStack Stack Smash Protection. Depends on > clang/llvm >= 3.7 and requires coroutine backend > ucontext. > - vhost-net vhost-net kernel acceleration support > - vhost-crypto vhost-user-crypto backend support > - vhost-kernel vhost kernel backend support > - vhost-user vhost-user backend support > - vhost-vdpa vhost-vdpa kernel backend support > > NOTE: The object files are built at the place where configure is launched > EOF > @@ -1510,35 +1479,6 @@ else > exit 1 > fi > > -######################################### > -# vhost interdependencies and host support > - > -# vhost backends > -if test "$vhost_user" = "yes" && test "$mingw32" = "yes"; then > - error_exit "vhost-user is not available on Windows" > -fi > -test "$vhost_vdpa" = "" && vhost_vdpa=$linux > -if test "$vhost_vdpa" = "yes" && test "$linux" != "yes"; then > - error_exit "vhost-vdpa is only available on Linux" > -fi > -test "$vhost_kernel" = "" && vhost_kernel=$linux > -if test "$vhost_kernel" = "yes" && test "$linux" != "yes"; then > - error_exit "vhost-kernel is only available on Linux" > -fi > - > -# vhost-user backends > -test "$vhost_crypto" = "" && vhost_crypto=$vhost_user > -if test "$vhost_crypto" = "yes" && test "$vhost_user" = "no"; then > - error_exit "--enable-vhost-crypto requires --enable-vhost-user" > -fi > - > -# OR the vhost-kernel, vhost-vdpa and vhost-user values for simplicity > -if test "$vhost_net" = ""; then > - test "$vhost_user" = "yes" && vhost_net=yes > - test "$vhost_vdpa" = "yes" && vhost_net=yes > - test "$vhost_kernel" = "yes" && vhost_net=yes > -fi > - > ########################################## > # pkg-config probe > > @@ -2058,28 +1998,6 @@ if test "$modules" = "yes"; then > echo "CONFIG_MODULES=y" >> $config_host_mak > fi > > -if test "$vhost_net" = "yes" ; then > - echo "CONFIG_VHOST_NET=y" >> $config_host_mak > -fi > -if test "$vhost_user" = "yes" ; then > - echo "CONFIG_VHOST_NET_USER=y" >> $config_host_mak > -fi > -if test "$vhost_vdpa" = "yes" ; then > - echo "CONFIG_VHOST_NET_VDPA=y" >> $config_host_mak > -fi > -if test "$vhost_crypto" = "yes" ; then > - echo "CONFIG_VHOST_CRYPTO=y" >> $config_host_mak > -fi > -if test "$vhost_kernel" = "yes" ; then > - echo "CONFIG_VHOST_KERNEL=y" >> $config_host_mak > -fi > -if test "$vhost_user" = "yes" ; then > - echo "CONFIG_VHOST_USER=y" >> $config_host_mak > -fi > -if test "$vhost_vdpa" = "yes" ; then > - echo "CONFIG_VHOST_VDPA=y" >> $config_host_mak > -fi > - > # XXX: suppress that > if [ "$bsd" = "yes" ] ; then > echo "CONFIG_BSD=y" >> $config_host_mak > diff --git a/meson.build b/meson.build > index e8446cf148..499082bf55 100644 > --- a/meson.build > +++ b/meson.build > @@ -313,14 +313,26 @@ have_tpm = get_option('tpm') \ > .allowed() > > # vhost > -have_vhost_user = 'CONFIG_VHOST_USER' in config_host > -have_vhost_vdpa = 'CONFIG_VHOST_VDPA' in config_host > -have_vhost_kernel = 'CONFIG_VHOST_KERNEL' in config_host > -have_vhost_net_user = 'CONFIG_VHOST_NET_USER' in config_host > -have_vhost_net_vdpa = 'CONFIG_VHOST_NET_VDPA' in config_host > -have_vhost_net = 'CONFIG_VHOST_NET' in config_host > +have_vhost_user = get_option('vhost_user') \ > + .disable_auto_if(targetos != 'linux') \ > + .require(targetos != 'windows', > + error_message: 'vhost-user is not available on > Windows').allowed() > +have_vhost_vdpa = get_option('vhost_vdpa') \ > + .require(targetos == 'linux', > + error_message: 'vhost-vdpa is only available on > Linux').allowed() > +have_vhost_kernel = get_option('vhost_kernel') \ > + .require(targetos == 'linux', > + error_message: 'vhost-kernel is only available on > Linux').allowed() > +have_vhost_user_crypto = get_option('vhost_crypto') \ > + .require(have_vhost_user, > + error_message: 'vhost-crypto requires vhost-user to be > enabled').allowed() > + > have_vhost = have_vhost_user or have_vhost_vdpa or have_vhost_kernel > -have_vhost_user_crypto = 'CONFIG_VHOST_CRYPTO' in config_host > + > +have_vhost_net_user = have_vhost_user and > get_option('vhost_net').allowed() > +have_vhost_net_vdpa = have_vhost_vdpa and > get_option('vhost_net').allowed() > +have_vhost_net_kernel = have_vhost_kernel and > get_option('vhost_net').allowed() > +have_vhost_net = have_vhost_net_kernel or have_vhost_net_user or > have_vhost_net_vdpa > > # Target-specific libraries and flags > libm = cc.find_library('m', required: false) > @@ -1709,6 +1721,13 @@ config_host_data.set('CONFIG_SNAPPY', > snappy.found()) > config_host_data.set('CONFIG_TPM', have_tpm) > config_host_data.set('CONFIG_USB_LIBUSB', libusb.found()) > config_host_data.set('CONFIG_VDE', vde.found()) > +config_host_data.set('CONFIG_VHOST_NET', have_vhost_net) > +config_host_data.set('CONFIG_VHOST_NET_USER', have_vhost_net_user) > +config_host_data.set('CONFIG_VHOST_NET_VDPA', have_vhost_net_vdpa) > +config_host_data.set('CONFIG_VHOST_KERNEL', have_vhost_kernel) > +config_host_data.set('CONFIG_VHOST_USER', have_vhost_user) > +config_host_data.set('CONFIG_VHOST_CRYPTO', have_vhost_user_crypto) > +config_host_data.set('CONFIG_VHOST_VDPA', have_vhost_vdpa) > config_host_data.set('CONFIG_VHOST_USER_BLK_SERVER', > have_vhost_user_blk_server) > config_host_data.set('CONFIG_VNC', vnc.found()) > config_host_data.set('CONFIG_VNC_JPEG', jpeg.found()) > diff --git a/meson_options.txt b/meson_options.txt > index 8efd5f520c..24a2a593f0 100644 > --- a/meson_options.txt > +++ b/meson_options.txt > @@ -235,6 +235,16 @@ option('oss', type: 'feature', value: 'auto', > option('pa', type: 'feature', value: 'auto', > description: 'PulseAudio sound support') > > +option('vhost_kernel', type: 'feature', value: 'auto', > + description: 'vhost kernel backend support') > +option('vhost_net', type: 'feature', value: 'auto', > + description: 'vhost-net kernel acceleration support') > +option('vhost_user', type: 'feature', value: 'auto', > + description: 'vhost-user backend support') > +option('vhost_crypto', type: 'feature', value: 'auto', > + description: 'vhost-user crypto backend support') > +option('vhost_vdpa', type: 'feature', value: 'auto', > + description: 'vhost-vdpa kernel backend support') > option('vhost_user_blk_server', type: 'feature', value: 'auto', > description: 'build vhost-user-blk server') > option('virtfs', type: 'feature', value: 'auto', > diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh > index 274639777e..28258e1478 100644 > --- a/scripts/meson-buildoptions.sh > +++ b/scripts/meson-buildoptions.sh > @@ -153,8 +153,13 @@ meson_options_help() { > printf "%s\n" ' usb-redir libusbredir support' > printf "%s\n" ' vde vde network backend support' > printf "%s\n" ' vdi vdi image format support' > + printf "%s\n" ' vhost-crypto vhost-user crypto backend support' > + printf "%s\n" ' vhost-kernel vhost kernel backend support' > + printf "%s\n" ' vhost-net vhost-net kernel acceleration support' > + printf "%s\n" ' vhost-user vhost-user backend support' > printf "%s\n" ' vhost-user-blk-server' > printf "%s\n" ' build vhost-user-blk server' > + printf "%s\n" ' vhost-vdpa vhost-vdpa kernel backend support' > printf "%s\n" ' virglrenderer virgl rendering support' > printf "%s\n" ' virtfs virtio-9p support' > printf "%s\n" ' virtiofsd build virtiofs daemon (virtiofsd)' > @@ -407,8 +412,18 @@ _meson_option_parse() { > --disable-vde) printf "%s" -Dvde=disabled ;; > --enable-vdi) printf "%s" -Dvdi=enabled ;; > --disable-vdi) printf "%s" -Dvdi=disabled ;; > + --enable-vhost-crypto) printf "%s" -Dvhost_crypto=enabled ;; > + --disable-vhost-crypto) printf "%s" -Dvhost_crypto=disabled ;; > + --enable-vhost-kernel) printf "%s" -Dvhost_kernel=enabled ;; > + --disable-vhost-kernel) printf "%s" -Dvhost_kernel=disabled ;; > + --enable-vhost-net) printf "%s" -Dvhost_net=enabled ;; > + --disable-vhost-net) printf "%s" -Dvhost_net=disabled ;; > + --enable-vhost-user) printf "%s" -Dvhost_user=enabled ;; > + --disable-vhost-user) printf "%s" -Dvhost_user=disabled ;; > --enable-vhost-user-blk-server) printf "%s" > -Dvhost_user_blk_server=enabled ;; > --disable-vhost-user-blk-server) printf "%s" > -Dvhost_user_blk_server=disabled ;; > + --enable-vhost-vdpa) printf "%s" -Dvhost_vdpa=enabled ;; > + --disable-vhost-vdpa) printf "%s" -Dvhost_vdpa=disabled ;; > --enable-virglrenderer) printf "%s" -Dvirglrenderer=enabled ;; > --disable-virglrenderer) printf "%s" -Dvirglrenderer=disabled ;; > --enable-virtfs) printf "%s" -Dvirtfs=enabled ;; > -- > 2.35.1 > > >
diff --git a/configure b/configure index 3b38ff3c63..0cedfcf5a9 100755 --- a/configure +++ b/configure @@ -282,11 +282,6 @@ EXTRA_CXXFLAGS="" EXTRA_OBJCFLAGS="" EXTRA_LDFLAGS="" -vhost_kernel="$default_feature" -vhost_net="$default_feature" -vhost_crypto="$default_feature" -vhost_user="no" -vhost_vdpa="$default_feature" debug_tcg="no" sanitizers="no" tsan="no" @@ -526,7 +521,6 @@ haiku) ;; linux) linux="yes" - vhost_user=${default_feature:-yes} ;; esac @@ -863,14 +857,6 @@ for opt do ;; --with-coroutine=*) coroutine="$optarg" ;; - --disable-vhost-net) vhost_net="no" - ;; - --enable-vhost-net) vhost_net="yes" - ;; - --disable-vhost-crypto) vhost_crypto="no" - ;; - --enable-vhost-crypto) vhost_crypto="yes" - ;; --disable-zlib-test) ;; --disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane) @@ -882,18 +868,6 @@ for opt do --enable-uuid|--disable-uuid) echo "$0: $opt is obsolete, UUID support is always built" >&2 ;; - --disable-vhost-user) vhost_user="no" - ;; - --enable-vhost-user) vhost_user="yes" - ;; - --disable-vhost-vdpa) vhost_vdpa="no" - ;; - --enable-vhost-vdpa) vhost_vdpa="yes" - ;; - --disable-vhost-kernel) vhost_kernel="no" - ;; - --enable-vhost-kernel) vhost_kernel="yes" - ;; --disable-capstone) capstone="disabled" ;; --enable-capstone) capstone="enabled" @@ -1092,11 +1066,6 @@ cat << EOF debug-info debugging information safe-stack SafeStack Stack Smash Protection. Depends on clang/llvm >= 3.7 and requires coroutine backend ucontext. - vhost-net vhost-net kernel acceleration support - vhost-crypto vhost-user-crypto backend support - vhost-kernel vhost kernel backend support - vhost-user vhost-user backend support - vhost-vdpa vhost-vdpa kernel backend support NOTE: The object files are built at the place where configure is launched EOF @@ -1510,35 +1479,6 @@ else exit 1 fi -######################################### -# vhost interdependencies and host support - -# vhost backends -if test "$vhost_user" = "yes" && test "$mingw32" = "yes"; then - error_exit "vhost-user is not available on Windows" -fi -test "$vhost_vdpa" = "" && vhost_vdpa=$linux -if test "$vhost_vdpa" = "yes" && test "$linux" != "yes"; then - error_exit "vhost-vdpa is only available on Linux" -fi -test "$vhost_kernel" = "" && vhost_kernel=$linux -if test "$vhost_kernel" = "yes" && test "$linux" != "yes"; then - error_exit "vhost-kernel is only available on Linux" -fi - -# vhost-user backends -test "$vhost_crypto" = "" && vhost_crypto=$vhost_user -if test "$vhost_crypto" = "yes" && test "$vhost_user" = "no"; then - error_exit "--enable-vhost-crypto requires --enable-vhost-user" -fi - -# OR the vhost-kernel, vhost-vdpa and vhost-user values for simplicity -if test "$vhost_net" = ""; then - test "$vhost_user" = "yes" && vhost_net=yes - test "$vhost_vdpa" = "yes" && vhost_net=yes - test "$vhost_kernel" = "yes" && vhost_net=yes -fi - ########################################## # pkg-config probe @@ -2058,28 +1998,6 @@ if test "$modules" = "yes"; then echo "CONFIG_MODULES=y" >> $config_host_mak fi -if test "$vhost_net" = "yes" ; then - echo "CONFIG_VHOST_NET=y" >> $config_host_mak -fi -if test "$vhost_user" = "yes" ; then - echo "CONFIG_VHOST_NET_USER=y" >> $config_host_mak -fi -if test "$vhost_vdpa" = "yes" ; then - echo "CONFIG_VHOST_NET_VDPA=y" >> $config_host_mak -fi -if test "$vhost_crypto" = "yes" ; then - echo "CONFIG_VHOST_CRYPTO=y" >> $config_host_mak -fi -if test "$vhost_kernel" = "yes" ; then - echo "CONFIG_VHOST_KERNEL=y" >> $config_host_mak -fi -if test "$vhost_user" = "yes" ; then - echo "CONFIG_VHOST_USER=y" >> $config_host_mak -fi -if test "$vhost_vdpa" = "yes" ; then - echo "CONFIG_VHOST_VDPA=y" >> $config_host_mak -fi - # XXX: suppress that if [ "$bsd" = "yes" ] ; then echo "CONFIG_BSD=y" >> $config_host_mak diff --git a/meson.build b/meson.build index e8446cf148..499082bf55 100644 --- a/meson.build +++ b/meson.build @@ -313,14 +313,26 @@ have_tpm = get_option('tpm') \ .allowed() # vhost -have_vhost_user = 'CONFIG_VHOST_USER' in config_host -have_vhost_vdpa = 'CONFIG_VHOST_VDPA' in config_host -have_vhost_kernel = 'CONFIG_VHOST_KERNEL' in config_host -have_vhost_net_user = 'CONFIG_VHOST_NET_USER' in config_host -have_vhost_net_vdpa = 'CONFIG_VHOST_NET_VDPA' in config_host -have_vhost_net = 'CONFIG_VHOST_NET' in config_host +have_vhost_user = get_option('vhost_user') \ + .disable_auto_if(targetos != 'linux') \ + .require(targetos != 'windows', + error_message: 'vhost-user is not available on Windows').allowed() +have_vhost_vdpa = get_option('vhost_vdpa') \ + .require(targetos == 'linux', + error_message: 'vhost-vdpa is only available on Linux').allowed() +have_vhost_kernel = get_option('vhost_kernel') \ + .require(targetos == 'linux', + error_message: 'vhost-kernel is only available on Linux').allowed() +have_vhost_user_crypto = get_option('vhost_crypto') \ + .require(have_vhost_user, + error_message: 'vhost-crypto requires vhost-user to be enabled').allowed() + have_vhost = have_vhost_user or have_vhost_vdpa or have_vhost_kernel -have_vhost_user_crypto = 'CONFIG_VHOST_CRYPTO' in config_host + +have_vhost_net_user = have_vhost_user and get_option('vhost_net').allowed() +have_vhost_net_vdpa = have_vhost_vdpa and get_option('vhost_net').allowed() +have_vhost_net_kernel = have_vhost_kernel and get_option('vhost_net').allowed() +have_vhost_net = have_vhost_net_kernel or have_vhost_net_user or have_vhost_net_vdpa # Target-specific libraries and flags libm = cc.find_library('m', required: false) @@ -1709,6 +1721,13 @@ config_host_data.set('CONFIG_SNAPPY', snappy.found()) config_host_data.set('CONFIG_TPM', have_tpm) config_host_data.set('CONFIG_USB_LIBUSB', libusb.found()) config_host_data.set('CONFIG_VDE', vde.found()) +config_host_data.set('CONFIG_VHOST_NET', have_vhost_net) +config_host_data.set('CONFIG_VHOST_NET_USER', have_vhost_net_user) +config_host_data.set('CONFIG_VHOST_NET_VDPA', have_vhost_net_vdpa) +config_host_data.set('CONFIG_VHOST_KERNEL', have_vhost_kernel) +config_host_data.set('CONFIG_VHOST_USER', have_vhost_user) +config_host_data.set('CONFIG_VHOST_CRYPTO', have_vhost_user_crypto) +config_host_data.set('CONFIG_VHOST_VDPA', have_vhost_vdpa) config_host_data.set('CONFIG_VHOST_USER_BLK_SERVER', have_vhost_user_blk_server) config_host_data.set('CONFIG_VNC', vnc.found()) config_host_data.set('CONFIG_VNC_JPEG', jpeg.found()) diff --git a/meson_options.txt b/meson_options.txt index 8efd5f520c..24a2a593f0 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -235,6 +235,16 @@ option('oss', type: 'feature', value: 'auto', option('pa', type: 'feature', value: 'auto', description: 'PulseAudio sound support') +option('vhost_kernel', type: 'feature', value: 'auto', + description: 'vhost kernel backend support') +option('vhost_net', type: 'feature', value: 'auto', + description: 'vhost-net kernel acceleration support') +option('vhost_user', type: 'feature', value: 'auto', + description: 'vhost-user backend support') +option('vhost_crypto', type: 'feature', value: 'auto', + description: 'vhost-user crypto backend support') +option('vhost_vdpa', type: 'feature', value: 'auto', + description: 'vhost-vdpa kernel backend support') option('vhost_user_blk_server', type: 'feature', value: 'auto', description: 'build vhost-user-blk server') option('virtfs', type: 'feature', value: 'auto', diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh index 274639777e..28258e1478 100644 --- a/scripts/meson-buildoptions.sh +++ b/scripts/meson-buildoptions.sh @@ -153,8 +153,13 @@ meson_options_help() { printf "%s\n" ' usb-redir libusbredir support' printf "%s\n" ' vde vde network backend support' printf "%s\n" ' vdi vdi image format support' + printf "%s\n" ' vhost-crypto vhost-user crypto backend support' + printf "%s\n" ' vhost-kernel vhost kernel backend support' + printf "%s\n" ' vhost-net vhost-net kernel acceleration support' + printf "%s\n" ' vhost-user vhost-user backend support' printf "%s\n" ' vhost-user-blk-server' printf "%s\n" ' build vhost-user-blk server' + printf "%s\n" ' vhost-vdpa vhost-vdpa kernel backend support' printf "%s\n" ' virglrenderer virgl rendering support' printf "%s\n" ' virtfs virtio-9p support' printf "%s\n" ' virtiofsd build virtiofs daemon (virtiofsd)' @@ -407,8 +412,18 @@ _meson_option_parse() { --disable-vde) printf "%s" -Dvde=disabled ;; --enable-vdi) printf "%s" -Dvdi=enabled ;; --disable-vdi) printf "%s" -Dvdi=disabled ;; + --enable-vhost-crypto) printf "%s" -Dvhost_crypto=enabled ;; + --disable-vhost-crypto) printf "%s" -Dvhost_crypto=disabled ;; + --enable-vhost-kernel) printf "%s" -Dvhost_kernel=enabled ;; + --disable-vhost-kernel) printf "%s" -Dvhost_kernel=disabled ;; + --enable-vhost-net) printf "%s" -Dvhost_net=enabled ;; + --disable-vhost-net) printf "%s" -Dvhost_net=disabled ;; + --enable-vhost-user) printf "%s" -Dvhost_user=enabled ;; + --disable-vhost-user) printf "%s" -Dvhost_user=disabled ;; --enable-vhost-user-blk-server) printf "%s" -Dvhost_user_blk_server=enabled ;; --disable-vhost-user-blk-server) printf "%s" -Dvhost_user_blk_server=disabled ;; + --enable-vhost-vdpa) printf "%s" -Dvhost_vdpa=enabled ;; + --disable-vhost-vdpa) printf "%s" -Dvhost_vdpa=disabled ;; --enable-virglrenderer) printf "%s" -Dvirglrenderer=enabled ;; --disable-virglrenderer) printf "%s" -Dvirglrenderer=disabled ;; --enable-virtfs) printf "%s" -Dvirtfs=enabled ;;
Finish the conversion by moving all the definitions and the constraint checks to meson_options.txt and meson.build respectively. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> --- configure | 82 ----------------------------------- meson.build | 33 +++++++++++--- meson_options.txt | 10 +++++ scripts/meson-buildoptions.sh | 15 +++++++ 4 files changed, 51 insertions(+), 89 deletions(-)