All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH v2 0/8] Automatically convert configure options to meson build options
@ 2021-01-07 14:00 Paolo Bonzini
  2021-01-07 14:00 ` [PATCH 1/8] build-system: clean up TCG/TCI configury Paolo Bonzini
                   ` (7 more replies)
  0 siblings, 8 replies; 32+ messages in thread
From: Paolo Bonzini @ 2021-01-07 14:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: alex.bennee, marcandre.lureau, berrange, stefanha

This is v2 of a concept that was first posted last September.  In the
meanwhile more options have been added to Meson, so the effect of the
change can hopefully be evaluated more accurately.  At least, the amount
of lines removed in the configure script is larger than the size of
the script itself!

Regarding the code itself, the main change is that the script has been
rewritten from Python to Perl.  The reasons for this are detailed in
the commit message.

For the parsing of an option to be completely automatic, there must be
no mentions of the corresponding variable in configure.  Patches 1 to
6 clean up some of the stragglers to enable more automatic conversions.
The only remaining options to be split between configure and Meson are
capstone, git, slirp, default_devices, cfi and xen.

Paolo

Paolo Bonzini (8):
  build-system: clean up TCG/TCI configury
  cocoa: do not enable coreaudio automatically
  gtk: remove CONFIG_GTK_GL
  configure: move X11 detection to Meson
  configure: move GTK+ detection to Meson
  configure: move Cocoa incompatibility checks to Meson
  configure: quote command line arguments in config.status
  configure: automatically parse command line for meson -D options

 Makefile                                |  11 +
 configure                               | 459 ++-------------
 disas/meson.build                       |   2 -
 docs/devel/build-system.rst             |  49 +-
 meson-buildoptions.json                 | 717 ++++++++++++++++++++++++
 meson.build                             | 100 ++--
 meson_options.txt                       |  13 +-
 scripts/configure-parse-buildoptions.pl | 205 +++++++
 ui/gtk.c                                |  16 +-
 ui/meson.build                          |   9 +-
 10 files changed, 1073 insertions(+), 508 deletions(-)
 create mode 100644 meson-buildoptions.json
 create mode 100755 scripts/configure-parse-buildoptions.pl

-- 
2.29.2



^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH 1/8] build-system: clean up TCG/TCI configury
  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 ` Paolo Bonzini
  2021-01-07 15:01   ` Peter Maydell
  2021-01-07 14:00 ` [PATCH 2/8] cocoa: do not enable coreaudio automatically Paolo Bonzini
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 32+ messages in thread
From: Paolo Bonzini @ 2021-01-07 14:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: alex.bennee, marcandre.lureau, berrange, stefanha

Make CONFIG_TCG_INTERPRETER a Meson option, and enable TCI (though with
a warning) if the host CPU is unsupported, making it more similar to
other --enable-* options.

Remove TCG-specific include paths from !CONFIG_TCG builds.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure         | 11 +++--------
 disas/meson.build |  2 --
 meson.build       | 50 ++++++++++++++++++++++++-----------------------
 meson_options.txt |  2 ++
 4 files changed, 31 insertions(+), 34 deletions(-)

diff --git a/configure b/configure
index 8e0de14aa6..81801a6fe0 100755
--- a/configure
+++ b/configure
@@ -355,7 +355,7 @@ sanitizers="no"
 tsan="no"
 fortify_source="$default_feature"
 strip_opt="yes"
-tcg_interpreter="no"
+tcg_interpreter="auto"
 bigendian="no"
 mingw32="no"
 gcov="no"
@@ -1117,9 +1117,9 @@ for opt do
   ;;
   --enable-whpx) whpx="enabled"
   ;;
-  --disable-tcg-interpreter) tcg_interpreter="no"
+  --disable-tcg-interpreter) tcg_interpreter="disabled"
   ;;
-  --enable-tcg-interpreter) tcg_interpreter="yes"
+  --enable-tcg-interpreter) tcg_interpreter="enabled"
   ;;
   --disable-cap-ng)  cap_ng="disabled"
   ;;
@@ -5911,11 +5911,6 @@ fi
 if test "$optreset" = "yes" ; then
   echo "HAVE_OPTRESET=y" >> $config_host_mak
 fi
-if test "$tcg" = "enabled"; then
-  if test "$tcg_interpreter" = "yes" ; then
-    echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
-  fi
-fi
 if test "$fdatasync" = "yes" ; then
   echo "CONFIG_FDATASYNC=y" >> $config_host_mak
 fi
diff --git a/disas/meson.build b/disas/meson.build
index 09a852742e..da341a511e 100644
--- a/disas/meson.build
+++ b/disas/meson.build
@@ -22,5 +22,3 @@ common_ss.add(when: 'CONFIG_SH4_DIS', if_true: files('sh4.c'))
 common_ss.add(when: 'CONFIG_SPARC_DIS', if_true: files('sparc.c'))
 common_ss.add(when: 'CONFIG_XTENSA_DIS', if_true: files('xtensa.c'))
 common_ss.add(when: capstone, if_true: files('capstone.c'))
-
-specific_ss.add(when: 'CONFIG_TCG_INTERPRETER', if_true: files('tci.c'))
diff --git a/meson.build b/meson.build
index 2742b37e14..36f1d02190 100644
--- a/meson.build
+++ b/meson.build
@@ -109,25 +109,8 @@ if targetos == 'linux'
                         language: ['c', 'cpp'])
 endif
 
-if 'CONFIG_TCG_INTERPRETER' in config_host
-  tcg_arch = 'tci'
-elif config_host['ARCH'] == 'sparc64'
-  tcg_arch = 'sparc'
-elif config_host['ARCH'] == 's390x'
-  tcg_arch = 's390'
-elif config_host['ARCH'] in ['x86_64', 'x32']
-  tcg_arch = 'i386'
-elif config_host['ARCH'] == 'ppc64'
-  tcg_arch = 'ppc'
-elif config_host['ARCH'] in ['riscv32', 'riscv64']
-  tcg_arch = 'riscv'
-else
-  tcg_arch = config_host['ARCH']
-endif
-add_project_arguments('-iquote', meson.current_source_dir() / 'tcg' / tcg_arch,
-                      '-iquote', '.',
+add_project_arguments('-iquote', '.',
                       '-iquote', meson.current_source_dir(),
-                      '-iquote', meson.current_source_dir() / 'accel/tcg',
                       '-iquote', meson.current_source_dir() / 'include',
                       '-iquote', meson.current_source_dir() / 'disas/libvixl',
                       language: ['c', 'cpp', 'objc'])
@@ -224,14 +207,31 @@ if not get_option('hax').disabled()
     accelerators += 'CONFIG_HAX'
   endif
 endif
+
+tcg_arch = config_host['ARCH']
 if not get_option('tcg').disabled()
-  if cpu not in supported_cpus
-    if 'CONFIG_TCG_INTERPRETER' in config_host
+  if get_option('tcg_interpreter').enabled() or cpu not in supported_cpus
+    if get_option('tcg_interpreter').disabled()
+      error('TCG interpreter disabled but host CPU @0@ supported'.format(cpu))
+    elif get_option('tcg_interpreter').auto()
       warning('Unsupported CPU @0@, will use TCG with TCI (experimental)'.format(cpu))
-    else
-      error('Unsupported CPU @0@, try --enable-tcg-interpreter'.format(cpu))
     endif
+    tcg_arch = 'tci'
+  elif config_host['ARCH'] == 'sparc64'
+    tcg_arch = 'sparc'
+  elif config_host['ARCH'] == 's390x'
+    tcg_arch = 's390'
+  elif config_host['ARCH'] in ['x86_64', 'x32']
+    tcg_arch = 'i386'
+  elif config_host['ARCH'] == 'ppc64'
+    tcg_arch = 'ppc'
+  elif config_host['ARCH'] in ['riscv32', 'riscv64']
+    tcg_arch = 'riscv'
   endif
+  add_project_arguments('-iquote', meson.current_source_dir() / 'tcg' / tcg_arch,
+                        '-iquote', meson.current_source_dir() / 'accel/tcg',
+                        language: ['c', 'cpp', 'objc'])
+
   accelerators += 'CONFIG_TCG'
   config_host += { 'CONFIG_TCG': 'y' }
 endif
@@ -1833,7 +1833,9 @@ specific_ss.add(when: 'CONFIG_TCG', if_true: files(
   'tcg/tcg-op.c',
   'tcg/tcg.c',
 ))
-specific_ss.add(when: 'CONFIG_TCG_INTERPRETER', if_true: files('disas/tci.c', 'tcg/tci.c'))
+if tcg_arch == 'tci'
+  specific_ss.add(files('disas/tci.c', 'tcg/tci.c'))
+endif
 
 subdir('backends')
 subdir('disas')
@@ -2392,7 +2394,7 @@ summary_info += {'WHPX support':      config_all.has_key('CONFIG_WHPX')}
 summary_info += {'TCG support':       config_all.has_key('CONFIG_TCG')}
 if config_all.has_key('CONFIG_TCG')
   summary_info += {'TCG debug enabled': config_host.has_key('CONFIG_DEBUG_TCG')}
-  summary_info += {'TCG interpreter':   config_host.has_key('CONFIG_TCG_INTERPRETER')}
+  summary_info += {'TCG interpreter':   tcg_arch == 'tci'}
 endif
 summary_info += {'malloc trim support': has_malloc_trim}
 summary_info += {'RDMA support':      config_host.has_key('CONFIG_RDMA')}
diff --git a/meson_options.txt b/meson_options.txt
index 7948a8255c..41f9c2cf6c 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -37,6 +37,8 @@ option('xen_pci_passthrough', type: 'feature', value: 'auto',
        description: 'Xen PCI passthrough support')
 option('tcg', type: 'feature', value: 'auto',
        description: 'TCG support')
+option('tcg_interpreter', type: 'feature', value: 'auto',
+       description: 'TCG bytecode interpreter (TCI)')
 option('cfi', type: 'boolean', value: 'false',
        description: 'Control-Flow Integrity (CFI)')
 option('cfi_debug', type: 'boolean', value: 'false',
-- 
2.29.2




^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 2/8] cocoa: do not enable coreaudio automatically
  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 14:00 ` Paolo Bonzini
  2021-01-07 14:00 ` [PATCH 3/8] gtk: remove CONFIG_GTK_GL Paolo Bonzini
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 32+ messages in thread
From: Paolo Bonzini @ 2021-01-07 14:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: alex.bennee, marcandre.lureau, berrange, stefanha

Remove the automagic connection between --enable-cocoa
and enabling coreaudio in audio_drv_list.  It can be
overridden anyway just by placing --enable-cocoa before
--audio-drv-list.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/configure b/configure
index 81801a6fe0..2dd772a60c 100755
--- a/configure
+++ b/configure
@@ -1149,9 +1149,7 @@ for opt do
   ;;
   --disable-cocoa) cocoa="disabled"
   ;;
-  --enable-cocoa)
-      cocoa="enabled" ;
-      audio_drv_list="coreaudio $(echo $audio_drv_list | sed s,coreaudio,,g)"
+  --enable-cocoa) cocoa="enabled"
   ;;
   --disable-system) softmmu="no"
   ;;
-- 
2.29.2




^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 3/8] gtk: remove CONFIG_GTK_GL
  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 14:00 ` [PATCH 2/8] cocoa: do not enable coreaudio automatically Paolo Bonzini
