From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: alex.bennee@linaro.org, marcandre.lureau@redhat.com,
berrange@redhat.com, stefanha@redhat.com
Subject: [PATCH 5/8] configure: move GTK+ detection to Meson
Date: Thu, 7 Jan 2021 15:00:36 +0100 [thread overview]
Message-ID: <20210107140039.467969-6-pbonzini@redhat.com> (raw)
In-Reply-To: <20210107140039.467969-1-pbonzini@redhat.com>
This also allows removing CONFIG_NEED_X11, all the ingredients
can be computed easily in meson.build.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
configure | 55 ++++++-----------------------------------------
meson.build | 29 ++++++++++++++++++-------
meson_options.txt | 2 ++
ui/meson.build | 2 +-
4 files changed, 30 insertions(+), 58 deletions(-)
diff --git a/configure b/configure
index e9d76c2c13..652cff7ba6 100755
--- a/configure
+++ b/configure
@@ -414,7 +414,7 @@ cfi="false"
cfi_debug="false"
seccomp="auto"
glusterfs="auto"
-gtk="$default_feature"
+gtk="auto"
tls_priority="NORMAL"
gnutls="$default_feature"
nettle="$default_feature"
@@ -1377,9 +1377,9 @@ for opt do
--enable-uuid|--disable-uuid)
echo "$0: $opt is obsolete, UUID support is always built" >&2
;;
- --disable-gtk) gtk="no"
+ --disable-gtk) gtk="disabled"
;;
- --enable-gtk) gtk="yes"
+ --enable-gtk) gtk="enabled"
;;
--tls-priority=*) tls_priority="$optarg"
;;
@@ -2329,10 +2329,10 @@ if test "$cocoa" = "enabled"; then
if test "$sdl" = "enabled"; then
error_exit "Cocoa and SDL UIs cannot both be enabled at once"
fi
- if test "$gtk" = "yes"; then
+ if test "$gtk" = "enabled"; then
error_exit "Cocoa and GTK UIs cannot both be enabled at once"
fi
- gtk=no
+ gtk=disabled
sdl=disabled
fi
@@ -2759,31 +2759,6 @@ EOF
fi
fi
-##########################################
-# GTK probe
-
-if test "$gtk" != "no"; then
- gtkpackage="gtk+-3.0"
- gtkx11package="gtk+-x11-3.0"
- gtkversion="3.22.0"
- if $pkg_config --exists "$gtkpackage >= $gtkversion"; then
- gtk_cflags=$($pkg_config --cflags $gtkpackage)
- gtk_libs=$($pkg_config --libs $gtkpackage)
- gtk_version=$($pkg_config --modversion $gtkpackage)
- if $pkg_config --exists "$gtkx11package >= $gtkversion"; then
- need_x11=yes
- gtk_cflags="$gtk_cflags $x11_cflags"
- gtk_libs="$gtk_libs $x11_libs"
- fi
- gtk="yes"
- elif test "$gtk" = "yes"; then
- feature_not_found "gtk" "Install gtk3-devel"
- else
- gtk="no"
- fi
-fi
-
-
##########################################
# GNUTLS probe
@@ -3640,16 +3615,6 @@ EOF
fi
fi
-if test "$opengl" = "yes" && test "$have_x11" = "yes"; then
- for target in $target_list; do
- case $target in
- lm32-softmmu) # milkymist-tmu2 requires X11 and OpenGL
- need_x11=yes
- ;;
- esac
- done
-fi
-
##########################################
# libxml2 probe
if test "$libxml2" != "no" ; then
@@ -5673,9 +5638,6 @@ fi
if test "$module_upgrades" = "yes"; then
echo "CONFIG_MODULE_UPGRADES=y" >> $config_host_mak
fi
-if test "$need_x11" = "yes"; then
- echo "CONFIG_NEED_X11=y" >> $config_host_mak
-fi
if test "$pipe2" = "yes" ; then
echo "CONFIG_PIPE2=y" >> $config_host_mak
fi
@@ -5763,11 +5725,6 @@ fi
if test "$bswap_h" = "yes" ; then
echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
fi
-if test "$gtk" = "yes" ; then
- echo "CONFIG_GTK=y" >> $config_host_mak
- echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak
- echo "GTK_LIBS=$gtk_libs" >> $config_host_mak
-fi
if test "$gio" = "yes" ; then
echo "CONFIG_GIO=y" >> $config_host_mak
echo "GIO_CFLAGS=$gio_cflags" >> $config_host_mak
@@ -6491,7 +6448,7 @@ NINJA=$ninja $meson setup \
-Dmalloc=$malloc -Dmalloc_trim=$malloc_trim -Dsparse=$sparse \
-Dkvm=$kvm -Dhax=$hax -Dwhpx=$whpx -Dhvf=$hvf \
-Dxen=$xen -Dxen_pci_passthrough=$xen_pci_passthrough -Dtcg=$tcg \
- -Dcocoa=$cocoa -Dmpath=$mpath -Dsdl=$sdl -Dsdl_image=$sdl_image \
+ -Dcocoa=$cocoa -Dgtk=$gtk -Dmpath=$mpath -Dsdl=$sdl -Dsdl_image=$sdl_image \
-Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg -Dvnc_png=$vnc_png \
-Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f -Dvirtiofsd=$virtiofsd \
-Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt -Dbrlapi=$brlapi \
diff --git a/meson.build b/meson.build
index fdd4312c71..a3a0958b4d 100644
--- a/meson.build
+++ b/meson.build
@@ -772,19 +772,31 @@ if 'CONFIG_OPENGL' in config_host
opengl = declare_dependency(compile_args: config_host['OPENGL_CFLAGS'].split(),
link_args: config_host['OPENGL_LIBS'].split())
endif
+
gtk = not_found
-if 'CONFIG_GTK' in config_host
- gtk = declare_dependency(compile_args: config_host['GTK_CFLAGS'].split(),
- link_args: config_host['GTK_LIBS'].split())
+gtkx11 = not_found
+if not get_option('gtk').auto() or have_system
+ gtk = dependency('gtk+-3.0', version: '>=3.22.0',
+ method: 'pkg-config',
+ required: get_option('gtk'),
+ static: enable_static)
+ if gtk.found()
+ gtkx11 = dependency('gtk+-x11-3.0', version: '>=3.22.0',
+ method: 'pkg-config',
+ required: false,
+ static: enable_static)
+ gtk = declare_dependency(dependencies: [gtk, gtkx11])
+ endif
endif
+
vte = not_found
if 'CONFIG_VTE' in config_host
vte = declare_dependency(compile_args: config_host['VTE_CFLAGS'].split(),
link_args: config_host['VTE_LIBS'].split())
endif
x11 = not_found
-if config_host.has_key('CONFIG_NEED_X11')
- x11 = dependency('x11', method: 'pkg-config', required: false,
+if gtkx11.found() or 'lm32-softmmu' in target_dirs
+ x11 = dependency('x11', method: 'pkg-config', required: gtkx11.found(),
static: enable_static)
endif
vnc = not_found
@@ -1058,6 +1070,7 @@ if glusterfs.found()
config_host_data.set('CONFIG_GLUSTERFS_FTRUNCATE_HAS_STAT', glusterfs_ftruncate_has_stat)
config_host_data.set('CONFIG_GLUSTERFS_IOCB_HAS_STAT', glusterfs_iocb_has_stat)
endif
+config_host_data.set('CONFIG_GTK', gtk.found())
config_host_data.set('CONFIG_LIBATTR', have_old_libattr)
config_host_data.set('CONFIG_LIBCAP_NG', libcap_ng.found())
config_host_data.set('CONFIG_LIBISCSI', libiscsi.found())
@@ -2229,7 +2242,7 @@ subdir('tools')
subdir('pc-bios')
subdir('docs')
subdir('tests')
-if 'CONFIG_GTK' in config_host
+if gtk.found()
subdir('po')
endif
@@ -2246,7 +2259,7 @@ if host_machine.system() == 'windows'
if build_docs
nsis_cmd += '-DCONFIG_DOCUMENTATION=y'
endif
- if 'CONFIG_GTK' in config_host
+ if gtk.found()
nsis_cmd += '-DCONFIG_GTK=y'
endif
@@ -2337,7 +2350,7 @@ endif
summary_info += {'SDL support': sdl.found()}
summary_info += {'SDL image support': sdl_image.found()}
# TODO: add back version
-summary_info += {'GTK support': config_host.has_key('CONFIG_GTK')}
+summary_info += {'GTK support': gtk.found()}
summary_info += {'pixman': pixman.found()}
# TODO: add back version
summary_info += {'VTE support': config_host.has_key('CONFIG_VTE')}
diff --git a/meson_options.txt b/meson_options.txt
index 41f9c2cf6c..b9b106675f 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -76,6 +76,8 @@ option('lzo', type : 'feature', value : 'auto',
description: 'lzo compression support')
option('rbd', type : 'feature', value : 'auto',
description: 'Ceph block device driver')
+option('gtk', type : 'feature', value : 'auto',
+ description: 'GTK+ user interface')
option('sdl', type : 'feature', value : 'auto',
description: 'SDL user interface')
option('sdl_image', type : 'feature', value : 'auto',
diff --git a/ui/meson.build b/ui/meson.build
index afbdd78e97..407e291ebe 100644
--- a/ui/meson.build
+++ b/ui/meson.build
@@ -57,7 +57,7 @@ if config_host.has_key('CONFIG_OPENGL_DMABUF')
ui_modules += {'egl-headless' : egl_headless_ss}
endif
-if config_host.has_key('CONFIG_GTK')
+if gtk.found()
softmmu_ss.add(when: 'CONFIG_WIN32', if_true: files('win32-kbd-hook.c'))
gtk_ss = ss.source_set()
--
2.29.2
next prev parent reply other threads:[~2021-01-07 14:05 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-07 14:00 [RFC PATCH v2 0/8] Automatically convert configure options to meson build options Paolo Bonzini
2021-01-07 14:00 ` [PATCH 1/8] build-system: clean up TCG/TCI configury Paolo Bonzini
2021-01-07 15:01 ` Peter Maydell
2021-01-07 15:50 ` Paolo Bonzini
2021-01-07 16:06 ` Daniel P. Berrangé
2021-01-13 13:09 ` Philippe Mathieu-Daudé
2021-01-13 13:42 ` Helge Deller
2021-01-13 13:57 ` Daniel P. Berrangé
2021-01-13 14:23 ` Peter Maydell
2021-01-13 20:39 ` Helge Deller
2021-01-13 14:23 ` Helge Deller
2021-01-13 14:34 ` Paolo Bonzini
2021-01-13 15:37 ` Helge Deller
2021-01-14 9:51 ` John Paul Adrian Glaubitz
2021-01-13 14:02 ` John David Anglin
2021-01-13 15:00 ` John Paul Adrian Glaubitz
2021-01-07 14:00 ` [PATCH 2/8] cocoa: do not enable coreaudio automatically Paolo Bonzini
2021-01-07 14:00 ` [PATCH 3/8] gtk: remove CONFIG_GTK_GL Paolo Bonzini
2021-01-07 16:05 ` Gerd Hoffmann
2021-01-07 14:00 ` [PATCH 4/8] configure: move X11 detection to Meson Paolo Bonzini
2021-01-07 14:00 ` Paolo Bonzini [this message]
2021-01-07 14:00 ` [PATCH 6/8] configure: move Cocoa incompatibility checks " Paolo Bonzini
2021-01-07 14:00 ` [PATCH 7/8] configure: quote command line arguments in config.status Paolo Bonzini
2021-01-13 15:44 ` Eric Blake
2021-01-07 14:00 ` [PATCH 8/8] configure: automatically parse command line for meson -D options Paolo Bonzini
2021-01-13 10:31 ` Daniel P. Berrangé
2021-01-13 12:26 ` Paolo Bonzini
2021-01-13 14:04 ` Paolo Bonzini
2021-01-22 8:00 ` 罗勇刚(Yonggang Luo)
2021-01-22 20:43 ` Paolo Bonzini
2021-01-23 3:30 ` 罗勇刚(Yonggang Luo)
2021-01-23 18:00 ` Paolo Bonzini
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=20210107140039.467969-6-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=berrange@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/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.