]> granicus.if.org Git - postgresql/commitdiff
Add some configure checks for DocBook and related tools. With a somewhat
authorPeter Eisentraut <peter_e@gmx.net>
Sun, 5 Nov 2000 21:04:07 +0000 (21:04 +0000)
committerPeter Eisentraut <peter_e@gmx.net>
Sun, 5 Nov 2000 21:04:07 +0000 (21:04 +0000)
standard installation layout it should be possible to build the HTML
and print documentation without additional manual setup.

aclocal.m4
config/docbook.m4 [new file with mode: 0644]
configure
configure.in
doc/src/sgml/Makefile
src/Makefile.global.in

index 23eba9e70646cfdc5dfc16fbd823abd8882bd4a1..7708287781eb539631aeb160610b518d47f637c2 100644 (file)
@@ -1,8 +1,9 @@
-dnl $Header: /cvsroot/pgsql/aclocal.m4,v 1.10 2000/10/20 23:57:32 petere Exp $
+dnl $Header: /cvsroot/pgsql/aclocal.m4,v 1.11 2000/11/05 21:04:05 petere Exp $
 builtin([include], [config/ac_func_accept_argtypes.m4])
 builtin([include], [config/c-compiler.m4])
 builtin([include], [config/c-library.m4])
 builtin([include], [config/cxx.m4])
+builtin([include], [config/docbook.m4])
 builtin([include], [config/general.m4])
 builtin([include], [config/libtool.m4])
 builtin([include], [config/programs.m4])
diff --git a/config/docbook.m4 b/config/docbook.m4
new file mode 100644 (file)
index 0000000..3e59926
--- /dev/null
@@ -0,0 +1,79 @@
+# $Header: /cvsroot/pgsql/config/docbook.m4,v 1.1 2000/11/05 21:04:06 petere Exp $
+
+# PGAC_PROG_JADE
+# --------------
+AC_DEFUN([PGAC_PROG_JADE],
+[AC_CHECK_PROGS([JADE], [openjade jade])])
+
+
+# PGAC_PROG_NSGMLS
+# ----------------
+AC_DEFUN([PGAC_PROG_NSGMLS],
+[AC_CHECK_PROGS([NSGMLS], [onsgmls nsgmls])])
+
+
+# PGAC_CHECK_DOCBOOK(VERSION)
+# ---------------------------
+AC_DEFUN([PGAC_CHECK_DOCBOOK],
+[AC_REQUIRE([PGAC_PROG_NSGMLS])
+AC_CACHE_CHECK([for DocBook V$1], [pgac_cv_check_docbook],
+[cat >conftest.sgml <<EOF
+<!doctype book PUBLIC "-//OASIS//DTD DocBook V$1//EN">
+<book>
+ <title>test</title>
+ <chapter>
+  <title>random</title>
+   <sect1>
+    <title>testsect</title>
+    <para>text</para>
+  </sect1>
+ </chapter>
+</book>
+EOF
+
+${NSGMLS-false} -s conftest.sgml 1>&5 2>&1
+if test $? -eq 0; then
+  pgac_cv_check_docbook=yes
+else
+  pgac_cv_check_docbook=no
+fi
+rm -f conftest.sgml])
+
+have_docbook=$pgac_cv_check_docbook
+AC_SUBST([have_docbook])
+])# PGAC_CHECK_DOCBOOK
+
+
+# PGAC_PATH_DOCBOOK_STYLESHEETS
+# -----------------------------
+AC_DEFUN([PGAC_PATH_DOCBOOK_STYLESHEETS],
+[AC_MSG_CHECKING([for DocBook stylesheets])
+AC_CACHE_VAL([pgac_cv_path_stylesheets],
+[if test -n "$DOCBOOKSTYLE"; then
+  pgac_cv_path_stylesheets=$DOCBOOKSTYLE
+else
+  for pgac_prefix in /usr /usr/local /opt; do
+    for pgac_infix in share lib; do
+      for pgac_postfix in \
+        sgml/stylesheets/nwalsh-modular \
+        sgml/stylesheets/docbook \
+        sgml/docbook/dsssl/modular
+      do
+        pgac_candidate=$pgac_prefix/$pgac_infix/$pgac_postfix
+        if test -r "$pgac_candidate/html/docbook.dsl" \
+           && test -r "$pgac_candidate/print/docbook.dsl"
+        then
+          pgac_cv_path_stylesheets=$pgac_candidate
+          break 3
+        fi
+      done
+    done
+  done
+fi])
+DOCBOOKSTYLE=$pgac_cv_path_stylesheets
+AC_SUBST([DOCBOOKSTYLE])
+if test -n "$DOCBOOKSTYLE"; then
+  AC_MSG_RESULT([$DOCBOOKSTYLE])
+else
+  AC_MSG_RESULT(no)
+fi])# PGAC_PATH_DOCBOOK_STYLESHEETS
index 58ca84da7cd9f5b13f9fdca57653376aeee2ab49..8d77868e8bcc5bda01e804ec687c4035979d6b90 100755 (executable)
--- a/configure
+++ b/configure
@@ -7463,6 +7463,185 @@ fi
 fi
 
 