@ 2021-01-07 14:00 ` 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
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 32+ messages in thread
From: Paolo Bonzini @ 2021-01-07 14:00 UTC (permalink / raw)
  To: qemu-devel
  Cc: alex.bennee, marcandre.lureau, berrange, Gerd Hoffmann, stefanha

CONFIG_GTK_GL is defined if OpenGL is present and GTK+
is 3.16 or newer.  Since GTK+ 3.22 is the minimum supported
version, just use CONFIG_OPENGL instead.

Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure      |  7 -------
 meson.build    |  1 -
 ui/gtk.c       | 16 ++++++++--------
 ui/meson.build |  3 +--
 4 files changed, 9 insertions(+), 18 deletions(-)

diff --git a/configure b/configure
index 2dd772a60c..c6d09b225e 100755
--- a/configure
+++ b/configure
@@ -415,7 +415,6 @@ cfi_debug="false"
 seccomp="auto"
 glusterfs="auto"
 gtk="$default_feature"
-gtk_gl="no"
 tls_priority="NORMAL"
 gnutls="$default_feature"
 nettle="$default_feature"
@@ -3626,9 +3625,6 @@ if test "$opengl" != "no" ; then
     opengl_cflags="$($pkg_config --cflags $opengl_pkgs)"
     opengl_libs="$($pkg_config --libs $opengl_pkgs)"
     opengl=yes
-    if test "$gtk" = "yes" && $pkg_config --exists "$gtkpackage >= 3.16"; then
-        gtk_gl="yes"
-    fi
   else
     if test "$opengl" = "yes" ; then
       feature_not_found "opengl" "Please install opengl (mesa) devel pkgs: $opengl_pkgs"
@@ -5781,9 +5777,6 @@ 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
-  if test "$gtk_gl" = "yes" ; then
-    echo "CONFIG_GTK_GL=y" >> $config_host_mak
-  fi
 fi
 if test "$gio" = "yes" ; then
     echo "CONFIG_GIO=y" >> $config_host_mak
diff --git a/meson.build b/meson.build
index 36f1d02190..a729a30d2f 100644
--- a/meson.build
+++ b/meson.build
@@ -2337,7 +2337,6 @@ 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 GL support':    config_host.has_key('CONFIG_GTK_GL')}
 summary_info += {'pixman':            pixman.found()}
 # TODO: add back version
 summary_info += {'VTE support':       config_host.has_key('CONFIG_VTE')}
diff --git a/ui/gtk.c b/ui/gtk.c
index a752aa22be..e8474456df 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -396,7 +396,7 @@ static void gd_update_full_redraw(VirtualConsole *vc)
     int ww, wh;
     ww = gdk_window_get_width(gtk_widget_get_window(area));
     wh = gdk_window_get_height(gtk_widget_get_window(area));
-#if defined(CONFIG_GTK_GL)
+#if defined(CONFIG_OPENGL)
     if (vc->gfx.gls && gtk_use_gl_area) {
         gtk_gl_area_queue_render(GTK_GL_AREA(vc->gfx.drawing_area));
         return;
@@ -625,7 +625,7 @@ static const DisplayChangeListenerOps dcl_ops = {
 
 /** DisplayState Callbacks (opengl version) **/
 
-#if defined(CONFIG_GTK_GL)
+#if defined(CONFIG_OPENGL)
 
 static const DisplayChangeListenerOps dcl_gl_area_ops = {
     .dpy_name             = "gtk-egl",
@@ -644,7 +644,7 @@ static const DisplayChangeListenerOps dcl_gl_area_ops = {
     .dpy_gl_update           = gd_gl_area_scanout_flush,
 };
 
-#endif /* CONFIG_GTK_GL */
+#endif /* CONFIG_OPENGL */
 
 static const DisplayChangeListenerOps dcl_egl_ops = {
     .dpy_name             = "gtk-egl",
@@ -725,7 +725,7 @@ static void gd_set_ui_info(VirtualConsole *vc, gint width, gint height)
     dpy_set_ui_info(vc->gfx.dcl.con, &info);
 }
 
-#if defined(CONFIG_GTK_GL)
+#if defined(CONFIG_OPENGL)
 
 static gboolean gd_render_event(GtkGLArea *area, GdkGLContext *context,
                                 void *opaque)
@@ -1865,7 +1865,7 @@ static void gd_connect_vc_gfx_signals(VirtualConsole *vc)
 {
     g_signal_connect(vc->gfx.drawing_area, "draw",
                      G_CALLBACK(gd_draw_event), vc);
-#if defined(CONFIG_GTK_GL)
+#if defined(CONFIG_OPENGL)
     if (gtk_use_gl_area) {
         /* wire up GtkGlArea events */
         g_signal_connect(vc->gfx.drawing_area, "render",
@@ -1992,12 +1992,12 @@ static GSList *gd_vc_gfx_init(GtkDisplayState *s, VirtualConsole *vc,
 
 #if defined(CONFIG_OPENGL)
     if (display_opengl) {
-#if defined(CONFIG_GTK_GL)
+#if defined(CONFIG_OPENGL)
         if (gtk_use_gl_area) {
             vc->gfx.drawing_area = gtk_gl_area_new();
             vc->gfx.dcl.ops = &dcl_gl_area_ops;
         } else
-#endif /* CONFIG_GTK_GL */
+#endif /* CONFIG_OPENGL */
         {
             vc->gfx.drawing_area = gtk_drawing_area_new();
             /*
@@ -2314,7 +2314,7 @@ static void early_gtk_display_init(DisplayOptions *opts)
     assert(opts->type == DISPLAY_TYPE_GTK);
     if (opts->has_gl && opts->gl != DISPLAYGL_MODE_OFF) {
 #if defined(CONFIG_OPENGL)
-#if defined(CONFIG_GTK_GL) && defined(GDK_WINDOWING_WAYLAND)
+#if defined(GDK_WINDOWING_WAYLAND)
         if (GDK_IS_WAYLAND_DISPLAY(gdk_display_get_default())) {
             gtk_use_gl_area = true;
             gtk_gl_area_init();
diff --git a/ui/meson.build b/ui/meson.build
index 013258a01c..d805448c4e 100644
--- a/ui/meson.build
+++ b/ui/meson.build
@@ -63,8 +63,7 @@ if config_host.has_key('CONFIG_GTK')
   gtk_ss = ss.source_set()
   gtk_ss.add(gtk, vte, pixman, files('gtk.c'))
   gtk_ss.add(when: [x11, 'CONFIG_X11'], if_true: files('x_keymap.c'))
-  gtk_ss.add(when: [opengl, 'CONFIG_OPENGL'], if_true: files('gtk-egl.c'))
-  gtk_ss.add(when: [opengl, 'CONFIG_GTK_GL'], if_true: files('gtk-gl-area.c'))
+  gtk_ss.add(when: [opengl, 'CONFIG_OPENGL'], if_true: files('gtk-egl.c', 'gtk-gl-area.c'))
   ui_modules += {'gtk' : gtk_ss}
 endif
 
-- 
2.29.2




^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 4/8] configure: move X11 detection to Meson
  2021-01-07 14:00 [RFC PATCH v2 0/8] Automatically convert configure options to meson build options Paolo Bonzini
                   ` (2 preceding siblings ...)
  2021-01-07 14:00 ` [PATCH 3/8] gtk: remove CONFIG_GTK_GL Paolo Bonzini
@ 2021-01-07 14:00 ` Paolo Bonzini
  2021-01-07 14:00 ` [PATCH 5/8] configure: move GTK+ " Paolo Bonzini
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 32+ messages in thread
From: Paolo Bonzini @ 2021-01-07 14:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: alex.bennee, marcandre.lureau, berrange, stefanha

For now move the logic verbatim.  GTK+ actually has a hard requirement
on X11 if gtk+x11 is present, but we will sort that out later.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure      | 14 ++------------
 meson.build    |  9 +++++----
 ui/meson.build |  4 ++--
 3 files changed, 9 insertions(+), 18 deletions(-)

diff --git a/configure b/configure
index c6d09b225e..e9d76c2c13 100755
--- a/configure
+++ b/configure
@@ -2759,14 +2759,6 @@ EOF
   fi
 fi
 
-##########################################
-# X11 probe
-if $pkg_config --exists "x11"; then
-    have_x11=yes
-    x11_cflags=$($pkg_config --cflags x11)
-    x11_libs=$($pkg_config --libs x11)
-fi
-
 ##########################################
 # GTK probe
 
@@ -5681,10 +5673,8 @@ fi
 if test "$module_upgrades" = "yes"; then
   echo "CONFIG_MODULE_UPGRADES=y" >> $config_host_mak
 fi
-if test "$have_x11" = "yes" && test "$need_x11" = "yes"; then
-  echo "CONFIG_X11=y" >> $config_host_mak
-  echo "X11_CFLAGS=$x11_cflags" >> $config_host_mak
-  echo "X11_LIBS=$x11_libs" >> $config_host_mak
+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
diff --git a/meson.build b/meson.build
index a729a30d2f..fdd4312c71 100644
--- a/meson.build
+++ b/meson.build
@@ -783,9 +783,9 @@ if 'CONFIG_VTE' in config_host
                            link_args: config_host['VTE_LIBS'].split())
 endif
 x11 = not_found
-if 'CONFIG_X11' in config_host
-  x11 = declare_dependency(compile_args: config_host['X11_CFLAGS'].split(),
-                           link_args: config_host['X11_LIBS'].split())
+if config_host.has_key('CONFIG_NEED_X11')
+  x11 = dependency('x11', method: 'pkg-config', required: false,
+                   static: enable_static)
 endif
 vnc = not_found
 png = not_found
@@ -1081,6 +1081,7 @@ 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_X11', x11.found())
 config_host_data.set('CONFIG_CFI', get_option('cfi'))
 config_host_data.set('QEMU_VERSION', '"@0@"'.format(meson.project_version()))
 config_host_data.set('QEMU_VERSION_MAJOR', meson.project_version().split('.')[0])
@@ -1167,7 +1168,7 @@ host_kconfig = \
   ('CONFIG_SPICE' in config_host ? ['CONFIG_SPICE=y'] : []) + \
   ('CONFIG_IVSHMEM' in config_host ? ['CONFIG_IVSHMEM=y'] : []) + \
   ('CONFIG_OPENGL' in config_host ? ['CONFIG_OPENGL=y'] : []) + \
-  ('CONFIG_X11' in config_host ? ['CONFIG_X11=y'] : []) + \
+  (x11.found() ? ['CONFIG_X11=y'] : []) + \
   ('CONFIG_VHOST_USER' in config_host ? ['CONFIG_VHOST_USER=y'] : []) + \
   ('CONFIG_VHOST_VDPA' in config_host ? ['CONFIG_VHOST_VDPA=y'] : []) + \
   ('CONFIG_VHOST_KERNEL' in config_host ? ['CONFIG_VHOST_KERNEL=y'] : []) + \
diff --git a/ui/meson.build b/ui/meson.build
index d805448c4e..afbdd78e97 100644
--- a/ui/meson.build
+++ b/ui/meson.build
@@ -62,7 +62,7 @@ if config_host.has_key('CONFIG_GTK')
 
   gtk_ss = ss.source_set()
   gtk_ss.add(gtk, vte, pixman, files('gtk.c'))
-  gtk_ss.add(when: [x11, 'CONFIG_X11'], if_true: files('x_keymap.c'))
+  gtk_ss.add(when: x11, if_true: files('x_keymap.c'))
   gtk_ss.add(when: [opengl, 'CONFIG_OPENGL'], if_true: files('gtk-egl.c', 'gtk-gl-area.c'))
   ui_modules += {'gtk' : gtk_ss}
 endif
@@ -77,7 +77,7 @@ if sdl.found()
     'sdl2.c',
   ))
   sdl_ss.add(when: [opengl, 'CONFIG_OPENGL'], if_true: files('sdl2-gl.c'))
-  sdl_ss.add(when: [x11, 'CONFIG_X11'], if_true: files('x_keymap.c'))
+  sdl_ss.add(when: x11, if_true: files('x_keymap.c'))
   ui_modules += {'sdl' : sdl_ss}
 endif
 
-- 
2.29.2




^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 5/8] configure: move GTK+ detection to Meson
  2021-01-07 14:00 [RFC PATCH v2 0/8] Automatically convert configure options to meson build options Paolo Bonzini
                   ` (3 preceding siblings ...)
  2021-01-07 14:00 ` [PATCH 4/8] configure: move X11 detection to Meson Paolo Bonzini
@ 2021-01-07 14:00 ` Paolo Bonzini
  2021-01-07 14:00 ` [PATCH 6/8] configure: move Cocoa incompatibility checks " Paolo Bonzini
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 32+ messages in thread
From: Paolo Bonzini @ 2021-01-07 14:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: alex.bennee, marcandre.lureau, berrange, stefanha

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




^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 6/8] configure: move Cocoa incompatibility checks to Meson
  2021-01-07 14:00 [RFC PATCH v2 0/8] Automatically convert configure options to meson build options Paolo Bonzini
                   ` (4 preceding siblings ...)
  2021-01-07 14:00 ` [PATCH 5/8] configure: move GTK+ " Paolo Bonzini
@ 2021-01-07 14:00 ` Paolo Bonzini
  2021-01-07 14:00 ` [PATCH 7/8] configure: quote command line arguments in config.status Paolo Bonzini
  2021-01-07 14:00 ` [PATCH 8/8] configure: automatically parse command line for meson -D options Paolo Bonzini
  7 siblings, 0 replies; 32+ messages in thread
From: Paolo Bonzini @ 2021-01-07 14:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: alex.bennee, marcandre.lureau, berrange, stefanha

The cocoa UI code currently assumes it is always the active UI
and does not interact well with other UI frontend code.  Move
the relevant checks to Meson now that all other frontends
have become Meson options.  This way, SDL/GTK+/Cocoa can be
parsed entirely by scripts/configure-parse-buildoptions.pl.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure   | 15 ---------------
 meson.build | 17 ++++++++++-------
 2 files changed, 10 insertions(+), 22 deletions(-)

diff --git a/configure b/configure
index 652cff7ba6..d573058b16 100755
--- a/configure
+++ b/configure
@@ -772,7 +772,6 @@ Darwin)
     QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
     QEMU_LDFLAGS="-arch x86_64 $QEMU_LDFLAGS"
   fi
-  cocoa="enabled"
   audio_drv_list="coreaudio try-sdl"
   audio_possible_drivers="coreaudio sdl"
   QEMU_LDFLAGS="-framework CoreFoundation -framework IOKit $QEMU_LDFLAGS"
@@ -2322,20 +2321,6 @@ if test -z "$want_tools"; then
 fi
 
 ##########################################
-# cocoa implies not SDL or GTK
-# (the cocoa UI code currently assumes it is always the active UI
-# and doesn't interact well with other UI frontend code)
-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" = "enabled"; then
-        error_exit "Cocoa and GTK UIs cannot both be enabled at once"
-    fi
-    gtk=disabled
-    sdl=disabled
-fi
-
 # Some versions of Mac OS X incorrectly define SIZE_MAX
 cat > $TMPC << EOF
 #include <stdint.h>
diff --git a/meson.build b/meson.build
index a3a0958b4d..5a8efd2316 100644
--- a/meson.build
+++ b/meson.build
@@ -148,7 +148,6 @@ version_res = []
 coref = []
 iokit = []
 emulator_link_args = []
-cocoa = not_found
 hvf = not_found
 if targetos == 'windows'
   socket = cc.find_library('ws2_32')
@@ -161,7 +160,6 @@ if targetos == 'windows'
 elif targetos == 'darwin'
   coref = dependency('appleframeworks', modules: 'CoreFoundation')
   iokit = dependency('appleframeworks', modules: 'IOKit')
