acinclude.m4 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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]])])
  9. if test "x$with_documentation" = "xno"; then
  10. ac_libmodbus_build_doc="no"
  11. ac_libmodbus_install_man="no"
  12. else
  13. # Determine whether or not documentation should be built and installed.
  14. ac_libmodbus_build_doc="yes"
  15. ac_libmodbus_install_man="yes"
  16. # Check for asciidoc and xmlto and don't build the docs if these are not installed.
  17. AC_CHECK_PROG(ac_libmodbus_have_asciidoc, asciidoc, yes, no)
  18. AC_CHECK_PROG(ac_libmodbus_have_xmlto, xmlto, yes, no)
  19. if test "x$ac_libmodbus_have_asciidoc" = "xno" -o "x$ac_libmodbus_have_xmlto" = "xno"; then
  20. ac_libmodbus_build_doc="no"
  21. # Tarballs built with 'make dist' ship with prebuilt documentation.
  22. if ! test -f doc/libmodbus.7; then
  23. ac_libmodbus_install_man="no"
  24. AC_MSG_WARN([You are building an unreleased version of libmodbus and asciidoc or xmlto are not installed.])
  25. AC_MSG_WARN([Documentation will not be built and manual pages will not be installed.])
  26. fi
  27. fi
  28. # Do not install man pages if on mingw
  29. if test "x$ac_libmodbus_on_mingw32" = "xyes"; then
  30. ac_libmodbus_install_man="no"
  31. fi
  32. fi
  33. AC_MSG_CHECKING([whether to build documentation])
  34. AC_MSG_RESULT([$ac_libmodbus_build_doc])
  35. AC_MSG_CHECKING([whether to install manpages])
  36. AC_MSG_RESULT([$ac_libmodbus_install_man])
  37. AM_CONDITIONAL(BUILD_DOC, test "x$ac_libmodbus_build_doc" = "xyes")
  38. AM_CONDITIONAL(INSTALL_MAN, test "x$ac_libmodbus_install_man" = "xyes")
  39. }])