aboutsummaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2023-02-27 18:23:58 +0000
committerPeter Maydell <peter.maydell@linaro.org>2023-02-27 18:23:58 +0000
commit33dc95d032a86dd007073d72cf006f663c614de2 (patch)
tree93ec17f54a2a4379fdea84818b3806e02539816b /configure
parente1f9f73ba15e0356ce1aa3317d7bd294f587ab58 (diff)
parent7eb061b06e97af9a8da7f31b839d78997ae737fc (diff)
downloadqemu-33dc95d032a86dd007073d72cf006f663c614de2.zip
qemu-33dc95d032a86dd007073d72cf006f663c614de2.tar.gz
qemu-33dc95d032a86dd007073d72cf006f663c614de2.tar.bz2
Merge tag 'for-upstream-8.0' of https://gitlab.com/bonzini/qemu into staging
* New Sapphire Rapids model support * x86 bugfixes * Prepare to drop support for Python 3.6 # -----BEGIN PGP SIGNATURE----- # # iQFIBAABCAAyFiEE8TM4V0tmI4mGbHaCv/vSX3jHroMFAmP87gcUHHBib256aW5p # QHJlZGhhdC5jb20ACgkQv/vSX3jHroM+TAf/TcRrukw+FXUs0Ld3AadRY6g3xV2x # n1VIfkMC2Bp1LVOS1W9aw7V6jPg8KMAV9SCQJjsVtyB5E9yPQg+/w7UgexqISYQG # 7NK3jDXmslSGIHNHh4qH9xAjQGjw/6e7N/gyWP+99vHPwZSbFJT6k7KP0/3O9yCu # /9KINq8AvvGbfW5m2d/umV1v1Gq4KwXkTa5uVIOciDMJtaA0QjADHg1MqsHPzBUP # F4du5BbuMaJkgQgJV5zsn7W9NnEQt1XzSug1c/vp2vyqEV00L4TjL9BzTqsTEBtS # KjUcQif5R5a+o8QRND9j8f74xjFpOR/nAEleNsfo6iwZQwWAiBQZ8ETsew== # =2aMG # -----END PGP SIGNATURE----- # gpg: Signature made Mon 27 Feb 2023 17:53:11 GMT # gpg: using RSA key F13338574B662389866C7682BFFBD25F78C7AE83 # gpg: issuer "pbonzini@redhat.com" # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full] # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" [full] # Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4 E2F7 7E15 100C CD36 69B1 # Subkey fingerprint: F133 3857 4B66 2389 866C 7682 BFFB D25F 78C7 AE83 * tag 'for-upstream-8.0' of https://gitlab.com/bonzini/qemu: i386: Add new CPU model SapphireRapids target/i386: KVM: allow fast string operations if host supports them target/i386: add FZRM, FSRS, FSRC target/i386: add FSRM to TCG MAINTAINERS: Cover RCU documentation ci, docker: update CentOS and OpenSUSE Python to non-EOL versions docs/devel: update and clarify lcitool instructions lcitool: update submodule configure: Look for auxiliary Python installations configure: protect against escaping venv when running Meson meson: stop looking for 'sphinx-build-3' meson: Avoid duplicates in generated config-poison.h again target/i386: Fix BZHI instruction Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure80
1 files changed, 61 insertions, 19 deletions
diff --git a/configure b/configure
index dccb5d4..2a8a9be 100755
--- a/configure
+++ b/configure
@@ -596,20 +596,43 @@ esac
: ${make=${MAKE-make}}
-# We prefer python 3.x. A bare 'python' is traditionally
-# python 2.x, but some distros have it as python 3.x, so
-# we check that too
+
+check_py_version() {
+ # We require python >= 3.6.
+ # NB: a True python conditional creates a non-zero return code (Failure)
+ "$1" -c 'import sys; sys.exit(sys.version_info < (3,6))'
+}
+
python=
-explicit_python=no
-for binary in "${PYTHON-python3}" python
-do
- if has "$binary"
- then
- python=$(command -v "$binary")
- break
+first_python=
+if test -z "${PYTHON}"; then
+ explicit_python=no
+ # A bare 'python' is traditionally python 2.x, but some distros
+ # have it as python 3.x, so check in both places.
+ for binary in python3 python python3.11 python3.10 python3.9 python3.8 python3.7 python3.6; do
+ if has "$binary"; then
+ python=$(command -v "$binary")
+ if check_py_version "$python"; then
+ # This one is good.
+ first_python=
+ break
+ else
+ first_python=$python
+ fi
+ fi
+ done
+else
+ # Same as above, but only check the environment variable.
+ has "${PYTHON}" || error_exit "The PYTHON environment variable does not point to an executable"
+ python=$(command -v "$PYTHON")
+ explicit_python=yes
+ if check_py_version "$python"; then
+ # This one is good.
+ first_python=
+ else
+ first_python=$first_python
fi
-done
-
+fi
# Check for ancillary tools used in testing
genisoimage=
@@ -1034,25 +1057,44 @@ rm -f ./*/config-devices.mak.d
if test -z "$python"
then
- error_exit "Python not found. Use --python=/path/to/python"
+ # If first_python is set, there was a binary somewhere even though
+ # it was not suitable. Use it for the error message.
+ if test -n "$first_python"; then
+ error_exit "Cannot use '$first_python', Python >= 3.6 is required." \
+ "Use --python=/path/to/python to specify a supported Python."
+ else
+ error_exit "Python not found. Use --python=/path/to/python"
+ fi
fi
+
if ! has "$make"
then
error_exit "GNU make ($make) not found"
fi
-# Note that if the Python conditional here evaluates True we will exit
-# with status 1 which is a shell 'false' value.
-if ! $python -c 'import sys; sys.exit(sys.version_info < (3,6))'; then
+if ! check_py_version "$python"; then
error_exit "Cannot use '$python', Python >= 3.6 is required." \
"Use --python=/path/to/python to specify a supported Python."
fi
-# Suppress writing compiled files
-python="$python -B"
+# Resolve PATH + suppress writing compiled files
+python="$(command -v "$python") -B"
+
+has_meson() {
+ local python_dir=$(dirname "$python")
+ # PEP405: pyvenv.cfg is either adjacent to the Python executable
+ # or one directory above
+ if test -f $python_dir/pyvenv.cfg || test -f $python_dir/../pyvenv.cfg; then
+ # Ensure that Meson and Python come from the same virtual environment
+ test -x "$python_dir/meson" &&
+ test "$(command -v meson)" -ef "$python_dir/meson"
+ else
+ has meson
+ fi
+}
if test -z "$meson"; then
- if test "$explicit_python" = no && has meson && version_ge "$(meson --version)" 0.61.5; then
+ if test "$explicit_python" = no && has_meson && version_ge "$(meson --version)" 0.61.5; then
meson=meson
elif test "$git_submodules_action" != 'ignore' ; then
meson=git