From 7147add9fedfb28909639ae419f995041d086266 Mon Sep 17 00:00:00 2001 From: Jonathan Richardson Date: Fri, 6 Apr 2018 10:49:04 -0700 Subject: [PATCH] autotools: Add option to disable installation of systemd conf files Add option to configure.ac to enable or disable install of systemd conf files. If --with-systemdsystemunitdir is passed to configure then the files will be installed to the provided directory. If the option isn't provided then the value is determined from the systemd pkgconfig file, if found in PKG_CONFIG_PATH. This change is required because Makefile.am always installed the files to a hard coded path that couldn't be changed. Signed-off-by: Jonathan Richardson --- Upstream-Status: Pending Makefile.am | 3 ++- configure.ac | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 86174e9..e90e966 100644 --- a/Makefile.am +++ b/Makefile.am @@ -141,8 +141,9 @@ install-data-hook: installdirs-local pkgconfigdir = ${libdir}/pkgconfig pkgconfig_DATA = lldpad.pc liblldp_clif.pc -systemdsystemunitdir = $(prefix)/lib/systemd/system +if HAVE_SYSTEMD dist_systemdsystemunit_DATA = lldpad.service lldpad.socket +endif bashcompletiondir = $(sysconfdir)/bash_completion.d dist_bashcompletion_DATA = contrib/bash_completion/lldpad contrib/bash_completion/lldptool diff --git a/configure.ac b/configure.ac index fa2f3a0..1a038cd 100644 --- a/configure.ac +++ b/configure.ac @@ -132,6 +132,15 @@ AC_TYPE_UINT16_T AC_TYPE_UINT32_T AC_TYPE_UINT8_T +# 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 include/version.h lldpad.spec lldpad.pc liblldp_clif.pc]) AC_CONFIG_MACRO_DIR([m4]) AC_OUTPUT