migratetmpl: also remove the migration tool
[gtk-doc.git] / m4 / gtkdoc_jh_path_xml_catalog.m4
blobcca22677c2436d39fe56ecbb907203317bb9bbe4
1 dnl Checks the location of the XML Catalog
2 dnl Usage:
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
17                 else
18                         jh_found_xmlcatalog=false
19                 fi
20         else
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"
26                 else
27                         jh_xml_catalog_searchdirs="/etc:$XDG_DATA_DIRS"
28                 fi
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"
32                 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
37                                 break
38                         fi
39                 done
40                 IFS="$jh_xml_catalog_saved_ifs"
41         fi
42         if $jh_found_xmlcatalog; then
43                 AC_MSG_RESULT([$with_xml_catalog])
44         else
45                 AC_MSG_RESULT([not found])
46         fi
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
54         fi
56         if $jh_found_xmlcatalog; then
57                 ifelse([$1],,[:],[$1])
58         else
59                 ifelse([$2],,[AC_MSG_ERROR([could not find XML catalog])],[$2])
60         fi