[PATCH libinput v3 2/2] Added configure option for documentation build.

Jon A. Cruz jonc at osg.samsung.com
Thu Dec 18 10:49:59 PST 2014


Added option with fallback of 'auto' to control building of documentation.

Signed-off-by: Jon A. Cruz <jonc at osg.samsung.com>
---
 configure.ac    | 72 ++++++++++++++++++++++++++++++++++++++++++---------------
 doc/Makefile.am |  2 +-
 2 files changed, 55 insertions(+), 19 deletions(-)

diff --git a/configure.ac b/configure.ac
index 329f224..ef26b21 100644
--- a/configure.ac
+++ b/configure.ac
@@ -38,6 +38,7 @@ AM_SILENT_RULES([yes])
 # Check for programs
 AC_PROG_CC_C99
 AC_PROG_CXX # Only used by build C++ test
+AC_PROG_GREP
 
 # Initialize libtool
 LT_PREREQ([2.2])
@@ -67,23 +68,58 @@ fi
 AC_SUBST(GCC_CFLAGS)
 AC_SUBST(GCC_CXXFLAGS)
 
-AC_PATH_PROG(DOXYGEN, [doxygen])
-if test "x$DOXYGEN" = "x"; then
-	AC_MSG_WARN([doxygen not found - required for documentation])
-	have_doxygen="no"
-else
-	have_doxygen="yes"
-fi
-AM_CONDITIONAL([HAVE_DOXYGEN], [test "x$have_doxygen" = "xyes"])
-
-AC_PATH_PROG(DOT, dot)
-if test "x$DOT" = "x"; then
-	AC_MSG_WARN([Graphviz's dot not found - required for documentation])
-	have_dot="no"
-else
-	have_dot="yes"
+AC_ARG_ENABLE([documentation],
+	      [AC_HELP_STRING([--enable-documentation],
+		              [Enable building the documentation (default=auto)])],
+	      [build_documentation="$enableval"],
+	      [build_documentation="auto"])
+
+if test "x$build_documentation" = "xyes" -o "x$build_documentation" = "xauto"; then
+	AC_PATH_PROG(DOXYGEN, doxygen)
+	if test "x$DOXYGEN" = "x"; then
+		if test "x$build_documentation" = "xyes"; then
+			AC_MSG_ERROR([Documentation build requested but doxygen not found. Install doxygen or disable the documentation using --disable-documentation])
+		fi
+	else
+		AC_MSG_CHECKING([for compatible doxygen version])
+		doxygen_version=`$DOXYGEN --version`
+		AS_VERSION_COMPARE([$doxygen_version], [1.6.0],
+		                   [AC_MSG_RESULT([no])
+		                    DOXYGEN=""],
+		                   [AC_MSG_RESULT([yes])],
+		                   [AC_MSG_RESULT([yes])])
+		if test "x$DOXYGEN" = "x" -a "x$build_documentation" = "xyes"; then
+			AC_MSG_ERROR([Doxygen $doxygen_version too old. Doxygen 1.6+ required for documentation build. Install required doxygen version or disable the documentation using --disable-documentation])
+		fi
+	fi
+
+	AC_PATH_PROG(DOT, dot)
+	if test "x$DOT" = "x"; then
+		if test "x$build_documentation" = "xyes"; then
+			AC_MSG_ERROR([Documentation build requested but graphviz's dot not found. Install graphviz or disable the documentation using --disable-documentation])
+		fi
+	else
+		AC_MSG_CHECKING([for compatible dot version])
+		dot_version=`$DOT -V 2>&1|$GREP -oP '(?<=version\W)@<:@0-9.@:>@*(?=\W(.*))'`
+		AS_VERSION_COMPARE([$dot_version], [2.26.0],
+		                   [AC_MSG_RESULT([no])
+		                    DOT=""],
+		                   [AC_MSG_RESULT([yes])],
+		                   [AC_MSG_RESULT([yes])])
+		if test "x$DOT" = "x" -a "x$build_documentation" = "xyes"; then
+			AC_MSG_ERROR([Graphviz dot $dot_version too old. Graphviz 2.26+ required for documentation build. Install required graphviz version or disable the documentation using --disable-documentation])
+		fi
+	fi
+
+	if test "x$DOXYGEN" != "x" -a "x$DOT" != "x"; then
+		AC_CONFIG_FILES([
+		doc/libinput.doxygen
+		])
+		build_documentation="yes"
+	else
+		build_documentation="no"
+	fi
 fi
-AM_CONDITIONAL([HAVE_DOT], [test "x$have_dot" = "xyes"])
 
 AC_ARG_ENABLE(event-gui,
 	      AS_HELP_STRING([--enable-event-gui], [Build the GUI event viewer (default=auto)]),
@@ -120,10 +156,10 @@ fi
 
 AM_CONDITIONAL(HAVE_VALGRIND, [test "x$VALGRIND" != "x"])
 AM_CONDITIONAL(BUILD_TESTS, [test "x$build_tests" = "xyes"])
+AM_CONDITIONAL(BUILD_DOCS, [test "x$build_documentation" = "xyes"])
 
 AC_CONFIG_FILES([Makefile
 		 doc/Makefile
-		 doc/libinput.doxygen
 		 src/Makefile
 		 src/libinput.pc
 		 src/libinput-version.h
@@ -134,7 +170,7 @@ AC_OUTPUT
 AC_MSG_RESULT([
 	Prefix			${prefix}
 
-	Build documentation	${have_doxygen}
+	Build documentation	${build_documentation}
 	Build tests		${build_tests}
 	Tests use valgrind	${VALGRIND}
 	Build GUI event tool	${build_eventgui}
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 624326b..30f6089 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -1,6 +1,6 @@
 EXTRA_DIST = touchpad-tap-state-machine.svg touchpad-softbutton-state-machine.svg
 
-if HAVE_DOXYGEN
+if BUILD_DOCS
 
 noinst_DATA = html/index.html
 
-- 
1.9.1



More information about the wayland-devel mailing list