-  cocoa = dependency('appleframeworks', modules: 'Cocoa', required: get_option('cocoa'))
 elif targetos == 'sunos'
   socket = [cc.find_library('socket'),
             cc.find_library('nsl'),
@@ -252,9 +250,6 @@ if not have_xen_pci_passthrough and get_option('xen_pci_passthrough').enabled()
     error('Xen PCI passthrough requested but Xen not enabled')
   endif
 endif
-if not cocoa.found() and get_option('cocoa').enabled()
-  error('Cocoa not available on this platform')
-endif
 
 ################
 # Dependencies #
@@ -358,6 +353,14 @@ if not get_option('attr').disabled()
   endif
 endif
 
+cocoa = dependency('appleframeworks', modules: 'Cocoa', required: get_option('cocoa'))
+if cocoa.found() and get_option('sdl').enabled()
+  error('Cocoa and SDL cannot be enabled at the same time')
+endif
+if cocoa.found() and get_option('gtk').enabled()
+  error('Cocoa and GTK+ cannot be enabled at the same time')
+endif
+
 seccomp = not_found
 if not get_option('seccomp').auto() or have_system or have_tools
   seccomp = dependency('libseccomp', version: '>=2.3.0',
@@ -643,7 +646,7 @@ if not get_option('brlapi').auto() or have_system
 endif
 
 sdl = not_found
-if have_system
+if not get_option('sdl').auto() or (have_system and not cocoa.found())
   sdl = dependency('sdl2', required: get_option('sdl'), static: enable_static)
   sdl_image = not_found
 endif
@@ -775,7 +778,7 @@ endif
 
 gtk = not_found
 gtkx11 = not_found
-if not get_option('gtk').auto() or have_system
+if not get_option('gtk').auto() or (have_system and not cocoa.found())
   gtk = dependency('gtk+-3.0', version: '>=3.22.0',
                    method: 'pkg-config',
                    required: get_option('gtk'),
-- 
2.29.2




^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 7/8] configure: quote command line arguments in config.status
  2021-01-07 14:00 [RFC PATCH v2 0/8] Automatically convert configure options to meson build options Paolo Bonzini
                   ` (5 preceding siblings ...)
  2021-01-07 14:00 ` [PATCH 6/8] configure: move Cocoa incompatibility checks " Paolo Bonzini
@ 2021-01-07 14:00 ` 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
  7 siblings, 1 reply; 32+ messages in thread
From: Paolo Bonzini @ 2021-01-07 14:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: alex.bennee, marcandre.lureau, berrange, stefanha

Make config.status generation a bit more robust.  (The quote_sh
function will also be reused to parse configure's command line
arguments in an external script driven by Meson build option
introspection).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index d573058b16..41866cc38e 100755
--- a/configure
+++ b/configure
@@ -89,6 +89,10 @@ printf " '%s'" "$0" "$@" >> config.log
 echo >> config.log
 echo "#" >> config.log
 
+quote_sh() {
+    printf "%s" "$1" | sed "s,','\\\\'',g; s,.*,'&',"
+}
+
 print_error() {
     (echo
     echo "ERROR: $1"
@@ -6509,7 +6513,7 @@ preserve_env WINDRES
 
 printf "exec" >>config.status
 for i in "$0" "$@"; do
-  test "$i" = --skip-meson || printf " '%s'" "$i" >>config.status
+  test "$i" = --skip-meson || printf " %s" "$(quote_sh "$i")" >>config.status
 done
 echo ' "$@"' >>config.status
 chmod +x config.status
-- 
2.29.2




^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 8/8] configure: automatically parse command line for meson -D options
  2021-01-07 14:00 [RFC PATCH v2 0/8] Automatically convert configure options to meson build options Paolo Bonzini
                   ` (6 preceding siblings ...)
  2021-01-07 14:00 ` [PATCH 7/8] configure: quote command line arguments in config.status Paolo Bonzini
@ 2021-01-07 14:00 ` Paolo Bonzini
  2021-01-13 10:31   ` Daniel P. Berrangé
  7 siblings, 1 reply; 32+ messages in thread
From: Paolo Bonzini @ 2021-01-07 14:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: alex.bennee, marcandre.lureau, berrange, stefanha

Right now meson_options.txt lists almost 60 options.  Each option
needs code in configure to parse it and pass the option down to Meson as
a -D command-line argument; in addition the default must be duplicated
between configure and meson_options.txt.

This series tries to remove the code duplication by passing unknown
--enable and --disable options to a Perl program, and using Meson's
introspection support to match those to meson_options.txt.
About 80% of the options can be handled completely by the new
mechanism.  Five meson options are not of the --enable/--disable
kind.  Six more need to be parsed in configure for various reasons
documented in the patch, but they still have their help automatically
generated.

The advantages are simple to explain, and are basically what you
can expect from an introspection-based system:

- there is obviously much less code in configure.  About 1000 lines
  of the script deal with command line parsing, and the patch removes
  a quarter of them.

- the script is higher quality than the repetitive code in configure.
  Help is generally more complete and useful, for example it consistently
  lists defaults as well as the possible choices if they are not just
  enabled/disabled/auto.  Parsing is more consistent too, for example
  --enable-slirp and --enable-blobs were not supported.

- new Meson options do not need any change to the configure script.
  This increases the attractiveness of converting options from
  hand-crafted parsing and config-host.mak to Meson.

The disadvantages are:

- a few options change name: --enable-tcmalloc and --enable-jemalloc
  become --enable-malloc={tcmalloc,jemalloc}; --disable-blobs becomes
  --disable-install-blobs.

- because we need to run the script to generate the full help, we
  cannot rely on the user supplying the path to a Python interpreter
  with --python.  For this reason, the script is written in Perl.
  Perl 5 is universally available as "/usr/bin/env perl", while
  (even ignoring the Python 2/3 difference) some systems do not
  have a "python" or "python3" binary on the path.

- because we parse command-line options before meson is available,
  the introspection output is stored in the source tree.  This is
  the reason for the unattractive diffstat; the number of JSON lines
  added is higher than the number of configure lines removed.
  Of course the latter are code that must be maintained manually and
  the former is not.

Note that the output of "meson introspect --buildoptions" is massaged
slightly, in order to make it more stable and avoid horrible conflicts
on every modification to meson_options.txt.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 Makefile                                |  11 +
 configure                               | 371 ++----------
 docs/devel/build-system.rst             |  49 +-
 meson-buildoptions.json                 | 717 ++++++++++++++++++++++++
 meson_options.txt                       |   9 +-
 scripts/configure-parse-buildoptions.pl | 205 +++++++
 6 files changed, 993 insertions(+), 369 deletions(-)
 create mode 100644 meson-buildoptions.json
 create mode 100755 scripts/configure-parse-buildoptions.pl

diff --git a/Makefile b/Makefile
index fb9923ff22..eca42f08d3 100644
--- a/Makefile
+++ b/Makefile
@@ -142,6 +142,17 @@ ifneq ($(MESON),)
 Makefile.mtest: build.ninja scripts/mtest2make.py
 	$(MESON) introspect --targets --tests --benchmarks | $(PYTHON) scripts/mtest2make.py > $@
 -include Makefile.mtest
+
+# python is used to keep the result stable
+.PHONY: update-buildoptions
+all update-buildoptions: $(SRC_PATH)/meson-buildoptions.json
+$(SRC_PATH)/meson-buildoptions.json: $(SRC_PATH)/meson_options.txt
+	$(MESON) introspect --buildoptions $(SRC_PATH)/meson.build | $(PYTHON) -c \
+	         'import json, sys; print( \
+	            json.dumps(sorted([x for x in json.loads(sys.stdin.read()) \
+	                               if x["section"] == "user"], \
+	                              key=lambda x: x["name"]), \
+	                       indent=2))' > $@
 endif
 
 # 4. Rules to bridge to other makefiles
diff --git a/configure b/configure
index 41866cc38e..64e19026f3 100755
--- a/configure
+++ b/configure
@@ -309,47 +309,19 @@ for opt do
   esac
 done
 
-brlapi="auto"
-curl="auto"
-iconv="auto"
-curses="auto"
-docs="auto"
-fdt="auto"
 netmap="no"
-sdl="auto"
-sdl_image="auto"
-virtiofsd="auto"
-virtfs="auto"
-libudev="auto"
-mpath="auto"
-vnc="enabled"
-sparse="auto"
 vde="$default_feature"
-vnc_sasl="auto"
-vnc_jpeg="auto"
-vnc_png="auto"
-xkbcommon="auto"
-xen="$default_feature"
 xen_ctrl_version="$default_feature"
-xen_pci_passthrough="auto"
 linux_aio="$default_feature"
 linux_io_uring="$default_feature"
-cap_ng="auto"
-attr="auto"
 xfs="$default_feature"
-tcg="enabled"
 membarrier="$default_feature"
 vhost_net="$default_feature"
 vhost_crypto="$default_feature"
 vhost_scsi="$default_feature"
 vhost_vsock="$default_feature"
 vhost_user="no"
-vhost_user_blk_server="auto"
 vhost_user_fs="$default_feature"
-kvm="auto"
-hax="auto"
-hvf="auto"
-whpx="auto"
 rdma="$default_feature"
 pvrdma="$default_feature"
 gprof="no"
@@ -359,7 +331,6 @@ sanitizers="no"
 tsan="no"
 fortify_source="$default_feature"
 strip_opt="yes"
-tcg_interpreter="auto"
 bigendian="no"
 mingw32="no"
 gcov="no"
@@ -369,38 +340,27 @@ modules="no"
 module_upgrades="no"
 prefix="/usr/local"
 qemu_suffix="qemu"
-slirp="auto"
 oss_lib=""
 bsd="no"
 linux="no"
 solaris="no"
 profiler="no"
-cocoa="auto"
 softmmu="yes"
 linux_user="no"
 bsd_user="no"
-blobs="true"
 pkgversion=""
 pie=""
 qom_cast_debug="yes"
 trace_backends="log"
 trace_file="trace"
 spice="$default_feature"
-rbd="auto"
 smartcard="$default_feature"
-u2f="auto"
 libusb="$default_feature"
 usb_redir="$default_feature"
 opengl="$default_feature"
 opengl_dmabuf="no"
 cpuid_h="no"
 avx2_opt="$default_feature"
-capstone="auto"
-lzo="auto"
-snappy="auto"
-bzip2="auto"
-lzfse="auto"
-zstd="auto"
 guest_agent="$default_feature"
 guest_agent_with_vss="no"
 guest_agent_ntddscsi="no"
@@ -408,8 +368,6 @@ guest_agent_msi="$default_feature"
 vss_win32_sdk="$default_feature"
 win_sdk="no"
 want_tools="$default_feature"
-libiscsi="auto"
-libnfs="auto"
 coroutine=""
 coroutine_pool="$default_feature"
 debug_stack_usage="no"
@@ -418,7 +376,6 @@ cfi="false"
 cfi_debug="false"
 seccomp="auto"
 glusterfs="auto"
-gtk="auto"
 tls_priority="NORMAL"
 gnutls="$default_feature"
 nettle="$default_feature"
@@ -449,20 +406,32 @@ sheepdog="no"
 libxml2="$default_feature"
 debug_mutex="no"
 libpmem="$default_feature"
-default_devices="true"
 plugins="no"
 fuzzing="no"
 rng_none="no"
 secret_keyring="$default_feature"
 libdaxctl="$default_feature"
 meson=""
+meson_args=""
 ninja=""
 skip_meson=no
-gettext="auto"
-fuse="auto"
-fuse_lseek="auto"
 
-malloc_trim="auto"
+# The following Meson options are handled manually (still they
+# are included in the automatically generated help message)
+
+# 1. Change "git" to "internal"
+capstone="auto"
+fdt="auto"
+slirp="auto"
+
+# 2. Support --with/--without option
+default_devices="true"
+
+# 3. Automatically enable LTO
+cfi="false"
+
+# 4. Detection partly done in configure
+xen="$default_feature"
 
 # parse CC options second
 for opt do
@@ -993,42 +962,10 @@ for opt do
     # configure to be used by RPM and similar macros that set
     # lots of directory switches by default.
   ;;
-  --disable-sdl) sdl="disabled"
-  ;;
-  --enable-sdl) sdl="enabled"
-  ;;
-  --disable-sdl-image) sdl_image="disabled"
-  ;;
-  --enable-sdl-image) sdl_image="enabled"
-  ;;
   --disable-qom-cast-debug) qom_cast_debug="no"
   ;;
   --enable-qom-cast-debug) qom_cast_debug="yes"
   ;;
-  --disable-virtfs) virtfs="disabled"
-  ;;
-  --enable-virtfs) virtfs="enabled"
-  ;;
-  --disable-libudev) libudev="disabled"
-  ;;
-  --enable-libudev) libudev="enabled"
-  ;;
-  --disable-virtiofsd) virtiofsd="disabled"
-  ;;
-  --enable-virtiofsd) virtiofsd="enabled"
-  ;;
-  --disable-mpath) mpath="disabled"
-  ;;
-  --enable-mpath) mpath="enabled"
-  ;;
-  --disable-vnc) vnc="disabled"
-  ;;
-  --enable-vnc) vnc="enabled"
-  ;;
-  --disable-gettext) gettext="disabled"
-  ;;
-  --enable-gettext) gettext="enabled"
-  ;;
   --oss-lib=*) oss_lib="$optarg"
   ;;
   --audio-drv-list=*) audio_drv_list="$optarg"
@@ -1057,24 +994,8 @@ for opt do
   ;;
   --disable-tsan) tsan="no"
   ;;
-  --enable-sparse) sparse="enabled"
-  ;;
-  --disable-sparse) sparse="disabled"
-  ;;
   --disable-strip) strip_opt="no"
   ;;
-  --disable-vnc-sasl) vnc_sasl="disabled"
-  ;;
-  --enable-vnc-sasl) vnc_sasl="enabled"
-  ;;
-  --disable-vnc-jpeg) vnc_jpeg="disabled"
-  ;;
-  --enable-vnc-jpeg) vnc_jpeg="enabled"
-  ;;
-  --disable-vnc-png) vnc_png="disabled"
-  ;;
-  --enable-vnc-png) vnc_png="enabled"
-  ;;
   --disable-slirp) slirp="disabled"
   ;;
   --enable-slirp) slirp="enabled"
@@ -1095,64 +1016,12 @@ for opt do
   ;;
   --enable-xen) xen="enabled"
   ;;
-  --disable-xen-pci-passthrough) xen_pci_passthrough="disabled"
-  ;;
-  --enable-xen-pci-passthrough) xen_pci_passthrough="enabled"
-  ;;
-  --disable-brlapi) brlapi="disabled"
-  ;;
-  --enable-brlapi) brlapi="enabled"
-  ;;
-  --disable-kvm) kvm="disabled"
-  ;;
-  --enable-kvm) kvm="enabled"
-  ;;
-  --disable-hax) hax="disabled"
-  ;;
-  --enable-hax) hax="enabled"
-  ;;
-  --disable-hvf) hvf="disabled"
-  ;;
-  --enable-hvf) hvf="enabled"
-  ;;
-  --disable-whpx) whpx="disabled"
-  ;;
-  --enable-whpx) whpx="enabled"
-  ;;
-  --disable-tcg-interpreter) tcg_interpreter="disabled"
-  ;;
-  --enable-tcg-interpreter) tcg_interpreter="enabled"
-  ;;
-  --disable-cap-ng)  cap_ng="disabled"
-  ;;
-  --enable-cap-ng) cap_ng="enabled"
-  ;;
-  --disable-tcg) tcg="disabled"
-  ;;
-  --enable-tcg) tcg="enabled"
-  ;;
-  --disable-malloc-trim) malloc_trim="disabled"
-  ;;
-  --enable-malloc-trim) malloc_trim="enabled"
-  ;;
   --disable-spice) spice="no"
   ;;
   --enable-spice) spice="yes"
   ;;
-  --disable-libiscsi) libiscsi="disabled"
-  ;;
-  --enable-libiscsi) libiscsi="enabled"
-  ;;
-  --disable-libnfs) libnfs="disabled"
-  ;;
-  --enable-libnfs) libnfs="enabled"
-  ;;
   --enable-profiler) profiler="yes"
   ;;
-  --disable-cocoa) cocoa="disabled"
-  ;;
-  --enable-cocoa) cocoa="enabled"
-  ;;
   --disable-system) softmmu="no"
   ;;
   --enable-system) softmmu="yes"
@@ -1196,22 +1065,6 @@ for opt do
   ;;
   --disable-cfi) cfi="false"
   ;;
-  --enable-cfi-debug) cfi_debug="true"
-  ;;
-  --disable-cfi-debug) cfi_debug="false"
-  ;;
-  --disable-curses) curses="disabled"
-  ;;
-  --enable-curses) curses="enabled"
-  ;;
-  --disable-iconv) iconv="disabled"
-  ;;
-  --enable-iconv) iconv="enabled"
-  ;;
-  --disable-curl) curl="disabled"
-  ;;
-  --enable-curl) curl="enabled"
-  ;;
   --disable-fdt) fdt="disabled"
   ;;
   --enable-fdt) fdt="enabled"
@@ -1228,16 +1081,10 @@ for opt do
   ;;
   --enable-linux-io-uring) linux_io_uring="yes"
   ;;
-  --disable-attr) attr="disabled"
-  ;;
-  --enable-attr) attr="enabled"
-  ;;
   --disable-membarrier) membarrier="no"
   ;;
   --enable-membarrier) membarrier="yes"
   ;;
-  --disable-blobs) blobs="false"
-  ;;
   --with-pkgversion=*) pkgversion="$optarg"
   ;;
   --with-coroutine=*) coroutine="$optarg"
@@ -1252,10 +1099,6 @@ for opt do
   ;;
   --disable-crypto-afalg) crypto_afalg="no"
   ;;
-  --disable-docs) docs="disabled"
-  ;;
-  --enable-docs) docs="enabled"
-  ;;
   --disable-vhost-net) vhost_net="no"
   ;;
   --enable-vhost-net) vhost_net="yes"
@@ -1272,10 +1115,6 @@ for opt do
   ;;
   --enable-vhost-vsock) vhost_vsock="yes"
   ;;
-  --disable-vhost-user-blk-server) vhost_user_blk_server="disabled"
-  ;;
-  --enable-vhost-user-blk-server) vhost_user_blk_server="enabled"
-  ;;
   --disable-vhost-user-fs) vhost_user_fs="no"
   ;;
   --enable-vhost-user-fs) vhost_user_fs="yes"
@@ -1284,10 +1123,6 @@ for opt do
   ;;
   --enable-opengl) opengl="yes"
   ;;
-  --disable-rbd) rbd="disabled"
-  ;;
-  --enable-rbd) rbd="enabled"
-  ;;
   --disable-xfsctl) xfs="no"
   ;;
   --enable-xfsctl) xfs="yes"
@@ -1296,10 +1131,6 @@ for opt do
   ;;
   --enable-smartcard) smartcard="yes"
   ;;
-  --disable-u2f) u2f="disabled"
-  ;;
-  --enable-u2f) u2f="enabled"
-  ;;
   --disable-libusb) libusb="no"
   ;;
   --enable-libusb) libusb="yes"
@@ -1310,26 +1141,6 @@ for opt do
   ;;
   --disable-zlib-test)
   ;;
-  --disable-lzo) lzo="disabled"
-  ;;
-  --enable-lzo) lzo="enabled"
-  ;;
-  --disable-snappy) snappy="disabled"
-  ;;
-  --enable-snappy) snappy="enabled"
-  ;;
-  --disable-bzip2) bzip2="disabled"
-  ;;
-  --enable-bzip2) bzip2="enabled"
-  ;;
-  --enable-lzfse) lzfse="enabled"
-  ;;
-  --disable-lzfse) lzfse="disabled"
-  ;;
-  --disable-zstd) zstd="disabled"
-  ;;
-  --enable-zstd) zstd="enabled"
-  ;;
   --enable-guest-agent) guest_agent="yes"
   ;;
   --disable-guest-agent) guest_agent="no"
@@ -1354,12 +1165,6 @@ for opt do
   ;;
   --disable-tools) want_tools="no"
   ;;
-  --enable-seccomp) seccomp="enabled"
-  ;;
-  --disable-seccomp) seccomp="disabled"
-  ;;
-  --disable-glusterfs) glusterfs="disabled"
-  ;;
   --disable-avx2) avx2_opt="no"
   ;;
   --enable-avx2) avx2_opt="yes"
@@ -1368,9 +1173,6 @@ for opt do
   ;;
   --enable-avx512f) avx512f_opt="yes"
   ;;
-
-  --enable-glusterfs) glusterfs="enabled"
-  ;;
   --disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane)
       echo "$0: $opt is obsolete, virtio-blk data-plane is always on" >&2
   ;;
@@ -1380,10 +1182,6 @@ for opt do
   --enable-uuid|--disable-uuid)
       echo "$0: $opt is obsolete, UUID support is always built" >&2
   ;;
-  --disable-gtk) gtk="disabled"
-  ;;
-  --enable-gtk) gtk="enabled"
-  ;;
   --tls-priority=*) tls_priority="$optarg"
   ;;
   --disable-gnutls) gnutls="no"
@@ -1438,14 +1236,6 @@ for opt do
   ;;
   --enable-libxml2) libxml2="yes"
   ;;
-  --disable-tcmalloc) tcmalloc="no"
-  ;;
-  --enable-tcmalloc) tcmalloc="yes"
-  ;;
-  --disable-jemalloc) jemalloc="no"
-  ;;
-  --enable-jemalloc) jemalloc="yes"
-  ;;
   --disable-replication) replication="no"
   ;;
   --enable-replication) replication="yes"
@@ -1520,10 +1310,6 @@ for opt do
   ;;
   --disable-libpmem) libpmem=no
   ;;
-  --enable-xkbcommon) xkbcommon="enabled"
-  ;;
-  --disable-xkbcommon) xkbcommon="disabled"
-  ;;
   --enable-plugins) plugins="yes"
   ;;
   --disable-plugins) plugins="no"
@@ -1550,13 +1336,8 @@ for opt do
   ;;
   --disable-libdaxctl) libdaxctl=no
   ;;
-  --enable-fuse) fuse="enabled"
-  ;;
-  --disable-fuse) fuse="disabled"
-  ;;
-  --enable-fuse-lseek) fuse_lseek="enabled"
-  ;;
-  --disable-fuse-lseek) fuse_lseek="disabled"
+  --enable-* | --disable-*)
+      meson_args="$meson_args $(quote_sh "$opt")"
   ;;
   *)
       echo "ERROR: unknown option $opt"
@@ -1566,6 +1347,15 @@ for opt do
   esac
 done
 
+# Convert unknown --enable/--disable arguments to Meson build options.
+meson_options=$(eval \
+    perl \$source_path/scripts/configure-parse-buildoptions.pl \
+         \< \$source_path/meson-buildoptions.json $meson_args)
+if test $? = 1; then
+    echo "Try '$0 --help' for more information"
+    exit 1
+fi
+
 libdir="${libdir:-$prefix/lib}"
 libexecdir="${libexecdir:-$prefix/libexec}"
 includedir="${includedir:-$prefix/include}"
@@ -1752,15 +1542,11 @@ Advanced options (experts only):
                            Available backends: $trace_backend_list
   --with-trace-file=NAME   Full PATH,NAME of file to store traces
                            Default:trace-<pid>
-  --disable-slirp          disable SLIRP userspace network connectivity
-  --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)
-  --enable-malloc-trim     enable libc malloc_trim() for memory optimization
   --oss-lib                path to OSS library
   --cpu=CPU                Build for host CPU [$cpu]
   --with-coroutine=BACKEND coroutine backend. Supported options:
                            ucontext, sigaltstack, windows
   --enable-gcov            enable test coverage analysis with gcov
-  --disable-blobs          disable installing provided firmware blobs
   --with-vss-sdk=SDK-path  enable Windows VSS support in QEMU Guest Agent
   --with-win-sdk=SDK-path  path to Windows Platform SDK (to build VSS .tlb)
   --tls-priority           default TLS protocol/cipher priority string
@@ -1772,16 +1558,13 @@ Advanced options (experts only):
                            enable plugins via shared library loading
   --disable-containers     don't use containers for cross-building
   --gdb=GDB-path           gdb to use for gdbstub tests [$gdb_bin]
-
-Optional features, enabled with --enable-FEATURE and
-disabled with --disable-FEATURE, default is enabled if available
-(unless built with --without-default-features):
-
+EOF
+  perl $source_path/scripts/configure-parse-buildoptions.pl --print-help < $source_path/meson-buildoptions.json
+cat << EOF
   system          all system emulation targets
   user            supported user emulation targets
   linux-user      all linux usermode emulation targets
   bsd-user        all BSD usermode emulation targets
-  docs            build documentation
   guest-agent     build the QEMU Guest Agent
   guest-agent-msi build guest agent Windows MSI installation package
   pie             Position Independent Executables
@@ -1793,84 +1576,35 @@ disabled with --disable-FEATURE, default is enabled if available
   sparse          sparse checker
   safe-stack      SafeStack Stack Smash Protection. Depends on
                   clang/llvm >= 3.7 and requires coroutine backend ucontext.
-  cfi             Enable Control-Flow Integrity for indirect function calls.
-                  In case of a cfi violation, QEMU is terminated with SIGILL
-                  Depends on lto and is incompatible with modules
-                  Automatically enables Link-Time Optimization (lto)
-  cfi-debug       In case of a cfi violation, a message containing the line that
-                  triggered the error is written to stderr. After the error,
-                  QEMU is still terminated with SIGILL
   gnutls          GNUTLS cryptography support
   nettle          nettle cryptography support
   gcrypt          libgcrypt cryptography support
   auth-pam        PAM access control
-  sdl             SDL UI
-  sdl-image       SDL Image support for icons
-  gtk             gtk UI
   vte             vte support for the gtk UI
-  curses          curses UI
-  iconv           font glyph conversion support
-  vnc             VNC UI support
-  vnc-sasl        SASL encryption for VNC server
-  vnc-jpeg        JPEG lossy compression for VNC server
-  vnc-png         PNG compression for VNC server
-  cocoa           Cocoa UI (Mac OS X only)
-  virtfs          VirtFS
-  virtiofsd       build virtiofs daemon (virtiofsd)
-  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
-  brlapi          BrlAPI (Braile)
-  curl            curl connectivity
   membarrier      membarrier system call (for Linux 4.14+ or Windows)
-  fdt             fdt device tree
-  kvm             KVM acceleration support
-  hax             HAX acceleration support
-  hvf             Hypervisor.framework acceleration support
-  whpx            Windows Hypervisor Platform acceleration support
   rdma            Enable RDMA-based migration
   pvrdma          Enable PVRDMA support
   vde             support for vde network
   netmap          support for netmap network
   linux-aio       Linux AIO support
   linux-io-uring  Linux io_uring support
-  cap-ng          libcap-ng support
-  attr            attr and xattr support
   vhost-net       vhost-net kernel acceleration support
   vhost-vsock     virtio sockets device support
   vhost-scsi      vhost-scsi kernel target support
   vhost-crypto    vhost-user-crypto backend support
   vhost-kernel    vhost kernel backend support
   vhost-user      vhost-user backend support
-  vhost-user-blk-server    vhost-user-blk server support
   vhost-vdpa      vhost-vdpa kernel backend support
   spice           spice
-  rbd             rados block device (rbd)
-  libiscsi        iscsi support
-  libnfs          nfs support
   smartcard       smartcard support (libcacard)
-  u2f             U2F support (u2f-emu)
   libusb          libusb (for usb passthrough)
   live-block-migration   Block migration in the main migration stream
   usb-redir       usb network redirection support
-  lzo             support of lzo compression library
-  snappy          support of snappy compression library
-  bzip2           support of bzip2 compression library
-                  (for reading bzip2-compressed dmg images)
-  lzfse           support of lzfse compression library
-                  (for reading lzfse-compressed dmg images)
-  zstd            support for zstd compression library
-                  (for migration compression and qcow2 cluster compression)
-  seccomp         seccomp support
   coroutine-pool  coroutine freelist (better performance)
-  glusterfs       GlusterFS backend
   tpm             TPM support
   libssh          ssh block device support
   numa            libnuma support
   libxml2         for Parallels image format
-  tcmalloc        tcmalloc support
-  jemalloc        jemalloc support
   avx2            AVX2 optimization support
   avx512f         AVX512F optimization support
   replication     replication support
@@ -1889,14 +1623,10 @@ disabled with --disable-FEATURE, default is enabled if available
   parallels       parallels image format support
   sheepdog        sheepdog block driver support (deprecated)
   crypto-afalg    Linux AF_ALG crypto backend driver
-  capstone        capstone disassembler support
   debug-mutex     mutex debugging support
   libpmem         libpmem support
-  xkbcommon       xkbcommon support
   rng-none        dummy RNG, avoid using /dev/(u)random and getrandom()
   libdaxctl       libdaxctl support
-  fuse            FUSE block device export
-  fuse-lseek      SEEK_HOLE/SEEK_DATA support for FUSE exports
 
 NOTE: The object files are built at the place where configure is launched
 EOF
@@ -3725,16 +3455,6 @@ EOF
   fi
 fi
 
-malloc=system
-if test "$tcmalloc" = "yes" && test "$jemalloc" = "yes" ; then
-    echo "ERROR: tcmalloc && jemalloc can't be used at the same time"
-    exit 1
-elif test "$tcmalloc" = "yes" ; then
-    malloc=tcmalloc
-elif test "$jemalloc" = "yes" ; then
-    malloc=jemalloc
-fi
-
 ##########################################
 # signalfd probe
 signalfd="no"
@@ -6413,7 +6133,8 @@ fi
 mv $cross config-meson.cross
 
 rm -rf meson-private meson-info meson-logs
-NINJA=$ninja $meson setup \
+run_meson() {
+  NINJA=$ninja $meson setup \
         --prefix "$prefix" \
         --libdir "$libdir" \
         --libexecdir "$libexecdir" \
@@ -6427,32 +6148,20 @@ NINJA=$ninja $meson setup \
         -Ddocdir="$docdir" \
         -Dqemu_firmwarepath="$firmwarepath" \
         -Dqemu_suffix="$qemu_suffix" \
+        -Dsphinx_build="$sphinx_build" \
         -Doptimization=$(if test "$debug" = yes; then echo 0; else echo 2; fi) \
         -Ddebug=$(if test "$debug_info" = yes; then echo true; else echo false; fi) \
         -Dwerror=$(if test "$werror" = yes; then echo true; else echo false; fi) \
         -Dstrip=$(if test "$strip_opt" = yes; then echo true; else echo false; fi) \
         -Db_pie=$(if test "$pie" = yes; then echo true; else echo false; fi) \
         -Db_coverage=$(if test "$gcov" = yes; then echo true; else echo false; fi) \
-        -Db_lto=$lto -Dcfi=$cfi -Dcfi_debug=$cfi_debug \
-        -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 -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 \
-        -Dcurl=$curl -Dglusterfs=$glusterfs -Dbzip2=$bzip2 -Dlibiscsi=$libiscsi \
-        -Dlibnfs=$libnfs -Diconv=$iconv -Dcurses=$curses -Dlibudev=$libudev\
-        -Drbd=$rbd -Dlzo=$lzo -Dsnappy=$snappy -Dlzfse=$lzfse \
-        -Dzstd=$zstd -Dseccomp=$seccomp -Dvirtfs=$virtfs -Dcap_ng=$cap_ng \
-        -Dattr=$attr -Ddefault_devices=$default_devices \
-        -Ddocs=$docs -Dsphinx_build=$sphinx_build -Dinstall_blobs=$blobs \
-        -Dvhost_user_blk_server=$vhost_user_blk_server \
-        -Dfuse=$fuse -Dfuse_lseek=$fuse_lseek \
+        -Db_lto=$lto -Dcfi=$cfi \
+        -Dcapstone=$capstone -Dfdt=$fdt -Dslirp=$slirp \
+        -Ddefault_devices=$default_devices -Dxen=$xen \
         $(if test "$default_features" = no; then echo "-Dauto_features=disabled"; fi) \
-        $cross_arg \
-        "$PWD" "$source_path"
-
+        "$@" $cross_arg "$PWD" "$source_path"
+}
+eval run_meson $meson_options
 if test "$?" -ne 0 ; then
     error_exit "meson setup failed"
 fi
diff --git a/docs/devel/build-system.rst b/docs/devel/build-system.rst
index 31f4dced2a..3ada0b878e 100644
--- a/docs/devel/build-system.rst
+++ b/docs/devel/build-system.rst
@@ -42,22 +42,17 @@ perform a build:
      ../configure
      make
 
-For now, checks on the compilation environment are found in configure
-rather than meson.build, though this is expected to change.  The command
-line is parsed in the configure script and, whenever needed, converted
-into the appropriate options to Meson.
+Many checks on the compilation environment are still found in configure
+rather than `meson.build`, but new checks should be added directly to
+`meson.build`.  The configure script automatically recognizes
+command line options for which a same-named Meson option exists;
+dashes in the command line are replaced with underscores.
 
 New checks should be added to Meson, which usually comprises the
 following tasks:
 
  - Add a Meson build option to meson_options.txt.
 
- - Add support to the command line arg parser to handle any new
-   `--enable-XXX`/`--disable-XXX` flags required by the feature.
-
- - Add information to the help output message to report on the new
-   feature flag.
-
  - Add code to perform the actual feature check.
 
  - Add code to include the feature status in `config-host.h`
@@ -66,36 +61,13 @@ following tasks:
    upon completion.
 
 
-Taking the probe for SDL2_Image as an example, we have the following pieces
-in configure::
-
-  # Initial variable state
-  sdl_image=auto
-
-  ..snip..
-
-  # Configure flag processing
-  --disable-sdl-image) sdl_image=disabled
-  ;;
-  --enable-sdl-image) sdl_image=enabled
-  ;;
-
-  ..snip..
-
-  # Help output feature message
-  sdl-image         SDL Image support for icons
-
-  ..snip..
-
-  # Meson invocation
-  -Dsdl_image=$sdl_image
-
-In meson_options.txt::
+Taking the probe for SDL2_Image as an example, we have the following
+in ``meson_options.txt``::
 
-  option('sdl', type : 'feature', value : 'auto',
+  option('sdl_image', type : 'feature', value : 'auto',
          description: 'SDL Image support for icons')
 
-In meson.build::
+And the detection code in ``meson.build``::
 
   # Detect dependency
   sdl_image = dependency('SDL2_image', required: get_option('sdl_image'),
@@ -108,6 +80,9 @@ In meson.build::
   # Summary
   summary_info += {'SDL image support': sdl_image.found()}
 
+For the configure script to parse the option, the ``meson-buildoptions.json``
+file in the root source directory must be up-to-date; ``make
+update-buildoptions`` (or just `make`) will take care of updating it.
 
 
 Helper functions
diff --git a/meson-buildoptions.json b/meson-buildoptions.json
new file mode 100644
index 0000000000..8e245e0d79
--- /dev/null
+++ b/meson-buildoptions.json
@@ -0,0 +1,717 @@
+[
+  {
+    "name": "attr",
+    "value": "auto",
+    "section": "user",
+    "machine": "any",
+    "choices": [
+      "enabled",
+      "disabled",
+      "auto"
+    ],
+    "type": "combo",
+    "description": "attr/xattr support"
+  },
+  {
+    "name": "brlapi",
+    "value": "auto",
+    "section": "user",
+    "machine": "any",
+    "choices": [
+      "enabled",
+      "disabled",
+      "auto"
+    ],
+    "type": "combo",
+    "description": "brlapi character device driver"
+  },
+  {
+    "name": "bzip2",
+    "value": "auto",
+    "section": "user",
+    "machine": "any",
+    "choices": [
+      "enabled",
+      "disabled",
+      "auto"
+    ],
+    "type": "combo",
+    "description": "bzip2 support for DMG images"
+  },
+  {
+    "name": "cap_ng",
+    "value": "auto",
+    "section": "user",
+    "machine": "any",
+    "choices": [
+      "enabled",
+      "disabled",
+      "auto"
+    ],
+    "type": "combo",
+    "description": "cap_ng support"
+  },
+  {
+    "name": "capstone",
+    "value": "auto",
+    "section": "user",
+    "machine": "any",
+    "choices": [
+      "disabled",
+      "enabled",
+      "auto",
+      "system",
+      "internal"
+    ],
+    "type": "combo",
+    "description": "Whether and how to find the capstone library"
+  },
+  {
+    "name": "cfi",
+    "value": false,
+    "section": "user",
+    "machine": "any",
+    "type": "boolean",
+    "description": "Control-Flow Integrity (CFI)"
+  },
+  {
+    "name": "cfi_debug",
+    "value": false,
+    "section": "user",
+    "machine": "any",
+    "type": "boolean",
+    "description": "Verbose errors in case of CFI violation"
+  },
+  {
+    "name": "cocoa",
+    "value": "auto",
+    "section": "user",
+    "machine": "any",
+    "choices": [
+      "enabled",
+      "disabled",
+      "auto"
+    ],
+    "type": "combo",
+    "description": "Cocoa user interface (macOS only)"
+  },
+  {
+    "name": "curl",
+    "value": "auto",
+    "section": "user",
+    "machine": "any",
+    "choices": [
+      "enabled",
+      "disabled",
+      "auto"
+    ],
+    "type": "combo",
+    "description": "CURL block device driver"
+  },
+  {
+    "name": "curses",
+    "value": "auto",
+    "section": "user",
+    "machine": "any",
+    "choices": [
+      "enabled",
+      "disabled",
+      "auto"
+    ],
+    "type": "combo",
+    "description": "curses UI"
+  },
+  {
+    "name": "default_devices",
+    "value": true,
+    "section": "user",
+    "machine": "any",
+    "type": "boolean",
+    "description": "Include a default selection of devices in emulators"
+  },
+  {
+    "name": "docdir",
+    "value": "doc",
+    "section": "user",
+    "machine": "any",
+    "type": "string",
+    "description": "Base directory for documentation installation (can be empty)"
+  },
+  {
+    "name": "docs",
+    "value": "auto",
+    "section": "user",
+    "machine": "any",
+    "choices": [
+      "enabled",
+      "disabled",
+      "auto"
+    ],
+    "type": "combo",
+    "description": "Documentations build support"
+  },
+  {
+    "name": "fdt",
+    "value": "auto",
+    "section": "user",
+    "machine": "any",
+    "choices": [
+      "disabled",
+      "enabled",
+      "auto",
+      "system",
+      "internal"
+    ],
+    "type": "combo",
+    "description": "Whether and how to find the libfdt library"
+  },
+  {
+    "name": "fuse",
+    "value": "auto",
+    "section": "user",
+    "machine": "any",
+    "choices": [
+      "enabled",
+      "disabled",
+      "auto"
+    ],
+    "type": "combo",
+    "description": "FUSE block device export"
+  },
+  {
+    "name": "fuse_lseek",
+    "value": "auto",
+    "section": "user",
+    "machine": "any",
+    "choices": [
+      "enabled",
+      "disabled",
+      "auto"
+    ],
+    "type": "combo",
+    "description": "SEEK_HOLE/SEEK_DATA support for FUSE exports"
+  },
+  {
+    "name": "gettext",
+    "value": "auto",
+    "section": "user",
+    "machine": "any",
+    "choices": [
+      "enabled",
+      "disabled",
+      "auto"
+    ],
+    "type": "combo",
+    "description": "Localization of the GTK+ user interface"
+  },
+  {
+    "name": "glusterfs",
+    "value": "auto",
+    "section": "user",
+    "machine": "any",
+    "choices": [
+      "enabled",
+      "disabled",
+      "auto"
+    ],
+    "type": "combo",
+    "description": "Glusterfs block device driver"
+  },
+  {
+    "name": "gtk",
+    "value": "auto",
+    "section": "user",
+    "machine": "any",
+    "choices": [
+      "enabled",
+      "disabled",
+      "auto"
+    ],
+    "type": "combo",
+    "description": "GTK+ user interface"
+  },
+  {
+    "name": "hax",
+    "value": "auto",
+    "section": "user",
+    "machine": "any",
+    "choices": [
+      "enabled",
+      "disabled",
+      "auto"
+    ],
+    "type": "combo",
+    "description": "HAX acceleration support"
+  },
+  {
+    "name": "hvf",
+    "value": "auto",
+    "section": "user",
+    "machine": "any",
+    "choices": [
+      "enabled",
+      "disabled",
+      "auto"
+    ],
+    "type": "combo",
+    "description": "HVF acceleration support"
+  },
+  {
+    "name": "iconv",
+    "value": "auto",
+    "section": "user",
+    "machine": "any",
+    "choices": [
+      "enabled",
+      "disabled",
+      "auto"
+    ],
+    "type": "combo",
+    "description": "Font glyph conversion support"
+  },
+  {
+    "name": "install_blobs",
+    "value": true,
+    "section": "user",
+    "machine": "any",
+    "type": "boolean",
+    "description": "install provided firmware blobs"
+  },
+  {
+    "name": "kvm",
+    "value": "auto",
+    "section": "user",
+    "machine": "any",
+    "choices": [
+      "enabled",
+      "disabled",
+      "auto"
+    ],
+    "type": "combo",
+    "description": "KVM acceleration support"
+  },
+  {
+    "name": "libiscsi",
+    "value": "auto",
+    "section": "user",
+    "machine": "any",
+    "choices": [
+      "enabled",
+      "disabled",
+      "auto"
+    ],
+    "type": "combo",
+    "description": "libiscsi userspace initiator"
+  },
+  {
+    "name": "libnfs",
+    "value": "auto",
+    "section": "user",
+    "machine": "any",
+    "choices": [
+      "enabled",
+      "disabled",
+      "auto"
+    ],
+    "type": "combo",
+    "description": "libnfs block device driver"
+  },
+  {
+    "name": "libslirp:version_suffix",
+    "value": "",
+    "section": "user",
+    "machine": "any",
+    "type": "string",
+    "description": "Suffix to append to SLIRP_VERSION_STRING"
+  },
+  {
+    "name": "libudev",
+    "value": "auto",
+    "section": "user",
+    "machine": "any",
+    "choices": [
+      "enabled",
+      "disabled",
+      "auto"
+    ],
+    "type": "combo",
+    "description": "Use libudev to enumerate host devices"
+  },
+  {
+    "name": "lzfse",
+    "value": "auto",
+    "section": "user",
+    "machine": "any",
+    "choices": [
+      "enabled",
+      "disabled",
+      "auto"
+    ],
+    "type": "combo",
+    "description": "lzfse support for DMG images"
+  },
+  {
+    "name": "lzo",
+    "value": "auto",
+    "section": "user",
+    "machine": "any",
+    "choices": [
+      "enabled",
+      "disabled",
+      "auto"
+    ],
+    "type": "combo",
+    "description": "lzo compression support"
+  },
+  {
+    "name": "malloc",
+    "value": "system",
+    "section": "user",
+    "machine": "any",
+    "choices": [
+      "system",
+      "tcmalloc",
+      "jemalloc"
+    ],
+    "type": "combo",
+    "description": "choose memory allocator to use"
+  },
+  {
+    "name": "malloc_trim",
+    "value": "auto",
+    "section": "user",
+    "machine": "any",
+    "choices": [
+      "enabled",
+      "disabled",
+      "auto"
+    ],
+    "type": "combo",
+    "description": "enable libc malloc_trim() for memory optimization"
+  },
+  {
+    "name": "mpath",
+    "value": "auto",
+    "section": "user",
+    "machine": "any",
+    "choices": [
+      "enabled",
+      "disabled",
+      "auto"
+    ],
+    "type": "combo",
+    "description": "Multipath persistent reservation passthrough"
+  },
+  {
+    "name": "qemu_firmwarepath",
+    "value": "",
+    "section": "user",
+    "machine": "any",
+    "type": "string",
+    "description": "search PATH for firmware files"
+  },
+  {
+    "name": "qemu_suffix",
+    "value": "qemu",
+    "section": "user",
+    "machine": "any",
+    "type": "string",
+    "description": "Suffix for QEMU data/modules/config directories (can be empty)"
+  },
+  {
+    "name": "rbd",
+    "value": "auto",
+    "section": "user",
+    "machine": "any",
+    "choices": [
+      "enabled",
+      "disabled",
+      "auto"
+    ],
+    "type": "combo",
+    "description": "Ceph block device driver"
+  },
+  {
+    "name": "sdl",
+    "value": "auto",
+    "section": "user",
+    "machine": "any",
+    "choices": [
+      "enabled",
+      "disabled",
+      "auto"
+    ],
+    "type": "combo",
+    "description": "SDL user interface"
+  },
+  {
+    "name": "sdl_image",
+    "value": "auto",
+    "section": "user",
+    "machine": "any",
+    "choices": [
+      "enabled",
+      "disabled",
+      "auto"
+    ],
+    "type": "combo",
+    "description": "SDL Image support for icons"
+  },
+  {
+    "name": "seccomp",
+    "value": "auto",
+    "section": "user",
+    "machine": "any",
+    "choices": [
+      "enabled",
+      "disabled",
+      "auto"
+    ],
+    "type": "combo",
+    "description": "seccomp support"
+  },
+  {
+    "name": "slirp",
+    "value": "auto",
+    "section": "user",
+    "machine": "any",
+    "choices": [
+      "disabled",
+      "enabled",
+      "auto",
+      "system",
+      "internal"
+    ],
+    "type": "combo",
+    "description": "Whether and how to find the slirp library"
+  },
+  {
+    "name": "snappy",
+    "value": "auto",
+    "section": "user",
+    "machine": "any",
+    "choices": [
+      "enabled",
+      "disabled",
+      "auto"
+    ],
+    "type": "combo",
+    "description": "snappy compression support"
+  },
+  {
+    "name": "sparse",
+    "value": "auto",
+    "section": "user",
+    "machine": "any",
+    "choices": [
+      "enabled",
+      "disabled",
+      "auto"
+    ],
+    "type": "combo",
+    "description": "sparse checker"
+  },
+  {
+    "name": "sphinx_build",
+    "value": "",
+    "section": "user",
+    "machine": "any",
+    "type": "string",
+    "description": "Use specified sphinx-build [$sphinx_build] for building document (default to be empty)"
+  },
+  {
+    "name": "tcg",
+    "value": "auto",
+    "section": "user",
+    "machine": "any",
+    "choices": [
+      "enabled",
+      "disabled",
+      "auto"
+    ],
+    "type": "combo",
+    "description": "TCG support"
+  },
+  {
+    "name": "tcg_interpreter",
+    "value": "auto",
+    "section": "user",
+    "machine": "any",
+    "choices": [
+      "enabled",
+      "disabled",
+      "auto"
+    ],
+    "type": "combo",
+    "description": "TCG bytecode interpreter (TCI)"
+  },
+  {
+    "name": "u2f",
+    "value": "auto",
+    "section": "user",
+    "machine": "any",
+    "choices": [
+      "enabled",
+      "disabled",
+      "auto"
+    ],
+    "type": "combo",
+    "description": "U2F emulation support"
+  },
+  {
+    "name": "vhost_user_blk_server",
+    "value": "auto",
+    "section": "user",
+    "machine": "any",
+    "choices": [
+      "enabled",
+      "disabled",
+      "auto"
+    ],
+    "type": "combo",
+    "description": "build vhost-user-blk server"
+  },
+  {
+    "name": "virtfs",
+    "value": "auto",
+    "section": "user",
+    "machine": "any",
+    "choices": [
+      "enabled",
+      "disabled",
+      "auto"
+    ],
+    "type": "combo",
+    "description": "virtio-9p support"
+  },
+  {
+    "name": "virtiofsd",
+    "value": "auto",
+    "section": "user",
+    "machine": "any",
+    "choices": [
+      "enabled",
+      "disabled",
+      "auto"
+    ],
+    "type": "combo",
+    "description": "build virtiofs daemon (virtiofsd)"
+  },
+  {
+    "name": "vnc",
+    "value": "enabled",
+    "section": "user",
+    "machine": "any",
+    "choices": [
+      "enabled",
+      "disabled",
+      "auto"
+    ],
+    "type": "combo",
+    "description": "VNC server"
+  },
+  {
+    "name": "vnc_jpeg",
+    "value": "auto",
+    "section": "user",
+    "machine": "any",
+    "choices": [
+      "enabled",
+      "disabled",
+      "auto"
+    ],
+    "type": "combo",
+    "description": "JPEG lossy compression for VNC server"
+  },
+  {
+    "name": "vnc_png",
+    "value": "auto",
+    "section": "user",
+    "machine": "any",
+    "choices": [
+      "enabled",
+      "disabled",
+      "auto"
+    ],
+    "type": "combo",
+    "description": "PNG compression for VNC server"
+  },
+  {
+    "name": "vnc_sasl",
+    "value": "auto",
+    "section": "user",
+    "machine": "any",
+    "choices": [
+      "enabled",
+      "disabled",
+      "auto"
+    ],
+    "type": "combo",
+    "description": "SASL authentication for VNC server"
+  },
+  {
+    "name": "whpx",
+    "value": "auto",
+    "section": "user",
+    "machine": "any",
+    "choices": [
+      "enabled",
+      "disabled",
+      "auto"
+    ],
+    "type": "combo",
+    "description": "WHPX acceleration support"
+  },
+  {
+    "name": "xen",
+    "value": "auto",
+    "section": "user",
+    "machine": "any",
+    "choices": [
+      "enabled",
+      "disabled",
+      "auto"
+    ],
+    "type": "combo",
+    "description": "Xen backend support"
+  },
+  {
+    "name": "xen_pci_passthrough",
+    "value": "auto",
+    "section": "user",
+    "machine": "any",
+    "choices": [
+      "enabled",
+      "disabled",
+      "auto"
+    ],
+    "type": "combo",
+    "description": "Xen PCI passthrough support"
+  },
+  {
+    "name": "xkbcommon",
+    "value": "auto",
+    "section": "user",
+    "machine": "any",
+    "choices": [
+      "enabled",
+      "disabled",
+      "auto"
+    ],
+    "type": "combo",
+    "description": "xkbcommon support"
+  },
+  {
+    "name": "zstd",
+    "value": "auto",
+    "section": "user",
+    "machine": "any",
+    "choices": [
+      "enabled",
+      "disabled",
+      "auto"
+    ],
+    "type": "combo",
+    "description": "zstd compression support"
+  }
+]
diff --git a/meson_options.txt b/meson_options.txt
index b9b106675f..08d02498ac 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,3 +1,7 @@
+# These options do not correspond to a --enable/--disable-* option
+# on the configure script command line.  If you add more, list them in
+# scripts/configure-parse-buildoptions.pl's SKIP_OPTIONS constant too.
+
 option('qemu_suffix', type : 'string', value: 'qemu',
        description: 'Suffix for QEMU data/modules/config directories (can be empty)')
 option('docdir', type : 'string', value : 'doc',
@@ -6,9 +10,12 @@ option('qemu_firmwarepath', type : 'string', value : '',
        description: 'search PATH for firmware files')
 option('sphinx_build', type : 'string', value : '',
        description: 'Use specified sphinx-build [$sphinx_build] for building document (default to be empty)')
-
 option('default_devices', type : 'boolean', value : true,
        description: 'Include a default selection of devices in emulators')
+
+# Everything else can be set via --enable/--disable-* option
+# on the configure script command line.
+
 option('docs', type : 'feature', value : 'auto',
        description: 'Documentations build support')
 option('gettext', type : 'feature', value : 'auto',
diff --git a/scripts/configure-parse-buildoptions.pl b/scripts/configure-parse-buildoptions.pl
new file mode 100755
index 0000000000..33402b0583
--- /dev/null
+++ b/scripts/configure-parse-buildoptions.pl
@@ -0,0 +1,205 @@
+#! /usr/bin/env perl
+
+# Parse configure command line options based on Meson's user build options
+# introspection data (passed on stdin).
+#
+# Copyright (C) 2021 Red Hat, Inc.
+#
+# Author: Paolo Bonzini <pbonzini@redhat.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+use warnings FATAL => 'all';
+use strict;
+use JSON::PP;
+
+# Meson options that do not correspond to a --enable/--disable option
+# in configure
+use constant SKIP_OPTIONS => ('docdir', 'qemu_firmwarepath', 'sphinx_build', 'qemu_suffix',
+                              'default_devices');
+
+use constant FEATURE_CHOICES => 'auto/disabled/enabled';
+use constant LINE_WIDTH => 74;
+
+# Convert the default value of an option to the string used in
+# the help message
+sub value_to_help ($)
+{
+  my ($value) = @_;
+  return $value if not JSON::PP::is_bool($value);
+  return $value ? 'enabled' : 'disabled';
+}
+
+# Print an entry of a two-column table, wrapping the text
+# to LINE_WIDTH characters.
+sub wrap($$$)
+{
+  my ($left, $text, $indent) = @_;
+  my $length = LINE_WIDTH - $indent;
+  my $line_re = qr/^(\s*) (.{1,$length}|\S+?) (?=\s|$)/x;
+  my $spaces = ' ' x $indent;
+
+  if (length ($left) >= $indent) {
+    print "$left\n";
+    $left = $spaces;
+  } else {
+    $left = substr ($left . $spaces, 0, $indent);
+}
+  while ($text =~ $line_re) {
+    print "$left$2\n";
+    $text = substr($text, (length $1) + (length $2));
+    $left = $spaces;
+  }
+}
+
+sub choices($)
+{
+  my ($opt) = @_;
+  my $choices = $opt->{'choices'};
+  return join('/', sort @$choices);
+}
+
+# Print the help for the option dictionary in the second argument.
+# The first argument is the left column in the table, the third
+# is the width of the first column.
+sub print_help_line($$$)
+{
+  my ($left, $opt, $indent) = @_;
+  my $help = value_to_help($opt->{'value'});
+  my $value = $opt->{'description'} . " [$help]";
+
+  $left =~ s/_/-/g;
+  wrap("  $left", $value, $indent);
+  if ($opt->{'type'} eq 'combo') {
+    my $list = choices($opt);
+    wrap('', "(choices: $list)", $indent)
+      if $list ne FEATURE_CHOICES;
+  }
+}
+
+# Return whether the option (a dictionary) can be used without
+# arguments.  Booleans can always be used without arguments;
+# combos allow no argument only if "enabled" and "disabled"
+# are valid values.
+sub allow_no_arg($)
+{
+  my ($opt) = @_;
+  return 1 if $opt->{'type'} eq 'boolean';
+  return 0 if $opt->{'type'} ne 'combo';
+
+  my $choices = $opt->{'choices'};
+  return (grep {$_ eq 'enabled'} @$choices) &&
+         (grep {$_ eq 'disabled'} @$choices);
+}
+
+# Return whether the option (a dictionary) can be used with
+# arguments.  Booleans can never be used without arguments;
+# combos allow an argument only if they accept other values
+# than "auto", "enabled", and "disabled".
+sub allow_arg($)
+{
+  my ($opt) = @_;
+  return 0 if $opt->{'type'} eq 'boolean';
+  return 1 if $opt->{'type'} ne 'combo';
+  return choices($opt) ne FEATURE_CHOICES;
+}
+
+sub print_help(%)
+{
+  my (%options) = @_;
+  # The first section includes options that have an arguments,
+  # and booleans (i.e., only one of enable/disable makes sense)
+  foreach my $opt (sort keys %options) {
+    my $item = $options{$opt};
+    my $left;
+    next if allow_no_arg($item) and $item->{'type'} ne 'boolean';
+
+    if ($item->{'type'} eq 'boolean') {
+      $left = $item->{'value'} ? "--disable-$opt" : "--enable-$opt";
+    } else {
+      $left = "--enable-$opt=CHOICE";
+    }
+    print_help_line($left, $item, 27);
+  }
+  print("\n");
+  print("Optional features, enabled with --enable-FEATURE and\n");
+  print("disabled with --disable-FEATURE:\n");
+
+  foreach my $opt (sort keys %options) {
+    my $item = $options{$opt};
+    print_help_line($opt, $item, 18)
+      if allow_no_arg($item);
+  }
+  exit 0;
+}
+
+sub error($)
+{
+  my ($msg) = @_;
+  print STDERR "ERROR: $msg\n";
+  exit 1;
+}
+
+sub shell_quote($)
+{
+  my ($word) = @_;
+  $word =~ s/'/'\\''/g;
+  return "'$word'";
+}
+
+
+# Read Meson introspection data and convert it to a dictionary
+
+my $input = do { local $/; <STDIN> };
+my $json = decode_json $input;
+my %options = ();
+
+foreach my $item (@$json) {
+  next if $item->{'section'} ne 'user';
+  next if $item->{'name'} =~ /:/;
+  next if grep {$_ eq $item->{'name'}} SKIP_OPTIONS;
+  $options{$item->{'name'}} = $item;
+}
+
+exit if ! @ARGV;
+print_help(%options) if ($ARGV[0] eq '--print-help');
+
+my @args = ();
+foreach my $arg (@ARGV) {
+  my ($before, $opt, $value) = $arg =~ /--(enable|disable)-([^=]*)(?:=(.*))?/;
+  die "internal error parsing command line"
+    if ! defined $before ;
+  my ($key, $option);
+
+  $key = $opt;
+  $key =~ s/-/_/g;
+  $option = $options{$key};
+  error("Unknown option --$before-$opt")
+    if ! defined $option || ($before eq 'disable' && ! allow_no_arg ($option));
+
+  if (! defined $value) {
+    error("option --$before-$opt requires an argument")
+      if (! allow_no_arg ($option));
+    if ($option->{'type'} eq 'combo') {
+      $value = "${before}d";
+    } else {
+      $value = $before eq 'enable' ? 'true' : 'false';
+    }
+  } else {
+    error("option --$before-$opt does not take an argument")
+      if ($before eq 'disable' || ! allow_arg ($option));
+  }
+  push @args, shell_quote("-D$key=$value");
+}
+print join(' ', @args);
-- 
2.29.2



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* Re: [PATCH 1/8] build-system: clean up TCG/TCI configury
  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
  0 siblings, 1 reply; 32+ messages in thread
From: Peter Maydell @ 2021-01-07 15:01 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Marc-André Lureau, Daniel P. Berrange, Alex Bennée,
	QEMU Developers, Stefan Hajnoczi

On Thu, 7 Jan 2021 at 14:03, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> Make CONFIG_TCG_INTERPRETER a Meson option, and enable TCI (though with
> a warning) if the host CPU is unsupported, making it more similar to
> other --enable-* options.

The current behaviour is kind of deliberate. Using the TCG
interpreter is a terrible idea and think it's better if we
don't let users end up using it without realising that they have.
(Personally I would vote to deprecate-and-delete TCI, and also
to just have configure error out on unknown host CPU architectures.)

thanks
-- PMM


^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 1/8] build-system: clean up TCG/TCI configury
  2021-01-07 15:01   ` Peter Maydell
@ 2021-01-07 15:50     ` Paolo Bonzini
  2021-01-07 16:06       ` Daniel P. Berrangé
  0 siblings, 1 reply; 32+ messages in thread
From: Paolo Bonzini @ 2021-01-07 15:50 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Marc-André Lureau, Daniel P. Berrange, Alex Bennée,
	QEMU Developers, Stefan Hajnoczi

On 07/01/21 16:01, Peter Maydell wrote:
> On Thu, 7 Jan 2021 at 14:03, Paolo Bonzini <pbonzini@redhat.com> wrote:
>>
>> Make CONFIG_TCG_INTERPRETER a Meson option, and enable TCI (though with
>> a warning) if the host CPU is unsupported, making it more similar to
>> other --enable-* options.
> 
> The current behaviour is kind of deliberate. Using the TCG
> interpreter is a terrible idea and think it's better if we
> don't let users end up using it without realising that they have.
> (Personally I would vote to deprecate-and-delete TCI, and also
> to just have configure error out on unknown host CPU architectures.)

Fair enough, I can change this back of course.  The missing targets are 
parisc, ia64 and sh4 I guess.

Paolo



^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 3/8] gtk: remove CONFIG_GTK_GL
  2021-01-07 14:00 ` [PATCH 3/8] gtk: remove CONFIG_GTK_GL Paolo Bonzini
@ 2021-01-07 16:05   ` Gerd Hoffmann
  0 siblings, 0 replies; 32+ messages in thread
From: Gerd Hoffmann @ 2021-01-07 16:05 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: alex.bennee, marcandre.lureau, berrange, qemu-devel, stefanha

On Thu, Jan 07, 2021 at 03:00:34PM +0100, Paolo Bonzini wrote:
> CONFIG_GTK_GL is defined if OpenGL is present and GTK+
> is 3.16 or newer.  Since GTK+ 3.22 is the minimum supported
> version, just use CONFIG_OPENGL instead.
> 
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Acked-by: Gerd Hoffmann <kraxel@redhat.com>



^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 1/8] build-system: clean up TCG/TCI configury
  2021-01-07 15:50     ` Paolo Bonzini
@ 2021-01-07 16:06       ` Daniel P. Berrangé
  2021-01-13 13:09         ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 32+ messages in thread
