All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: [PATCH 18/24] configure, meson: move Spice configure handling to meson
Date: Thu,  7 Oct 2021 15:08:23 +0200	[thread overview]
Message-ID: <20211007130829.632254-13-pbonzini@redhat.com> (raw)
In-Reply-To: <20211007130630.632028-1-pbonzini@redhat.com>

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Add meson feature options for Spice and Spice protocol, and move
detection logic out of configure.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20211007102453.978041-1-marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 chardev/meson.build |  2 +-
 configure           | 47 +--------------------------------------------
 meson.build         | 29 +++++++++++++++++-----------
 meson_options.txt   |  4 ++++
 ui/meson.build      |  4 ++--
 5 files changed, 26 insertions(+), 60 deletions(-)

diff --git a/chardev/meson.build b/chardev/meson.build
index 32377af383..325ba2bdb9 100644
--- a/chardev/meson.build
+++ b/chardev/meson.build
@@ -35,7 +35,7 @@ if brlapi.found()
   chardev_modules += { 'baum': module_ss }
 endif
 
-if config_host.has_key('CONFIG_SPICE')
+if spice.found()
   module_ss = ss.source_set()
   module_ss.add(when: [spice], if_true: files('spice.c'))
   chardev_modules += { 'spice': module_ss }
diff --git a/configure b/configure
index bb3bb3e58f..016814d23b 100755
--- a/configure
+++ b/configure
@@ -369,7 +369,7 @@ pie=""
 qom_cast_debug="yes"
 trace_backends="log"
 trace_file="trace"
-spice="$default_feature"
+spice="auto"
 spice_protocol="auto"
 rbd="auto"
 smartcard="auto"
@@ -3229,41 +3229,6 @@ EOF
   fi
 fi
 
-##########################################
-# spice probe
-if test "$spice_protocol" != "no" ; then
-  spice_protocol_cflags=$($pkg_config --cflags spice-protocol 2>/dev/null)
-  if $pkg_config --atleast-version=0.12.3 spice-protocol; then
-    spice_protocol="yes"
-  else
-    if test "$spice_protocol" = "yes" ; then
-      feature_not_found "spice_protocol" \
-          "Install spice-protocol(>=0.12.3) devel"
-    fi
-    spice_protocol="no"
-  fi
-fi
-
-if test "$spice" != "no" ; then
-  cat > $TMPC << EOF
-#include <spice.h>
-int main(void) { spice_server_new(); return 0; }
-EOF
-  spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null)
-  spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null)
-  if $pkg_config --atleast-version=0.12.5 spice-server && \
-     test "$spice_protocol" = "yes" && \
-     compile_prog "$spice_cflags" "$spice_libs" ; then
-    spice="yes"
-  else
-    if test "$spice" = "yes" ; then
-      feature_not_found "spice" \
-          "Install spice-server(>=0.12.5) devel"
-    fi
-    spice="no"
-  fi
-fi
-
 ##########################################
 # check if we have VSS SDK headers for win
 
@@ -4233,16 +4198,6 @@ if test "$tcg" = "enabled" -a "$tcg_interpreter" = "true" ; then
   echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
 fi
 
-if test "$spice_protocol" = "yes" ; then
-  echo "CONFIG_SPICE_PROTOCOL=y" >> $config_host_mak
-  echo "SPICE_PROTOCOL_CFLAGS=$spice_protocol_cflags" >> $config_host_mak
-fi
-if test "$spice" = "yes" ; then
-  echo "CONFIG_SPICE=y" >> $config_host_mak
-  echo "SPICE_CFLAGS=$spice_cflags $spice_protocol_cflags" >> $config_host_mak
-  echo "SPICE_LIBS=$spice_libs" >> $config_host_mak
-fi
-
 if test "$opengl" = "yes" ; then
   echo "CONFIG_OPENGL=y" >> $config_host_mak
   echo "OPENGL_CFLAGS=$opengl_cflags" >> $config_host_mak
diff --git a/meson.build b/meson.build
index 96f87630f0..0721309ed1 100644
--- a/meson.build
+++ b/meson.build
@@ -542,17 +542,20 @@ if not get_option('jack').auto() or have_system
                     method: 'pkg-config', kwargs: static_kwargs)
 endif
 
-spice = not_found
-spice_headers = not_found
 spice_protocol = not_found
-if 'CONFIG_SPICE' in config_host
-  spice = declare_dependency(compile_args: config_host['SPICE_CFLAGS'].split(),
-                             link_args: config_host['SPICE_LIBS'].split())
-  spice_headers = declare_dependency(compile_args: config_host['SPICE_CFLAGS'].split())
+if not get_option('spice_protocol').auto() or have_system
+  spice_protocol = dependency('spice-protocol', version: '>=0.12.3',
+                              required: get_option('spice_protocol'),
+                              method: 'pkg-config', kwargs: static_kwargs)
 endif
