1 dnl ##############################################################################
2 dnl # AC_LIBMODBUS_CHECK_DOC_BUILD #
3 dnl # Check whether to build documentation and install man-pages #
4 dnl ##############################################################################
5 AC_DEFUN([AC_LIBMODBUS_CHECK_DOC_BUILD], [{
6 # Allow user to disable doc build
7 AC_ARG_WITH([documentation], [AS_HELP_STRING([--without-documentation],
8 [disable documentation build even if asciidoc and xmlto are present [default=no]])])
10 if test "x$with_documentation" = "xno"; then
11 ac_libmodbus_build_doc="no"
12 ac_libmodbus_install_man="no"
14 # Determine whether or not documentation should be built and installed.
15 ac_libmodbus_build_doc="yes"
16 ac_libmodbus_install_man="yes"
17 # Check for asciidoc and xmlto and don't build the docs if these are not installed.
18 AC_CHECK_PROG(ac_libmodbus_have_asciidoc, asciidoc, yes, no)
19 AC_CHECK_PROG(ac_libmodbus_have_xmlto, xmlto, yes, no)
20 if test "x$ac_libmodbus_have_asciidoc" = "xno" -o "x$ac_libmodbus_have_xmlto" = "xno"; then
21 ac_libmodbus_build_doc="no"
22 # Tarballs built with 'make dist' ship with prebuilt documentation.
23 if ! test -f doc/libmodbus.7; then
24 ac_libmodbus_install_man="no"
25 AC_MSG_WARN([You are building an unreleased version of libmodbus and asciidoc or xmlto are not installed.])
26 AC_MSG_WARN([Documentation will not be built and manual pages will not be installed.])
30 # Do not install man pages if on mingw
31 if test "x$ac_libmodbus_on_mingw32" = "xyes"; then
32 ac_libmodbus_install_man="no"
36 AC_MSG_CHECKING([whether to build documentation])
37 AC_MSG_RESULT([$ac_libmodbus_build_doc])
39 AC_MSG_CHECKING([whether to install manpages])
40 AC_MSG_RESULT([$ac_libmodbus_install_man])
42 AM_CONDITIONAL(BUILD_DOC, test "x$ac_libmodbus_build_doc" = "xyes")
43 AM_CONDITIONAL(INSTALL_MAN, test "x$ac_libmodbus_install_man" = "xyes")