]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
* configure.in proxy/Makefile.am proxy/libvirt_proxy.c
authorDaniel Veillard <veillard@redhat.com>
Thu, 15 Mar 2007 07:43:16 +0000 (07:43 +0000)
committerDaniel Veillard <veillard@redhat.com>
Thu, 15 Mar 2007 07:43:16 +0000 (07:43 +0000)
  src/Makefile.am src/libvirt.c src/qemu_internal.c src/test.c
  src/xen_internal.c src/xen_internal.h src/xend_internal.c
  src/xm_internal.c src/xml.c src/xs_internal.c
  tests/Makefile.am tests/sexpr2xmltest.c tests/xmconfigtest.c:
  allow selective compilation of Xen,QEmu/KVM and test support
  in or out at configure time. Also allows to compile on a system
  without Xen development installed. All drivers are selected by
  default.
Daniel

17 files changed:
ChangeLog
configure.in
proxy/Makefile.am
proxy/libvirt_proxy.c
src/Makefile.am
src/libvirt.c
src/qemu_internal.c
src/test.c
src/xen_internal.c
src/xen_internal.h
src/xend_internal.c
src/xm_internal.c
src/xml.c
src/xs_internal.c
tests/Makefile.am
tests/sexpr2xmltest.c
tests/xmconfigtest.c

index 2cc1a413a883132fee2fc8982d7cdfc7e829d4dc..09c84578dc30b6770ef375078619ef261f757df3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+Thu Mar 15 08:40:33 CET 2007 Daniel Veillard <veillard@redhat.com>
+
+       * configure.in proxy/Makefile.am proxy/libvirt_proxy.c 
+         src/Makefile.am src/libvirt.c src/qemu_internal.c src/test.c 
+         src/xen_internal.c src/xen_internal.h src/xend_internal.c 
+         src/xm_internal.c src/xml.c src/xs_internal.c 
+         tests/Makefile.am tests/sexpr2xmltest.c tests/xmconfigtest.c:
+         allow selective compilation of Xen,QEmu/KVM and test support
+         in or out at configure time. Also allows to compile on a system
+         without Xen development installed. All drivers are selected by
+         default.
+
 Wed Mar 14 14:12:32 CET 2007 Daniel Veillard <veillard@redhat.com>
 
        * src/xend_internal.c: applied patch from Kazuki Mizushima, an
