[PATCH util-macros 2/2] Add XORG_WITH_XMLLINT to validate XML documents

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


Used when generating the documentation.

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

diff --git a/xorg-macros.m4.in b/xorg-macros.m4.in
index a700daf..abf7cc1 100644
--- a/xorg-macros.m4.in
+++ b/xorg-macros.m4.in
@@ -551,6 +551,63 @@ 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_XMLLINT([MIN-VERSION], [DEFAULT])
+# --------------------------------------------
+# Minimum version: 1.14.0
+#
+# The xmllint program validates an XML file against its DTD
+# (Document Type Definition) and reports on any differences. 
+# When DEFAULT is not specified, --with-xmllint assumes 'auto'.
+#
+# Interface to module:
+# HAVE_XMLLINT: used in makefiles to validate DocBook/XML files
+# XMLLINT: returns the path of the xmllint program found
+#	   returns the path set by the user in the environment
+# --with-xmllint: 'yes' user instructs the module to use xmllint
+#		  'no' user instructs the module not to use xmllint
+# have_xmllint: returns yes if xmllint found in PATH or no
+#
+# If the user sets the value of XMLLINT, AC_PATH_PROG skips testing the path.
+#
+AC_DEFUN([XORG_WITH_XMLLINT],[
+AC_ARG_VAR([XMLLINT], [Path to xmllint command])
+m4_define([_defopt], m4_default([$2], [auto]))
+AC_ARG_WITH(xmllint,
+	AS_HELP_STRING([--with-xmllint],
+	   [Use xmllint for the validation of XML documents (default: ]_defopt[)]),
+	   [use_xmllint=$withval], [use_xmllint=]_defopt)
+m4_undefine([_defopt])
+
+if test "x$use_xmllint" = x"auto"; then
+   AC_PATH_PROG([XMLLINT], [xmllint])
+   if test "x$XMLLINT" = "x"; then
+        AC_MSG_WARN([xmllint not found - cannot validate XML documents])
+	have_xmllint=no
+   else
+        have_xmllint=yes
+   fi
+elif test "x$use_xmllint" = x"yes" ; then
+   AC_PATH_PROG([XMLLINT], [xmllint])
+   if test "x$XMLLINT" = "x"; then
+        AC_MSG_ERROR([--with-xmllint=yes specified but xmllint not found in PATH])
+   fi
+   have_xmllint=yes
+elif test "x$use_xmllint" = x"no" ; then
+   if test "x$XMLLINT" != "x"; then
+      AC_MSG_WARN([ignoring XMLLINT environment variable since --with-xmllint=no was specified])
+   fi
+   have_xmllint=no
+else
+   AC_MSG_ERROR([--with-xmllint 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_XMLLINT], [test "$have_xmllint" = yes])
+]) # XORG_WITH_XMLLINT
+
 # XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
 # ----------------
 # Minimum version: 1.5.0
-- 
1.6.0.4



More information about the xorg-devel mailing list