add configure option to disable manpage generation

using --disable-manpage-support it's finally possibly to disable
the formerly obligatory use of a2x to generate the manpage
documentation.

this is the final solution to the decade old problem that users need
to install the enormous asciidoc package to compile TINYproxy from
source, or otherwise get a build error, even though the vast majority
is only interested in the program itself.

solution was inspired by PR #179.

closes #179
closes #111

note that since 1.10.0 release the generated release tarball includes
the generated manpages too; in which case neither the use of a2x
nor --disable-manpage-support is required.
This commit is contained in:
rofl0r 2020-08-12 00:15:45 +01:00
parent e1d36d3f74
commit 5ba958829f
3 changed files with 31 additions and 6 deletions

View File

@ -96,6 +96,15 @@ if test x"$transparent_enabled" = x"yes"; then
AC_DEFINE(TRANSPARENT_PROXY) AC_DEFINE(TRANSPARENT_PROXY)
fi fi
dnl Let user decide whether he wants support for manpages
dnl Which require either a2x/asciidoctor or a tarball release
AH_TEMPLATE([MANPAGE_SUPPORT],
[Build manpages with a2x/asciidoctor if they are missing from the distribution.])
TP_ARG_ENABLE(manpage_support,
[Enable support for building manpages (default is YES)],
yes)
AM_CONDITIONAL(HAVE_MANPAGE_INTEREST, test x"$manpage_support_enabled" = x"yes")
# This is required to build test programs below # This is required to build test programs below
AC_PROG_CC AC_PROG_CC
@ -173,15 +182,14 @@ AC_SUBST(CPPFLAGS)
AC_SUBST(LIBS) AC_SUBST(LIBS)
AC_SUBST(ADDITIONAL_OBJECTS) AC_SUBST(ADDITIONAL_OBJECTS)
if test x"$manpage_support_enabled" = x"yes"; then
# Check for asciidoc # Check for asciidoc
AC_PATH_PROG(A2X, a2x, no) AC_PATH_PROG(A2X, a2x, no)
AM_CONDITIONAL(HAVE_A2X, test "x$A2X" != "xno") if test "x$A2X" = "xno" ; then
# Check for asciidoctor # Check for asciidoctor
AC_PATH_PROG(ASCIIDOCTOR, asciidoctor, no) AC_PATH_PROG(ASCIIDOCTOR, asciidoctor, no)
AM_CONDITIONAL(HAVE_ASCIIDOCTOR, test "x$ASCIIDOCTOR" != "xno") else
# checking xmllint, which is only used together with a2x
# checking xmllint
AC_PATH_PROG(XMLLINT, xmllint, no) AC_PATH_PROG(XMLLINT, xmllint, no)
if test "x$XMLLINT" != "xno"; then if test "x$XMLLINT" != "xno"; then
AS_ECHO_N("testing xmllint... ") AS_ECHO_N("testing xmllint... ")
@ -194,7 +202,20 @@ if test "x$XMLLINT" != "xno"; then
fi fi
rm -f conftest.txt conftest.xml rm -f conftest.txt conftest.xml
fi fi
AM_CONDITIONAL(HAVE_XMLLINT, test "x$XMLLINT" != "xno") fi #a2x installed
if test "x$A2X" = "xno" -a "x$ASCIIDOCTOR" = "xno" && \
! test -e docs/man5/tinyproxy.conf.5 -a -e docs/man8/tinyproxy.8 ; then
AC_MSG_ERROR([
manpage generation requested, but neither a2x, asciidoctor
nor pre-generated manpages found.
Use --disable-manpage-support if you want to compile anyway.])
fi
fi #manpage_support_enabled
AM_CONDITIONAL(HAVE_A2X, test "x$A2X" != "x" -a "x$A2X" != "xno")
AM_CONDITIONAL(HAVE_XMLLINT, test "x$XMLLINT" != "x" -a "x$XMLLINT" != "xno")
AM_CONDITIONAL(HAVE_ASCIIDOCTOR, test "x$ASCIIDOCTOR" != "x" -a "x$ASCIIDOCTOR" != "xno")
AC_CONFIG_FILES([ AC_CONFIG_FILES([
Makefile Makefile

View File

@ -1,5 +1,7 @@
if HAVE_MANPAGE_INTEREST
MAN5_FILES = \ MAN5_FILES = \
tinyproxy.conf.txt tinyproxy.conf.txt
endif
if HAVE_XMLLINT if HAVE_XMLLINT
A2X_ARGS = -d manpage -f manpage A2X_ARGS = -d manpage -f manpage

View File

@ -1,5 +1,7 @@
if HAVE_MANPAGE_INTEREST
MAN8_FILES = \ MAN8_FILES = \
tinyproxy.txt tinyproxy.txt
endif
if HAVE_XMLLINT if HAVE_XMLLINT
A2X_ARGS = -d manpage -f manpage A2X_ARGS = -d manpage -f manpage