[llvm] r173890 - build: add --with-python option
Saleem Abdulrasool
compnerd at compnerd.org
Tue Jan 29 20:07:38 PST 2013
Author: compnerd
Date: Tue Jan 29 22:07:37 2013
New Revision: 173890
URL: http://llvm.org/viewvc/llvm-project?rev=173890&view=rev
Log:
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 at compnerd.org>
Reviewed-by: Eric Christopher <echristo at gmail.com>, Daniel Dunbar <daniel at zuster.org>
Modified:
llvm/trunk/Makefile.config.in
llvm/trunk/Makefile.rules
llvm/trunk/autoconf/configure.ac
llvm/trunk/projects/sample/Makefile.llvm.rules
llvm/trunk/test/Makefile
Modified: llvm/trunk/Makefile.config.in
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Makefile.config.in?rev=173890&r1=173889&r2=173890&view=diff
==============================================================================
--- llvm/trunk/Makefile.config.in (original)
+++ llvm/trunk/Makefile.config.in Tue Jan 29 22:07:37 2013
@@ -179,6 +179,7 @@ RANLIB := @RANLIB@
RM := @RM@
SED := @SED@
TAR := @TAR@
+PYTHON := @PYTHON@
# Paths to miscellaneous programs we hope are present but might not be
BZIP2 := @BZIP2@
Modified: llvm/trunk/Makefile.rules
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Makefile.rules?rev=173890&r1=173889&r2=173890&view=diff
==============================================================================
--- llvm/trunk/Makefile.rules (original)
+++ llvm/trunk/Makefile.rules Tue Jan 29 22:07:37 2013
@@ -97,7 +97,7 @@ endif
$(LLVMBuildMakeFrag): $(PROJ_SRC_ROOT)/Makefile.rules \
$(PROJ_OBJ_ROOT)/Makefile.config
$(Echo) Constructing LLVMBuild project information.
- $(Verb) $(LLVMBuildTool) \
+ $(Verb)$(PYTHON) $(LLVMBuildTool) \
--native-target "$(TARGET_NATIVE_ARCH)" \
--enable-targets "$(TARGETS_TO_BUILD)" \
--enable-optional-components "$(OPTIONAL_COMPONENTS)" \
@@ -826,7 +826,7 @@ ObjectsBC := $(BaseNameSources:%=$(ObjDi
#----------------------------------------------------------
ifeq (-mingw32,$(findstring -mingw32,$(BUILD_TRIPLE)))
- ECHOPATH := $(Verb)python -u -c "import sys;print ' '.join(sys.argv[1:])"
+ ECHOPATH := $(Verb)$(PYTHON) -u -c "import sys;print ' '.join(sys.argv[1:])"
else
ECHOPATH := $(Verb)$(ECHO)
endif
Modified: llvm/trunk/autoconf/configure.ac
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/configure.ac?rev=173890&r1=173889&r2=173890&view=diff
==============================================================================
--- llvm/trunk/autoconf/configure.ac (original)
+++ llvm/trunk/autoconf/configure.ac Tue Jan 29 22:07:37 2013
@@ -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===
Modified: llvm/trunk/projects/sample/Makefile.llvm.rules
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/projects/sample/Makefile.llvm.rules?rev=173890&r1=173889&r2=173890&view=diff
==============================================================================
--- llvm/trunk/projects/sample/Makefile.llvm.rules (original)
+++ llvm/trunk/projects/sample/Makefile.llvm.rules Tue Jan 29 22:07:37 2013
@@ -745,7 +745,7 @@ ObjectsBC := $(BaseNameSources:%=$(ObjDi
#----------------------------------------------------------
ifeq (-mingw32,$(findstring -mingw32,$(BUILD_TRIPLE)))
- ECHOPATH := $(Verb)python -u -c "import sys;print ' '.join(sys.argv[1:])"
+ ECHOPATH := $(Verb)$(PYTHON) -u -c "import sys;print ' '.join(sys.argv[1:])"
else
ECHOPATH := $(Verb)$(ECHO)
endif
Modified: llvm/trunk/test/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Makefile?rev=173890&r1=173889&r2=173890&view=diff
==============================================================================
--- llvm/trunk/test/Makefile (original)
+++ llvm/trunk/test/Makefile Tue Jan 29 22:07:37 2013
@@ -87,14 +87,14 @@ endif # SunOS
check-local:: lit.site.cfg Unit/lit.site.cfg
( $(ULIMIT) \
- $(LLVM_SRC_ROOT)/utils/lit/lit.py $(LIT_ARGS) $(LIT_TESTSUITE) )
+ $(PYTHON) $(LLVM_SRC_ROOT)/utils/lit/lit.py $(LIT_ARGS) $(LIT_TESTSUITE) )
# This is a legacy alias dating from when both DejaGNU and lit were in use.
check-local-lit:: check-local
check-local-all:: lit.site.cfg Unit/lit.site.cfg extra-site-cfgs
( $(ULIMIT) \
- $(LLVM_SRC_ROOT)/utils/lit/lit.py $(LIT_ARGS) $(LIT_ALL_TESTSUITES) )
+ $(PYTHON) $(LLVM_SRC_ROOT)/utils/lit/lit.py $(LIT_ARGS) $(LIT_ALL_TESTSUITES) )
clean::
$(RM) -rf `find $(LLVM_OBJ_ROOT)/test -name Output -type d -print`
@@ -138,7 +138,7 @@ lit.site.cfg: FORCE
@$(ECHOPATH) s=@LLVM_TOOLS_DIR@=$(ToolDir)=g >> lit.tmp
@$(ECHOPATH) s=@SHLIBDIR@=$(SharedLibDir)=g >> lit.tmp
@$(ECHOPATH) s=@SHLIBEXT@=$(SHLIBEXT)=g >> lit.tmp
- @$(ECHOPATH) s=@PYTHON_EXECUTABLE@=python=g >> lit.tmp
+ @$(ECHOPATH) s=@PYTHON_EXECUTABLE@=$(PYTHON)=g >> lit.tmp
@$(ECHOPATH) s=@OCAMLOPT@=$(OCAMLOPT) -cc $(subst *,'\\\"',*$(subst =,"\\=",$(CXX_FOR_OCAMLOPT))*) -I $(LibDir)/ocaml=g >> lit.tmp
@$(ECHOPATH) s=@ENABLE_SHARED@=$(ENABLE_SHARED)=g >> lit.tmp
@$(ECHOPATH) s=@ENABLE_ASSERTIONS@=$(ENABLE_ASSERTIONS)=g >> lit.tmp
More information about the llvm-commits
mailing list