1 dnl Checks the location of the XML Catalog
3 dnl JH_PATH_XML_CATALOG([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
4 dnl Defines XMLCATALOG and XML_CATALOG_FILE substitutions
5 AC_DEFUN([JH_PATH_XML_CATALOG],
7 dnl check for the presence of the XML catalog
8 AC_ARG_WITH([xml-catalog],
9 AS_HELP_STRING([--with-xml-catalog=CATALOG],
10 [path to xml catalog to use]),,
11 [with_xml_catalog=''])
12 AC_MSG_CHECKING([for XML catalog])
13 if test -n "$with_xml_catalog"; then
14 dnl path was explicitly given. check that it exists.
15 if test -f "$with_xml_catalog"; then
16 jh_found_xmlcatalog=true
18 jh_found_xmlcatalog=false
21 dnl if one was not explicitly specified, try some guesses
22 dnl we look first in /etc/xml/catalog, then XDG_DATA_DIRS/xml/catalog
23 if test -z "$XDG_DATA_DIRS"; then
24 dnl if we have no XDG_DATA_DIRS, use the default
25 jh_xml_catalog_searchdirs="/etc:/usr/local/share:/usr/share"
27 jh_xml_catalog_searchdirs="/etc:$XDG_DATA_DIRS"
29 jh_found_xmlcatalog=false
30 dnl take care to iterate based on ':', allowing whitespace to appear in paths
31 jh_xml_catalog_saved_ifs="$IFS"
33 for d in $jh_xml_catalog_searchdirs; do
34 if test -f "$d/xml/catalog"; then
35 with_xml_catalog="$d/xml/catalog"
36 jh_found_xmlcatalog=true
40 IFS="$jh_xml_catalog_saved_ifs"
42 if $jh_found_xmlcatalog; then
43 AC_MSG_RESULT([$with_xml_catalog])
45 AC_MSG_RESULT([not found])
47 XML_CATALOG_FILE="$with_xml_catalog"
48 AC_SUBST([XML_CATALOG_FILE])
50 dnl check for the xmlcatalog program
51 AC_PATH_PROG(XMLCATALOG, xmlcatalog, no)
52 if test "x$XMLCATALOG" = xno; then
53 jh_found_xmlcatalog=false
56 if $jh_found_xmlcatalog; then
57 ifelse([$1],,[:],[$1])
59 ifelse([$2],,[AC_MSG_ERROR([could not find XML catalog])],[$2])