1dnl
2dnl check where to install documentation
3dnl
4dnl determines documentation "root directory", i.e. the directory
5dnl where all documentation will be placed in
6dnl
7
8AC_DEFUN([GP_CHECK_DOC_DIR],
9[
10AC_BEFORE([$0], [GP_BUILD_GTK_DOCS])dnl
11AC_BEFORE([$0], [GP_CHECK_DOXYGEN])dnl
12
13AC_ARG_WITH([doc-dir],
14[AS_HELP_STRING([--with-doc-dir=PATH],
15[Where to install docs  [default=autodetect]])])
16
17# check for the main ("root") documentation directory
18AC_MSG_CHECKING([main docdir])
19
20if test "x${with_doc_dir}" != "x"
21then # docdir is given as parameter
22    docdir="${with_doc_dir}"
23    AC_MSG_RESULT([${docdir} (from parameter)])
24else # otherwise invent a docdir hopefully compatible with system policy
25    if test -d "/usr/share/doc"
26    then
27        maindocdir='${prefix}/share/doc'
28        AC_MSG_RESULT([${maindocdir} (FHS style)])
29    elif test -d "/usr/doc"
30    then
31        maindocdir='${prefix}/doc'
32        AC_MSG_RESULT([${maindocdir} (old style)])
33    else
34        maindocdir='${datadir}/doc'
35        AC_MSG_RESULT([${maindocdir} (default value)])
36    fi
37    AC_MSG_CHECKING([package docdir])
38    # check whether to include package version into documentation path
39    # FIXME: doesn't work properly.
40    if ls -d /usr/{share/,}doc/make-[0-9]* > /dev/null 2>&1
41    then
42        docdir="${maindocdir}/${PACKAGE}-${VERSION}"
43        AC_MSG_RESULT([${docdir} (redhat style)])
44    else
45        docdir="${maindocdir}/${PACKAGE}"
46        AC_MSG_RESULT([${docdir} (default style)])
47    fi
48fi
49
50AC_SUBST([docdir])
51])dnl
52
53dnl
54dnl check whether to build docs and where to:
55dnl
56dnl * determine presence of prerequisites (only gtk-doc for now)
57dnl * determine destination directory for HTML files
58dnl
59
60AC_DEFUN([GP_BUILD_GTK_DOCS],
61[
62# docdir has to be determined in advance
63AC_REQUIRE([GP_CHECK_DOC_DIR])
64
65# ---------------------------------------------------------------------------
66# gtk-doc: We use gtk-doc for building our documentation. However, we
67#          require the user to explicitely request the build.
68# ---------------------------------------------------------------------------
69try_gtkdoc=false
70gtkdoc_msg="no (not requested)"
71have_gtkdoc=false
72AC_ARG_ENABLE([docs],
73[AS_HELP_STRING([--enable-docs],
74[Use gtk-doc to build documentation [default=no]])],[
75	if test x$enableval = xyes; then
76		try_gtkdoc=true
77	fi
78])
79if $try_gtkdoc; then
80	AC_PATH_PROG([GTKDOC],[gtkdoc-mkdb])
81	if test -n "${GTKDOC}"; then
82		have_gtkdoc=true
83		gtkdoc_msg="yes"
84	else
85		gtkdoc_msg="no (http://www.gtk.org/rdp/download.html)"
86	fi
87fi
88AM_CONDITIONAL([ENABLE_GTK_DOC], [$have_gtkdoc])
89GP_CONFIG_MSG([build API docs with gtk-doc],[$gtkdoc_msg])
90
91
92# ---------------------------------------------------------------------------
93# Give the user the possibility to install html documentation in a
94# user-defined location.
95# ---------------------------------------------------------------------------
96AC_ARG_WITH([html-dir],
97[AS_HELP_STRING([--with-html-dir=PATH],
98[Where to install html docs [default=autodetect]])])
99
100AC_MSG_CHECKING([for html dir])
101if test "x${with_html_dir}" = "x" ; then
102    htmldir="${docdir}/html"
103    AC_MSG_RESULT([${htmldir} (default)])
104else
105    htmldir="${with_html_dir}"
106    AC_MSG_RESULT([${htmldir} (from parameter)])
107fi
108AC_SUBST([htmldir])
109apidocdir="${htmldir}/api"
110AC_SUBST([apidocdir])
111
112])dnl
113
114