+#
+# Check for DocBook and tools
+#
+for ac_prog in onsgmls nsgmls
+do
+# Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:7475: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_NSGMLS'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$NSGMLS"; then
+  ac_cv_prog_NSGMLS="$NSGMLS" # Let the user override the test.
+else
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_NSGMLS="$ac_prog"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+NSGMLS="$ac_cv_prog_NSGMLS"
+if test -n "$NSGMLS"; then
+  echo "$ac_t""$NSGMLS" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+test -n "$NSGMLS" && break
+done
+
+# If you don't have nsgmls you won't get very far, so save the cycles.
+if test -n "$NSGMLS"; then
+  for ac_prog in openjade jade
+do
+# Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:7511: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_JADE'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$JADE"; then
+  ac_cv_prog_JADE="$JADE" # Let the user override the test.
+else
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_JADE="$ac_prog"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+JADE="$ac_cv_prog_JADE"
+if test -n "$JADE"; then
+  echo "$ac_t""$JADE" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+test -n "$JADE" && break
+done
+
+  
+echo $ac_n "checking for DocBook V3.1""... $ac_c" 1>&6
+echo "configure:7542: checking for DocBook V3.1" >&5
+if eval "test \"`echo '$''{'pgac_cv_check_docbook'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat >conftest.sgml <<EOF
+<!doctype book PUBLIC "-//OASIS//DTD DocBook V3.1//EN">
+<book>
+ <title>test</title>
+ <chapter>
+  <title>random</title>
+   <sect1>
+    <title>testsect</title>
+    <para>text</para>
+  </sect1>
+ </chapter>
+</book>
+EOF
+
+${NSGMLS-false} -s conftest.sgml 1>&5 2>&1
+if test $? -eq 0; then
+  pgac_cv_check_docbook=yes
+else
+  pgac_cv_check_docbook=no
+fi
+rm -f conftest.sgml
+fi
+
+echo "$ac_t""$pgac_cv_check_docbook" 1>&6
+
+have_docbook=$pgac_cv_check_docbook
+
+
+  echo $ac_n "checking for DocBook stylesheets""... $ac_c" 1>&6
+echo "configure:7575: checking for DocBook stylesheets" >&5
+if eval "test \"`echo '$''{'pgac_cv_path_stylesheets'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$DOCBOOKSTYLE"; then
+  pgac_cv_path_stylesheets=$DOCBOOKSTYLE
+else
+  for pgac_prefix in /usr /usr/local /opt; do
+    for pgac_infix in share lib; do
+      for pgac_postfix in \
+        sgml/stylesheets/nwalsh-modular \
+        sgml/stylesheets/docbook \
+        sgml/docbook/dsssl/modular
+      do
+        pgac_candidate=$pgac_prefix/$pgac_infix/$pgac_postfix
+        if test -r "$pgac_candidate/html/docbook.dsl" \
+           && test -r "$pgac_candidate/print/docbook.dsl"
+        then
+          pgac_cv_path_stylesheets=$pgac_candidate
+          break 3
+        fi
+      done
+    done
+  done
+fi
+fi
+
+DOCBOOKSTYLE=$pgac_cv_path_stylesheets
+
+if test -n "$DOCBOOKSTYLE"; then
+  echo "$ac_t""$DOCBOOKSTYLE" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+  for ac_prog in sgmlspl
+do
+# Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:7614: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_SGMLSPL'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$SGMLSPL"; then
+  ac_cv_prog_SGMLSPL="$SGMLSPL" # Let the user override the test.
+else
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_SGMLSPL="$ac_prog"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+SGMLSPL="$ac_cv_prog_SGMLSPL"
+if test -n "$SGMLSPL"; then
+  echo "$ac_t""$SGMLSPL" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+test -n "$SGMLSPL" && break
+done
+
+fi
+
+
 # Finally ready to produce output files ...
 
 if test x"$abs_top_srcdir" != x"$abs_top_builddir"; then
