[PATCH 18/34] configure: switch string options to automatic parsing

Paolo Bonzini posted 34 patches 3 years, 9 months ago
Maintainers: Yuval Shaia <yuval.shaia.ml@gmail.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Jason Wang <jasowang@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Fam Zheng <fam@euphon.net>, Stefano Stabellini <sstabellini@kernel.org>, Anthony Perard <anthony.perard@citrix.com>, Paul Durrant <paul@xen.org>, "Michael S. Tsirkin" <mst@redhat.com>, Juan Quintela <quintela@redhat.com>, "Dr. David Alan Gilbert" <dgilbert@redhat.com>, Michael Roth <michael.roth@amd.com>, John Snow <jsnow@redhat.com>, Cleber Rosa <crosa@redhat.com>, Thomas Huth <thuth@redhat.com>, Laurent Vivier <lvivier@redhat.com>, Gerd Hoffmann <kraxel@redhat.com>
There is a newer version of this series
[PATCH 18/34] configure: switch string options to automatic parsing
Posted by Paolo Bonzini 3 years, 9 months ago
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure                     | 24 +-----------------------
 scripts/meson-buildoptions.py |  5 +----
 scripts/meson-buildoptions.sh |  9 +++++++++
 3 files changed, 11 insertions(+), 27 deletions(-)

diff --git a/configure b/configure
index 87ceb33917..8f34f2a061 100755
--- a/configure
+++ b/configure
@@ -231,12 +231,10 @@ fi
 
 # default parameters
 cpu=""
-iasl="iasl"
 interp_prefix="/usr/gnemul/qemu-%M"
 static="no"
 cross_compile="no"
 cross_prefix=""
-audio_drv_list="default"
 block_drv_rw_whitelist=""
 block_drv_ro_whitelist=""
 host_cc="cc"
@@ -312,7 +310,6 @@ linux_user=""
 bsd_user=""
 pkgversion=""
 pie=""
-trace_file="trace"
 coroutine=""
 tls_priority="NORMAL"
 plugins="$default_feature"
@@ -713,8 +710,6 @@ for opt do
   ;;
   --cxx=*)
   ;;
-  --iasl=*) iasl="$optarg"
-  ;;
   --objcc=*) objcc="$optarg"
   ;;
   --make=*) make="$optarg"
@@ -723,8 +718,6 @@ for opt do
   ;;
   --python=*) python="$optarg" ; explicit_python=yes
   ;;
-  --sphinx-build=*) sphinx_build="$optarg"
-  ;;
   --skip-meson) skip_meson=yes
   ;;
   --meson=*) meson="$optarg"
@@ -765,8 +758,6 @@ for opt do
                        error_exit "Can't mix --target-list-exclude with --target-list"
                    fi
   ;;
-  --with-trace-file=*) trace_file="$optarg"
-  ;;
   --with-default-devices) default_devices="true"
   ;;
   --without-default-devices) default_devices="false"
@@ -825,8 +816,6 @@ for opt do
     # configure to be used by RPM and similar macros that set
     # lots of directory switches by default.
   ;;
-  --audio-drv-list=*) audio_drv_list="$optarg"
-  ;;
   --block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=$(echo "$optarg" | sed -e 's/,/ /g')
   ;;
   --block-drv-ro-whitelist=*) block_drv_ro_whitelist=$(echo "$optarg" | sed -e 's/,/ /g')
@@ -1000,12 +989,7 @@ for opt do
   --enable-jemalloc) meson_option_parse --enable-malloc=jemalloc jemalloc
   ;;
   # everything else has the same name in configure and meson
-  --enable-* | --disable-*) meson_option_parse "$opt" "$optarg"
-  ;;
-  *)
-      echo "ERROR: unknown option $opt"
-      echo "Try '$0 --help' for more information"
-      exit 1
+  --*) meson_option_parse "$opt" "$optarg"
   ;;
   esac
 done
