meson: add libxl driver build option

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
This commit is contained in:
Pavel Hrdina 2020-04-30 11:30:11 +02:00
parent 0417725dce
commit 79fde1c101
4 changed files with 53 additions and 79 deletions

View File

@ -91,7 +91,6 @@ AM_CONDITIONAL([WITH_MACOS], [test "$with_macos" = "yes"])
if test "$with_libvirtd" = "no" ; then
with_qemu=no
with_lxc=no
with_libxl=no
with_vbox=no
fi
@ -112,7 +111,6 @@ dnl
LIBVIRT_DRIVER_ARG_QEMU
LIBVIRT_DRIVER_ARG_OPENVZ
LIBVIRT_DRIVER_ARG_VMWARE
LIBVIRT_DRIVER_ARG_LIBXL
LIBVIRT_DRIVER_ARG_VBOX
LIBVIRT_DRIVER_ARG_LXC
LIBVIRT_DRIVER_ARG_VZ
@ -123,7 +121,6 @@ LIBVIRT_DRIVER_ARG_INTERFACE
LIBVIRT_DRIVER_CHECK_QEMU
LIBVIRT_DRIVER_CHECK_OPENVZ
LIBVIRT_DRIVER_CHECK_VMWARE
LIBVIRT_DRIVER_CHECK_LIBXL
LIBVIRT_DRIVER_CHECK_VBOX
LIBVIRT_DRIVER_CHECK_LXC
LIBVIRT_DRIVER_CHECK_VZ
@ -325,7 +322,6 @@ LIBVIRT_DRIVER_RESULT_QEMU
LIBVIRT_DRIVER_RESULT_OPENVZ
LIBVIRT_DRIVER_RESULT_VMWARE
LIBVIRT_DRIVER_RESULT_VBOX
LIBVIRT_DRIVER_RESULT_LIBXL
LIBVIRT_DRIVER_RESULT_LXC
LIBVIRT_DRIVER_RESULT_VZ
LIBVIRT_DRIVER_RESULT_TEST
@ -359,7 +355,6 @@ LIBVIRT_RESULT_DRIVER_MODULES
AC_MSG_NOTICE([])
AC_MSG_NOTICE([Libraries])
AC_MSG_NOTICE([])
LIBVIRT_RESULT_LIBXL
LIBVIRT_RESULT_NSS
LIBVIRT_RESULT_PM_UTILS
LIBVIRT_RESULT_RBD

View File

