From 22a900a90fd7d1bd0792cc773fdc36b5fcc45f63 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 7 Apr 2021 10:19:03 +0200 Subject: [PATCH] build-sys: add UL_REQUIRES_PROGRAM() macro, use it for asciidoc * use our generic UL_BUILD_INIT() stuff for ENABLE_ASCIIDOC * add UL_REQUIRES_PROGRAM() * add "Manual pages: yes|no" to ./configure summary Signed-off-by: Karel Zak --- configure.ac | 29 ++++++++++++----------------- m4/ul.m4 | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 17 deletions(-) diff --git a/configure.ac b/configure.ac index 909be6dbcb..c77b529cce 100644 --- a/configure.ac +++ b/configure.ac @@ -234,22 +234,6 @@ GTK_DOC_CHECK([1.10]) AC_PATH_PROG([XSLTPROC], [xsltproc]) -AC_ARG_ENABLE([asciidoc], - AS_HELP_STRING([--disable-asciidoc], [do not generate man pages from asciidoc]), - [], [enable_asciidoc=check] -) - -AS_IF([test "x$enable_asciidoc" = xno], [ - AM_CONDITIONAL([ENABLE_ASCIIDOC], [false]) -], [ - AC_PATH_PROG([ASCIIDOCTOR], [asciidoctor]) - AS_IF([test "x$enable_asciidoc" = xyes && "x$ASCIIDOCTOR" = x], [ - AC_MSG_ERROR([AsciiDoc requested but asciidoctor not found]) - ]) - AM_CONDITIONAL([ENABLE_ASCIIDOC], [test "x$ASCIIDOCTOR" != x]) -]) - - linux_os=no bsd_os=no AS_CASE([${host_os}], @@ -744,11 +728,20 @@ AC_ARG_ENABLE([all-programs], AS_CASE([$enable_all_programs], [yes], [AC_MSG_WARN([force to build all programs by default]) ul_default_estate=check], - [no], [AC_MSG_WARN([disable all programs by default]) + [no], [AC_MSG_WARN([disable all programs and man pages by default]) ul_default_estate=no] ) +AC_ARG_ENABLE([asciidoc], + AS_HELP_STRING([--disable-asciidoc], [do not generate man pages from asciidoc]), + [], [UL_DEFAULT_ENABLE([asciidoc], [check])] +) +UL_BUILD_INIT([asciidoc]) +UL_REQUIRES_PROGRAM([asciidoc], [ASCIIDOCTOR], [asciidoctor], [man pages]) +AM_CONDITIONAL([ENABLE_ASCIIDOC], [test "x$build_asciidoc" = xyes]) + + AX_CHECK_TLS have_pty=no @@ -2661,6 +2654,8 @@ AC_MSG_RESULT([ Btrfs support: ${have_btrfs} Wide-char support: ${build_widechar} + Manual pages: ${build_asciidoc} + warnings: ${WARN_CFLAGS} diff --git a/m4/ul.m4 b/m4/ul.m4 index 7e9aa1d391..951db73719 100644 --- a/m4/ul.m4 +++ b/m4/ul.m4 @@ -325,6 +325,38 @@ AC_DEFUN([UL_REQUIRES_COMPILE], [ fi ]) + +dnl UL_REQUIRES_PROGRAM(NAME, PROGVAR, PROGRAM, DESC, [VARSUFFIX=$1]) +dnl +dnl Modifies $build_ variable according to $enable_ and +dnl ability compile AC_PATH_PROG(). +dnl +dnl The is description used for warning/error dnl message (e.g. "foo support"). +dnl +dnl The default for $build_ and $enable_ could be overwrited by option $5. +AC_DEFUN([UL_REQUIRES_PROGRAM], [ + m4_define([suffix], m4_default([$5],$1)) + + if test "x$[build_]suffix" != xno; then + + AC_PATH_PROG([$2], [$3]) + + case $[enable_]suffix:x$$2 in #( + no:*) + [build_]suffix=no ;; + yes:x) + AC_MSG_ERROR([$1 selected, but required $3 not available]);; + yes:x*) + [build_]suffix=yes ;; + check:x) + AC_MSG_WARN([$3 not found; not building $4]) + [build_]suffix=no ;; + check:x*) + [build_]suffix=yes ;; + esac + fi +]) + dnl dnl UL_CONFLICTS_BUILD(NAME, ANOTHER, ANOTHERDESC, [VARSUFFIX=$1]) dnl -- 2.47.3