Collection of DPF-based plugins for packaging
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
4.1KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_check_docbook_dtd.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_CHECK_DOCBOOK_DTD([dtd-version])
  8. #
  9. # DESCRIPTION
  10. #
  11. # Check for access to a docbook DTD of a particular revision. This macro
  12. # can be used for multiple versions within the same script.
  13. #
  14. # Input:
  15. #
  16. # $1 is the version of docbook to search for; default 'current'.
  17. #
  18. # Output:
  19. #
  20. # $HAVE_DOCBOOK_DTD_VERS will be set to 'yes' or 'no' depending on the
  21. # results of the test, where VERS is $1, with '_' substituted for '.'
  22. # $HAVE_DOCBOOK_DTD will also be set to the same value.
  23. #
  24. # Example:
  25. #
  26. # AX_CHECK_DOCBOOK_DTD(4.3)
  27. # if test "x$HAVE_DOCBOOK_DTD_4_3" = "xyes"; then
  28. # ...
  29. #
  30. # LICENSE
  31. #
  32. # Copyright (c) 2008 Zmanda Inc. <http://www.zmanda.com/>
  33. # Copyright (c) 2008 Dustin J. Mitchell <dustin@zmanda.com>
  34. #
  35. # This program is free software; you can redistribute it and/or modify it
  36. # under the terms of the GNU General Public License as published by the
  37. # Free Software Foundation; either version 2 of the License, or (at your
  38. # option) any later version.
  39. #
  40. # This program is distributed in the hope that it will be useful, but
  41. # WITHOUT ANY WARRANTY; without even the implied warranty of
  42. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
  43. # Public License for more details.
  44. #
  45. # You should have received a copy of the GNU General Public License along
  46. # with this program. If not, see <https://www.gnu.org/licenses/>.
  47. #
  48. # As a special exception, the respective Autoconf Macro's copyright owner
  49. # gives unlimited permission to copy, distribute and modify the configure
  50. # scripts that are the output of Autoconf when processing the Macro. You
  51. # need not follow the terms of the GNU General Public License when using
  52. # or distributing such scripts, even though portions of the text of the
  53. # Macro appear in them. The GNU General Public License (GPL) does govern
  54. # all other use of the material that constitutes the Autoconf Macro.
  55. #
  56. # This special exception to the GPL applies to versions of the Autoconf
  57. # Macro released by the Autoconf Archive. When you make and distribute a
  58. # modified version of the Autoconf Macro, you may extend this special
  59. # exception to the GPL to apply to your modified version as well.
  60. #serial 6
  61. AU_ALIAS([AC_CHECK_DOCBOOK_DTD], [AX_CHECK_DOCBOOK_DTD])
  62. AC_DEFUN([AX_CHECK_DOCBOOK_DTD],
  63. [
  64. AC_REQUIRE([AX_PROG_XSLTPROC])
  65. dnl define a temporary variable for the version, so this macro can be
  66. dnl used with multiple versions
  67. define([_VERS], $1)
  68. ifelse(_VERS, [], [define([_VERS], [current])])
  69. define([ac_cv_docbook_dtd_VERS], patsubst([ac_cv_docbook_dtd_]_VERS, [\.], [_]))
  70. define([HAVE_DOCBOOK_DTD_VERS], patsubst([HAVE_DOCBOOK_DTD_]_VERS, [\.], [_]))
  71. AC_CACHE_CHECK([for Docbook DTD version ]_VERS, [ac_cv_docbook_dtd_VERS],
  72. [
  73. ac_cv_docbook_dtd_VERS=no
  74. if test -n "$XSLTPROC"; then
  75. MY_XSLTPROC_FLAGS=`echo "" $XSLTPROC_FLAGS|sed -e s/--novalid//g`
  76. cat <<EOF >conftest.xml
  77. <?xml version="1.0" encoding='ISO-8859-1'?>
  78. <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V[]_VERS//EN" "http://www.oasis-open.org/docbook/xml/_VERS/docbookx.dtd">
  79. <book id="empty">
  80. </book>
  81. EOF
  82. echo "Trying '$XSLTPROC $MY_XSLTPROC_FLAGS conftest.xml'" >&AS_MESSAGE_LOG_FD
  83. $XSLTPROC $MY_XSLTPROC_FLAGS conftest.xml >conftest.out 2>&1
  84. if test "$?" = 0 -o "$?" = 5; then
  85. # failing to load the DTD is just a warning, so check for it in the output.
  86. if grep 'warning: failed to load external entity' conftest_out >/dev/null 2>&1; then
  87. : # no good..
  88. else
  89. ac_cv_docbook_dtd_VERS=yes
  90. fi
  91. fi
  92. cat conftest.out >&AS_MESSAGE_LOG_FD
  93. rm -f conftest.xml conftest.out
  94. fi
  95. ])
  96. HAVE_DOCBOOK_DTD_VERS="$ac_cv_docbook_dtd_VERS"
  97. HAVE_DOCBOOK_DTD=HAVE_DOCBOOK_DTD_VERS
  98. undefine([_VERS])
  99. ])