[libvirt PATCH 118/351] meson: add init_script build option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
 configure.ac           |  3 ---
 m4/virt-init-script.m4 | 61 ------------------------------------------
 meson.build            | 15 +++++++++++
 meson_options.txt      |  1 +
 4 files changed, 16 insertions(+), 64 deletions(-)
 delete mode 100644 m4/virt-init-script.m4

diff --git a/configure.ac b/configure.ac
index eaa7b57380e..e73b3f617ca 100644
--- a/configure.ac
+++ b/configure.ac
@@ -98,14 +98,12 @@ dnl Miscellaneous checks
 dnl
 
 LIBVIRT_ARG_NUMAD
-LIBVIRT_ARG_INIT_SCRIPT
 LIBVIRT_ARG_LOGIN_SHELL
 LIBVIRT_ARG_TLS_PRIORITY
 LIBVIRT_ARG_SYSCTL_CONFIG
 
 
 LIBVIRT_CHECK_NUMAD
-LIBVIRT_CHECK_INIT_SCRIPT
 LIBVIRT_CHECK_LOGIN_SHELL
 LIBVIRT_CHECK_TLS_PRIORITY
 LIBVIRT_CHECK_SYSCTL_CONFIG
@@ -178,7 +176,6 @@ AC_MSG_NOTICE([])
 AC_MSG_NOTICE([Miscellaneous])
 AC_MSG_NOTICE([])
 LIBVIRT_RESULT_NUMAD
-LIBVIRT_RESULT_INIT_SCRIPT
 LIBVIRT_RESULT_LOGIN_SHELL
 LIBVIRT_RESULT_TLS_PRIORITY
 AC_MSG_NOTICE([])
diff --git a/m4/virt-init-script.m4 b/m4/virt-init-script.m4
deleted file mode 100644
index 676135866f9..00000000000
--- a/m4/virt-init-script.m4
+++ /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])
-])
diff --git a/meson.build b/meson.build
index ece7c90e26d..e9186e38cfd 100644
--- a/meson.build
+++ b/meson.build
@@ -2086,6 +2086,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
 
@@ -2211,6 +2225,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,
   'Default Editor': conf.get_unquoted('DEFAULT_EDITOR'),
   'virt-host-validate': conf.has('WITH_HOST_VALIDATE'),
diff --git a/meson_options.txt b/meson_options.txt
index 80a11df4679..0e7b6659e2f 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -95,3 +95,4 @@ option('debug_logs', type: 'boolean', value: true, description: 'enable debuggin
 option('default_editor', type: 'string', value: 'vi', description: 'Editor to use for interactive commands')
 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')
-- 
2.26.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux