mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
build: fix tools/configure in case only python3 exists
Calling ./configure with python3 being there but no python, tools/configure will fail. Fix that by defaulting to python and falling back to python3 or python2. While at it fix the use of non portable "type -p" by replacing it by AC_PATH_PROG(). Signed-off-by: Juergen Gross <jgross@suse.com> Acked-by: Wei Liu <wl@xen.org> [ wei: run autogen.sh ] Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
This commit is contained in:
1 parent
b4f042236a
commit
5852ca4852
2 files changed
+89
-4
No files matched your search
Vendored
+86
-2
@@ -6926,12 +6926,96 @@ then
|
||||
fi;;
|
||||
esac
|
||||
if test -z "$PYTHON"; then :
|
||||
PYTHON="python"
|
||||
for ac_prog in python python3 python2
|
||||
do
|
||||
# Extract the first word of "$ac_prog", so it can be a program name with args.
|
||||
set dummy $ac_prog; ac_word=$2
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
||||
$as_echo_n "checking for $ac_word... " >&6; }
|
||||
if ${ac_cv_prog_PYTHON+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
if test -n "$PYTHON"; then
|
||||
ac_cv_prog_PYTHON="$PYTHON" # Let the user override the test.
|
||||
else
|
||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
for as_dir in $PATH
|
||||
do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_prog_PYTHON="$ac_prog"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
IFS=$as_save_IFS
|
||||
|
||||
fi
|
||||
fi
|
||||
PYTHON=$ac_cv_prog_PYTHON
|
||||
if test -n "$PYTHON"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5
|
||||
$as_echo "$PYTHON" >&6; }
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
fi
|
||||
|
||||
|
||||
test -n "$PYTHON" && break
|
||||
done
|
||||
test -n "$PYTHON" || PYTHON="err"
|
||||
|
||||
fi
|
||||
if test "$PYTHON" = "err"; then :
|
||||
as_fn_error $? "No python interpreter found" "$LINENO" 5
|
||||
fi
|
||||
if echo "$PYTHON" | grep -q "^/"; then :
|
||||
|
||||
else
|
||||
PYTHON=`type -p "$PYTHON"`
|
||||
# Extract the first word of "$PYTHON", so it can be a program name with args.
|
||||
set dummy $PYTHON; ac_word=$2
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
||||
$as_echo_n "checking for $ac_word... " >&6; }
|
||||
if ${ac_cv_path_PYTHON+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
case $PYTHON in
|
||||
[\\/]* | ?:[\\/]*)
|
||||
ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path.
|
||||
;;
|
||||
*)
|
||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
for as_dir in $PATH
|
||||
do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
IFS=$as_save_IFS
|
||||
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
PYTHON=$ac_cv_path_PYTHON
|
||||
if test -n "$PYTHON"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5
|
||||
$as_echo "$PYTHON" >&6; }
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
fi
|
||||
|
||||
|
||||
fi
|
||||
PYTHONPATH=$PYTHON
|
||||
PYTHON=`basename $PYTHONPATH`
|
||||
|
||||
+3
-2
@@ -337,8 +337,9 @@ case "$host_os" in
|
||||
freebsd*) ;;
|
||||
*) AX_PATH_PROG_OR_FAIL([BASH], [bash]);;
|
||||
esac
|
||||
AS_IF([test -z "$PYTHON"], [PYTHON="python"])
|
||||
AS_IF([echo "$PYTHON" | grep -q "^/"], [], [PYTHON=`type -p "$PYTHON"`])
|
||||
AS_IF([test -z "$PYTHON"], [AC_CHECK_PROGS([PYTHON], [python python3 python2], err)])
|
||||
AS_IF([test "$PYTHON" = "err"], [AC_MSG_ERROR([No python interpreter found])])
|
||||
AS_IF([echo "$PYTHON" | grep -q "^/"], [], [AC_PATH_PROG([PYTHON], [$PYTHON])])
|
||||
PYTHONPATH=$PYTHON
|
||||
PYTHON=`basename $PYTHONPATH`
|
||||
|
||||
|
||||