1dnl -*- mode: autoconf -*-
2
3# serial 1
4
5dnl Usage:
6dnl   GTK_DOC_CHECK([minimum-gtk-doc-version])
7AC_DEFUN([GTK_DOC_CHECK],
8[
9  AC_REQUIRE([PKG_PROG_PKG_CONFIG])
10  AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first
11  AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first
12
13  dnl check for tools we added during development
14  AC_PATH_PROG([GTKDOC_CHECK],[gtkdoc-check])
15  AC_PATH_PROGS([GTKDOC_REBASE],[gtkdoc-rebase],[true])
16  AC_PATH_PROG([GTKDOC_MKPDF],[gtkdoc-mkpdf])
17
18  dnl for overriding the documentation installation directory
19  AC_ARG_WITH([html-dir],
20    AS_HELP_STRING([--with-html-dir=PATH], [path to installed docs]),,
21    [with_html_dir='${datadir}/gtk-doc/html'])
22  HTML_DIR="$with_html_dir"
23  AC_SUBST([HTML_DIR])
24
25  dnl enable/disable documentation building
26  AC_ARG_ENABLE([gtk-doc],
27    AS_HELP_STRING([--enable-gtk-doc],
28                   [use gtk-doc to build documentation [[default=no]]]),,
29    [enable_gtk_doc=no])
30
31  if test x$enable_gtk_doc = xyes; then
32    ifelse([$1],[],
33      [PKG_CHECK_EXISTS([gtk-doc],,
34                        AC_MSG_ERROR([gtk-doc not installed and --enable-gtk-doc requested]))],
35      [PKG_CHECK_EXISTS([gtk-doc >= $1],,
36                        AC_MSG_ERROR([You need to have gtk-doc >= $1 installed to build $PACKAGE_NAME]))])
37    dnl don't check for glib if we build glib
38    if test "x$PACKAGE_NAME" != "xglib"; then
39      dnl don't fail if someone does not have glib
40      PKG_CHECK_MODULES(GTKDOC_DEPS, glib-2.0 >= 2.10.0 gobject-2.0  >= 2.10.0,,)
41    fi
42    dnl don't rely on sed being pulled in implicitly. Fixes Solaris build.
43    if test -z "$SED"; then
44      AC_PROG_SED
45    fi
46  fi
47
48  AC_MSG_CHECKING([whether to build gtk-doc documentation])
49  AC_MSG_RESULT($enable_gtk_doc)
50
51  dnl enable/disable output formats
52  AC_ARG_ENABLE([gtk-doc-html],
53    AS_HELP_STRING([--enable-gtk-doc-html],
54                   [build documentation in html format [[default=yes]]]),,
55    [enable_gtk_doc_html=yes])
56    AC_ARG_ENABLE([gtk-doc-pdf],
57      AS_HELP_STRING([--enable-gtk-doc-pdf],
58                     [build documentation in pdf format [[default=no]]]),,
59      [enable_gtk_doc_pdf=no])
60
61  if test -z "$GTKDOC_MKPDF"; then
62    enable_gtk_doc_pdf=no
63  fi
64
65
66  AM_CONDITIONAL([ENABLE_GTK_DOC], [test x$enable_gtk_doc = xyes])
67  AM_CONDITIONAL([GTK_DOC_BUILD_HTML], [test x$enable_gtk_doc_html = xyes])
68  AM_CONDITIONAL([GTK_DOC_BUILD_PDF], [test x$enable_gtk_doc_pdf = xyes])
69  AM_CONDITIONAL([GTK_DOC_USE_LIBTOOL], [test -n "$LIBTOOL"])
70])
71