]> git.draconx.ca Git - rarpd-dx.git/blob - m4/xsltproc.m4
Move docbook/xsltproc configure test into separate m4 file.
[rarpd-dx.git] / m4 / xsltproc.m4
1 dnl Copyright © 2023 Nick Bowler
2 dnl
3 dnl License WTFPL2: Do What The Fuck You Want To Public License, version 2.
4 dnl This is free software: you are free to do what the fuck you want to.
5 dnl There is NO WARRANTY, to the extent permitted by law.
6
7 dnl CHECK_XSLTPROC
8 dnl
9 dnl Check whether xsltproc can be run to compile the rarpd man page.
10 dnl
11 dnl If found, sets XSLTPROC and the cache variable dx_cv_xsltproc_works=yes
12 AC_DEFUN([CHECK_XSLTPROC],
13 [AC_CHECK_PROGS([XSLTPROC], [xsltproc], [not found])
14 AS_IF([test x"$XSLTPROC" != x"not found"],
15   [AC_CACHE_CHECK([whether $XSLTPROC works], [dx_cv_xsltproc_works],
16 [dx_cv_xsltproc_works=no
17 cat >conftest.xsl <<'EOF'
18 <?xml version='1.0' encoding='UTF-8' ?>
19 <xsl:stylesheet version='1.0'
20   xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
21 <xsl:import href="http://docbook.sourceforge.net/release/xsl-ns/current/manpages/docbook.xsl"/>
22 <xsl:output omit-xml-declaration='yes' />
23 <xsl:template match='/'><xsl:text>hello</xsl:text></xsl:template>
24 </xsl:stylesheet>
25 EOF
26 cat >conftest.xml <<'EOF'
27 <?xml version='1.0' encoding='UTF-8' ?>
28 <root />
29 EOF
30 $XSLTPROC --nonet conftest.xsl conftest.xml >conftest.out 2>&AS_MESSAGE_LOG_FD &&
31   { read var <conftest.out; test x"$var" = x"hello"; } &&
32   dx_cv_xsltproc_works=yes
33 rm -f conftest.xsl conftest.xml conftest.out])])])