<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.26.0">
</HEAD>
<BODY>
On Wed, 2010-01-06 at 08:05 +0100, Matthieu Herrb wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
>From 861790b2c9ac121d42d71c3258c24d1a6b265bc9 Mon Sep 17 00:00:00 2001
From: Matthieu Herrb <<A HREF="mailto:matthieu.herrb@laas.fr">matthieu.herrb@laas.fr</A>>
Date: Tue, 5 Jan 2010 23:04:25 +0100
Subject: [PATCH] Add XORG_WITH_XMLTO to factorize xmlto tests.
This also allow to configure with --without-xmlto to ignore
</PRE>
</BLOCKQUOTE>
--without-xmlto: if you want it, you have to code it. Only --with-xmlto works.
<BLOCKQUOTE TYPE=CITE>
<PRE>
a 3rd party xmlto tool on systems that normally don't have it,
in order to have reproducable builds.
Signed-off-by: Matthieu Herrb <<A HREF="mailto:matthieu.herrb@laas.fr">matthieu.herrb@laas.fr</A>>
---
xorg-macros.m4.in | 45 +++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 45 insertions(+), 0 deletions(-)
diff --git a/xorg-macros.m4.in b/xorg-macros.m4.in
index 20d0c70..85d353f 100644
--- a/xorg-macros.m4.in
+++ b/xorg-macros.m4.in
@@ -310,6 +310,51 @@ AC_SUBST(MAKE_PDF)
AC_SUBST(MAKE_HTML)
]) # XORG_CHECK_DOCBOOK
+# XORG_WITH_XMLTO
+# ----------------
+# Minimum version: 1.5.0
+#
+# Checks for the availability of the xmlto command.
+# Adds a --with-xmlto argument to configure that can be used to
+# disable xmlto or specify a specific path to the executable.
</PRE>
</BLOCKQUOTE>
See case#4. Needs to be reworked as path to xmlto is supplied in XMLTO env var.
<BLOCKQUOTE TYPE=CITE>
<PRE>
+# defines the HAVE_XMLTO automake conditionnal according to the result.
+AC_DEFUN([XORG_WITH_XMLTO],[
+AC_ARG_VAR([XMLTO], [Path to xmlto command])
</PRE>
</BLOCKQUOTE>
Shouldn't "Path to xmlto command" be spelled with a lower case p?
<BLOCKQUOTE TYPE=CITE>
<PRE>
+AC_ARG_WITH(xmlto,
+        AS_HELP_STRING([--with-xmlto],
+         [Use xmlto to regenerate documentation (default: auto)]),
+         [use_xmlto=$withval], [use_xmlto=auto])
+
+if test "x$use_xmlto" = x"auto"; then
+ AC_PATH_PROG([XMLTO], [xmlto])
+ if test "x$XMLTO" = "x"; then
+ AC_MSG_WARN([xmlto not found - cannot create man pages without it])
+        have_xmlto=no
+ else
+ have_xmlto=yes
+ fi
+elif test "x$use_xmlto" = x"yes" ; then
+ AC_PATH_PROG([XMLTO], [xmlto])
+ if test "x$XMLTO" = "x"; then
+ AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
+ fi
+ have_xmlto=yes
+elif test "x$use_xmlto" = x"no" ; then
+ if test "x$XMLTO" != "x"; then
+ AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
+ fi
+ have_xmlto=no
+else
+ if test -x $use_xmlto ; then
+ XMLTO=$use_xmlto
+ have_xmlto=yes
+ else
+ AC_MSG_ERROR([specified xmlto $use_xmlto doesn't exist])
+ fi
</PRE>
</BLOCKQUOTE>
This 4th case should be an error (or ignored). There are only 3 possible value [yes|no|auto]. If the user wishes to pass a value for XMLTO, it is done in the environment or on the command line:
<BLOCKQUOTE>
<PRE>
./configure --prefix $prefix XMLTO=/usr/bin/myxmlto
</PRE>
</BLOCKQUOTE>
The user may specify a value for XMLTO without specifying --with-xmlto, in which case it defaults to "auto".<BR>
The AC_PATH_PROG assigns precedence to the user supplied value of XMLTO as seen here in configure script:
<BLOCKQUOTE>
<PRE>
ac_cv_path_XMLTO="$XMLTO" # Let the user override the test with a path.
</PRE>
</BLOCKQUOTE>
It also caches the user value and all works transparently. In any case, AC_PATH_PROG must always be called (when using xmlto) so that all the internals are set correctly, regardless of where the value comes from. It is not required to test -x the existence of the tool, as it was find in the PATH by AC_PATH_PROG.<BR>
<BR>
Output of ./configure --help:
<BLOCKQUOTE>
<PRE>
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-xmlto Use xmlto to regenerate documentation (default:
auto)
</PRE>
</BLOCKQUOTE>
The semantic "Optional Packages" fits perfectly in our case. This calls for a yes/no type of answer. I noticed modules using the "Optional Packages" mechanism to pass in values like filename, but it was not intended for that. In our case, we don't want 2 competing ways to supply an xmlto path.<BR>
<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
<PRE>
+fi
+AM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
+]) # XORG_CHECK_XMLTO
+
# XORG_CHECK_MALLOC_ZERO
# ----------------------
# Minimum version: 1.0.0
--
1.6.5.3
</PRE>
</BLOCKQUOTE>
Excellent. I have tested all 3 cases (auto, yes,no) and they work as advertised. Both with and without XMLTO environment variable set. Note that when a user sets XMLTO, AC_PATH_PROG takes it at face value and does not complain that it is not in PATH. Because XMLTO is set, our AC_MSG_WARN is not triggered. This is as designed by Automake:<BR>
<BR>
<BLOCKQUOTE>
<PRE>
The result of this test can be overridden by setting the <TT><I>variable</I></TT> variable
</PRE>
</BLOCKQUOTE>
You may want to make a note of this as it can be interpreted as bug.<BR>
<BR>
I'll test the next (and most likely the final) version of the patch. Any plan for asciidoc or any other tool?<BR>
<BR>
<BR>
<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
<PRE>
</PRE>
</BLOCKQUOTE>
</BODY>
</HTML>