[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen staging-4.13] build: fix tools/configure in case only python3 exists
commit ddccd9f87ef8accdff518dc2ebb64c05f55cd278 Author: Juergen Gross <jgross@xxxxxxxx> AuthorDate: Wed Dec 11 17:56:59 2019 +0100 Commit: Wei Liu <wl@xxxxxxx> CommitDate: Thu Dec 12 14:17:59 2019 +0000 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@xxxxxxxx> Acked-by: Wei Liu <wl@xxxxxxx> [ wei: run autogen.sh ] Reviewed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> (cherry picked from commit 5852ca48526316918cd82fba1033a6a5379fbc4c) --- tools/configure | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- tools/configure.ac | 5 ++-- 2 files changed, 89 insertions(+), 4 deletions(-) diff --git a/tools/configure b/tools/configure index e47bcef351..643d89d3d7 100755 --- a/tools/configure +++ b/tools/configure @@ -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` diff --git a/tools/configure.ac b/tools/configure.ac index a8d8ce5ffe..8d86c42de8 100644 --- a/tools/configure.ac +++ b/tools/configure.ac @@ -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` -- generated by git-patchbot for /home/xen/git/xen.git#staging-4.13 _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |