Blame build/m4/gtk-doc.m4

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