-AC_MSG_CHECKING([for SGML Tools style])
-SGML2TXT_CMD="true"
-SGML2PS_CMD="true"
-SGML2HTML_CMD="true"
-case "`uname -s`" in
- FreeBSD)
- SGML2TXT_CMD="sgmlfmt -f ascii manual.sgml && uniq < manual.ascii | expand > manual.txt && rm -rf manual.ascii || true"
- SGML2PS_CMD="sgmlfmt -f ps manual.sgml || true"
- SGML2HTML_CMD="sgmlfmt -f html manual.sgml || true"
- AC_MSG_RESULT(FreeBSD)
+
+dnl Documentation tools
+have_openjade="no"
+AC_PATH_PROG([OSPCAT], [ospcat], [none])
+if test "$OSPCAT" != "none"
+then
+ AC_MSG_CHECKING([for openjade docbook stylesheets])
+ dslosfile=`ospcat --public-id="-//Norman Walsh//DOCUMENT DocBook Print Stylesheet//EN"`
+ DSLROOT=`echo $dslosfile | sed -n -e "s/.*SOIBASE='\(@<:@^'@:>@*\)\/catalog'.*/\1/p"`
+ # ospcat may spit out an absolute path without an SOIBASE
+ if test -z "$DSLROOT"
+ then
+ DSLROOT=`echo $dslosfile | sed -e 's|<OSFILE>\(.*\)/print/docbook.dsl|\1|'`
+ fi
+ if test -f $DSLROOT/print/docbook.dsl
+ then
+ AC_MSG_RESULT([in $DSLROOT])
+ have_openjade="yes"
+ else
+ AC_MSG_RESULT([not found: PDF documentation will not be built.])
+ fi
+fi
+AC_SUBST(DSLROOT)
+
+AC_MSG_CHECKING([for lynx])
+AC_PATH_PROG([HTML2TXT_CMD], [lynx], [none])
+if test x"$HTML2TXT_CMD" = x"none"
+then
+ AC_MSG_CHECKING([for w3m])
+ AC_PATH_PROG([HTML2TXT_CMD], [w3m], [none])
+fi
+if test x"$HTML2TXT_CMD" = x"none"
+then
+ AC_MSG_CHECKING([for elinks])
+ AC_PATH_PROG([HTML2TXT_CMD], [elinks], [none])
+fi
+case "$HTML2TXT_CMD" in
+ *elinks*)
+ HTML2TXT_CMD="$HTML2TXT_CMD -dump -no-numbering -no-references \$^ > \$@"
+ ;;
+ *lynx*)
+ HTML2TXT_CMD="$HTML2TXT_CMD -dump -nolist -with_backspaces \$^ > \$@"