add macros for gphoto2-manual

git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@7959 67ed7778-7388-44ab-90cf-0a291f65f57c
This commit is contained in:
Hans Ulrich Niedermann
2005-05-07 11:27:22 +00:00
parent 48dc916623
commit a5dec8b67e
8 changed files with 569 additions and 1 deletions

View File

@@ -1 +1 @@
EXTRA_DIST = gp-byteorder.m4 gp-camlibs.m4 gp-check-library.m4 gp-check-popt.m4 gp-check-shell-environment.m4 gp-config-msg.m4 gp-documentation.m4 gp-dynamic-libraries.m4 gp-gettext-hack.m4 gp-packaging.m4 gp-pkg-config.m4 gp-references.m4 gp-va-copy.m4 stdint.m4
EXTRA_DIST = gp-byteorder.m4 gp-camlibs.m4 gp-check-library.m4 gp-check-popt.m4 gp-check-shell-environment.m4 gp-config-msg.m4 gp-documentation.m4 gp-dynamic-libraries.m4 gp-gettext-hack.m4 gp-packaging.m4 gp-pkg-config.m4 gp-references.m4 gp-va-copy.m4 stdint.m4 gp-manual-docbook-xml.m4 gp-manual-documentation.m4 gp-manual-fig2dev.m4 gp-manual-graphviz.m4 gp-manual-gtk-doc.m4 gp-manual-pstoimg.m4 gp-manual-w3m.m4

View File

@@ -0,0 +1,46 @@
dnl ------------------------------------------------------------------------
dnl try to find xmlto (required for generation of man pages and html docs)
dnl ------------------------------------------------------------------------
AC_DEFUN([GP_CHECK_DOCBOOK_XML],
[
AC_MSG_CHECKING([for XML catalogs])
XML_CATALOG_FILES="`find /etc/xml /usr/share/xml /usr/share/sgml -type f \( -iname 'catalog.xml' -or -iname 'catalog' \) -print 2> /dev/null | while read file; do echo -n "$file "; done`"
if test "x$XML_CATALOG_FILES" = "x"
then
AC_MSG_RESULT([none found.])
else
AC_MSG_RESULT([found ${XML_CATALOG_FILES}])
fi
AC_SUBST(XML_CATALOG_FILES)
#XML_DEBUG_CATALOG=0
#AC_SUBST(XML_DEBUG_CATALOG)
manual_msg="no (http://cyberelk.net/tim/xmlto/)"
try_xmlto=true
have_xmlto=false
AC_ARG_WITH(xmlto, [ --without-xmlto Don't use xmlto],[
if test x$withval = xno; then
try_xmlto=false
fi])
if $try_xmlto; then
AC_PATH_PROG(XMLTO,xmlto)
if test -n "${XMLTO}"; then
have_xmlto=true
manual_msg="yes"
PURE_XMLTO="$XMLTO"
if true || test "x$XML_CATALOG_FILES" = "x"; then
unset XML_CATALOG_FILES
XMLTO="${XMLTO} -m \$(top_srcdir)/src/xsl/custom.xsl"
else
XMLTO="env XML_CATALOG_FILES=\"${XML_CATALOG_FILES}\" ${XMLTO} -m ${top_srcdir}/src/xsl/custom.xsl"
fi
else
# in case anybody runs $(XMLTO) somewhere, we return false
XMLTO=false
fi
fi
AM_CONDITIONAL(XMLTO, $have_xmlto)
])

View File

