[Spice-commits] 3 commits - configure.ac

Christophe Fergau teuf at kemper.freedesktop.org
Tue Nov 19 06:25:53 PST 2013


 configure.ac |   52 +++++++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 43 insertions(+), 9 deletions(-)

New commits:
commit ab6cb2c29d6134309b35a2d7ca7b3f056293e4e0
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Fri Nov 15 17:21:42 2013 +0100

    build-sys: Add real autodetection of python
    
    configure help text says that by default python will be used automatically
    if appropriate, however this only means that on !windows and !gtk3, we will
    force build of the python bindings, and fail if any needed package to build
    them is missing.
    
    This commit improves on the current checks so that when autodetecting
    python, if a package is missing then build of the bindings is silently
    disabled rather than failing.

diff --git a/configure.ac b/configure.ac
index 8e59400..8efa998 100644
--- a/configure.ac
+++ b/configure.ac
@@ -576,20 +576,42 @@ AC_SUBST(VAPIDIR)
 AC_ARG_WITH([python],
   AS_HELP_STRING([--with-python], [build python bindings @<:@default=auto@:>@]),
   [case "$withval" in
-   yes|no) with_python="$withval";;
+   yes|no|auto) with_python="$withval";;
    *) AC_MSG_ERROR([bad value $withval for python option]) ;;
    esac],
   [AS_IF([test "$with_gtk" = "3.0" || test "x$os_win32" = "xyes"],
-         [with_python=no],[with_python=yes])]
+         [with_python=no],[with_python=auto])]
 )
 
-if test "x$with_python" = "xyes"; then
-  PKG_CHECK_MODULES(PYGTK, pygtk-2.0 >= 2.0.0)
+if test "x$with_python" != "xno"; then
+  PKG_CHECK_MODULES(PYGTK, [pygtk-2.0 >= 2.0.0], [have_pygtk=yes], [have_pygtk=no])
   AC_SUBST(PYGTK_CFLAGS)
   AC_SUBST(PYGTK_LIBS)
+  if test "x$have_pygtk" != "xyes"
+  then
+    if test "x$with_python" = "xyes"
+    then
+      AC_MSG_ERROR("No pygtk found")
+    else
+      with_python=no
+    fi
+  fi
+fi
 
-  AM_PATH_PYTHON
+if test "x$with_python" != "xno"; then
+  AM_PATH_PYTHON([], [have_python=yes], [have_python=no])
+  if test "x$have_python" != "xyes"
+  then
+    if test "x$with_python" = "xyes"
+    then
+      AC_MSG_ERROR("No python found")
+    else
+      with_python=no
+    fi
+  fi
+fi
 
+if test "x$with_python" != "xno"; then
   AC_MSG_CHECKING([whether $PYTHON version >= 2.0])
   HAVE_PYTHON_REQUIRED=no
   AM_PYTHON_CHECK_VERSION([$PYTHON], [2.0],
@@ -600,18 +622,30 @@ if test "x$with_python" = "xyes"; then
 
   if test "x$HAVE_PYTHON_REQUIRED" != "xyes"
   then
-    AC_MSG_ERROR("No suitable python found")
+    if test "x$with_python" = "xyes"
+    then
+      AC_MSG_ERROR("No suitable python found")
+    else
+      with_python=no
+    fi
   fi
+fi
 
+if test "x$with_python" != "xno"; then
   AM_CHECK_PYTHON_HEADERS(have_python_headers=yes,have_python_headers=no)
 
   if test "x$have_python_headers" != "xyes"
   then
-    AC_MSG_ERROR("No python development headers found")
+    if test "x$with_python" = "xyes"
+    then
+      AC_MSG_ERROR("No python development headers found")
+    else
+      with_python=no
+    fi
   fi
 fi
 
-AM_CONDITIONAL(WITH_PYTHON, [test "x$with_python" = "xyes"])
+AM_CONDITIONAL(WITH_PYTHON, [test "x$with_python" != "xno"])
 
 
 AC_ARG_ENABLE([dbus],
commit 93df06ddccf9d2be8de2efb2c06815b088762bca
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Fri Nov 15 17:17:37 2013 +0100

    build-sys: Re-enable building of python bindings by default
    
    Commit daa4ece tried to disable building of python bindings on Windows by
    default, but in doing so, it also disabled building of python bindings by
    default when we are building neither for Windows nor for gtk3.

diff --git a/configure.ac b/configure.ac
index 26c1eb9..8e59400 100644
--- a/configure.ac
+++ b/configure.ac
@@ -580,7 +580,7 @@ AC_ARG_WITH([python],
    *) AC_MSG_ERROR([bad value $withval for python option]) ;;
    esac],
   [AS_IF([test "$with_gtk" = "3.0" || test "x$os_win32" = "xyes"],
-         [with_python=no])]
+         [with_python=no],[with_python=yes])]
 )
 
 if test "x$with_python" = "xyes"; then
commit 774000911a9759e958bd6d1e6d4186dfb5351fff
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Fri Nov 15 16:45:09 2013 +0100

    build-sys: Fix invalid 'test' syntax in configure.ac
    
    test ... -o test ... is not a valid shell construct, change it to
    test ... || test ... as this is more portable than test ... -o ...
    
    This was causing a warning when running configure.

diff --git a/configure.ac b/configure.ac
index c42066f..26c1eb9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -579,7 +579,7 @@ AC_ARG_WITH([python],
    yes|no) with_python="$withval";;
    *) AC_MSG_ERROR([bad value $withval for python option]) ;;
    esac],
-  [AS_IF([test "$with_gtk" = "3.0" -o test "x$os_win32=xyes"],
+  [AS_IF([test "$with_gtk" = "3.0" || test "x$os_win32" = "xyes"],
          [with_python=no])]
 )
 


More information about the Spice-commits mailing list