From: Daniel P. Berrangé @ 2021-01-07 16:06 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Peter Maydell, Alex Bennée, QEMU Developers,
	Stefan Hajnoczi, Marc-André Lureau

On Thu, Jan 07, 2021 at 04:50:36PM +0100, Paolo Bonzini wrote:
> On 07/01/21 16:01, Peter Maydell wrote:
> > On Thu, 7 Jan 2021 at 14:03, Paolo Bonzini <pbonzini@redhat.com> wrote:
> > > 
> > > Make CONFIG_TCG_INTERPRETER a Meson option, and enable TCI (though with
> > > a warning) if the host CPU is unsupported, making it more similar to
> > > other --enable-* options.
> > 
> > The current behaviour is kind of deliberate. Using the TCG
> > interpreter is a terrible idea and think it's better if we
> > don't let users end up using it without realising that they have.
> > (Personally I would vote to deprecate-and-delete TCI, and also
> > to just have configure error out on unknown host CPU architectures.)
> 
> Fair enough, I can change this back of course.  The missing targets are
> parisc, ia64 and sh4 I guess.

ia64 is a dead host architecture and doesn't exist in any OS distro that
we target anymore, so I don't think we need to consider it.

Likewise parisc/hppa doesn't seem exist in Debian since Squeeze, so I
think we can rule that out too.

