[PATCH:macros] doc: add XORG_CHECK_SGML_DOCTOOLS to detect xorg-sgml-doctools

Yaakov (Cygwin/X) yselkowitz at users.sourceforge.net
Thu Mar 25 01:48:25 PDT 2010


From: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>

Trying to find X11/defs.ent with AC_CHECK_FILE does not work when
cross-compiling, and the check assumed that xorg-sgml-doctools is
installed to the same prefix which need not always be the case.

xorg-sgml-doctools 1.4 provides a pkg-config file which we can use
instead, fixing both those cases.  This macro is provided in util-macros
instead of with xorg-sgml-doctools, otherwise the latter would become a
hard dependency just to run autoreconf.

Signed-off-by: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
---
This depends on the patch for xorg-sgml-doctools to provide a pkg-config 
file.

 xorg-macros.m4.in |   45 ++++++++++++++++++++++++---------------------
 1 files changed, 24 insertions(+), 21 deletions(-)

diff --git a/xorg-macros.m4.in b/xorg-macros.m4.in
index 055c83e..beb5fd5 100644
--- a/xorg-macros.m4.in
+++ b/xorg-macros.m4.in
@@ -178,6 +178,22 @@ AC_SUBST([DRIVER_MAN_DIR])
 AC_SUBST([ADMIN_MAN_DIR])
 ]) # XORG_MANPAGE_SECTIONS
 
+# XORG_CHECK_SGML_DOCTOOLS
+# ------------------------
+# Minimum version: 1.7.0
+#
+# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
+# provided by xorg-sgml-doctools, if installed.
+AC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
+AC_MSG_CHECKING([for X.Org SGML entities])
+PKG_CHECK_EXISTS([xorg-sgml-doctools],
+    [XORG_SGML_PATH="`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`"
+    have_sgml_ent=yes],
+    [have_sgml_ent=no])
+AC_MSG_RESULT([$have_sgml_ent])
+AC_SUBST(XORG_SGML_PATH)
+])
+
 # XORG_CHECK_LINUXDOC
 # -------------------
 # Minimum version: 1.0.0
@@ -187,23 +203,14 @@ AC_SUBST([ADMIN_MAN_DIR])
 # Whether or not the necessary tools and files are found can be checked
 # with the AM_CONDITIONAL "BUILD_LINUXDOC"
 AC_DEFUN([XORG_CHECK_LINUXDOC],[
-if test x$XORG_SGML_PATH = x ; then
-    XORG_SGML_PATH=$prefix/share/sgml
-fi
-HAVE_DEFS_ENT=
-
-if test x"$cross_compiling" = x"yes" ; then
-  HAVE_DEFS_ENT=no
-else
-  AC_CHECK_FILE([$XORG_SGML_PATH/X11/defs.ent], [HAVE_DEFS_ENT=yes])
-fi
+AC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
 
 AC_PATH_PROG(LINUXDOC, linuxdoc)
 AC_PATH_PROG(PS2PDF, ps2pdf)
 
 AC_MSG_CHECKING([whether to build documentation])
 
-if test x$HAVE_DEFS_ENT != x && test x$LINUXDOC != x ; then
+if test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
    BUILDDOC=yes
 else
    BUILDDOC=no
@@ -245,24 +252,20 @@ AC_SUBST(MAKE_HTML)
 # indicates whether the necessary tools and files are found and, if set,
 # $(MAKE_XXX) blah.sgml will produce blah.xxx.
 AC_DEFUN([XORG_CHECK_DOCBOOK],[
-if test x$XORG_SGML_PATH = x ; then
-    XORG_SGML_PATH=$prefix/share/sgml
-fi
-HAVE_DEFS_ENT=
+AC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
+
 BUILDTXTDOC=no
 BUILDPDFDOC=no
 BUILDPSDOC=no
 BUILDHTMLDOC=no
 
-AC_CHECK_FILE([$XORG_SGML_PATH/X11/defs.ent], [HAVE_DEFS_ENT=yes])
-
 AC_PATH_PROG(DOCBOOKPS, docbook2ps)
 AC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
 AC_PATH_PROG(DOCBOOKHTML, docbook2html)
 AC_PATH_PROG(DOCBOOKTXT, docbook2txt)
 
 AC_MSG_CHECKING([whether to build text documentation])
-if test x$HAVE_DEFS_ENT != x && test x$DOCBOOKTXT != x &&
+if test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
    test x$BUILD_TXTDOC != xno; then
 	BUILDTXTDOC=yes
 fi
@@ -270,7 +273,7 @@ AM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
 AC_MSG_RESULT([$BUILDTXTDOC])
 
 AC_MSG_CHECKING([whether to build PDF documentation])
-if test x$HAVE_DEFS_ENT != x && test x$DOCBOOKPDF != x &&
+if test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
    test x$BUILD_PDFDOC != xno; then
 	BUILDPDFDOC=yes
 fi
@@ -278,7 +281,7 @@ AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
 AC_MSG_RESULT([$BUILDPDFDOC])
 
 AC_MSG_CHECKING([whether to build PostScript documentation])
-if test x$HAVE_DEFS_ENT != x && test x$DOCBOOKPS != x &&
+if test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
    test x$BUILD_PSDOC != xno; then
 	BUILDPSDOC=yes
 fi
@@ -286,7 +289,7 @@ AM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
 AC_MSG_RESULT([$BUILDPSDOC])
 
 AC_MSG_CHECKING([whether to build HTML documentation])
-if test x$HAVE_DEFS_ENT != x && test x$DOCBOOKHTML != x &&
+if test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
    test x$BUILD_HTMLDOC != xno; then
 	BUILDHTMLDOC=yes
 fi
-- 
1.6.6.1



More information about the xorg-devel mailing list