From aee46bced28340c0b357a7d7eb6e9a073f930dba Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com>
Date: Sat, 4 Jul 2015 20:39:15 -0400
Subject: [PATCH] configure: add --disable-python, --disable-doc

Allows to control whether to build the Python cython binding
and the Doxygen documentation.
---
 configure.ac | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/configure.ac b/configure.ac
index 0254785a..d2c87bcc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -10,25 +10,26 @@ AS_IF([test "x$enable_debug" = "xyes"],
       [CXXFLAGS="${CXXFLAGS} -g -Wno-return-type -Wall -Wextra -Wnon-virtual-dtor -O0"],
       [CXXFLAGS="${CXXFLAGS} -O3"])
 
-AC_PROG_CC
 AC_PROG_CXX
 AM_PROG_AR
 
-AC_CHECK_PROGS([DOXYGEN], [doxygen])
-if test -z "$DOXYGEN";
-   then AC_MSG_WARN([Doxygen not found - continuing without Doxygen support])
-fi
+dnl Check for Doxygen
+AC_ARG_ENABLE([doc], [AS_HELP_STRING([--disable-doc], [Disable documentation generation (doxygen)])])
+AS_IF([test "x$enable_doc" != "xno"], [
+  AC_CHECK_PROGS([DOXYGEN], [doxygen])
+  AS_IF([test -z "$DOXYGEN"],[AC_MSG_WARN([Doxygen not found - continuing without Doxygen support])])
+])
 AM_CONDITIONAL([HAVE_DOXYGEN], [test -n "$DOXYGEN"])
 
-AM_PATH_PYTHON([3.3],, [:])
-AM_CONDITIONAL([HAVE_PYTHON], [test -n "$PYTHON"])
-
-if test -n "$PYTHON"; then
-  AC_CHECK_PROGS([CYTHON], [cython])
-  if test -z "$CYTHON";
-     then AC_MSG_WARN([Cython not found - continuing without cython support])
-  fi
-fi
+dnl Check for Python
+AC_ARG_ENABLE([python], [AS_HELP_STRING([--disable-python], [Disble python binding])])
+AS_IF([test "x$enable_python" != "xno"], [
+  AM_PATH_PYTHON([3.3],, [:])
+  AS_IF([test -n "$PYTHON"],[
+    AC_CHECK_PROGS([CYTHON], [cython])
+    AS_IF([test -z "$CYTHON"],[AC_MSG_WARN([Cython not found - continuing without python support])])
+  ])
+])
 AM_CONDITIONAL([USE_CYTHON], [test -n "$CYTHON"])
 
 case "${host_os}" in
-- 
GitLab