[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 66/68] configure: reorder option parsing code
|
From: |
Paolo Bonzini |
|
Subject: |
[PULL 66/68] configure: reorder option parsing code |
|
Date: |
Wed, 17 May 2023 19:45:18 +0200 |
Move some variable assignments around for clarity and to remove
one of three loops on the command line arguments.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
configure | 121 ++++++++++++++++++++++++++----------------------------
1 file changed, 58 insertions(+), 63 deletions(-)
diff --git a/configure b/configure
index 2d6ff2d6cef6..9dc17aaa7c86 100755
--- a/configure
+++ b/configure
@@ -177,29 +177,18 @@ then
error_exit "main directory cannot contain spaces nor colons"
fi
+# parse CC options first; some compiler tests are used to establish
+# some defaults, based on the host environment
+
# default parameters
cpu=""
-static="no"
cross_compile="no"
cross_prefix=""
host_cc="cc"
-use_containers="yes"
-gdb_bin=$(command -v "gdb-multiarch" || command -v "gdb")
-gdb_arches=""
-
-if test -e "$source_path/.git"
-then
- git_submodules_action="update"
-else
- git_submodules_action="ignore"
-fi
-
-git_submodules="ui/keycodemapdb"
-git="git"
-
-# Don't accept a target_list environment variable.
-unset target_list
-unset target_list_exclude
+EXTRA_CFLAGS=""
+EXTRA_CXXFLAGS=""
+EXTRA_OBJCFLAGS=""
+EXTRA_LDFLAGS=""
# Default value for a variable defining feature "foo".
# * foo="no" feature will only be used if --enable-foo arg is given
@@ -212,49 +201,8 @@ unset target_list_exclude
# Always add --enable-foo and --disable-foo command line args.
# Distributions want to ensure that several features are compiled in, and it
# is impossible without a --enable-foo that exits if a feature is not found.
-
default_feature=""
-# parse CC options second
-for opt do
- optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
- case "$opt" in
- --without-default-features)
- default_feature="no"
- ;;
- esac
-done
-EXTRA_CFLAGS=""
-EXTRA_CXXFLAGS=""
-EXTRA_OBJCFLAGS=""
-EXTRA_LDFLAGS=""
-
-debug_tcg="no"
-docs="auto"
-EXESUF=""
-prefix="/usr/local"
-qemu_suffix="qemu"
-softmmu="yes"
-linux_user=""
-bsd_user=""
-pie=""
-plugins="$default_feature"
-ninja=""
-bindir="bin"
-skip_meson=no
-vfio_user_server="disabled"
-
-# The following Meson options are handled manually (still they
-# are included in the automatically generated help message)
-
-# 1. Track which submodules are needed
-fdt="auto"
-
-# 2. Automatically enable/disable other options
-tcg="auto"
-cfi="false"
-
-# parse CC options second
for opt do
optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
case "$opt" in
@@ -293,9 +241,60 @@ for opt do
--cross-prefix-*) cc_arch=${opt#--cross-prefix-}; cc_arch=${cc_arch%%=*}
eval "cross_prefix_${cc_arch}=\$optarg"
;;
+ --without-default-features) default_feature="no"
+ ;;
esac
done
+
+if test -e "$source_path/.git"
+then
+ git_submodules_action="update"
+else
+ git_submodules_action="ignore"
+fi
+
+git_submodules="ui/keycodemapdb"
+git="git"
+debug_tcg="no"
+docs="auto"
+EXESUF=""
+prefix="/usr/local"
+qemu_suffix="qemu"
+softmmu="yes"
+linux_user=""
+bsd_user=""
+plugins="$default_feature"
+ninja=""
+python=
+pypi="enabled"
+bindir="bin"
+skip_meson=no
+vfio_user_server="disabled"
+use_containers="yes"
+gdb_bin=$(command -v "gdb-multiarch" || command -v "gdb")
+gdb_arches=""
+werror=""
+
+# Don't accept a target_list environment variable.
+unset target_list
+unset target_list_exclude
+
+# The following Meson options are handled manually (still they
+# are included in the automatically generated help message)
+
+# 1. Track which submodules are needed
+fdt="auto"
+
+# 2. Automatically enable/disable other options
+tcg="auto"
+cfi="false"
+
+# 3. Need to check for -static-pie before Meson runs. Also,
+# Meson has PIE as a boolean rather than enabled/disabled/auto.
+pie=""
+static="no"
+
# Preferred compiler:
# ${CC} (if set)
# ${cross_prefix}gcc (if cross-prefix specified)
@@ -536,8 +535,6 @@ check_py_version() {
"$1" -c 'import sys; sys.exit(sys.version_info < (3,7))'
}
-python=
-pypi="enabled"
first_python=
if test -z "${PYTHON}"; then
# A bare 'python' is traditionally python 2.x, but some distros
@@ -584,8 +581,6 @@ if test "$mingw32" = "yes" ; then
qemu_suffix=""
fi
-werror=""
-
meson_option_build_array() {
printf '['
(if test "$targetos" = windows; then
--
2.40.1
- [PULL 35/68] configure: use 'mkvenv ensure meson' to bootstrap meson, (continued)
- [PULL 35/68] configure: use 'mkvenv ensure meson' to bootstrap meson, Paolo Bonzini, 2023/05/17
- [PULL 39/68] configure: bootstrap sphinx with mkvenv, Paolo Bonzini, 2023/05/17
- [PULL 44/68] python: bump some of the dependencies, Paolo Bonzini, 2023/05/17
- [PULL 49/68] meson: add more version numbers to the summary, Paolo Bonzini, 2023/05/17
- [PULL 53/68] configure, meson: move --enable-modules to Meson, Paolo Bonzini, 2023/05/17
- [PULL 59/68] build: move warning flag selection to meson, Paolo Bonzini, 2023/05/17
- [PULL 60/68] build: move remaining compiler flag tests to meson, Paolo Bonzini, 2023/05/17
- [PULL 67/68] configure: remove unnecessary check, Paolo Bonzini, 2023/05/17
- [PULL 52/68] configure: remove pkg-config functions, Paolo Bonzini, 2023/05/17
- [PULL 58/68] build: move stack protector flag selection to meson, Paolo Bonzini, 2023/05/17
- [PULL 66/68] configure: reorder option parsing code,
Paolo Bonzini <=
- [PULL 63/68] configure: remove compiler sanity check, Paolo Bonzini, 2023/05/17
- [PULL 25/68] mkvenv: add console script entry point generation, Paolo Bonzini, 2023/05/17
- [PULL 31/68] tests/vm: add py310-expat to NetBSD, Paolo Bonzini, 2023/05/17
- [PULL 46/68] meson: require 0.63.0, Paolo Bonzini, 2023/05/17
- [PULL 47/68] meson: use prefer_static option, Paolo Bonzini, 2023/05/17
- [PULL 48/68] meson: remove static_kwargs, Paolo Bonzini, 2023/05/17
- [PULL 50/68] meson: drop unnecessary declare_dependency(), Paolo Bonzini, 2023/05/17
- [PULL 54/68] meson: prepare move of QEMU_CFLAGS to meson, Paolo Bonzini, 2023/05/17