hc
2024-11-01 2f529f9b558ca1c1bd74be7437a84e4711743404
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
#                                               -*- Autoconf -*-
# Building Docbook-XML documents with the autotools.
#
# Check whether needed tools for generating Docbook XML doc are installed and
# running. 
#  - "docbook-root" is the name of the source tree subdirectory which is the
# docbook documentation root. It is expected to contain at least : 
#      catalog.in, used to match DTD generic addresses to their local copy ;
#      pictures, with all the pictures referenced by the XML documents ;
#      css, with the CSS referenced by the html documents.
#
#  - "generated-doc-root" is the name of the source tree subdirectory which 
# contains the generated documentation. It is expected to contain at least :
#      html/pictures with the pictures needed by the html documents ;
#      html/css with the css needed by the html documents ;
#      html/* one directory by html document ;
#      pdf/*.pdf one pdf file by pdf document ;
#
#  - "docbook-dtd-version" is the version of the Docbook-XML DTD used.
#
# DBX_DOC_INIT(docbook-root, generated-doc-root, docbook-dtd-version)
# ------------------------------------------------------------------------------
AC_DEFUN([DBX_DOC_INIT], 
[
DBX_DOC_ROOT="$1"
AC_SUBST(DBX_DOC_ROOT)
 
AC_MSG_CHECKING(whether compiling Docbook XML documentation)
AC_ARG_ENABLE(dbx, 
        AS_HELP_STRING([--enable-dbx],[Build Docbook XML documentation.]),
   [case "$enableval" in
   y | ye | yes) DBX_DOC=yes;;
   *) DBX_DOC="" ;;
   esac])
 
if test \! -f "$srcdir/$1/catalog.in"; then
    if test x$DBX_DOC = xyes;
    then
        AC_MSG_ERROR([$1/catalog.in could not be found in the source tree,
DocBook documentation can not be generated.])
    fi
    AC_MSG_RESULT([not present.])
else
    AC_MSG_RESULT(${DBX_DOC:-no})
fi
AM_CONDITIONAL(DBX_DOC,[test "$DBX_DOC" = yes])
 
DBX_GEN_DOC_ROOT="$2"
AC_SUBST(DBX_GEN_DOC_ROOT)
 
# First: search for needed tools.
AC_CHECK_PROG(DBX_LINT, xmllint, xmllint)
if test x"$DBX_LINT" = x -a -n "$DBX_DOC"; then
   AC_MSG_ERROR([xmllint was not found. Check your PATH variable and try again.])
fi
AC_SUBST(DBX_LINT)
 
 
AC_CHECK_PROG(DBX_XSLTPROC, xsltproc, xsltproc)
if test x"$DBX_XSLTPROC" = x -a -n "$DBX_DOC"; then
   AC_MSG_ERROR([xsltproc was not found. Check your PATH variable and try 
again.])
fi
AC_SUBST(DBX_XSLTPROC)
 
 
AC_CHECK_PROG(DBX_FOP, fop, fop)
if test x"$DBX_FOP" = x -a -n "$DBX_DOC"; then
   AC_MSG_ERROR([fop was not found. Check your PATH variable and try again.])
fi
AC_SUBST(DBX_FOP)
 
# Second: search for DTD and XSL stylesheets.
DBX_DTD_VERSION="$3"
 
AC_MSG_CHECKING(whether Docbook XML documentation generation can use network.)
AC_ARG_ENABLE(dbx-network,
        AS_HELP_STRING([--enable-dbx-network],[Try to access Docbook DTD and
XSL stylesheets through network (default is to die if local installation can not
be found by configure).]),
        [ case "$enable_dbx_network" in 
           y | yes | yes )
                DBX_NET=yes;;
           n | no )
                DBX_NET="";;
          esac
        ])
 
# Do not define the --nonet xsltproc flag if the option --enable-dbx-network was
# passed
AC_MSG_RESULT(${DBX_NET:-no})
if test -n "$DBX_NET"; then
    unset DBX_MAYBE_NONET
else
    DBX_MAYBE_NONET=--nonet
fi
AC_SUBST(DBX_MAYBE_NONET)
 
 
AC_MSG_CHECKING(for docbook-xml root dir)
AC_ARG_WITH(dbx-root,
        AS_HELP_STRING([--with-dbx-root],[specify the Docbook XML root (that 
is, the directory where docbookx.dtd should be found). Default is to use
well-known locations (or network if --enable-dbx-network was passed).]),
        [DBX_ROOT="$withval"])
if test x"$DBX_ROOT" = x; then
   # Still not found, we will hence look for it using the "well-known"
   # places (well... for the moment, only the Debian package directory) 
   for dir in \
       /usr/share/sgml/docbook/dtd/xml/$DBX_DTD_VERSION
   do
        if test -e $dir/docbookx.dtd; then
           DBX_ROOT="$dir"; 
           break;
        fi
   done
fi
AC_MSG_RESULT(${DBX_ROOT:-network})
if test x"$DBX_ROOT" = x; then
   if test x"$enable_dbx_network" != x  -a -n "$DBX_DOC"; then 
        AC_MSG_ERROR([The Docbook XML DTD was not found, and accessing it
through network is forbidden.])
   fi
   DBX_ROOT="http://www.oasis-open.org/docbook/xml/$DBX_DTD_VERSION/"
else
   DBX_ROOT="file://$DBX_ROOT"
fi
AC_SUBST(DBX_ROOT)
 
 
AC_MSG_CHECKING(for docbook-xsl root dir)
AC_ARG_WITH(docbook-xsl-root,
   AS_HELP_STRING([--with-dbx-xsl-root],[specify the Docbook XML XSL
stylesheet root. Default is to use well-known locations (or network if
--enable-dbx-network was passed)]),
        [ DBX_XSL_ROOT="$withval" ])
if test x"$DBX_XSL_ROOT" = x; then
   # Still not found, we will hence look for it using the "well-known"
   # places (well... for the moment, only the Debian standard directory) 
   for dir in \
       /usr/share/sgml/docbook/stylesheet/xsl/nwalsh
   do
        if test -e "$dir/html/docbook.xsl"; then
           DBX_XSL_ROOT="$dir"; 
           break;
        fi
   done
fi
AC_MSG_RESULT(${DBX_XSL_ROOT:-network})
if test x"$DBX_XSL_ROOT" = x; then
   if test x"$enable_dbx_network" != x -a -n "$DBX_DOC"; then
        AC_MSG_ERROR([The Docbook XML DTD was not found, and accessing it 
through network is forbidden.])
   fi
   DBX_XSL_ROOT="http://http://docbook.sourceforge.net/release/xsl/current"
else
   DBX_XSL_ROOT="file://$DBX_XSL_ROOT"
fi
AC_SUBST(DBX_XSL_ROOT)
 
 
DBX_ABS_SRCDIR=`case $srcdir in
  [\\/]* | ?:[\\/]* ) echo : ;;
  *) echo false ;;
esac`
AM_CONDITIONAL(DBX_ABS_SRCDIR, $DBX_ABS_SRCDIR)
 
 
])