postgresql/config/docbook.m4
Tom Lane f2386d7136 Fix configure's search for collateindex.pl.
PGAC_PATH_COLLATEINDEX supposed that it could use AC_PATH_PROGS to search
for collateindex.pl, but that macro will only accept files that are marked
executable, and at least some DocBook installations don't mark the script
executable (a case the docs Makefile was already prepared for).  Accept the
script if it's present and readable in $DOCBOOKSTYLE/bin, and otherwise
search the PATH as before.

Having fixed that up, we don't need the fallback case that was in the docs
Makefile, and instead can throw an understandable error if configure didn't
find the script.  Per recent trouble report from John Lumby.
2012-03-22 00:46:03 -04:00

102 lines
2.7 KiB
Text

# config/docbook.m4
# PGAC_PROG_JADE
# --------------
AC_DEFUN([PGAC_PROG_JADE],
[AC_CHECK_PROGS([JADE], [openjade jade])])
# PGAC_PROG_NSGMLS
# ----------------
AC_DEFUN([PGAC_PROG_NSGMLS],
[AC_CHECK_PROGS([NSGMLS], [onsgmls nsgmls])])
# PGAC_CHECK_DOCBOOK(VERSION)
# ---------------------------
AC_DEFUN([PGAC_CHECK_DOCBOOK],
[AC_REQUIRE([PGAC_PROG_NSGMLS])
AC_CACHE_CHECK([for DocBook V$1], [pgac_cv_check_docbook],
[cat >conftest.sgml <<EOF
<!doctype book PUBLIC "-//OASIS//DTD DocBook V$1//EN">
<book>
<title>test</title>
<chapter>
<title>random</title>
<sect1>
<title>testsect</title>
<para>text</para>
</sect1>
</chapter>
</book>
EOF
pgac_cv_check_docbook=no
if test -n "$NSGMLS"; then
$NSGMLS -s conftest.sgml 1>&AS_MESSAGE_LOG_FD 2>&1
if test $? -eq 0; then
pgac_cv_check_docbook=yes
fi
fi
rm -f conftest.sgml])
have_docbook=$pgac_cv_check_docbook
AC_SUBST([have_docbook])
])# PGAC_CHECK_DOCBOOK
# PGAC_PATH_DOCBOOK_STYLESHEETS
# -----------------------------
AC_DEFUN([PGAC_PATH_DOCBOOK_STYLESHEETS],
[AC_ARG_VAR(DOCBOOKSTYLE, [location of DocBook stylesheets])dnl
AC_MSG_CHECKING([for DocBook stylesheets])
AC_CACHE_VAL([pgac_cv_path_stylesheets],
[if test -n "$DOCBOOKSTYLE"; then
pgac_cv_path_stylesheets=$DOCBOOKSTYLE
else
for pgac_prefix in /usr /usr/local /opt /sw; do
for pgac_infix in share lib; do
for pgac_postfix in \
sgml/stylesheets/nwalsh-modular \
sgml/stylesheets/docbook \
sgml/stylesheets/dsssl/docbook \
sgml/docbook-dsssl \
sgml/docbook/dsssl/modular \
sgml/docbook/stylesheet/dsssl/modular \
sgml/docbook/dsssl-stylesheets \
sgml/dsssl/docbook-dsssl-nwalsh
do
pgac_candidate=$pgac_prefix/$pgac_infix/$pgac_postfix
if test -r "$pgac_candidate/html/docbook.dsl" \
&& test -r "$pgac_candidate/print/docbook.dsl"
then
pgac_cv_path_stylesheets=$pgac_candidate
break 3
fi
done
done
done
fi])
DOCBOOKSTYLE=$pgac_cv_path_stylesheets
AC_SUBST([DOCBOOKSTYLE])
if test -n "$DOCBOOKSTYLE"; then
AC_MSG_RESULT([$DOCBOOKSTYLE])
else
AC_MSG_RESULT(no)
fi])# PGAC_PATH_DOCBOOK_STYLESHEETS
# PGAC_PATH_COLLATEINDEX
# ----------------------
# Some DocBook installations provide collateindex.pl in $DOCBOOKSTYLE/bin,
# but it's not necessarily marked executable, so we can't use AC_PATH_PROG
# to check for it there. Other installations just put it in the PATH.
AC_DEFUN([PGAC_PATH_COLLATEINDEX],
[AC_REQUIRE([PGAC_PATH_DOCBOOK_STYLESHEETS])dnl
if test -n "$DOCBOOKSTYLE" -a -r "$DOCBOOKSTYLE/bin/collateindex.pl"; then
COLLATEINDEX="$DOCBOOKSTYLE/bin/collateindex.pl"
AC_SUBST([COLLATEINDEX])
else
AC_PATH_PROG(COLLATEINDEX, collateindex.pl)
fi])# PGAC_PATH_COLLATEINDEX