2 dnl check where to install documentation
4 dnl determines documentation "root directory", i.e. the directory
5 dnl where all documentation will be placed in
8 AC_DEFUN([GP_DOC_GENERAL],[dnl
9 AC_MSG_CHECKING([whether to build any docs])
10 AC_ARG_ENABLE([docs], [dnl
11 AS_HELP_STRING([--disable-docs], [whether to create any documentation])], [dnl
13 yes|true|on) gp_build_docs="yes" ;;
14 *) gp_build_docs="no" ;;
19 AC_MSG_RESULT([${gp_build_docs}])
20 AM_CONDITIONAL([BUILD_DOCS], [test "x${gp_build_docs}" = "xyes"])
23 AC_DEFUN([GP_CHECK_DOC_DIR],
25 AC_REQUIRE([GP_DOC_GENERAL])dnl
26 AC_BEFORE([$0], [GP_BUILD_GTK_DOCS])dnl
27 AC_BEFORE([$0], [GP_CHECK_DOXYGEN])dnl
29 AC_ARG_WITH([doc-dir],
30 [AS_HELP_STRING([--with-doc-dir=PATH],
31 [Where to install docs [default=autodetect]])])
33 # check for the main ("root") documentation directory
34 AC_MSG_CHECKING([main docdir])
36 if test "x${with_doc_dir}" != "x"
37 then # docdir is given as parameter
38 docdir="${with_doc_dir}"
39 AC_MSG_RESULT([${docdir} (from parameter)])
40 else # otherwise invent a docdir hopefully compatible with system policy
41 if test -d "/usr/share/doc"
43 maindocdir='${prefix}/share/doc'
44 AC_MSG_RESULT([${maindocdir} (FHS style)])
45 elif test -d "/usr/doc"
47 maindocdir='${prefix}/doc'
48 AC_MSG_RESULT([${maindocdir} (old style)])
50 maindocdir='${datadir}/doc'
51 AC_MSG_RESULT([${maindocdir} (default value)])
53 AC_MSG_CHECKING([package docdir])
54 # check whether to include package version into documentation path
55 # FIXME: doesn't work properly.
56 if ls -d /usr/{share/,}doc/make-[0-9]* > /dev/null 2>&1
58 docdir="${maindocdir}/${PACKAGE}-${VERSION}"
59 AC_MSG_RESULT([${docdir} (redhat style)])
61 docdir="${maindocdir}/${PACKAGE}"
62 AC_MSG_RESULT([${docdir} (default style)])
70 dnl check whether to build docs and where to:
72 dnl * determine presence of prerequisites (only gtk-doc for now)
73 dnl * determine destination directory for HTML files
76 AC_DEFUN([GP_BUILD_GTK_DOCS],
78 # docdir has to be determined in advance
79 AC_REQUIRE([GP_CHECK_DOC_DIR])
81 # ---------------------------------------------------------------------------
82 # gtk-doc: We use gtk-doc for building our documentation. However, we
83 # require the user to explicitely request the build.
84 # ---------------------------------------------------------------------------
86 gtkdoc_msg="no (not requested)"
89 [AS_HELP_STRING([--enable-docs],
90 [Use gtk-doc to build documentation [default=no]])],[
91 if test x$enableval = xyes; then
96 AC_PATH_PROG([GTKDOC],[gtkdoc-mkdb])
97 if test -n "${GTKDOC}"; then
101 gtkdoc_msg="no (http://www.gtk.org/rdp/download.html)"
104 AM_CONDITIONAL([ENABLE_GTK_DOC], [$have_gtkdoc])
105 GP_CONFIG_MSG([build API docs with gtk-doc],[$gtkdoc_msg])
108 # ---------------------------------------------------------------------------
109 # Give the user the possibility to install html documentation in a
110 # user-defined location.
111 # ---------------------------------------------------------------------------
112 AC_ARG_WITH([html-dir],
113 [AS_HELP_STRING([--with-html-dir=PATH],
114 [Where to install html docs [default=autodetect]])])
116 AC_MSG_CHECKING([for html dir])
117 if test "x${with_html_dir}" = "x" ; then
118 htmldir="${docdir}/html"
119 AC_MSG_RESULT([${htmldir} (default)])
121 htmldir="${with_html_dir}"
122 AC_MSG_RESULT([${htmldir} (from parameter)])
125 apidocdir="${htmldir}/api"
126 AC_SUBST([apidocdir}])
131 dnl doxygen related stuff
133 dnl define substitutions for Doxyfile.in
134 AC_DEFUN([GP_CHECK_DOXYGEN],[dnl
135 AC_REQUIRE([GP_CHECK_DOC_DIR])dnl
136 AC_PATH_PROG([DOT], [dot], [false])
137 AC_PATH_PROG([DOXYGEN], [doxygen], [false])
138 AM_CONDITIONAL([HAVE_DOXYGEN], [test "x$DOXYGEN" != "xfalse"])
139 AM_CONDITIONAL([HAVE_DOT], [test "x$DOT" != "xfalse"])
140 if test "x$DOT" != "xfalse"; then
141 AC_SUBST([HAVE_DOT],[YES])
143 AC_SUBST([HAVE_DOT],[NO])
145 AC_SUBST([HTML_APIDOC_DIR], ["${PACKAGE_TARNAME}-api.html"])
146 AC_SUBST([DOXYGEN_OUTPUT_DIR], [doxygen-output])
147 AC_SUBST([HTML_APIDOC_INTERNALS_DIR], ["${PACKAGE_TARNAME}-internals.html"])