]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
meson: add bhyve build option
authorPavel Hrdina <phrdina@redhat.com>
Wed, 29 Apr 2020 22:56:50 +0000 (00:56 +0200)
committerPavel Hrdina <phrdina@redhat.com>
Mon, 3 Aug 2020 07:27:00 +0000 (09:27 +0200)
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
configure.ac
m4/virt-driver-bhyve.m4 [deleted file]
meson.build
meson_options.txt

index cdd13bea02ab4611144f664495e3fd1e3d60c81e..5e7b7d97fa10ab2f4aa423aa36ef6bbd635b631d 100644 (file)
@@ -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
@@ -336,7 +334,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 (file)
index 14b30c0..0000000
+++ /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])
-])
index 881e8981a7b78d98a7951b73aaafe161718dd357..cee6f4873ba3b49460396ee62a3062f0da0aa4fe 100644 (file)
@@ -1589,6 +1589,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
 
@@ -1609,6 +1624,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'),
 }
index 571b5ff66be7d9c2a937badbb7c731dbb42c5342..d933a40b0f4139d24b00f25e6412b25a77818625 100644 (file)
@@ -48,6 +48,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')