Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx> --- configure.ac | 63 +++---------------------------------- m4/virt-driver-xenapi.m4 | 82 ++++++++++++++++++++++++++++++++++++++++++++++++ src/Makefile.am | 4 +-- 3 files changed, 88 insertions(+), 61 deletions(-) create mode 100644 m4/virt-driver-xenapi.m4 diff --git a/configure.ac b/configure.ac index 09bf9c4307..4b041adeac 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 0000000000..3f37d8da9f --- /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 <http://www.gnu.org/licenses/>. +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 262528cb14..767fee66f0 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 -- 2.11.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list