sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@$(ldap_subdir)
schemadir = $(sysconfdir)/schema
+systemdsystemunitdir = @systemdsystemunitdir@
PLAT = @PLAT@
EXEEXT = @EXEEXT@
builtin(include, build/openldap.m4)dnl
dnl ================================================================
+m4_ifndef([PKG_PREREQ],
+ [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
+
AC_CONFIG_AUX_DIR(build)dnl
AC_CONFIG_MACRO_DIRS([build])
dnl WiredTiger
ol_link_wt=no
if test $ol_enable_wt != no ; then
- AC_CHECK_PROG(PKGCONFIG,pkg-config,yes)
- if test "$PKGCONFIG" != yes ; then
- AC_MSG_ERROR([could not locate pkg-config])
+ PKG_CHECK_MODULES(WT, wiredtiger)
+ if test $ol_enable_wt = yes ; then
+ SLAPD_LIBS="$SLAPD_LIBS \$(WT_LIBS)"
fi
- WT_INCS=`pkg-config --cflags wiredtiger`
- WT_LIBS=`pkg-config --libs wiredtiger`
-
- save_CFLAGS="$CFLAGS"
- save_LDFLAGS="$LDFLAGS"
- CFLAGS="$WT_INCS"
- CPPFLAGS="$WT_INCS"
- LDFLAGS="$WT_LIBS"
- AC_CHECK_HEADERS([wiredtiger.h])
- AC_CHECK_LIB(wiredtiger,wiredtiger_version,[: ok],[
- AC_MSG_ERROR([could not locate wiredtiger library])
- ])
- CFLAGS="$save_CFLAGS"
- CPPFLAGS="$save_CPPFLAGS"
- LDFLAGS="$save_LDFLAGS"
- SLAPD_LIBS="$SLAPD_LIBS \$(WT_LIBS)"
ol_link_wt=yes
fi
dnl Check for systemd (only if we have a server)
dnl
WITH_SYSTEMD=no
+systemdsystemunitdir=
ol_link_systemd=no
if test $ol_enable_slapd == no && test $ol_enable_balancer != yes ; then
if test $ol_with_systemd != no ; then
AC_DEFINE(HAVE_SYSTEMD,1,[define if you have systemd])
SYSTEMD_LIBS="$ol_link_systemd"
WITH_SYSTEMD=yes
+
+ PKG_CHECK_VAR(systemdsystemunitdir, systemd, systemdsystemunitdir)
+ if test -z "$systemdsystemunitdir"; then
+ if test -d /usr/lib/systemd/system; then
+ systemdsystemunitdir=/usr/lib/systemd/system
+ else
+ systemdsystemunitdir=/lib/systemd/system
+ fi
+ fi
fi
fi
+AC_SUBST(systemdsystemunitdir)
dnl ----------------------------------------------------------------
dnl Check for entropy sources
AC_SUBST(SLAPD_SQL_LIBS)
AC_SUBST(SLAPD_SQL_INCLUDES)
-AC_SUBST(WT_INCS)
+AC_SUBST(WT_CFLAGS)
AC_SUBST(WT_LIBS)
AC_SUBST(BALANCER_INCLUDE)
BUILD_OPT = "--enable-balancer"
BUILD_SRV = @BUILD_BALANCER@
-all-local-srv: $(PROGRAMS)
+all-local-srv: $(PROGRAMS) all-cffiles
# $(LTHREAD_LIBS) must be last!
XLIBS = $(LLOADD_L)
version.o: version.c $(OBJS) $(LLOADD_L)
-install-local-srv: FORCE
+all-cffiles:
+ @if test -n "$(systemdsystemunitdir)"; then \
+ $(SED) -e "s;%LIBEXECDIR%;$(libexecdir);" \
+ $(srcdir)/lloadd.service > lloadd.service.tmp ; \
+ fi
+ touch all-cffiles
+
+clean-local-srv: FORCE
+ $(RM) *.tmp all-cffiles
+
+install-local-srv: install-lloadd install-conf
+
+install-lloadd: FORCE
-$(MKDIR) $(DESTDIR)$(libexecdir)
@-$(INSTALL) -m 700 -d $(DESTDIR)$(localstatedir)/openldap-lloadd
@( \
$(DESTDIR)$(libexecdir); \
done \
)
+
+install-conf: FORCE
+ @-$(MKDIR) $(DESTDIR)$(sysconfdir)
+ if test -n "$(systemdsystemunitdir)" && test ! -f $(DESTDIR)$(systemdsystemunitdir)/lloadd.service; then \
+ $(MKDIR) $(DESTDIR)$(systemdsystemunitdir); \
+ echo "installing lloadd.service in $(systemdsystemunitdir)"; \
+ echo "$(INSTALL) $(INSTALLFLAGS) -m 644 lloadd.service.tmp $(DESTDIR)$(systemdsystemunitdir)/lloadd.service"; \
+ $(INSTALL) $(INSTALLFLAGS) -m 644 lloadd.service.tmp $(DESTDIR)$(systemdsystemunitdir)/lloadd.service; \
+ fi
--- /dev/null
+[Unit]
+Description=LDAP Load Balancer Daemon
+After=syslog.target network-online.target
+Documentation=man:lloadd.conf
+
+[Service]
+Type=notify
+Environment="LLOADD_URLS=ldap:/// ldapi:///" "LLOADD_OPTIONS="
+EnvironmentFile=/etc/sysconfig/lloadd
+ExecStart=%LIBEXECDIR%/lloadd -d 0 -h ${LLOADD_URLS} $LLOADD_OPTIONS
+
+[Install]
+WantedBy=multi-user.target
$(SED) -e "s;%SYSCONFDIR%;$$sysconfdir;" \
-e "s;%LOCALSTATEDIR%;$$localstatedir;" \
-e "s;%MODULEDIR%;$$moduledir;" \
- $(srcdir)/slapd.conf > slapd.conf.tmp ; \
+ $(srcdir)/slapd.conf > slapd.conf.tmp || exit $$? ; \
$(SED) -e "s;%SYSCONFDIR%;$$sysconfdir;" \
-e "s;%LOCALSTATEDIR%;$$localstatedir;" \
-e "s;%MODULEDIR%;$$moduledir;" \
- $(srcdir)/slapd.ldif > slapd.ldif.tmp ; \
+ $(srcdir)/slapd.ldif > slapd.ldif.tmp || exit $$? ;
+ @if test -n "$(systemdsystemunitdir)"; then \
+ $(SED) -e "s;%LIBEXECDIR%;$(libexecdir);" \
+ $(srcdir)/slapd.service > slapd.service.tmp ; \
+ fi
touch all-cffiles
install-schema: FORCE
else \
echo "PRESERVING EXISTING CONFIGURATION FILE $(DESTDIR)$(sysconfdir)/slapd.ldif" ; \
fi
+ if test -n "$(systemdsystemunitdir)" && test ! -f $(DESTDIR)$(systemdsystemunitdir)/slapd.service; then \
+ $(MKDIR) $(DESTDIR)$(systemdsystemunitdir); \
+ echo "installing slapd.service in $(systemdsystemunitdir)"; \
+ echo "$(INSTALL) $(INSTALLFLAGS) -m 644 slapd.service.tmp $(DESTDIR)$(systemdsystemunitdir)/slapd.service"; \
+ $(INSTALL) $(INSTALLFLAGS) -m 644 slapd.service.tmp $(DESTDIR)$(systemdsystemunitdir)/slapd.service; \
+ fi
install-db-config: FORCE
@-$(MKDIR) $(DESTDIR)$(localstatedir) $(DESTDIR)$(sysconfdir)
BUILD_MOD = @BUILD_WT@
mod_DEFS = -DSLAPD_IMPORT
-MOD_DEFS = @WT_INCS@
+MOD_DEFS = @WT_CFLAGS@
MOD_LIBS = @WT_LIBS@
--- /dev/null
+[Unit]
+Description=OpenLDAP Server Daemon
+After=syslog.target network-online.target
+Documentation=man:slapd
+Documentation=man:slapd-config
+Documentation=man:slapd-mdb
+
+[Service]
+Type=notify
+Environment="SLAPD_URLS=ldap:/// ldapi:///" "SLAPD_OPTIONS="
+EnvironmentFile=/etc/sysconfig/slapd
+ExecStart=%LIBEXECDIR%/slapd -d 0 -h ${SLAPD_URLS} $SLAPD_OPTIONS
+
+[Install]
+WantedBy=multi-user.target