@@ -7686,6 +7865,11 @@ s%@HAVE_POSIX_SIGNALS@%$HAVE_POSIX_SIGNALS%g
 s%@TCLSH@%$TCLSH%g
 s%@TCL_CONFIG_SH@%$TCL_CONFIG_SH%g
 s%@TK_CONFIG_SH@%$TK_CONFIG_SH%g
+s%@NSGMLS@%$NSGMLS%g
+s%@JADE@%$JADE%g
+s%@have_docbook@%$have_docbook%g
+s%@DOCBOOKSTYLE@%$DOCBOOKSTYLE%g
+s%@SGMLSPL@%$SGMLSPL%g
 
 CEOF
 EOF
index 2845ff6de6882e7b772eefebfe3ea02b4e270cee..53b19292a1b97783741d959184bedc8d001a05a5 100644 (file)
@@ -1090,6 +1090,19 @@ if test "$with_tk" = yes; then
 fi
 
 
+#
+# Check for DocBook and tools
+#
+PGAC_PROG_NSGMLS
+# If you don't have nsgmls you won't get very far, so save the cycles.
+if test -n "$NSGMLS"; then
+  PGAC_PROG_JADE
+  PGAC_CHECK_DOCBOOK([3.1])
+  PGAC_PATH_DOCBOOK_STYLESHEETS
+  AC_CHECK_PROGS(SGMLSPL, sgmlspl)
+fi
+
+
 # Finally ready to produce output files ...
 
 if test x"$abs_top_srcdir" != x"$abs_top_builddir"; then
index 44e185811066fdf206a32d2b402ddf2c55bcdc1f..ff314b94a0eaa76697ff17047b58a7fd5243e55b 100644 (file)
@@ -8,62 +8,56 @@
 #
 #
 # IDENTIFICATION
-#    $Header: /cvsroot/pgsql/doc/src/sgml/Makefile,v 1.24 2000/10/17 15:26:39 petere Exp $
+#    $Header: /cvsroot/pgsql/doc/src/sgml/Makefile,v 1.25 2000/11/05 21:04:06 petere Exp $
 #
 #----------------------------------------------------------------------------
 
-# Pick up Makefile.global from the source area
-# This is the only resource from the code source area and is optional.
-# Actually, we want this to get Makefile.custom - thomas 1998-03-01
 subdir = doc/src/sgml
 top_builddir = ../../..
--include $(top_builddir)/src/Makefile.global
+include $(top_builddir)/src/Makefile.global
 
 
-# This is where the default stylesheets appear on my linux system.
-# Probably no need to change this; rather, put definitions
-#  for HSTYLE and PSTYLE and/or for HDSL and PDSL
-#  in Makefile.custom in your code src directory.
-#HSTYLE=/usr/lib/sgml/stylesheets/nwalsh-modular/html
-#PSTYLE=/usr/lib/sgml/stylesheets/nwalsh-modular/print
-# This is where the production stylesheets appear on postgresql.org
+ifndef DOCBOOKSTYLE
+DOCBOOKSTYLE = /home/projects/pgsql/developers/thomas/db143.d/docbook
+endif
+
 ifndef HSTYLE
-HSTYLE= /home/projects/pgsql/developers/thomas/db143.d/docbook/html
+HSTYLE = $(DOCBOOKSTYLE)/html
 endif
 ifndef PSTYLE
-PSTYLE= /home/projects/pgsql/developers/thomas/db143.d/docbook/print
+PSTYLE = $(DOCBOOKSTYLE)/print
 endif
 
 HDSL=$(HSTYLE)/docbook.dsl
 PDSL=$(PSTYLE)/docbook.dsl
 
-# Options for DocBook style sheets
+ifndef JADE
+JADE = jade
+endif
+SGMLINCLUDE = -D ref -D ../graphics
+
+ifndef NSGMLS
+NSGMLS = nsgmls
+endif
+
+ifndef SGMLSPL
+SGMLSPL = sgmlspl
+endif
 
