[libvirt PATCH 082/351] meson: add BHyVe build option

Pavel Hrdina phrdina at redhat.com
Thu Jul 16 09:55:18 UTC 2020


Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
---
 configure.ac            |  3 ---
 m4/virt-driver-bhyve.m4 | 56 -----------------------------------------
 meson.build             | 16 ++++++++++++
 meson_options.txt       |  1 +
 4 files changed, 17 insertions(+), 59 deletions(-)
 delete mode 100644 m4/virt-driver-bhyve.m4

diff --git a/configure.ac b/configure.ac
index 25250fd2c4c..155d7495840 100644
--- a/configure.ac
+++ b/configure.ac
@@ -116,7 +116,6 @@ LIBVIRT_DRIVER_ARG_LIBXL
 LIBVIRT_DRIVER_ARG_VBOX
 LIBVIRT_DRIVER_ARG_LXC
 LIBVIRT_DRIVER_ARG_VZ
-LIBVIRT_DRIVER_ARG_BHYVE
 LIBVIRT_DRIVER_ARG_ESX
 LIBVIRT_DRIVER_ARG_HYPERV
 LIBVIRT_DRIVER_ARG_TEST
@@ -130,7 +129,6 @@ LIBVIRT_DRIVER_CHECK_LIBXL
 LIBVIRT_DRIVER_CHECK_VBOX
 LIBVIRT_DRIVER_CHECK_LXC
 LIBVIRT_DRIVER_CHECK_VZ
-LIBVIRT_DRIVER_CHECK_BHYVE
 LIBVIRT_DRIVER_CHECK_ESX
 LIBVIRT_DRIVER_CHECK_HYPERV
 LIBVIRT_DRIVER_CHECK_TEST
@@ -338,7 +336,6 @@ LIBVIRT_DRIVER_RESULT_LXC
 LIBVIRT_DRIVER_RESULT_ESX
 LIBVIRT_DRIVER_RESULT_HYPERV
 LIBVIRT_DRIVER_RESULT_VZ
-LIBVIRT_DRIVER_RESULT_BHYVE
 LIBVIRT_DRIVER_RESULT_TEST
 LIBVIRT_DRIVER_RESULT_NETWORK
 LIBVIRT_DRIVER_RESULT_INTERFACE
diff --git a/m4/virt-driver-bhyve.m4 b/m4/virt-driver-bhyve.m4
deleted file mode 100644
index 14b30c0b3e7..00000000000
--- a/m4/virt-driver-bhyve.m4
+++ /dev/null
@@ -1,56 +0,0 @@
-dnl The bhyve driver
-dnl
-dnl Copyright (C) 2014 Roman Bogorodskiy
-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_BHYVE],[
-    LIBVIRT_ARG_WITH_FEATURE([BHYVE], [BHyVe], [check])
-])
-
-AC_DEFUN([LIBVIRT_DRIVER_CHECK_BHYVE],[
-    if test "$with_bhyve" != "no"; then
-        AC_PATH_PROG([BHYVE], [bhyve], [], [$PATH:/usr/sbin])
-        AC_PATH_PROG([BHYVECTL], [bhyvectl], [], [$PATH:/usr/sbin])
-        AC_PATH_PROG([BHYVELOAD], [bhyveload], [], [$PATH:/usr/sbin/])
-
-        if test -z "$BHYVE" || test -z "$BHYVECTL" || \
-            test -z "$BHYVELOAD" || test "$with_freebsd" = "no"; then
-            if test "$with_bhyve" = "check"; then
-                with_bhyve="no"
-            else
-                AC_MSG_ERROR([The bhyve driver cannot be enabled])
-            fi
-        else
-            with_bhyve="yes"
-        fi
-    fi
-
-    if test "$with_bhyve" = "yes"; then
-        AC_DEFINE_UNQUOTED([WITH_BHYVE], 1, [whether bhyve driver is enabled])
-        AC_DEFINE_UNQUOTED([BHYVE], ["$BHYVE"],
-                           [Location of the bhyve tool])
-        AC_DEFINE_UNQUOTED([BHYVECTL], ["$BHYVECTL"],
-                           [Location of the bhyvectl tool])
-        AC_DEFINE_UNQUOTED([BHYVELOAD], ["$BHYVELOAD"],
-                           [Location of the bhyveload tool])
-    fi
-    AM_CONDITIONAL([WITH_BHYVE], [test "$with_bhyve" = "yes"])
-])
-
-AC_DEFUN([LIBVIRT_DRIVER_RESULT_BHYVE],[
-    LIBVIRT_RESULT([Bhyve], [$with_bhyve])
-])
diff --git a/meson.build b/meson.build
index 4aae01f62e5..5d9eb1142d0 100644
--- a/meson.build
+++ b/meson.build
@@ -1571,6 +1571,21 @@ if not get_option('driver_libvirtd').disabled()
   endif
 endif
 
+if not get_option('driver_bhyve').disabled() and host_machine.system() == 'freebsd'
+  bhyve_prog = find_program('bhyve', required: get_option('driver_bhyve'))
+  bhyvectl_prog = find_program('bhyvectl', required: get_option('driver_bhyve'))
+  bhyveload_prog = find_program('bhyveload', required: get_option('driver_bhyve'))
+
+  if bhyve_prog.found() and bhyvectl_prog.found() and bhyveload_prog.found()
+    conf.set('WITH_BHYVE', 1)
+    conf.set_quoted('BHYVE', bhyve_prog.path())
+    conf.set_quoted('BHYVECTL', bhyvectl_prog.path())
+    conf.set_quoted('BHYVELOAD', bhyveload_prog.path())
+  endif
+elif get_option('driver_bhyve').enabled()
+  error('The bhyve driver cannot be enabled')
+endif
+
 
 # define top include directory
 
@@ -1591,6 +1606,7 @@ configure_file(output: 'meson-config.h', configuration: conf)
 # print configuration summary
 
 driver_summary = {
+  'Bhyve': conf.has('WITH_BHYVE'),
   'Remote': conf.has('WITH_REMOTE'),
   'Libvirtd': conf.has('WITH_LIBVIRTD'),
 }
diff --git a/meson_options.txt b/meson_options.txt
index 8731f78defe..0e1b43b8350 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -47,6 +47,7 @@ option('yajl', type: 'feature', value: 'auto', description: 'yajl support')
 
 
 # build driver options
+option('driver_bhyve', type: 'feature', value: 'auto', description: 'BHyVe driver')
 option('driver_libvirtd', type: 'feature', value: 'auto', description: 'libvirtd 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')
-- 
2.26.2




More information about the libvir-list mailing list