@@ -1128,7 +1112,6 @@ $(echo Available targets: $default_target_list | \
 Advanced options (experts only):
   --cross-prefix=PREFIX    use PREFIX for compile tools, PREFIX can be blank [$cross_prefix]
   --cc=CC                  use C compiler CC [$cc]
-  --iasl=IASL              use ACPI compiler IASL [$iasl]
   --host-cc=CC             use C compiler CC [$host_cc] for code run at
                            build time
   --cxx=CXX                use C++ compiler CXX [$cxx]
@@ -1141,7 +1124,6 @@ Advanced options (experts only):
   --cross-cc-cflags-ARCH=  use compiler flags when building ARCH guest tests
   --make=MAKE              use specified make [$make]
   --python=PYTHON          use specified python [$python]
-  --sphinx-build=SPHINX    use specified sphinx-build [$sphinx_build]
   --meson=MESON            use specified meson [$meson]
   --ninja=NINJA            use specified ninja [$ninja]
   --smbd=SMBD              use specified smbd [$smbd]
@@ -2484,15 +2466,11 @@ if test "$skip_meson" = no; then
         --sysconfdir "$sysconfdir" \
         --localedir "$localedir" \
         --localstatedir "$local_statedir" \
-        -Daudio_drv_list=$audio_drv_list \
         -Ddefault_devices=$default_devices \
         -Ddocdir="$docdir" \
-        -Diasl="$iasl" \
         -Dqemu_firmwarepath="$firmwarepath" \
         -Dqemu_suffix="$qemu_suffix" \
         -Dsmbd="$smbd" \
-        -Dsphinx_build="$sphinx_build" \
-        -Dtrace_file="$trace_file" \
         -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) \
diff --git a/scripts/meson-buildoptions.py b/scripts/meson-buildoptions.py
index 4af8d6e732..3e540e8bb3 100755
--- a/scripts/meson-buildoptions.py
+++ b/scripts/meson-buildoptions.py
@@ -26,21 +26,18 @@
 import sys
 
 SKIP_OPTIONS = {
-    "audio_drv_list",
     "default_devices",
     "docdir",
     "fuzzing_engine",
-    "iasl",
     "qemu_firmwarepath",
     "qemu_suffix",
     "smbd",
-    "sphinx_build",
-    "trace_file",
 }
 
 OPTION_NAMES = {
     "malloc": "enable-malloc",
     "trace_backends": "enable-trace-backends",
+    "trace_file": "with-trace-file",
 }
 
 BUILTIN_OPTIONS = {
diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
index 5a06b7915c..63f2f1abcf 100644
--- a/scripts/meson-buildoptions.sh
+++ b/scripts/meson-buildoptions.sh
@@ -1,5 +1,7 @@
 # This file is generated by meson-buildoptions.py, do not edit!
 meson_options_help() {
+  printf "%s\n" '  --audio-drv-list=CHOICES Set audio driver list [default] (choices:'
+  printf "%s\n" '                           alsa/coreaudio/default/dsound/jack/oss/pa/sdl)'
   printf "%s\n" '  --disable-coroutine-pool coroutine freelist (better performance)'
   printf "%s\n" '  --disable-install-blobs  install provided firmware blobs'
   printf "%s\n" '  --enable-block-drv-whitelist-in-tools'
@@ -32,6 +34,9 @@ meson_options_help() {
   printf "%s\n" '  --enable-trace-backends=CHOICES'
   printf "%s\n" '                           Set available tracing backends [log] (choices:'
   printf "%s\n" '                           dtrace/ftrace/log/nop/simple/syslog/ust)'
+  printf "%s\n" '  --iasl=VALUE             Path to ACPI disassembler'
+  printf "%s\n" '  --sphinx-build=VALUE     Use specified sphinx-build for building document'
+  printf "%s\n" '  --with-trace-file=VALUE  Trace file prefix for simple backend [trace]'
   printf "%s\n" ''
   printf "%s\n" 'Optional features, enabled with --enable-FEATURE and'
   printf "%s\n" 'disabled with --disable-FEATURE, default is enabled if available'
@@ -147,6 +152,7 @@ _meson_option_parse() {
     --disable-alsa) printf "%s" -Dalsa=disabled ;;
     --enable-attr) printf "%s" -Dattr=enabled ;;
     --disable-attr) printf "%s" -Dattr=disabled ;;
+    --audio-drv-list=*) quote_sh "-Daudio_drv_list=$2" ;;
     --enable-auth-pam) printf "%s" -Dauth_pam=enabled ;;
     --disable-auth-pam) printf "%s" -Dauth_pam=disabled ;;
     --enable-avx2) printf "%s" -Davx2=enabled ;;
