[PATCH util-macros] XORG_WITH_FOP: add minimum version checking support

Gaetan Nadon memsize at videotron.ca
Wed Jun 22 06:41:55 PDT 2011


Adding this feature is motivated by a bug in fop 0.95 where
fop crashes in the presence of some characters like the latin capital
sharp s. Fop version 1.0 works correctly.

This is the same feature found in XMLTO and the likes.
In the macro public interface there is a shift in parameter position
for the DEFAULT parameter. Doing development on older libraries
(point releases on older versions) will still work the same way as
the "no" value will be interpreted as the minimum version. It won't
be found, so fop will be disabled anyway.

Only libX11 has used XORG_WITH_FOP(no) and will be changed with a version
bump on util-macros.

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

diff --git a/xorg-macros.m4.in b/xorg-macros.m4.in
index d2ad154..d3b0b7e 100644
--- a/xorg-macros.m4.in
+++ b/xorg-macros.m4.in
@@ -740,10 +740,11 @@ AM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
 AM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
 ]) # XORG_WITH_GROFF
 
-# XORG_WITH_FOP([DEFAULT])
-# ----------------
+# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
+# ---------------------------------------
 # Minimum version: 1.6.0
 # Minimum version for optional DEFAULT argument: 1.11.0
+# Minimum version for optional MIN-VERSION argument: 1.15.0
 #
 # Documentation tools are not always available on all platforms and sometimes
 # not at the appropriate level. This macro enables a module to test for the
@@ -763,7 +764,7 @@ AM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
 #
 AC_DEFUN([XORG_WITH_FOP],[
 AC_ARG_VAR([FOP], [Path to fop command])
-m4_define([_defopt], m4_default([$1], [auto]))
+m4_define([_defopt], m4_default([$2], [auto]))
 AC_ARG_WITH(fop,
 	AS_HELP_STRING([--with-fop],
 	   [Use fop to regenerate documentation (default: ]_defopt[)]),
@@ -792,6 +793,22 @@ elif test "x$use_fop" = x"no" ; then
 else
    AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
 fi
+
+# Test for a minimum version of fop, if provided.
+m4_ifval([$1],
+[if test "$have_fop" = yes; then
+    # scrape the fop version
+    AC_MSG_CHECKING([for fop minimum version])
+    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
+    AC_MSG_RESULT([$fop_version])
+    AS_VERSION_COMPARE([$fop_version], [$1],
+        [if test "x$use_fop" = xauto; then
+            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
+            have_fop=no
+        else
+            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
+        fi])
+fi])
 AM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
 ]) # XORG_WITH_FOP
 
-- 
1.7.4.1



More information about the xorg-devel mailing list