diff --git a/config/docbook.m4 b/config/docbook.m4
index 7e285383aaa8902f764b212587802a5f6bc9b048..b0b6ce02383437f90a6a9ff0b8ca10983562369e 100644
--- a/config/docbook.m4
+++ b/config/docbook.m4
@@ -1,4 +1,4 @@
-# $Header: /cvsroot/pgsql/config/docbook.m4,v 1.2 2002/03/29 17:32:53 petere Exp $
+# $Header: /cvsroot/pgsql/config/docbook.m4,v 1.3 2002/04/14 17:23:20 petere Exp $
 
 # PGAC_PROG_JADE
 # --------------
@@ -47,7 +47,8 @@ AC_SUBST([have_docbook])
 # PGAC_PATH_DOCBOOK_STYLESHEETS
 # -----------------------------
 AC_DEFUN([PGAC_PATH_DOCBOOK_STYLESHEETS],
-[AC_MSG_CHECKING([for DocBook stylesheets])
+[AC_ARG_VAR(DOCBOOKSTYLE, [location of DocBook stylesheets])dnl
+AC_MSG_CHECKING([for DocBook stylesheets])
 AC_CACHE_VAL([pgac_cv_path_stylesheets],
 [if test -n "$DOCBOOKSTYLE"; then
   pgac_cv_path_stylesheets=$DOCBOOKSTYLE
@@ -57,7 +58,8 @@ else
       for pgac_postfix in \
         sgml/stylesheets/nwalsh-modular \
         sgml/stylesheets/docbook \
-        sgml/docbook/dsssl/modular
+        sgml/docbook/dsssl/modular \
+        sgml/docbook/dsssl-stylesheets
       do
         pgac_candidate=$pgac_prefix/$pgac_infix/$pgac_postfix
         if test -r "$pgac_candidate/html/docbook.dsl" \
@@ -77,3 +79,15 @@ if test -n "$DOCBOOKSTYLE"; then
 else
   AC_MSG_RESULT(no)
 fi])# PGAC_PATH_DOCBOOK_STYLESHEETS
+
+
+# PGAC_PATH_COLLATEINDEX
+# ----------------------
+AC_DEFUN([PGAC_PATH_COLLATEINDEX],
+[AC_REQUIRE([PGAC_PATH_DOCBOOK_STYLESHEETS])dnl
+if test -n "$DOCBOOKSTYLE"; then
+  AC_PATH_PROGS(COLLATEINDEX, collateindex.pl, [],
+                [$DOCBOOKSTYLE/bin $PATH])
+else
+  AC_PATH_PROGS(COLLATEINDEX, collateindex.pl)
+fi])# PGAC_PATH_COLLATEINDEX
diff --git a/configure b/configure
index 7b8e847ad19f4418eb1822d4096ec5dd0249086f..48f018e4a58a134bf67fd8a0451b4bf590b1181f 100755
--- a/configure
+++ b/configure
@@ -769,6 +769,10 @@ ac_env_CXXCPP_set=${CXXCPP+set}
 ac_env_CXXCPP_value=$CXXCPP
 ac_cv_env_CXXCPP_set=${CXXCPP+set}
 ac_cv_env_CXXCPP_value=$CXXCPP
+ac_env_DOCBOOKSTYLE_set=${DOCBOOKSTYLE+set}
+ac_env_DOCBOOKSTYLE_value=$DOCBOOKSTYLE
+ac_cv_env_DOCBOOKSTYLE_set=${DOCBOOKSTYLE+set}
+ac_cv_env_DOCBOOKSTYLE_value=$DOCBOOKSTYLE
 
 #
 # Report the --help message.
@@ -896,6 +900,8 @@ Some influential environment variables:
   CXX         C++ compiler command
   CXXFLAGS    C++ compiler flags
   CXXCPP      C++ preprocessor
+  DOCBOOKSTYLE
+              location of DocBook stylesheets
 
 Use these variables to override the choices made by `configure' or to help
 it to find libraries and programs with nonstandard names/locations.
@@ -16399,9 +16405,7 @@ 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
+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
@@ -16475,7 +16479,7 @@ echo "${ECHO_T}$pgac_cv_check_docbook" >&6
 have_docbook=$pgac_cv_check_docbook
 
 
-  echo "$as_me:$LINENO: checking for DocBook stylesheets" >&5
+echo "$as_me:$LINENO: checking for DocBook stylesheets" >&5
 echo $ECHO_N "checking for DocBook stylesheets... $ECHO_C" >&6
 if test "${pgac_cv_path_stylesheets+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -16488,7 +16492,8 @@ else
       for pgac_postfix in \
         sgml/stylesheets/nwalsh-modular \
         sgml/stylesheets/docbook \
-        sgml/docbook/dsssl/modular
+        sgml/docbook/dsssl/modular \
+        sgml/docbook/dsssl-stylesheets
       do
         pgac_candidate=$pgac_prefix/$pgac_infix/$pgac_postfix
         if test -r "$pgac_candidate/html/docbook.dsl" \
@@ -16512,7 +16517,98 @@ else
   echo "$as_me:$LINENO: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
-  for ac_prog in sgmlspl
+if test -n "$DOCBOOKSTYLE"; then
+  for ac_prog in collateindex.pl
+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 "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_COLLATEINDEX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $COLLATEINDEX in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_COLLATEINDEX="$COLLATEINDEX" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $DOCBOOKSTYLE/bin $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_COLLATEINDEX="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  ;;
+esac
+fi
+COLLATEINDEX=$ac_cv_path_COLLATEINDEX
+
+if test -n "$COLLATEINDEX"; then
+  echo "$as_me:$LINENO: result: $COLLATEINDEX" >&5
+echo "${ECHO_T}$COLLATEINDEX" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  test -n "$COLLATEINDEX" && break
+done
+
+else
+  for ac_prog in collateindex.pl
+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 "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_COLLATEINDEX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $COLLATEINDEX in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_COLLATEINDEX="$COLLATEINDEX" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_COLLATEINDEX="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  ;;
+esac
+fi
+COLLATEINDEX=$ac_cv_path_COLLATEINDEX
+
+if test -n "$COLLATEINDEX"; then
+  echo "$as_me:$LINENO: result: $COLLATEINDEX" >&5
+echo "${ECHO_T}$COLLATEINDEX" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  test -n "$COLLATEINDEX" && break
+done
+
+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
@@ -16552,7 +16648,6 @@ fi
   test -n "$SGMLSPL" && break
 done
 
-fi
 
 
 # prepare build tree if outside source tree
@@ -17258,6 +17353,7 @@ s,@NSGMLS@,$NSGMLS,;t t
 s,@JADE@,$JADE,;t t
 s,@have_docbook@,$have_docbook,;t t
 s,@DOCBOOKSTYLE@,$DOCBOOKSTYLE,;t t
+s,@COLLATEINDEX@,$COLLATEINDEX,;t t
 s,@SGMLSPL@,$SGMLSPL,;t t
 s,@vpath_build@,$vpath_build,;t t
 CEOF
diff --git a/configure.in b/configure.in
index b829d6ee9b6ed7b6620b16797540d14f2e977946..13100c68a71bf5603eae09cd8a9c1c634b041668 100644
--- a/configure.in
+++ b/configure.in
@@ -1,5 +1,5 @@
 dnl Process this file with autoconf to produce a configure script.
-dnl $Header: /cvsroot/pgsql/configure.in,v 1.177 2002/04/10 22:46:31 petere Exp $
+dnl $Header: /cvsroot/pgsql/configure.in,v 1.178 2002/04/14 17:23:20 petere Exp $
 
 dnl Developers, please strive to achieve this order:
 dnl
@@ -1212,13 +1212,11 @@ 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
+PGAC_PROG_JADE
+PGAC_CHECK_DOCBOOK([3.1])
+PGAC_PATH_DOCBOOK_STYLESHEETS
+PGAC_PATH_COLLATEINDEX
+AC_CHECK_PROGS(SGMLSPL, sgmlspl)
 
 
 # prepare build tree if outside source tree
diff --git a/doc/src/sgml/Makefile b/doc/src/sgml/Makefile
index ddf750c81e419a04d2cc0fdfab8169b71d0e57ab..76e15524108c3a876ad97ee27cedaa6cab6d8100 100644
--- a/doc/src/sgml/Makefile
+++ b/doc/src/sgml/Makefile
@@ -8,7 +8,7 @@
 #
 #
 # IDENTIFICATION
-#    $Header: /cvsroot/pgsql/doc/src/sgml/Makefile,v 1.49 2002/01/30 21:54:17 petere Exp $
+#    $Header: /cvsroot/pgsql/doc/src/sgml/Makefile,v 1.50 2002/04/14 17:23:20 petere Exp $
 #
 #----------------------------------------------------------------------------
 
@@ -19,12 +19,8 @@ include $(top_builddir)/src/Makefile.global
 .SECONDARY:
 .NOTPARALLEL:
 
-ifndef DOCBOOKSTYLE
-DOCBOOKSTYLE = /home/projects/pgsql/developers/thomas/db162.d/docbook
-endif
-
-ifndef DOCBOOKINDEX
-  DOCBOOKINDEX = $(DOCBOOKSTYLE)/bin/collateindex.pl
+ifndef COLLATEINDEX
+COLLATEINDEX = $(DOCBOOKSTYLE)/bin/collateindex.pl
 endif
 
 ifndef JADE
@@ -58,7 +54,9 @@ ALLBOOKS = admin developer programmer reference tutorial user
 
 ALLSGML := $(wildcard $(srcdir)/*.sgml $(srcdir)/ref/*.sgml) bookindex.sgml setindex.sgml
 
-CATALOG = $(DOCBOOKSTYLE)/catalog
+ifdef DOCBOOKSTYLE
+CATALOG = -c $(DOCBOOKSTYLE)/catalog
+endif
 
 
 ##
@@ -84,7 +82,7 @@ man: $(ALLSGML)
 ## HTML
 ##
 
-JADE.html = $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) -c $(CATALOG) -d stylesheet.dsl -i output-html -t sgml
+JADE.html = $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d stylesheet.dsl -i output-html -t sgml
 
 postgres.html: postgres.sgml $(ALLSGML) stylesheet.dsl
 	@rm -f *.html
@@ -100,22 +98,14 @@ programmer.html: catalogs.gif connections.gif
 postgres.html: catalogs.gif connections.gif
 
 
-COLLATEINDEX = $(PERL) $(DOCBOOKINDEX) -f -g -t 'Index'
+COLLATEINDEX := $(PERL) $(COLLATEINDEX) -f -g -t 'Index'
 
 ifeq (,$(wildcard HTML.index))
 bookindex.sgml:
-ifeq (,$(wildcard $(COLLATEINDEX)))
-	touch $@
-else
 	$(COLLATEINDEX) -o $@ -N
-endif
 
 setindex.sgml:
-ifeq (,$(wildcard $(COLLATEINDEX)))
-	touch $@
-else
 	$(COLLATEINDEX) -x -o $@ -N
-endif
 else
 bookindex.sgml: HTML.index
 	$(COLLATEINDEX) -i 'bookindex' -o $@ $<
@@ -131,19 +121,19 @@ endif
 
 # RTF to allow minor editing for hardcopy
 $(addsuffix .rtf, $(ALLBOOKS)): %.rtf: %.sgml $(ALLSGML) stylesheet.dsl
-	$(JADE) $(JADEFLAGS) $(SGMLINCLUDE) -c $(CATALOG) -d stylesheet.dsl -t rtf -V rtf-backend -i output-print book-decl.sgml $<
+	$(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d stylesheet.dsl -t rtf -V rtf-backend -i output-print book-decl.sgml $<
 
 # TeX
 # Regular TeX and pdfTeX have slightly differing requirements, so we
 # need to distinguish the path we're taking.
 
 $(addsuffix .tex-ps, $(ALLBOOKS)): %.tex-ps: %.sgml $(ALLSGML) stylesheet.dsl
-	$(JADE) $(JADEFLAGS) $(SGMLINCLUDE) -c $(CATALOG) -d stylesheet.dsl -t tex -V tex-backend -i output-print -V texdvi-output -o $@ book-decl.sgml $<
+	$(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d stylesheet.dsl -t tex -V tex-backend -i output-print -V texdvi-output -o $@ book-decl.sgml $<
 
 programmer.tex-ps: catalogs.eps connections.eps
 
 $(addsuffix .tex-pdf, $(ALLBOOKS)): %.tex-pdf: %.sgml $(ALLSGML) stylesheet.dsl
-	$(JADE) $(JADEFLAGS) $(SGMLINCLUDE) -c $(CATALOG) -d stylesheet.dsl -t tex -V tex-backend -i output-print -V texpdf-output -o $@ book-decl.sgml $<
+	$(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d stylesheet.dsl -t tex -V tex-backend -i output-print -V texpdf-output -o $@ book-decl.sgml $<
 
 programmer.tex-pdf: catalogs.pdf connections.pdf
 
@@ -168,7 +158,7 @@ programmer.tex-pdf: catalogs.pdf connections.pdf
 # for debugging DSSSL code, and possibly to interface to some other
 # tools that can make use of this.
 $(addsuffix .fot, $(ALLBOOKS)): %.fot: %.sgml $(ALLSGML) stylesheet.dsl
-	$(JADE) $(JADEFLAGS) $(SGMLINCLUDE) -c $(CATALOG) -d stylesheet.dsl -t fot -i output-print -o $@ book-decl.sgml $<
+	$(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d stylesheet.dsl -t fot -i output-print -o $@ book-decl.sgml $<
 
 
 # Graphics
@@ -187,7 +177,7 @@ $(addsuffix .fot, $(ALLBOOKS)): %.fot: %.sgml $(ALLSGML) stylesheet.dsl
 ## Semi-automatic generation of some text files.
 ##
 
-JADE.text = $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) -c $(CATALOG) -d stylesheet.dsl -i output-text -t sgml
+JADE.text = $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d stylesheet.dsl -i output-text -t sgml
 
 INSTALL HISTORY regress_README: % : %.html
 	@echo "|";\
@@ -219,10 +209,10 @@ regress_README.html: regress.sgml
 check: $(addprefix check-, $(ALLBOOKS)) check-postgres
 
 # Quick syntax check without style processing
-$(addprefix check-, $(ALLBOOKS)): check-%: %.sgml
+$(addprefix check-, $(ALLBOOKS)): check-%: %.sgml bookindex.sgml
 	$(NSGMLS) $(SGMLINCLUDE) -s book-decl.sgml $<
 
-check-postgres: postgres.sgml
+check-postgres: postgres.sgml setindex.sgml
 	$(NSGMLS) $(SGMLINCLUDE) -s $<
 
 
diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index f7feda8366c1137885626b32cf1366f4b2c28f3b..0a713bfe99421f2705e2012f53f679b899fb77f2 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -1,5 +1,5 @@
 # -*-makefile-*-
-# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.145 2002/04/10 16:45:25 petere Exp $
+# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.146 2002/04/14 17:23:20 petere Exp $
 
 #------------------------------------------------------------------------------
 # All PostgreSQL makefiles include this file and use the variables it sets,
@@ -153,6 +153,7 @@ TCLSH		= @TCLSH@
 
 have_docbook	= @have_docbook@
 DOCBOOKSTYLE	= @DOCBOOKSTYLE@
+COLLATEINDEX	= @COLLATEINDEX@
 
 
 ##########################################################################