]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
build-sys: add UL_REQUIRES_PROGRAM() macro, use it for asciidoc
authorKarel Zak <kzak@redhat.com>
Wed, 7 Apr 2021 08:19:03 +0000 (10:19 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 7 Apr 2021 08:19:03 +0000 (10:19 +0200)
* 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 <kzak@redhat.com>
configure.ac
m4/ul.m4

index 909be6dbcb511769375db5138346157ae5fb5df9..c77b529ccedb5eab3eb8214968f80d80339f5e2d 100644 (file)
@@ -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}
index 7e9aa1d3913dcd62f3922ce3ed6c527ee667daba..951db7371997ad9c771dc4762249f39c8ce67e6b 100644 (file)
--- 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_<name> variable according to $enable_<name> and
+dnl ability compile AC_PATH_PROG().
+dnl
+dnl The <desc> is description used for warning/error dnl message (e.g. "foo support").
+dnl
+dnl The default <name> 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