[PATCH] Make libvirt build when xen-devel is not installed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



After the Capabilities patch went in, we discovered that although we could supposedly build libvirt without xen-devel installed, in fact we needed to be more aggressive with ifdefs (and conditionally turn off compilation of some tests that only test xen features). This patch makes it possible to compile libvirt with neither qemu nor xen-devel installed.

Signed-off-by: Hugh Brock <hbrock@xxxxxxxxxx>

--
Red Hat Virtualization Group http://redhat.com/virtualization
Hugh Brock           | virt-manager http://virt-manager.org
hbrock@xxxxxxxxxx    | virtualization library http://libvirt.org
diff -ruN libvirt.orig/configure.in libvirt/configure.in
--- libvirt.orig/configure.in	2007-03-15 13:24:57.000000000 -0400
+++ libvirt/configure.in	2007-03-15 16:17:26.000000000 -0400
@@ -187,7 +187,7 @@
 then
 
 if test "$with_xen" = "no" ; then
-    echo Disabling XEN support
+    echo "Disabling XEN support"
 else
     dnl search for the Xen store library
     AC_SEARCH_LIBS(xs_read, [xenstore],
@@ -387,7 +387,7 @@
 fi
 AC_MSG_RESULT($RUNNING_XEND)
 
-AM_CONDITIONAL(ENABLE_XEN_TESTS, [test "$RUNNING_XEN" != "no" -a "$RUNNING_XEND" != "no"])
+AM_CONDITIONAL(ENABLE_XEN_TESTS, [test "$WITH_XEN" != "0" -a "$RUNNING_XEN" != "no" -a "$RUNNING_XEND" != "no"])
 
 AC_ARG_ENABLE(test-coverage,
 [  --enable-test-coverage   turn on code coverage instrumentation],
diff -ruN libvirt.orig/src/xml.c libvirt/src/xml.c
--- libvirt.orig/src/xml.c	2007-03-15 03:43:16.000000000 -0400
+++ libvirt/src/xml.c	2007-03-15 16:17:47.000000000 -0400
@@ -213,6 +213,8 @@
 
 
 #ifndef PROXY
+#ifdef WITH_XEN
+
 /**
  * virtDomainParseXMLGraphicsDescImage:
  * @conn: pointer to the hypervisor connection
@@ -1208,6 +1210,7 @@
     return (NULL);
 }
 
+#endif /* WITH_XEN */
 #endif /* !PROXY */
 
 
@@ -1269,6 +1272,8 @@
 }
 
 #ifndef PROXY
+#ifdef WITH_XEN
+
 /**
  * virParseXMLDevice:
  * @conn: pointer to the hypervisor connection
@@ -1342,9 +1347,7 @@
     xmlDocPtr xml = NULL;
     xmlNodePtr node, cur;
     xmlChar *attr = NULL;
-#ifdef WITH_XEN
     char *xref;
-#endif /* WITH_XEN */
     int ret = 0;
 
     xml = xmlReadDoc((const xmlChar *) xmldesc, "domain.xml", NULL,
@@ -1376,7 +1379,6 @@
             if (attr == NULL)
                 goto error;
 
-#ifdef WITH_XEN
             xref = xenStoreDomainGetNetworkID(domain->conn, domain->id,
                                               (char *) attr);
             if (xref != NULL) {
@@ -1384,7 +1386,6 @@
                 free(xref);
                 goto cleanup;
             }
-#endif /* WITH_XEN */
 
             goto error;
         }
@@ -1398,6 +1399,7 @@
         xmlFree(attr);
     return ret;
 }
+#endif /* WITH_XEN */
 #endif /* !PROXY */
 
 /*
diff -ruN libvirt.orig/tests/Makefile.am libvirt/tests/Makefile.am
--- libvirt.orig/tests/Makefile.am	2007-03-15 03:43:16.000000000 -0400
+++ libvirt/tests/Makefile.am	2007-03-15 16:18:01.000000000 -0400
@@ -30,12 +30,15 @@
 
 EXTRA_DIST = xmlrpcserver.py test_conf.sh
 
-noinst_PROGRAMS = xmlrpctest xml2sexprtest sexpr2xmltest virshtest conftest \
-	reconnect xmconfigtest
+noinst_PROGRAMS = xmlrpctest virshtest conftest
 
-TESTS = xml2sexprtest sexpr2xmltest virshtest test_conf.sh xmconfigtest
 if ENABLE_XEN_TESTS
-  TESTS += reconnect
+  noinst_PROGRAMS += xml2sexprtest sexpr2xmltest reconnect xmconfigtest
+endif
+
+TESTS =  virshtest test_conf.sh 
+if ENABLE_XEN_TESTS
+  TESTS += reconnect xml2sexprtest sexpr2xmltest xmconfigtest
 endif
 
 valgrind:

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]