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
export SANE_DEBUG_KODAKAIO=20
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
./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
./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
......
......@@ -70,13 +70,6 @@ dnl ***********************************************************************
dnl Checks for programs.
dnl ***********************************************************************
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_*
PKG_PROG_PKG_CONFIG
......@@ -734,26 +727,51 @@ AC_ARG_ENABLE(parport-directio,
fi
])
AC_ARG_ENABLE(latex,
AS_HELP_STRING([--disable-latex],
[disable use of latex, et.al., to generate documentation]),,
enable_latex=yes)
if test "x$enable_latex" = "xyes" ; then
if test "x$LATEX" = "xno" || test "x$DVIPS" = "xno" || test "x$MAKEINDEX" = "xno" ; then
enable_latex=no
echo "disabling latex (missing latex, dvips or makeindex)"
else
echo "enabling latex"
fi
else
echo "disabling latex"
fi
AM_CONDITIONAL(USE_LATEX, test x$enable_latex = xyes)
AM_CONDITIONAL(HAVE_PDFLATEX,
[test "x$PDFLATEX" != xno \
&& test "x$EPSTOPDF" != xno \
&& test "x$GS" != xno \
&& test "x$MAKEINDEX" != xno])
dnl ******************************************************************
dnl SANE API specification format conversion support
dnl ******************************************************************
AC_ARG_WITH(api-spec,
AS_HELP_STRING([--with-api-spec],
[convert API spec to supported output formats @<:@default=check@:>@]),
[],
[with_api_spec=check])
dnl Test for all tools that may be involved. These tests are fast and
dnl running them allows for the Makefile targets to be formulated such
dnl that you non-requested formats can be made using a one-off without
dnl the need to reconfigure.
AC_PATH_PROG(MAKEINDEX, makeindex, no)
AC_PATH_PROG(DVIPS, dvips, no)
AC_PATH_PROG(LATEX, latex, no)
AC_PATH_PROG(PDFLATEX, pdflatex, no)
AC_PATH_PROG(EPSTOPDF, epstopdf, no)
AC_PATH_PROG(GS, gs, no)
AC_PATH_PROG(DLH, dlh, no)
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 Write output files
......
......@@ -80,17 +80,11 @@ HTML_PAGES = sane-backends.html sane-backends-external.html \
endif
doc_DATA = $(HTML_PAGES)
if USE_LATEX
STANDARD = sane.ps
else
STANDARD =
endif
all: bemans $(STANDARD) html-pages
all: bemans $(API_SPECS) html-pages
dist_doc_DATA = backend-writing.txt
nobase_dist_doc_DATA = $(BEDOCS)
doc_DATA += $(STANDARD)
doc_DATA += $(API_SPECS)
EXTRA_DIST += descriptions.txt releases.txt sane-logo2.jpg sane-logo.png \
sane.png
......@@ -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/umax.TODO
EXTRA_DIST += sane.tex net.tex html.sty
DESC_FILES = descriptions/abaton.desc descriptions/agfafocus.desc \
descriptions/apple.desc descriptions/artec.desc \
descriptions/artec_eplus48u.desc descriptions/as6e.desc \
......@@ -217,49 +209,82 @@ DESC_EXT_FILES = descriptions-external/brother2.desc \
descriptions-external/viceo.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
uninstall-local:
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"
sane.ind: $(srcdir)/sane.tex
@echo Generating index for sane.tex...
sane.ind: $(API_SPEC_INPUTS)
@echo Generating index for $<...
@touch sane.ind
@$(am_TEXINPUTS) $(LATEX) $(srcdir)/sane </dev/null >/dev/null && \
@$(am_TEXINPUTS) $(LATEX) $< </dev/null >/dev/null && \
$(MAKEINDEX) -q sane.idx && \
$(am_TEXINPUTS) $(LATEX) $(srcdir)/sane </dev/null >/dev/null
$(am_TEXINPUTS) $(LATEX) $< </dev/null >/dev/null
sane.dvi: sane.ind
@echo Generating sane.dvi from sane.tex...
@$(am_TEXINPUTS) $(LATEX) $(srcdir)/sane </dev/null >/dev/null
sane.dvi: $(API_SPEC_INPUTS) sane.ind
@echo Generating $@ from $<...
@$(am_TEXINPUTS) $(LATEX) $< </dev/null >/dev/null
sane.ps: sane.dvi
@echo Generating sane.ps from sane.dvi...
@$(am_TEXINPUTS) $(DVIPS) -q sane.dvi -o sane.ps
@echo Generating $@ from $<...
@$(am_TEXINPUTS) $(DVIPS) -q $< -o $@
if HAVE_PDFLATEX
sane.pdf: $(srcdir)/sane.tex sane.ind
sane.pdf: $(API_SPEC_INPUTS) sane.ind
@echo Generating $@ from $<...
@if test $(srcdir) != $(builddir); then \
test -d $(builddir)/figs || mkdir -p $(builddir)/figs; \
cp $(srcdir)/figs/*.eps $(builddir)/figs; \
fi
@$(am_TEXINPUTS) $(PDFLATEX) $< >/dev/null
endif
sane-html: sane.dvi
$(am_TEXINPUTS) $(DLH) $(srcdir)/sane.tex
## ^^
html-man: $(MANPAGES)
@for page in $(MANPAGES); do \
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