Only sh4 still seems to be supported in Debian. I expect the primary
need there is for sh4 guest support rather than sh4 host support.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 8/8] configure: automatically parse command line for meson -D options
  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
  0 siblings, 2 replies; 32+ messages in thread
From: Daniel P. Berrangé @ 2021-01-13 10:31 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: marcandre.lureau, alex.bennee, qemu-devel, stefanha

On Thu, Jan 07, 2021 at 03:00:39PM +0100, Paolo Bonzini wrote:
> Right now meson_options.txt lists almost 60 options.  Each option
> needs code in configure to parse it and pass the option down to Meson as
> a -D command-line argument; in addition the default must be duplicated
> between configure and meson_options.txt.
> 
> This series tries to remove the code duplication by passing unknown
> --enable and --disable options to a Perl program, and using Meson's
> introspection support to match those to meson_options.txt.
> About 80% of the options can be handled completely by the new
> mechanism.  Five meson options are not of the --enable/--disable
> kind.  Six more need to be parsed in configure for various reasons
> documented in the patch, but they still have their help automatically
> generated.
> 
> The advantages are simple to explain, and are basically what you
> can expect from an introspection-based system:
> 
> - there is obviously much less code in configure.  About 1000 lines
>   of the script deal with command line parsing, and the patch removes
>   a quarter of them.
> 
> - the script is higher quality than the repetitive code in configure.
>   Help is generally more complete and useful, for example it consistently
>   lists defaults as well as the possible choices if they are not just
>   enabled/disabled/auto.  Parsing is more consistent too, for example
>   --enable-slirp and --enable-blobs were not supported.
> 
> - new Meson options do not need any change to the configure script.
>   This increases the attractiveness of converting options from
>   hand-crafted parsing and config-host.mak to Meson.
> 
> The disadvantages are:
> 
> - a few options change name: --enable-tcmalloc and --enable-jemalloc
>   become --enable-malloc={tcmalloc,jemalloc}; --disable-blobs becomes
>   --disable-install-blobs.
> 
> - because we need to run the script to generate the full help, we
>   cannot rely on the user supplying the path to a Python interpreter
>   with --python.  For this reason, the script is written in Perl.
>   Perl 5 is universally available as "/usr/bin/env perl", while
>   (even ignoring the Python 2/3 difference) some systems do not
>   have a "python" or "python3" binary on the path.

Can't we just use  "/usr/bin/env python3", and if that doesn't
exist in $PATH, simply show truncated --help output, with a
message requesting that they pass --python to see full help.

> 
> - because we parse command-line options before meson is available,
>   the introspection output is stored in the source tree.  This is
>   the reason for the unattractive diffstat; the number of JSON lines
>   added is higher than the number of configure lines removed.
>   Of course the latter are code that must be maintained manually and
>   the former is not.
> 
> Note that the output of "meson introspect --buildoptions" is massaged
> slightly, in order to make it more stable and avoid horrible conflicts
> on every modification to meson_options.txt.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  Makefile                                |  11 +
>  configure                               | 371 ++----------
>  docs/devel/build-system.rst             |  49 +-
>  meson-buildoptions.json                 | 717 ++++++++++++++++++++++++

I'm not a fan of seeing this file introduced as it has significant
overlap with meson_options.txt.    I feel like the latter has enough
information present to do an acceptable job for help output. After
all that's sufficient if we were using meson directly.


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 8/8] configure: automatically parse command line for meson -D options
  2021-01-13 10:31   ` Daniel P. Berrangé
@ 2021-01-13 12:26     ` Paolo Bonzini
  2021-01-13 14:04     ` Paolo Bonzini
  1 sibling, 0 replies; 32+ messages in thread
From: Paolo Bonzini @ 2021-01-13 12:26 UTC (permalink / raw)
  To: Daniel P. Berrangé
  Cc: marcandre.lureau, alex.bennee, qemu-devel, stefanha

On 13/01/21 11:31, Daniel P. Berrangé wrote:
>>
>> - because we need to run the script to generate the full help, we
>>    cannot rely on the user supplying the path to a Python interpreter
>>    with --python.  For this reason, the script is written in Perl.
>>    Perl 5 is universally available as "/usr/bin/env perl", while
>>    (even ignoring the Python 2/3 difference) some systems do not
>>    have a "python" or "python3" binary on the path.
> 
> Can't we just use  "/usr/bin/env python3", and if that doesn't
> exist in $PATH, simply show truncated --help output, with a
> message requesting that they pass --python to see full help.

We can and it's what the RFC did, but I found it to be ugly for the 
user.  For example the rest of the build defaults not to "/usr/bin/env 
python3" but to whatever Python interpreter /usr/bin/meson uses.

Not that Perl is pretty, :) but developer ugliness ranks a notch lower 
than user-visible ugliness.  I cannot think of anything else that is 
already required to build QEMU and can parse JSON.

I don't expect this script to see any change ever, except for 
occasionally updating SKIP_OPTIONS.  Meson introspection data is 
backwards-compatible.

Paolo



^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 1/8] build-system: clean up TCG/TCI configury
  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 15:00           ` John Paul Adrian Glaubitz
  0 siblings, 2 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-01-13 13:09 UTC (permalink / raw)
  To: Aurelien Jarno, Stefan Weil, John Paul Adrian Glaubitz,
	Helge Deller, debian-hppa, debian-superh
  Cc: Peter Maydell, Daniel P. Berrangé,
	QEMU Developers, Stefan Hajnoczi, Marc-André Lureau,
	Paolo Bonzini, Alex Bennée

Cc'ing TCI, SH4 and PA contacts FWIW.

