AM_PROG_LIBTOOL
+dnl docbook xml transform and processing tools
+AC_ARG_ENABLE(docs,
+ AC_HELP_STRING([--disable-docs],[don't build the documentation]),
+ [case "${enableval}" in
+ yes) build_docs=true;;
+ no) build_docs=false;;
+ *) AC_MSG_ERROR(unknown value ${enableval} for --enable-docs);;
+ esac],[build_docs=true])
+
+dnl ideally we'd look for other tools and support them
+if test x$build_docs = xtrue; then
+ AC_CHECK_PROGS([XSLTPROC], xsltproc, [/bin/false])
+ AC_CHECK_PROGS([PDFXMLTEX], pdfxmltex, [/bin/false])
+ if test "x$XSLTPROC" = "x/bin/false" || test "x$PDFXMLTEX" = "x/bin/false"; then
+ build_docs=false
+ AC_MSG_WARN([Documentation will not be built])
+ fi
+fi
+
+AM_CONDITIONAL(BUILD_DOCS, [test x$build_docs = xtrue])
+
dnl --------------------------------------------------
dnl Set build flags based on environment
dnl --------------------------------------------------
docdir = $(datadir)/doc/$(PACKAGE)-$(VERSION)
+# conditionally make the generated documentation
+if BUILD_DOCS
+built_docs = Vorbis_I_spec.html Vorbis_I_spec.pdf
+else
+built_docs =
+endif !BUILD_DOCS
+
doc_DATA = components.png \
draft-moffitt-vorbis-rtp-00.txt \
eightphase.png \
white-ogg.png \
white-xifish.png \
window1.png \
- window2.png
+ window2.png \
+ Vorbis_I_spec.html \
+ $(built_docs)
+
+doc_sources = xml/Vorbis_I_spec.xml \
+ xml/01-introduction.xml \
+ xml/02-bitpacking.xml \
+ xml/03-codebook.xml \
+ xml/04-codec.xml \
+ xml/05-comment.xml \
+ xml/06-floor0.xml \
+ xml/07-floor1.xml \
+ xml/08-residue.xml \
+ xml/09-helper.xml \
+ xml/10-tables.xml \
+ xml/a1-encapsulation_ogg.xml \
+ xml/a2-encapsulation_rtp.xml \
+ xml/footer.xml \
+ xml/spec-common.xsl \
+ xml/spec-fo.xsl \
+ xml/spec-html.xsl
EXTRA_DIST = $(doc_DATA)
+nobase_EXTRA_DIST = $(doc_sources)
+
+# explicit rules for generating docs
+Vorbis_I_spec.html:
+ xsltproc --xinclude --output $@ xml/spec-html.xsl xml/Vorbis_I_spec.xml
+
+Vorbis_I_spec.fo:
+ xsltproc --xinclude --output $@ xml/spec-fo.xsl xml/Vorbis_I_spec.xml
+
+Vorbis_I_spec.pdf: Vorbis_I_spec.fo
+ cp $< spec.fo # work around a passivetex bug
+ pdfxmltex --interaction nonstopmode spec.fo
+ pdfxmltex --interaction nonstopmode spec.fo
+ rm spec.fo
+ mv spec.pdf $@
+