[project @ 2004-09-13 19:25:38 by panne]
authorpanne <unknown>
Mon, 13 Sep 2004 19:25:38 +0000 (19:25 +0000)
committerpanne <unknown>
Mon, 13 Sep 2004 19:25:38 +0000 (19:25 +0000)
Improve fop detection now that SuSE has fixed their broken /usr/bin/fop

aclocal.m4

index f16094d..d5a6cd8 100644 (file)
@@ -912,14 +912,66 @@ fi
 ])# FP_CHECK_DOCBOOK_DTD
 
 
+# FP_GEN_FO
+# ------------------
+# Generates a formatting objects document in conftest.fo.
+AC_DEFUN([FP_GEN_FO],
+[rm -f conftest.fo
+cat > conftest.fo << EOF
+<?xml version="1.0"?>
+<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+  <fo:layout-master-set>
+    <fo:simple-page-master master-name="blank">
+      <fo:region-body/>
+    </fo:simple-page-master>
+  </fo:layout-master-set>
+  <fo:page-sequence master-reference="blank">
+    <fo:flow flow-name="xsl-region-body">
+      <fo:block>
+        Test!
+      </fo:block>
+    </fo:flow>
+  </fo:page-sequence>
+</fo:root>
+EOF
+]) # FP_GEN_FO
+
+
+# FP_PROG_FOP
+# -----------
+# Set the output variable 'FopCmd' to the first working 'fop' in the current
+# 'PATH'. Note that /usr/bin/fop is broken in SuSE 9.1 (unpatched), so try
+# /usr/share/fop/fop.sh in that case (or no 'fop'), too.
+AC_DEFUN([FP_PROG_FOP],
+[AC_PATH_PROGS([FopCmd1], [fop])
+if test -n "$FopCmd1"; then
+  AC_CACHE_CHECK([for $FopCmd1 usability], [fp_cv_fop_usability],
+    [FP_GEN_FO
+    if "$FopCmd1" -fo conftest.fo -ps conftest.ps > /dev/null 2>&1; then
+      fp_cv_fop_usability=yes
+    else
+      fp_cv_fop_usability=no
+    fi
+    rm -rf conftest*])
+  if test x"$fp_cv_fop_usability" = xyes; then
+     FopCmd=$FopCmd1
+  fi
+fi
+if test -z "$FopCmd"; then
+  AC_PATH_PROGS([FopCmd2], [fop.sh], , [/usr/share/fop])
+  FopCmd=$FopCmd2
+fi
+AC_SUBST([FopCmd])
+])# FP_PROG_FOP
+
+
 # FP_PROG_FO_PROCESSOR
 # --------------------
 # Try to find an FO processor. PassiveTeX output is sometimes a bit strange, so
-# try FOP first.  Furthermore, /usr/bin/fop is broken in SuSE 9.1, so try the
-# "real" fop.sh first. Sets the output variables FopCmd, XmltexCmd, DvipsCmd,
-# and PdfxmltexCmd.
+# try FOP first. Sets the output variables FopCmd, XmltexCmd, DvipsCmd, and
+# PdfxmltexCmd.
 AC_DEFUN([FP_PROG_FO_PROCESSOR],
-[AC_PATH_PROGS([FopCmd], [fop.sh fop], [], [$PATH:/usr/share/fop])
+[AC_REQUIRE([FP_PROG_FOP])
 AC_PATH_PROG([XmltexCmd], [xmltex])
 AC_PATH_PROG([DvipsCmd], [dvips])
 if test -z "$FopCmd"; then