[gtk-doc] Do not require --enable-gtk-doc to build source packages



commit cf5a3002fcf4f45331537fd6c4990725827b1f59
Author: Hib Eris <hib hiberis nl>
Date:   Mon Dec 19 12:05:44 2011 +0100

    Do not require --enable-gtk-doc to build source packages
    
    This allows packages that use GTK_DOC_CHECK to build a source
    package without having to explicitly request '--enable-gtk-doc'.
    
    Fixes bug #666509.

 gtk-doc.m4                  |   40 ++++++++++++++++++++++++++--------------
 gtk-doc.make                |   17 ++++++++++-------
 gtk-doc.notmpl.make         |   17 ++++++++++-------
 help/manual/C/index.docbook |   16 ----------------
 4 files changed, 46 insertions(+), 44 deletions(-)
---
diff --git a/gtk-doc.m4 b/gtk-doc.m4
index a303463..3675543 100644
--- a/gtk-doc.m4
+++ b/gtk-doc.m4
@@ -1,6 +1,6 @@
 dnl -*- mode: autoconf -*-
 
-# serial 1
+# serial 2
 
 dnl Usage:
 dnl   GTK_DOC_CHECK([minimum-gtk-doc-version])
@@ -10,6 +10,17 @@ AC_DEFUN([GTK_DOC_CHECK],
   AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first
   AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first
 
+  ifelse([$1],[],[gtk_doc_requires="gtk-doc"],[gtk_doc_requires="gtk-doc >= $1"])
+  AC_MSG_CHECKING([for gtk-doc])
+  PKG_CHECK_EXISTS([$gtk_doc_requires],[have_gtk_doc=yes],[have_gtk_doc=no])
+  AC_MSG_RESULT($have_gtk_doc)
+
+  if test "$have_gtk_doc" = "no"; then
+      AC_MSG_WARN([
+  You will not be able to create source packages with 'make dist'
+  because $gtk_doc_requires is not found.])
+  fi
+
   dnl check for tools we added during development
   dnl Use AC_CHECK_PROG to avoid the check target using an absolute path that
   dnl may not be writable by the user. Currently, automake requires that the
@@ -33,22 +44,22 @@ AC_DEFUN([GTK_DOC_CHECK],
                    [use gtk-doc to build documentation [[default=no]]]),,
     [enable_gtk_doc=no])
 
-  if test x$enable_gtk_doc = xyes; then
-    ifelse([$1],[],
-      [PKG_CHECK_EXISTS([gtk-doc],,
-                        AC_MSG_ERROR([gtk-doc not installed and --enable-gtk-doc requested]))],
-      [PKG_CHECK_EXISTS([gtk-doc >= $1],,
-                        AC_MSG_ERROR([You need to have gtk-doc >= $1 installed to build $PACKAGE_NAME]))])
-    dnl don't check for glib if we build glib
-    if test "x$PACKAGE_NAME" != "xglib"; then
-      dnl don't fail if someone does not have glib
-      PKG_CHECK_MODULES(GTKDOC_DEPS, glib-2.0 >= 2.10.0 gobject-2.0  >= 2.10.0,,[:])
-    fi
-  fi
-
   AC_MSG_CHECKING([whether to build gtk-doc documentation])
   AC_MSG_RESULT($enable_gtk_doc)
 
+  if test "x$enable_gtk_doc" = "xyes" && test "$have_gtk_doc" = "no"; then
+    AC_MSG_ERROR([
+  You must have $gtk_doc_requires installed to build documentation for
+  $PACKAGE_NAME. Please install gtk-doc or disable building the
+  documentation by adding '--disable-gtk-doc' to '[$]0'.])
+  fi
+
+  dnl don't check for glib if we build glib
+  if test "x$PACKAGE_NAME" != "xglib"; then
+    dnl don't fail if someone does not have glib
+    PKG_CHECK_MODULES(GTKDOC_DEPS, glib-2.0 >= 2.10.0 gobject-2.0  >= 2.10.0,,[:])
+  fi
+
   dnl enable/disable output formats
   AC_ARG_ENABLE([gtk-doc-html],
     AS_HELP_STRING([--enable-gtk-doc-html],
@@ -68,6 +79,7 @@ AC_DEFUN([GTK_DOC_CHECK],
   fi
   AC_SUBST([AM_DEFAULT_VERBOSITY])
 
+  AM_CONDITIONAL([HAVE_GTK_DOC], [test x$have_gtk_doc = xyes])
   AM_CONDITIONAL([ENABLE_GTK_DOC], [test x$enable_gtk_doc = xyes])
   AM_CONDITIONAL([GTK_DOC_BUILD_HTML], [test x$enable_gtk_doc_html = xyes])
   AM_CONDITIONAL([GTK_DOC_BUILD_PDF], [test x$enable_gtk_doc_pdf = xyes])
diff --git a/gtk-doc.make b/gtk-doc.make
index 7a50540..584843f 100644
--- a/gtk-doc.make
+++ b/gtk-doc.make
@@ -56,7 +56,6 @@ gtkdoc-check.test: Makefile
 
 CLEANFILES = $(SCANOBJ_FILES) $(REPORT_FILES) $(DOC_STAMPS) gtkdoc-check.test
 
-if ENABLE_GTK_DOC
 if GTK_DOC_BUILD_HTML
 HTML_BUILD_STAMP=html-build.stamp
 else
@@ -68,9 +67,11 @@ else
 PDF_BUILD_STAMP=
 endif
 
-all-local: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP)
-else
-all-local:
+all-gtk-doc: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP)
+.PHONY: all-gtk-doc
+
+if ENABLE_GTK_DOC
+all-local: all-gtk-doc
 endif
 
 docs: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP)
@@ -290,15 +291,17 @@ uninstall-local:
 #
 # Require gtk-doc when making dist
 #
-if ENABLE_GTK_DOC
+if HAVE_GTK_DOC
 dist-check-gtkdoc: docs
 else
 dist-check-gtkdoc:
-       @echo "*** gtk-doc must be installed and enabled in order to make dist"
+       @echo "*** gtk-doc is needed to run 'make dist'.         ***"
+       @echo "*** gtk-doc was not found when 'configure' ran.   ***"
+       @echo "*** please install gtk-doc and rerun 'configure'. ***"
        @false
 endif
 
-dist-hook: dist-check-gtkdoc dist-hook-local
+dist-hook: dist-check-gtkdoc all-gtk-doc dist-hook-local
        @mkdir $(distdir)/tmpl
        @mkdir $(distdir)/html
        @-cp ./tmpl/*.sgml $(distdir)/tmpl
diff --git a/gtk-doc.notmpl.make b/gtk-doc.notmpl.make
index 6f5953d..764fd7c 100644
--- a/gtk-doc.notmpl.make
+++ b/gtk-doc.notmpl.make
@@ -56,7 +56,6 @@ gtkdoc-check.test: Makefile
 
 CLEANFILES = $(SCANOBJ_FILES) $(REPORT_FILES) $(DOC_STAMPS) gtkdoc-check.test
 
-if ENABLE_GTK_DOC
 if GTK_DOC_BUILD_HTML
 HTML_BUILD_STAMP=html-build.stamp
 else
@@ -68,9 +67,11 @@ else
 PDF_BUILD_STAMP=
 endif
 
-all-local: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP)
-else
-all-local:
+all-gtk-doc: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP)
+.PHONY: all-gtk-doc
+
+if ENABLE_GTK_DOC
+all-local: all-gtk-doc
 endif
 
 docs: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP)
@@ -266,15 +267,17 @@ uninstall-local:
 #
 # Require gtk-doc when making dist
 #
-if ENABLE_GTK_DOC
+if HAVE_GTK_DOC
 dist-check-gtkdoc: docs
 else
 dist-check-gtkdoc:
-       @echo "*** gtk-doc must be installed and enabled in order to make dist"
+       @echo "*** gtk-doc is needed to run 'make dist'.         ***"
+       @echo "*** gtk-doc was not found when 'configure' ran.   ***"
+       @echo "*** please install gtk-doc and rerun 'configure'. ***"
        @false
 endif
 
-dist-hook: dist-check-gtkdoc dist-hook-local
+dist-hook: dist-check-gtkdoc all-gtk-doc dist-hook-local
        @mkdir $(distdir)/html
        @cp ./html/* $(distdir)/html
        @-cp ./$(DOC_MODULE).pdf $(distdir)/
diff --git a/help/manual/C/index.docbook b/help/manual/C/index.docbook
index fade630..c67e98d 100644
--- a/help/manual/C/index.docbook
+++ b/help/manual/C/index.docbook
@@ -536,22 +536,6 @@ AC_CONFIG_MACRO_DIR(m4)
 
       <!-- FIXME: explain options ? -->
 
-      <para>
-        You may also want to enable GTK-Doc for the distcheck make target. Just
-        add the one line shown in the next example to your top-level
-        <filename>Makefile.am</filename>:
-      </para>
-
-      <para>
-        <example><title>Enable GTK-Doc during make distcheck</title>
-          <programlisting>
-<![CDATA[
-DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc
-]]>
-          </programlisting>
-        </example>
-      </para>
-
     </sect1>
 
     <sect1 id="settingup_autogen">


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]