[virt-tools-list] [virt-viewer 01/20] Add --with-ovirt configure argument

Christophe Fergeau cfergeau at redhat.com
Wed Jun 13 12:23:09 UTC 2012


This adds a pkg-config test for libvirt which will be needed
to access the oVirt REST API. This is in preparation for handling
ovirt:// URIs.
---
 configure.ac    |   20 ++++++++++++++++++++
 src/Makefile.am |   13 +++++++++++++
 2 files changed, 33 insertions(+)

diff --git a/configure.ac b/configure.ac
index 494cd13..59039cf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -14,6 +14,7 @@ AM_SILENT_RULES([yes])
 
 GLIB2_REQUIRED=2.12.0
 LIBXML2_REQUIRED="2.6.0"
+LIBREST_REQUIRED="0.7.2"
 LIBVIRT_REQUIRED="0.9.7"
 GTK2_REQUIRED="2.18.0"
 GTK3_REQUIRED="3.0"
@@ -162,6 +163,23 @@ AS_IF([test "x$have_spice_gtk" = "xyes"],
 ])
 AM_CONDITIONAL([HAVE_SPICE_GTK], [test "x$have_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,
+                         rest-0.7 >= $LIBREST_REQUIRED,
+                         [have_ovirt=yes], [have_ovirt=no])],
+      [have_ovirt=no])
+
+AS_IF([test "x$have_ovirt" = "xyes"],
+      [AC_DEFINE([HAVE_OVIRT], 1, [Have librest?])],
+      [AS_IF([test "x$with_ovirt" = "xyes"],
+             [AC_MSG_ERROR([oVirt support requested but librest not found])
+      ])
+])
+AM_CONDITIONAL([HAVE_OVIRT], [test "x$have_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])
@@ -232,3 +250,5 @@ AC_MSG_NOTICE([     LIBXML2: $LIBXML2_CFLAGS $LIBXML2_LIBS])
 AC_MSG_NOTICE([])
 AC_MSG_NOTICE([     LIBVIRT: $LIBVIRT_CFLAGS $LIBVIRT_LIBS])
 AC_MSG_NOTICE([])
+AC_MSG_NOTICE([     LIBREST: $OVIRT_CFLAGS $OVIRT_LIBS])
+AC_MSG_NOTICE([])
diff --git a/src/Makefile.am b/src/Makefile.am
index d99b043..38fb683 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -38,6 +38,11 @@ COMMON_SOURCES +=						\
 	$(NULL)
 endif
 
+if HAVE_OVIRT
+COMMON_SOURCES +=						\
+	$(NULL)
+endif
+
 if HAVE_SPICE_GTK
 COMMON_SOURCES +=						\
 	virt-viewer-session-spice.h virt-viewer-session-spice.c	\
@@ -75,6 +80,10 @@ if HAVE_GTK_VNC
 virt_viewer_LDFLAGS += $(GTK_VNC_LIBS)
 virt_viewer_CFLAGS += $(GTK_VNC_CFLAGS)
 endif
+if HAVE_OVIRT
+virt_viewer_LDFLAGS += $(OVIRT_LIBS)
+virt_viewer_CFLAGS += $(OVIRT_CFLAGS)
+endif
 if HAVE_SPICE_GTK
 virt_viewer_LDFLAGS += $(SPICE_GTK_LIBS)
 virt_viewer_CFLAGS += $(SPICE_GTK_CFLAGS)
@@ -107,6 +116,10 @@ if HAVE_GTK_VNC
 remote_viewer_LDFLAGS += $(GTK_VNC_LIBS)
 remote_viewer_CFLAGS += $(GTK_VNC_CFLAGS)
 endif
+if HAVE_OVIRT
+remote_viewer_LDFLAGS += $(OVIRT_LIBS)
+remote_viewer_CFLAGS += $(OVIRT_CFLAGS)
+endif
 if HAVE_SPICE_GTK
 remote_viewer_LDFLAGS += $(SPICE_GTK_LIBS) $(SPICE_CONTROLLER_LIBS)
 remote_viewer_CFLAGS += $(SPICE_GTK_CFLAGS) $(SPICE_CONTROLLER_CFLAGS)
-- 
1.7.10.2




More information about the virt-tools-list mailing list