[virt-tools-list] [PATCH virt-viewer 2/2] configure: Use default error message when package is missing

Pavel Grunt pgrunt at redhat.com
Mon Jun 29 11:18:20 UTC 2015


To make clear why configure failed - e.g.:
 Package requirements (spice-client-gtk-2.0 >= 0.28) were not met
 Requested 'spice-client-gtk-2.0 >= 0.28' but version of spice-client-gtk-2.0 is 0.25
instead of
 spice-gtk requested but not found

Related:
https://bugzilla.redhat.com/show_bug.cgi?id=1214577
---
 configure.ac | 87 +++++++++++++++++++++++++-----------------------------------
 1 file changed, 36 insertions(+), 51 deletions(-)

diff --git a/configure.ac b/configure.ac
index df0053d..d37863b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -103,19 +103,15 @@ PKG_CHECK_MODULES(LIBXML2, libxml-2.0 >= $LIBXML2_REQUIRED)
 AC_ARG_WITH([libvirt],
     AS_HELP_STRING([--without-libvirt], [Ignore presence of libvirt and disable it]))
 
-AS_IF([test "x$with_libvirt" != "xno"],
-      [PKG_CHECK_MODULES(LIBVIRT,
-                         [libvirt >= $LIBVIRT_REQUIRED],
-                         [have_libvirt=yes], [have_libvirt=no])],
-      [have_libvirt=no])
-
-AS_IF([test "x$have_libvirt" = "xyes"],
-      [AC_DEFINE([HAVE_LIBVIRT], 1, [Have libvirt?])],
-      [AS_IF([test "x$with_libvirt" = "xyes"],
-             [AC_MSG_ERROR([libvirt requested but not found])
-      ])
-])
-AM_CONDITIONAL([HAVE_LIBVIRT], [test "x$have_libvirt" = "xyes"])
+AS_IF([test "x$with_libvirt" != "xno" && test "x$with_libvirt" != "xyes"],
+      [PKG_CHECK_EXISTS([libvirt >= $LIBVIRT_REQUIRED],
+                        [with_libvirt=yes], [with_libvirt=no])])
+
+AS_IF([test "x$with_libvirt" = "xyes"],
+      [PKG_CHECK_MODULES(LIBVIRT, [libvirt >= $LIBVIRT_REQUIRED])]
+      [AC_DEFINE([HAVE_LIBVIRT], 1, [Have libvirt?])]
+)
+AM_CONDITIONAL([HAVE_LIBVIRT], [test "x$with_libvirt" = "xyes"])
 
 old_LIBS=$LIBS
 LIBS=$LIBVIRT_LIBS
@@ -161,49 +157,41 @@ PKG_CHECK_MODULES(GTK, gtk+-$GTK_API_VERSION >= $GTK_REQUIRED)
 AC_ARG_WITH([gtk-vnc],
     AS_HELP_STRING([--without-gtk-vnc], [Ignore presence of gtk-vnc and disable it]))
 
-AS_IF([test "x$with_gtk_vnc" != "xno"],
-      [PKG_CHECK_MODULES(GTK_VNC,
-                         gtk-vnc-$GTK_VNC_API_VERSION >= $GTK_VNC_REQUIRED,
-                         [have_gtk_vnc=yes], [have_gtk_vnc=no])],
-      [have_gtk_vnc=no])
-
-AS_IF([test "x$have_gtk_vnc" = "xyes"],
-      [AC_DEFINE([HAVE_GTK_VNC], 1, [Have gtk-vnc?])],
-      [AS_IF([test "x$with_gtk_vnc" = "xyes"],
-             [AC_MSG_ERROR([gtk-vnc requested but not found])
-      ])
-])
-AM_CONDITIONAL([HAVE_GTK_VNC], [test "x$have_gtk_vnc" = "xyes"])
+AS_IF([test "x$with_gtk_vnc" != "xno" && test "x$with_gtk_vnc" != "xyes"],
+      [PKG_CHECK_EXISTS([gtk-vnc-$GTK_VNC_API_VERSION >= $GTK_VNC_REQUIRED],
+                        [with_gtk_vnc=yes], [with_gtk_vnc=no])])
+
+AS_IF([test "x$with_gtk_vnc" = "xyes"],
+      [PKG_CHECK_MODULES(GTK_VNC, [gtk-vnc-$GTK_VNC_API_VERSION >= $GTK_VNC_REQUIRED])]
+      [AC_DEFINE([HAVE_GTK_VNC], 1, [Have gtk-vnc?])]
+)
+AM_CONDITIONAL([HAVE_GTK_VNC], [test "x$with_gtk_vnc" = "xyes"])
 
 AC_ARG_WITH([spice-gtk],
     AS_HELP_STRING([--without-spice-gtk], [Ignore presence of spice-gtk and disable it]))
 
