ax_prog_sphinx_build.m4 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. # ===========================================================================
  2. # https://github.com/BrianAker/ddm4
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_PROG_SPHINX_BUILD([ACTION-IF-FOUND], [ACTION-IF-NOT_FOUND])
  8. #
  9. # DESCRIPTION
  10. #
  11. # Look for sphinx-build and make sure it is a recent version of it.
  12. #
  13. # LICENSE
  14. #
  15. # Copyright (c) 2012-2013 Brian Aker <brian@tangent.org>
  16. #
  17. # Copying and distribution of this file, with or without modification, are
  18. # permitted in any medium without royalty provided the copyright notice
  19. # and this notice are preserved. This file is offered as-is, without any
  20. # warranty.
  21. #serial 5
  22. AC_DEFUN([AX_PROG_SPHINX_BUILD],
  23. [AX_WITH_PROG([SPHINXBUILD],[sphinx-build],[:])
  24. AS_IF([test x"SPHINXBUILD" = x":"],
  25. [SPHINXBUILD=],
  26. [AS_IF([test -x "$SPHINXBUILD"],
  27. [AC_MSG_CHECKING([Checking to see if $SPHINXBUILD is recent])
  28. junk=`$SPHINXBUILD --version &> version_file`
  29. AS_IF([test $? -eq 0],
  30. [ax_sphinx_build_version=`head -1 version_file`],
  31. [junk=`$SPHINXBUILD &> version_file`
  32. ax_sphinx_build_version=`head -1 version_file`
  33. rm version_file
  34. AC_MSG_RESULT([$SPHINXBUILD is version "$ax_sphinx_build_version"])
  35. $SPHINXBUILD -Q -C -b man -d conftest.d . . >/dev/null 2>&1
  36. AS_IF([test $? -eq 0], ,[SPHINXBUILD=])
  37. rm -rf conftest.d ])
  38. ])
  39. rm -f version_file
  40. ])
  41. INC_SPHINXBUILD='
  42. ifneq ($(filter $(SPHINX_TARGETS), $(MAKECMDGOALS)), )
  43. .NOTPARALLEL:
  44. endif
  45. '
  46. AC_SUBST([INC_SPHINXBUILD])
  47. AM_SUBST_NOTMAKE([INC_SPHINXBUILD])
  48. AS_IF([test -n "${SPHINXBUILD}"],
  49. [AC_SUBST([SPHINXBUILD])
  50. ifelse([$1], , :, [$1])],
  51. [ifelse([$2], , :, [$2])])
  52. ])