diff --git a/configure.ac b/configure.ac index 7d3b66349776c2d0cee6af4095a0da4220de4a23..59dc5cff8d1212ce3b455b8d3431049633bf14d1 100644 --- a/configure.ac +++ b/configure.ac @@ -403,7 +403,7 @@ LIBVIRT_DRIVER_ARG_QEMU LIBVIRT_DRIVER_ARG_OPENVZ LIBVIRT_DRIVER_ARG_VMWARE LIBVIRT_ARG_WITH([PHYP], [PHYP], [check]) -LIBVIRT_ARG_WITH([XENAPI], [XenAPI], [check]) +LIBVIRT_DRIVER_ARG_XENAPI LIBVIRT_DRIVER_ARG_LIBXL LIBVIRT_ARG_WITH([VBOX], [VirtualBox XPCOMC], [yes]) LIBVIRT_DRIVER_ARG_LXC @@ -492,53 +492,7 @@ if test "$with_libvirtd" = "yes" ; then fi AM_CONDITIONAL([WITH_LIBVIRTD], [test "$with_libvirtd" = "yes"]) -old_LIBS="$LIBS" -old_CFLAGS="$CFLAGS" -LIBXENSERVER_LIBS="" -LIBXENSERVER_CFLAGS="" -dnl search for the XenServer library -fail=0 -if test "$with_xenapi" != "no" ; then - if test "$with_xenapi" != "yes" && test "$with_xenapi" != "check" ; then - LIBXENSERVER_CFLAGS="-I$with_xenapi/include" - LIBXENSERVER_LIBS="-L$with_xenapi" - fi - CFLAGS="$CFLAGS $LIBXENSERVER_CFLAGS" - LIBS="$LIBS $LIBXENSERVER_LIBS" - AC_CHECK_LIB([xenserver], [xen_vm_start], [ - LIBXENSERVER_LIBS="$LIBXENSERVER_LIBS -lxenserver" - ],[ - if test "$with_xenapi" = "yes"; then - fail=1 - fi - with_xenapi=no - ]) - if test "$with_xenapi" != "no" ; then - if test "$with_curl" = "no"; then - if test "$with_xenapi" = "yes"; then - fail=1 - fi - with_xenapi=no - else - with_xenapi=yes - fi - fi -fi - -LIBS="$old_LIBS" -CFLAGS="$old_CFLAGS" - -if test $fail = 1; then - AC_MSG_ERROR([You must install libxenserver and libcurl to compile the XenAPI driver]) -fi - -if test "$with_xenapi" = "yes"; then - AC_DEFINE_UNQUOTED([WITH_XENAPI], 1, [whether XenAPI driver is enabled]) -fi - -AC_SUBST([LIBXENSERVER_CFLAGS]) -AC_SUBST([LIBXENSERVER_LIBS]) - +LIBVIRT_DRIVER_CHECK_XENAPI LIBVIRT_DRIVER_CHECK_LIBXL LIBVIRT_DRIVER_CHECK_XEN @@ -1087,11 +1041,6 @@ if test "$with_vmx" = "yes" ; then fi AM_CONDITIONAL([WITH_VMX], [test "$with_vmx" = "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"]) - dnl dnl check for Hyper-V @@ -1432,7 +1381,7 @@ LIBVIRT_DRIVER_RESULT_UML LIBVIRT_DRIVER_RESULT_OPENVZ LIBVIRT_DRIVER_RESULT_VMWARE AC_MSG_NOTICE([ VBox: $with_vbox]) -AC_MSG_NOTICE([ XenAPI: $with_xenapi]) +LIBVIRT_DRIVER_RESULT_XENAPI LIBVIRT_DRIVER_RESULT_LIBXL LIBVIRT_DRIVER_RESULT_LXC AC_MSG_NOTICE([ PHYP: $with_phyp]) @@ -1508,12 +1457,8 @@ LIBVIRT_RESULT_UDEV LIBVIRT_RESULT_VIRTUALPORT LIBVIRT_RESULT_XDR LIBVIRT_RESULT_XEN +LIBVIRT_RESULT_XENAPI LIBVIRT_RESULT_YAJL -if test "$with_xenapi" = "yes" ; then -AC_MSG_NOTICE([ xenapi: $LIBXENSERVER_CFLAGS $LIBXENSERVER_LIBS]) -else -AC_MSG_NOTICE([ xenapi: no]) -fi if test "$with_storage_rbd" = "yes" ; then AC_MSG_NOTICE([ rbd: $LIBRBD_LIBS]) else diff --git a/m4/virt-driver-xenapi.m4 b/m4/virt-driver-xenapi.m4 new file mode 100644 index 0000000000000000000000000000000000000000..3f37d8da9f089fe47dbb5bf70f777250b97a13ff --- /dev/null +++ b/m4/virt-driver-xenapi.m4 @@ -0,0 +1,82 @@ +dnl The XenAPI driver +dnl +dnl Copyright (C) 2016 Red Hat, Inc. +dnl +dnl This library is free software; you can redistribute it and/or +dnl modify it under the terms of the GNU Lesser General Public +dnl License as published by the Free Software Foundation; either +dnl version 2.1 of the License, or (at your option) any later version. +dnl +dnl This library is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl Lesser General Public License for more details. +dnl +dnl You should have received a copy of the GNU Lesser General Public +dnl License along with this library. If not, see +dnl . +dnl + +AC_DEFUN([LIBVIRT_DRIVER_ARG_XENAPI], [ + LIBVIRT_ARG_WITH([XENAPI], [XenAPI], [check]) +]) + +AC_DEFUN([LIBVIRT_DRIVER_CHECK_XENAPI], [ + AC_REQUIRE([LIBVIRT_CHECK_CURL]) + + old_LIBS="$LIBS" + old_CFLAGS="$CFLAGS" + XENAPI_LIBS="" + XENAPI_CFLAGS="" + dnl search for the XenServer library + fail=0 + if test "$with_xenapi" != "no" ; then + if test "$with_xenapi" != "yes" && test "$with_xenapi" != "check" ; then + XENAPI_CFLAGS="-I$with_xenapi/include" + XENAPI_LIBS="-L$with_xenapi" + fi + CFLAGS="$CFLAGS $XENAPI_CFLAGS" + LIBS="$LIBS $XENAPI_LIBS" + AC_CHECK_LIB([xenserver], [xen_vm_start], [ + XENAPI_LIBS="$XENAPI_LIBS -lxenserver" + ],[ + if test "$with_xenapi" = "yes"; then + fail=1 + fi + with_xenapi=no + ]) + if test "$with_xenapi" != "no" ; then + if test "$with_curl" = "no"; then + if test "$with_xenapi" = "yes"; then + fail=1 + fi + with_xenapi=no + else + with_xenapi=yes + fi + fi + fi + + LIBS="$old_LIBS" + CFLAGS="$old_CFLAGS" + + if test $fail = 1; then + AC_MSG_ERROR([You must install libxenserver and libcurl to compile the XenAPI driver]) + fi + + 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([XENAPI_CFLAGS]) + AC_SUBST([XENAPI_LIBS]) +]) + +AC_DEFUN([LIBVIRT_DRIVER_RESULT_XENAPI], [ + LIBVIRT_RESULT([XenAPI], [$with_xenapi]) +]) + +AC_DEFUN([LIBVIRT_RESULT_XENAPI], [ + LIBVIRT_RESULT_LIB([XENAPI]) +]) diff --git a/src/Makefile.am b/src/Makefile.am index 73f1d7be0253477e5292eac3a513cf9dc0e2c083..d84c984403ca7aea8745ce8e351aeb595ba7f80b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1316,10 +1316,10 @@ endif WITH_VBOX if WITH_XENAPI noinst_LTLIBRARIES += libvirt_driver_xenapi.la libvirt_la_BUILT_LIBADD += libvirt_driver_xenapi.la -libvirt_driver_xenapi_la_CFLAGS = $(LIBXENSERVER_CFLAGS) $(CURL_CFLAGS) \ +libvirt_driver_xenapi_la_CFLAGS = $(XENAPI_CFLAGS) $(CURL_CFLAGS) \ -I$(srcdir)/conf -I$(srcdir)/xenconfig $(AM_CFLAGS) libvirt_driver_xenapi_la_LDFLAGS = $(AM_LDFLAGS) -libvirt_driver_xenapi_la_LIBADD = $(LIBXENSERVER_LIBS) $(CURL_LIBS) +libvirt_driver_xenapi_la_LIBADD = $(XENAPI_LIBS) $(CURL_LIBS) libvirt_driver_xenapi_la_SOURCES = $(XENAPI_DRIVER_SOURCES) endif WITH_XENAPI