From be4e3b40076ff762fe8cd58a6d2d9e8da127558c Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Wed, 25 Apr 2012 17:14:16 +0100 Subject: [PATCH] configure: Allow choice of backend for PDF generation. Add --with-pdf-backend=[yes|no|dblatex|fop|default] option which defaults to "yes". This controls the option passed to 'xmlto' to generate PDFs. If set to "yes" (the default) it looks for 'dblatex' and uses it as the backend for 'xmlto' if found, otherwise 'xmlto' will use the default backend. If set to "no" (same as --without-pdf-backend), PDF generation is disabled. If set to "dblatex" it looks for 'dblatex' and uses it as the backend for 'xmlto' if found, otherwise PDF generation is disabled. If set to "fop" it looks for 'fop' and uses it as the backend for 'xmlto' if found, otherwise PDF generation is disabled. If set to "default", 'xmlto' will use the default backend. --- configure.ac | 49 +++++++++++++++++++++++++++++++++++++++++++------ doc/Makefile.am | 29 +++++++++++++++++------------ 2 files changed, 60 insertions(+), 18 deletions(-) diff --git a/configure.ac b/configure.ac index 900978e..7a7fddc 100644 --- a/configure.ac +++ b/configure.ac @@ -180,16 +180,53 @@ if test "$ENABLE_DOCBOOK" == "yes"; then if test "$XMLTO" = "no" ; then AC_MSG_WARN([xmlto not found, will not be able to rebuild documentation]) fi - AC_PATH_PROG(DBLATEX, dblatex, no) - if test "$DBLATEX" = "no" ; then - AC_MSG_WARN([dblatex not found, will not be able to generate pdfs]) - fi else XMLTO="no" - DBLATEX="no" fi + +if test "$XMLTO" != "no"; then + AC_ARG_WITH([pdf-backend], + [AS_HELP_STRING([--with-pdf-backend=[[yes|no|dblatex|fop|default]]], + [Enable or disable PDF generation with backend])], + [WITH_PDF_BACKEND=$withval],[WITH_PDF_BACKEND="yes"]) + case "$WITH_PDF_BACKEND" in + no) + PDF_BACKEND="no" + ;; + yes) + # Prefer dblatex, then default backend. + # Could use [dblatex fop] to prefer dblatex or fop. + AC_CHECK_PROGS([PDF_BACKEND], [dblatex], [default]) + AC_MSG_NOTICE([Will use $PDF_BACKEND backend for PDF generation]) + ;; + default) + # Use xmlto's default backend. + PDF_BACKEND="default" + ;; + dblatex|fop) + AC_CHECK_PROG([PDF_BACKEND], [$WITH_PDF_BACKEND], + [$WITH_PDF_BACKEND], [no]) + if test "$PDF_BACKEND" = "no"; then + AC_MSG_WARN([$WITH_PDF_BACKEND not found, disabling PDF generation]) + fi + ;; + *) + AC_MSG_WARN([Bad --with-pdf-backend option, disabling PDF generation]) + PDF_BACKEND="no" + ;; + esac +else + PDF_BACKEND="no" +fi +case $PDF_BACKEND in +fop|default) + AC_MSG_WARN([$PDF_BACKEND PDF backend might not work. --without-pdf-backend disables PDF generation.]) + ;; +esac AM_CONDITIONAL(HAVE_XMLTO, [test "$XMLTO" != "no"]) -AM_CONDITIONAL(HAVE_DBLATEX, [test "$DBLATEX" != "no"]) +AM_CONDITIONAL(BUILD_PDF, [test "$PDF_BACKEND" != "no"]) +AM_CONDITIONAL(BUILD_PDF_USING_DBLATEX, [test "$PDF_BACKEND" = "dblatex"]) +AM_CONDITIONAL(BUILD_PDF_USING_FOP, [test "$PDF_BACKEND" = "fop"]) pcmciadir="\${sysconfdir}/pcmcia" AC_SUBST(pcmciadir) diff --git a/doc/Makefile.am b/doc/Makefile.am index 2bdb061..117e11d 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -19,13 +19,6 @@ if HAVE_XMLTO all_html = $(srcdir)/doc_html install_html = install_html uninstall_html = uninstall_html - -if HAVE_DBLATEX -dist_pdf_DATA = $(srcdir)/pdf/comedilib.pdf -else -dist_pdf_DATA = -endif - all_man = $(srcdir)/man install_man = install_man uninstall_man = uninstall_man @@ -33,14 +26,27 @@ else all_html = install_html = uninstall_html = - -dist_pdf_DATA = - all_man = install_man = uninstall_man = endif +if BUILD_PDF +dist_pdf_DATA = $(srcdir)/pdf/comedilib.pdf +else +dist_pdf_DATA = +endif + +if BUILD_PDF_USING_DBLATEX +XMLTO_PDF_WITH = --with-dblatex +else +if BUILD_PDF_USING_FOP +XMLTO_PDF_WITH = --with-fop +else +XMLTO_PDF_WITH = +endif +endif + all-local: $(all_html) $(all_man) install-data-local: $(install_html) $(install_man) @@ -77,8 +83,7 @@ uninstall_man: for each in `find $(srcdir)/man/ -name '*.3'`; do $(RM) $(DESTDIR)$(mandir)/man3/`basename $$each` ; done $(srcdir)/pdf/comedilib.pdf: $(XML) - $(mkdir_p) $(srcdir)/pdf - $(DBLATEX) -o $(srcdir)/pdf -t pdf $(srcdir)/comedilib.xml + $(XMLTO) -o $(srcdir)/pdf --skip-validation $(XMLTO_PDF_WITH) pdf $(srcdir)/comedilib.xml funcref.xml: funcref mkref $(srcdir)/mkref $(srcdir)/funcref >$(srcdir)/funcref.xml -- 2.26.2