@@ -229,6 +235,7 @@ _meson_option_parse() {
     --disable-hax) printf "%s" -Dhax=disabled ;;
     --enable-hvf) printf "%s" -Dhvf=enabled ;;
     --disable-hvf) printf "%s" -Dhvf=disabled ;;
+    --iasl=*) quote_sh "-Diasl=$2" ;;
     --enable-iconv) printf "%s" -Diconv=enabled ;;
     --disable-iconv) printf "%s" -Diconv=disabled ;;
     --enable-install-blobs) printf "%s" -Dinstall_blobs=true ;;
@@ -331,6 +338,7 @@ _meson_option_parse() {
     --disable-snappy) printf "%s" -Dsnappy=disabled ;;
     --enable-sparse) printf "%s" -Dsparse=enabled ;;
     --disable-sparse) printf "%s" -Dsparse=disabled ;;
+    --sphinx-build=*) quote_sh "-Dsphinx_build=$2" ;;
     --enable-spice) printf "%s" -Dspice=enabled ;;
     --disable-spice) printf "%s" -Dspice=disabled ;;
     --enable-spice-protocol) printf "%s" -Dspice_protocol=enabled ;;
@@ -346,6 +354,7 @@ _meson_option_parse() {
     --enable-tpm) printf "%s" -Dtpm=enabled ;;
     --disable-tpm) printf "%s" -Dtpm=disabled ;;
     --enable-trace-backends=*) quote_sh "-Dtrace_backends=$2" ;;
+    --with-trace-file=*) quote_sh "-Dtrace_file=$2" ;;
     --enable-u2f) printf "%s" -Du2f=enabled ;;
     --disable-u2f) printf "%s" -Du2f=disabled ;;
     --enable-usb-redir) printf "%s" -Dusb_redir=enabled ;;
-- 
2.35.1
Re: [PATCH 18/34] configure: switch string options to automatic parsing
Posted by Marc-André Lureau 3 years, 9 months ago
On Wed, Apr 20, 2022 at 8:03 PM Paolo Bonzini <pbonzini@redhat.com> wrote:

> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>

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



