]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
systemd: install service file using `systemdsystemunit_DATA`
authorVincent Bernat <bernat@luffy.cx>
Thu, 15 Aug 2013 09:08:39 +0000 (11:08 +0200)
committerVincent Bernat <bernat@luffy.cx>
Thu, 15 Aug 2013 10:15:03 +0000 (12:15 +0200)
When there is an autoconf variable `somethingdir`, we can use
`something_DATA` in automake to install things to this directory. This
is more convenient than using local targets We still have to protect
the use of those variables with conditional macros since they can be
empty or set to no. There is also a drawback about distcheck trying to
set prefix and not expecting things to be installed outside of prefix.

Do the same thing for OS X launchd daemon configuration file.

Makefile.am
configure.ac
debian/rules
m4/args.m4
osx/Makefile.am
src/daemon/Makefile.am

index 273a4dc5348a3063fd177b59392b1db60750faac..07390fd86dcb46fdae87e52a44020e7576f8a0d4 100644 (file)
@@ -31,3 +31,9 @@ dist-hook:
        echo $(VERSION) > $(distdir)/.dist-version
 
 MOSTLYCLEANFILES = $(DX_CLEANFILES)
+
+# systemd and launchd files are not installed in the prefix, don't
+# request them for distcheck
+DISTCHECK_CONFIGURE_FLAGS = \
+        --with-systemdsystemunitdir=no \
+       --with-launchddaemonsdir=no
index 504b3569ab83f64a2eb39a021ff8ec08bef1f7e1..470f42c3dff690db0a2caea75756e01e1d368ad4 100644 (file)
@@ -179,11 +179,18 @@ if test x"$with_json" = x"yes"; then
 fi
 
 # OS X launchd support
-lldp_ARG_WITH([launchd-daemons-path], [Directory for launchd configuration file (OSX)], [/Library/LaunchDaemons])
+lldp_ARG_WITH([launchddaemonsdir], [Directory for launchd configuration file (OSX)],
+                                   [/Library/LaunchDaemons])
+AC_SUBST([launchddaemonsdir], [$with_launchddaemonsdir])
+AM_CONDITIONAL(HAVE_LAUNCHDDAEMONSDIR,
+    [test -n "$with_launchddaemonsdir" -a "x$with_launchddaemonsdir" != xno ])
 
 # Systemd
 lldp_ARG_WITH([systemdsystemunitdir], [Directory for systemd service files],
-              [$($PKG_CONFIG --variable=systemdsystemunitdir systemd || echo no)])
+              [$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
+AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
+AM_CONDITIONAL(HAVE_SYSTEMDSYSTEMUNITDIR,
+    [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])
 
 # Privsep settings
 lldp_ARG_WITH([privsep-user], [Which user to use for privilege separation], [_lldpd])
index 941649e30ddce7a6947dc22699094cbd8a4a243e..96e804ed62ced5b5333b5b3f1189669315001fe5 100755 (executable)
@@ -4,4 +4,4 @@ include /usr/share/cdbs/1/rules/debhelper.mk
 include /usr/share/cdbs/1/rules/autoreconf.mk
 include /usr/share/cdbs/1/class/autotools.mk
 
-DEB_CONFIGURE_EXTRA_FLAGS = --with-snmp --with-xml
+DEB_CONFIGURE_EXTRA_FLAGS = --with-snmp --with-xml --with-systemdsystemunitdir=/lib/systemd/system
index cc6263bd319d2cfb89ca58fb1dfd20c88f79a6e4..47d05ada044464b00db6c779344c338e4fad0ab8 100644 (file)
@@ -12,6 +12,7 @@ AC_DEFUN([lldp_ARG_WITH],[
         AC_SUBST(AS_TR_CPP([$1]), [$withval])],[
        AC_DEFINE_UNQUOTED(AS_TR_CPP([$1]), ["$3"], [$2])
         AC_SUBST(AS_TR_CPP([$1]), [$3])
+        eval with_[]m4_translit([$1], [-+.], [___]))="$3"
 ])])
 
 dnl lldp_ARG_ENABLE(name, help1, default)
index 7f34c2af802297568e1636129674829a31328f51..5e2b8fe7333366a0eeb372e821be4c620edc1a4f 100644 (file)
@@ -57,17 +57,9 @@ $(ARCHS:%=stamp-%): stamp-%: im.bernat.lldpd.plist
        touch $@
 
 # Install launchd plist
-install-data-local:
-       [ x"@LAUNCHD_DAEMONS_PATH@" = x"no" ] || install -m 0755 -d $(DESTDIR)@LAUNCHD_DAEMONS_PATH@
-       [ x"@LAUNCHD_DAEMONS_PATH@" = x"no" ] || install -m 0644 im.bernat.lldpd.plist $(DESTDIR)@LAUNCHD_DAEMONS_PATH@
-uninstall-local:
-       [ x"@LAUNCHD_DAEMONS_PATH@" = x"no" ] || rm -f $(DESTDIR)@LAUNCHD_DAEMONS_PATH@/im.bernat.lldpd.plist
-clean-local:
-       rm -rf $(ARCHS)
-       rm -rf $(PKG_DIR)
-       rm -f stamp-*
-       rm -rf pkg.1
-       rm -f ../$(PKG_NAME)
+if HAVE_LAUNCHDDAEMONSDIR
+launchddaemons_DATA = im.bernat.lldpd.plist
+endif
 
 .PHONY: pkg requirements
 
index 54dda7b1916a74f279662c8697f57e6739cf5a73..dbf380688aafc0a48da6749202cdd557f02396a4 100644 (file)
@@ -101,8 +101,6 @@ $(top_builddir)/libevent/libevent.la: $(top_srcdir)/libevent/*.c $(top_srcdir)/l
 endif
 
 ## systemd service file
-install-data-local:
-       [ x"@SYSTEMDSYSTEMUNITDIR@" = x"no" ] || install -m 0755 -d $(DESTDIR)@SYSTEMDSYSTEMUNITDIR@
-       [ x"@SYSTEMDSYSTEMUNITDIR@" = x"no" ] || install -m 0644 -d lldpd.service $(DESTDIR)@SYSTEMDSYSTEMUNITDIR@
-uninstall-local:
-       [ x"@LAUNCHD_DAEMONS_PATH@" = x"no" ] || rm -f $(DESTDIR)@SYSTEMDSYSTEMUNITDIR@/lldpd.service
+if HAVE_SYSTEMDSYSTEMUNITDIR
+systemdsystemunit_DATA = lldpd.service
+endif