On 1/7/21 5:06 PM, Daniel P. Berrangé wrote:
> On Thu, Jan 07, 2021 at 04:50:36PM +0100, Paolo Bonzini wrote:
>> On 07/01/21 16:01, Peter Maydell wrote:
>>> On Thu, 7 Jan 2021 at 14:03, Paolo Bonzini <pbonzini@redhat.com> wrote:
>>>>
>>>> Make CONFIG_TCG_INTERPRETER a Meson option, and enable TCI (though with
>>>> a warning) if the host CPU is unsupported, making it more similar to
>>>> other --enable-* options.
>>>
>>> The current behaviour is kind of deliberate. Using the TCG
>>> interpreter is a terrible idea and think it's better if we
>>> don't let users end up using it without realising that they have.
>>> (Personally I would vote to deprecate-and-delete TCI, and also
>>> to just have configure error out on unknown host CPU architectures.)
>>
>> Fair enough, I can change this back of course.  The missing targets are
>> parisc, ia64 and sh4 I guess.
> 
> ia64 is a dead host architecture and doesn't exist in any OS distro that
> we target anymore, so I don't think we need to consider it.
> 
> Likewise parisc/hppa doesn't seem exist in Debian since Squeeze, so I
> think we can rule that out too.
> 
> Only sh4 still seems to be supported in Debian. I expect the primary
> need there is for sh4 guest support rather than sh4 host support.
> 
> Regards,
> Daniel
> 



^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 1/8] build-system: clean up TCG/TCI configury
  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:02             ` John David Anglin
  2021-01-13 15:00           ` John Paul Adrian Glaubitz
  1 sibling, 2 replies; 32+ messages in thread
From: Helge Deller @ 2021-01-13 13:42 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé,
	Aurelien Jarno, Stefan Weil, John Paul Adrian Glaubitz,
	debian-hppa, debian-superh
  Cc: Peter Maydell, Daniel P. Berrangé,
	QEMU Developers, Stefan Hajnoczi, Marc-André Lureau,
	Paolo Bonzini, Alex Bennée

On 1/13/21 2:09 PM, Philippe Mathieu-Daudé wrote:
> Cc'ing TCI, SH4 and PA contacts FWIW.
>
> On 1/7/21 5:06 PM, Daniel P. Berrangé wrote:
>> On Thu, Jan 07, 2021 at 04:50:36PM +0100, Paolo Bonzini wrote:
>>> On 07/01/21 16:01, Peter Maydell wrote:
>>>> On Thu, 7 Jan 2021 at 14:03, Paolo Bonzini <pbonzini@redhat.com> wrote:
>>>>>
>>>>> Make CONFIG_TCG_INTERPRETER a Meson option, and enable TCI (though with
>>>>> a warning) if the host CPU is unsupported, making it more similar to
>>>>> other --enable-* options.
>>>>
>>>> The current behaviour is kind of deliberate. Using the TCG
>>>> interpreter is a terrible idea and think it's better if we
>>>> don't let users end up using it without realising that they have.
>>>> (Personally I would vote to deprecate-and-delete TCI, and also
>>>> to just have configure error out on unknown host CPU architectures.)
>>>
>>> Fair enough, I can change this back of course.  The missing targets are
>>> parisc, ia64 and sh4 I guess.
>>
>> ia64 is a dead host architecture and doesn't exist in any OS distro that
>> we target anymore, so I don't think we need to consider it.

I have no opinion about ia64.

>> Likewise parisc/hppa doesn't seem exist in Debian since Squeeze, so I
>> think we can rule that out too.

Can we please keep parisc/hppa.
It's not an official platform any longer, but quite active in the
"unstable" debian-ports repository:
https://buildd.debian.org/status/architecture.php?a=hppa&suite=sid

>> Only sh4 still seems to be supported in Debian. I expect the primary
>> need there is for sh4 guest support rather than sh4 host support.

Same as for hppa/parisc, sh4 is in debian-ports too.

Helge


^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 1/8] build-system: clean up TCG/TCI configury
  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 14:23               ` Helge Deller
  2021-01-13 14:02             ` John David Anglin
  1 sibling, 2 replies; 32+ messages in thread
From: Daniel P. Berrangé @ 2021-01-13 13:57 UTC (permalink / raw)
  To: Helge Deller
  Cc: Peter Maydell, Paolo Bonzini, Stefan Weil,
	John Paul Adrian Glaubitz, Philippe Mathieu-Daudé,
	QEMU Developers, debian-superh, Stefan Hajnoczi, debian-hppa,
	Marc-André Lureau, Alex Bennée, Aurelien Jarno

On Wed, Jan 13, 2021 at 02:42:51PM +0100, Helge Deller wrote:
> On 1/13/21 2:09 PM, Philippe Mathieu-Daudé wrote:
> > Cc'ing TCI, SH4 and PA contacts FWIW.
> >
> > On 1/7/21 5:06 PM, Daniel P. Berrangé wrote:
> >> On Thu, Jan 07, 2021 at 04:50:36PM +0100, Paolo Bonzini wrote:
> >>> On 07/01/21 16:01, Peter Maydell wrote:
> >>>> On Thu, 7 Jan 2021 at 14:03, Paolo Bonzini <pbonzini@redhat.com> wrote:
> >>>>>
> >>>>> Make CONFIG_TCG_INTERPRETER a Meson option, and enable TCI (though with
> >>>>> a warning) if the host CPU is unsupported, making it more similar to
> >>>>> other --enable-* options.
> >>>>
> >>>> The current behaviour is kind of deliberate. Using the TCG
> >>>> interpreter is a terrible idea and think it's better if we
> >>>> don't let users end up using it without realising that they have.
> >>>> (Personally I would vote to deprecate-and-delete TCI, and also
> >>>> to just have configure error out on unknown host CPU architectures.)
> >>>
> >>> Fair enough, I can change this back of course.  The missing targets are
> >>> parisc, ia64 and sh4 I guess.
> >>
> >> ia64 is a dead host architecture and doesn't exist in any OS distro that
> >> we target anymore, so I don't think we need to consider it.
> 
> I have no opinion about ia64.
> 
> >> Likewise parisc/hppa doesn't seem exist in Debian since Squeeze, so I
> >> think we can rule that out too.
> 
> Can we please keep parisc/hppa.
> It's not an official platform any longer, but quite active in the
> "unstable" debian-ports repository:
> https://buildd.debian.org/status/architecture.php?a=hppa&suite=sid
> 
> >> Only sh4 still seems to be supported in Debian. I expect the primary
> >> need there is for sh4 guest support rather than sh4 host support.
> 
> Same as for hppa/parisc, sh4 is in debian-ports too.

So that at least shows that we need *guest target* support hppa/sha4.

The question still remains whether anyone is actually likely to be
running/using QEMU on a sh4/hppa *host*, to emulate a different
guest arch ? This is what that TCG interpreter provides for.
eg would anyone really want to emulate aarch64 guest when runing on
a hppa host ?

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 1/8] build-system: clean up TCG/TCI configury
  2021-01-13 13:42           ` Helge Deller
  2021-01-13 13:57             ` Daniel P. Berrangé
@ 2021-01-13 14:02             ` John David Anglin
  1 sibling, 0 replies; 32+ messages in thread
From: John David Anglin @ 2021-01-13 14:02 UTC (permalink / raw)
  To: Helge Deller, Philippe Mathieu-Daudé,
	Aurelien Jarno, Stefan Weil, John Paul Adrian Glaubitz,
	debian-hppa, debian-superh
  Cc: Peter Maydell, Daniel P. Berrangé,
	QEMU Developers, Stefan Hajnoczi, Marc-André Lureau,
	Paolo Bonzini, Alex Bennée

On 2021-01-13 8:42 a.m., Helge Deller wrote:
>>> ia64 is a dead host architecture and doesn't exist in any OS distro that
>>> we target anymore, so I don't think we need to consider it.
> I have no opinion about ia64.
>
>>> Likewise parisc/hppa doesn't seem exist in Debian since Squeeze, so I
>>> think we can rule that out too.
> Can we please keep parisc/hppa.
> It's not an official platform any longer, but quite active in the
> "unstable" debian-ports repository:
> https://buildd.debian.org/status/architecture.php?a=hppa&suite=sid
>
>>> Only sh4 still seems to be supported in Debian. I expect the primary
>>> need there is for sh4 guest support rather than sh4 host support.
> Same as for hppa/parisc, sh4 is in debian-ports too.
The status of the platforms in debian-ports is here:
https://www.ports.debian.org/archive
https://buildd.debian.org/status/architecture.php?a=hppa&suite=sid

There is some effort to maintain all the platforms in debian-ports.  The hppa platform is also still
in gentoo, and one or two bsd distros.

Regards,
Dave

-- 
John David Anglin  dave.anglin@bell.net




^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 8/8] configure: automatically parse command line for meson -D options
  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)
  1 sibling, 1 reply; 32+ messages in thread
From: Paolo Bonzini @ 2021-01-13 14:04 UTC (permalink / raw)
  To: Daniel P. Berrangé
  Cc: marcandre.lureau, alex.bennee, qemu-devel, stefanha

On 13/01/21 11:31, Daniel P. Berrangé wrote:
>>   meson-buildoptions.json                 | 717 ++++++++++++++++++++++++
> I'm not a fan of seeing this file introduced as it has significant
> overlap with meson_options.txt.    I feel like the latter has enough
> information present to do an acceptable job for help output. After
> all that's sufficient if we were using meson directly.

Sorry, I missed this remark.  meson-buildoptions.json is not 
hand-written.  It is the result of Meson's own parsing meson_options.txt 
exported as JSON.

In the commit message "because we parse command-line options before 
meson is available, the introspection output is stored in the source 
tree.  This is the reason for the unattractive diffstat; the number of 
JSON lines added is higher than the number of configure lines removed. 
Of course the latter are code that must be maintained manually and the 
former is not".

Paolo



^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 1/8] build-system: clean up TCG/TCI configury
  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
  1 sibling, 1 reply; 32+ messages in thread
From: Peter Maydell @ 2021-01-13 14:23 UTC (permalink / raw)
  To: Daniel P. Berrangé
  Cc: Paolo Bonzini, Stefan Weil, Helge Deller,
	John Paul Adrian Glaubitz, Philippe Mathieu-Daudé,
	QEMU Developers, debian-superh, Stefan Hajnoczi, debian-hppa,
	Marc-André Lureau, Alex Bennée, Aurelien Jarno

On Wed, 13 Jan 2021 at 13:57, Daniel P. Berrangé <berrange@redhat.com> wrote:
> The question still remains whether anyone is actually likely to be
> running/using QEMU on a sh4/hppa *host*, to emulate a different
> guest arch ? This is what that TCG interpreter provides for.
> eg would anyone really want to emulate aarch64 guest when runing on
> a hppa host ?

If anybody does, they should provide and help us maintain
an hppa backend for tcg (and resources so we can CI it).
TCI is going to be so slow as to be useless -- you might
be able to tick a box saying "we built QEMU for this port"
but I find it hard to believe anybody would actually use
the result.

thanks
-- PMM


^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 1/8] build-system: clean up TCG/TCI configury
  2021-01-13 13:57             ` Daniel P. Berrangé
  2021-01-13 14:23               ` Peter Maydell
@ 2021-01-13 14:23               ` Helge Deller
  2021-01-13 14:34                 ` Paolo Bonzini
  2021-01-14  9:51                 ` John Paul Adrian Glaubitz
  1 sibling, 2 replies; 32+ messages in thread
From: Helge Deller @ 2021-01-13 14:23 UTC (permalink / raw)
  To: Daniel P. Berrangé
  Cc: Peter Maydell, Paolo Bonzini, Stefan Weil,
	John Paul Adrian Glaubitz, Philippe Mathieu-Daudé,
	QEMU Developers, debian-superh, Stefan Hajnoczi, debian-hppa,
	Marc-André Lureau, Alex Bennée, Aurelien Jarno

On 1/13/21 2:57 PM, Daniel P. Berrangé wrote:
> On Wed, Jan 13, 2021 at 02:42:51PM +0100, Helge Deller wrote:
>> On 1/13/21 2:09 PM, Philippe Mathieu-Daudé wrote:
>>> Cc'ing TCI, SH4 and PA contacts FWIW.
>>>
>>> On 1/7/21 5:06 PM, Daniel P. Berrangé wrote:
>>>> On Thu, Jan 07, 2021 at 04:50:36PM +0100, Paolo Bonzini wrote:
>>>>> On 07/01/21 16:01, Peter Maydell wrote:
>>>>>> On Thu, 7 Jan 2021 at 14:03, Paolo Bonzini <pbonzini@redhat.com> wrote:
>>>>>>>
>>>>>>> Make CONFIG_TCG_INTERPRETER a Meson option, and enable TCI (though with
>>>>>>> a warning) if the host CPU is unsupported, making it more similar to
>>>>>>> other --enable-* options.
>>>>>>
>>>>>> The current behaviour is kind of deliberate. Using the TCG
>>>>>> interpreter is a terrible idea and think it's better if we
>>>>>> don't let users end up using it without realising that they have.
>>>>>> (Personally I would vote to deprecate-and-delete TCI, and also
>>>>>> to just have configure error out on unknown host CPU architectures.)
>>>>>
>>>>> Fair enough, I can change this back of course.  The missing targets are
>>>>> parisc, ia64 and sh4 I guess.
>>>>
>>>> ia64 is a dead host architecture and doesn't exist in any OS distro that
>>>> we target anymore, so I don't think we need to consider it.
>>
>> I have no opinion about ia64.
>>
>>>> Likewise parisc/hppa doesn't seem exist in Debian since Squeeze, so I
>>>> think we can rule that out too.
>>
>> Can we please keep parisc/hppa.
>> It's not an official platform any longer, but quite active in the
>> "unstable" debian-ports repository:
>> https://buildd.debian.org/status/architecture.php?a=hppa&suite=sid
>>
>>>> Only sh4 still seems to be supported in Debian. I expect the primary
>>>> need there is for sh4 guest support rather than sh4 host support.
>>
>> Same as for hppa/parisc, sh4 is in debian-ports too.
>
> So that at least shows that we need *guest target* support hppa/sha4.

Yes.

> The question still remains whether anyone is actually likely to be
> running/using QEMU on a sh4/hppa *host*, to emulate a different
> guest arch ?

Agreed, it's not very useful because of speed and amount of possible
users, but ....(please read below)

> This is what that TCG interpreter provides for. eg would anyone
> really want to emulate aarch64 guest when runing on a hppa host ?
In debian many packages directly and indirectly depend on the qemu
source package, because it provides - beside the emulator - various
userspace tools which are necessary natively, like e.g. qemu-img.
In the past building those tools failed on hppa because the configure script
detected that neither native TCG nor TCG interpreter support was possible.
As such the configuration aborted and no tools were built.
So, the change should still make it possible to enable building the userspace
tools.

On the other side, sometimes even a slow TCG-interpreter enabled qemu
for other arches can be useful. It's not about speed, but about the
*possibility* to emulate small pieces of different code, e.g.
cross-compilers, bios-tools and such. It's not used often, but it
can be handy.
That said, if it doesn't hurt I think we should not disable something
which can be useful (this applies to all architectures).

Helge


^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 1/8] build-system: clean up TCG/TCI configury
  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
  1 sibling, 1 reply; 32+ messages in thread
From: Paolo Bonzini @ 2021-01-13 14:34 UTC (permalink / raw)
  To: Helge Deller, Daniel P. Berrangé
  Cc: Peter Maydell, Stefan Weil, John Paul Adrian Glaubitz,
	Philippe Mathieu-Daudé,
	QEMU Developers, debian-superh, Stefan Hajnoczi, debian-hppa,
	Marc-André Lureau, Alex Bennée, Aurelien Jarno

On 13/01/21 15:23, Helge Deller wrote:
> In debian many packages directly and indirectly depend on the qemu
> source package, because it provides - beside the emulator - various
> userspace tools which are necessary natively, like e.g. qemu-img.
> In the past building those tools failed on hppa because the configure script
> detected that neither native TCG nor TCG interpreter support was possible.
> As such the configuration aborted and no tools were built.
> So, the change should still make it possible to enable building the userspace
> tools.

