From 63e8270141a296843cfe1daba38e1969ac6d75ae Mon Sep 17 00:00:00 2001
From: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Date: Sat, 30 Apr 2022 00:35:34 +0200
Subject: [PATCH] Make it possible to disable the generation of the
 documentation

Not all systems have docbook and po4a available.

Upstream-Status: Backport [https://salsa.debian.org/debian/base-passwd/-/commit/2a6d16e595c93084e279d0dcbef37d960b44fd1a]
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---
 Makefile.am  | 2 ++
 configure.ac | 9 +++++++++
 2 files changed, 11 insertions(+)

diff --git a/Makefile.am b/Makefile.am
index 4bdd769..97b4f42 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,6 @@
+if ENABLE_DOCS
 SUBDIRS = doc man
+endif
 
 sbin_PROGRAMS = update-passwd
 
diff --git a/configure.ac b/configure.ac
index 1e35ad1..b98374e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -27,6 +27,15 @@ AS_IF([test "x$enable_debconf" != xno],
       [debconf support not available (use --disable-debconf to disable)])])
    AC_DEFINE([HAVE_DEBCONF], [1], [Define if you have libdebconfclient])])
 
+dnl Check whether to build the documentation 
+AC_MSG_CHECKING([whether to build the documentation])
+AC_ARG_ENABLE([docs],
+  [AC_HELP_STRING([--disable-docs], [do not build and install documentation])],
+  [],
+  [enable_docs=yes])
+AC_MSG_RESULT($enable_docs)
+AM_CONDITIONAL(ENABLE_DOCS, test "x$enable_docs" = xyes)
+
 dnl Finally output everything
 AC_CONFIG_FILES([Makefile doc/Makefile man/Makefile])
 AC_OUTPUT
