• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#
2# SYNOPSIS
3#
4#   AX_CHECK_A2X_TO_MANPAGE([action-if-positive [, action-if-negative]])
5#
6# DESCRIPTION
7#
8#   This macro checks if an installed a2x can be used to create manual
9#   pages.
10#
11#   Examples:
12#
13#     AX_CHECK_A2X_TO_MANPAGE
14#     or
15#     AX_CHECK_A2X_TO_MANPAGE([], [AC_MSG_ERROR([docbook-xml is missing])])
16#
17# LICENSE
18#
19#   Copyright (c) 2018 Olaf Bergmann <bergmann@tzi.org>
20#
21#   This file is part of the CoAP library libcoap. Please see README for terms
22#   of use.
23
24AC_DEFUN([AX_CHECK_A2X_TO_MANPAGE],
25[
26    AC_CACHE_CHECK([manpage creation with a2x], [ac_cv_a2x_man],
27    [
28            if test "x$A2X" = "x"; then
29                 AC_MSG_NOTICE([a2x not in path, skipping test])
30                 ac_cv_a2x_man=no
31            else
32                cat <<EOF >conftestman.txt
33foo(7)
34======
35
36NAME
37----
38foo - manual
39
40AUTHORS
41-------
42author
43EOF
44             $A2X --verbose --doctype manpage --format manpage conftestman.txt >conftest.out 2>&1
45             if test "$?" = 0; then
46                ac_cv_a2x_man=yes
47                $1
48             else
49                ac_cv_a2x_man=no
50                cat conftest.out >&AS_MESSAGE_LOG_FD 2>&1
51                $2
52             fi
53             rm -f conftestman.txt conftest.out foo.7
54        fi
55    ])
56    HAVE_A2X_MAN="$ac_cv_a2x_man"
57])
58