Check whether 'xmlto man' actually works

If xmlto is present, create a very simple example man page by
running 'xmlto man'. Only generate man pages at "make all" time
if this works.

The check is a little lenthy, so we might want to put it into
a separate .m4 file some time.

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Hans Ulrich Niedermann 2008-02-11 10:19:10 +01:00 committed by Julien Danjou
parent d68ba7fa12
commit 593f92c24d
2 changed files with 40 additions and 0 deletions

View File

@ -159,11 +159,13 @@ awesome_message_LDADD = $(XFT_LIBS) $(X_LIBS) $(CAIRO_LIBS) $(CONFUSE_LIBS)
if HAVE_XMLTO
if HAVE_ASCIIDOC
if XMLTO_MAN_WORKS
man_MANS += awesome.1
man_MANS += awesome-client.1
man_MANS += awesomerc.1
endif
endif
endif
EXTRA_DIST += awesome.1.txt
EXTRA_DIST += awesome-client.1.txt

View File

@ -54,6 +54,44 @@ AM_CONDITIONAL([HAVE_ASCIIDOC], [test "x$ASCIIDOC" != "x:"])
AM_CONDITIONAL([HAVE_XMLTO], [test "x$XMLTO" != "x:"])
AM_CONDITIONAL([HAVE_DOXYGEN], [test "x$DOXYGEN" != "x:"])
xmlto_man_works=no
if test ="x$XMLTO" != "x:"; then dnl try generating an example man page
rm -f conf-example.1
cat>conf-example.1.xml<<MANEOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<refentry>
<refmeta>
<refentrytitle>conf-example</refentrytitle>
<manvolnum>1</manvolnum>
</refmeta>
<refnamediv>
<refname>conf-example</refname>
<refpurpose>'configure' time test for working 'xmlto man'</refpurpose>
</refnamediv>
<refsynopsisdiv>
<simpara>foo</simpara>
</refsynopsisdiv>
<refsect1>
<title>DESCRIPTION</title>
<simpara>bar</simpara>
</refsect1>
</refentry>
MANEOF
AC_MSG_CHECKING([whether xmlto can create a man page])
if ${XMLTO} man conf-example.1.xml >/dev/null 2>&1 && test -s conf-example.1; then
xmlto_man_works=yes
AC_MSG_RESULT([yes])
rm -f conf-example.1 conf-example.1.xml
else
AC_MSG_RESULT([no])
AC_MSG_WARN([awesome man page generation requires 'xmlto man', but it does not work.
Do you need to (properly) install http://docbook.sourceforge.net/projects/xsl/?])
fi
fi
AM_CONDITIONAL([XMLTO_MAN_WORKS], [test "x$xmlto_man_works" = "xyes"])
AM_CONDITIONAL([USING_GCC], [test "x$GCC" = "xyes"])
AC_CANONICAL_HOST