Commit fa41b180 authored by Olaf Meeuwissen's avatar Olaf Meeuwissen

Refactor API spec conversion support

Unless explicitly asked to do without, all formats for which required
tools are found will be built.  Checks cover PostScript, PDF and HTML.

All logic and files involved are now collected in a single "section"
and grouped in such a way that their function should be clearer.

fixup! Refactor API spec conversion support
parent d7c69d14
...@@ -31,13 +31,13 @@ convenient lines to paste ...@@ -31,13 +31,13 @@ convenient lines to paste
export SANE_DEBUG_KODAKAIO=20 export SANE_DEBUG_KODAKAIO=20
for ubuntu prior to 12.10 for ubuntu prior to 12.10
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-avahi --disable-latex BACKENDS="kodakaio test" ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-avahi --without-api-spec BACKENDS="kodakaio test"
for ubuntu 12.10 for ubuntu 12.10
./configure --prefix=/usr --libdir=/usr/lib/i386-linux-gnu --sysconfdir=/etc --localstatedir=/var --enable-avahi --disable-latex BACKENDS="kodakaio test" ./configure --prefix=/usr --libdir=/usr/lib/i386-linux-gnu --sysconfdir=/etc --localstatedir=/var --enable-avahi --without-api-spec BACKENDS="kodakaio test"
for ubuntu 14.10 for ubuntu 14.10
./configure --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu --sysconfdir=/etc --localstatedir=/var --enable-avahi --disable-latex BACKENDS="kodakaio test" ./configure --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu --sysconfdir=/etc --localstatedir=/var --enable-avahi --without-api-spec BACKENDS="kodakaio test"
If you want to use the test backend, for example with sane-troubleshoot, you should enable it in /etc/sane.d/dll.conf If you want to use the test backend, for example with sane-troubleshoot, you should enable it in /etc/sane.d/dll.conf
......
...@@ -70,13 +70,6 @@ dnl *********************************************************************** ...@@ -70,13 +70,6 @@ dnl ***********************************************************************
dnl Checks for programs. dnl Checks for programs.
dnl *********************************************************************** dnl ***********************************************************************
AC_PATH_PROG(SANE_CONFIG_PATH, sane-config, no) AC_PATH_PROG(SANE_CONFIG_PATH, sane-config, no)
AC_PATH_PROG(PDFLATEX, pdflatex$EXEEXT, no)
AC_PATH_PROG(EPSTOPDF, epstopdf$EXEEXT, no)
AC_PATH_PROG(GS, gs$EXEEXT, no)
AC_PATH_PROG(LATEX, latex$EXEEXT, no)
AC_PATH_PROG(DVIPS, dvips$EXEEXT, no)
AC_PATH_PROG(MAKEINDEX, makeindex$EXEEXT, no)
AC_PATH_PROG(DLH, dlh$EXEEXT, no)
dnl Call explicitely before using PKG_* dnl Call explicitely before using PKG_*
PKG_PROG_PKG_CONFIG PKG_PROG_PKG_CONFIG
...@@ -734,26 +727,51 @@ AC_ARG_ENABLE(parport-directio, ...@@ -734,26 +727,51 @@ AC_ARG_ENABLE(parport-directio,
fi fi
]) ])
AC_ARG_ENABLE(latex, dnl ******************************************************************
AS_HELP_STRING([--disable-latex], dnl SANE API specification format conversion support
[disable use of latex, et.al., to generate documentation]),, dnl ******************************************************************
enable_latex=yes) AC_ARG_WITH(api-spec,
if test "x$enable_latex" = "xyes" ; then AS_HELP_STRING([--with-api-spec],
if test "x$LATEX" = "xno" || test "x$DVIPS" = "xno" || test "x$MAKEINDEX" = "xno" ; then [convert API spec to supported output formats @<:@default=check@:>@]),
enable_latex=no [],
echo "disabling latex (missing latex, dvips or makeindex)" [with_api_spec=check])
else dnl Test for all tools that may be involved. These tests are fast and
echo "enabling latex" dnl running them allows for the Makefile targets to be formulated such
fi dnl that you non-requested formats can be made using a one-off without
else dnl the need to reconfigure.
echo "disabling latex" AC_PATH_PROG(MAKEINDEX, makeindex, no)
fi AC_PATH_PROG(DVIPS, dvips, no)
AM_CONDITIONAL(USE_LATEX, test x$enable_latex = xyes) AC_PATH_PROG(LATEX, latex, no)
AM_CONDITIONAL(HAVE_PDFLATEX, AC_PATH_PROG(PDFLATEX, pdflatex, no)
[test "x$PDFLATEX" != xno \ AC_PATH_PROG(EPSTOPDF, epstopdf, no)
&& test "x$EPSTOPDF" != xno \ AC_PATH_PROG(GS, gs, no)
&& test "x$GS" != xno \ AC_PATH_PROG(DLH, dlh, no)
&& test "x$MAKEINDEX" != xno]) AC_PATH_PROG(PPMTOGIF, ppmtogif, no)
AS_IF([test xno != "x$with_api_spec"],
[dnl Flag formats for which all required tools have been found
AS_IF([ test xno != "x$MAKEINDEX" \
&& test xno != "x$DVIPS" \
&& test xno != "x$LATEX"], [with_api_ps=yes])
AS_IF([ test xno != "x$MAKEINDEX" \
&& test xno != "x$PDFLATEX" \
&& test xno != "x$EPSTOPDF" \
&& test xno != "x$GS"], [with_api_pdf=yes])
AS_IF([ test xno != "x$MAKEINDEX" \
&& test xno != "x$DVIPS" \
&& test xno != "x$DHL" \
&& test xno != "x$GS" \
&& test xno != "x$PPMTOFIG" ], [with_api_html=yes])
AS_IF([test xyes = "x$with_api_spec" \
&& test xno = "x$with_api_ps" \
&& test xno = "x$with_api_pdf" \
&& test xno = "x$with_api_html"],
[AC_MSG_ERROR([tools to convert the API spec are missing])
])
])
AM_CONDITIONAL(WITH_API_PS, [test x$with_api_ps = xyes])
AM_CONDITIONAL(WITH_API_PDF, [test x$with_api_pdf = xyes])
AM_CONDITIONAL(WITH_API_HTML, [test x$with_api_html = xyes])
dnl *********************************************************************** dnl ***********************************************************************
dnl Write output files dnl Write output files
......
...@@ -80,17 +80,11 @@ HTML_PAGES = sane-backends.html sane-backends-external.html \ ...@@ -80,17 +80,11 @@ HTML_PAGES = sane-backends.html sane-backends-external.html \
endif endif
doc_DATA = $(HTML_PAGES) doc_DATA = $(HTML_PAGES)
if USE_LATEX all: bemans $(API_SPECS) html-pages
STANDARD = sane.ps
else
STANDARD =
endif
all: bemans $(STANDARD) html-pages
dist_doc_DATA = backend-writing.txt dist_doc_DATA = backend-writing.txt
nobase_dist_doc_DATA = $(BEDOCS) nobase_dist_doc_DATA = $(BEDOCS)
doc_DATA += $(STANDARD) doc_DATA += $(API_SPECS)
EXTRA_DIST += descriptions.txt releases.txt sane-logo2.jpg sane-logo.png \ EXTRA_DIST += descriptions.txt releases.txt sane-logo2.jpg sane-logo.png \
sane.png sane.png
...@@ -152,8 +146,6 @@ BEDOCS += umax/negative-types.txt umax/sane-logo.jpg \ ...@@ -152,8 +146,6 @@ BEDOCS += umax/negative-types.txt umax/sane-logo.jpg \
umax/sane-umax.jpg umax/umax.BUGS umax/umax.CHANGES umax/umax.FAQ \ umax/sane-umax.jpg umax/umax.BUGS umax/umax.CHANGES umax/umax.FAQ \
umax/umax.TODO umax/umax.TODO
EXTRA_DIST += sane.tex net.tex html.sty
DESC_FILES = descriptions/abaton.desc descriptions/agfafocus.desc \ DESC_FILES = descriptions/abaton.desc descriptions/agfafocus.desc \
descriptions/apple.desc descriptions/artec.desc \ descriptions/apple.desc descriptions/artec.desc \
descriptions/artec_eplus48u.desc descriptions/as6e.desc \ descriptions/artec_eplus48u.desc descriptions/as6e.desc \
...@@ -217,49 +209,82 @@ DESC_EXT_FILES = descriptions-external/brother2.desc \ ...@@ -217,49 +209,82 @@ DESC_EXT_FILES = descriptions-external/brother2.desc \
descriptions-external/viceo.desc descriptions-external/viceo.desc
EXTRA_DIST += $(DESC_EXT_FILES) descriptions-external/template.desc. EXTRA_DIST += $(DESC_EXT_FILES) descriptions-external/template.desc.
EXTRA_DIST += figs/area.eps figs/area.fig figs/flow.eps figs/flow.fig \
figs/hierarchy.eps figs/hierarchy.fig figs/image-data.eps \
figs/image-data.fig figs/xfer.eps figs/xfer.fig
EXTRA_DIST += icons/contents.gif icons/index.gif icons/next.gif \
icons/next_gr.gif icons/previous.gif icons/previous_gr.gif \
icons/references.gif icons/references_gr.gif icons/up.gif icons/up_gr.gif
install-data-local: install-beman5 install-data-local: install-beman5
uninstall-local: uninstall-local:
rm -rf $(DESTDIR)$(beman5dir)/sane-*.5 rm -rf $(DESTDIR)$(beman5dir)/sane-*.5
## SANE API specification format conversion support
API_SPECS =
if WITH_API_PS
API_SPECS += sane.ps
endif
if WITH_API_PDF
API_SPECS += sane.pdf
endif
if WITH_API_HTML
API_SPECS += sane-html
endif
API_SPEC_INPUTS = $(srcdir)/sane.tex
API_SPEC_INPUTS += $(srcdir)/net.tex
EXTRA_DIST += $(API_SPEC_INPUTS)
## The *.eps files are included in the $(API_SPEC_INPUTS). They are
## generated from the corresponding *.fig files.
API_SPEC_TEX_FIGS =
API_SPEC_TEX_FIGS += figs/area.fig figs/area.eps
API_SPEC_TEX_FIGS += figs/flow.fig figs/flow.eps
API_SPEC_TEX_FIGS += figs/hierarchy.fig figs/hierarchy.eps
API_SPEC_TEX_FIGS += figs/image-data.fig figs/image-data.eps
API_SPEC_TEX_FIGS += figs/xfer.fig figs/xfer.eps
EXTRA_DIST += $(API_SPEC_TEX_FIGS)
## These icons are referred to in the generated HTML output.
API_SPEC_HTML_ICONS =
API_SPEC_HTML_ICONS += icons/contents.gif
API_SPEC_HTML_ICONS += icons/index.gif
API_SPEC_HTML_ICONS += icons/next.gif icons/next_gr.gif
API_SPEC_HTML_ICONS += icons/previous.gif icons/previous_gr.gif
API_SPEC_HTML_ICONS += icons/references.gif icons/references_gr.gif
API_SPEC_HTML_ICONS += icons/up.gif icons/up_gr.gif
EXTRA_DIST += $(API_SPEC_HTML_ICONS)
## This is probably(!) used in the HTML conversion.
API_SPEC_HTML_STYLE = html.sty
EXTRA_DIST += $(API_SPEC_HTML_STYLE)
am_TEXINPUTS = TEXINPUTS="$(builddir):$(srcdir):$$TEXINPUTS" am_TEXINPUTS = TEXINPUTS="$(builddir):$(srcdir):$$TEXINPUTS"
sane.ind: $(srcdir)/sane.tex sane.ind: $(API_SPEC_INPUTS)
@echo Generating index for sane.tex... @echo Generating index for $<...
@touch sane.ind @touch sane.ind
@$(am_TEXINPUTS) $(LATEX) $(srcdir)/sane </dev/null >/dev/null && \ @$(am_TEXINPUTS) $(LATEX) $< </dev/null >/dev/null && \
$(MAKEINDEX) -q sane.idx && \ $(MAKEINDEX) -q sane.idx && \
$(am_TEXINPUTS) $(LATEX) $(srcdir)/sane </dev/null >/dev/null $(am_TEXINPUTS) $(LATEX) $< </dev/null >/dev/null
sane.dvi: sane.ind sane.dvi: $(API_SPEC_INPUTS) sane.ind
@echo Generating sane.dvi from sane.tex... @echo Generating $@ from $<...
@$(am_TEXINPUTS) $(LATEX) $(srcdir)/sane </dev/null >/dev/null @$(am_TEXINPUTS) $(LATEX) $< </dev/null >/dev/null
sane.ps: sane.dvi sane.ps: sane.dvi
@echo Generating sane.ps from sane.dvi... @echo Generating $@ from $<...
@$(am_TEXINPUTS) $(DVIPS) -q sane.dvi -o sane.ps @$(am_TEXINPUTS) $(DVIPS) -q $< -o $@
if HAVE_PDFLATEX sane.pdf: $(API_SPEC_INPUTS) sane.ind
sane.pdf: $(srcdir)/sane.tex sane.ind
@echo Generating $@ from $<... @echo Generating $@ from $<...
@if test $(srcdir) != $(builddir); then \ @if test $(srcdir) != $(builddir); then \
test -d $(builddir)/figs || mkdir -p $(builddir)/figs; \ test -d $(builddir)/figs || mkdir -p $(builddir)/figs; \
cp $(srcdir)/figs/*.eps $(builddir)/figs; \ cp $(srcdir)/figs/*.eps $(builddir)/figs; \
fi fi
@$(am_TEXINPUTS) $(PDFLATEX) $< >/dev/null @$(am_TEXINPUTS) $(PDFLATEX) $< >/dev/null
endif
sane-html: sane.dvi sane-html: sane.dvi
$(am_TEXINPUTS) $(DLH) $(srcdir)/sane.tex $(am_TEXINPUTS) $(DLH) $(srcdir)/sane.tex
## ^^
html-man: $(MANPAGES) html-man: $(MANPAGES)
@for page in $(MANPAGES); do \ @for page in $(MANPAGES); do \
echo "translating $${page} to $${page}.html..."; \ echo "translating $${page} to $${page}.html..."; \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment