blob: b1d746f8bc5e05b007788742b87c7119ad94cd23 [file] [log] [blame]
Patrick Williams03514f12024-04-05 07:04:11 -05001From 7147add9fedfb28909639ae419f995041d086266 Mon Sep 17 00:00:00 2001
Andrew Geissler82c905d2020-04-13 13:39:40 -05002From: Jonathan Richardson <jonathan.richardson@broadcom.com>
3Date: Fri, 6 Apr 2018 10:49:04 -0700
4Subject: [PATCH] autotools: Add option to disable installation of systemd conf
5 files
6
7Add option to configure.ac to enable or disable install of systemd conf
8files. If --with-systemdsystemunitdir is passed to configure then the
9files will be installed to the provided directory. If the option isn't
10provided then the value is determined from the systemd pkgconfig file,
11if found in PKG_CONFIG_PATH.
12
13This change is required because Makefile.am always installed the files
14to a hard coded path that couldn't be changed.
15
16
17Signed-off-by: Jonathan Richardson <jonathan.richardson@broadcom.com>
18---
Patrick Williams520786c2023-06-25 16:20:36 -050019Upstream-Status: Pending
20
Andrew Geissler82c905d2020-04-13 13:39:40 -050021 Makefile.am | 3 ++-
22 configure.ac | 9 +++++++++
23 2 files changed, 11 insertions(+), 1 deletion(-)
24
25diff --git a/Makefile.am b/Makefile.am
Patrick Williams03514f12024-04-05 07:04:11 -050026index 86174e9..e90e966 100644
Andrew Geissler82c905d2020-04-13 13:39:40 -050027--- a/Makefile.am
28+++ b/Makefile.am
Patrick Williams03514f12024-04-05 07:04:11 -050029@@ -141,8 +141,9 @@ install-data-hook: installdirs-local
Andrew Geissler82c905d2020-04-13 13:39:40 -050030 pkgconfigdir = ${libdir}/pkgconfig
31 pkgconfig_DATA = lldpad.pc liblldp_clif.pc
32
33-systemdsystemunitdir = $(prefix)/lib/systemd/system
34+if HAVE_SYSTEMD
35 dist_systemdsystemunit_DATA = lldpad.service lldpad.socket
36+endif
37
38 bashcompletiondir = $(sysconfdir)/bash_completion.d
39 dist_bashcompletion_DATA = contrib/bash_completion/lldpad contrib/bash_completion/lldptool
40diff --git a/configure.ac b/configure.ac
Patrick Williams03514f12024-04-05 07:04:11 -050041index fa2f3a0..1a038cd 100644
Andrew Geissler82c905d2020-04-13 13:39:40 -050042--- a/configure.ac
43+++ b/configure.ac
Patrick Williams03514f12024-04-05 07:04:11 -050044@@ -132,6 +132,15 @@ AC_TYPE_UINT16_T
Andrew Geissler82c905d2020-04-13 13:39:40 -050045 AC_TYPE_UINT32_T
46 AC_TYPE_UINT8_T
47
48+# Support for systemd unit files.
49+AC_ARG_WITH([systemdsystemunitdir],
50+ AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
51+ [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
52+if test "x$with_systemdsystemunitdir" != xno; then
53+ AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
54+fi
55+AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])
56+
57 AC_CONFIG_FILES([Makefile include/version.h lldpad.spec lldpad.pc liblldp_clif.pc])
58 AC_CONFIG_MACRO_DIR([m4])
59 AC_OUTPUT