AC_MSG_ERROR([Please install libmpdclient and libmpdclient-devel packages])
fi
+dnl Check if we should install the systemd file:
+AC_ARG_WITH([systemd],[AS_HELP_STRING([--with-systemd],[install systemd service file])])
+AM_CONDITIONAL([INSTALL_SYSTEMD], [test "x$with_systemd" = "xyes"])
+
+dnl On Debian, may require:
+dnl sudo apt install systemd-dev
+if test "x${with_systemd}" = xyes ; then
+ dnl Check for systemd unit directory using pkgconfig:
+ PKG_CHECK_VAR([systemdsystemunitdir], [systemd], [systemdsystemunitdir])
+
+ dnl Allow users to override the path (e.g., ./configure --with-systemdsystemunitdir=/tmp)
+ AC_ARG_WITH([systemdsystemunitdir],
+ [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],
+ [with_systemdsystemunitdir=$withval], [with_systemdsystemunitdir=$systemdsystemunitdir])
+
+ dnl Make the variable available in Makefiles
+ AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
+fi
+
AC_SUBST(WARNINGCFLAGS)
AC_SUBST(ac_aux_dir)
dnl Creating output file(s)
AC_CONFIG_FILES([Makefile
+ data/Makefile
+ data/mpdstream.service
doc/Makefile
src/Makefile
])
--- /dev/null
+# This file is processed by GNU automake to generate Makefile.in
+
+systemdsystemunit_DATA = mpdstream.service
+
+systemdsystemunitdir = @systemdsystemunitdir@
+
+EXTRA_DIST = \
+ mpdstream.service
+
+CLEANFILES = *~
+
+MAINTAINERCLEANFILES = \
+ Makefile.in
--- /dev/null
+[Unit]
+Description=mpdstream service
+After=mpd.service
+StartLimitIntervalSec=60
+StartLimitBurst=5
+
+[Service]
+Type=simple
+ExecStart=@prefix@/bin/mpdstream
+Restart=on-failure
+RestartSec=10s
+
+[Install]
+WantedBy=multi-user.target