-AS_IF([test "x$with_spice_gtk" != "xno"],
-      [PKG_CHECK_MODULES(SPICE_GTK,
-                         [spice-client-gtk-$SPICE_GTK_API_VERSION >= $SPICE_GTK_REQUIRED
-                          spice-controller spice-protocol >= $SPICE_PROTOCOL_REQUIRED],
-                         [have_spice_gtk=yes], [have_spice_gtk=no])],
-      [have_spice_gtk=no])
+AS_IF([test "x$with_spice_gtk" != "xno" && test "x$with_spice_gtk" != "xyes"],
+      [PKG_CHECK_EXISTS([spice-client-gtk-$SPICE_GTK_API_VERSION >= $SPICE_GTK_REQUIRED
+                         spice-controller spice-protocol >= $SPICE_PROTOCOL_REQUIRED],
+                        [with_spice_gtk=yes], [with_spice_gtk=no])])
 
-AS_IF([test "x$have_spice_gtk" = "xyes"],
+AS_IF([test "x$with_spice_gtk" = "xyes"],
+      [PKG_CHECK_MODULES(SPICE_GTK, [spice-client-gtk-$SPICE_GTK_API_VERSION >= $SPICE_GTK_REQUIRED])]
       [PKG_CHECK_MODULES(SPICE_CONTROLLER, [spice-controller])]
       [PKG_CHECK_MODULES(SPICE_PROTOCOL, [spice-protocol >= $SPICE_PROTOCOL_REQUIRED])]
-      [AC_DEFINE([HAVE_SPICE_GTK], 1, [Have spice-gtk?])],
-      [AS_IF([test "x$with_spice_gtk" = "xyes"],
-             [AC_MSG_ERROR([spice-gtk requested but not found])
-      ])
-])
-AM_CONDITIONAL([HAVE_SPICE_GTK], [test "x$have_spice_gtk" = "xyes"])
+      [AC_DEFINE([HAVE_SPICE_GTK], 1, [Have spice-gtk?])]
+)
+AM_CONDITIONAL([HAVE_SPICE_GTK], [test "x$with_spice_gtk" = "xyes"])
 
 AC_ARG_WITH([ovirt],
     AS_HELP_STRING([--without-ovirt], [Ignore presence of librest and disable oVirt support]))
 
-AS_IF([test "x$with_ovirt" != "xno"],
-      [PKG_CHECK_MODULES([OVIRT], [govirt-1.0 >= $GOVIRT_REQUIRED],
-                         [have_ovirt=yes], [have_ovirt=no])],
-      [have_ovirt=no])
+AS_IF([test "x$with_ovirt" != "xno" && test "x$with_ovirt" != "xyes"],
+      [PKG_CHECK_EXISTS([govirt-1.0 >= $GOVIRT_REQUIRED],
+                        [with_ovirt=yes], [with_ovirt=no])])
 
-AS_IF([test "x$have_ovirt" = "xyes"],
+AS_IF([test "x$with_ovirt" = "xyes"],
+      [PKG_CHECK_MODULES([OVIRT], [govirt-1.0 >= $GOVIRT_REQUIRED])]
       [AC_DEFINE([HAVE_OVIRT], 1, [Have libgovirt?])]
       [SAVED_CFLAGS="$CFLAGS"
        SAVED_LIBS="$LIBS"
@@ -215,19 +203,16 @@ AS_IF([test "x$have_ovirt" = "xyes"],
         [AC_DEFINE([HAVE_OVIRT_CANCEL], 1, [Have rest_proxy_auth_cancel and OVIRT_REST_CALL_ERROR_CANCELLED?])],
         [])
        CFLAGS="$SAVED_CFLAGS"
-       LIBS="$SAVED_LIBS"],
-      [AS_IF([test "x$with_ovirt" = "xyes"],
-             [AC_MSG_ERROR([oVirt support requested but libgovirt not found])
-      ])
-])
-AM_CONDITIONAL([HAVE_OVIRT], [test "x$have_ovirt" = "xyes"])
+       LIBS="$SAVED_LIBS"]
+)
+AM_CONDITIONAL([HAVE_OVIRT], [test "x$with_ovirt" = "xyes"])
 
 dnl Decide if this platform can support the SSH tunnel feature.
 AC_CHECK_HEADERS([sys/socket.h sys/un.h windows.h])
 AC_CHECK_FUNCS([fork socketpair])
 
 
-if test "x$have_gtk_vnc" != "xyes" && test "x$have_spice_gtk" != "xyes"; then
+if test "x$with_gtk_vnc" != "xyes" && test "x$with_spice_gtk" != "xyes"; then
     AC_MSG_ERROR([At least one of spice or vnc must be used])
 fi
 
-- 
2.4.5




More information about the virt-tools-list mailing list