+dnl -- sgml tools --
+
+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 \$^ > \$@"
+ ;;
+ *w3m*)
+ HTML2TXT_CMD="$HTML2TXT_CMD -dump \$^ > \$@"
+ ;;
+ *)
+ HTML2TXT_CMD="true"
+ ;;
+esac
+AC_SUBST(HTML2TXT_CMD)
+
+AC_MSG_CHECKING([for tidy])
+AC_PATH_PROG([HTMLCLEAN_CMD], [tidy], [none])
+
+if test x"$HTMLCLEAN_CMD" != x"none"
+then
+ HTMLCLEAN_CMD="$HTMLCLEAN_CMD -q -i -m -asxml -utf8 "
+else
+ HTMLCLEAN_CMD="echo "
+fi
+AC_SUBST(HTMLCLEAN_CMD)
+