[PATCH wayland 2/5] man, configure.ac: Only generate man pages if we can do it offline

Jonas Ådahl jadahl at gmail.com
Sat Dec 1 08:33:23 PST 2012


Instead of relying on downloading the stylesheet from the Internet for
generating man pages, only generate them if the stylesheet is available
locally.

Signed-off-by: Jonas Ådahl <jadahl at gmail.com>
---
 configure.ac        |   14 ++++++++++++++
 doc/man/Makefile.am |    7 +++++--
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index aa7a62a..0151e49 100644
--- a/configure.ac
+++ b/configure.ac
@@ -76,6 +76,20 @@ fi
 AC_PATH_PROG(XSLTPROC, xsltproc)
 AM_CONDITIONAL([HAVE_XSLTPROC], [test "x$XSLTPROC" != "x"])
 
+AC_MSG_CHECKING([for docbook manpages stylesheet])
+MANPAGES_STYLESHEET=http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl
+AC_PATH_PROGS_FEATURE_CHECK([XSLTPROC_TMP], [xsltproc],
+			    AS_IF([`"$ac_path_XSLTPROC_TMP" --nonet "$MANPAGES_STYLESHEET" > /dev/null 2>&1`],
+				  [HAVE_MANPAGES_STYLESHEET=yes]))
+if test "x$HAVE_MANPAGES_STYLESHEET" = "xyes"; then
+	AM_CONDITIONAL([HAVE_MANPAGES_STYLESHEET], true)
+	AC_SUBST(MANPAGES_STYLESHEET)
+	AC_MSG_RESULT([yes])
+else
+	AM_CONDITIONAL([HAVE_MANPAGES_STYLESHEET], false)
+	AC_MSG_RESULT([no])
+fi
+
 AM_CONDITIONAL(BUILD_DOCS, [test x$enable_documentation = xyes])
 if test "x$enable_documentation" = "xyes"; then
 	AC_PATH_PROG(DOXYGEN, doxygen)
diff --git a/doc/man/Makefile.am b/doc/man/Makefile.am
index a6a5072..1407953 100644
--- a/doc/man/Makefile.am
+++ b/doc/man/Makefile.am
@@ -16,6 +16,7 @@ EXTRA_DIST =
 man_MANS =
 
 if HAVE_XSLTPROC
+if HAVE_MANPAGES_STYLESHEET
 
 CLEANFILES += $(MANPAGES) $(MANPAGES_ALIASES)
 EXTRA_DIST += $(MANPAGES) $(MANPAGES_ALIASES) $(XML_FILES)
@@ -25,11 +26,12 @@ XSLTPROC_FLAGS = \
 	--stringparam man.authors.section.enabled 0 \
 	--stringparam man.copyright.section.enabled 0 \
 	--stringparam funcsynopsis.style ansi \
-	--stringparam man.output.quietly 1
+	--stringparam man.output.quietly 1 \
+	--nonet
 
 XSLTPROC_PROCESS_MAN = \
 	$(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
-	$(XSLTPROC) -o $@ $(XSLTPROC_FLAGS) http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $< && \
+	$(XSLTPROC) -o $@ $(XSLTPROC_FLAGS) $(MANPAGES_STYLESHEET) $< && \
 	$(SED) -i -e 's/^\.so \(.*\)\.\(.\)$$/\.so man\2\/\1\.\2/' $(MANPAGES_ALIASES)
 
 %.1: %.xml
@@ -46,4 +48,5 @@ XSLTPROC_PROCESS_MAN = \
 
 wl_display_connect_to_fd.3: wl_display_connect.3
 
+endif # HAVE_MANPAGES_STYLESHEET
 endif # HAVE_XSLTPROC
-- 
1.7.10.4



More information about the wayland-devel mailing list