diff --git a/configure.ac b/configure.ac index 45178de4..22397691 100644 --- a/configure.ac +++ b/configure.ac @@ -432,6 +432,25 @@ AC_CHECK_PROG([have_asciidoc], asciidoc, true, false) AC_CHECK_PROG([have_xsltproc], xsltproc, true, false) if $have_asciidoc && $have_xsltproc; then AM_CONDITIONAL([ASCIIDOC], true) + # MacOS with Homebrew requires the environment variable + # XML_CATALOG_FILES for xsltproc. + AM_CONDITIONAL([HAVE_XML_CATALOG_FILES], false) + XML_CATALOG_FILES= + AC_CHECK_PROG([have_brew], brew, true, false) + if $have_brew; then + brew_prefix=$(brew --prefix) + catalog_file=$brew_prefix/etc/xml/catalog + AC_CHECK_FILE($catalog_file, + [ + AM_CONDITIONAL([HAVE_XML_CATALOG_FILES], true) + XML_CATALOG_FILES=file:$catalog_file + ], + [ + AC_MSG_ERROR([Missing file $catalog_file.]) + ] + ) + fi + AC_SUBST([XML_CATALOG_FILES]) else AM_CONDITIONAL([ASCIIDOC], false) fi diff --git a/doc/Makefile.am b/doc/Makefile.am index f78e5e00..5dfa20d1 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -38,8 +38,13 @@ pdf: ${man_MANS:%=%.pdf} SUFFIXES = .asc .html .pdf .asc: - -asciidoc -b docbook -d manpage -o - $< | \ +if HAVE_XML_CATALOG_FILES + asciidoc -b docbook -d manpage -o - $< | \ + XML_CATALOG_FILES=$(XML_CATALOG_FILES) xsltproc --nonet $(man_xslt) - +else + asciidoc -b docbook -d manpage -o - $< | \ xsltproc --nonet $(man_xslt) - +endif .asc.html: asciidoc -b html5 -o $@ $<