1 dnl 2 dnl check where to install documentation 3 dnl 4 dnl determines documentation "root directory", i.e. the directory 5 dnl where all documentation will be placed in 6 dnl 7 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 12 case "$enableval" in 13 yes|true|on) gp_build_docs="yes" ;; 14 *) gp_build_docs="no" ;; 15 esac 16 ],[dnl 17 gp_build_docs="yes" 18 ])dnl 19 AC_MSG_RESULT([${gp_build_docs}]) 20 AM_CONDITIONAL([BUILD_DOCS], [test "x${gp_build_docs}" = "xyes"]) 21 ])dnl 22 23 AC_DEFUN([GP_CHECK_DOC_DIR], 24 [ 25 AC_REQUIRE([GP_DOC_GENERAL])dnl 26 AC_BEFORE([$0], [GP_BUILD_GTK_DOCS])dnl 27 AC_BEFORE([$0], [GP_CHECK_DOXYGEN])dnl 28 29 AC_ARG_WITH([doc-dir], 30 [AS_HELP_STRING([--with-doc-dir=PATH], 31 [Where to install docs [default=autodetect]])]) 32 33 # check for the main ("root") documentation directory 34 AC_MSG_CHECKING([main docdir]) 35 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" 42 then 43 maindocdir='${prefix}/share/doc' 44 AC_MSG_RESULT([${maindocdir} (FHS style)]) 45 elif test -d "/usr/doc" 46 then 47 maindocdir='${prefix}/doc' 48 AC_MSG_RESULT([${maindocdir} (old style)]) 49 else 50 maindocdir='${datadir}/doc' 51 AC_MSG_RESULT([${maindocdir} (default value)]) 52 fi 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 57 then 58 docdir="${maindocdir}/${PACKAGE}-${VERSION}" 59 AC_MSG_RESULT([${docdir} (redhat style)]) 60 else 61 docdir="${maindocdir}/${PACKAGE}" 62 AC_MSG_RESULT([${docdir} (default style)]) 63 fi 64 fi 65 66 AC_SUBST([docdir]) 67 ])dnl 68 69 dnl 70 dnl check whether to build docs and where to: 71 dnl 72 dnl * determine presence of prerequisites (only gtk-doc for now) 73 dnl * determine destination directory for HTML files 74 dnl 75 76 AC_DEFUN([GP_BUILD_GTK_DOCS], 77 [ 78 # docdir has to be determined in advance 79 AC_REQUIRE([GP_CHECK_DOC_DIR]) 80 81 # --------------------------------------------------------------------------- 82 # gtk-doc: We use gtk-doc for building our documentation. However, we 83 # require the user to explicitely request the build. 84 # --------------------------------------------------------------------------- 85 try_gtkdoc=false 86 gtkdoc_msg="no (not requested)" 87 have_gtkdoc=false 88 AC_ARG_ENABLE([docs], 89 [AS_HELP_STRING([--enable-docs], 90 [Use gtk-doc to build documentation [default=no]])],[ 91 if test x$enableval = xyes; then 92 try_gtkdoc=true 93 fi 94 ]) 95 if $try_gtkdoc; then 96 AC_PATH_PROG([GTKDOC],[gtkdoc-mkdb]) 97 if test -n "${GTKDOC}"; then 98 have_gtkdoc=true 99 gtkdoc_msg="yes" 100 else 101 gtkdoc_msg="no (http://www.gtk.org/rdp/download.html)" 102 fi 103 fi 104 AM_CONDITIONAL([ENABLE_GTK_DOC], [$have_gtkdoc]) 105 GP_CONFIG_MSG([build API docs with gtk-doc],[$gtkdoc_msg]) 106 107 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]])]) 115 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)]) 120 else 121 htmldir="${with_html_dir}" 122 AC_MSG_RESULT([${htmldir} (from parameter)]) 123 fi 124 AC_SUBST([htmldir]) 125 apidocdir="${htmldir}/api" 126 AC_SUBST([apidocdir}]) 127 128 ])dnl 129 130 131 dnl doxygen related stuff 132 dnl look for tools 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]) 142 else 143 AC_SUBST([HAVE_DOT],[NO]) 144 fi 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"]) 148 ])dnl 149 150