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=<path>.

Signed-off-by: Gabriel Krisman Bertazi <kris...@linux.vnet.ibm.com>
---
 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
-- 
2.1.0


------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Iprdd-devel mailing list
Iprdd-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iprdd-devel

Reply via email to