diff options
-rwxr-xr-x | configure | 55 | ||||
-rw-r--r-- | meson.build | 29 | ||||
-rw-r--r-- | meson_options.txt | 2 | ||||
-rw-r--r-- | ui/meson.build | 2 |
4 files changed, 30 insertions, 58 deletions
@@ -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 @@ -2760,31 +2760,6 @@ EOF 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 if test "$gnutls" != "no"; then @@ -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 @@ -6501,7 +6458,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 e673c1578a..73d3cc5385 100644 --- a/meson.build +++ b/meson.build @@ -776,19 +776,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 @@ -1062,6 +1074,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()) @@ -2230,7 +2243,7 @@ subdir('tools') subdir('pc-bios') subdir('docs') subdir('tests') -if 'CONFIG_GTK' in config_host +if gtk.found() subdir('po') endif @@ -2247,7 +2260,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 @@ -2338,7 +2351,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 7948a8255c..72a3ca22d6 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -74,6 +74,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 cc764e1bd1..634fabab0d 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() |