+else
+ # Sphinx exits with code 1 when it prints its usage
+ sphinxver=`{ $SPHINX --version 2>&1 || :; } | head -n 3`
+
+ if ! echo "$sphinxver" | grep -q -w -e '^Sphinx' -e '^Usage:'; then
+ AC_MSG_ERROR([Unable to determine Sphinx version])
+
+ # Note: Character classes ([...]) need to be double quoted due to autoconf
+ # using m4
+ elif ! echo "$sphinxver" | grep -q -E '^Sphinx[[[:space:]]]+v[[1-9]]\>'; then
+ AC_MSG_ERROR([Sphinx 1.0 or higher is required])
+ fi
+fi
+
+AC_ARG_ENABLE([manpages-in-doc],
+ [AS_HELP_STRING([--enable-manpages-in-doc],
+ m4_normalize([include man pages in HTML documentation
+ (requires sphinx; default disabled)]))],
+ [case "$enableval" in
+ yes) manpages_in_doc=yes ;;
+ no) manpages_in_doc= ;;
+ *)
+ AC_MSG_ERROR([Bad value $enableval for --enable-manpages-in-doc])
+ ;;
+ esac
+ ],
+ [manpages_in_doc=])
+AM_CONDITIONAL([MANPAGES_IN_DOC], [test -n "$manpages_in_doc"])
+AC_SUBST(MANPAGES_IN_DOC, $manpages_in_doc)
+
+if test -z "$SPHINX" -a -n "$manpages_in_doc"; then
+ AC_MSG_ERROR([Including man pages in HTML documentation requires sphinx])