From d7fefe23ad15148686c0f2a1351d5e4dfc7e859c Mon Sep 17 00:00:00 2001
From: chak <unknown>
Date: Wed, 31 May 2000 00:55:11 +0000
Subject: [PATCH] [project @ 2000-05-31 00:55:10 by chak] Autoconf magic to
 determine a working DocBook CATALOG file (if any).  Makes the makefile
 variable DOCBOOK_CATALOG refer to this CATALOG file (absolute path).

---
 aclocal.m4      | 45 ++++++++++++++++++++++++++++++++++++++++++++-
 configure.in    |  8 +++++++-
 mk/config.mk.in |  4 +++-
 3 files changed, 54 insertions(+), 3 deletions(-)

diff --git a/aclocal.m4 b/aclocal.m4
index 40c1f2663df9..6eb2d1cda253 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,4 +1,4 @@
-dnl $Id: aclocal.m4,v 1.47 2000/05/09 10:43:45 rrt Exp $
+dnl $Id: aclocal.m4,v 1.48 2000/05/31 00:55:10 chak Exp $
 dnl 
 dnl Extra autoconf macros for the Glasgow fptools
 dnl
@@ -592,5 +592,48 @@ AC_DEFINE(HAVE_PROTOTYPES)
 fi
 ])
 
+dnl ** Check which CATALOG file we have to use with DocBook SGML.
+dnl
+dnl FPTOOLS_DOCBOOK_CATALOG(VARIABLE, JADE, STYLESHEET, CATALOGS-TO-CHECK-FOR)
+dnl
+dnl If any of the catalogs given in CATALOGS-TO-CHECK-FOR works on this
+dnl platform, let VARIABLE refer to this catalog; otherwise, VARIABLE
+dnl is set to "no".  JADE is the jade executable and STYLESHEET
+dnl a DocBook style sheet.
+dnl
+AC_DEFUN(FPTOOLS_DOCBOOK_CATALOG,
+[AC_CACHE_CHECK([for DocBook CATALOG], fptools_cv_sgml_catalog,
+[
+cat > conftest.sgml << EOF
+<!DOCTYPE Article PUBLIC "-//OASIS//DTD DocBook V3.1//EN">
+<Article>
+<ArtHeader>
+<Title>Test</Title>
+<Author><OtherName>Test</OtherName></Author>
+<Address>Test</Address>
+<PubDate>Test</PubDate>
+</ArtHeader>
+<Sect1><Title>Test</Title>
+<Para>
+Test.
+</Para>
+</Sect1>
+</Article>
+EOF
+fptools_cv_sgml_catalog=no
+for fptools_catalog in $4; do
+  ac_try="$2 -t rtf -d $3#print -c $fptools_catalog conftest.sgml"
+  if AC_TRY_EVAL(ac_try); then
+    fptools_cv_sgml_catalog=[$]fptools_catalog
+    break
+  fi
+done
+])
+rm -rf conftest*
+if test $fptools_cv_sgml_catalog != "no"; then
+  $1=$fptools_cv_sgml_catalog
+fi
+])
+
 
 # LocalWords:  fi
diff --git a/configure.in b/configure.in
index 80be29a284a8..a58eda241d5d 100644
--- a/configure.in
+++ b/configure.in
@@ -488,8 +488,14 @@ AC_PATH_PROGS(TarCmd,gtar tar,tar)
 dnl ** check for gzip/compress
 AC_PATH_PROGS(CompressCmd,gzip compress,gzip)
 
-dnl ** check for jade/openjade
+dnl ** check for jade/openjade & determine a working catalog
 AC_PATH_PROGS(JadeCmd,openjade jade,jade)
+FPTOOLS_DOCBOOK_CATALOG(Catalog, $JadeCmd, docs/fptools-both.dsl, 
+                        glafp-utils/docbook/CATALOG*)
+if test -z "$Catalog"; then
+  AC_MSG_RESULT([Warning: You will not be able to build the documentation.])
+fi
+AC_SUBST(Catalog)
 
 compress_nm=`basename $CompressCmd`
 if test x"$compress_nm" = xgzip; then
diff --git a/mk/config.mk.in b/mk/config.mk.in
index ca8a553aa287..3afa25d7cf70 100644
--- a/mk/config.mk.in
+++ b/mk/config.mk.in
@@ -1,4 +1,4 @@
-#
+#								 -*-makefile-*-
 # @configure_input@
 #
 ################################################################################
@@ -655,6 +655,8 @@ SRC_SGML2HTML_OPTS      = -d $(SGMLSTYLESHEET)
 SRC_SGML2PS_OPTS      	= -d $(SGMLSTYLESHEET)
 SRC_SGML2RTF_OPTS       = -d $(SGMLSTYLESHEET)
 
+DOCBOOK_CATALOG		= $(FPTOOLS_TOP_ABS)/@Catalog@
+
 #-----------------------------------------------------------------------------
 # 		FPtools support software
 
-- 
GitLab