aboutsummaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@redhat.com>2017-03-28 14:44:18 +0100
committerStefan Hajnoczi <stefanha@redhat.com>2017-04-21 10:45:34 +0100
commitc53eeaf75a04782e15a0cc931eda0b9e3143cfd0 (patch)
tree7ab691520d29fe02645b8e82a28fd18230197235 /configure
parentfa54abb8c298f892639ffc4bc2f61448ac3be4a1 (diff)
configure: eliminate Python dependency for --help
The ./configure script should produce --help output even if Python is not installed. Listing trace backends is simple: show the names of all Python modules in scripts/tracetool/backend/ whose source code contains 'PUBLIC = True'. Perform the backend enumeration in shell instead of Python so that we can move the Python check until after ./configure --help. Reported-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 20170328134418.3426-1-stefanha@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure35
1 files changed, 19 insertions, 16 deletions
diff --git a/configure b/configure
index be4d326ae0..6db3044fb0 100755
--- a/configure
+++ b/configure
@@ -1191,21 +1191,6 @@ for opt do
esac
done
-if ! has $python; then
- error_exit "Python not found. Use --python=/path/to/python"
-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 < (2,6) or sys.version_info >= (3,))'; then
- error_exit "Cannot use '$python', Python 2.6 or later is required." \
- "Note that Python 3 or later is not yet supported." \
- "Use --python=/path/to/python to specify a supported Python."
-fi
-
-# Suppress writing compiled files
-python="$python -B"
-
case "$cpu" in
ppc)
CPU_CFLAGS="-m32"
@@ -1280,6 +1265,9 @@ for config in $mak_wilds; do
default_target_list="${default_target_list} $(basename "$config" .mak)"
done
+# Enumerate public trace backends for --help output
+trace_backend_list=$(echo $(grep -le '^PUBLIC = True$' scripts/tracetool/backend/*.py | sed -e 's/^.*\/\(.*\)\.py$/\1/'))
+
if test x"$show_help" = x"yes" ; then
cat << EOF
@@ -1333,7 +1321,7 @@ Advanced options (experts only):
set block driver read-only whitelist
(affects only QEMU, not qemu-img)
--enable-trace-backends=B Set trace backend
- Available backends: $($python $source_path/scripts/tracetool.py --list-backends)
+ Available backends: $trace_backend_list
--with-trace-file=NAME Full PATH,NAME of file to store traces
Default:trace-<pid>
--disable-slirp disable SLIRP userspace network connectivity
@@ -1433,6 +1421,21 @@ EOF
exit 0
fi
+if ! has $python; then
+ error_exit "Python not found. Use --python=/path/to/python"
+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 < (2,6) or sys.version_info >= (3,))'; then
+ error_exit "Cannot use '$python', Python 2.6 or later is required." \
+ "Note that Python 3 or later is not yet supported." \
+ "Use --python=/path/to/python to specify a supported Python."
+fi
+
+# Suppress writing compiled files
+python="$python -B"
+
# Now we have handled --enable-tcg-interpreter and know we're not just
# printing the help message, bail out if the host CPU isn't supported.
if test "$ARCH" = "unknown"; then