From 59c7e915819e3a243e423038ebddaee20bbfd2e7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Robert=20Kl=C3=B6fkorn?= <robertk@dune-project.org>
Date: Wed, 5 Dec 2007 16:17:21 +0000
Subject: [PATCH] check whether dist has been build without documentation and
 if disable building of documentation.

[[Imported from SVN: r5023]]
---
 m4/Makefile.am  |  2 +-
 m4/dune_all.m4  |  4 +---
 m4/dune_docu.m4 | 22 ++++++++++++++++++++++
 3 files changed, 24 insertions(+), 4 deletions(-)
 create mode 100644 m4/dune_docu.m4

diff --git a/m4/Makefile.am b/m4/Makefile.am
index 2a9d8318e..ec4ab0532 100644
--- a/m4/Makefile.am
+++ b/m4/Makefile.am
@@ -3,7 +3,7 @@
 ALLM4S = acx_blas.m4 acx_mpi.m4 acx_pthread.m4 alberta.m4 alugrid.m4	\
          ax_check_gl.m4 ax_lang_compiler_ms.m4 dune_all.m4      \
          dune_amira.m4 dune_compiler.m4 dune_deprecated.m4 dune_griddim.m4 \
-         dune_exprtmpl.m4 dune_linkcxx.m4 dune.m4 dune_mpi.m4           \
+         dune_exprtmpl.m4 dune_linkcxx.m4 dune.m4 dune_mpi.m4 dune_docu.m4 \
          dune_psurface.m4 dune_streams.m4 f5.m4 fortran_overwrite.m4 grape.m4 hdf5.m4   \
          immdx_lib_metis.m4 inkscape.m4 mpi-config.m4 opengl.m4         \
          parmetis.m4 superlu-dist.m4 superlu.m4 ug.m4 xdr.m4
diff --git a/m4/dune_all.m4 b/m4/dune_all.m4
index df2228634..255707c81 100644
--- a/m4/dune_all.m4
+++ b/m4/dune_all.m4
@@ -66,9 +66,7 @@ dnl check for library functions
   AC_CHECK_PROGS([CONVERT], [convert], [true])
 
   # doxygen and latex take a lot of time...
-  AC_ARG_ENABLE(documentation,
-   AC_HELP_STRING([--disable-documentation],[don't generate docs, speeds up the build]))
-  AM_CONDITIONAL(BUILD_DOCS, test x$enable_documentation != xno)
+  AC_REQUIRE([DUNE_DOCUMENTATION])
 
   # special variable to include the documentation into the website
   AC_ARG_WITH(duneweb,
diff --git a/m4/dune_docu.m4 b/m4/dune_docu.m4
new file mode 100644
index 000000000..cdd36b94a
--- /dev/null
+++ b/m4/dune_docu.m4
@@ -0,0 +1,22 @@
+# searches for documentation 
+AC_DEFUN([DUNE_DOCUMENTATION],[
+
+  # if dist has been build without
+  # documentation then disable documentation 
+  # option by default 
+  DOCU_TAG_FILE="no-documentation.tag"
+  if test -f doc/$DOCU_TAG_FILE ; then 
+    HAS_DOCUMENTATION="no"
+  else 
+    # check whether option is chosen or not 
+    if test x$enable_documentation != xno; then 
+      HAS_DOCUMENTATION="yes"
+    else 
+      HAS_DOCUMENTATION="no"
+    fi
+  fi
+  AC_SUBST(DOCUMENTATION_TAG_FILE, $DOCU_TAG_FILE )
+  AC_ARG_ENABLE(documentation,
+   AC_HELP_STRING([--disable-documentation],[don't generate docs, speeds up the build]))
+  AM_CONDITIONAL(BUILD_DOCS, test x$HAS_DOCUMENTATION = xyes)
+])
-- 
GitLab