Previous: Writing test programs, Up:

5.1.5 Using Sphinxbuild to build documentation

Using pyconfigure and Autoconf to test for other tools is quite easy. For example, many Python packages use Sphinxbuild to build their documentation. If this is the case for your project, you might do something like the following:

     AC_CHECK_PROGS([SPHINXBUILD], [sphinx-build sphinx-build3 sphinx-build2], [no])
     AS_IF([test "x$SPHINXBUILD" = xno],
     	    AC_MSG_WARN(sphinx-build is required to build documentation))

We simply use Autoconf's AC_CHECK_PROGS macro to check for a series of possible Sphinxbuild binaries and save the result to the SPHINXBUILD variable, which may then be used in

     docs/build/index.html: $(wildcard $(srcdir)/docs/source/*)
     ifneq ($(SPHINXBUILD),no)
      	$(SPHINXBUILD) -b html docs/source/ docs/build/