[PATCH util-macros 1/2] Add XORG_WITH_W3M for HTML to text conversion

Gaetan Nadon memsize at videotron.ca
Mon Mar 21 16:53:45 PDT 2011


This tool is used under the cover by XMLTO to convert DocBook/XML
to text. This macro allows to use it explicitly with the
same facilities provided with other documentation tools.

Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
---
 xorg-macros.m4.in |   56 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 56 insertions(+), 0 deletions(-)

diff --git a/xorg-macros.m4.in b/xorg-macros.m4.in
index 76462b5..a700daf 100644
--- a/xorg-macros.m4.in
+++ b/xorg-macros.m4.in
@@ -494,6 +494,62 @@ m4_ifval([$1],[AC_MSG_WARN(Checking for MIN-VERSION is not implemented.)])
 AM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
 ]) # XORG_WITH_XSLTPROC
 
+# XORG_WITH_W3M([MIN-VERSION], [DEFAULT])
+# --------------------------------------------
+# Minimum version: 1.14.0
+#
+# W3m is a text-based World Wide Web browser with IPv6 support
+# It is used to convert documentation from htlm to text format
+# When DEFAULT is not specified, --with-w3m assumes 'auto'.
+#
+# Interface to module:
+# HAVE_W3M: used in makefiles to conditionally convert documentation
+# W3M:	 returns the path of the w3m program found
+#	 returns the path set by the user in the environment
+# --with-w3m: 'yes' user instructs the module to use w3m
+#	      'no' user instructs the module not to use w3m
+# have_w3m: returns yes if w3m found in PATH or no
+#
+# If the user sets the value of W3M, AC_PATH_PROG skips testing the path.
+#
+AC_DEFUN([XORG_WITH_W3M],[
+AC_ARG_VAR([W3M], [Path to w3m command])
+m4_define([_defopt], m4_default([$2], [auto]))
+AC_ARG_WITH(w3m,
+	AS_HELP_STRING([--with-w3m],
+	   [Use w3m for the transformation of XML documents (default: ]_defopt[)]),
+	   [use_w3m=$withval], [use_w3m=]_defopt)
+m4_undefine([_defopt])
+
+if test "x$use_w3m" = x"auto"; then
+   AC_PATH_PROG([W3M], [w3m])
+   if test "x$W3M" = "x"; then
+        AC_MSG_WARN([w3m not found - cannot convert documents from HTML to text])
+	have_w3m=no
+   else
+        have_w3m=yes
+   fi
+elif test "x$use_w3m" = x"yes" ; then
+   AC_PATH_PROG([W3M], [w3m])
+   if test "x$W3M" = "x"; then
+        AC_MSG_ERROR([--with-w3m=yes specified but w3m not found in PATH])
+   fi
+   have_w3m=yes
+elif test "x$use_w3m" = x"no" ; then
+   if test "x$W3M" != "x"; then
+      AC_MSG_WARN([ignoring W3M environment variable since --with-w3m=no was specified])
+   fi
+   have_w3m=no
+else
+   AC_MSG_ERROR([--with-w3m expects 'yes' or 'no'])
+fi
+
+# Checking for minimum version is not implemented
+# but we want to keep the interface consistent with other commands
+m4_ifval([$1],[AC_MSG_WARN(Checking for MIN-VERSION is not implemented.)])
+
+AM_CONDITIONAL([HAVE_W3M], [test "$have_w3m" = yes])
+]) # XORG_WITH_W3M
 
 # XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
 # ----------------
-- 
1.6.0.4



More information about the xorg-devel mailing list