Files
xen/tools/configure.ac
T
Luis R. Rodriguez 015330004e systemd: add xen systemd service and module files
This adds the systemd xen service / module files and integrates
support into the build system.

This goes in with AX_AVAILABLE_SYSTEMD() which will enable
systemd if development libraries have been found on your
build system. If you don't have systemd on target systems
for binaries built with systemd then the binary will not
work, you must explicitly disable systemd support if you
do not want to build systemd support.

When systemd libraries are present only systems that
have booted into systemd go through the systemd initialization,
otherwise the SysVinit is used.

These are originally based on the Fedora systemd files.

Changes made from Fedora's systemd files:

  * split sockets into two files to claim different permissions
  * Use /bin/sh -c exec to for a simple launcher implementation
  * enables systemd socket activation for C xenstored and Ocaml
    oxenstored
  * use sd_notify(), so change the service to Type=notify, because of
    this we remove the PIDFile specification as we don't care for it, and let
    systemd do its magic for us, this also means we don't have to fork
    so we use --no-fork with systemd
  * defines a modules-load.d, its original source file will be shared
    between systemd and old init systems
  * simplify service files with ConditionVirtualization=xen which uses
    the built in systemd virtualization backend detection, these
    service files will not be available to start on systems that do not
    boot with xen as a hypervisor
  * use autoconf to replace @variable@ paths for us which piggy
    backs on top of the latest autoconf changes to xen
  * removes oxenstored service file in favor of a system variable which
    controls which which xentored to use at run time, we avoid multiple
    service files this way.
  * simplifies startup to not require polling on the sockets
    as initial socket management is handled by systemd, we just
    take on the socket later once anything pokes at it, a simple nc -U
    (as root) on any of the sockets files can activate the service for example.
    Anything queued up will be sent to us once we start. Socket activation
    should in theory also let us dynamically switch between xenstores but more
    importantly we could upgrade xenstored while keeping all active
    socket communication queued up, but in order to take advantage of
    this we eventually would need to remove the requirement of not being
    able to bring down the xenstored. Even though active sockets are
    supported since most libxl communication doesn't triggger a check
    on the unix socket first administrators are encouraged to enable
    the xenstored.service to triggger an initialization of the xenstored
    upon bring up. Some systems also never use unix sockets for
    communication with the xenstored and as such active sockets will
    not be used there.
  * allow for xenstored configuration through *either* of these
    configuration files:
	- /etc/sysconfig/xenstored
	- /etc/default/xenstored
    The /etc/default/xenstored will let debian based systems do
    the same, while SUSE/OpenSUSE/Fedora/RedHat can keep on chugging
    with sysconfig. We leave these files all commented out by default
    though given that for systemd we want to encourage not using them.
  * ensures we create the run directory as most systems will likely
    be using a tmpfs for run dirs for the pid files
  * Some systems define the selinux context in the systemd Option for the
    /var/lib/xenstored tmpfs:
	Options=mode=755,context="system_u:object_r:xenstored_var_lib_t:s0"
    For the upstream version we remove that and let systems specify the
    context on their system /etc/default/xenstored or /etc/sysconfig/xenstored
    $XENSTORED_MOUNT_CTX variable, with a default to none.
  * takes advantage of the shared xendomains helper for the xendomains
    service
  * Add the new dom0 that gets kicked off for disk backend access into
    its own systemd service associated to xen

We end up with these systemd files:

General requirements:

  * proc-xen.mount
  * var-lib-xenstored.mount

xenstored:

  * xenstored.service
  * xenstored.socket
  * xenstored_ro.socket
  * xenconsoled.service
  * xen-qemu-dom0-disk-backend.service.in

Optional:

  * xendomains.service
  * xen-watchdog.service

As for integration with xen, we house keep all the systemd files
under a new directory tools/hotplug/Linux/systemd/ and will be targeted
by default when building on Linux systems if systemd development
libraries are present at build time.

The systemd files will be sanitized for meta @VARIABLES@ upon
configuration and installed upon the install target. Systems that
do not use systemd can still get systemd service unit files installed
if the build system enabled systemd support, this however does not
mandate a requirement of having systemd libraries present. Old init
scripts are always installed.

If you don't specify a prefix you will end up with the services
files under /usr/local/lib/systemd/system/ by default, and systemd
modules-load.d conf files under /usr/local/lib/modules-load.d/ which
systemd does look for (although it seems this is not documented).

Distributions are expected to provide their /usr/ prefix to end up in
the more generic location upon distribution install at
/usr/lib/systemd/system/ and /usr/lib/modules-load.d/ respectively.

Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Jan Rękorajski <baggins@pld-linux.org>
Cc: M A Young <m.a.young@durham.ac.uk>
Cc: Jacek Konieczny <jajcus@jajcus.net>
Cc: xen-devel@lists.xenproject.org
Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
[ ijc -- ran autogen.sh ]
2014-08-04 14:58:24 +01:00

