diff --git a/ChangeLog b/ChangeLog index 2cc1a413a8..09c84578dc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +Thu Mar 15 08:40:33 CET 2007 Daniel Veillard + + * 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 * src/xend_internal.c: applied patch from Kazuki Mizushima, an diff --git a/configure.in b/configure.in index 041abc5904..0529a2503a 100644 --- a/configure.in +++ b/configure.in @@ -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 diff --git a/proxy/Makefile.am b/proxy/Makefile.am index 2b1ca87356..17541130d8 100644 --- a/proxy/Makefile.am +++ b/proxy/Makefile.am @@ -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 diff --git a/proxy/libvirt_proxy.c b/proxy/libvirt_proxy.c index 85b9f818ae..746029be27 100644 --- a/proxy/libvirt_proxy.c +++ b/proxy/libvirt_proxy.c @@ -19,6 +19,8 @@ #include #include #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 */ diff --git a/src/Makefile.am b/src/Makefile.am index 4864fb6645..4bae9224ad 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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@ diff --git a/src/libvirt.c b/src/libvirt.c index d5b00cfddb..bbac58ad3a 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -21,14 +21,16 @@ #include #include -#include - #include "internal.h" #include "driver.h" + +#ifdef WITH_XEN +#include #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); diff --git a/src/qemu_internal.c b/src/qemu_internal.c index 4347f0f8de..eb18af720e 100644 --- a/src/qemu_internal.c +++ b/src/qemu_internal.c @@ -21,6 +21,7 @@ * Author: Daniel P. Berrange */ +#ifdef WITH_QEMU #include #include #include @@ -1230,6 +1231,7 @@ void qemuRegister(void) { virRegisterDriver(&qemuDriver); virRegisterNetworkDriver(&qemuNetworkDriver); } +#endif /* WITH_QEMU */ /* * Local variables: diff --git a/src/test.c b/src/test.c index cb2496e3a2..927ae520b4 100644 --- a/src/test.c +++ b/src/test.c @@ -21,6 +21,7 @@ * Daniel Berrange */ +#ifdef WITH_TEST #include #include #include @@ -1375,6 +1376,7 @@ int testDomainUndefine(virDomainPtr domain) { return (0); } +#endif /* WITH_TEST */ /* * Local variables: diff --git a/src/xen_internal.c b/src/xen_internal.c index 4c73cd11ee..6ebb4ff4c7 100644 --- a/src/xen_internal.c +++ b/src/xen_internal.c @@ -8,6 +8,8 @@ * Daniel Veillard */ +#ifdef WITH_XEN + #include #include /* 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 diff --git a/src/xen_internal.h b/src/xen_internal.h index e5d16d048e..6e65aa7224 100644 --- a/src/xen_internal.h +++ b/src/xen_internal.h @@ -11,9 +11,6 @@ #ifndef __VIR_XEN_INTERNAL_H__ #define __VIR_XEN_INTERNAL_H__ -/* required for dom0_getdomaininfo_t and DOM0_INTERFACE_VERSION */ -#include - #ifdef __cplusplus extern "C" { #endif diff --git a/src/xend_internal.c b/src/xend_internal.c index e814e66c55..c936266428 100644 --- a/src/xend_internal.c +++ b/src/xend_internal.c @@ -10,6 +10,7 @@ * archive for more details. */ +#ifdef WITH_XEN #include #include #include @@ -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 + #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: diff --git a/src/xm_internal.c b/src/xm_internal.c index 4c1a97a0a5..e26c20ccc9 100644 --- a/src/xm_internal.c +++ b/src/xm_internal.c @@ -22,6 +22,7 @@ * */ +#ifdef WITH_XEN #include #include #include @@ -2261,6 +2262,7 @@ int xenXMNumOfDefinedDomains(virConnectPtr conn) { return virHashSize(nameConfigMap); } +#endif /* WITH_XEN */ /* * Local variables: * indent-tabs-mode: nil diff --git a/src/xml.c b/src/xml.c index 6f14d9d964..09034d418a 100644 --- a/src/xml.c +++ b/src/xml.c @@ -14,7 +14,9 @@ #include #include #include +#ifdef WITH_XEN #include +#endif #include #include #include @@ -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; } diff --git a/src/xs_internal.c b/src/xs_internal.c index 558a88b472..0923b5ce97 100644 --- a/src/xs_internal.c +++ b/src/xs_internal.c @@ -8,6 +8,7 @@ * Daniel Veillard */ +#ifdef WITH_XEN #include #include #include @@ -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: + */ diff --git a/tests/Makefile.am b/tests/Makefile.am index c276cb0313..a2a74444fa 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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@ \ diff --git a/tests/sexpr2xmltest.c b/tests/sexpr2xmltest.c index d1d020c49c..236ebd13a8 100644 --- a/tests/sexpr2xmltest.c +++ b/tests/sexpr2xmltest.c @@ -1,6 +1,7 @@ #include #include +#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: + */ diff --git a/tests/xmconfigtest.c b/tests/xmconfigtest.c index 4feff5fb69..e5ef2b3cc1 100644 --- a/tests/xmconfigtest.c +++ b/tests/xmconfigtest.c @@ -24,6 +24,7 @@ #include #include +#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: