[rhythmbox] build: Rework logic of python support



commit b6d6d4895f18a5f99bae9b3d2a350d2dc1f2bee2
Author: Marvin Schmidt <marv exherbo org>
Date:   Sat Mar 12 10:24:42 2016 +0100

    build: Rework logic of python support
    
    Check for suitable Python interpreter only if Python support is actually
    enabled or we're autodetecting whether we can enable it. So far
    AM_PYTHON without second and third argument (action-if-found and
    action-if-not-found) would error out if no suitable Python version was
    found, even if Python support was explictly disabled

 configure.ac |   33 +++++++++++++++++++++------------
 1 files changed, 21 insertions(+), 12 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 90e03c1..df4cd19 100644
--- a/configure.ac
+++ b/configure.ac
@@ -573,27 +573,36 @@ AC_SUBST(SAMPLEPLUGINDIR)
 dnl ================================================================
 dnl Python plugins
 dnl ================================================================
-AM_PATH_PYTHON(3.2.3)
-
 
+AC_MSG_CHECKING([whether Python plugin support is requested])
 AC_ARG_ENABLE([python],
               AS_HELP_STRING([--enable-python[=@<:@no/auto/yes@:>@]],[Build with python support]),
               [enable_python=$enableval],
               [enable_python="auto"])
+AC_MSG_RESULT([$enable_python])
 
-if test "x$enable_python" = "xauto"; then
-       PKG_CHECK_EXISTS([pygobject-3.0 >= $PYGOBJECT_REQUIRED],
-                        [enable_python=yes],[enable_python=no])
-fi
+if test "x$enable_python" != "xno"; then
+       AM_PATH_PYTHON([3.2.3], [have_python=yes], [have_python=no])
+
+       if test "x$have_python" = "xno" -a "x$enable_python" = "xyes"; then
+               AC_MSG_ERROR([Python support explicitly requested, but no suitable Python interpreter could 
be found])
+       fi
 
-if test "x$enable_python" = "xyes"; then
-       PKG_CHECK_MODULES(PYTHON, [pygobject-3.0 >= $PYGOBJECT_REQUIRED])
+       PKG_CHECK_MODULES(PYTHON, [pygobject-3.0 >= $PYGOBJECT_REQUIRED],
+                       [have_pygobject=yes], [have_pygobject=no])
 
-       pyoverridesdir=`$PYTHON -c "import gi; print(gi._overridesdir)"`
-       AC_SUBST(pyoverridesdir)
+       if test "x$have_pygobject" = "xno" -a "x$enable_python" = "xyes"; then
+               AC_MSG_ERROR([Python support explicitly requested, but pygobject-3.0 could not be found])
+       fi
+
+       if test "x$have_python" = "xyes" -a "x$have_pygobject" = "xyes"; then
+               pyoverridesdir=`$PYTHON -c "import gi; print(gi._overridesdir)"`
+               AC_SUBST(pyoverridesdir)
+               build_python=yes
+       fi
 fi
 
-AM_CONDITIONAL(ENABLE_PYTHON, test x"$enable_python" = "xyes")
+AM_CONDITIONAL(ENABLE_PYTHON, test "x$build_python" = "xyes")
 
 dnl ================================================================
 dnl Vala plugins
@@ -868,7 +877,7 @@ elif test x"$enable_hal" = xyes; then
 else
        AC_MSG_NOTICE([   GUdev support disabled])
 fi
-if test x"$enable_python" = xyes; then
+if test x"$build_python" = xyes; then
        AC_MSG_NOTICE([** Python plugin support enabled])
 else
        AC_MSG_NOTICE([   Python plugin support disabled])


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