From 39f695f75656bed454b6d2c4b252de914ff0f09f Mon Sep 17 00:00:00 2001 From: Leonardo de Moura Date: Tue, 9 Oct 2012 07:06:48 -0700 Subject: [PATCH] Added --with-python configuration option, replaced *.py with *.pyc in install-python make command. Signed-off-by: Leonardo de Moura --- Makefile.in | 26 ++++++++++++++------------ configure.in | 22 +++++++++++++++++----- 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/Makefile.in b/Makefile.in index 1f2ea2e80..1db2dca76 100644 --- a/Makefile.in +++ b/Makefile.in @@ -22,6 +22,7 @@ LDFLAGS_EXTRA= PREFIX=@prefix@ HAS_PYTHON=@HAS_PYTHON@ PYTHON_PACKAGE_DIR=@PYTHON_PACKAGE_DIR@ +PYTHON=@PYTHON@ ######################### Z3=z3 @@ -470,21 +471,22 @@ uninstall: 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@ diff --git a/configure.in b/configure.in index 7f1ad4a48..8236334a4 100644 --- a/configure.in +++ b/configure.in @@ -11,6 +11,17 @@ AS_IF([test "$use_gmp" = "yes"],[ ]) 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) @@ -52,14 +63,14 @@ if version >= "3": 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" @@ -136,9 +147,10 @@ AC_OUTPUT(Makefile) cat <