Add --enable-sosreport=[yes|no] option to configure script to let user
enable/disable this feature.  This is required because distros might
want to disable it or maybe they just don't support sosreport
and... well, there is OBS.

Signed-off-by: Gabriel Krisman Bertazi <kris...@linux.vnet.ibm.com>
---
 Makefile.am  |  2 ++
 configure.ac | 22 +++++++++++++++++++++-
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index ea3e115..740841a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -45,5 +45,7 @@ dist_bashcomp_DATA = iprconfig-bash-completion.sh
 
 SUBDIRS = . systemd init.d spec
 
+if SOSREPORT
 sosreportdir = @pythondir@/sos/plugins
 sosreport_PYTHON = iprutils.py
+endif
diff --git a/configure.ac b/configure.ac
index a99b519..d6b47ed 100644
--- a/configure.ac
+++ b/configure.ac
@@ -17,7 +17,6 @@ AC_CONFIG_MACRO_DIR([build-aux])
 AC_PROG_CC
 AC_PROG_INSTALL
 LT_INIT
-AM_PATH_PYTHON([2.6])
 
 ncurses_include=$(ncurses5-config --cflags)
 if test -n ${ncurses_include}; then
@@ -40,6 +39,27 @@ AC_ARG_ENABLE([build_static],
  esac], [build_static=false])
 AM_CONDITIONAL([STATIC_BUILD], [test "x${build_static}" = xtrue])
 
+# --enable-sosreport.
+AC_ARG_ENABLE([sosreport],
+              [--enable-sosreport Install sosreport plugin],
+[case "${enableval}" in
+  yes)
+     sosreport=true
+     ;;
+  no)
+     sosreport=false
+     ;;
+  *)
+    AC_MSG_ERROR([bad value ${enableval} for --enable-sosreport])
+    ;;
+ esac], [sosreport=true])
+AM_CONDITIONAL([SOSREPORT], [test "x${sosreport}" = xtrue])
+
+## Check for python if building with sosreport.
+if test "x${SOSREPORT_TRUE}" = "x"; then
+   AM_PATH_PYTHON([2.6])
+fi
+
 # Check for Libraries.
 if test "x${STATIC_BUILD_TRUE}" = "x"; then
  AC_CHECK_LIB(dl, dlopen, [],
-- 
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