Blame m4macros/gtk-doc.m4

Packit ae235b
# -*- mode: autoconf -*-
Packit ae235b
#
Packit ae235b
# gtk-doc.m4 - configure macro to check for gtk-doc
Packit ae235b
# Copyright (C) 2003 James Henstridge
Packit ae235b
#               2007-2017  Stefan Sauer
Packit ae235b
#
Packit ae235b
# This program is free software: you can redistribute it and/or modify
Packit ae235b
# it under the terms of the GNU General Public License as published by
Packit ae235b
# the Free Software Foundation, either version 3 of the License, or
Packit ae235b
# (at your option) any later version.
Packit ae235b
#
Packit ae235b
# This program is distributed in the hope that it will be useful,
Packit ae235b
# but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit ae235b
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit ae235b
# GNU General Public License for more details.
Packit ae235b
#
Packit ae235b
# You should have received a copy of the GNU General Public License
Packit ae235b
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
Packit ae235b
#
Packit ae235b
# As a special exception, the above copyright owner gives unlimited
Packit ae235b
# permission to copy, distribute and modify the configure scripts that
Packit ae235b
# are the output of Autoconf when processing the Macro. You need not
Packit ae235b
# follow the terms of the GNU General Public License when using or
Packit ae235b
# distributing such scripts, even though portions of the text of the
Packit ae235b
# Macro appear in them. The GNU General Public License (GPL) does govern
Packit ae235b
# all other use of the material that constitutes the Autoconf Macro.
Packit ae235b
Packit ae235b
# serial 2
Packit ae235b
Packit ae235b
dnl Usage:
Packit ae235b
dnl   GTK_DOC_CHECK([minimum-gtk-doc-version])
Packit ae235b
AC_DEFUN([GTK_DOC_CHECK],
Packit ae235b
[
Packit ae235b
  AC_REQUIRE([PKG_PROG_PKG_CONFIG])
Packit ae235b
  AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first
Packit ae235b
  AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first
Packit ae235b
Packit ae235b
  ifelse([$1],[],[gtk_doc_requires="gtk-doc"],[gtk_doc_requires="gtk-doc >= $1"])
Packit ae235b
  AC_MSG_CHECKING([for gtk-doc])
Packit ae235b
  PKG_CHECK_EXISTS([$gtk_doc_requires],[have_gtk_doc=yes],[have_gtk_doc=no])
Packit ae235b
  AC_MSG_RESULT($have_gtk_doc)
Packit ae235b
Packit ae235b
  if test "$have_gtk_doc" = "no"; then
Packit ae235b
      AC_MSG_WARN([
Packit ae235b
  You will not be able to create source packages with 'make dist'
Packit ae235b
  because $gtk_doc_requires is not found.])
Packit ae235b
  fi
Packit ae235b
Packit ae235b
  dnl check for tools we added during development
Packit ae235b
  dnl Use AC_CHECK_PROG to avoid the check target using an absolute path that
Packit ae235b
  dnl may not be writable by the user. Currently, automake requires that the
Packit ae235b
  dnl test name must end in '.test'.
Packit ae235b
  dnl https://bugzilla.gnome.org/show_bug.cgi?id=701638
Packit ae235b
  AC_CHECK_PROG([GTKDOC_CHECK],[gtkdoc-check],[gtkdoc-check.test])
Packit ae235b
  AC_PATH_PROG([GTKDOC_CHECK_PATH],[gtkdoc-check])
Packit ae235b
  AC_PATH_PROGS([GTKDOC_REBASE],[gtkdoc-rebase],[true])
Packit ae235b
  AC_PATH_PROG([GTKDOC_MKPDF],[gtkdoc-mkpdf])
Packit ae235b
Packit ae235b
  dnl for overriding the documentation installation directory
Packit ae235b
  AC_ARG_WITH([html-dir],
Packit ae235b
    AS_HELP_STRING([--with-html-dir=PATH], [path to installed docs]),,
Packit ae235b
    [with_html_dir='${datadir}/gtk-doc/html'])
Packit ae235b
  HTML_DIR="$with_html_dir"
Packit ae235b
  AC_SUBST([HTML_DIR])
Packit ae235b
Packit ae235b
  dnl enable/disable documentation building
Packit ae235b
  AC_ARG_ENABLE([gtk-doc],
Packit ae235b
    AS_HELP_STRING([--enable-gtk-doc],
Packit ae235b
                   [use gtk-doc to build documentation [[default=no]]]),,
Packit ae235b
    [enable_gtk_doc=no])
Packit ae235b
Packit ae235b
  AC_MSG_CHECKING([whether to build gtk-doc documentation])
Packit ae235b
  AC_MSG_RESULT($enable_gtk_doc)
Packit ae235b
Packit ae235b
  if test "x$enable_gtk_doc" = "xyes" && test "$have_gtk_doc" = "no"; then
Packit ae235b
    AC_MSG_ERROR([
Packit ae235b
  You must have $gtk_doc_requires installed to build documentation for
Packit ae235b
  $PACKAGE_NAME. Please install gtk-doc or disable building the
Packit ae235b
  documentation by adding '--disable-gtk-doc' to '[$]0'.])
Packit ae235b
  fi
Packit ae235b
Packit ae235b
  dnl don't check for glib if we build glib
Packit ae235b
  if test "x$PACKAGE_NAME" != "xglib"; then
Packit ae235b
    dnl don't fail if someone does not have glib
Packit ae235b
    PKG_CHECK_MODULES(GTKDOC_DEPS, glib-2.0 >= 2.10.0 gobject-2.0  >= 2.10.0,,[:])
Packit ae235b
  fi
Packit ae235b
Packit ae235b
  dnl enable/disable output formats
Packit ae235b
  AC_ARG_ENABLE([gtk-doc-html],
Packit ae235b
    AS_HELP_STRING([--enable-gtk-doc-html],
Packit ae235b
                   [build documentation in html format [[default=yes]]]),,
Packit ae235b
    [enable_gtk_doc_html=yes])
Packit ae235b
    AC_ARG_ENABLE([gtk-doc-pdf],
Packit ae235b
      AS_HELP_STRING([--enable-gtk-doc-pdf],
Packit ae235b
                     [build documentation in pdf format [[default=no]]]),,
Packit ae235b
      [enable_gtk_doc_pdf=no])
Packit ae235b
Packit ae235b
  if test -z "$GTKDOC_MKPDF"; then
Packit ae235b
    enable_gtk_doc_pdf=no
Packit ae235b
  fi
Packit ae235b
Packit ae235b
  if test -z "$AM_DEFAULT_VERBOSITY"; then
Packit ae235b
    AM_DEFAULT_VERBOSITY=1
Packit ae235b
  fi
Packit ae235b
  AC_SUBST([AM_DEFAULT_VERBOSITY])
Packit ae235b
Packit ae235b
  AM_CONDITIONAL([HAVE_GTK_DOC], [test x$have_gtk_doc = xyes])
Packit ae235b
  AM_CONDITIONAL([ENABLE_GTK_DOC], [test x$enable_gtk_doc = xyes])
Packit ae235b
  AM_CONDITIONAL([GTK_DOC_BUILD_HTML], [test x$enable_gtk_doc_html = xyes])
Packit ae235b
  AM_CONDITIONAL([GTK_DOC_BUILD_PDF], [test x$enable_gtk_doc_pdf = xyes])
Packit ae235b
  AM_CONDITIONAL([GTK_DOC_USE_LIBTOOL], [test -n "$LIBTOOL"])
Packit ae235b
  AM_CONDITIONAL([GTK_DOC_USE_REBASE], [test -n "$GTKDOC_REBASE"])
Packit ae235b
])