326 lines
10 KiB
Plaintext

# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.67])
AC_INIT([Xen Hypervisor Tools], m4_esyscmd([../version.sh ../xen/Makefile]),
[xen-devel@lists.xen.org], [xen], [http://www.xen.org/])
AC_CONFIG_SRCDIR([libxl/libxl.c])
AC_CONFIG_FILES([
../config/Tools.mk
hotplug/Linux/init.d/xencommons.in
hotplug/Linux/init.d/sysconfig.xencommons
hotplug/Linux/systemd/proc-xen.mount
hotplug/Linux/systemd/var-lib-xenstored.mount
hotplug/Linux/systemd/xenstored.socket
hotplug/Linux/systemd/xenstored_ro.socket
hotplug/Linux/systemd/xenstored.service
hotplug/Linux/systemd/xenconsoled.service
hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service
hotplug/Linux/systemd/xendomains.service
hotplug/Linux/systemd/xen-watchdog.service
])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_AUX_DIR([../])
# Check if CFLAGS, LDFLAGS, LIBS, CPPFLAGS or CPP is set and print a warning
AS_IF([test -n "$CC$CFLAGS$LDFLAGS$LIBS$CPPFLAGS$CPP"], [
AC_MSG_WARN(
[Setting CC, CFLAGS, LDFLAGS, LIBS, CPPFLAGS or CPP is not \
recommended, use PREPEND_INCLUDES, PREPEND_LIB, \
APPEND_INCLUDES and APPEND_LIB instead when possible.])
])
AC_CANONICAL_HOST
case $host_vendor in
rumpxen) CONFIG_RUMP=y; rump=true ;;
*) CONFIG_RUMP=n; rump=false ;;
esac
AC_SUBST(CONFIG_RUMP)
AC_SYS_LARGEFILE
case $ac_cv_sys_file_offset_bits in #(
no | unknown) ;;
*)
FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits
;;
esac
AC_SUBST(FILE_OFFSET_BITS)
# M4 Macro includes
m4_include([../m4/savevar.m4])
m4_include([../m4/features.m4])
m4_include([../m4/path_or_fail.m4])
m4_include([../m4/checkpolicy.m4])
m4_include([../m4/set_cflags_ldflags.m4])
m4_include([../m4/python_version.m4])
m4_include([../m4/python_devel.m4])
m4_include([../m4/ocaml.m4])
m4_include([../m4/uuid.m4])
m4_include([../m4/pkg.m4])
m4_include([../m4/curses.m4])
m4_include([../m4/pthread.m4])
m4_include([../m4/ptyfuncs.m4])
m4_include([../m4/extfs.m4])
m4_include([../m4/fetcher.m4])
m4_include([../m4/ax_compare_version.m4])
m4_include([../m4/paths.m4])
m4_include([../m4/xenstored.m4])
m4_include([../m4/systemd.m4])
AX_XEN_EXPAND_CONFIG()
# Enable/disable options
AX_ARG_DEFAULT_DISABLE([githttp], [Download GIT repositories via HTTP])
AX_ARG_DEFAULT_ENABLE([monitors], [Disable xenstat and xentop monitoring tools])
AX_ARG_DEFAULT_ENABLE([ocamltools], [Disable Ocaml tools])
AX_ARG_DEFAULT_ENABLE([xsmpolicy], [Disable XSM policy compilation])
AX_ARG_DEFAULT_DISABLE([ovmf], [Enable OVMF])
AX_ARG_DEFAULT_ENABLE([seabios], [Disable SeaBIOS])
AX_ARG_DEFAULT_ENABLE([debug], [Disable debug build of tools])
AX_ARG_DEFAULT_DISABLE([blktap1], [Enable blktap1 tools])
dnl Enable blktap2 on Linux only.
AC_ARG_ENABLE([blktap2],
AS_HELP_STRING([--enable-blktap2],
[Enable blktap2, (DEFAULT is on for Linux, otherwise off)]),,[
case "$host_os" in
linux*)
enable_blktap2="yes";;
*) enable_blktap2="no";;
esac
])
AS_IF([test "x$enable_blktap2" = "xyes"], [
AC_DEFINE([HAVE_BLKTAP2], [1], [Blktap2 enabled])
blktap2=y],[
blktap2=n
])
AC_SUBST(blktap2)
AC_ARG_ENABLE([qemu-traditional],
AS_HELP_STRING([--enable-qemu-traditional],
[Enable qemu traditional device model, (DEFAULT is on for Linux or NetBSD x86, otherwise off)]),,[
case "$host_cpu" in
i[[3456]]86|x86_64)
enable_qemu_traditional="yes";;
*) enable_qemu_traditional="no";;
esac
case "$host_os" in
freebsd*)
enable_qemu_traditional="no";;
esac
])
AS_IF([test "x$enable_qemu_traditional" = "xyes"], [
AC_DEFINE([HAVE_QEMU_TRADITIONAL], [1], [Qemu traditional enabled])
qemu_traditional=y],[
qemu_traditional=n
])
AC_SUBST(qemu_traditional)
AC_ARG_ENABLE([rombios],
AS_HELP_STRING([--enable-rombios],
[Enable ROMBIOS, (DEFAULT is on if qemu-traditional is enabled, otherwise off)]),,[
AS_IF([test "x$enable_qemu_traditional" = "xyes"], [
enable_rombios="yes"
], [
enable_rombios="no"
])
])
AS_IF([test "x$enable_rombios" = "xyes"], [
AC_DEFINE([HAVE_ROMBIOS], [1], [ROMBIOS enabled])
rombios=y],[
rombios=n
])
AC_SUBST(rombios)
AC_ARG_WITH([system-qemu],
AS_HELP_STRING([--with-system-qemu@<:@=PATH@:>@],
[Use system supplied qemu PATH or qemu (taken from $PATH) as qemu-xen
device model instead of building and installing our own version]),[
case $withval in
yes) qemu_xen=n ; qemu_xen_path=qemu ;;
no) qemu_xen=y ; qemu_xen_path= ;;
*) qemu_xen=n ; qemu_xen_path=$withval ;;
esac
],[
case "$host_cpu" in
i[[3456]]86|x86_64)
qemu_xen=y;;
*) qemu_xen=n;;
esac
])
AS_IF([test "x$qemu_xen" = "xn"], [
AC_DEFINE_UNQUOTED([QEMU_XEN_PATH], ["$qemu_xen_path"], [Qemu Xen path])
])
AC_SUBST(qemu_xen)
AC_ARG_WITH([system-seabios],
AS_HELP_STRING([--with-system-seabios@<:@=PATH@:>@],
[Use system supplied seabios PATH instead of building and installing
our own version]),[
case $withval in
no) seabios_path= ;;
*) seabios_path=$withval ;;
esac
],[])
AC_SUBST(seabios_path)
AC_ARG_WITH([system-ovmf],
AS_HELP_STRING([--with-system-ovmf@<:@=PATH@:>@],
[Use system supplied OVMF PATH instead of building and installing
our own version]),[
case $withval in
no) ovmf_path= ;;
*) ovmf_path=$withval ;;
esac
],[])
AC_SUBST(ovmf_path)
AC_ARG_WITH([extra-qemuu-configure-args],
AS_HELP_STRING([--with-extra-qemuu-configure-args@<:@="--ARG1 ..."@:>@],
[List of additional configure options for upstream qemu]),[
case $withval in
no) EXTRA_QEMUU_CONFIGURE_ARGS= ;;
*) EXTRA_QEMUU_CONFIGURE_ARGS=$withval ;;
esac
],[])
AC_SUBST(EXTRA_QEMUU_CONFIGURE_ARGS)
AC_ARG_VAR([PREPEND_INCLUDES],
[List of include folders to prepend to CFLAGS (without -I)])
AC_ARG_VAR([PREPEND_LIB],
[List of library folders to prepend to LDFLAGS (without -L)])
AC_ARG_VAR([APPEND_INCLUDES],
[List of include folders to append to CFLAGS (without -I)])
AC_ARG_VAR([APPEND_LIB],
[List of library folders to append to LDFLAGS (without -L)])
AX_SET_FLAGS
AC_ARG_VAR([PYTHON], [Path to the Python parser])
AC_ARG_VAR([PERL], [Path to Perl parser])
AC_ARG_VAR([BISON], [Path to Bison parser generator])
AC_ARG_VAR([FLEX], [Path to Flex lexical analyser generator])
AC_ARG_VAR([CURL], [Path to curl-config tool])
AC_ARG_VAR([XML], [Path to xml2-config tool])
AC_ARG_VAR([BASH], [Path to bash shell])
AC_ARG_VAR([XGETTEXT], [Path to xgetttext tool])
AC_ARG_VAR([AS86], [Path to as86 tool])
AC_ARG_VAR([LD86], [Path to ld86 tool])
AC_ARG_VAR([BCC], [Path to bcc tool])
AC_ARG_VAR([IASL], [Path to iasl tool])
# Checks for programs.
AC_PROG_CC
AC_PROG_MAKE_SET
AC_PROG_INSTALL
AC_PATH_PROG([BISON], [bison])
AC_PATH_PROG([FLEX], [flex])
AX_PATH_PROG_OR_FAIL([PERL], [perl])
AC_PROG_OCAML
AC_PROG_FINDLIB
AX_XENSTORE_OPTIONS
AX_XENSTORE_SET
AS_IF([test "x$ocamltools" = "xy"], [
AS_IF([test "x$OCAMLC" = "xno" || test "x$OCAMLFIND" = "xno"], [
AS_IF([test "x$enable_ocamltools" = "xyes"], [
AC_MSG_ERROR([Ocaml tools enabled, but unable to find Ocaml])])
ocamltools="n"
], [
AX_COMPARE_VERSION([$OCAMLVERSION], [lt], [3.09.3], [
AS_IF([test "x$enable_ocamltools" = "xyes"], [
AC_MSG_ERROR([Your version of OCaml: $OCAMLVERSION is not supported])])
ocamltools="n"
])
])
])
AS_IF([test "x$xsmpolicy" = "xy"], [
AC_PROG_CHECKPOLICY
AS_IF([test "x$CHECKPOLICY" = "xno"], [
AS_IF([test "x$enable_xsmpolicy" = "xyes"], [
AC_MSG_ERROR([XSM policy compilation enabled, but unable to find checkpolicy])])
xsmpolicy="n"
])
])
AX_PATH_PROG_OR_FAIL([BASH], [bash])
AS_IF([echo "$PYTHON" | grep -q "^/"], [
PYTHONPATH=$PYTHON
PYTHON=`basename $PYTHONPATH`
],[test -z "$PYTHON"], [PYTHON="python"],
[AC_MSG_ERROR([PYTHON specified, but is not an absolute path])])
AX_PATH_PROG_OR_FAIL([PYTHONPATH], [$PYTHON])
AX_CHECK_PYTHON_VERSION([2], [3])
AS_IF([test "$cross_compiling" != yes], [
AX_CHECK_PYTHON_DEVEL()
])
if ! $rump; then
AX_PATH_PROG_OR_FAIL([XGETTEXT], [xgettext])
dnl as86, ld86, bcc and iasl are only required when the host system is x86*.
dnl "host" here means the platform on which the hypervisor and tools is
dnl going to run, not the platform on which we are building (known as
dnl "build" in gnu speak).
case "$host_cpu" in
i[[3456]]86|x86_64)
AX_PATH_PROG_OR_FAIL([AS86], [as86])
AX_PATH_PROG_OR_FAIL([LD86], [ld86])
AX_PATH_PROG_OR_FAIL([BCC], [bcc])
AX_PATH_PROG_OR_FAIL([IASL], [iasl])
;;
esac
AX_CHECK_UUID
AX_CHECK_CURSES
PKG_CHECK_MODULES(glib, [glib-2.0 >= 2.12])
AX_CHECK_FETCHER
# Checks for libraries.
AC_CHECK_HEADER([bzlib.h], [
AC_CHECK_LIB([bz2], [BZ2_bzDecompressInit], [zlib="$zlib -DHAVE_BZLIB -lbz2"])
])
AC_CHECK_HEADER([lzma.h], [
AC_CHECK_LIB([lzma], [lzma_stream_decoder], [zlib="$zlib -DHAVE_LZMA -llzma"])
])
AC_CHECK_HEADER([lzo/lzo1x.h], [
AC_CHECK_LIB([lzo2], [lzo1x_decompress], [zlib="$zlib -DHAVE_LZO1X -llzo2"])
])
AC_SUBST(zlib)
AS_IF([test "x$enable_blktap1" = "xyes" || test "x$enable_blktap2" = "xyes"], [
AC_CHECK_LIB([aio], [io_setup], [], [AC_MSG_ERROR([Could not find libaio])])
])
AC_SUBST(system_aio)
AC_CHECK_LIB([crypto], [MD5], [], [AC_MSG_ERROR([Could not find libcrypto])])
AX_CHECK_EXTFS
AC_CHECK_LIB([gcrypt], [gcry_md_hash_buffer], [libgcrypt="y"], [libgcrypt="n"])
AC_SUBST(libgcrypt)
AX_CHECK_PTHREAD
AX_CHECK_PTYFUNCS
AC_CHECK_LIB([yajl], [yajl_alloc], [],
[AC_MSG_ERROR([Could not find yajl])])
AC_CHECK_LIB([z], [deflateCopy], [], [AC_MSG_ERROR([Could not find zlib])])
AC_CHECK_LIB([iconv], [libiconv_open], [libiconv="y"], [libiconv="n"])
AC_SUBST(libiconv)
# FDT is needed only on ARM
case "$host_cpu" in
arm*|aarch64)
AC_CHECK_LIB([fdt], [fdt_create], [], [AC_MSG_ERROR([Could not find libfdt])])
esac
# Checks for header files.
AC_CHECK_HEADERS([yajl/yajl_version.h sys/eventfd.h valgrind/memcheck.h utmp.h])
fi # ! $rump
AX_AVAILABLE_SYSTEMD()
AC_OUTPUT()