[farsight2/master] Use gst-python's autoconf test to check for python instead of calling python-config directly

Olivier Crête olivier.crete at collabora.co.uk
Tue Dec 23 15:21:44 PST 2008


---
 acinclude.m4       |   30 ++++++++++++++++++++++++++++++
 configure.ac       |    2 +-
 python/Makefile.am |    2 +-
 3 files changed, 32 insertions(+), 2 deletions(-)
 create mode 100644 acinclude.m4

diff --git a/acinclude.m4 b/acinclude.m4
new file mode 100644
index 0000000..585455f
--- /dev/null
+++ b/acinclude.m4
@@ -0,0 +1,30 @@
+dnl Copy pasted from gst-python's acinclude.m4 file
+
+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"`
+if $PYTHON-config --help 2>/dev/null; then
+  PYTHON_INCLUDES=`$PYTHON-config --includes 2>/dev/null`
+else
+  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
+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"
+])
diff --git a/configure.ac b/configure.ac
index d36b779..b6c2e09 100644
--- a/configure.ac
+++ b/configure.ac
@@ -183,7 +183,6 @@ AM_CONDITIONAL(HAVE_VALGRIND, test ! "x$VALGRIND_PATH" = "xno")
 
 dnl check for documentation tools
 GTK_DOC_CHECK([1.8])
-AS_PATH_PYTHON([2.1])
 dnl AG_GST_PLUGIN_DOCS([1.8],[2.1])
 
 dnl Make automake happy with per-target flags
@@ -349,6 +348,7 @@ AC_ARG_ENABLE([python],
 	WANT_PYTHON=yes)
 if test "x$WANT_PYTHON" = "xyes"; then
    AM_PATH_PYTHON
+   AM_CHECK_PYTHON_HEADERS(,[AC_MSG_ERROR(could not find Python headers)])
    PKG_CHECK_MODULES(PYFARSIGHT, [ 	pygobject-2.0 >= 2.12.0 
 					gst-python-0.10 >= 0.10.10
 					pygtk-2.0 >= 2.10 ] )
diff --git a/python/Makefile.am b/python/Makefile.am
index 71103f3..5c9f0bd 100644
--- a/python/Makefile.am
+++ b/python/Makefile.am
@@ -6,7 +6,7 @@ AM_CPPFLAGS =						\
 	-I$(top_srcdir)/gst-libs/gst/farsight/		\
 	-DDATADIR=\""$(datadir)"\"			\
 	$(PYFARSIGHT_CFLAGS)				\
-	`python-config --cflags`			\
+	$(PYTHON_INCLUDES)				\
 	$(FS2_INTERNAL_CFLAGS) 				\
 	$(FS2_CFLAGS) 					\
 	$(WARN_CFLAGS)
-- 
1.5.6.5




More information about the farsight-commits mailing list