xref: /OK3568_Linux_fs/buildroot/package/automake/gtk-doc.m4 (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyundnl -*- mode: autoconf -*-
2*4882a593Smuzhiyun
3*4882a593Smuzhiyun# serial 2
4*4882a593Smuzhiyun
5*4882a593Smuzhiyundnl Usage:
6*4882a593Smuzhiyundnl   GTK_DOC_CHECK([minimum-gtk-doc-version])
7*4882a593SmuzhiyunAC_DEFUN([GTK_DOC_CHECK],
8*4882a593Smuzhiyun[
9*4882a593Smuzhiyun  AC_REQUIRE([PKG_PROG_PKG_CONFIG])
10*4882a593Smuzhiyun  AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first
11*4882a593Smuzhiyun  AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first
12*4882a593Smuzhiyun
13*4882a593Smuzhiyun  ifelse([$1],[],[gtk_doc_requires="gtk-doc"],[gtk_doc_requires="gtk-doc >= $1"])
14*4882a593Smuzhiyun  AC_MSG_CHECKING([for gtk-doc])
15*4882a593Smuzhiyun  PKG_CHECK_EXISTS([$gtk_doc_requires],[have_gtk_doc=yes],[have_gtk_doc=no])
16*4882a593Smuzhiyun  AC_MSG_RESULT($have_gtk_doc)
17*4882a593Smuzhiyun
18*4882a593Smuzhiyun  if test "$have_gtk_doc" = "no"; then
19*4882a593Smuzhiyun      AC_MSG_WARN([
20*4882a593Smuzhiyun  You will not be able to create source packages with 'make dist'
21*4882a593Smuzhiyun  because $gtk_doc_requires is not found.])
22*4882a593Smuzhiyun  fi
23*4882a593Smuzhiyun
24*4882a593Smuzhiyun  dnl check for tools we added during development
25*4882a593Smuzhiyun  dnl Use AC_CHECK_PROG to avoid the check target using an absolute path that
26*4882a593Smuzhiyun  dnl may not be writable by the user. Currently, automake requires that the
27*4882a593Smuzhiyun  dnl test name must end in '.test'.
28*4882a593Smuzhiyun  dnl https://bugzilla.gnome.org/show_bug.cgi?id=701638
29*4882a593Smuzhiyun  AC_CHECK_PROG([GTKDOC_CHECK],[gtkdoc-check],[gtkdoc-check.test])
30*4882a593Smuzhiyun  AC_PATH_PROG([GTKDOC_CHECK_PATH],[gtkdoc-check])
31*4882a593Smuzhiyun  AC_PATH_PROGS([GTKDOC_REBASE],[gtkdoc-rebase],[true])
32*4882a593Smuzhiyun  AC_PATH_PROG([GTKDOC_MKPDF],[gtkdoc-mkpdf])
33*4882a593Smuzhiyun
34*4882a593Smuzhiyun  dnl for overriding the documentation installation directory
35*4882a593Smuzhiyun  AC_ARG_WITH([html-dir],
36*4882a593Smuzhiyun    AS_HELP_STRING([--with-html-dir=PATH], [path to installed docs]),,
37*4882a593Smuzhiyun    [with_html_dir='${datadir}/gtk-doc/html'])
38*4882a593Smuzhiyun  HTML_DIR="$with_html_dir"
39*4882a593Smuzhiyun  AC_SUBST([HTML_DIR])
40*4882a593Smuzhiyun
41*4882a593Smuzhiyun  dnl enable/disable documentation building
42*4882a593Smuzhiyun  AC_ARG_ENABLE([gtk-doc],
43*4882a593Smuzhiyun    AS_HELP_STRING([--enable-gtk-doc],
44*4882a593Smuzhiyun                   [use gtk-doc to build documentation [[default=no]]]),,
45*4882a593Smuzhiyun    [enable_gtk_doc=no])
46*4882a593Smuzhiyun
47*4882a593Smuzhiyun  AC_MSG_CHECKING([whether to build gtk-doc documentation])
48*4882a593Smuzhiyun  AC_MSG_RESULT($enable_gtk_doc)
49*4882a593Smuzhiyun
50*4882a593Smuzhiyun  if test "x$enable_gtk_doc" = "xyes" && test "$have_gtk_doc" = "no"; then
51*4882a593Smuzhiyun    AC_MSG_ERROR([
52*4882a593Smuzhiyun  You must have $gtk_doc_requires installed to build documentation for
53*4882a593Smuzhiyun  $PACKAGE_NAME. Please install gtk-doc or disable building the
54*4882a593Smuzhiyun  documentation by adding '--disable-gtk-doc' to '[$]0'.])
55*4882a593Smuzhiyun  fi
56*4882a593Smuzhiyun
57*4882a593Smuzhiyun  dnl don't check for glib if we build glib
58*4882a593Smuzhiyun  if test "x$PACKAGE_NAME" != "xglib"; then
59*4882a593Smuzhiyun    dnl don't fail if someone does not have glib
60*4882a593Smuzhiyun    PKG_CHECK_MODULES(GTKDOC_DEPS, glib-2.0 >= 2.10.0 gobject-2.0  >= 2.10.0,,[:])
61*4882a593Smuzhiyun  fi
62*4882a593Smuzhiyun
63*4882a593Smuzhiyun  dnl enable/disable output formats
64*4882a593Smuzhiyun  AC_ARG_ENABLE([gtk-doc-html],
65*4882a593Smuzhiyun    AS_HELP_STRING([--enable-gtk-doc-html],
66*4882a593Smuzhiyun                   [build documentation in html format [[default=yes]]]),,
67*4882a593Smuzhiyun    [enable_gtk_doc_html=yes])
68*4882a593Smuzhiyun    AC_ARG_ENABLE([gtk-doc-pdf],
69*4882a593Smuzhiyun      AS_HELP_STRING([--enable-gtk-doc-pdf],
70*4882a593Smuzhiyun                     [build documentation in pdf format [[default=no]]]),,
71*4882a593Smuzhiyun      [enable_gtk_doc_pdf=no])
72*4882a593Smuzhiyun
73*4882a593Smuzhiyun  if test -z "$GTKDOC_MKPDF"; then
74*4882a593Smuzhiyun    enable_gtk_doc_pdf=no
75*4882a593Smuzhiyun  fi
76*4882a593Smuzhiyun
77*4882a593Smuzhiyun  if test -z "$AM_DEFAULT_VERBOSITY"; then
78*4882a593Smuzhiyun    AM_DEFAULT_VERBOSITY=1
79*4882a593Smuzhiyun  fi
80*4882a593Smuzhiyun  AC_SUBST([AM_DEFAULT_VERBOSITY])
81*4882a593Smuzhiyun
82*4882a593Smuzhiyun  AM_CONDITIONAL([HAVE_GTK_DOC], [test x$have_gtk_doc = xyes])
83*4882a593Smuzhiyun  AM_CONDITIONAL([ENABLE_GTK_DOC], [test x$enable_gtk_doc = xyes])
84*4882a593Smuzhiyun  AM_CONDITIONAL([GTK_DOC_BUILD_HTML], [test x$enable_gtk_doc_html = xyes])
85*4882a593Smuzhiyun  AM_CONDITIONAL([GTK_DOC_BUILD_PDF], [test x$enable_gtk_doc_pdf = xyes])
86*4882a593Smuzhiyun  AM_CONDITIONAL([GTK_DOC_USE_LIBTOOL], [test -n "$LIBTOOL"])
87*4882a593Smuzhiyun  AM_CONDITIONAL([GTK_DOC_USE_REBASE], [test -n "$GTKDOC_REBASE"])
88*4882a593Smuzhiyun])
89