2002-06-12 msw added AM_CHECK_PYTHON_HEADERS from pygtk rewrote python
authorMatt Wilson <msw@src.gnome.org>
Wed, 12 Jun 2002 21:44:04 +0000 (21:44 +0000)
committerMatt Wilson <msw@src.gnome.org>
Wed, 12 Jun 2002 21:44:04 +0000 (21:44 +0000)
2002-06-12 msw
* acinclude.m4: added AM_CHECK_PYTHON_HEADERS from pygtk
* configure.in: rewrote python checks to be more robust
* python/Makefile.am (CFLAGS): include @PYTHON_INCLUDES@

ChangeLog
acinclude.m4 [new file with mode: 0644]
configure.in
python/Makefile.am

index 805495d..4d62a13 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2002-06-12 msw
+       * acinclude.m4: added AM_CHECK_PYTHON_HEADERS from pygtk
+       * configure.in: rewrote python checks to be more robust
+       * python/Makefile.am (CFLAGS): include @PYTHON_INCLUDES@
 2002-06-12 msw
        * src/vte.c (vte_terminal_get_accessible): turn the logic around
        to be the right way
diff --git a/acinclude.m4 b/acinclude.m4
new file mode 100644 (file)
index 0000000..66d11b6
--- /dev/null
@@ -0,0 +1,24 @@
+dnl a macro to check for ability to create python extensions
+dnl  AM_CHECK_PYTHON_HEADERS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE])
+dnl function also defines PYTHON_INCLUDES
+AC_DEFUN([AM_CHECK_PYTHON_HEADERS],
+[AC_REQUIRE([AM_PATH_PYTHON])
+AC_MSG_CHECKING(for headers required to compile python extensions)
+dnl deduce PYTHON_INCLUDES
+py_prefix=`$PYTHON -c "import sys; print sys.prefix"`
+py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"`
+PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}"
+if test "$py_prefix" != "$py_exec_prefix"; then
+  PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}"
+fi
+AC_SUBST(PYTHON_INCLUDES)
+dnl check if the headers exist:
+save_CPPFLAGS="$CPPFLAGS"
+CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
+AC_TRY_CPP([#include <Python.h>],dnl
+[AC_MSG_RESULT(found)
+$1],dnl
+[AC_MSG_RESULT(not found)
+$2])
+CPPFLAGS="$save_CPPFLAGS"
+])
\ No newline at end of file
index 85294fc..0ab9619 100644 (file)
@@ -71,10 +71,22 @@ AC_MSG_CHECKING([for pygtk-2.0])
 if pkg-config --exists pygtk-2.0 ; then
        AC_MSG_RESULT([found])
        PKG_CHECK_MODULES(PYGTK,[pygtk-2.0])
-       AC_MSG_CHECKING([python version])
-       [PYTHONREV=`python -c 'import sys;print "%s.%s" % (sys.version_info[0], sys.version_info[1])'`]
-       AC_MSG_RESULT($PYTHONREV)
-       PYTHONMODULES="vtemodule.so"
+       AM_PATH_PYTHON
+       AC_MSG_CHECKING(for python >= 2.2)
+       prog="
+import sys, string
+minver = (2,2,0,'final',0)
+if sys.version_info < minver:
+  sys.exit(1)
+sys.exit(0)"
+       if $PYTHON -c "$prog" 1>&AC_FD_CC 2>&AC_FD_CC
+       then
+         AC_MSG_RESULT(okay)
+          AM_CHECK_PYTHON_HEADERS([PYTHONMODULES="vtemodule.so"],
+                                 [AC_MSG_RESULT(could not find Python headers)])
+       else
+         AC_MSG_RESULT(too old)
+       fi
 else
        AC_MSG_RESULT([not found])
 fi
index 6c514d7..811af5a 100644 (file)
@@ -1,9 +1,9 @@
 EXTRA_PROGRAMS = vtemodule.so
 EXTRA_DIST = vte.defs vte.override
-pythonsiteexecdir = $(libdir)/python@PYTHONREV@/site-packages
+pythonsiteexecdir = $(pyexecdir)
 pythonsiteexec_PROGRAMS = @PYTHONMODULES@
 
-CFLAGS = @CFLAGS@ @XFT_CFLAGS@ @GTK_CFLAGS@ @X_CFLAGS@
+CFLAGS = @CFLAGS@ @XFT_CFLAGS@ @GTK_CFLAGS@ @X_CFLAGS@ @PYTHON_INCLUDES@
 
 CLEANFILES = vte.c