Commits

Leonardo de Moura committed 39f695f

Added --with-python configuration option, replaced *.py with *.pyc in install-python make command.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>

  • Participants
  • Parent commits bd17292

Comments (0)

Files changed (2)

 PREFIX=@prefix@
 HAS_PYTHON=@HAS_PYTHON@
 PYTHON_PACKAGE_DIR=@PYTHON_PACKAGE_DIR@
+PYTHON=@PYTHON@
 #########################
 
 Z3=z3
 install-python: $(BIN_DIR)/lib$(Z3).@SO_EXT@
 	@if test $(HAS_PYTHON) -eq 0; then echo "Python is not available in your system."; exit 1; fi
 	@echo "Installing Python bindings at $(PYTHON_PACKAGE_DIR)."
-	@cp python/z3.py $(PYTHON_PACKAGE_DIR)
-	@cp python/z3core.py $(PYTHON_PACKAGE_DIR)
-	@cp python/z3types.py $(PYTHON_PACKAGE_DIR)
-	@cp python/z3consts.py $(PYTHON_PACKAGE_DIR)
-	@cp python/z3tactics.py $(PYTHON_PACKAGE_DIR)
-	@cp python/z3printer.py $(PYTHON_PACKAGE_DIR)
+	@$(PYTHON) python/example.py > /dev/null
+	@cp python/z3.pyc $(PYTHON_PACKAGE_DIR)
+	@cp python/z3core.pyc $(PYTHON_PACKAGE_DIR)
+	@cp python/z3types.pyc $(PYTHON_PACKAGE_DIR)
+	@cp python/z3consts.pyc $(PYTHON_PACKAGE_DIR)
+	@cp python/z3tactics.pyc $(PYTHON_PACKAGE_DIR)
+	@cp python/z3printer.pyc $(PYTHON_PACKAGE_DIR)
 	@cp $(BIN_DIR)/lib$(Z3).@SO_EXT@ $(PYTHON_PACKAGE_DIR)
 
 uninstall-python: 
 	@if test $(HAS_PYTHON) -eq 0; then echo "Python is not available in your system."; exit 1; fi
 	@echo "Uninstalling Python bindings from $(PYTHON_PACKAGE_DIR)."
-	@rm -f $(PYTHON_PACKAGE_DIR)/z3.py
-	@rm -f $(PYTHON_PACKAGE_DIR)/z3core.py
-	@rm -f $(PYTHON_PACKAGE_DIR)/z3types.py
-	@rm -f $(PYTHON_PACKAGE_DIR)/z3consts.py
-	@rm -f $(PYTHON_PACKAGE_DIR)/z3tactics.py
-	@rm -f $(PYTHON_PACKAGE_DIR)/z3printer.py
+	@rm -f $(PYTHON_PACKAGE_DIR)/z3.pyc
+	@rm -f $(PYTHON_PACKAGE_DIR)/z3core.pyc
+	@rm -f $(PYTHON_PACKAGE_DIR)/z3types.pyc
+	@rm -f $(PYTHON_PACKAGE_DIR)/z3consts.pyc
+	@rm -f $(PYTHON_PACKAGE_DIR)/z3tactics.pyc
+	@rm -f $(PYTHON_PACKAGE_DIR)/z3printer.pyc
 	@rm -f $(PYTHON_PACKAGE_DIR)/$(BIN_DIR)/lib$(Z3).@SO_EXT@

File configure.in

 ])
 AC_SUBST(EXTRA_LIB_SRCS)
 
+AC_ARG_WITH(python,
+[AS_HELP_STRING([--with-python=PYTHON_PATH],
+		[specify the location of the python 2.x executable.])])
+
+PYTHON="python"
+if test "x$with_python" != x; then
+  PYTHON="$with_python"
+fi
+
+AC_SUBST(PYTHON)
+
 AC_PATH_PROG([D2U], [dos2unix], [no], [~/bin$PATH_SEPARATOR$PATH])
 AS_IF([test "$D2U" = "no"], [AC_MSG_ERROR(dos2unix not found)])
 AC_SUBST(D2U)
 exit(0)
 EOF
 
-if python tst_python.py; then
+if $PYTHON tst_python.py; then
   HAS_PYTHON="1"
   HAS_PYTHON_MSG="yes"
 cat > get_py_dir.py << EOF
 import distutils.sysconfig
 print distutils.sysconfig.get_python_lib()
 EOF
-  if python get_py_dir.py > dir.txt; then
+  if $PYTHON get_py_dir.py > dir.txt; then
     PYTHON_PACKAGE_DIR=`cat dir.txt`
   else
     HAS_PYTHON="0"
 cat <<EOF
 
 Z3 was configured with success.
-Host platform: $PLATFORM
-Arithmetic:    $ARITH
-Python:        $HAS_PYTHON_MSG
+Host platform:  $PLATFORM
+Arithmetic:     $ARITH
+Python Support: $HAS_PYTHON_MSG
+Pyyhon:         $PYTHON 
 
 Type 'make' to compile Z3.
 Type 'sudo make install' to install Z3.