index 041abc59042a6627961d6807b137f650ba81cb09..0529a2503a0d2af38feb9ed9bfedab6b750d36fc 100644 (file)
@@ -63,6 +63,14 @@ AC_ARG_WITH(html-subdir, AC_HELP_STRING([--with-html-subdir=path],
             [HTML_DIR="$HTML_DIR/\$(PACKAGE)-\$(VERSION)/html"])
 AC_SUBST(HTML_DIR)
 
+dnl Allow to build without Xen, QEMU/KVM or test driver
+AC_ARG_WITH(xen,
+[  --with-xen              add XEN support (on)])
+AC_ARG_WITH(qemu,
+[  --with-qemu             add QEMU/KVM support (on)])
+AC_ARG_WITH(test,
+[  --with-test             add test driver support (on)])
+
 dnl
 dnl specific tests to setup DV devel environments with debug etc ...
 dnl
@@ -156,11 +164,35 @@ dnl
 AC_ARG_WITH(depends,
        [  --with-depends          check for dependancies (on)])
 
+LIBVIRT_FEATURES=
+WITH_XEN=0
+
+if test "$with_qemu" = "no" ; then
+    echo "Disabling QEMU/KVM support"
+else
+    LIBVIRT_FEATURES="$LIBVIRT_FEATURES -DWITH_QEMU"
+fi
+
+if test "$with_test" = "no" ; then
+    echo "Disabling test driver support"
+else
+    LIBVIRT_FEATURES="$LIBVIRT_FEATURES -DWITH_TEST"
+fi
+
 if test "$with_depends" != "no"
 then
 
-dnl search for the Xen store library
-AC_SEARCH_LIBS(xs_read, [xenstore], [], [AC_MSG_ERROR([Xen store library not found])])
+if test "$with_xen" = "no" ; then
+    echo Disabling XEN support
+else
+    dnl search for the Xen store library
+    AC_SEARCH_LIBS(xs_read, [xenstore],
+                   [WITH_XEN=1],
+                   [AC_MSG_RESULT([Xen store library not found])])
+    if test "$WITH_XEN" != "0" ; then
+        LIBVIRT_FEATURES="$LIBVIRT_FEATURES -DWITH_XEN"
+    fi
+fi
 
 dnl
 dnl check for libsyfs (>= 2.0.0); allow disabling bridge parameters support altogether
@@ -245,6 +277,9 @@ AC_SUBST(VIRSH_LIBS)
 # end of if with_depends
 fi
 
+AC_SUBST(WITH_XEN)
+AC_SUBST(LIBVIRT_FEATURES)
+
 dnl
 dnl check for python
 dnl
index 2b1ca873568f511c28800acd8a1990581361f5be..17541130d80b4b50f392013d5bf338153e4ed3ea 100644 (file)
@@ -3,7 +3,7 @@
 INCLUDES = -I$(top_builddir)/include -I@top_srcdir@/include \
            -I@top_srcdir@/proxy -I@top_srcdir@/src @LIBXML_CFLAGS@ \
           -DPROXY  -DLOCALEBASEDIR=\""$(datadir)/locale"\" \
-           -DGETTEXT_PACKAGE=\"$(PACKAGE)\" $(WARN_CFLAGS)
+           -DGETTEXT_PACKAGE=\"$(PACKAGE)\" $(WARN_CFLAGS) $(LIBVIRT_FEATURES)
 
 libexec_PROGRAMS = libvirt_proxy
 
index 85b9f818aee27efee223a29d83b51dfe6a29c381..746029be2769149d2115f5acd1ac6008c0de075c 100644 (file)
@@ -19,6 +19,8 @@
 #include <sys/un.h>
 #include <locale.h>
 #include "internal.h"
+
+#ifdef WITH_XEN
 #include "proxy_internal.h"
 #include "xen_internal.h"
 #include "xend_internal.h"
@@ -786,3 +788,9 @@ int main(int argc, char **argv) {
     proxyCloseUnixSocket();
     exit(0);
 }
+#else /* WITHOUT_XEN */
+int main(void) {
+    fprintf(stderr, "libvirt was compiled without Xen support\n");
+    exit(1);
+}
+#endif /* WITH_XEN */
index 4864fb6645b9d807b06071268ba3fc6d5b1855e1..4bae9224ad5147eaddcd8529c7c3cd801bc9ee19 100644 (file)
@@ -3,7 +3,7 @@
 INCLUDES = -I$(top_builddir)/include -I@top_srcdir@/include @LIBXML_CFLAGS@ -I@top_srcdir@/qemud \
           -DBINDIR=\""$(libexecdir)"\" -DSBINDIR=\""$(sbindir)"\" -DLOCALEBASEDIR=\""$(datadir)/locale"\" \
            -DLOCAL_STATE_DIR=\""$(localstatedir)"\" \
-           -DGETTEXT_PACKAGE=\"$(PACKAGE)\" $(WARN_CFLAGS)
+           -DGETTEXT_PACKAGE=\"$(PACKAGE)\" $(WARN_CFLAGS) $(LIBVIRT_FEATURES)
 DEPS = libvirt.la
 LDADDS = @STATIC_BINARIES@ libvirt.la
 VIRSH_LIBS = @VIRSH_LIBS@
index d5b00cfddbf3a8fa36f86119a824731ba4ebce75..bbac58ad3ad596ed5a21f054da2122b1b22aef47 100644 (file)
 #include <libxml/parser.h>
 #include <libxml/xpath.h>
 
-#include <xs.h>
-
 #include "internal.h"
 #include "driver.h"
+
+#ifdef WITH_XEN
+#include <xs.h>
 #include "xen_internal.h"
 #include "xend_internal.h"
 #include "xs_internal.h"
 #include "xm_internal.h"
+#endif
 #include "proxy_internal.h"
 #include "xml.h"
 #include "test.h"
@@ -69,13 +71,19 @@ virInitialize(void)
     /*
      * Note that the order is important the first ones have a higher priority
      */
+#ifdef WITH_XEN
     xenHypervisorRegister();
     xenProxyRegister();
     xenDaemonRegister();
     xenStoreRegister();
     xenXMRegister();
+#endif
+#ifdef WITH_TEST
     testRegister();
+#endif
+#ifdef WITH_QEMU
     qemuRegister();
+#endif
 
     return(0);
 }
