[llvm-commits] [PATCH] build: add --with-python option

Saleem Abdulrasool compnerd at compnerd.org
Sat Jan 26 22:12:17 PST 2013


  Add missing bit of change (Makefile.config.in).

Hi echristo,

http://llvm-reviews.chandlerc.com/D334

CHANGE SINCE LAST DIFF
  http://llvm-reviews.chandlerc.com/D334?vs=775&id=777#toc

Files:
  Makefile.config.in
  Makefile.rules
  autoconf/configure.ac
  projects/sample/Makefile.llvm.rules
  test/Makefile

Index: Makefile.config.in
===================================================================
--- Makefile.config.in
+++ Makefile.config.in
@@ -179,6 +179,7 @@
 RM         := @RM@
 SED        := @SED@
 TAR        := @TAR@
+PYTHON     := @PYTHON@
 
 # Paths to miscellaneous programs we hope are present but might not be
 BZIP2      := @BZIP2@
Index: Makefile.rules
===================================================================
--- Makefile.rules
+++ Makefile.rules
@@ -826,7 +826,7 @@
 #----------------------------------------------------------
 
 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
Index: autoconf/configure.ac
===================================================================
--- autoconf/configure.ac
+++ autoconf/configure.ac
@@ -1298,6 +1298,31 @@
 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]))
+if ! test -x "$with_python" ; then
+  if test -n "$with_python" ; then
+    AC_MSG_WARN([specified python ($with_python) is not usable, searching path])
+  fi
+  AC_PATH_PROG([PYTHON], [python python2 python3],
+               [AC_MSG_RESULT([no])
+                AC_MSG_ERROR([could not find python 2.5 or higher])])
+else
+  AC_MSG_CHECKING([for python])
+  AC_MSG_RESULT($with_python)
+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" -ge "2" \
+   && test "$ac_python_version_minor" -ge "5" ; then
+  AC_MSG_RESULT($PYTHON)
+else
+  AC_MSG_RESULT([no])
+  AC_MSG_FAILURE([found python $ac_python_version ($PYTHON); required >= 2.5])
+fi
 
 dnl===-----------------------------------------------------------------------===
 dnl===
Index: projects/sample/Makefile.llvm.rules
===================================================================
--- projects/sample/Makefile.llvm.rules
+++ projects/sample/Makefile.llvm.rules
@@ -745,7 +745,7 @@
 #----------------------------------------------------------
 
 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
Index: test/Makefile
===================================================================
--- test/Makefile
+++ test/Makefile
@@ -138,7 +138,7 @@
 	@$(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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D334.2.patch
Type: text/x-patch
Size: 3480 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130126/69bbbf05/attachment.bin>


More information about the llvm-commits mailing list