-if 'CONFIG_SPICE_PROTOCOL' in config_host
-  spice_protocol = declare_dependency(compile_args: config_host['SPICE_PROTOCOL_CFLAGS'].split())
+spice = not_found
+if not get_option('spice').auto() or have_system
+  spice = dependency('spice-server', version: '>=0.12.5',
+                     required: get_option('spice'),
+                     method: 'pkg-config', kwargs: static_kwargs)
 endif
+spice_headers = spice.partial_dependency(compile_args: true, includes: true)
+
 rt = cc.find_library('rt', required: false)
 libdl = not_found
 if 'CONFIG_PLUGIN' in config_host
@@ -1483,6 +1486,8 @@ config_host_data.set('CONFIG_STATX', has_statx)
 config_host_data.set('CONFIG_ZSTD', zstd.found())
 config_host_data.set('CONFIG_FUSE', fuse.found())
 config_host_data.set('CONFIG_FUSE_LSEEK', fuse_lseek.found())
+config_host_data.set('CONFIG_SPICE_PROTOCOL', spice_protocol.found())
+config_host_data.set('CONFIG_SPICE', spice.found())
 config_host_data.set('CONFIG_X11', x11.found())
 config_host_data.set('CONFIG_CFI', get_option('cfi'))
 config_host_data.set('QEMU_VERSION', '"@0@"'.format(meson.project_version()))
@@ -1764,7 +1769,7 @@ have_ivshmem = config_host_data.get('CONFIG_EVENTFD')
 host_kconfig = \
   (get_option('fuzzing') ? ['CONFIG_FUZZ=y'] : []) + \
   ('CONFIG_TPM' in config_host ? ['CONFIG_TPM=y'] : []) + \
-  ('CONFIG_SPICE' in config_host ? ['CONFIG_SPICE=y'] : []) + \
+  (spice.found() ? ['CONFIG_SPICE=y'] : []) + \
   (have_ivshmem ? ['CONFIG_IVSHMEM=y'] : []) + \
   ('CONFIG_OPENGL' in config_host ? ['CONFIG_OPENGL=y'] : []) + \
   (x11.found() ? ['CONFIG_X11=y'] : []) + \
@@ -3342,8 +3347,10 @@ summary_info += {'PVRDMA support':    config_host.has_key('CONFIG_PVRDMA')}
 summary_info += {'fdt support':       fdt_opt == 'disabled' ? false : fdt_opt}
 summary_info += {'libcap-ng support': libcap_ng}
 summary_info += {'bpf support':       libbpf}
-# TODO: add back protocol and server version
-summary_info += {'spice support':     config_host.has_key('CONFIG_SPICE')}
+summary_info += {'spice protocol support': spice_protocol}
+if spice_protocol.found()
+  summary_info += {'  spice server support': spice}
+endif
 summary_info += {'rbd support':       rbd}
 summary_info += {'xfsctl support':    config_host.has_key('CONFIG_XFS')}
 summary_info += {'smartcard support': cacard}
diff --git a/meson_options.txt b/meson_options.txt
index d8e67ae481..5a140af7f7 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -125,6 +125,10 @@ option('smartcard', type : 'feature', value : 'auto',
        description: 'CA smartcard emulation support')
 option('snappy', type : 'feature', value : 'auto',
        description: 'snappy compression support')
