]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
Correct method to determine systemd unit path 184/head
authordantheperson <dantheperson@gmail.com>
Mon, 21 Dec 2015 11:40:24 +0000 (00:40 +1300)
committerdantheperson <dantheperson@gmail.com>
Mon, 21 Dec 2015 11:40:24 +0000 (00:40 +1300)
As recomended by debain maintainers and
http://www.freedesktop.org/software/systemd/man/daemon.html#Installing%20Systemd%20Service%20Files

Makefile.am
configure.ac

index fcf68059430a92f14acb992ba0d0b7b8d1d75463..f576001d20915ba4b23da85c9eaa47c51b6d5886 100644 (file)
@@ -61,6 +61,6 @@ if INSTALL_SYSTEMV
        [ -f $(DESTDIR)/etc/init.d/shairport-sync ] || cp scripts/shairport-sync $(DESTDIR)/etc/init.d/
 endif
 if INSTALL_SYSTEMD
-       [ -e $(DESTDIR)/usr/lib/systemd/system ] || mkdir -p $(DESTDIR)/usr/lib/systemd/system
-       cp scripts/shairport-sync.service $(DESTDIR)/usr/lib/systemd/system
+       [ -e $(DESTDIR)$(systemdsystemunitdir) ] || mkdir -p $(DESTDIR)$(systemdsystemunitdir)
+       cp scripts/shairport-sync.service $(DESTDIR)$(systemdsystemunitdir)
 endif
index dcaabbb48646245c0680ffcf65004a890521204c..cf3cb22ceb0b92e7c203ccffc67ce292277496af 100644 (file)
@@ -213,6 +213,22 @@ AC_ARG_WITH(dns_sd, [  --with-dns_sd = choose dns_sd mDNS support], [
   AC_SEARCH_LIBS([DNSServiceRefDeallocate], [dns_sd], , AC_MSG_ERROR(dns_sd support requires the dns_sd library!))], )
 AM_CONDITIONAL([USE_DNS_SD], [test "x$HAS_DNS_SD" = "x1"])
 
+# Find systemd unit dir
+AC_ARG_WITH([systemdsystemunitdir],
+     [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],,
+     [with_systemdsystemunitdir=auto])
+AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], [
+     def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
+
+     AS_IF([test "x$def_systemdsystemunitdir" = "x"],
+   [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"],
+    [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])])
+    with_systemdsystemunitdir=no],
+   [with_systemdsystemunitdir="$def_systemdsystemunitdir"])])
+AS_IF([test "x$with_systemdsystemunitdir" != "xno"],
+      [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])])
+AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"])
+
 # Checks for header files.
 AC_HEADER_STDC
 AC_CHECK_HEADERS([getopt_long.h])