From 84fbaf7c3d91eeded2bcc7264fc5607ba625d37c Mon Sep 17 00:00:00 2001 From: Gabriel Krisman Bertazi Date: Tue, 14 Jul 2015 12:47:15 -0300 Subject: [PATCH] iprutils: Add option to enable/disable systemd files from configure script. Allow users to disable systemd support in iprutils for distros that don't support it. One can run ../configure --without-systemd to avoid building the service files. The default behavior is to build systemd files (--with-systemd) and they will be installed into %{prefix}/usr/lib/systemd/system/. But path can be overriden using --with-systemd=. Signed-off-by: Gabriel Krisman Bertazi Signed-off-by: Brian King --- Makefile.am | 6 +++++- configure.ac | 19 +++++++++++++++++++ systemd/Makefile.am | 8 +++++--- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/Makefile.am b/Makefile.am index 740841a..4636ecb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -43,7 +43,11 @@ dist_noinst_DATA = LICENSE bashcompdir = ${sysconfdir}/bash_completion.d dist_bashcomp_DATA = iprconfig-bash-completion.sh -SUBDIRS = . systemd init.d spec +SUBDIRS = . init.d spec + +if SYSTEMD +SUBDIRS += systemd +endif if SOSREPORT sosreportdir = @pythondir@/sos/plugins diff --git a/configure.ac b/configure.ac index d6b47ed..6f392ef 100644 --- a/configure.ac +++ b/configure.ac @@ -55,6 +55,25 @@ AC_ARG_ENABLE([sosreport], esac], [sosreport=true]) AM_CONDITIONAL([SOSREPORT], [test "x${sosreport}" = xtrue]) +# --with-systemd +systemdunitdir='${exec_prefix}/usr/lib/systemd/system/' +AC_ARG_WITH([systemd], + [--without-systemd Disable systemd service files.], +[case $withval in + yes) + systemd=true; + ;; + no) + systemd=false; + ;; + *) + systemd=true; + systemdunitdir="$withval" + ;; + esac], [systemd=true]) +AM_CONDITIONAL([SYSTEMD], [test "x${systemd}" = xtrue]) +AC_SUBST(systemdunitdir, ${systemdunitdir}) + ## Check for python if building with sosreport. if test "x${SOSREPORT_TRUE}" = "x"; then AM_PATH_PYTHON([2.6]) diff --git a/systemd/Makefile.am b/systemd/Makefile.am index db0b61a..b9a28c9 100644 --- a/systemd/Makefile.am +++ b/systemd/Makefile.am @@ -11,10 +11,12 @@ %.service: %.service.in sed -e 's,[@]sbindir[@],$(sbindir),g' < $< > $@ -nodist_pkgdata_DATA = iprdump.service \ +systemdunitdir = @systemdunitdir@ + +nodist_systemdunit_DATA = iprdump.service \ iprinit.service iprupdate.service -dist_pkgdata_DATA = iprdump.service.in \ +EXTRA_DIST = iprdump.service.in \ iprinit.service.in iprupdate.service.in clean-local: - rm iprdump.service iprinit.service iprupdate.service + -rm iprdump.service iprinit.service iprupdate.service