@ -1,74 +0,0 @@
dnl The libxl 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_LIBXL], [
LIBVIRT_ARG_WITH_FEATURE([LIBXL], [libxenlight], [check])
])
AC_DEFUN([LIBVIRT_DRIVER_CHECK_LIBXL], [
LIBXL_LIBS=""
LIBXL_CFLAGS=""
LIBXL_FIRMWARE_DIR=""
LIBXL_EXECBIN_DIR=""
LIBXL_API_VERSION="-DLIBXL_API_VERSION=0x040500"
dnl search for libxl, aka libxenlight
old_with_libxl="$with_libxl"
LIBVIRT_CHECK_PKG([LIBXL], [xenlight], [4.6.0])
if test "x$with_libxl" = "xyes" ; then
LIBXL_FIRMWARE_DIR=$($PKG_CONFIG --variable xenfirmwaredir xenlight)
LIBXL_EXECBIN_DIR=$($PKG_CONFIG --variable libexec_bin xenlight)
fi
if test "$with_libxl" = "yes"; then
LIBXL_CFLAGS="$LIBXL_CFLAGS $LIBXL_API_VERSION"
dnl If building with libxl, use the libxl utility header and lib too
AC_CHECK_HEADERS([libxlutil.h])
LIBXL_LIBS="$LIBXL_LIBS -lxlutil"
if test "x$LIBXL_FIRMWARE_DIR" != "x"; then
AC_DEFINE_UNQUOTED([LIBXL_FIRMWARE_DIR], ["$LIBXL_FIRMWARE_DIR"], [directory containing Xen firmware blobs])
fi
if test "x$LIBXL_EXECBIN_DIR" != "x"; then
AC_DEFINE_UNQUOTED([LIBXL_EXECBIN_DIR], ["$LIBXL_EXECBIN_DIR"], [directory containing Xen libexec binaries])
fi
dnl Check if the xtl_* infrastructure is in libxentoollog
dnl (since Xen 4.7) if not then assume it is in libxenctrl
dnl (as it was for 4.6 and earler)
AC_CHECK_LIB([xentoollog], [xtl_createlogger_stdiostream], [
LIBXL_LIBS="$LIBXL_LIBS -lxenstore -lxentoollog"
],[
LIBXL_LIBS="$LIBXL_LIBS -lxenstore -lxenctrl"
])
fi
dnl Check if Xen has support for PVH
AC_CHECK_DECL(LIBXL_DOMAIN_TYPE_PVH, [AC_DEFINE([HAVE_XEN_PVH], [1], [Define to 1 if Xen has PVH support.])], [], [#include <libxl.h>])
AC_SUBST([LIBXL_CFLAGS])
AC_SUBST([LIBXL_LIBS])
])
AC_DEFUN([LIBVIRT_RESULT_LIBXL], [
LIBVIRT_RESULT_LIB([LIBXL])
])
AC_DEFUN([LIBVIRT_DRIVER_RESULT_LIBXL], [
LIBVIRT_RESULT([libxl], [$with_libxl])
])

View File

@ -1617,6 +1617,57 @@ elif get_option('driver_hyperv').enabled()
error('openwsman is required for the Hyper-V driver')
endif
if not get_option('driver_libxl').disabled() and conf.has('WITH_LIBVIRTD')
libxl_version = '4.6.0'
libxl_dep = dependency('xenlight', version: '>=' + libxl_version, required: get_option('driver_libxl'))
if libxl_dep.found()
libxl_firmware_dir = libxl_dep.get_pkgconfig_variable('xenfirmwaredir')
libxl_execbin = libxl_dep.get_pkgconfig_variable('libexec_bin')
if libxl_firmware_dir != ''
conf.set_quoted('LIBXL_FIRMWARE_DIR', libxl_firmware_dir)
endif
if libxl_execbin != ''
conf.set_quoted('LIBXL_EXECBIN_DIR', libxl_execbin)
endif
# If building with libxl, use the libxl utility header and lib too
if cc.has_header('libxlutil.h')
conf.set('HAVE_LIBXLUTIL_H', 1)
endif
xl_util_dep = cc.find_library('xlutil')
xen_store_dep = cc.find_library('xenstore')
# xtl_* infrastructure is in libxentoollog since Xen 4.7 previously
# it was in libxenctrl.
if libxl_dep.version().version_compare('>=4.7.0')
xtl_link_dep = cc.find_library('xentoollog')
else
xtl_link_dep = cc.find_library('xenctrl')
endif
libxl_dep = declare_dependency(
compile_args: '-DLIBXL_API_VERSION=0x040500',
dependencies: [
libxl_dep,
xtl_link_dep,
xl_util_dep,
xen_store_dep,
],
)
# Check if Xen has support for PVH
if cc.has_header_symbol('libxl.h', 'LIBXL_DOMAIN_TYPE_PVH')
conf.set('HAVE_XEN_PVH', 1)
endif
conf.set('WITH_LIBXL', 1)
endif
elif get_option('driver_libxl').enabled()
error('libvirtd is required for libxenlight')
endif
# define top include directory
@ -1637,6 +1688,7 @@ configure_file(output: 'meson-config.h', configuration: conf)
# print configuration summary
driver_summary = {
'libxl': conf.has('WITH_LIBXL'),
'ESX': conf.has('WITH_ESX'),
'Hyper-V': conf.has('WITH_HYPERV'),
'Bhyve': conf.has('WITH_BHYVE'),

View File

@ -52,5 +52,6 @@ option('driver_bhyve', type: 'feature', value: 'auto', description: 'bhyve drive
option('driver_esx', type: 'feature', value: 'enabled', description: 'esx driver')
option('driver_hyperv', type: 'feature', value: 'auto', description: 'Hyper-V driver')
option('driver_libvirtd', type: 'feature', value: 'auto', description: 'libvirtd driver')
option('driver_libxl', type: 'feature', value: 'auto', description: 'libxenlight driver')
option('driver_remote', type: 'feature', value: 'enabled', description: 'remote driver')
option('remote_default_mode', type: 'combo', choices: ['legacy', 'direct'], value: 'legacy', description: 'remote driver default mode')