commit 8ab6f4b718eae5f4b3be53177ff91d857dbc1c75
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date:   Sun Mar 11 16:24:29 2018 +0100

    Add systemd service file

diff --git a/Makefile.am b/Makefile.am
index d806c3dd..37bb15c9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -11,6 +11,13 @@ EXTRA_DIST= config.rpath ANNOUNCE BUGS FAQ README.packagers README.translators R
 
 MAINTAINERCLEANFILES=configure
 
+nodist_systemdsystemunit_DATA = \
+	speech-dispatcherd.service
+CLEANFILES = \
+	speech-dispatcherd.service
+%.service: %.service.in
+	$(AM_V_GEN)sed -e 's,@bindir\@,$(bindir),g' $< > $@
+
 testinstall: install check
 	cd src/tests && $(MAKE) $(AM_MAKEFLAGS) testinstall
 
diff --git a/configure.ac b/configure.ac
index 58e10591..7923e262 100644
--- a/configure.ac
+++ b/configure.ac
@@ -414,6 +414,15 @@ AC_SUBST([spdincludedir])
 includedir=${spdincludedir}
 AC_SUBST([includedir])
 
+# support for systemd unit files
+AC_ARG_WITH([systemdsystemunitdir],
+        AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
+        [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
+if test "x$with_systemdsystemunitdir" != xno; then
+        AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
+fi
+AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])
+
 AC_CONFIG_FILES([Makefile
                  speech-dispatcher.pc
                  config/Makefile
diff --git a/speech-dispatcherd.service.in b/speech-dispatcherd.service.in
new file mode 100644
index 00000000..142555b4
--- /dev/null
+++ b/speech-dispatcherd.service.in
@@ -0,0 +1,11 @@
+[Unit]
+Description=Speech-Dispatcher, common interface to speech synthesizers
+
+[Service]
+Type=forking
+ExecStart=@bindir@/speech-dispatcher -d
+ExecReload=/bin/kill -HUP $MAINPID
+
+[Install]
+WantedBy=multi-user.target
+Alias=speech-dispatcher.service
