Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 1 | From dc3f2250908587710f109c80ddf8a94f0bc40b82 Mon Sep 17 00:00:00 2001 |
| 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 | --- |
| 19 | Makefile.am | 3 ++- |
| 20 | configure.ac | 9 +++++++++ |
| 21 | 2 files changed, 11 insertions(+), 1 deletion(-) |
| 22 | |
| 23 | diff --git a/Makefile.am b/Makefile.am |
| 24 | index 292c0fd..0fb9bb0 100644 |
| 25 | --- a/Makefile.am |
| 26 | +++ b/Makefile.am |
| 27 | @@ -138,8 +138,9 @@ install-data-hook: installdirs-local |
| 28 | pkgconfigdir = ${libdir}/pkgconfig |
| 29 | pkgconfig_DATA = lldpad.pc liblldp_clif.pc |
| 30 | |
| 31 | -systemdsystemunitdir = $(prefix)/lib/systemd/system |
| 32 | +if HAVE_SYSTEMD |
| 33 | dist_systemdsystemunit_DATA = lldpad.service lldpad.socket |
| 34 | +endif |
| 35 | |
| 36 | bashcompletiondir = $(sysconfdir)/bash_completion.d |
| 37 | dist_bashcompletion_DATA = contrib/bash_completion/lldpad contrib/bash_completion/lldptool |
| 38 | diff --git a/configure.ac b/configure.ac |
| 39 | index 0667446..f75f433 100644 |
| 40 | --- a/configure.ac |
| 41 | +++ b/configure.ac |
| 42 | @@ -95,6 +95,15 @@ AC_TYPE_UINT16_T |
| 43 | AC_TYPE_UINT32_T |
| 44 | AC_TYPE_UINT8_T |
| 45 | |
| 46 | +# Support for systemd unit files. |
| 47 | +AC_ARG_WITH([systemdsystemunitdir], |
| 48 | + AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]), |
| 49 | + [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)]) |
| 50 | +if test "x$with_systemdsystemunitdir" != xno; then |
| 51 | + AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir]) |
| 52 | +fi |
| 53 | +AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ]) |
| 54 | + |
| 55 | AC_CONFIG_FILES([Makefile include/version.h lldpad.spec lldpad.pc liblldp_clif.pc]) |
| 56 | AC_CONFIG_MACRO_DIR([m4]) |
| 57 | AC_OUTPUT |