diff options
author | Saleem Abdulrasool <compnerd@compnerd.org> | 2013-01-30 04:07:37 +0000 |
---|---|---|
committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2013-01-30 04:07:37 +0000 |
commit | 26127bd746144842e245e7ecaa734a0219c34dbc (patch) | |
tree | cff007e79e0b948bad4ac1d877cfb92434b560b6 /llvm/autoconf | |
parent | afed1ddb406afe00cb05360c5b8a01e42db3250d (diff) | |
download | bcm5719-llvm-26127bd746144842e245e7ecaa734a0219c34dbc.tar.gz bcm5719-llvm-26127bd746144842e245e7ecaa734a0219c34dbc.zip |
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 <compnerd@compnerd.org>
Reviewed-by: Eric Christopher <echristo@gmail.com>, Daniel Dunbar <daniel@zuster.org>
llvm-svn: 173890
Diffstat (limited to 'llvm/autoconf')
-rw-r--r-- | llvm/autoconf/configure.ac | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/llvm/autoconf/configure.ac b/llvm/autoconf/configure.ac index 9c18e61801d..7d0f9f1aa1f 100644 --- a/llvm/autoconf/configure.ac +++ b/llvm/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=== |