[totem] Tidy up the Python checks in configure.in



commit 1608daf3fb025bebc4fc9adb479a5e04094e3d59
Author: Philip Withnall <philip tecnocode co uk>
Date:   Fri Dec 17 21:01:38 2010 +0000

    Tidy up the Python checks in configure.in
    
    This adds a dependency on pygobject-2.0 >= 2.27.0, as we depend on various bug
    fixes in it at runtime.

 configure.in |   60 ++++++++++++++++++++++-----------------------------------
 1 files changed, 23 insertions(+), 37 deletions(-)
---
diff --git a/configure.in b/configure.in
index 3760d6b..6b9a075 100644
--- a/configure.in
+++ b/configure.in
@@ -48,6 +48,8 @@ TOTEM_PLPARSER_REQS=2.29.1
 GNOMEICON_REQS=2.15.90
 DBUS_REQS=0.82
 PEAS_REQS=0.7.0
+PYTHON_REQS=2.3
+PYGOBJECT_REQS=2.27.0
 
 AC_SUBST(GLIB_REQS)
 AC_SUBST(GTK_REQS)
@@ -274,57 +276,41 @@ dnl ================================================================
 PKG_CHECK_MODULES(PEAS, libpeas-1.0 >= $PEAS_REQS)
 PKG_CHECK_MODULES(PEASGTK, libpeas-gtk-1.0 >= $PEAS_REQS)
 
-dnl ================================================================
-dnl Python plugins
-dnl ================================================================
+# ================================================================
+# Python plugins
+# ================================================================
+# We don't need any of this at compile time, but it is needed for the Python plugins at runtime, so we check anyway.
 
 AC_MSG_CHECKING([whether Python plugin support is requested])
 AC_ARG_ENABLE([python],
 	AS_HELP_STRING([--enable-python],[Enable python support]),
-	[enable_python=$enableval have_python=$enableval],
-	[enable_python=autodetect have_python=yes])
+	[enable_python=$enableval],
+	[enable_python=autodetect])
 AC_MSG_RESULT([$enable_python])
 
-if test "x$have_python" != "xyes"; then
-	if test "x$enable_python" = "xyes"; then
-		AC_MSG_ERROR([Python not found])
-	elif test "x$enable_python" = "xautodetect"; then
-		enable_python=no
-		AC_MSG_WARN([Python not found, disabling python support])
-	fi
-fi
+have_python=no
+have_pygobject=no
 
-if test "x$have_python" != "xno"; then
-	AM_PATH_PYTHON([2.3],[],[have_python=no])
+# Test for the Python run time and PyGObject
+if test "x$enable_python" != "xno"; then
+	AM_PATH_PYTHON([$PYTHON_REQS],[have_python=yes],[have_python=no])
 	if test "x$PYTHON" = "x:"; then
 		have_python=no
 	fi
-fi
 
-if test "x$have_python" != "xno"; then
-	PY_PREFIX=`$PYTHON -c 'import sys ; print sys.prefix'`
-	PY_EXEC_PREFIX=`$PYTHON -c 'import sys ; print sys.exec_prefix'`
-	PYTHON_LIBS="-lpython$PYTHON_VERSION"
-	if test -d $PY_EXEC_PREFIX/lib64/python$PYTHON_VERSION ; then
-		PYTHON_LIB_LOC="-L$PY_EXEC_PREFIX/lib64/python$PYTHON_VERSION/config"
-		PYTHON_MAKEFILE="$PY_EXEC_PREFIX/lib64/python$PYTHON_VERSION/config/Makefile"
-	else
-		PYTHON_LIB_LOC="-L$PY_EXEC_PREFIX/lib/python$PYTHON_VERSION/config"
-		PYTHON_MAKEFILE="$PY_EXEC_PREFIX/lib/python$PYTHON_VERSION/config/Makefile"
-	fi
-	PYTHON_CFLAGS="-I$PY_PREFIX/include/python$PYTHON_VERSION"
-	PYTHON_BASEMODLIBS=`sed -n -e 's/^BASEMODLIBS=\(.*\)/\1/p' $PYTHON_MAKEFILE`
-	PYTHON_OTHER_LIBS=`sed -n -e 's/^LIBS=\(.*\)/\1/p' $PYTHON_MAKEFILE`
-	PYTHON_EXTRA_LIBS="$PYTHON_BASEMODLIBS $PYTHON_OTHER_LIBS"
-	AC_SUBST([PYTHON_LIBS])
-	AC_SUBST([PYTHON_LIB_LOC])
-	AC_SUBST([PYTHON_CFLAGS])
-	AC_SUBST([PYTHON_EXTRA_LIBS])
+	PKG_CHECK_MODULES([PYGOBJECT],[pygobject-2.0 >= $PYGOBJECT_REQS],[have_pygobject=yes],[have_pygobject=no])
 fi
 
-if test "x$have_python" != "xno" -a "x$enable_python" != "xno"; then
+# Output the results of the Python checks
+if test "x$have_python" != "xyes" -o "x$have_pygobject" != "xyes"; then
+	if test "x$enable_python" = "xyes"; then
+		AC_MSG_ERROR([python >= $PYTHON_REQS or pygobject-2.0 >= $PYGOBJECT_REQS not found])
+	elif test "x$enable_python" = "xautodetect"; then
+		enable_python=no
+		AC_MSG_WARN([python >= $PYTHON_REQS or pygobject-2.0 >= $PYGOBJECT_REQS not found; disabling Python support])
+	fi
+elif test "x$enable_python" != "xno"; then
 	enable_python=yes
-	AC_DEFINE([ENABLE_PYTHON],[1],[Define to compile with python plugin support])
 fi
 
 AM_CONDITIONAL([ENABLE_PYTHON],[test "x$enable_python" = "xyes"])



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]