configure: automatically pick python3 is available
Unless overridden via an env var or configure arg, QEMU will only look for the 'python' binary in $PATH. This is unhelpful on distros which are only shipping Python 3.x (eg Fedora) in their default install as, if they comply with PEP 394, the bare 'python' binary won't exist. This changes configure so that by default it will search for all three common python binaries, preferring to find Python 3.x versions. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20190327170701.23798-1-berrange@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
This commit is contained in:
parent
b36b59371f
commit
faf441429a
18
configure
vendored
18
configure
vendored
@ -899,7 +899,18 @@ fi
|
|||||||
|
|
||||||
: ${make=${MAKE-make}}
|
: ${make=${MAKE-make}}
|
||||||
: ${install=${INSTALL-install}}
|
: ${install=${INSTALL-install}}
|
||||||
: ${python=${PYTHON-python}}
|
# 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 before python2
|
||||||
|
python=
|
||||||
|
for binary in "${PYTHON-python3}" python python2
|
||||||
|
do
|
||||||
|
if has "$binary"
|
||||||
|
then
|
||||||
|
python="$binary"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
: ${smbd=${SMBD-/usr/sbin/smbd}}
|
: ${smbd=${SMBD-/usr/sbin/smbd}}
|
||||||
|
|
||||||
# Default objcc to clang if available, otherwise use CC
|
# Default objcc to clang if available, otherwise use CC
|
||||||
@ -1818,8 +1829,9 @@ EOF
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! has $python; then
|
if test -z "$python"
|
||||||
error_exit "Python not found. Use --python=/path/to/python"
|
then
|
||||||
|
error_exit "Python not found. Use --python=/path/to/python"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Note that if the Python conditional here evaluates True we will exit
|
# Note that if the Python conditional here evaluates True we will exit
|
||||||
|
Loading…
Reference in New Issue
Block a user