From 3ef8b0adb4c64b5a8611472850b4991afaf289f1 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Wed, 30 Jan 2013 04:07:37 +0000 Subject: build: add --with-python option This adds a new --with-python option to allow configuration of the python binary for building. If not specified, $PATH will be searched for common python binary names (python, python2, python3). If specified, and the path is not executable, it will attempt to search $PATH. Signed-off-by: Saleem Abdulrasool Reviewed-by: Eric Christopher , Daniel Dunbar git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173890 91177308-0d34-0410-b5e6-96231b3b80d8 --- autoconf/configure.ac | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'autoconf') diff --git a/autoconf/configure.ac b/autoconf/configure.ac index 9c18e61..7d0f9f1 100644 --- a/autoconf/configure.ac +++ b/autoconf/configure.ac @@ -1298,6 +1298,35 @@ else fi AC_MSG_RESULT([$NO_VARIADIC_MACROS $NO_MISSING_FIELD_INITIALIZERS $COVERED_SWITCH_DEFAULT $NO_UNINITIALIZED $NO_MAYBE_UNINITIALIZED]) +AC_ARG_WITH([python], + [AS_HELP_STRING([--with-python], [path to python])], + [PYTHON="$withval"]) + +if test -n "$PYTHON" && test -x "$PYTHON" ; then + AC_MSG_CHECKING([for python]) + AC_MSG_RESULT([user defined: $with_python]) +else + if test -n "$PYTHON" ; then + AC_MSG_WARN([specified python ($PYTHON) is not usable, searching path]) + fi + + AC_PATH_PROG([PYTHON], [python python2 python26], + [AC_MSG_RESULT([not found]) + AC_MSG_ERROR([could not find python 2.5 or higher])]) +fi + +AC_MSG_CHECKING([for python >= 2.5]) +ac_python_version=`$PYTHON -c 'import sys; print sys.version.split()[[0]]'` +ac_python_version_major=`echo $ac_python_version | cut -d'.' -f1` +ac_python_version_minor=`echo $ac_python_version | cut -d'.' -f2` +ac_python_version_patch=`echo $ac_python_version | cut -d'.' -f3` +if test "$ac_python_version_major" -eq "2" \ + && test "$ac_python_version_minor" -ge "5" ; then + AC_MSG_RESULT([$PYTHON ($ac_python_version)]) +else + AC_MSG_RESULT([not found]) + AC_MSG_FAILURE([found python $ac_python_version ($PYTHON); required >= 2.5]) +fi dnl===-----------------------------------------------------------------------=== dnl=== -- cgit v1.1