mkdb: add an idea for rewriting path of system entities in the doctype_header
[gtk-doc.git] / acinclude.m4
blob02501fa5f95648f47734f2d732a412f324cdde98
2 # Checks the location of the XML Catalog
3 # Usage:
4 #   JH_PATH_XML_CATALOG([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
5 # Defines XMLCATALOG and XML_CATALOG_FILE substitutions
6 AC_DEFUN([JH_PATH_XML_CATALOG],
8   # check for the presence of the XML catalog
9   AC_ARG_WITH([xml-catalog],
10               AC_HELP_STRING([--with-xml-catalog=CATALOG],
11                              [path to xml catalog to use]),,
12               [with_xml_catalog=/etc/xml/catalog])
13   jh_found_xmlcatalog=true
14   XML_CATALOG_FILE="$with_xml_catalog"
15   AC_SUBST([XML_CATALOG_FILE])
16   AC_MSG_CHECKING([for XML catalog ($XML_CATALOG_FILE)])
17   if test -f "$XML_CATALOG_FILE"; then
18     AC_MSG_RESULT([found])
19   else
20     jh_found_xmlcatalog=false
21     AC_MSG_RESULT([not found])
22   fi
24   # check for the xmlcatalog program
25   AC_PATH_PROG(XMLCATALOG, xmlcatalog, no)
26   if test "x$XMLCATALOG" = xno; then
27     jh_found_xmlcatalog=false
28   fi
30   if $jh_found_xmlcatalog; then
31     ifelse([$1],,[:],[$1])
32   else
33     ifelse([$2],,[AC_MSG_ERROR([could not find XML catalog])],[$2])
34   fi
37 # Checks if a particular URI appears in the XML catalog
38 # Usage:
39 #   JH_CHECK_XML_CATALOG(URI, [FRIENDLY-NAME], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
40 AC_DEFUN([JH_CHECK_XML_CATALOG],
42   AC_REQUIRE([JH_PATH_XML_CATALOG],[JH_PATH_XML_CATALOG(,[:])])dnl
43   AC_MSG_CHECKING([for ifelse([$2],,[$1],[$2]) in XML catalog])
44   if $jh_found_xmlcatalog && \
45      AC_RUN_LOG([$XMLCATALOG --noout "$XML_CATALOG_FILE" "$1" >&2]); then
46     AC_MSG_RESULT([found])
47     ifelse([$3],,,[$3
48 ])dnl
49   else
50     AC_MSG_RESULT([not found])
51     ifelse([$4],,
52        [AC_MSG_ERROR([could not find ifelse([$2],,[$1],[$2]) in XML catalog])],
53        [$4])
54   fi