-DBOPTS= -D ref -D ../graphics
-#DBOPTS+= -V %no-split-output% -V %no-make-index%
-# use-id-as-filename picks up the "Id=" fields to use as file names.
-# If this is omitted then file names are generic "c01.htm"
-#  as in v6.3 documentation. Yuck.
-DBOPTS+= -V %use-id-as-filename%
 
 # docbook2man generates man pages from docbook refentry source code.
-# This is where the (patched) docbook2man perl scripts reside on hub.org.
 
+ifndef D2MDIR
+# This is where the (patched) docbook2man perl scripts reside on hub.org.
 D2MDIR= /home/users/t/thomas/d2x/docbook2man
+endif
 D2MSCRIPT= $(D2MDIR)/docbook2man-spec.pl
 
-TAR= tar
+vpath %.sgml ./ref
 
-# Hmm, made this optional but jade _really_ doesn't like them missing
-# - thomas 1998-03-01
-ifneq ($(HDSL), )
-HTMLOPTS= -d $(HDSL)
-endif
-ifneq ($(PDSL), )
-PRINTOPTS= -d $(PDSL)
-endif
+ALLDOCUMENTS = admin user programmer developer tutorial postgres
 
-vpath %.sgml ./ref
+ALLSGML := $(wildcard $(srcdir)/*.sgml $(srcdir)/ref/*.sgml)
 
 MANSOURCES= $(wildcard ref/*.sgml)
 
@@ -119,79 +113,73 @@ APPTARGETS= $(XAPPTARGETS:-ref.1=.1)
 XSQLTARGETS= $(COMMANDS:.sgml=.l)
 SQLTARGETS= $(XSQLTARGETS:-ref.l=.l)
 
-.PRECIOUS: postgres.tex postgres.dvi
-.PHONY: install all clean distclean
 
-install:
+##
+## Man pages
+##
 
-all:
+.PHONY: man man1 manl
 
 man:
        $(MAKE) man1 manl
-       ($(RM) -r *.1 *.l man1 manl)
+       rm -r *.1 *.l man1 manl
        $(MAKE) man1 manl
 
 manpage.refs:
        $(MAKE) man
 
 man1: $(APPTARGETS) manpage.refs
-       $(RM) -rf man1
+       rm -rf man1
        if [ ! -d man1 ]; then mkdir man1; fi
        cp *.1 man1/
 
 manl: $(SQLTARGETS) manpage.refs
-       $(RM) -rf manl/*
+       rm -rf manl/*
        if [ ! -d manl ]; then mkdir manl; fi
        cp *.l manl/
 
-clean:
-       (rm -rf HTML.manifest *.html *.htm *.1 *.l man1 manl manpage*)
-
-distclean:
-       $(MAKE) clean
-
-#
-# Generic production rules
-#
-
 %.1: %-ref.sgml
-       nsgmls $(NSGMLS_FLAGS) refentry.sgml $< \
-       | sgmlspl $(D2MSCRIPT) --lowercase --blockformat --section 1
+       $(NSGMLS) $(NSGMLS_FLAGS) refentry.sgml $< \
+       | $(SGMLSPL) $(D2MSCRIPT) --lowercase --section 1
 
 %.1: %.sgml
-       nsgmls $(NSGMLS_FLAGS) refentry.sgml $< \
-       | sgmlspl $(D2MSCRIPT) --lowercase --blockformat --section 1
+       $(NSGMLS) $(NSGMLS_FLAGS) refentry.sgml $< \
+       | $(SGMLSPL) $(D2MSCRIPT) --lowercase --section 1
 
 %.l: %.sgml
-       nsgmls $(NSGMLS_FLAGS) refentry.sgml $< \
-       | sgmlspl $(D2MSCRIPT) --lowercase --blockformat --section l
+       $(NSGMLS) $(NSGMLS_FLAGS) refentry.sgml $< \
+       | $(SGMLSPL) $(D2MSCRIPT) --lowercase --section l
 
-# HTML
+
+##
+## HTML
+##
+
+%.html: %.sgml $(ALLSGML)
+       @rm -f *.htm
+       $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) -d $(HDSL) -V %use-id-as-filename% -t sgml $<
 # Include some softlinks to the generic default file names
+       ln -sf $*.htm index.html
+       ln -sf $*.htm $*.html
 
-%.html:        %.sgml #$(HDSL)
-       (rm -rf *.htm)
-       jade $(DBOPTS) $(HTMLOPTS) -t sgml $<
-       (ln -sf $*.htm index.html)
-       (ln -sf $*.htm $*.html)
 
-# RTF to allow minor editing for hardcopy
-# This is used for v6.3 docs
+##
+## Print
+##
 
-%.rtf: %.sgml #$(PDSL)
-       jade $(DBOPTS) $(PRINTOPTS) -t rtf $<
+# RTF to allow minor editing for hardcopy
+%.rtf: %.sgml
+       $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) -d $(PDSL) -t rtf $<
 
 # TeX and DVI
-
-%.tex: %.sgml #$(PDSL)
-       jade $(DBOPTS) $(PRINTOPTS) -t tex $<
+%.tex: %.sgml
+       $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) -d $(PDSL) -t tex $<
 
 %.dvi: %.tex
        jadetex $<
        jadetex $<
 
 # Postscript from TeX
-
 %.ps: %.dvi
        dvips -o $@ $<
 
@@ -201,9 +189,9 @@ distclean:
        cp -p ../graphics/$@ .
 
 
-#
-# Semi-automatic generation of some text files.
-#
+##
+## Semi-automatic generation of some text files.
+##
 
 INSTALL HISTORY: % : %.html
        @echo "|";\
@@ -216,7 +204,7 @@ INSTALL.html HISTORY.html: %.html : tempfile_%.html
        sed 's/Chapter 1. *//g' $< >$@
 
 tempfile_INSTALL.html tempfile_HISTORY.html: tempfile_%.html : tempfile_%.sgml
-       jade -d $(HDSL) -V nochunks -t sgml $< >$@
+       $(JADE) $(JADEFLAGS) -d $(HDSL) -V nochunks -t sgml $< >$@
 
 
 tempfile_INSTALL.sgml: standalone-install.sgml installation.sgml
@@ -228,3 +216,27 @@ tempfile_HISTORY.sgml: release.sgml
 
 
 .INTERMEDIATE: tempfile_INSTALL.html tempfile_HISTORY.html tempfile_INSTALL.sgml tempfile_HISTORY.sgml
+
+
+##
+## Check
+##
+
+check: $(addprefix check-, $(ALLDOCUMENTS))
+
+# Quick syntax check without style processing
+check-%: %.sgml
+       $(NSGMLS) $(SGMLINCLUDE) -s $<
+
+
+##
+## Clean
+##
+
+clean distclean maintainer-clean:
+# HTML
+       rm -f HTML.manifest *.html *.htm
+# man
+       rm -rf *.1 *.l man1 manl manpage.refs manpage.links manpage.log
+# print
+       rm -f *.rtf *.tex *.dvi *.aux *.log *.ps *.pdf
index 55e6bbe9e0821805fc779b02b7f14b822827bf7d..ef2556784e8bbe5026f24a7fa5ddefec930cddd4 100644 (file)
@@ -1,5 +1,5 @@
 # -*-makefile-*-
-# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.109 2000/11/04 16:39:02 petere Exp $
+# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.110 2000/11/05 21:04:07 petere Exp $
 
 #------------------------------------------------------------------------------
 # All PostgreSQL makefiles include this file and use the variables it sets,
@@ -125,6 +125,9 @@ krb_srvtab = @krb_srvtab@
 TCL_CONFIG_SH = @TCL_CONFIG_SH@
 TK_CONFIG_SH = @TK_CONFIG_SH@
 
+have_docbook   = @have_docbook@
+DOCBOOKSTYLE   = @DOCBOOKSTYLE@
+
 
 ##########################################################################
 #
@@ -190,6 +193,12 @@ INSTALL_SHLIB      = @INSTALL_SHLIB@
 mkinstalldirs  = $(SHELL) $(top_srcdir)/config/mkinstalldirs
 missing                = $(SHELL) $(top_srcdir)/config/missing
 
+# Documentation
+
+JADE   = @JADE@
+NSGMLS = @NSGMLS@
+SGMLSPL        = @SGMLSPL@
+
 
 ##########################################################################
 #