]> granicus.if.org Git - postgis/commitdiff
Rework the documentation Makefile so that it works with the autoconf build system.
authorMark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>
Tue, 20 May 2008 22:10:54 +0000 (22:10 +0000)
committerMark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>
Tue, 20 May 2008 22:10:54 +0000 (22:10 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@2777 b70326c6-7e19-0410-871a-916f4a2858ee

configure.in
doc/Makefile

index 36fb15780bd60b08e7b6d443491d5ffb441ad616..064ede58766e5679b80db319dcb2300b0f28fcae 100644 (file)
@@ -23,6 +23,49 @@ POSTGIS_MINOR_VERSION=`cat Version.config | grep POSTGIS_MINOR_VERSION | sed 's/
 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
@@ -245,5 +288,5 @@ AC_SUBST([SHLIB_LINK])
 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])
 
index cca661f52ab3c088236692dcfda30541d0460090..c4483921e215cf34fc3528d92cc624e9cfbbdd2a 100644 (file)
@@ -1,9 +1,9 @@
-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 \
@@ -15,21 +15,19 @@ XSLTPROC_HTMLOPTS = \
 
 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) \
@@ -44,35 +42,6 @@ html/postgis.html: postgis-out.xml
                $(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 \
@@ -99,4 +68,14 @@ uninstall:
        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