[gnome-contacts] Check for stylesheets required for man page
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts] Check for stylesheets required for man page
- Date: Fri, 23 Jan 2015 21:54:01 +0000 (UTC)
commit fa4f2c798bdf6d7de95ef5f1239b5951edfff60b
Author: David King <amigadave amigadave com>
Date: Tue Jan 20 14:30:06 2015 +0000
Check for stylesheets required for man page
Macros copied from gtk-doc.
https://bugzilla.gnome.org/show_bug.cgi?id=743255
configure.ac | 10 +++++-
m4/gtkdoc_jh_check_xml_catalog.m4 | 16 ++++++++++
m4/gtkdoc_jh_path_xml_catalog.m4 | 61 +++++++++++++++++++++++++++++++++++++
3 files changed, 85 insertions(+), 2 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 6593eb0..2664bd9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -95,8 +95,14 @@ AS_IF([test "x$enable_man_pages" != "xno"],
[AC_PATH_PROG([XSLTPROC], [xsltproc])
AS_IF([test "xac_cv_path_XSLTPROC" = "x"], [have_xsltproc=no],
[have_xsltproc=yes])
-dnl TODO: Also check for the required stylesheets.
- AS_IF([test "x$have_xsltproc" = "xyes"],
+ JH_CHECK_XML_CATALOG([-//OASIS//DTD DocBook XML V4.2//EN],
+ [DocBook XML DTD V4.2], [have_docbookdtd=yes],
+ [have_docbookdtd=no])
+ JH_CHECK_XML_CATALOG([http://docbook.sourceforge.net/release/xsl/current/html/refentry.xsl],
+ [DocBook XSL Stylesheets], [have_docbookxsl=yes],
+ [have_docbookxsl=no])
+ AS_IF([test "x$have_xsltproc" = "xyes" -a "x$have_docbookdtd" = "xyes" \
+ -a "x$have_docbookxsl" = "xyes"],
[have_manutils=yes],
[AS_IF([test "x$enable_man_pages" = "xyes"],
[AC_MSG_ERROR([man page requested but required utilities were not found])])
diff --git a/m4/gtkdoc_jh_check_xml_catalog.m4 b/m4/gtkdoc_jh_check_xml_catalog.m4
new file mode 100644
index 0000000..618c1c9
--- /dev/null
+++ b/m4/gtkdoc_jh_check_xml_catalog.m4
@@ -0,0 +1,16 @@
+dnl Checks if a particular URI appears in the XML catalog
+dnl Usage:
+dnl JH_CHECK_XML_CATALOG(URI, [FRIENDLY-NAME], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+AC_DEFUN([JH_CHECK_XML_CATALOG],
+[
+ AC_REQUIRE([JH_PATH_XML_CATALOG],[JH_PATH_XML_CATALOG(,[:])])dnl
+ AC_MSG_CHECKING([for ifelse([$2],,[$1],[$2]) in XML catalog])
+ if $jh_found_xmlcatalog && \
+ AC_RUN_LOG([$XMLCATALOG --noout "$XML_CATALOG_FILE" "$1" >&2]); then
+ AC_MSG_RESULT([found])
+ ifelse([$3],,,[$3])
+ else
+ AC_MSG_RESULT([not found])
+ ifelse([$4],,[AC_MSG_ERROR([could not find ifelse([$2],,[$1],[$2]) in XML catalog])],[$4])
+ fi
+])
diff --git a/m4/gtkdoc_jh_path_xml_catalog.m4 b/m4/gtkdoc_jh_path_xml_catalog.m4
new file mode 100644
index 0000000..cca2267
--- /dev/null
+++ b/m4/gtkdoc_jh_path_xml_catalog.m4
@@ -0,0 +1,61 @@
+dnl Checks the location of the XML Catalog
+dnl Usage:
+dnl JH_PATH_XML_CATALOG([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+dnl Defines XMLCATALOG and XML_CATALOG_FILE substitutions
+AC_DEFUN([JH_PATH_XML_CATALOG],
+[
+ dnl check for the presence of the XML catalog
+ AC_ARG_WITH([xml-catalog],
+ AS_HELP_STRING([--with-xml-catalog=CATALOG],
+ [path to xml catalog to use]),,
+ [with_xml_catalog=''])
+ AC_MSG_CHECKING([for XML catalog])
+ if test -n "$with_xml_catalog"; then
+ dnl path was explicitly given. check that it exists.
+ if test -f "$with_xml_catalog"; then
+ jh_found_xmlcatalog=true
+ else
+ jh_found_xmlcatalog=false
+ fi
+ else
+ dnl if one was not explicitly specified, try some guesses
+ dnl we look first in /etc/xml/catalog, then XDG_DATA_DIRS/xml/catalog
+ if test -z "$XDG_DATA_DIRS"; then
+ dnl if we have no XDG_DATA_DIRS, use the default
+ jh_xml_catalog_searchdirs="/etc:/usr/local/share:/usr/share"
+ else
+ jh_xml_catalog_searchdirs="/etc:$XDG_DATA_DIRS"
+ fi
+ jh_found_xmlcatalog=false
+ dnl take care to iterate based on ':', allowing whitespace to appear in paths
+ jh_xml_catalog_saved_ifs="$IFS"
+ IFS=':'
+ for d in $jh_xml_catalog_searchdirs; do
+ if test -f "$d/xml/catalog"; then
+ with_xml_catalog="$d/xml/catalog"
+ jh_found_xmlcatalog=true
+ break
+ fi
+ done
+ IFS="$jh_xml_catalog_saved_ifs"
+ fi
+ if $jh_found_xmlcatalog; then
+ AC_MSG_RESULT([$with_xml_catalog])
+ else
+ AC_MSG_RESULT([not found])
+ fi
+ XML_CATALOG_FILE="$with_xml_catalog"
+ AC_SUBST([XML_CATALOG_FILE])
+
+ dnl check for the xmlcatalog program
+ AC_PATH_PROG(XMLCATALOG, xmlcatalog, no)
+ if test "x$XMLCATALOG" = xno; then
+ jh_found_xmlcatalog=false
+ fi
+
+ if $jh_found_xmlcatalog; then
+ ifelse([$1],,[:],[$1])
+ else
+ ifelse([$2],,[AC_MSG_ERROR([could not find XML catalog])],[$2])
+ fi
+])
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]