]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
meson: add init_script build option
authorPavel Hrdina <phrdina@redhat.com>
Thu, 16 Jul 2020 15:36:03 +0000 (17:36 +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-init-script.m4 [deleted file]
meson.build
meson_options.txt

index 2105c5285b61f73741f2e1f98e3ee41a4499738f..b144062d8c6ffe1c7089e558b1ec95ae56aef981 100644 (file)
@@ -98,7 +98,6 @@ dnl Miscellaneous checks
 dnl
 
 LIBVIRT_ARG_NUMAD
-LIBVIRT_ARG_INIT_SCRIPT
 LIBVIRT_ARG_LOADER_NVRAM
 LIBVIRT_ARG_LOGIN_SHELL
 LIBVIRT_ARG_TLS_PRIORITY
@@ -106,7 +105,6 @@ LIBVIRT_ARG_SYSCTL_CONFIG
 
 
 LIBVIRT_CHECK_NUMAD
-LIBVIRT_CHECK_INIT_SCRIPT
 LIBVIRT_CHECK_LOADER_NVRAM
 LIBVIRT_CHECK_LOGIN_SHELL
 LIBVIRT_CHECK_TLS_PRIORITY
@@ -180,7 +178,6 @@ AC_MSG_NOTICE([])
 AC_MSG_NOTICE([Miscellaneous])
 AC_MSG_NOTICE([])
 LIBVIRT_RESULT_NUMAD
-LIBVIRT_RESULT_INIT_SCRIPT
 LIBVIRT_RESULT_LOADER_NVRAM
 LIBVIRT_RESULT_LOGIN_SHELL
 LIBVIRT_RESULT_TLS_PRIORITY
diff --git a/m4/virt-init-script.m4 b/m4/virt-init-script.m4
deleted file mode 100644 (file)
index 6761358..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-dnl Init script type
-dnl
-dnl Copyright (C) 2005-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_ARG_INIT_SCRIPT],[
-    LIBVIRT_ARG_WITH([INIT_SCRIPT],
-                     [Style of init script to install: systemd, openrc, check, none],
-                     [check])
-])
-
-AC_DEFUN([LIBVIRT_CHECK_INIT_SCRIPT],[
-    AC_MSG_CHECKING([for init script type])
-
-    if test "$with_init_script" = check && test "$cross_compiling" = yes; then
-        with_init_script=none
-    fi
-    if test "$with_init_script" = check && type systemctl >/dev/null 2>&1; then
-        with_init_script=systemd
-    fi
-    if test "$with_init_script" = check && type openrc >/dev/null 2>&1; then
-        with_init_script=openrc
-    fi
-    if test "$with_init_script" = check; then
-        with_init_script=none
-    fi
-
-    AS_CASE([$with_init_script],
-        [systemd],[],
-        [openrc],[],
-        [none],[],
-        [*],[
-            AC_MSG_ERROR([Unknown initscript flavour $with_init_script])
-        ]
-    )
-
-    AM_CONDITIONAL([LIBVIRT_INIT_SCRIPT_SYSTEMD],
-                   [test "$with_init_script" = "systemd"])
-    AM_CONDITIONAL([LIBVIRT_INIT_SCRIPT_OPENRC],
-                   [test "$with_init_script" = "openrc"])
-
-    AC_MSG_RESULT($with_init_script)
-])
-
-AC_DEFUN([LIBVIRT_RESULT_INIT_SCRIPT],[
-    LIBVIRT_RESULT([Init script], [$with_init_script])
-])
index 874b1e56968d478e752d4d89d9fc0361e42a8331..135d4408c5871cca14d1c3e9b19c05c8083f761f 100644 (file)
@@ -2098,6 +2098,20 @@ elif get_option('host_validate').enabled()
   error('virt-host-validate is not supported on Windows')
 endif
 
+if get_option('init_script') == 'check'
+  if meson.is_cross_build()
+    init_script = 'none'
+  elif find_program('systemctl', required: false).found()
+    init_script = 'systemd'
+  elif find_program('openrc', required: false).found()
+    init_script = 'openrc'
+  else
+    init_script = 'none'
+  endif
+else
+  init_script = get_option('init_script')
+endif
+
 
 # define top include directory
 
@@ -2222,6 +2236,7 @@ misc_summary = {
   'Use -Werror': cc_flags.contains('-Werror'),
   'Warning Flags': supported_cc_flags,
   'DTrace': conf.has('WITH_DTRACE_PROBES'),
+  'Init script': init_script,
   'Char device locks': chrdev_lock_files,
   'virt-host-validate': conf.has('WITH_HOST_VALIDATE'),
 }
index 67ae7caa9620b4fac7d811671476f6a34493de98..8b67aa9bc7a34d4a2d3cca5867fb6e071b19072f 100644 (file)
@@ -94,3 +94,4 @@ option('storage_zfs', type: 'feature', value: 'auto', description: 'ZFS backend
 option('chrdev_lock_files', type: 'string', value: '', description: 'location for UUCP style lock files for character devices (leave empty for default paths on some platforms)')
 option('dtrace', type: 'feature', value: 'auto', description: 'use dtrace for static probing')
 option('host_validate', type: 'feature', value: 'auto', description: 'build virt-host-validate')
+option('init_script', type: 'combo', choices: ['systemd', 'openrc', 'check', 'none'], value: 'check', description: 'Style of init script to install')