aboutsummaryrefslogtreecommitdiffstats
path: root/meta-networking/recipes-protocols/openlldp/files/0001-autotools-Add-option-to-disable-installation-of-syst.patch
blob: a26a5299abea8d51040c134b74c98dbe26c8880b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
From dc3f2250908587710f109c80ddf8a94f0bc40b82 Mon Sep 17 00:00:00 2001
From: Jonathan Richardson <jonathan.richardson@broadcom.com>
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 <jonathan.richardson@broadcom.com>
---
 Makefile.am  | 3 ++-
 configure.ac | 9 +++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index 292c0fd..0fb9bb0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -138,8 +138,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 0667446..f75f433 100644
--- a/configure.ac
+++ b/configure.ac
@@ -95,6 +95,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