[Spice-devel] [spice-gtk 3/3] build-sys: Add real autodetection of python

Marc-André Lureau marcandre.lureau at gmail.com
Fri Nov 15 09:35:17 PST 2013


On Fri, Nov 15, 2013 at 6:20 PM, Christophe Fergeau <cfergeau at redhat.com> wrote:
> 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.

ok, I wonder if it's necessary to have all this "auto" logic for
something that is supposed to go away (who needs it nowadays? it was
done for virt-manager, but afaik they switched to gtk3/g-i bindings).
But since you did it, ack.

> ---
>  configure.ac | 50 ++++++++++++++++++++++++++++++++++++++++++--------
>  1 file changed, 42 insertions(+), 8 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 7db6c0d..7d95155 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -571,20 +571,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],
> @@ -595,18 +617,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],
> --
> 1.8.4.2
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel



-- 
Marc-André Lureau


More information about the Spice-devel mailing list