meson: add init_script 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-07-16 17:36:03 +02:00
parent efbbd59bcb
commit c0a5b15d69
4 changed files with 16 additions and 64 deletions

View 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

View File

@ -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])
])

View 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'),
}

View 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')