summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configure.ac5
-rw-r--r--extras/systemd/Makefile.am21
2 files changed, 12 insertions, 14 deletions
diff --git a/configure.ac b/configure.ac
index 5731859b388..ebc9bd8fbe5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -340,10 +340,11 @@ AC_ARG_WITH(mountutildir,
AC_SUBST(mountutildir)
AC_ARG_WITH(systemddir,
- [ --with-systemddir=DIR systemd service files in DIR @<:@/usr/lib/systemd/system@:>@],
+ [ --with-systemddir=DIR systemd service files in DIR @<:@PREFIX/lib/systemd/system@:>@],
[systemddir=$withval],
- [systemddir='/usr/lib/systemd/system'])
+ [systemddir='${prefix}/lib/systemd/system'])
AC_SUBST(systemddir)
+AM_CONDITIONAL([USE_SYSTEMD], test [ -d '/usr/lib/systemd/system' ])
AC_ARG_WITH(initdir,
[ --with-initdir=DIR init.d scripts in DIR @<:@/etc/init.d@:>@],
diff --git a/extras/systemd/Makefile.am b/extras/systemd/Makefile.am
index 82fa1aac690..5b9b117efaf 100644
--- a/extras/systemd/Makefile.am
+++ b/extras/systemd/Makefile.am
@@ -1,14 +1,11 @@
-CLEANFILES = glustereventsd.service
-EXTRA_DIST = glustereventsd.service.in
+CLEANFILES = glusterd.service glustereventsd.service
+EXTRA_DIST = glusterd.service.in glustereventsd.service.in
-SYSTEMD_DIR = @systemddir@
+if USE_SYSTEMD
+# systemddir is already defined through configure.ac
+systemd_DATA = glusterd.service
-install-exec-local:
- @if [ -d $(SYSTEMD_DIR) ]; then \
- $(mkdir_p) $(DESTDIR)$(SYSTEMD_DIR); \
- $(INSTALL_PROGRAM) glusterd.service $(DESTDIR)$(SYSTEMD_DIR)/; \
- fi
- @if [ @EVENTS_ENABLED@ = 1 ] && [ -d $(SYSTEMD_DIR) ]; then \
- $(mkdir_p) $(DESTDIR)$(SYSTEMD_DIR); \
- $(INSTALL_PROGRAM) glustereventsd.service $(DESTDIR)$(SYSTEMD_DIR)/; \
- fi
+if BUILD_EVENTS
+systemd_DATA += glustereventsd.service
+endif
+endif