summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.am15
-rw-r--r--configure.ac8
-rw-r--r--src/conf_macros.m444
-rw-r--r--src/external/systemd.m48
4 files changed, 72 insertions, 3 deletions
diff --git a/Makefile.am b/Makefile.am
index b445f9c81..d8eb28d3e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -30,6 +30,7 @@ pluginpath = @pluginpath@
pidpath = @pidpath@
pipepath = @pipepath@
initdir = @initdir@
+systemdunitdir = @systemdunitdir@
logpath = @logpath@
pubconfpath = @pubconfpath@
@@ -974,6 +975,11 @@ update-po:
#######################
dist_init_SCRIPTS =
+dist_systemdunit_DATA =
+if HAVE_SYSTEMD_UNIT
+ dist_systemdunit_DATA += \
+ src/sysv/systemd/sssd.service
+else
if HAVE_SUSE
dist_init_SCRIPTS += \
src/sysv/SUSE/sssd
@@ -986,6 +992,7 @@ else
src/sysv/sssd
endif
endif
+endif
dist_sssdconf_DATA = \
@@ -1003,18 +1010,15 @@ installsssddirs::
$(DESTDIR)$(includedir) \
$(DESTDIR)$(libdir) \
$(DESTDIR)$(sbindir) \
- $(DESTDIR)$(initdir) \
$(DESTDIR)$(mandir) \
$(DESTDIR)$(pluginpath) \
$(DESTDIR)$(libdir)/ldb \
- $(DESTDIR)$(infpintrospectdir) \
$(DESTDIR)$(dbusintrospectdir) \
$(DESTDIR)$(pipepath)/private \
$(DESTDIR)$(sssdlibdir) \
$(DESTDIR)$(sssdconfdir) \
$(DESTDIR)$(dbpath) \
$(DESTDIR)$(pidpath) \
- $(DESTDIR)$(initdir) \
$(DESTDIR)$(logpath) \
$(DESTDIR)$(pubconfpath)
@@ -1041,6 +1045,11 @@ if BUILD_PYTHON_BINDINGS
fi
endif
mkdir -p doc $(DESTDIR)/$(docdir); cp -a doc $(DESTDIR)/$(docdir)/
+if HAVE_SYSTEMD_UNIT
+ mkdir -p $(DESTDIR)$(systemdunitdir)
+else
+ mkdir -p $(DESTDIR)$(initdir)
+endif
install-data-hook:
rm $(DESTDIR)/$(nsslibdir)/libnss_sss.so.2 \
diff --git a/configure.ac b/configure.ac
index f0fa07257..6a57aa4fd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -119,8 +119,12 @@ m4_include([src/external/nscd.m4])
m4_include([src/external/nsupdate.m4])
m4_include([src/external/libkeyutils.m4])
m4_include([src/external/libnl.m4])
+m4_include([src/external/systemd.m4])
m4_include([src/util/signal.m4])
+WITH_INITSCRIPT
+WITH_SYSTEMD_UNIT_DIR
+
PKG_CHECK_MODULES([DBUS],[dbus-1])
dnl if test -n "`$PKG_CONFIG --modversion dbus-1 | grep '^0\.'`" ; then
if ! $PKG_CONFIG --atleast-version 1.0.0 dbus-1; then
@@ -165,6 +169,10 @@ if test x$BUILD_LIBNL != x; then
AM_CHECK_LIBNL
fi
+if test x$HAVE_SYSTEMD_UNIT != x; then
+ AM_CHECK_SYSTEMD
+fi
+
AC_CHECK_HEADERS([sys/inotify.h])
AC_CHECK_HEADERS([sasl/sasl.h],,AC_MSG_ERROR([Could not find SASL headers]))
diff --git a/src/conf_macros.m4 b/src/conf_macros.m4
index d759c48e9..273a52704 100644
--- a/src/conf_macros.m4
+++ b/src/conf_macros.m4
@@ -100,6 +100,30 @@ AC_DEFUN([WITH_PIPE_PATH],
AC_DEFINE_UNQUOTED(PIPE_PATH, "$config_pipepath", [Where to store pipe files for the SSSD interconnects])
])
+AC_DEFUN([WITH_INITSCRIPT],
+ [ AC_ARG_WITH([initscript],
+ [AC_HELP_STRING([--with-initscript=INITSCRIPT_TYPE],
+ [Type of your init script (sysv|systemd). [sysv]]
+ )
+ ]
+ )
+ default_initscript=sysv
+ if test x"$with_initscript" = x; then
+ with_initscript=$default_initscript
+ fi
+
+ if test x"$with_initscript" = xsysv || \
+ test x"$with_initscript" = xsystemd; then
+ initscript=$with_initscript
+ else
+ AC_MSG_ERROR([Illegal value -$with_initscript- for option --with-initscript])
+ fi
+
+ AM_CONDITIONAL([HAVE_SYSV], [test x"$initscript" = xsysv])
+ AM_CONDITIONAL([HAVE_SYSTEMD_UNIT], [test x"$initscript" = xsystemd])
+ AC_MSG_NOTICE([Will use init script type: $initscript])
+ ])
+
AC_DEFUN([WITH_INIT_DIR],
[ AC_ARG_WITH([init-dir],
[AC_HELP_STRING([--with-init-dir=DIR],
@@ -117,6 +141,25 @@ AC_DEFUN([WITH_INIT_DIR],
AC_SUBST(initdir)
])
+dnl A macro to configure the directory to install the systemd unit files to
+AC_DEFUN([WITH_SYSTEMD_UNIT_DIR],
+ [ AC_ARG_WITH([systemdunitdir],
+ [ AC_HELP_STRING([--with-systemdunitdir=DIR],
+ [Directory for systemd service files [Auto]]
+ ),
+ ],
+ )
+ if test x"$with_systemdunitdir" != x; then
+ systemdunitdir=$with_systemdunitdir
+ else
+ systemdunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
+ if test x"$systemdunitdir" = x; then
+ AC_MSG_ERROR([Could not detect systemd unit directory])
+ fi
+ fi
+ AC_SUBST(systemdunitdir)
+ ])
+
AC_DEFUN([WITH_MANPAGES],
[ AC_ARG_WITH([manpages],
[AC_HELP_STRING([--with-manpages],
@@ -251,3 +294,4 @@ AC_DEFUN([WITH_LIBNL],
AC_SUBST(BUILD_LIBNL)
fi
])
+
diff --git a/src/external/systemd.m4 b/src/external/systemd.m4
new file mode 100644
index 000000000..2c26dc19b
--- /dev/null
+++ b/src/external/systemd.m4
@@ -0,0 +1,8 @@
+dnl A macro to check presence of systemd on the system
+AC_DEFUN([AM_CHECK_SYSTEMD],
+[
+ PKG_CHECK_EXISTS(systemd,
+ [ HAVE_SYSTEMD=1, AC_SUBST(HAVE_SYSTEMD) ],
+ [AC_MSG_ERROR([Could not detect systemd presence])]
+ )
+])