updating configure to use python-config for building python bindings
authorDejan Jovanović <dejan.jovanovic@gmail.com>
Fri, 3 Feb 2012 23:17:30 +0000 (23:17 +0000)
committerDejan Jovanović <dejan.jovanovic@gmail.com>
Fri, 3 Feb 2012 23:17:30 +0000 (23:17 +0000)
config/bindings.m4
configure.ac
src/bindings/Makefile.am

index 61b93a8cb11b2502be6997a9963c3e60326fdb60..29f9f5705ba6453530b5faee103ee86828c48ddc 100644 (file)
@@ -91,9 +91,23 @@ else
           ;;
         python)
           AC_MSG_RESULT([python support will be built])
-          AC_ARG_VAR(PYTHON_CPPFLAGS, [flags to pass to compiler when building Python bindings])
-          CPPFLAGS="$CPPFLAGS $PYTHON_CPPFLAGS"
-          AC_CHECK_HEADER([Python.h], [cvc4_build_python_bindings=yes], [binding_error=yes])
+          AM_PATH_PYTHON([2.5], [cvc4_build_python_bindings=yes], [binding_error=yes])
+          AC_ARG_VAR([PYTHON_INCLUDE], [Include flags for python, bypassing python-config])
+          AC_ARG_VAR([PYTHON_CONFIG], [Path to python-config])
+          AS_IF([test -z "$PYTHON_INCLUDE"], [
+            AS_IF([test -z "$PYTHON_CONFIG"], [
+              AC_PATH_PROGS([PYTHON_CONFIG],
+                [python$PYTHON_VERSION-config python-config],
+                [no]
+              )
+              AS_IF([test "$PYTHON_CONFIG" = no], [AC_MSG_ERROR([cannot find python-config for $PYTHON.])])
+             ])
+            AC_MSG_CHECKING([python include flags])
+            AC_SUBST(PYTHON_CXXFLAGS, `$PYTHON_CONFIG --includes`)
+            AC_MSG_RESULT([$PYTHON_CXXFLAGS])
+          ])
+          CPPFLAGS="$CPPFLAGS $PYTHON_CXXFLAGS"
+          AC_CHECK_HEADER([Python.h], [cvc4_build_python_bindings=yes], [binding_error=yes])     
           ;;
         ruby)
           AC_MSG_RESULT([ruby support will be built])
index 729544391ce655d1a166f080c13309b0b6b083cc..4a8d194335fc621f1036f582112612b230f17b74 100644 (file)
@@ -829,7 +829,7 @@ AC_LIB_ANTLR
 # build support.  The arg list is the default set if unspecified by
 # the user (the actual built set is the subset that appears to be
 # supported by the build host).
-CVC4_CHECK_BINDINGS([c java])dnl csharp perl php python ruby tcl ocaml])
+CVC4_CHECK_BINDINGS([c java])
 
 # Checks for header files.
 AC_CHECK_HEADERS([getopt.h unistd.h])
index b4e45c59281e0dea909a52982b2bbd48ad5c2c92..74a9934e7438c2fa1e98cc737c9405f58183a0ef 100644 (file)
@@ -95,6 +95,7 @@ phpdata_DATA += php/CVC4.php
 endif
 if CVC4_LANGUAGE_BINDING_PYTHON
 pythonlib_LTLIBRARIES += python/CVC4.la
+python_CVC4_la_CXXFLAGS = $(PYTHON_CXXFLAGS)
 python_CVC4_la_LDFLAGS = \
        -module \
        -version-info $(LIBCVC4BINDINGS_VERSION)