1# autoconf 2.13 / 2.50 compatibility macro
2
3# GLIB_AC_DIVERT_BEFORE_HELP(STUFF)
4# ---------------------------------
5# Put STUFF early enough so that they are available for $ac_help expansion.
6# Handle both classic (<= v2.13) and modern autoconf
7AC_DEFUN([GLIB_AC_DIVERT_BEFORE_HELP],
8[ifdef([m4_divert_text], [m4_divert_text([NOTICE],[$1])],
9       [ifdef([AC_DIVERT], [AC_DIVERT([NOTICE],[$1])],
10              [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl
11$1
12AC_DIVERT_POP()])])])
13
14# GTK_ADD_LIB(VAR,LIBNAME)
15# ---------------------------------
16# Helper macro to add a -lBlah to a variable, avoiding repeats
17# Note that this needs to be quoted when used in an enclosing macro
18AC_DEFUN([GTK_ADD_LIB],
19[ case "$$1 " in
20    *-l$2[[\ \	]]*)               ;;
21    *)               $1="-l$2 $$1" ;;
22  esac
23])
24
25
26# Checks the location of the XML Catalog
27# Usage:
28#   JH_PATH_XML_CATALOG([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
29# Defines XMLCATALOG and XML_CATALOG_FILE substitutions
30AC_DEFUN([JH_PATH_XML_CATALOG],
31[
32  # check for the presence of the XML catalog
33  AC_ARG_WITH([xml-catalog],
34              AC_HELP_STRING([--with-xml-catalog=CATALOG],
35                             [path to xml catalog to use]),,
36              [with_xml_catalog=/etc/xml/catalog])
37  jh_found_xmlcatalog=true
38  XML_CATALOG_FILE="$with_xml_catalog"
39  AC_SUBST([XML_CATALOG_FILE])
40  AC_MSG_CHECKING([for XML catalog ($XML_CATALOG_FILE)])
41  if test -f "$XML_CATALOG_FILE"; then
42    AC_MSG_RESULT([found])
43  else
44    jh_found_xmlcatalog=false
45    AC_MSG_RESULT([not found])
46  fi
47
48  # check for the xmlcatalog program
49  AC_PATH_PROG(XMLCATALOG, xmlcatalog, no)
50  if test "x$XMLCATALOG" = xno; then
51    jh_found_xmlcatalog=false
52  fi
53
54  if $jh_found_xmlcatalog; then
55    ifelse([$1],,[:],[$1])
56  else
57    ifelse([$2],,[AC_MSG_ERROR([could not find XML catalog])],[$2])
58  fi
59])
60
61# Checks if a particular URI appears in the XML catalog
62# Usage:
63#   JH_CHECK_XML_CATALOG(URI, [FRIENDLY-NAME], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
64AC_DEFUN([JH_CHECK_XML_CATALOG],
65[
66  AC_REQUIRE([JH_PATH_XML_CATALOG],[JH_PATH_XML_CATALOG(,[:])])dnl
67  AC_MSG_CHECKING([for ifelse([$2],,[$1],[$2]) in XML catalog])
68  if $jh_found_xmlcatalog && \
69     AC_RUN_LOG([$XMLCATALOG --noout "$XML_CATALOG_FILE" "$1" >&2]); then
70    AC_MSG_RESULT([found])
71    ifelse([$3],,,[$3
72])dnl
73  else
74    AC_MSG_RESULT([not found])
75    ifelse([$4],,
76       [AC_MSG_ERROR([could not find ifelse([$2],,[$1],[$2]) in XML catalog])],
77       [$4])
78  fi
79])
80