]> git.draconx.ca Git - rarpd-dx.git/commitdiff
Move docbook/xsltproc configure test into separate m4 file.
authorNick Bowler <nbowler@draconx.ca>
Fri, 28 Jul 2023 04:40:14 +0000 (00:40 -0400)
committerNick Bowler <nbowler@draconx.ca>
Fri, 28 Jul 2023 04:40:52 +0000 (00:40 -0400)
configure.ac
m4/.gitignore [deleted file]
m4/xsltproc.m4 [new file with mode: 0644]

index cd2be37b1779180253772aa0d1f0331e91e398f3..6eff55163bb21f63e8e77749e136d27afe7fea9b 100644 (file)
@@ -12,27 +12,7 @@ AM_SILENT_RULES([yes])
 
 AC_PROG_CC
 
-AC_CHECK_PROGS([XSLTPROC], [xsltproc], [not found])
-AS_IF([test x"$XSLTPROC" != x"not found"],
-  [AC_CACHE_CHECK([whether $XSLTPROC works], [dx_cv_xsltproc_works],
-[dx_cv_xsltproc_works=no
-cat >conftest.xsl <<'EOF'
-<?xml version='1.0' encoding='UTF-8' ?>
-<xsl:stylesheet version='1.0'
-  xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
-<xsl:import href="http://docbook.sourceforge.net/release/xsl-ns/current/manpages/docbook.xsl"/>
-<xsl:output omit-xml-declaration='yes' />
-<xsl:template match='/'><xsl:text>hello</xsl:text></xsl:template>
-</xsl:stylesheet>
-EOF
-cat >conftest.xml <<'EOF'
-<?xml version='1.0' encoding='UTF-8' ?>
-<root />
-EOF
-$XSLTPROC --nonet conftest.xsl conftest.xml >conftest.out 2>&AS_MESSAGE_LOG_FD &&
-  { read var <conftest.out; test x"$var" = x"hello"; } &&
-  dx_cv_xsltproc_works=yes
-rm -f conftest.xsl conftest.xml conftest.out])])
+CHECK_XSLTPROC
 AM_CONDITIONAL([HAVE_XSLTPROC], [test x"$dx_cv_xsltproc_works" = x"yes"])
 
 AC_CONFIG_FILES([Makefile])
diff --git a/m4/.gitignore b/m4/.gitignore
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/m4/xsltproc.m4 b/m4/xsltproc.m4
new file mode 100644 (file)
index 0000000..2e0dbe4
--- /dev/null
@@ -0,0 +1,33 @@
+dnl Copyright © 2023 Nick Bowler
+dnl
+dnl License WTFPL2: Do What The Fuck You Want To Public License, version 2.
+dnl This is free software: you are free to do what the fuck you want to.
+dnl There is NO WARRANTY, to the extent permitted by law.
+
+dnl CHECK_XSLTPROC
+dnl
+dnl Check whether xsltproc can be run to compile the rarpd man page.
+dnl
+dnl If found, sets XSLTPROC and the cache variable dx_cv_xsltproc_works=yes
+AC_DEFUN([CHECK_XSLTPROC],
+[AC_CHECK_PROGS([XSLTPROC], [xsltproc], [not found])
+AS_IF([test x"$XSLTPROC" != x"not found"],
+  [AC_CACHE_CHECK([whether $XSLTPROC works], [dx_cv_xsltproc_works],
+[dx_cv_xsltproc_works=no
+cat >conftest.xsl <<'EOF'
+<?xml version='1.0' encoding='UTF-8' ?>
+<xsl:stylesheet version='1.0'
+  xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
+<xsl:import href="http://docbook.sourceforge.net/release/xsl-ns/current/manpages/docbook.xsl"/>
+<xsl:output omit-xml-declaration='yes' />
+<xsl:template match='/'><xsl:text>hello</xsl:text></xsl:template>
+</xsl:stylesheet>
+EOF
+cat >conftest.xml <<'EOF'
+<?xml version='1.0' encoding='UTF-8' ?>
+<root />
+EOF
+$XSLTPROC --nonet conftest.xsl conftest.xml >conftest.out 2>&AS_MESSAGE_LOG_FD &&
+  { read var <conftest.out; test x"$var" = x"hello"; } &&
+  dx_cv_xsltproc_works=yes
+rm -f conftest.xsl conftest.xml conftest.out])])])