qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: [PATCH 1/3] configure: Add the possibility to read options from meson_options.txt
Date: Sun, 29 Aug 2021 19:32:08 +0200	[thread overview]
Message-ID: <20210829173210.39562-2-thuth@redhat.com> (raw)
In-Reply-To: <20210829173210.39562-1-thuth@redhat.com>

To avoid double maintenance between the configure script and
meson_options.txt, add some simple logic in the configure script
to read the options from meson_options.txt.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 configure | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 9a79a004d7..b3e6d51916 100755
--- a/configure
+++ b/configure
@@ -836,6 +836,8 @@ fi
 
 werror=""
 
+meson_options=""
+
 for opt do
   optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
   case "$opt" in
@@ -1581,6 +1583,26 @@ for opt do
   ;;
   --disable-slirp-smbd) slirp_smbd=no
   ;;
+  --enable-*)
+      arg=$(echo "$opt" | sed -e "s/--enable-//" -e "s/-/_/g")
+      if ! grep -q "option('$arg', type[ ]*: 'feature'" \
+                $source_path/meson_options.txt; then
+          echo "ERROR: unknown option $opt"
+          echo "Try '$0 --help' for more information"
+          exit 1
+      fi
+      meson_options="$meson_options -D$arg=enabled"
+  ;;
+  --disable-*)
+      arg=$(echo "$opt" | sed -e "s/--disable-//" -e "s/-/_/g")
+      if ! grep -q "option('$arg', type[ ]*: 'feature'" \
+                $source_path/meson_options.txt; then
+          echo "ERROR: unknown option $opt"
+          echo "Try '$0 --help' for more information"
+          exit 1
+      fi
+      meson_options="$meson_options -D$arg=disabled"
+  ;;
   *)
       echo "ERROR: unknown option $opt"
       echo "Try '$0 --help' for more information"
@@ -5211,7 +5233,7 @@ if test "$skip_meson" = no; then
         -Dvhost_user_blk_server=$vhost_user_blk_server -Dmultiprocess=$multiprocess \
         -Dfuse=$fuse -Dfuse_lseek=$fuse_lseek -Dguest_agent_msi=$guest_agent_msi -Dbpf=$bpf\
         $(if test "$default_feature" = no; then echo "-Dauto_features=disabled"; fi) \
-	-Dtcg_interpreter=$tcg_interpreter \
+        -Dtcg_interpreter=$tcg_interpreter $meson_options \
         $cross_arg \
         "$PWD" "$source_path"
 
-- 
2.27.0



  reply	other threads:[~2021-08-29 17:33 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-29 17:32 [PATCH 0/3] Use meson_options.txt in the configure script Thomas Huth
2021-08-29 17:32 ` Thomas Huth [this message]
2021-08-30 14:47   ` [PATCH 1/3] configure: Add the possibility to read options from meson_options.txt Eric Blake
2021-08-29 17:32 ` [PATCH 2/3] configure: Remove options that can be handled via meson_options.txt instead Thomas Huth
2021-08-30 15:06   ` Eric Blake
2021-08-30 15:33     ` Richard Henderson
2021-08-30 16:33     ` Thomas Huth
2021-08-29 17:32 ` [PATCH 3/3] configure: Get help text from meson_options.txt Thomas Huth
2021-08-30 15:30   ` Eric Blake
2021-08-30 16:48     ` Thomas Huth
2021-08-29 21:22 ` [PATCH 0/3] Use meson_options.txt in the configure script Marc-André Lureau
2021-08-30  5:11   ` Thomas Huth
2021-08-30  9:12     ` Philippe Mathieu-Daudé
2021-08-30  9:21       ` Peter Maydell
2021-08-31 12:49     ` Paolo Bonzini

Reply instructions:

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

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

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

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

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

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

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).