[RFC:lib/libSM] Use XORG_CHECK_GROFF for building specs

Yaakov (Cygwin/X) yselkowitz at users.sourceforge.net
Wed Oct 21 02:30:18 PDT 2009


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

---
This is an example usage of XORG_CHECK_GROFF, adding PDF docs as well.

 configure.ac    |   29 ++++-------------------------
 doc/Makefile.am |   30 +++++++++++++++++++++---------
 2 files changed, 25 insertions(+), 34 deletions(-)

diff --git a/configure.ac b/configure.ac
index baabf6d..228202d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -12,10 +12,10 @@ AM_INIT_AUTOMAKE([dist-bzip2])
 
 AM_MAINTAINER_MODE
 
-# Require xorg-macros 1.3 or later: XORG_DEFAULT_OPTIONS
+# Require xorg-macros 1.4 or later: XORG_CHECK_GROFF
 m4_ifndef([XORG_MACROS_VERSION],
-	  [m4_fatal([must install xorg-macros 1.3 or later before running autoconf/autogen])])
-XORG_MACROS_VERSION(1.3)
+	  [m4_fatal([must install xorg-macros 1.4 or later before running autoconf/autogen])])
+XORG_MACROS_VERSION(1.4)
 
 AM_CONFIG_HEADER([config.h])
 
@@ -55,28 +55,7 @@ AC_CHECK_FUNCS([uuid_create], [], [
 
 AM_CONDITIONAL(WITH_LIBUUID, test x"$HAVE_LIBUUID" = xyes)
 
-# Documentation is currently a single troff document
-AC_PATH_PROGS([GROFF], [groff], [none], [$PATH:/usr/gnu/bin])
-
-AC_MSG_CHECKING([whether to build documentation])
-AC_ARG_ENABLE(docs, AC_HELP_STRING([--enable-docs],
-				   [Enable building of Xaw documentation]),
-	      [build_docs="${enableval}"], [build_docs="auto"])
-
-if test "x${build_docs}" = xauto; then
-    if test "x${GROFF}" = xnone ; then
-	build_docs=no
-    else
-	build_docs=yes
-    fi
-fi
-AC_MSG_RESULT([${build_docs}])
-if test "x${build_docs}" = xyes && test "x${GROFF}" = xnone ; then
-    AC_MSG_ERROR([can't build documentation without groff])
-fi
-
-AM_CONDITIONAL(BUILD_DOCS, [test x$build_docs = xyes])
-
+XORG_CHECK_GROFF
 
 AC_OUTPUT([Makefile
 	   doc/Makefile
diff --git a/doc/Makefile.am b/doc/Makefile.am
index fc2260b..614258f 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -26,12 +26,21 @@
 
 # Based on xc/doc/specs/SM/Makefile from X11R6.9
 
-doc_sources = macros.t SMlib.ms xsmp.ms
+doc_sources = SMlib.ms xsmp.ms
 
-EXTRA_DIST = $(doc_sources)
+EXTRA_DIST = $(doc_sources) macros.t
 
-if BUILD_DOCS
-doc_DATA = SMlib.txt SMlib.ps SMlib.html xsmp.txt xsmp.ps xsmp.html
+if BUILD_SPECS
+
+if BUILD_PDFDOC
+printable_format = .pdf
+else
+printable_format = .ps
+endif
+
+doc_DATA =	$(doc_sources:.ms=.txt) \
+		$(doc_sources:.ms=$(printable_format)) \
+		$(doc_sources:.ms=.html)
 
 CLEANFILES = $(doc_DATA)
 MOSTLYCLEANFILES = index.*
@@ -42,18 +51,21 @@ GROFF_DEFS = -dxV="$(PACKAGE_STRING)"
 # -t to run through tbl
 GROFF_FLAGS = -t -ms $(GROFF_DEFS) $(srcdir)/macros.t
 
-SUFFIXES = .ms .ps .txt .html
+SUFFIXES = .ms .ps .txt .html .pdf
 
 .ms.ps:
-	-$(AM_V_GEN) $(GROFF) -Tps $(GROFF_FLAGS) $< 2> index.$@.raw > $@
+	-$(AM_V_GEN) $(MAKE_PS) $(GROFF_FLAGS) $< 2> index.$@.raw > $@
 	@if grep '^[^1-9.]' index.$@.raw | grep -v warning; then exit 1; \
 	 else test $$? -le 1; fi
 
 .ms.txt:
-	$(AM_V_GEN) env GROFF_NO_SGR=TRUE $(GROFF) -Tutf8 $(GROFF_FLAGS) \
+	$(AM_V_GEN) $(MAKE_TEXT) -Tutf8 $(GROFF_FLAGS) \
 	 $< 2> index.$@.raw > $@
 
 .ms.html:
-	$(AM_V_GEN) $(GROFF) -Thtml $(GROFF_FLAGS) $< 2> index.$@.raw > $@
+	$(AM_V_GEN) $(MAKE_HTML) $(GROFF_FLAGS) $< 2> index.$@.raw > $@
+
+.ps.pdf:
+	$(AM_V_GEN) $(MAKE_PDF) $< $@
 
-endif BUILD_DOCS
+endif BUILD_SPECS
-- 
1.6.4.2



More information about the xorg-devel mailing list