]> git.proxmox.com Git - mirror_zfs.git/blobdiff - config/user-systemd.m4
OpenZFS 9185 - Enable testing over NFS in ZFS performance tests
[mirror_zfs.git] / config / user-systemd.m4
index c2105abce0ece5bd97323e545e8b5a05ab652ce3..3e6a4a281f3c9c197ef7e4cb95a9fdd4482c1e19 100644 (file)
@@ -2,7 +2,8 @@ AC_DEFUN([ZFS_AC_CONFIG_USER_SYSTEMD], [
        AC_ARG_ENABLE(systemd,
                AC_HELP_STRING([--enable-systemd],
                [install systemd unit/preset files [[default: yes]]]),
-               [],enable_systemd=yes)
+               [enable_systemd=$enableval],
+               [enable_systemd=check])
 
        AC_ARG_WITH(systemdunitdir,
                AC_HELP_STRING([--with-systemdunitdir=DIR],
@@ -17,19 +18,36 @@ AC_DEFUN([ZFS_AC_CONFIG_USER_SYSTEMD], [
        AC_ARG_WITH(systemdmodulesloaddir,
                AC_HELP_STRING([--with-systemdmodulesloaddir=DIR],
                [install systemd module load files into dir [[/usr/lib/modules-load.d]]]),
-               systemdmoduleloaddir=$withval,systemdmodulesloaddir=/usr/lib/modules-load.d)
+               systemdmodulesloaddir=$withval,systemdmodulesloaddir=/usr/lib/modules-load.d)
 
+       AC_ARG_WITH(systemdgeneratordir,
+               AC_HELP_STRING([--with-systemdgeneratordir=DIR],
+               [install systemd generators in dir [[/usr/lib/systemd/system-generators]]]),
+               systemdgeneratordir=$withval,systemdgeneratordir=/usr/lib/systemd/system-generators)
 
-       AS_IF([test "x$enable_systemd" = xyes],
-               [
+       AS_IF([test "x$enable_systemd" = xcheck], [
+               AS_IF([systemctl --version >/dev/null 2>&1],
+                       [enable_systemd=yes],
+                       [enable_systemd=no])
+       ])
+
+       AC_MSG_CHECKING(for systemd support)
+       AC_MSG_RESULT([$enable_systemd])
+
+       AS_IF([test "x$enable_systemd" = xyes], [
                ZFS_INIT_SYSTEMD=systemd
                ZFS_MODULE_LOAD=modules-load.d
+               DEFINE_SYSTEMD='--with systemd --define "_unitdir $(systemdunitdir)" --define "_presetdir $(systemdpresetdir)" --define "_generatordir $(systemdgeneratordir)"'
                modulesloaddir=$systemdmodulesloaddir
-               ])
+       ],[
+               DEFINE_SYSTEMD='--without systemd'
+       ])
 
        AC_SUBST(ZFS_INIT_SYSTEMD)
        AC_SUBST(ZFS_MODULE_LOAD)
+       AC_SUBST(DEFINE_SYSTEMD)
        AC_SUBST(systemdunitdir)
        AC_SUBST(systemdpresetdir)
+       AC_SUBST(systemdgeneratordir)
        AC_SUBST(modulesloaddir)
 ])