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