[Libguestfs] [PATCH] build: improve Gtk check

Richard W.M. Jones rjones at redhat.com
Thu Jul 28 10:09:57 UTC 2016


On Thu, Jul 28, 2016 at 11:03:23AM +0200, Pino Toscano wrote:
> Check the presence of Gtk properly depending on the value of --with-gtk:
> if a specific version is chosen, then let PKG_CHECK_MODULES fail if that
> version if not found, otherwise fallback from gtk3 to gtk2 to no gtk.
> 
> Also move few common AC_SUBST in a single place.
> ---
>  m4/guestfs_misc_libraries.m4 | 26 ++++++++++++++------------
>  1 file changed, 14 insertions(+), 12 deletions(-)
> 
> diff --git a/m4/guestfs_misc_libraries.m4 b/m4/guestfs_misc_libraries.m4
> index 4ae0576..fee265b 100644
> --- a/m4/guestfs_misc_libraries.m4
> +++ b/m4/guestfs_misc_libraries.m4
> @@ -85,29 +85,31 @@ AC_ARG_WITH([gtk],
>       AC_MSG_RESULT([not set, will check for installed Gtk])]
>  )
>  
> -if test "x$GTK_LIBS" = "x" && \
> -        ( test "x$with_gtk" = "x3" || test "x$with_gtk" = "xcheck" ) ; then
> +if test "x$with_gtk" = "x3"; then
>      PKG_CHECK_MODULES([GTK], [gtk+-3.0], [
> -        AC_SUBST([GTK_CFLAGS])
> -        AC_SUBST([GTK_LIBS])
>          GTK_VERSION=3
> -        AC_SUBST([GTK_VERSION])
> -    ], [])
> -fi
> -if test "x$GTK_LIBS" = "x" && \
> -        ( test "x$with_gtk" = "x2" || test "x$with_gtk" = "xcheck" ) ; then
> +    ])
> +elif test "x$with_gtk" = "x2"; then
>      PKG_CHECK_MODULES([GTK], [gtk+-2.0], [
> -        AC_SUBST([GTK_CFLAGS])
> -        AC_SUBST([GTK_LIBS])
>          GTK_VERSION=2
> -        AC_SUBST([GTK_VERSION])
>      ], [])
> +elif test "x$with_gtk" = "xcheck"; then
> +    PKG_CHECK_MODULES([GTK], [gtk+-3.0], [
> +        GTK_VERSION=3
> +    ], [
> +        PKG_CHECK_MODULES([GTK], [gtk+-2.0], [
> +            GTK_VERSION=2
> +        ], [:])
> +    ])
>  fi
>  
>  dnl Can we build virt-p2v?
>  AC_MSG_CHECKING([if we can build virt-p2v])
>  if test "x$GTK_LIBS" != "x"; then
>      AC_MSG_RESULT([yes, with Gtk $GTK_VERSION])
> +    AC_SUBST([GTK_CFLAGS])
> +    AC_SUBST([GTK_LIBS])
> +    AC_SUBST([GTK_VERSION])
>  else
>      AC_MSG_RESULT([no])
>  fi
> -- 
> 2.7.4

Looks good, ACK.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v




More information about the Libguestfs mailing list