You could still build those, with --disable-system --disable-user.  Or 
we could rig the configure/meson scripts to do that automatically if no 
accelerator is supported.

Paolo



^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 1/8] build-system: clean up TCG/TCI configury
  2021-01-13 13:09         ` Philippe Mathieu-Daudé
  2021-01-13 13:42           ` Helge Deller
@ 2021-01-13 15:00           ` John Paul Adrian Glaubitz
  1 sibling, 0 replies; 32+ messages in thread
From: John Paul Adrian Glaubitz @ 2021-01-13 15:00 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé,
	Aurelien Jarno, Stefan Weil, Helge Deller, debian-hppa,
	debian-superh
  Cc: Peter Maydell, Daniel P. Berrangé,
	QEMU Developers, Stefan Hajnoczi, Marc-André Lureau,
	Paolo Bonzini, Alex Bennée

Hello!

On 1/13/21 2:09 PM, Philippe Mathieu-Daudé wrote:
>> ia64 is a dead host architecture and doesn't exist in any OS distro that
>> we target anymore, so I don't think we need to consider it.
>>
>> Likewise parisc/hppa doesn't seem exist in Debian since Squeeze, so I
>> think we can rule that out too.

Both hppa and ia64 are maintained as unofficial ports in Debian:

> https://cdimage.debian.org/cdimage/ports/snapshots/2021-01-03/

>> Only sh4 still seems to be supported in Debian. I expect the primary
>> need there is for sh4 guest support rather than sh4 host support.

Same applies to sh4:

> https://cdimage.debian.org/cdimage/ports/debian-installer/2021-01-03/sh4/

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913



^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 1/8] build-system: clean up TCG/TCI configury
  2021-01-13 14:34                 ` Paolo Bonzini
@ 2021-01-13 15:37                   ` Helge Deller
  0 siblings, 0 replies; 32+ messages in thread
From: Helge Deller @ 2021-01-13 15:37 UTC (permalink / raw)
  To: Paolo Bonzini, Daniel P. Berrangé
  Cc: Peter Maydell, Stefan Weil, John Paul Adrian Glaubitz,
	Philippe Mathieu-Daudé,
	QEMU Developers, debian-superh, Stefan Hajnoczi, debian-hppa,
	Marc-André Lureau, Alex Bennée, Aurelien Jarno

On 1/13/21 3:34 PM, Paolo Bonzini wrote:
> On 13/01/21 15:23, Helge Deller wrote:
>> In debian many packages directly and indirectly depend on the qemu
>> source package, because it provides - beside the emulator - various
>> userspace tools which are necessary natively, like e.g. qemu-img.
>> In the past building those tools failed on hppa because the configure script
>> detected that neither native TCG nor TCG interpreter support was possible.
>> As such the configuration aborted and no tools were built.
>> So, the change should still make it possible to enable building the userspace
>> tools.
>
> You could still build those, with --disable-system --disable-user.

Yes, since the tools are independend of the emulation, it should be possible
to build those independend if system/user is enabled or disabled.

> Or we could rig the configure/meson scripts to do that automatically
> if no accelerator is supported.

That would be the expected behaviour.

Helge


^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 7/8] configure: quote command line arguments in config.status
  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
  0 siblings, 0 replies; 32+ messages in thread
From: Eric Blake @ 2021-01-13 15:44 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel
  Cc: marcandre.lureau, alex.bennee, berrange, stefanha

On 1/7/21 8:00 AM, Paolo Bonzini wrote:
> Make config.status generation a bit more robust.  (The quote_sh
> function will also be reused to parse configure's command line
> arguments in an external script driven by Meson build option
> introspection).
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  configure | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/configure b/configure
> index d573058b16..41866cc38e 100755
> --- a/configure
> +++ b/configure
> @@ -89,6 +89,10 @@ printf " '%s'" "$0" "$@" >> config.log
>  echo >> config.log
>  echo "#" >> config.log
>  
> +quote_sh() {
> +    printf "%s" "$1" | sed "s,','\\\\'',g; s,.*,'&',"
> +}

printf %s does not append a newline, but POSIX does not require sed to
behave sanely when its input does not end in a newline.

But unless we hit a case where someone is actually using a sed that
complains, this works for me.

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org



^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 1/8] build-system: clean up TCG/TCI configury
  2021-01-13 14:23               ` Peter Maydell
@ 2021-01-13 20:39                 ` Helge Deller
  0 siblings, 0 replies; 32+ messages in thread
From: Helge Deller @ 2021-01-13 20:39 UTC (permalink / raw)
  To: Peter Maydell, Daniel P. Berrangé
  Cc: Paolo Bonzini, Stefan Weil, John Paul Adrian Glaubitz,
	Philippe Mathieu-Daudé,
	QEMU Developers, debian-superh, Stefan Hajnoczi, debian-hppa,
	Marc-André Lureau, Alex Bennée, Aurelien Jarno

On 1/13/21 3:23 PM, Peter Maydell wrote:
> On Wed, 13 Jan 2021 at 13:57, Daniel P. Berrangé <berrange@redhat.com> wrote:
>> The question still remains whether anyone is actually likely to be
>> running/using QEMU on a sh4/hppa *host*, to emulate a different
>> guest arch ? This is what that TCG interpreter provides for.
>> eg would anyone really want to emulate aarch64 guest when runing on
>> a hppa host ?
>
> If anybody does, they should provide and help us maintain
> an hppa backend for tcg (and resources so we can CI it).

My time is currently too limited to actually work on such a
backend, but out of couriosity, what hardware resources would be needed?
Is a login to a machine sufficient?

> TCI is going to be so slow as to be useless -- you might
> be able to tick a box saying "we built QEMU for this port"
> but I find it hard to believe anybody would actually use
> the result.

True. As I said in the other mail, it would be useful for small
tools/builds only.

Helge


^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 1/8] build-system: clean up TCG/TCI configury
  2021-01-13 14:23               ` Helge Deller
  2021-01-13 14:34                 ` Paolo Bonzini
@ 2021-01-14  9:51                 ` John Paul Adrian Glaubitz
  1 sibling, 0 replies; 32+ messages in thread
From: John Paul Adrian Glaubitz @ 2021-01-14  9:51 UTC (permalink / raw)
  To: Helge Deller, Daniel P. Berrangé
  Cc: Peter Maydell, Paolo Bonzini, Stefan Weil,
	Philippe Mathieu-Daudé,
	QEMU Developers, debian-superh, Stefan Hajnoczi, debian-hppa,
	Marc-André Lureau, Alex Bennée, Aurelien Jarno

Hello!

On 1/13/21 3:23 PM, Helge Deller wrote:
>> This is what that TCG interpreter provides for. eg would anyone
>> really want to emulate aarch64 guest when runing on a hppa host ?
>
> In debian many packages directly and indirectly depend on the qemu
> source package, because it provides - beside the emulator - various
> userspace tools which are necessary natively, like e.g. qemu-img.

I agree, that this a problem and it would be great if QEMU could be fixed
that it builds on all targets, not necessarily with all features available.

Currently, it looks like this:

> https://buildd.debian.org/status/package.php?p=qemu&suite=sid

Note: The build failure on sparc64 is a bug in the device-tree-compiler
package which has not been fixed in Debian yet, see:

> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=977031

> In the past building those tools failed on hppa because the configure script
> detected that neither native TCG nor TCG interpreter support was possible.
> As such the configuration aborted and no tools were built.
> So, the change should still make it possible to enable building the userspace
> tools.

I agree.

> On the other side, sometimes even a slow TCG-interpreter enabled qemu
> for other arches can be useful. It's not about speed, but about the
> *possibility* to emulate small pieces of different code, e.g.
> cross-compilers, bios-tools and such. It's not used often, but it
> can be handy.

I also agree here.

> That said, if it doesn't hurt I think we should not disable something
> which can be useful (this applies to all architectures).

True.

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913



^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 8/8] configure: automatically parse command line for meson -D options
  2021-01-13 14:04     ` Paolo Bonzini
@ 2021-01-22  8:00       ` 罗勇刚(Yonggang Luo)
  2021-01-22 20:43         ` Paolo Bonzini
  0 siblings, 1 reply; 32+ messages in thread
From: 罗勇刚(Yonggang Luo) @ 2021-01-22  8:00 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Alex Bennée, Marc-André Lureau, Daniel P. Berrangé,
	qemu-level, Stefan Hajnoczi

[-- Attachment #1: Type: text/plain, Size: 1316 bytes --]

Hi Paolo, as python and meson are required dependencies to building qemu
now,
can we detecting python/meson at the very begining of configure,
even before the --help parameter.

On Wed, Jan 13, 2021 at 6:08 AM Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> On 13/01/21 11:31, Daniel P. Berrangé wrote:
> >>   meson-buildoptions.json                 | 717
++++++++++++++++++++++++
> > I'm not a fan of seeing this file introduced as it has significant
> > overlap with meson_options.txt.    I feel like the latter has enough
> > information present to do an acceptable job for help output. After
> > all that's sufficient if we were using meson directly.
>
> Sorry, I missed this remark.  meson-buildoptions.json is not
> hand-written.  It is the result of Meson's own parsing meson_options.txt
> exported as JSON.
>
> In the commit message "because we parse command-line options before
> meson is available, the introspection output is stored in the source
> tree.  This is the reason for the unattractive diffstat; the number of
> JSON lines added is higher than the number of configure lines removed.
> Of course the latter are code that must be maintained manually and the
> former is not".
>
> Paolo
>
>


--
         此致
礼
罗勇刚
Yours
    sincerely,
Yonggang Luo

[-- Attachment #2: Type: text/html, Size: 1593 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 8/8] configure: automatically parse command line for meson -D options
  2021-01-22  8:00       ` 罗勇刚(Yonggang Luo)
@ 2021-01-22 20:43         ` Paolo Bonzini
  2021-01-23  3:30           ` 罗勇刚(Yonggang Luo)
  0 siblings, 1 reply; 32+ messages in thread
From: Paolo Bonzini @ 2021-01-22 20:43 UTC (permalink / raw)
  To: Yonggang Luo
  Cc: Alex Bennée, Marc-André Lureau, Daniel P. Berrangé,
	qemu-level, Stefan Hajnoczi

[-- Attachment #1: Type: text/plain, Size: 1647 bytes --]

Il ven 22 gen 2021, 09:00 罗勇刚(Yonggang Luo) <luoyonggang@gmail.com> ha
scritto:

> Hi Paolo, as python and meson are required dependencies to building qemu
> now,
> can we detecting python/meson at the very begining of configure,
> even before the --help parameter.
>

We could and I did it in the first version. However it's ugly that the user
has to use --python on some setups in order to get a full help message.

Paolo


> On Wed, Jan 13, 2021 at 6:08 AM Paolo Bonzini <pbonzini@redhat.com> wrote:
> >
> > On 13/01/21 11:31, Daniel P. Berrangé wrote:
> > >>   meson-buildoptions.json                 | 717
> ++++++++++++++++++++++++
> > > I'm not a fan of seeing this file introduced as it has significant
> > > overlap with meson_options.txt.    I feel like the latter has enough
> > > information present to do an acceptable job for help output. After
> > > all that's sufficient if we were using meson directly.
> >
> > Sorry, I missed this remark.  meson-buildoptions.json is not
> > hand-written.  It is the result of Meson's own parsing meson_options.txt
> > exported as JSON.
> >
> > In the commit message "because we parse command-line options before
> > meson is available, the introspection output is stored in the source
> > tree.  This is the reason for the unattractive diffstat; the number of
> > JSON lines added is higher than the number of configure lines removed.
> > Of course the latter are code that must be maintained manually and the
> > former is not".
> >
> > Paolo
> >
> >
>
>
> --
>          此致
> 礼
> 罗勇刚
> Yours
>     sincerely,
> Yonggang Luo
>

[-- Attachment #2: Type: text/html, Size: 2471 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 8/8] configure: automatically parse command line for meson -D options
  2021-01-22 20:43         ` Paolo Bonzini
@ 2021-01-23  3:30           ` 罗勇刚(Yonggang Luo)
  2021-01-23 18:00             ` Paolo Bonzini
  0 siblings, 1 reply; 32+ messages in thread
From: 罗勇刚(Yonggang Luo) @ 2021-01-23  3:30 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Alex Bennée, Marc-André Lureau, Daniel P. Berrangé,
	qemu-level, Stefan Hajnoczi

[-- Attachment #1: Type: text/plain, Size: 2024 bytes --]

On Sat, Jan 23, 2021 at 4:44 AM Paolo Bonzini <pbonzini@redhat.com> wrote:
>
>
>
> Il ven 22 gen 2021, 09:00 罗勇刚(Yonggang Luo) <luoyonggang@gmail.com> ha
scritto:
>>
>> Hi Paolo, as python and meson are required dependencies to building qemu
now,
>> can we detecting python/meson at the very begining of configure,
>> even before the --help parameter.
>
>
> We could and I did it in the first version. However it's ugly that the
user has to use --python on some setups in order to get a full help message.

  Yeap, but finally configure should gone, so I think --python are
acceptable by user, just need make sure to be noticed when the default
python
are not python3

>
> Paolo
>
>>
>> On Wed, Jan 13, 2021 at 6:08 AM Paolo Bonzini <pbonzini@redhat.com>
wrote:
>> >
>> > On 13/01/21 11:31, Daniel P. Berrangé wrote:
>> > >>   meson-buildoptions.json                 | 717
++++++++++++++++++++++++
>> > > I'm not a fan of seeing this file introduced as it has significant
>> > > overlap with meson_options.txt.    I feel like the latter has enough
>> > > information present to do an acceptable job for help output. After
>> > > all that's sufficient if we were using meson directly.
>> >
>> > Sorry, I missed this remark.  meson-buildoptions.json is not
>> > hand-written.  It is the result of Meson's own parsing
meson_options.txt
>> > exported as JSON.
>> >
>> > In the commit message "because we parse command-line options before
>> > meson is available, the introspection output is stored in the source
>> > tree.  This is the reason for the unattractive diffstat; the number of
>> > JSON lines added is higher than the number of configure lines removed.
>> > Of course the latter are code that must be maintained manually and the
>> > former is not".
>> >
>> > Paolo
>> >
>> >
>>
>>
>> --
>>          此致
>> 礼
>> 罗勇刚
>> Yours
>>     sincerely,
>> Yonggang Luo



--
         此致
礼
罗勇刚
Yours
    sincerely,
Yonggang Luo

[-- Attachment #2: Type: text/html, Size: 2744 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 8/8] configure: automatically parse command line for meson -D options
  2021-01-23  3:30           ` 罗勇刚(Yonggang Luo)
@ 2021-01-23 18:00             ` Paolo Bonzini
  0 siblings, 0 replies; 32+ messages in thread
From: Paolo Bonzini @ 2021-01-23 18:00 UTC (permalink / raw)
  To: luoyonggang
  Cc: Alex Bennée, Marc-André Lureau, Daniel P. Berrangé,
	qemu-level, Stefan Hajnoczi

On 23/01/21 04:30, 罗勇刚(Yonggang Luo) wrote:
>  > We could and I did it in the first version. However it's ugly that 
> the user has to use --python on some setups in order to get a full help 
> message.
> 
>    Yeap, but finally configure should gone, so I think --python are 
> acceptable by user, just need make sure to be noticed when the default 
> python
> are not python3

When configure will be gone, these 200 lines of Perl will disappear with 
it, so we don't have to think for future users and developers, but for 
the present.

I don't expect configure or Makefile to go away completely, because for 
example things such as "git submodule" handling are easier to do in the 
shell.  However, we also need to evaluate what's the road to a minimal 
configure (just like our Makefile is pretty minimal, only tests/tcg 
still has lots of build logic).  In that respect, automatic parsing 
command line simplifies moving things from configure to meson, and that 
is true no matter what language the parser is written in.

(BTW, I'm not such a Perl fan.  I have only ever written like 3 or 4 
programs in Perl).

Paolo



^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2021-01-23 18:02 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 5/8] configure: move GTK+ " Paolo Bonzini
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

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.