@@ -1335,6 +1343,7 @@ virDomainGetUUID(virDomainPtr domain, unsigned char *uuid)
     if (domain->id == 0) {
         memset(uuid, 0, VIR_UUID_BUFLEN);
     } else {
+#ifdef WITH_XEN
         if ((domain->uuid[0] == 0) && (domain->uuid[1] == 0) &&
             (domain->uuid[2] == 0) && (domain->uuid[3] == 0) &&
             (domain->uuid[4] == 0) && (domain->uuid[5] == 0) &&
@@ -1345,6 +1354,7 @@ virDomainGetUUID(virDomainPtr domain, unsigned char *uuid)
             (domain->uuid[14] == 0) && (domain->uuid[15] == 0))
             xenDaemonDomainLookupByName_ids(domain->conn, domain->name,
                                 &domain->uuid[0]);
+#endif
         memcpy(uuid, &domain->uuid[0], VIR_UUID_BUFLEN);
     }
     return (0);
index 4347f0f8dea564f969db2f9c64673972509a8aea..eb18af720ecee30cca02bc6fdf7755554b9acab5 100644 (file)
@@ -21,6 +21,7 @@
  * Author: Daniel P. Berrange <berrange@redhat.com>
  */
 
+#ifdef WITH_QEMU
 #include <stdio.h>
 #include <string.h>
 #include <sys/time.h>
@@ -1230,6 +1231,7 @@ void qemuRegister(void) {
     virRegisterDriver(&qemuDriver);
     virRegisterNetworkDriver(&qemuNetworkDriver);
 }
+#endif /* WITH_QEMU */
 
 /*
  * Local variables:
index cb2496e3a2a6da22b5ae08f9bd99a6cedf2409f6..927ae520b4e14f5dc8a2d575316ecb50d825b4b9 100644 (file)
@@ -21,6 +21,7 @@
  * Daniel Berrange <berrange@redhat.com>
  */
 
+#ifdef WITH_TEST
 #include <stdio.h>
 #include <string.h>
 #include <sys/time.h>
@@ -1375,6 +1376,7 @@ int testDomainUndefine(virDomainPtr domain) {
 
     return (0);
 }
+#endif /* WITH_TEST */
 
 /*
  * Local variables:
index 4c73cd11eece3b62d50345d010113dc36786107d..6ebb4ff4c7f9e5562a76d284cb99c546ba289740 100644 (file)
@@ -8,6 +8,8 @@
  * Daniel Veillard <veillard@redhat.com>
  */
 
+#ifdef WITH_XEN
+
 #include <stdio.h>
 #include <string.h>
 /* required for uint8_t, uint32_t, etc ... */
@@ -1880,6 +1882,7 @@ xenHypervisorGetVcpuMax(virDomainPtr domain)
     return maxcpu;
 }
 
+#endif /* WITH_XEN */
 /*
  * Local variables:
  *  indent-tabs-mode: nil
index e5d16d048e5a4dcd4a82be3f32791605ad46f4e0..6e65aa7224f31b22c82da6701f78b4a75d8a7976 100644 (file)
@@ -11,9 +11,6 @@
 #ifndef __VIR_XEN_INTERNAL_H__
 #define __VIR_XEN_INTERNAL_H__
 
-/* required for dom0_getdomaininfo_t and DOM0_INTERFACE_VERSION */
-#include <xen/dom0_ops.h>
-
 #ifdef __cplusplus
 extern "C" {
 #endif
index e814e66c5576d1bccf3d9e9bb4f81efceed62e4e..c936266428adb1901872ed1c3757a8cb2860808f 100644 (file)
@@ -10,6 +10,7 @@
  *  archive for more details.
  */
 
+#ifdef WITH_XEN
 #include <stdio.h>
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -37,6 +38,9 @@
 #include "xen_internal.h" /* for DOM0_INTERFACE_VERSION */
 #include "xs_internal.h" /* To extract VNC port & Serial console TTY */
 
+/* required for cpumap_t */
+#include <xen/dom0_ops.h>
+
 #ifndef PROXY
 static const char * xenDaemonGetType(virConnectPtr conn);
 static int xenDaemonListDomains(virConnectPtr conn, int *ids, int maxids);
@@ -3123,9 +3127,7 @@ error:
 }
 
 #endif /* ! PROXY */
-
-
-
+#endif /* WITH_XEN */
 
 /*
  * Local variables:
index 4c1a97a0a5dd8c2fa68f054f5453df119421388a..e26c20ccc907922ca8fc651e1ebb47a31b12a479 100644 (file)
@@ -22,6 +22,7 @@
  *
  */
 
+#ifdef WITH_XEN
 #include <dirent.h>
 #include <time.h>
 #include <sys/stat.h>