@@ -0,0 +1,329 @@
dnl
dnl check where to install documentation
dnl
dnl determines documentation "root directory", i.e. the directory
dnl where all documentation will be placed in
dnl
AC_DEFUN([GP_CHECK_DOCDIR],
[
AC_ARG_WITH(doc-dir, [ --with-doc-dir=PATH Where to install docs [default=autodetect]])dnl
# check for the main ("root") documentation directory
AC_MSG_CHECKING([main docdir])
if test "x${with_doc_dir}" != "x"
then # docdir is given as parameter
docdir="${with_doc_dir}"
AC_MSG_RESULT([${docdir} (from parameter)])
else # otherwise invent a docdir hopefully compatible with system policy
if test -d "/usr/share/doc"
then
maindocdir='${prefix}/share/doc'
AC_MSG_RESULT([${maindocdir} (FHS style)])
elif test -d "/usr/doc"
then
maindocdir='${prefix}/doc'
AC_MSG_RESULT([${maindocdir} (old style)])
else
maindocdir='${datadir}/doc'
AC_MSG_RESULT([${maindocdir} (default value)])
fi
AC_MSG_CHECKING(package docdir)
# check whether to include package version into documentation path
# FIXME: doesn't work properly.
if ls -d /usr/{share/,}doc/*-[[]0-9[]]* > /dev/null 2>&1
then
docdir="${maindocdir}/${PACKAGE}-${VERSION}"
AC_MSG_RESULT([${docdir} (redhat style)])
else
docdir="${maindocdir}/${PACKAGE}"
AC_MSG_RESULT([${docdir} (default style)])
fi
fi
AC_SUBST(docdir)
])dnl
dnl Solaris hack for grep and tr
AC_DEFUN([GP_CHECK_TR],
[
if test -n "`echo $host_os | grep '[sS]olaris'`"; then
TR=/usr/xpg4/bin/tr
GREP=/usr/xpg4/bin/grep
else
TR=tr
GREP=grep
fi
])
dnl
dnl check whether to build docs and where to:
dnl
dnl * determine presence of prerequisites (only gtk-doc for now)
dnl * determine destination directory for HTML files
dnl
AC_DEFUN([GP_BUILD_DOCS],
[
# doc dir has to be determined in advance
AC_REQUIRE([GP_CHECK_DOCDIR])
AC_REQUIRE([GP_CHECK_GTK_DOC])
AC_REQUIRE([GP_CHECK_FIG2DEV])
AC_REQUIRE([GP_CHECK_DOCBOOK_XML])
AC_REQUIRE([GP_CHECK_TR])
AC_REQUIRE([GP_CHECK_PSTOIMG])
AC_REQUIRE([GP_CHECK_DOT])
AC_REQUIRE([GP_CHECK_W3M])
gphoto2xml='$(top_srcdir)/src/gphoto2.xml'
AC_SUBST(gphoto2xml)
dnl ---------------------------------------------------------------------------
dnl Give the user the possibility to install documentation in
dnl user-defined locations.
dnl ---------------------------------------------------------------------------
AC_ARG_WITH(html-dir, [ --with-html-dir=PATH Where to install html docs [default=autodetect]])
AC_MSG_CHECKING([for html dir])
if test "x${with_html_dir}" = "x" ; then
htmldir="${docdir}/html"
AC_MSG_RESULT([${htmldir} (default)])
else
htmldir="${with_html_dir}"
AC_MSG_RESULT([${htmldir} (from parameter)])
fi
AC_SUBST(htmldir)
AC_ARG_WITH(xhtml-dir, [ --with-xhtml-dir=PATH Where to install xhtml docs [default=autodetect]])
AC_MSG_CHECKING([for xhtml dir])
if test "x${with_xhtml_dir}" = "x" ; then
xhtmldir="${docdir}/xhtml"
AC_MSG_RESULT([${xhtmldir} (default)])
else
xhtmldir="${with_xhtml_dir}"
AC_MSG_RESULT([${xhtmldir} (from parameter)])
fi
AC_SUBST(xhtmldir)
AC_ARG_WITH(html-nochunks-dir, [ --with-html-nochunks-dir=PATH Where to install html-nochunks docs [default=autodetect]])
AC_MSG_CHECKING([for html-nochunks dir])
if test "x${with_html_nochunks_dir}" = "x" ; then
htmlnochunksdir="${docdir}/html-nochunks"
AC_MSG_RESULT([${htmlnochunksdir} (default)])
else
htmlnochunksdir="${with_html_nochunks_dir}"
AC_MSG_RESULT([${htmlnochunksdir} (from parameter)])
fi
AC_SUBST(htmlnochunksdir)
AC_ARG_WITH(xhtml-nochunks-dir, [ --with-xhtml-nochunks-dir=PATH Where to install xhtml-nochunks docs [default=autodetect]])
AC_MSG_CHECKING([for xhtml-nochunks dir])
if test "x${with_xhtml_nochunks_dir}" = "x" ; then
xhtmlnochunksdir="${docdir}/xhtml-nochunks"
AC_MSG_RESULT([${xhtmlnochunksdir} (default)])
else
xhtmlnochunksdir="${with_xhtml_nochunks_dir}"
AC_MSG_RESULT([${xhtmlnochunksdir} (from parameter)])
fi
AC_SUBST(xhtmlnochunksdir)
AC_ARG_WITH(xml-dir, [ --with-xml-dir=PATH Where to install xml docs [default=autodetect]])
AC_MSG_CHECKING([for xml dir])
if test "x${with_xml_dir}" = "x" ; then
xmldir="${docdir}/xml"
AC_MSG_RESULT([${xmldir} (default)])
else
xmldir="${with_xml_dir}"
AC_MSG_RESULT([${xmldir} (from parameter)])
fi
AC_SUBST(xmldir)
xmlcssdir="${xmldir}/css"
AC_SUBST(xmlcssdir)
AC_ARG_WITH(txt-dir, [ --with-txt-dir=PATH Where to install txt docs [default=autodetect]])
AC_MSG_CHECKING([for txt dir])
if test "x${with_txt_dir}" = "x" ; then
txtdir="${docdir}/txt"
AC_MSG_RESULT([${txtdir} (default)])
else
txtdir="${with_txt_dir}"
AC_MSG_RESULT([${txtdir} (from parameter)])
fi
AC_SUBST(txtdir)
AC_ARG_WITH(man-dir, [ --with-man-dir=PATH Where to install man docs [default=autodetect]])
AC_MSG_CHECKING([for man dir])
if test "x${with_man_dir}" = "x" ; then
manmandir="${docdir}/man"
AC_MSG_RESULT([${manmandir} (default)])
else
manmandir="${with_man_dir}"
AC_MSG_RESULT([${manmandir} (from parameter)])
fi
AC_SUBST(manmandir)
AC_ARG_WITH(pdf-dir, [ --with-pdf-dir=PATH Where to install pdf docs [default=autodetect]])
AC_MSG_CHECKING([for pdf dir])
if test "x${with_pdf_dir}" = "x" ; then
pdfdir="${docdir}/pdf"
AC_MSG_RESULT([${pdfdir} (default)])
else
pdfdir="${with_pdf_dir}"
AC_MSG_RESULT([${pdfdir} (from parameter)])
fi
AC_SUBST(pdfdir)
AC_ARG_WITH(ps-dir, [ --with-ps-dir=PATH Where to install ps docs [default=autodetect]])
AC_MSG_CHECKING([for ps dir])
if test "x${with_ps_dir}" = "x" ; then
psdir="${docdir}/ps"
AC_MSG_RESULT([${psdir} (default)])
else
psdir="${with_ps_dir}"
AC_MSG_RESULT([${psdir} (from parameter)])
fi
AC_SUBST(psdir)
AC_ARG_WITH(figure-dir, [ --with-figure-dir=PATH Where to install figures [default=autodetect]])
AC_MSG_CHECKING([for figure dir])
if test "x${with_figure_dir}" = "x" ; then
figuredir="${docdir}/figures"
AC_MSG_RESULT([${figuredir} (default)])
else
figuredir="${with_figure_dir}"
AC_MSG_RESULT([${figuredir} (from parameter)])
fi
AC_SUBST(figuredir)
AC_ARG_WITH(screenshots-dir, [ --with-screenshots-dir=PATH Where to install screenshotss [default=autodetect]])
AC_MSG_CHECKING([for screenshots dir])
if test "x${with_screenshots_dir}" = "x" ; then
screenshotsdir="${docdir}/screenshots"
AC_MSG_RESULT([${screenshotsdir} (default)])
else
screenshotsdir="${with_screenshots_dir}"
AC_MSG_RESULT([${screenshotsdir} (from parameter)])
fi
AC_SUBST(screenshotsdir)
screenshotsgtkamdir="${screenshotsdir}/gtkam"
AC_SUBST(screenshotsgtkamdir)
doc_formats_list='man html txt ps pdf'
# initialize have_xmlto* to false
for i in $doc_formats_list; do
d=`echo $i | $TR A-Z a-z`
eval "have_xmlto$d=false"
done
AC_MSG_CHECKING(checking doc formats)
AC_ARG_WITH(doc_formats,
[ --with-doc-formats=<list> create doc with format in <list>; ]
[ 'all' build all doc formats; ]
[ possible formats are: ]
[ man, html, ps, pdf ],
doc_formats="$withval", doc_formats="man html txt")
if test "$doc_formats" = "all"; then
doc_formats=$doc_formats_list
else
doc_formats=`echo $doc_formats | sed 's/,/ /g'`
fi
# set have_xmlto* to true if requested and possible
if $have_xmlto; then
for i in $doc_formats; do
if test -n "`echo $doc_formats_list | $GREP -E \"(^| )$i( |\$)\"`"; then
eval "have_xmlto$i=true"
else
AC_ERROR(Unknown doc format $i!)
fi
done
AC_MSG_RESULT($doc_formats)
else
AC_MSG_RESULT([deactivated (requires xmlto)])
fi
# Make sure that xmltopdf actually works
if $have_xmltopdf; then
AC_MSG_CHECKING([whether pdf creation works])
oldcwd="$(pwd)"
top_srcdir() { echo "$srcdir"; }
mkdir test-pdf
cd test-pdf
cat>test-db.xml<<EOF
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<book id="foobook">
<bookinfo>
<title>Foo Title</title>
</bookinfo>
<chapter id="foochapter">
<title>Foo Chapter</title>
<para>
Foo bar blah blah
<!--ulink url="https://www.hypothetical-url.invalid/with&amp;ersand">ampersand</ulink-->.
</para>
</chapter>
</book>
EOF
${PURE_XMLTO} pdf -o . test-db.xml --searchpath ..
if test -s test-db.pdf; then
AC_MSG_RESULT([yes, look at $(pwd)/test-db.pdf to verify])
else
if $have_xmltopdf; then
AC_MSG_ERROR([PDF creation requested, but failed. See $(pwd) ...])
else
AC_MSG_RESULT([no, but not requested])
fi
fi
cd "$oldcwd"
unset top_srcdir
fi
AM_CONDITIONAL(XMLTOHTML,$have_xmltohtml)
AM_CONDITIONAL(XMLTOMAN,$have_xmltoman)
AM_CONDITIONAL(XMLTOTXT,$have_xmltotxt)
AM_CONDITIONAL(XMLTOTXT2,$have_xmltotxt && $have_w3m)
AM_CONDITIONAL(XMLTOPDF,$have_xmltopdf)
AM_CONDITIONAL(XMLTOPS,$have_xmltops)
# create list of supported formats
AC_MSG_CHECKING([for manual formats to re­create])
xxx=""
manual_html=""
manual_pdf=""
manual_ps=""
if $have_xmltohtml; then
xxx="${xxx} html"
fi
if $have_xmltoman; then
xxx="${xxx} man"
fi
if $have_xmltopdf; then
xxx="${xxx} pdf"
fi
if $have_xmltops; then
xxx="${xxx} ps"
fi
if $have_xmltotxt; then
xxx="${xxx} txt"
fi
AC_SUBST(manual_html)
AC_SUBST(manual_pdf)
AC_SUBST(manual_ps)
AC_MSG_RESULT($xxx)
if test "x$xxx" != "x"
then
if $have_fig2dev; then
fig_out=""
else
fig_out="out"
fi
manual_msg="in (${xxx} ) formats with${fig_out} figures"
fi
])dnl

View File

@@ -0,0 +1,40 @@
dnl ---------------------------------------------------------------------------
dnl fig2dev: This program is needed for processing images. If not found,
dnl documentation can still be built, but without figures.
dnl ---------------------------------------------------------------------------
AC_DEFUN([GP_CHECK_FIG2DEV],
[
try_fig2dev=true
have_fig2dev=false
AC_ARG_WITH(fig2dev, [ --without-fig2dev Don't use fig2dev],[
if test "x$withval" = "xno"; then
try_fig2dev=false
fi])
if $try_fig2dev; then
AC_PATH_PROG(FIG2DEV,fig2dev)
if test -n "${FIG2DEV}"; then
have_fig2dev=true
fi
fi
if $have_fig2dev; then
AC_SUBST(FIG2DEV)
${FIG2DEV} -L ps > /dev/null <<EOF
#FIG 3.2
Landscape
Center
Inches
Letter
100.00
Single
-2
1200 2
1 3 0 1 0 7 50 0 -1 0.000 1 0.0000 3000 3750 270 270 3000 3750 3150 3975
EOF
if test $? != 0; then
have_fig2dev=false
fi
fi
AM_CONDITIONAL(ENABLE_FIGURES, $have_fig2dev)
])

View File

@@ -0,0 +1,49 @@
dnl ---------------------------------------------------------------------------
dnl dot: This program is needed for processing images. If not found,
dnl documentation can still be built, but without figures.
dnl ---------------------------------------------------------------------------
AC_DEFUN([GP_CHECK_DOT],
[
try_dot=true
have_dot=false
AC_ARG_WITH(dot, [ --without-dot Don't use dot],[
if test "x$withval" = "xno"; then
try_dot=false
fi])
if $try_dot; then
AC_PATH_PROG(DOT,dot)
if test -n "${DOT}"; then
have_dot=true
fi
fi
if $have_dot; then
AC_SUBST(DOT)
AC_MSG_CHECKING([whether ${DOT} works])
${DOT} -Tps -o tesseract.ps 2> /dev/null <<EOF
graph tesseract {
node [[shape=point]];
o -- {a;b;c;d;}
a -- {ab;ac;ad;}
b -- {ab;bc;bd;}
c -- {ac;bc;cd;}
d -- {ad;bd;cd;}
ab -- {abc;abd;}
ac -- {abc;acd;}
ad -- {abd;acd;}
bc -- {abc;bcd;}
bd -- {abd;bcd;}
cd -- {acd;bcd;}
{abc;abd;acd;bcd;} -- abcd;
}
EOF
if test $? != 0 || test ! -f tesseract.ps; then
have_dot=false
AC_MSG_RESULT([no (see http://www.graphviz.org/ ...)])
else
AC_MSG_RESULT(yes)
fi
fi
AM_CONDITIONAL(ENABLE_GRAPHS, $have_dot)
])

View File

@@ -0,0 +1,24 @@
dnl ---------------------------------------------------------------------------
dnl gtk-doc: We use gtk-doc for building our documentation. However, we
dnl require the user to explicitely request the build.
dnl ---------------------------------------------------------------------------
AC_DEFUN([GP_CHECK_GTK_DOC],
[
try_gtkdoc=false
gtkdoc_msg="no (not requested)"
have_gtkdoc=false
AC_ARG_ENABLE(docs, [ --enable-docs Use gtk-doc to build documentation [default=no]],[
if test x$enableval = xyes; then
try_gtkdoc=true
fi])
if $try_gtkdoc; then
AC_PATH_PROG(GTKDOC,gtkdoc-mkdb)
if test -n "${GTKDOC}"; then
have_gtkdoc=true
gtkdoc_msg="yes"
else
gtkdoc_msg="no (http://www.gtk.org/rdp/download.html)"
fi
fi
AM_CONDITIONAL(ENABLE_GTK_DOC, $have_gtkdoc)
])

View File

@@ -0,0 +1,35 @@
dnl ---------------------------------------------------------------------------
dnl pstoimg: This program is needed for processing images. If not found,
dnl documentation can still be built, but without figures.
dnl ---------------------------------------------------------------------------
AC_DEFUN([GP_CHECK_PSTOIMG],
[
AC_REQUIRE([GP_CHECK_DOT])
try_pstoimg=true
have_pstoimg=false
AC_ARG_WITH(pstoimg, [ --without-pstoimg Don't use pstoimg],[
if test "x$withval" = "xno"; then
try_pstoimg=false
fi])
if $try_pstoimg; then
AC_PATH_PROG(PSTOIMG,pstoimg)
if test -n "${PSTOIMG}"; then
have_pstoimg=true
fi
fi
if $have_pstoimg; then
AC_SUBST(PSTOIMG)
AC_MSG_CHECKING([whether ${PSTOIMG} works])
rm -f tesseract.png
${PSTOIMG} -type png -scale 1.2 -antialias -crop a tesseract.ps > /dev/null
if test $? != 0 || test ! -f tesseract.png; then
have_pstoimg=false
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
fi
fi
AM_CONDITIONAL(ENABLE_PSTOIMG, $have_pstoimg)
])

View File

@@ -0,0 +1,45 @@
dnl ---------------------------------------------------------------------------
dnl w3m: This program is needed for converting HTML to text.
dnl ---------------------------------------------------------------------------
AC_DEFUN([GP_CHECK_W3M],
[
try_w3m=true
have_w3m=false
AC_ARG_WITH(w3m, [ --without-w3m Don't use w3m],[
if test "x$withval" = "xno"; then
try_w3m=false
fi])
if $try_w3m; then
AC_PATH_PROG(W3M,w3m)
if test -n "${W3M}"; then
have_w3m=true
fi
fi
if $have_w3m; then
AC_MSG_CHECKING([whether ${W3M} works])
cat > html2text-test.xxxhtml 2> /dev/null <<EOF
<html>
<title>
<h1>HTML2TEXT Test</h1>
</title>
<body>
<p>This is a test.</p>
</body>
</html>
EOF
${W3M} -T text/html -cols 78 -dump html2text-test.xxxhtml > html2text-test.txt
if test $? != 0 || test ! -f html2text-test.txt || test ! -s html2text-test.txt
then
have_w3m=false
AC_MSG_RESULT([no (see http://www.w3m.org/ or http://w3m.sourceforge.net/ ...)])
W3M=false
AC_SUBST(W3M)
else
AC_MSG_RESULT([yes])
AC_SUBST(W3M)
fi
fi
AM_CONDITIONAL([HAVE_W3M], [$have_w3m])
])