> ---
>  configure                     | 24 +-----------------------
>  scripts/meson-buildoptions.py |  5 +----
>  scripts/meson-buildoptions.sh |  9 +++++++++
>  3 files changed, 11 insertions(+), 27 deletions(-)
>
> diff --git a/configure b/configure
> index 87ceb33917..8f34f2a061 100755
> --- a/configure
> +++ b/configure
> @@ -231,12 +231,10 @@ fi
>
>  # default parameters
>  cpu=""
> -iasl="iasl"
>  interp_prefix="/usr/gnemul/qemu-%M"
>  static="no"
>  cross_compile="no"
>  cross_prefix=""
> -audio_drv_list="default"
>  block_drv_rw_whitelist=""
>  block_drv_ro_whitelist=""
>  host_cc="cc"
> @@ -312,7 +310,6 @@ linux_user=""
>  bsd_user=""
>  pkgversion=""
>  pie=""
> -trace_file="trace"
>  coroutine=""
>  tls_priority="NORMAL"
>  plugins="$default_feature"
> @@ -713,8 +710,6 @@ for opt do
>    ;;
>    --cxx=*)
>    ;;
> -  --iasl=*) iasl="$optarg"
> -  ;;
>    --objcc=*) objcc="$optarg"
>    ;;
>    --make=*) make="$optarg"
> @@ -723,8 +718,6 @@ for opt do
>    ;;
>    --python=*) python="$optarg" ; explicit_python=yes
>    ;;
> -  --sphinx-build=*) sphinx_build="$optarg"
> -  ;;
>    --skip-meson) skip_meson=yes
>    ;;
>    --meson=*) meson="$optarg"
> @@ -765,8 +758,6 @@ for opt do
>                         error_exit "Can't mix --target-list-exclude with
> --target-list"
>                     fi
>    ;;
> -  --with-trace-file=*) trace_file="$optarg"
> -  ;;
>    --with-default-devices) default_devices="true"
>    ;;
>    --without-default-devices) default_devices="false"
> @@ -825,8 +816,6 @@ for opt do
>      # configure to be used by RPM and similar macros that set
>      # lots of directory switches by default.
>    ;;
> -  --audio-drv-list=*) audio_drv_list="$optarg"
> -  ;;
>    --block-drv-rw-whitelist=*|--block-drv-whitelist=*)
> block_drv_rw_whitelist=$(echo "$optarg" | sed -e 's/,/ /g')
>    ;;
>    --block-drv-ro-whitelist=*) block_drv_ro_whitelist=$(echo "$optarg" |
> sed -e 's/,/ /g')
> @@ -1000,12 +989,7 @@ for opt do
>    --enable-jemalloc) meson_option_parse --enable-malloc=jemalloc jemalloc
>    ;;
>    # everything else has the same name in configure and meson
> -  --enable-* | --disable-*) meson_option_parse "$opt" "$optarg"
> -  ;;
> -  *)
> -      echo "ERROR: unknown option $opt"
> -      echo "Try '$0 --help' for more information"
> -      exit 1
> +  --*) meson_option_parse "$opt" "$optarg"
>    ;;
>    esac
>  done
> @@ -1128,7 +1112,6 @@ $(echo Available targets: $default_target_list | \
>  Advanced options (experts only):
>    --cross-prefix=PREFIX    use PREFIX for compile tools, PREFIX can be
> blank [$cross_prefix]
>    --cc=CC                  use C compiler CC [$cc]
> -  --iasl=IASL              use ACPI compiler IASL [$iasl]
>    --host-cc=CC             use C compiler CC [$host_cc] for code run at
>                             build time
>    --cxx=CXX                use C++ compiler CXX [$cxx]
> @@ -1141,7 +1124,6 @@ Advanced options (experts only):
>    --cross-cc-cflags-ARCH=  use compiler flags when building ARCH guest
> tests
>    --make=MAKE              use specified make [$make]
>    --python=PYTHON          use specified python [$python]
> -  --sphinx-build=SPHINX    use specified sphinx-build [$sphinx_build]
>    --meson=MESON            use specified meson [$meson]
>    --ninja=NINJA            use specified ninja [$ninja]
>    --smbd=SMBD              use specified smbd [$smbd]
> @@ -2484,15 +2466,11 @@ if test "$skip_meson" = no; then
>          --sysconfdir "$sysconfdir" \
>          --localedir "$localedir" \
>          --localstatedir "$local_statedir" \
> -        -Daudio_drv_list=$audio_drv_list \
>          -Ddefault_devices=$default_devices \
>          -Ddocdir="$docdir" \
> -        -Diasl="$iasl" \
>          -Dqemu_firmwarepath="$firmwarepath" \
>          -Dqemu_suffix="$qemu_suffix" \
>          -Dsmbd="$smbd" \
> -        -Dsphinx_build="$sphinx_build" \
> -        -Dtrace_file="$trace_file" \
>          -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) \
> diff --git a/scripts/meson-buildoptions.py b/scripts/meson-buildoptions.py
> index 4af8d6e732..3e540e8bb3 100755
> --- a/scripts/meson-buildoptions.py
> +++ b/scripts/meson-buildoptions.py
> @@ -26,21 +26,18 @@
>  import sys
>
>  SKIP_OPTIONS = {
> -    "audio_drv_list",
>      "default_devices",
>      "docdir",
>      "fuzzing_engine",
> -    "iasl",
>      "qemu_firmwarepath",
>      "qemu_suffix",
>      "smbd",
> -    "sphinx_build",
> -    "trace_file",
>  }
>
>  OPTION_NAMES = {
>      "malloc": "enable-malloc",
>      "trace_backends": "enable-trace-backends",
> +    "trace_file": "with-trace-file",
>  }
>
>  BUILTIN_OPTIONS = {
> diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
> index 5a06b7915c..63f2f1abcf 100644
> --- a/scripts/meson-buildoptions.sh
> +++ b/scripts/meson-buildoptions.sh
> @@ -1,5 +1,7 @@
>  # This file is generated by meson-buildoptions.py, do not edit!
>  meson_options_help() {
> +  printf "%s\n" '  --audio-drv-list=CHOICES Set audio driver list
> [default] (choices:'
> +  printf "%s\n" '
>  alsa/coreaudio/default/dsound/jack/oss/pa/sdl)'
>    printf "%s\n" '  --disable-coroutine-pool coroutine freelist (better
> performance)'
>    printf "%s\n" '  --disable-install-blobs  install provided firmware
> blobs'
>    printf "%s\n" '  --enable-block-drv-whitelist-in-tools'
> @@ -32,6 +34,9 @@ meson_options_help() {
>    printf "%s\n" '  --enable-trace-backends=CHOICES'
>    printf "%s\n" '                           Set available tracing
> backends [log] (choices:'
>    printf "%s\n" '
>  dtrace/ftrace/log/nop/simple/syslog/ust)'
> +  printf "%s\n" '  --iasl=VALUE             Path to ACPI disassembler'
> +  printf "%s\n" '  --sphinx-build=VALUE     Use specified sphinx-build
> for building document'
> +  printf "%s\n" '  --with-trace-file=VALUE  Trace file prefix for simple
> backend [trace]'
>    printf "%s\n" ''
>    printf "%s\n" 'Optional features, enabled with --enable-FEATURE and'
>    printf "%s\n" 'disabled with --disable-FEATURE, default is enabled if
> available'
> @@ -147,6 +152,7 @@ _meson_option_parse() {
>      --disable-alsa) printf "%s" -Dalsa=disabled ;;
>      --enable-attr) printf "%s" -Dattr=enabled ;;
>      --disable-attr) printf "%s" -Dattr=disabled ;;
> +    --audio-drv-list=*) quote_sh "-Daudio_drv_list=$2" ;;
>      --enable-auth-pam) printf "%s" -Dauth_pam=enabled ;;
>      --disable-auth-pam) printf "%s" -Dauth_pam=disabled ;;
>      --enable-avx2) printf "%s" -Davx2=enabled ;;
> @@ -229,6 +235,7 @@ _meson_option_parse() {
>      --disable-hax) printf "%s" -Dhax=disabled ;;
>      --enable-hvf) printf "%s" -Dhvf=enabled ;;
>      --disable-hvf) printf "%s" -Dhvf=disabled ;;
> +    --iasl=*) quote_sh "-Diasl=$2" ;;
>      --enable-iconv) printf "%s" -Diconv=enabled ;;
>      --disable-iconv) printf "%s" -Diconv=disabled ;;
>      --enable-install-blobs) printf "%s" -Dinstall_blobs=true ;;
> @@ -331,6 +338,7 @@ _meson_option_parse() {
>      --disable-snappy) printf "%s" -Dsnappy=disabled ;;
>      --enable-sparse) printf "%s" -Dsparse=enabled ;;
>      --disable-sparse) printf "%s" -Dsparse=disabled ;;
> +    --sphinx-build=*) quote_sh "-Dsphinx_build=$2" ;;
>      --enable-spice) printf "%s" -Dspice=enabled ;;
>      --disable-spice) printf "%s" -Dspice=disabled ;;
>      --enable-spice-protocol) printf "%s" -Dspice_protocol=enabled ;;
> @@ -346,6 +354,7 @@ _meson_option_parse() {
>      --enable-tpm) printf "%s" -Dtpm=enabled ;;
>      --disable-tpm) printf "%s" -Dtpm=disabled ;;
>      --enable-trace-backends=*) quote_sh "-Dtrace_backends=$2" ;;
> +    --with-trace-file=*) quote_sh "-Dtrace_file=$2" ;;
>      --enable-u2f) printf "%s" -Du2f=enabled ;;
>      --disable-u2f) printf "%s" -Du2f=disabled ;;
>      --enable-usb-redir) printf "%s" -Dusb_redir=enabled ;;
> --
> 2.35.1
>
>
>
>

-- 
Marc-André Lureau