summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2009-04-09 12:17:25 +0200
committerBruno Haible <bruno@clisp.org>2009-04-09 12:17:25 +0200
commit2f5ba37e26608fb39f701c2c674305798ef26125 (patch)
tree8cdf88aba13f34a86a09f3a9ee5f24d5eef1efd9
parent97e59cd448f5420f94050aa927ba0a3e0e010735 (diff)
downloadlibunistring-2f5ba37e26608fb39f701c2c674305798ef26125.tar.gz
Build and install the documentation.
-rw-r--r--ChangeLog13
-rw-r--r--Makefile.am4
-rwxr-xr-xautogen.sh15
-rw-r--r--configure.ac8
-rw-r--r--doc/Makefile.am186
-rw-r--r--doc/libunistring.texi7
-rw-r--r--m4/fixautomake.m438
7 files changed, 268 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 624633b..d397e63 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,15 @@
-2008-04-08 Bruno Haible <bruno@clisp.org>
+2008-04-09 Bruno Haible <bruno@clisp.org>
+
+ Build and install documentation.
+ * autogen.sh: Fetch a recent copy of texinfo.tex.
+ * configure.ac (TEXI2DVI, DVIPS, PERL): New substituted variables.
+ (AC_CONFIG_FILES): Add doc/Makefile.
+ * m4/fixautomake.m4: New file, from GNU gettext.
+ * Makefile.am (SUBDIRS): Add doc.
+ (EXTRA_DIST): Add build-aux/texi2html.
+ * doc/Makefile.am: New file.
+ * doc/libunistring.texi: Set document encoding to UTF-8.
+ (arrow): Add a fallback definition for texi2html.
Put the table of contents at the beginning, not at the end.
* build-aux/texi2html (INLINE_CONTENTS): Set to 1.
diff --git a/Makefile.am b/Makefile.am
index c4c9d13..f4b9de4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -20,11 +20,11 @@ AUTOMAKE_OPTIONS = 1.5 gnu no-dependencies
ACLOCAL = build-aux/fixaclocal @ACLOCAL@
ACLOCAL_AMFLAGS = -I m4 -I gnulib-m4
-SUBDIRS = lib tests
+SUBDIRS = doc lib tests
EXTRA_DIST = \
version.sh BUGS DEPENDENCIES HACKING autogen.sh \
- build-aux/fixaclocal build-aux/run-test
+ build-aux/fixaclocal build-aux/texi2html build-aux/run-test
# Allow users to use "gnulib-tool --update".
diff --git a/autogen.sh b/autogen.sh
index 26967cb..1b11159 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -44,6 +44,17 @@ while :; do
done
if test $skip_gnulib = false; then
+ # texinfo.tex
+ # The most recent snapshot of it is available in the gnulib repository.
+ # But this is a snapshot, with all possible dangers.
+ # A stable release of it is available through "automake --add-missing --copy",
+ # but that is too old (does not support @arrow{}). So take the version which
+ # matches the latest stable texinfo release.
+ if test ! -f build-aux/texinfo.tex; then
+ { wget -q --timeout=5 -O build-aux/texinfo.tex.tmp 'http://cvs.savannah.gnu.org/viewvc/*checkout*/texinfo/doc/texinfo.tex?root=texinfo&pathrev=texinfo_4_13' \
+ && mv build-aux/texinfo.tex.tmp build-aux/texinfo.tex; \
+ } || rm -f build-aux/texinfo.tex.tmp
+ fi
if test -z "$GNULIB_TOOL"; then
# Check out gnulib in a subdirectory 'gnulib'.
if test -d gnulib; then
@@ -393,6 +404,10 @@ if test $skip_gnulib = false; then
--import $GNULIB_MODULES
$GNULIB_TOOL --copy-file build-aux/config.guess; chmod a+x build-aux/config.guess
$GNULIB_TOOL --copy-file build-aux/config.sub; chmod a+x build-aux/config.sub
+ # If we got no texinfo.tex so far, take the snapshot from gnulib.
+ if test ! -f build-aux/texinfo.tex; then
+ $GNULIB_TOOL --copy-file build-aux/texinfo.tex build-aux/texinfo.tex
+ fi
fi
fi
diff --git a/configure.ac b/configure.ac
index 627d66b..eb0e868 100644
--- a/configure.ac
+++ b/configure.ac
@@ -54,7 +54,15 @@ dnl Checks for types, header files, functions and declarations.
gl_INIT
+dnl Check for tools needed for formatting the documentation.
+ac_aux_dir_abs=`cd $ac_aux_dir && pwd`
+AC_PATH_PROG([TEXI2DVI], [texi2dvi], [$ac_aux_dir_abs/missing texi2dvi])
+AC_PATH_PROG([DVIPS], [dvips], [$ac_aux_dir_abs/missing dvips])
+AC_PATH_PROG([PERL], [perl], [$ac_aux_dir_abs/missing perl])
+
AC_CONFIG_FILES([Makefile])
+AC_CONFIG_FILES([doc/Makefile],
+ [FIX_MAKEFILE_DISTRIB])
AC_CONFIG_FILES([lib/Makefile])
AC_CONFIG_FILES([tests/Makefile])
AC_OUTPUT
diff --git a/doc/Makefile.am b/doc/Makefile.am
new file mode 100644
index 0000000..bf1549f
--- /dev/null
+++ b/doc/Makefile.am
@@ -0,0 +1,186 @@
+## Makefile for the doc subdirectory of GNU libunistring.
+## Copyright (C) 2009 Free Software Foundation, Inc.
+##
+## This program is free software: you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+## Process this file with automake to produce Makefile.in.
+
+AUTOMAKE_OPTIONS = 1.5 gnits
+EXTRA_DIST =
+MOSTLYCLEANFILES =
+
+# List of -I options referring to directories that contain texinfo sources
+# used by this directory.
+# Should contain at least one -I option, to work around a bug in texi2dvi 1.13,
+# see <http://lists.gnu.org/archive/html/bug-automake/2009-04/msg00029.html>.
+TEXINCLUDES = -I .
+
+MAKEINFO = env LANG= LC_MESSAGES= LC_ALL= LANGUAGE= @MAKEINFO@
+MAKEINFOFLAGS = $(TEXINCLUDES) --no-split
+
+info_TEXINFOS = libunistring.texi
+# List of texinfo sources @included by libunistring.texi, excluding version.texi.
+libunistring_TEXINFOS = \
+ unitypes.texi unistr.texi uniconv.texi unistdio.texi uniname.texi \
+ unictype.texi uniwidth.texi uniwbrk.texi unilbrk.texi uninorm.texi \
+ unicase.texi uniregex.texi \
+ gpl.texi lgpl.texi fdl.texi
+
+# The dependencies of stamp-vti generated by automake are incomplete.
+# So we have to duplicate the entire rule which would otherwise be generated
+# by automake.
+$(srcdir)/stamp-vti: $(info_TEXINFOS) $(libunistring_TEXINFOS) $(top_srcdir)/version.sh
+ (dir=.; test -f ./libunistring.texi || dir=$(srcdir); \
+ set `$(SHELL) $(top_srcdir)/build-aux/mdate-sh $$dir/libunistring.texi`; \
+ echo "@set UPDATED $$1 $$2 $$3"; \
+ echo "@set UPDATED-MONTH $$2 $$3"; \
+ echo "@set EDITION $(VERSION)"; \
+ echo "@set VERSION $(VERSION)") > vti.tmp
+ cmp -s vti.tmp $(srcdir)/version.texi \
+ || (echo "Updating $(srcdir)/version.texi"; \
+ cp vti.tmp $(srcdir)/version.texi)
+ rm -f vti.tmp
+ cp $(srcdir)/version.texi $@
+
+# We distribute only the split HTML documentation.
+# The user can generate the others, via
+# make libunistring.ps
+# make libunistring.pdf
+# make libunistring.html
+
+all-local: html-local
+install-data-local: install-html
+installdirs-local: installdirs-html
+uninstall-local: uninstall-html
+# Hidden from automake, but really activated. Works around an automake-1.5 bug.
+#distdir: dist-html
+
+html-local: html-split
+# Override of automake's definition. The HTML files we want to distribute are
+# not the ones that automake knows about, and we cannot define HTMLS to a value
+# containing wildcards.
+install-html: install-html-split
+ @:
+uninstall-html: uninstall-html-split
+dist-html: dist-html-split
+
+# CLEANFILES: libunistring.{dvi,ps,pdf,html} are already known to automake.
+MAINTAINERCLEANFILES = libunistring_*.html
+
+
+# Documentation in DVI format.
+
+# Override of automake's definition:
+#TEXI2DVI = @TEXI2DVI@
+TEXI2DVI = @TEXI2DVI@ $(TEXINCLUDES)
+
+# The install-dvi target is already defined by automake.
+
+installdirs-dvi:
+ $(mkdir_p) $(DESTDIR)$(dvidir)
+
+uninstall-dvi:
+ $(RM) $(DESTDIR)$(dvidir)/libunistring.dvi
+
+
+# Documentation in Postscript format.
+
+# Override of automake's definition:
+#DVIPS = @DVIPS@
+DVIPS = @DVIPS@ -D600
+
+libunistring.ps: libunistring.dvi
+ $(DVIPS) -o $@ `if test -f libunistring.dvi; then echo libunistring.dvi; else echo $(srcdir)/libunistring.dvi; fi`
+
+# The install-ps target is already defined by automake.
+
+installdirs-ps:
+ $(mkdir_p) $(DESTDIR)$(psdir)
+
+uninstall-ps:
+ $(RM) $(DESTDIR)$(psdir)/libunistring.ps
+
+
+# Documentation in Portable Document Format.
+
+# Override of automake's definition:
+#TEXI2PDF = @TEXI2DVI@ --pdf
+TEXI2PDF = @TEXI2DVI@ --pdf $(TEXINCLUDES)
+
+# The install-pdf target is already defined by automake.
+
+installdirs-pdf:
+ $(mkdir_p) $(DESTDIR)$(pdfdir)
+
+uninstall-pdf:
+ $(RM) $(DESTDIR)$(pdfdir)/libunistring.pdf
+
+
+# Documentation in HTML format.
+
+TEXI2HTML = @PERL@ $(top_srcdir)/build-aux/texi2html
+
+html-monolithic: libunistring.html
+html-split: libunistring_toc.html
+
+# Override of automake's definition.
+# We want to use texi2html, not makeinfo --html.
+libunistring.html: libunistring.texi version.texi $(libunistring_TEXINFOS)
+ $(TEXI2HTML) $(TEXINCLUDES) -no-sec-nav -no-menu -toc-links -number -monolithic `if test -f libunistring.texi; then echo libunistring.texi; else echo $(srcdir)/libunistring.texi; fi`
+
+libunistring_toc.html: libunistring.texi version.texi $(libunistring_TEXINFOS)
+ case "@PERL@" in \
+ *"/missing perl") \
+ $(TEXI2HTML) $(TEXINCLUDES) -no-sec-nav -no-menu -toc-links -number -split_chapter `if test -f libunistring.texi; then echo libunistring.texi; else echo $(srcdir)/libunistring.texi; fi` || exit 0 ;; \
+ *) $(RM) libunistring_*.html ; \
+ $(TEXI2HTML) $(TEXINCLUDES) -no-sec-nav -no-menu -toc-links -number -split_chapter `if test -f libunistring.texi; then echo libunistring.texi; else echo $(srcdir)/libunistring.texi; fi` ;; \
+ esac \
+ && { mv libunistring/libunistring.html libunistring_toc.html; \
+ mv libunistring/*.html .; \
+ rmdir libunistring; \
+ }
+
+install-html-monolithic: libunistring.html
+ $(mkdir_p) $(DESTDIR)$(htmldir)
+ $(INSTALL_DATA) `if test -f libunistring.html; then echo .; else echo $(srcdir); fi`/libunistring.html $(DESTDIR)$(htmldir)/libunistring.html
+
+install-html-split: libunistring_toc.html
+ $(mkdir_p) $(DESTDIR)$(htmldir)
+ for file in `if test -f libunistring_toc.html; then echo .; else echo $(srcdir); fi`/libunistring_*.html; do \
+ $(INSTALL_DATA) $$file $(DESTDIR)$(htmldir)/`basename $$file`; \
+ done
+
+installdirs-html:
+ $(mkdir_p) $(DESTDIR)$(htmldir)
+
+uninstall-html-monolithic:
+ $(RM) $(DESTDIR)$(htmldir)/libunistring.html
+
+uninstall-html-split:
+ $(RM) $(DESTDIR)$(htmldir)/libunistring_*.html
+
+dist-html-monolithic:
+ $(mkdir_p) $(distdir)/
+ file=libunistring.html; \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ cp -p $$d/$$file $(distdir)/$$file || exit 1
+
+# We would like to put libunistring_*.html into EXTRA_DIST, but it doesn't work.
+dist-html-split:
+ $(mkdir_p) $(distdir)/
+ file=libunistring_toc.html; \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ for file in `cd $$d && echo libunistring_*.html`; do \
+ cp -p $$d/$$file $(distdir)/$$file || exit 1; \
+ done
diff --git a/doc/libunistring.texi b/doc/libunistring.texi
index d0eff27..e40c70e 100644
--- a/doc/libunistring.texi
+++ b/doc/libunistring.texi
@@ -1,6 +1,7 @@
\input texinfo @c -*-texinfo-*-
@comment %**start of header
@setfilename libunistring.info
+@documentencoding UTF-8
@settitle GNU libunistring
@finalout
@c Indices:
@@ -16,6 +17,12 @@
@ifclear texi2html
@firstparagraphindent insert
@end ifclear
+@c texi2html-1.76 does not support @arrow{}.
+@ifset texi2html
+@macro arrow{}
+→
+@end macro
+@end ifset
@comment %**end of header
@include version.texi
diff --git a/m4/fixautomake.m4 b/m4/fixautomake.m4
new file mode 100644
index 0000000..bf82d76
--- /dev/null
+++ b/m4/fixautomake.m4
@@ -0,0 +1,38 @@
+# fixautomake.m4 serial 6 (gettext-0.16)
+dnl Copyright (C) 2002-2003, 2006 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License. As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+dnl From Bruno Haible
+
+dnl Fix unesthetic build commands generated by automake.
+AC_DEFUN([FIX_MAKEFILE_COMPILE], [
+ sed -e "s,\`test -f \\\$< || echo '\\\$(srcdir)/'\`\\\$<,\\\$<," -e "s,\`test -f '\\\$<' || echo '\\\$(srcdir)/'\`\\\$<,\\\$<," < $ac_file > $ac_file.tmp
+ mv $ac_file.tmp $ac_file
+])
+
+dnl Fix an automake-1.5-1.7.2 bug: the distrib rule is omitted.
+AC_DEFUN([FIX_MAKEFILE_DISTRIB], [
+ sed -e 's,^#distdir:,distdir:,' < $ac_file > $ac_file.tmp
+ mv $ac_file.tmp $ac_file
+])
+
+dnl Fix an automake-1.9-1.10 bug: the distrib rule is not extensible.
+dnl Insert a invocation of the distdir1 target inside the distdir commands,
+dnl after $(distdir) has been erased and re-created.
+AC_DEFUN([FIX_MAKEFILE_TOPDIR_DISTRIB], [
+ sed_script='/mkdir \$(distdir)$/{a\
+\ $(MAKE) distdir1
+}'
+ sed -e "$sed_script" < $ac_file > $ac_file.tmp
+ mv $ac_file.tmp $ac_file
+])
+
+dnl Fix an automake-1.5-1.7.2 bug: all info files are erased by "make".
+AC_DEFUN([FIX_MAKEFILE_INFO], [
+ sed -e '/@rm -f \$''@/d' < $ac_file > $ac_file.tmp
+ mv $ac_file.tmp $ac_file
+])