@@ -2261,6 +2262,7 @@ int xenXMNumOfDefinedDomains(virConnectPtr conn) {
     return virHashSize(nameConfigMap);
 }
 
+#endif /* WITH_XEN */
 /*
  * Local variables:
  *  indent-tabs-mode: nil
index 6f14d9d964db163087facd0e5e54fbf90edf5990..09034d418ac63ad54c5c2faac83758041dc987ab 100644 (file)
--- a/src/xml.c
+++ b/src/xml.c
@@ -14,7 +14,9 @@
 #include <stdlib.h>
 #include <string.h>
 #include <stdarg.h>
+#ifdef WITH_XEN
 #include <xs.h>
+#endif
 #include <libxml/parser.h>
 #include <libxml/tree.h>
 #include <libxml/xpath.h>
@@ -1340,7 +1342,9 @@ virDomainXMLDevID(virDomainPtr domain, char *xmldesc, char *class, char *ref)
     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,
@@ -1372,6 +1376,7 @@ virDomainXMLDevID(virDomainPtr domain, char *xmldesc, char *class, char *ref)
             if (attr == NULL)
                 goto error;
 
+#ifdef WITH_XEN
             xref = xenStoreDomainGetNetworkID(domain->conn, domain->id,
                                               (char *) attr);
             if (xref != NULL) {
@@ -1379,6 +1384,7 @@ virDomainXMLDevID(virDomainPtr domain, char *xmldesc, char *class, char *ref)
                 free(xref);
                 goto cleanup;
             }
+#endif /* WITH_XEN */
 
             goto error;
         }
index 558a88b472bbdd56d125a3b716b304ecd005ac08..0923b5ce97b2c9514539629ef7a0802b14b7079c 100644 (file)
@@ -8,6 +8,7 @@
  * Daniel Veillard <veillard@redhat.com>
  */
 
+#ifdef WITH_XEN
 #include <stdio.h>
 #include <string.h>
 #include <unistd.h>
@@ -836,3 +837,13 @@ xenStoreDomainGetNetworkID(virConnectPtr conn, int id, const char *mac) {
     free(list);
     return(ret);
 }
+
+#endif /* WITH_XEN */
+/*
+ * Local variables:
+ *  indent-tabs-mode: nil
+ *  c-indent-level: 4
+ *  c-basic-offset: 4
+ *  tab-width: 4
+ * End:
+ */
index c276cb0313abbc41f6239ab0900d39c821d29b53..a2a74444fa11cd50f8d59ee53c23d966750a1595 100644 (file)
@@ -19,7 +19,8 @@ INCLUDES = \
         -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=199506L \
         -DGETTEXT_PACKAGE=\"$(PACKAGE)\" \
          $(COVERAGE_CFLAGS) \
-         $(WARN_CFLAGS)
+         $(WARN_CFLAGS)        \
+        $(LIBVIRT_FEATURES)
 
 LDADDS = \
        @STATIC_BINARIES@ \
index d1d020c49c962a0b39d7a5ceee947e884ac9e7ea..236ebd13a825f3c31516d649a58b45b4a6a8d5af 100644 (file)
@@ -1,6 +1,7 @@
 #include <stdio.h>
 #include <string.h>
 
+#ifdef WITH_XEN
 #include "xml.h"
 #include "xend_internal.h"
 #include "testutils.h"
@@ -190,3 +191,19 @@ main(int argc, char **argv)
 
     exit(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
 }
+#else /* WITHOUT_XEN */
+int
+main(void)
+{
+    fprintf(stderr, "libvirt compiled without Xen support\n");
+    exit(0);
+}
+#endif /* WITH_XEN */
+/*
+ * Local variables:
+ *  indent-tabs-mode: nil
+ *  c-indent-level: 4
+ *  c-basic-offset: 4
+ *  tab-width: 4
+ * End:
+ */
index 4feff5fb69155dd05bcbcf536f0736b8c23a4871..e5ef2b3cc15b6a9c449c57d48155f382f21ee4f8 100644 (file)
@@ -24,6 +24,7 @@
 #include <stdio.h>
 #include <string.h>
 
+#ifdef WITH_XEN
 #include "xm_internal.h"
 #include "testutils.h"
 #include "internal.h"
@@ -214,7 +215,14 @@ main(int argc, char **argv)
 
     exit(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
 }
-
+#else /* WITHOUT_XEN */
+int
+main(void)
+{
+    fprintf(stderr, "libvirt compiled without Xen support\n");
+    exit(0);
+}
+#endif /* WITH_XEN */
 
 /*
  * Local variables: