
2010/2/26 Sharadha Prabhakar (3P) <sharadha.prabhakar@citrix.com>:
This is the last patch in this series. It contains changes made to the following files. ~/libvirt/configure.ac ~/libvirt/src/Makefile.am ~/libvirt/src/util/virterror.c ~/libvirt/src/driver.h ~/libvirt/include/libvirt/virterror.h ~/libvirt/virterror.c
--- ./libvirt_org/configure.ac 2010-02-17 17:39:21.000000000 +0000 +++ ./libvirt/configure.ac 2010-02-26 11:18:47.000000000 +0000 @@ -219,6 +219,8 @@ AC_HELP_STRING([--with-libssh2=@<:@PFX@:>@], [libssh2 location @<:@default=/usr/local/lib@:>@]),[],[with_libssh2=yes]) AC_ARG_WITH([phyp], AC_HELP_STRING([--with-phyp], [add PHYP support @<:@default=check@:>@]),[],[with_phyp=check]) +AC_ARG_WITH([xenapi], + AC_HELP_STRING([--with-xenapi], [add XenAPI support @<:@default=yes@:>@]),[],[with_xenapi=check])
The actual default and the printed one mismatch. change default=yes to default=check
AC_ARG_WITH([vbox], AC_HELP_STRING([--with-vbox], [add VirtualBox support @<:@default=yes@:>@]),[],[with_vbox=yes]) AC_ARG_WITH([lxc], @@ -307,6 +309,7 @@ fi AM_CONDITIONAL([WITH_VBOX], [test "$with_vbox" = "yes"])
+ if test "$with_libvirtd" = "no" ; then with_qemu=no fi @@ -335,6 +338,49 @@ fi AM_CONDITIONAL([WITH_LIBVIRTD], [test "$with_libvirtd" = "yes"])
+ +old_LIBS="$LIBS" +old_CFLAGS="$CFLAGS" +LIBXENSERVER_LIBS="" +LIBXENSERVER_CFLAGS="" +LIBXENSERVER_LDFLAGS="" +dnl search for the XenServer library +if test "$with_xenapi" != "no" ; then + if test "$with_xenapi" != "yes" -a "$with_xenapi" != "check" ; then + LIBXENSERVER_CFLAGS="-I$with_xenapi/include" + LIBXENSERVER_LDFLAGS="$with_xenapi/libxenserver.so"
Why do you add the path to an .so file to the LDFLAGS?
+ LIBXENSERVER_LIBS="-L$with_xenapi -lxenserver" + fi + fail=0 + CFLAGS="$CFLAGS $LIBXENSERVER_CFLAGS" + LIBS="$LIBS $LIBXENSERVER_LIBS" + AC_CHECK_LIB([xen_vm_start], [xs_read], [
I'm not sure that I understand what you're doing here. You're checking for a xs_read function in a xen_vm_start library.
+ with_xenapi=yes + LIBXENSERVER_LIBS="$LIBXENSERVER_LIBS -lxenstore"
Do you really need xenstore?
+ ],[ + if test "$with_xenapi" = "yes"; then + fail=1 + fi + with_xenapi=no + ]) +fi + +LIBS="$old_LIBS" +CFLAGS="$old_CFLAGS" + +if test $fail = 1; then + AC_MSG_ERROR([You must install the XenServer Library to compile XenAPI driver with -lxenserver]) +fi + +if test "$with_xenapi" = "yes"; then + AC_DEFINE_UNQUOTED([WITH_XENAPI], 1, [whether Xen driver is enabled])
'XenAPI driver' instead of 'Xen driver'
+fi + +AC_SUBST([LIBXENSERVER_CFLAGS]) +AC_SUBST([LIBXENSERVER_LIBS]) +AC_SUBST([LIBXENSERVER_LDFLAGS]) + +
old_LIBS="$LIBS" old_CFLAGS="$CFLAGS" XEN_LIBS="" @@ -1447,23 +1493,31 @@ LIBCURL_LIBS="" LIBCURL_FOUND="no"
-if test "$with_esx" = "yes" -o "$with_esx" = "check"; then +if test "$with_esx" = "yes" -o "$with_esx" = "check" -o "$with_xenapi" = "yes" -o "$with_xenapi" = "check"; then PKG_CHECK_MODULES(LIBCURL, libcurl >= $LIBCURL_REQUIRED, [ LIBCURL_FOUND=yes with_esx="yes" + with_xenapi="yes"
This part should be split into an ESX and XenAPI part. Otherwise you may change with_esx="no" to with_esx="yes" just because libcurl was found.
], [ - if test "$with_esx" = "check"; then + if test "$with_esx" = "check" -o "$with_xenapi" = "check"; then with_esx=no - AC_MSG_NOTICE([libcurl is required for ESX driver, disabling it]) + with_xenapi=no + AC_MSG_NOTICE([libcurl is required for ESX/XENAPI driver, disabling it]) else - AC_MSG_ERROR([libcurl >= $LIBCURL_REQUIRED is required for the ESX driver]) + AC_MSG_ERROR([libcurl >= $LIBCURL_REQUIRED is required for the ESX/XENAPI driver]) fi
Also this part should be split into an ESX and XenAPI part.
]) fi if test "$with_esx" = "yes" ; then AC_DEFINE_UNQUOTED([WITH_ESX], 1, [whether ESX driver is enabled]) fi + +if test "$with_xenapi" = "yes" ; then + AC_DEFINE_UNQUOTED([WITH_XENAPI], 1, [whether XenAPI driver is enabled]) +fi + AM_CONDITIONAL([WITH_ESX], [test "$with_esx" = "yes"]) +AM_CONDITIONAL([WITH_XENAPI], [test "$with_xenapi" = "yes"]) AC_SUBST([LIBCURL_CFLAGS]) AC_SUBST([LIBCURL_LIBS])
I suggest to restructure this tests like this: dnl dnl check for libcurl (ESX/XenAPI) dnl LIBCURL_CFLAGS="" LIBCURL_LIBS="" if test "$with_esx" = "yes" -o "$with_esx" = "check" -o "$with_xenapi" = "yes" -o "$with_xenapi" = "check"; then PKG_CHECK_MODULES(LIBCURL, libcurl >= $LIBCURL_REQUIRED, [ if test "$with_esx" = "check"; then with_esx=yes fi if test "$with_xenapi" = "check"; then with_xenapi=yes fi ], [ if test "$with_esx" = "check"; then with_esx=no AC_MSG_NOTICE([libcurl is required for the ESX driver, disabling it]) elif test "$with_esx" = "yes"; then AC_MSG_ERROR([libcurl >= $LIBCURL_REQUIRED is required for the ESX driver]) fi if test "$with_xenapi" = "check"; then with_xenapi=no AC_MSG_NOTICE([libcurl is required for the XenAPI driver, disabling it]) elif test "$with_xenapi" = "yes"; then AC_MSG_ERROR([libcurl >= $LIBCURL_REQUIRED is required for the XenAPI driver]) fi ]) fi if test "$with_esx" = "yes" ; then AC_DEFINE_UNQUOTED([WITH_ESX], 1, [whether ESX driver is enabled]) fi AM_CONDITIONAL([WITH_ESX], [test "$with_esx" = "yes"]) if test "$with_xenapi" = "yes" ; then AC_DEFINE_UNQUOTED([WITH_XENAPI], 1, [whether XenAPI driver is enabled]) fi AM_CONDITIONAL([WITH_XENAPI], [test "$with_xenapi" = "yes"]) AC_SUBST([LIBCURL_CFLAGS]) AC_SUBST([LIBCURL_LIBS])
@@ -1894,6 +1948,7 @@ AC_MSG_NOTICE([ UML: $with_uml]) AC_MSG_NOTICE([ OpenVZ: $with_openvz]) AC_MSG_NOTICE([ VBox: $with_vbox]) +AC_MSG_NOTICE([ XenAPI: $with_xenapi]) AC_MSG_NOTICE([ LXC: $with_lxc]) AC_MSG_NOTICE([ PHYP: $with_phyp]) AC_MSG_NOTICE([ ONE: $with_one]) @@ -1992,6 +2047,12 @@ else AC_MSG_NOTICE([ xen: no]) fi +if test "$with_xenapi" = "yes" ; then +AC_MSG_NOTICE([ xenapi: $LIBXENSERVER_CFLAGS $LIBXENSERVER_LIBS $LIBXENSERVER_LDFLAGS]) +else +AC_MSG_NOTICE([ xen: no])
'xenapi: no' instead of 'xen: no'.
+fi if test "$with_hal" = "yes" ; then AC_MSG_NOTICE([ hal: $HAL_CFLAGS $HAL_LIBS]) else --- ./libvirt_org/src/Makefile.am 2010-02-17 17:38:13.000000000 +0000 +++ ./libvirt/src/Makefile.am 2010-02-26 13:13:59.000000000 +0000 @@ -205,6 +207,11 @@ qemu/qemu_security_dac.h \ qemu/qemu_security_dac.c
+XENAPI_DRIVER_SOURCES = \ + xenapi/xenapi_driver.c xenapi/xenapi_driver.h \ + xenapi_driver_private.h \ + xenapi/xenapi_utils.c xenapi/xenapi_utils.h + UML_DRIVER_SOURCES = \ uml/uml_conf.c uml/uml_conf.h \ uml/uml_driver.c uml/uml_driver.h @@ -466,6 +473,30 @@ libvirt_driver_vbox_la_SOURCES = $(VBOX_DRIVER_SOURCES) endif
+if WITH_XENAPI +if WITH_DRIVER_MODULES +mod_LTLIBRARIES += libvirt_driver_xenapi.la +else +noinst_LTLIBRARIES += libvirt_driver_xenapi.la + +libvirt_la_LIBADD += libvirt_driver_xenapi.la \ + $(LIBXENSERVER_LDFLAGS)
LIBXENSERVER_LDFLAGS is not necessary here. Adding LIBXENSERVER_LIBS to libvirt_driver_xenapi_la_LDFLAGS some lines below should be enough. Matthias