From 5f55173b79237340810e3cee2bc352fc624d5f08 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Fri, 9 Jul 2010 15:11:39 +0200
Subject: [PATCH] Enable from-repository builds on old distributions
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

… or on distributions which simply have other implementations of man,
that do not support '--warnings'.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Manuel Franceschini <livewire@google.com>
---
 Makefile.am  |  2 +-
 configure.ac | 11 +++++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index 0d98d2736..711dd8722 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -422,7 +422,7 @@ man/%.7.in man/%.8.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
 	@test -n "$(DOCBOOK2MAN)" || \
 	  { echo 'docbook2man' not found during configure; exit 1; }
 	$(DOCBOOK_WRAPPER) "$(DOCBOOK2MAN)" $< $(notdir $(@:.in=)) $@
-	$(CHECK_MAN) $@
+	if test -n "$(MAN_HAS_WARNINGS)"; then $(CHECK_MAN) $@; fi
 
 man/%.html.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
 	@test -n "$(DOCBOOK2HTML)" || \
diff --git a/configure.ac b/configure.ac
index be58c5ea7..360faea0b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -249,6 +249,17 @@ fi
 
 AC_SUBST(SOCAT_USE_ESCAPE)
 
+if man --help | grep -q -e --warnings
+then
+  MAN_HAS_WARNINGS=1
+else
+  MAN_HAS_WARNINGS=
+  AC_MSG_WARN([man doesn't support --warnings, man pages checks
+               will not be possible])
+fi
+
+AC_SUBST(MAN_HAS_WARNINGS)
+
 # Check for Python
 AM_PATH_PYTHON(2.4)
 
-- 
GitLab