1*735d6239SKiyoung Kimdnl 2*735d6239SKiyoung Kimdnl check where to install documentation 3*735d6239SKiyoung Kimdnl 4*735d6239SKiyoung Kimdnl determines documentation "root directory", i.e. the directory 5*735d6239SKiyoung Kimdnl where all documentation will be placed in 6*735d6239SKiyoung Kimdnl 7*735d6239SKiyoung Kim 8*735d6239SKiyoung KimAC_DEFUN([GP_DOC_GENERAL],[dnl 9*735d6239SKiyoung KimAC_MSG_CHECKING([whether to build any docs]) 10*735d6239SKiyoung KimAC_ARG_ENABLE([docs], [dnl 11*735d6239SKiyoung KimAS_HELP_STRING([--disable-docs], [whether to create any documentation])], [dnl 12*735d6239SKiyoung Kimcase "$enableval" in 13*735d6239SKiyoung Kim yes|true|on) gp_build_docs="yes" ;; 14*735d6239SKiyoung Kim *) gp_build_docs="no" ;; 15*735d6239SKiyoung Kimesac 16*735d6239SKiyoung Kim],[dnl 17*735d6239SKiyoung Kimgp_build_docs="yes" 18*735d6239SKiyoung Kim])dnl 19*735d6239SKiyoung KimAC_MSG_RESULT([${gp_build_docs}]) 20*735d6239SKiyoung KimAM_CONDITIONAL([BUILD_DOCS], [test "x${gp_build_docs}" = "xyes"]) 21*735d6239SKiyoung Kim])dnl 22*735d6239SKiyoung Kim 23*735d6239SKiyoung KimAC_DEFUN([GP_CHECK_DOC_DIR], 24*735d6239SKiyoung Kim[ 25*735d6239SKiyoung KimAC_REQUIRE([GP_DOC_GENERAL])dnl 26*735d6239SKiyoung KimAC_BEFORE([$0], [GP_BUILD_GTK_DOCS])dnl 27*735d6239SKiyoung KimAC_BEFORE([$0], [GP_CHECK_DOXYGEN])dnl 28*735d6239SKiyoung Kim 29*735d6239SKiyoung KimAC_ARG_WITH([doc-dir], 30*735d6239SKiyoung Kim[AS_HELP_STRING([--with-doc-dir=PATH], 31*735d6239SKiyoung Kim[Where to install docs [default=autodetect]])]) 32*735d6239SKiyoung Kim 33*735d6239SKiyoung Kim# check for the main ("root") documentation directory 34*735d6239SKiyoung KimAC_MSG_CHECKING([main docdir]) 35*735d6239SKiyoung Kim 36*735d6239SKiyoung Kimif test "x${with_doc_dir}" != "x" 37*735d6239SKiyoung Kimthen # docdir is given as parameter 38*735d6239SKiyoung Kim docdir="${with_doc_dir}" 39*735d6239SKiyoung Kim AC_MSG_RESULT([${docdir} (from parameter)]) 40*735d6239SKiyoung Kimelse # otherwise invent a docdir hopefully compatible with system policy 41*735d6239SKiyoung Kim if test -d "/usr/share/doc" 42*735d6239SKiyoung Kim then 43*735d6239SKiyoung Kim maindocdir='${prefix}/share/doc' 44*735d6239SKiyoung Kim AC_MSG_RESULT([${maindocdir} (FHS style)]) 45*735d6239SKiyoung Kim elif test -d "/usr/doc" 46*735d6239SKiyoung Kim then 47*735d6239SKiyoung Kim maindocdir='${prefix}/doc' 48*735d6239SKiyoung Kim AC_MSG_RESULT([${maindocdir} (old style)]) 49*735d6239SKiyoung Kim else 50*735d6239SKiyoung Kim maindocdir='${datadir}/doc' 51*735d6239SKiyoung Kim AC_MSG_RESULT([${maindocdir} (default value)]) 52*735d6239SKiyoung Kim fi 53*735d6239SKiyoung Kim AC_MSG_CHECKING([package docdir]) 54*735d6239SKiyoung Kim # check whether to include package version into documentation path 55*735d6239SKiyoung Kim # FIXME: doesn't work properly. 56*735d6239SKiyoung Kim if ls -d /usr/{share/,}doc/make-[0-9]* > /dev/null 2>&1 57*735d6239SKiyoung Kim then 58*735d6239SKiyoung Kim docdir="${maindocdir}/${PACKAGE}-${VERSION}" 59*735d6239SKiyoung Kim AC_MSG_RESULT([${docdir} (redhat style)]) 60*735d6239SKiyoung Kim else 61*735d6239SKiyoung Kim docdir="${maindocdir}/${PACKAGE}" 62*735d6239SKiyoung Kim AC_MSG_RESULT([${docdir} (default style)]) 63*735d6239SKiyoung Kim fi 64*735d6239SKiyoung Kimfi 65*735d6239SKiyoung Kim 66*735d6239SKiyoung KimAC_SUBST([docdir]) 67*735d6239SKiyoung Kim])dnl 68*735d6239SKiyoung Kim 69*735d6239SKiyoung Kimdnl 70*735d6239SKiyoung Kimdnl check whether to build docs and where to: 71*735d6239SKiyoung Kimdnl 72*735d6239SKiyoung Kimdnl * determine presence of prerequisites (only gtk-doc for now) 73*735d6239SKiyoung Kimdnl * determine destination directory for HTML files 74*735d6239SKiyoung Kimdnl 75*735d6239SKiyoung Kim 76*735d6239SKiyoung KimAC_DEFUN([GP_BUILD_GTK_DOCS], 77*735d6239SKiyoung Kim[ 78*735d6239SKiyoung Kim# docdir has to be determined in advance 79*735d6239SKiyoung KimAC_REQUIRE([GP_CHECK_DOC_DIR]) 80*735d6239SKiyoung Kim 81*735d6239SKiyoung Kim# --------------------------------------------------------------------------- 82*735d6239SKiyoung Kim# gtk-doc: We use gtk-doc for building our documentation. However, we 83*735d6239SKiyoung Kim# require the user to explicitely request the build. 84*735d6239SKiyoung Kim# --------------------------------------------------------------------------- 85*735d6239SKiyoung Kimtry_gtkdoc=false 86*735d6239SKiyoung Kimgtkdoc_msg="no (not requested)" 87*735d6239SKiyoung Kimhave_gtkdoc=false 88*735d6239SKiyoung KimAC_ARG_ENABLE([docs], 89*735d6239SKiyoung Kim[AS_HELP_STRING([--enable-docs], 90*735d6239SKiyoung Kim[Use gtk-doc to build documentation [default=no]])],[ 91*735d6239SKiyoung Kim if test x$enableval = xyes; then 92*735d6239SKiyoung Kim try_gtkdoc=true 93*735d6239SKiyoung Kim fi 94*735d6239SKiyoung Kim]) 95*735d6239SKiyoung Kimif $try_gtkdoc; then 96*735d6239SKiyoung Kim AC_PATH_PROG([GTKDOC],[gtkdoc-mkdb]) 97*735d6239SKiyoung Kim if test -n "${GTKDOC}"; then 98*735d6239SKiyoung Kim have_gtkdoc=true 99*735d6239SKiyoung Kim gtkdoc_msg="yes" 100*735d6239SKiyoung Kim else 101*735d6239SKiyoung Kim gtkdoc_msg="no (http://www.gtk.org/rdp/download.html)" 102*735d6239SKiyoung Kim fi 103*735d6239SKiyoung Kimfi 104*735d6239SKiyoung KimAM_CONDITIONAL([ENABLE_GTK_DOC], [$have_gtkdoc]) 105*735d6239SKiyoung KimGP_CONFIG_MSG([build API docs with gtk-doc],[$gtkdoc_msg]) 106*735d6239SKiyoung Kim 107*735d6239SKiyoung Kim 108*735d6239SKiyoung Kim# --------------------------------------------------------------------------- 109*735d6239SKiyoung Kim# Give the user the possibility to install html documentation in a 110*735d6239SKiyoung Kim# user-defined location. 111*735d6239SKiyoung Kim# --------------------------------------------------------------------------- 112*735d6239SKiyoung KimAC_ARG_WITH([html-dir], 113*735d6239SKiyoung Kim[AS_HELP_STRING([--with-html-dir=PATH], 114*735d6239SKiyoung Kim[Where to install html docs [default=autodetect]])]) 115*735d6239SKiyoung Kim 116*735d6239SKiyoung KimAC_MSG_CHECKING([for html dir]) 117*735d6239SKiyoung Kimif test "x${with_html_dir}" = "x" ; then 118*735d6239SKiyoung Kim htmldir="${docdir}/html" 119*735d6239SKiyoung Kim AC_MSG_RESULT([${htmldir} (default)]) 120*735d6239SKiyoung Kimelse 121*735d6239SKiyoung Kim htmldir="${with_html_dir}" 122*735d6239SKiyoung Kim AC_MSG_RESULT([${htmldir} (from parameter)]) 123*735d6239SKiyoung Kimfi 124*735d6239SKiyoung KimAC_SUBST([htmldir]) 125*735d6239SKiyoung Kimapidocdir="${htmldir}/api" 126*735d6239SKiyoung KimAC_SUBST([apidocdir}]) 127*735d6239SKiyoung Kim 128*735d6239SKiyoung Kim])dnl 129*735d6239SKiyoung Kim 130*735d6239SKiyoung Kim 131*735d6239SKiyoung Kimdnl doxygen related stuff 132*735d6239SKiyoung Kimdnl look for tools 133*735d6239SKiyoung Kimdnl define substitutions for Doxyfile.in 134*735d6239SKiyoung KimAC_DEFUN([GP_CHECK_DOXYGEN],[dnl 135*735d6239SKiyoung KimAC_REQUIRE([GP_CHECK_DOC_DIR])dnl 136*735d6239SKiyoung KimAC_PATH_PROG([DOT], [dot], [false]) 137*735d6239SKiyoung KimAC_PATH_PROG([DOXYGEN], [doxygen], [false]) 138*735d6239SKiyoung KimAM_CONDITIONAL([HAVE_DOXYGEN], [test "x$DOXYGEN" != "xfalse"]) 139*735d6239SKiyoung KimAM_CONDITIONAL([HAVE_DOT], [test "x$DOT" != "xfalse"]) 140*735d6239SKiyoung Kimif test "x$DOT" != "xfalse"; then 141*735d6239SKiyoung Kim AC_SUBST([HAVE_DOT],[YES]) 142*735d6239SKiyoung Kimelse 143*735d6239SKiyoung Kim AC_SUBST([HAVE_DOT],[NO]) 144*735d6239SKiyoung Kimfi 145*735d6239SKiyoung KimAC_SUBST([HTML_APIDOC_DIR], ["${PACKAGE_TARNAME}-api.html"]) 146*735d6239SKiyoung KimAC_SUBST([DOXYGEN_OUTPUT_DIR], [doxygen-output]) 147*735d6239SKiyoung KimAC_SUBST([HTML_APIDOC_INTERNALS_DIR], ["${PACKAGE_TARNAME}-internals.html"]) 148*735d6239SKiyoung Kim])dnl 149*735d6239SKiyoung Kim 150