POSTGIS_MICRO_VERSION=`cat Version.config | grep POSTGIS_MICRO_VERSION | sed 's/[[^=]]*=\([[0-9]]\)/\1/g'`
+dnl
+dnl Search for xsltproc which is required for building documentation
+dnl
+
+AC_PATH_PROG([XSLTPROC], [xsltproc], [])
+if test "x$XSLTPROC" = "x"; then
+ AC_MSG_WARN([xsltproc is not installed so documentation cannot be built])
+fi
+
+
+dnl
+dnl Allow the user to specify the location of the html/docbook.xsl stylesheet
+dnl
+
+AC_ARG_WITH([xsldir], [Specify the path to the directory containing the docbook.xsl stylesheet], [XSLBASE="$withval"], [XSLBASE=""])
+if test "x$XSLBASE" = "x"; then
+ dnl If the user did not specify a directory for the docbook stylesheet, choose the first directory
+ dnl that matches from the following list
+ SEARCHPATH="
+ /usr/share/sgml/docbook/xsl-stylesheets
+ /usr/share/xml/docbook/stylesheet/nwalsh
+ /usr/share/sgml/docbook/stylesheet/xsl/nwalsh
+ "
+ for p in ${SEARCHPATH}; do
+ if test -r "${p}"/html/docbook.xsl; then
+ XSLBASE="${p}"
+ break
+ fi
+ done
+fi
+
+dnl For XSLBASE, make sure the directory exists and that it contains html/docbook.xsl
+if test ! -d "$XSLBASE"; then
+ AC_MSG_ERROR([the docbook stylesheet directory specified using --with-xsldir does not exist])
+fi
+
+if test ! -f "$XSLBASE/html/docbook.xsl"; then
+ AC_MSG_ERROR([the docbook stylesheet directory specified using --with-xsldir does not contain the html/docbook.xsl file])
+fi
+
+AC_SUBST([XSLBASE])
+
+
dnl
dnl Detect the version of PostgreSQL installed on the system
dnl
dnl AC_MSG_RESULT([SHLIB_LINK: $SHLIB_LINK])
dnl Output the relevant files
-AC_OUTPUT([lwgeom/Makefile lwgeom/sqldefines.h loader/Makefile.pgsql2shp regress/Makefile])
+AC_OUTPUT([lwgeom/Makefile lwgeom/sqldefines.h loader/Makefile.pgsql2shp regress/Makefile doc/Makefile])
-include ../Makefile.config
-include ../Version.config
+#
+# PostGIS documentation build Makefile
+#
-LAST_RELEASE_VERSION = $(REL_MAJOR_VERSION).$(REL_MINOR_VERSION).$(REL_MICRO_VERSION)
-
-JW_COMMONOPTS = -f docbook -b html -e no-valid
+XSLTPROC = /usr/bin/xsltproc
+XSLBASE = /usr/share/xml/docbook/stylesheet/nwalsh
XSLTPROC_COMMONOPTS = \
--param section.autolabel 1 \
HTML_DOCBOOK_XSL=$(XSLBASE)/html/docbook.xsl
CHUNK_HTML_DOCBOOK_XSL=$(XSLBASE)/html/chunk.xsl
-FO_DOCBOOK_XSL=$(XSLBASE)/fo/docbook.xsl
-all: $(DOC_RULE)
-requirements_not_met:
- @echo
- @echo "Docs building requires 'xsltproc' or 'jw'."
- @echo "Configuration tool could not find any, either install"
- @echo "them or refer to online manual:"
- @echo
- @echo " http://postgis.refractions.net/docs"
- @echo
+# If XSLTPROC was not found during configure, we cannot
+# build the documentation
+ifdef XSLTPROC
+all: html/postgis.html
+else
+all: requirements_not_met
+endif
+
postgis-out.xml: postgis.xml long_xact.xml ../Version.config
- cat $< | sed "s/@@LAST_RELEASE_VERSION@@/$(LAST_RELEASE_VERSION)/g" > $@
+ cat $< | sed "s/@@LAST_RELEASE_VERSION@@/1.4.0/g" > $@
chunked-html: postgis-out.xml
$(XSLTPROC) $(XSLTPROC_COMMONOPTS) $(XSLTPROC_HTMLOPTS) \
$(HTML_DOCBOOK_XSL) \
$<
-postgis.fo: postgis-out.xml
- $(XSLTPROC) $(XSLTPROC_COMMONOPTS) \
- --output $@ \
- $(XSLBASE)/fo/docbook.xsl \
- $<
-
-html: html/postgis.html
-
-postgis.pdf: postgis-out.xml
- @if test x"$(DB2PDF)" = x; then \
- echo "Error: db2pdf not found, can't build posgis.pdf"; \
- echo " try installing docbook-utils package"; \
- false; \
- else \
- $(DB2PDF) $< && mv postgis-out.pdf postgis.pdf; \
- fi
-
-# this is broken
-_postgis.pdf: postgis.fo
- @if test x"$(PDFXMLTEX)" = x; then \
- echo "Error: pdfxmltex not found, can't build posgis.pdf"; \
- false; \
- else \
- $(PDFXMLTEX) $<; \
- fi
-
-jw: postgis-out.xml
- $(JW) $(JW_COMMONOPTS) -o html/ postgis-out.xml
-
clean:
@rm -f \
postgis-out.xml \
rm -f $(DESTDIR)$(mandir)/man1/shp2pgsql.1
rm -f $(DESTDIR)$(mandir)/man1/pgsql2shp.1
-.PHONY: html
+requirements_not_met:
+ @echo
+ @echo "configure was unable to find 'xsltproc' which is required to build the documentation."
+ @echo "To build the documentation, install xsltproc and then re-run configure. Alternatively "
+ @echo "refer to online manual:"
+ @echo
+ @echo " http://postgis.refractions.net/docs"
+ @echo
+
+.PHONY: html
+