+option('spice', type : 'feature', value : 'auto',
+       description: 'Spice server support')
+option('spice_protocol', type : 'feature', value : 'auto',
+       description: 'Spice protocol support')
 option('u2f', type : 'feature', value : 'auto',
        description: 'U2F emulation support')
 option('usb_redir', type : 'feature', value : 'auto',
diff --git a/ui/meson.build b/ui/meson.build
index a73beb0e54..ee8ef27714 100644
--- a/ui/meson.build
+++ b/ui/meson.build
@@ -89,7 +89,7 @@ if sdl.found()
   ui_modules += {'sdl' : sdl_ss}
 endif
 
-if config_host.has_key('CONFIG_SPICE')
+if spice.found()
   spice_core_ss = ss.source_set()
   spice_core_ss.add(spice, pixman, files(
     'spice-core.c',
@@ -99,7 +99,7 @@ if config_host.has_key('CONFIG_SPICE')
   ui_modules += {'spice-core' : spice_core_ss}
 endif
 
-if config_host.has_key('CONFIG_SPICE') and config_host.has_key('CONFIG_GIO')
+if spice.found() and config_host.has_key('CONFIG_GIO')
   spice_ss = ss.source_set()
   spice_ss.add(spice, gio, pixman, files('spice-app.c'))
   ui_modules += {'spice-app': spice_ss}
-- 
2.31.1




  parent reply	other threads:[~2021-10-07 13:29 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-07 13:06 [PATCH 00/24] configure->meson queue for 6.2 Paolo Bonzini
2021-10-07 13:06 ` [PATCH 01/24] configure: remove --oss-lib Paolo Bonzini
2021-10-07 17:32   ` Thomas Huth
2021-10-07 20:42   ` Marc-André Lureau
2021-10-08  9:19     ` Paolo Bonzini
2021-10-07 13:06 ` [PATCH 02/24] audio: remove CONFIG_AUDIO_WIN_INT Paolo Bonzini
2021-10-07 20:42   ` Marc-André Lureau
2021-10-07 13:06 ` [PATCH 03/24] configure, meson: move audio driver detection to Meson Paolo Bonzini
2021-10-07 20:42   ` Marc-André Lureau
2021-10-07 13:06 ` [PATCH 04/24] meson: define symbols for all available audio drivers Paolo Bonzini
2021-10-07 13:06 ` [PATCH 05/24] configure: add command line options for " Paolo Bonzini
2021-10-07 20:42   ` Marc-André Lureau
2021-10-07 13:08 ` [PATCH 06/24] kconfig: split CONFIG_SPARSE_MEM from fuzzing Paolo Bonzini
2021-10-07 13:48   ` Philippe Mathieu-Daudé
2021-10-07 20:42   ` Marc-André Lureau
2021-10-08  3:08   ` Alexander Bulekov
2021-10-07 13:08 ` [PATCH 07/24] configure, meson: move fuzzing configuration to Meson Paolo Bonzini
2021-10-08  3:10   ` Alexander Bulekov
2021-10-07 13:08 ` [PATCH 08/24] trace: simple: pass trace_file unmodified to config-host.h Paolo Bonzini
2021-10-07 20:42   ` Marc-André Lureau
2021-10-07 13:08 ` [PATCH 09/24] trace: move configuration from configure to Meson Paolo Bonzini
2021-10-07 20:41   ` Marc-André Lureau
2021-10-07 13:08 ` [PATCH 10/24] configure, meson: move CONFIG_HOST_DSOSUF " Paolo Bonzini
2021-10-07 13:44   ` Philippe Mathieu-Daudé
2021-10-07 20:41   ` Marc-André Lureau
2021-10-07 13:08 ` [PATCH 11/24] configure, meson: get HOST_WORDS_BIGENDIAN via the machine object Paolo Bonzini
2021-10-07 13:45   ` Philippe Mathieu-Daudé
2021-10-07 20:41   ` Marc-André Lureau
2021-10-07 13:08 ` [PATCH 12/24] configure, meson: remove CONFIG_GCOV from config-host.mak Paolo Bonzini
2021-10-07 20:41   ` Marc-André Lureau
2021-10-07 13:08 ` [PATCH 13/24] configure, meson: move remaining HAVE_* compiler tests to Meson Paolo Bonzini
2021-10-07 20:41   ` Marc-André Lureau
2021-10-07 13:08 ` [PATCH 14/24] configure, meson: move pthread_setname_np checks " Paolo Bonzini
2021-10-07 20:41   ` Marc-André Lureau
2021-10-07 13:08 ` [PATCH 15/24] configure, meson: move libaio check to meson.build Paolo Bonzini
2021-10-07 19:24   ` Richard Henderson
2021-10-08  8:30     ` Paolo Bonzini
2021-10-08  8:47       ` Marc-André Lureau
2021-10-08  9:15         ` Paolo Bonzini
2021-10-07 13:08 ` [PATCH 16/24] configure, meson: move vde detection to meson Paolo Bonzini
2021-10-07 20:41   ` Marc-André Lureau
2021-10-07 13:08 ` [PATCH 17/24] configure, meson: move netmap " Paolo Bonzini
2021-10-07 17:55   ` Thomas Huth
2021-10-07 13:08 ` Paolo Bonzini [this message]
2021-10-07 13:08 ` [PATCH 19/24] configure: remove obsolete Solaris ar check Paolo Bonzini
2021-10-07 18:19   ` Thomas Huth
2021-10-07 20:41   ` Marc-André Lureau
2021-10-07 13:08 ` [PATCH 20/24] configure, meson: move more compiler checks to Meson Paolo Bonzini
2021-10-07 20:41   ` Marc-André Lureau
2021-10-07 13:08 ` [PATCH 21/24] configure: remove deprecated --{enable, disable}-git-update Paolo Bonzini
2021-10-07 20:41   ` Marc-André Lureau
2021-10-07 13:08 ` [PATCH 22/24] configure: accept "internal" for --enable-capstone/slirp/fdt Paolo Bonzini
2021-10-07 20:41   ` Marc-André Lureau
2021-10-07 13:08 ` [PATCH 23/24] configure: prepare for auto-generated option parsing Paolo Bonzini
2021-10-07 16:53   ` Thomas Huth
2021-10-08  8:42     ` Paolo Bonzini
2021-10-07 13:08 ` [PATCH 24/24] configure: automatically parse command line for meson -D options Paolo Bonzini
2021-10-07 20:41   ` Marc-André Lureau
2021-10-08  8:43     ` Paolo Bonzini
2021-10-08  8:46       ` Marc-André Lureau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211007130829.632254-13-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.