Patrick Williams | 03514f1 | 2024-04-05 07:04:11 -0500 | [diff] [blame^] | 1 | From 7147add9fedfb28909639ae419f995041d086266 Mon Sep 17 00:00:00 2001 |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 2 | From: Jonathan Richardson <jonathan.richardson@broadcom.com> |
| 3 | Date: Fri, 6 Apr 2018 10:49:04 -0700 |
| 4 | Subject: [PATCH] autotools: Add option to disable installation of systemd conf |
| 5 | files |
| 6 | |
| 7 | Add option to configure.ac to enable or disable install of systemd conf |
| 8 | files. If --with-systemdsystemunitdir is passed to configure then the |
| 9 | files will be installed to the provided directory. If the option isn't |
| 10 | provided then the value is determined from the systemd pkgconfig file, |
| 11 | if found in PKG_CONFIG_PATH. |
| 12 | |
| 13 | This change is required because Makefile.am always installed the files |
| 14 | to a hard coded path that couldn't be changed. |
| 15 | |
| 16 | |
| 17 | Signed-off-by: Jonathan Richardson <jonathan.richardson@broadcom.com> |
| 18 | --- |
Patrick Williams | 520786c | 2023-06-25 16:20:36 -0500 | [diff] [blame] | 19 | Upstream-Status: Pending |
| 20 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 21 | Makefile.am | 3 ++- |
| 22 | configure.ac | 9 +++++++++ |
| 23 | 2 files changed, 11 insertions(+), 1 deletion(-) |
| 24 | |
| 25 | diff --git a/Makefile.am b/Makefile.am |
Patrick Williams | 03514f1 | 2024-04-05 07:04:11 -0500 | [diff] [blame^] | 26 | index 86174e9..e90e966 100644 |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 27 | --- a/Makefile.am |
| 28 | +++ b/Makefile.am |
Patrick Williams | 03514f1 | 2024-04-05 07:04:11 -0500 | [diff] [blame^] | 29 | @@ -141,8 +141,9 @@ install-data-hook: installdirs-local |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 30 | 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 |
| 40 | diff --git a/configure.ac b/configure.ac |
Patrick Williams | 03514f1 | 2024-04-05 07:04:11 -0500 | [diff] [blame^] | 41 | index fa2f3a0..1a038cd 100644 |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 42 | --- a/configure.ac |
| 43 | +++ b/configure.ac |
Patrick Williams | 03514f1 | 2024-04-05 07:04:11 -0500 | [diff] [blame^] | 44 | @@ -132,6 +132,15 @@ AC_TYPE_UINT16_T |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 45 | 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 |