diff -ruNp m4-1.4.10/.tarball-version m4-1.4.11/.tarball-version --- m4-1.4.10/.tarball-version 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/.tarball-version 2008-04-02 07:16:28.000000000 -0600 @@ -0,0 +1 @@ +1.4.11 diff -ruNp m4-1.4.10/.version m4-1.4.11/.version --- m4-1.4.10/.version 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/.version 2008-02-25 21:29:23.000000000 -0700 @@ -0,0 +1 @@ +1.4.10b.2-3ab0-dirty diff -ruNp m4-1.4.10/AUTHORS m4-1.4.11/AUTHORS --- m4-1.4.10/AUTHORS 2007-05-30 19:24:06.000000000 -0600 +++ m4-1.4.11/AUTHORS 2007-10-06 16:15:26.000000000 -0600 @@ -2,93 +2,29 @@ Authors of GNU M4. The following contributors have warranted legal paper exchanges with the Free Software Foundation for their contributions to GNU M4. Also -see the files ChangeLog and THANKS. - -This list comes from "sed -ne '/^M4/,/^$/p' /gd/gnuorg/copyright.list" -on the fencepost.gnu.org machine. - -M4 Rene' Seindal Denmark 1964 1990-03-28 -Assigns program and future changes. - -M4 University of Copenhagen 1990-01-17 -Disclaims the program by Rene Seindal. - -M4 James L. Avera USA ? 1993-10-04 -Assigns changes. -Changed (in m4-1.0.3): M4.c M4.h debug.c Makefile.in configure.in -Changelog -Added: stackovf.c tests/stackovf_test.sh - -M4 Pete Chown Uk 1972 1994-06-28 -Assigns changes (builtin.c, input.c, m4.h, m4.texinfo, macro.c). - -M4 John Gerard Makecki USA 1954 1995-04-24 -Assigns changes. (eval.c, builtin.c, m4.[ch]; new - numb.[ch]) -johnm@vlibs.com - -M4 VLSI Libraries Inc. 1995-04-24 -Disclaims changes by John Gerard Makecki. - -M4 Francois Pinard Canada 1949 1996-02-01 -Assigns past and future changes. -pinard@iro.umontreal.ca - -M4 Thomas Tanner Germany 1979 1999-06-23 -Assigns past and future changes. -tanner@ffii.org - -M4 Gary V. Vaughan Uk 1970 2000-10-02 -Assigns past and future changes (extensive; new src/modules.c). -gvv@techie.com, gary@gnu.org - -M4 TRANSLATIONS Yuji Minejima Japan 1969 2001-05-09 -Assigns translation of manual for m4. - -M4 Akim Demaille France 1970 2001-11-01 -Assigns past and future changes. -akim@freefriends.org - -M4 Andrew James Bettison Australia 1964 2001-11-19 -Assigns past and future changes. (list with assignment) -andrewb@zip.com.au - -M4 Noah Jeffrey Misch United States 1984 2004-07-05 -Assigns past and future changes. -noah@cs.caltech.edu - -M4 Michael Elizabeth Chastain Us 1962 2001-12-27 -Assigns past and future changes. -mec@shout.net - -M4 William C. Cox United States 1945 2004-12-04 -Assigns past and future changes. -bill@qswtools.com - -M4 Alexandre Duret-Lutz France 1978 2004-12-04 -Assigns past and future changes. -adl@gnu.org - -M4 John Gatewood Ham USA, 1964 2005-11-01 -Assigns Past and Future Changes -zappaman@buraphalinux.org -Changed files: -m4-1.4.3/COPYING,m4-1.4.3/ChangeLog,m4-1.4.3/README, m4-1.4.3/THANKS, m4-1.4.3/checks/Makefile.in, m4-1.4.3/doc/m4.texinfo,m4-1.4.3/src/m4.c, New file: m4-1.4.3/checks/invocation_tests - -M4 Eric Benjamin Blake USA, 1977 2006-01-18 -Assigns Past and Future Changes -ebb9@byu.net - -M4 John Brzustowski Canada, 1966 2006-03-06 -Assigns Past and Future Changes -jbrzusto@fastmail.fm - -M4 Ralf Wildenhues Germany, 1975 2006-03-20 -Assigns Past and Future Changes -Ralf.Wildenhues@gmx.de - -M4 Markus Duft Austria, 1984 2006-08-03 -Assigns Past and Future Changes -markus.duft@salomon.at +see the files ChangeLog and THANKS. This list results from searching +for /\bM4\b/ in the file /gd/gnuorg/copyright.list on the +fencepost.gnu.org machine. + +Rene' Seindal seindal@diku.dk 1990-03-28 +James L. Avera jima@netcom.com 1993-10-04 +Pete Chown pete.chown@dale.dircon.co.uk 1994-06-28 +John Gerard Makecki johnm@vlibs.com 1995-04-24 +Francois Pinard pinard@iro.umontreal.ca 1996-02-01 +Thomas Tanner tanner@ffii.org 1999-06-23 +Gary V. Vaughan gary@gnu.org 2000-10-02 +Yuji Minejima ? 2001-05-09 +Akim Demaille akim@freefriends.org 2001-11-01 +Andrew James Bettison andrewb@zip.com.au 2001-11-19 +Noah Jeffrey Misch noah@cs.caltech.edu 2004-07-05 +Michael Elizabeth Chastain mec@shout.net 2001-12-27 +William C. Cox bill@qswtools.com 2004-12-04 +Alexandre Duret-Lutz adl@gnu.org 2004-12-04 +John Gatewood Ham zappaman@buraphalinux.org 2005-11-01 +Eric Benjamin Blake ebb9@byu.net 2006-01-18 +John Brzustowski jbrzusto@fastmail.fm 2006-03-06 +Ralf Wildenhues Ralf.Wildenhues@gmx.de 2006-03-20 +Markus Duft markus.duft@salomon.at 2006-08-03 ======================================================================== diff -ruNp m4-1.4.10/ChangeLog m4-1.4.11/ChangeLog --- m4-1.4.10/ChangeLog 2007-07-09 21:50:13.000000000 -0600 +++ m4-1.4.11/ChangeLog 2008-04-02 06:07:26.000000000 -0600 @@ -1,6 +1,359 @@ +2008-04-02 Eric Blake + + Release Version 1.4.11. + * NEWS: Mention the release. + + Prepare for release. + * maint.mk (alpha): Check for PREV_VERSION setting sooner, and + remove tag operation. + (version-check): Enhance this check. + (prev-tarball): Depend on version-check. + (this-vc-tag): Delete, and mention need to run tag... + * HACKING: ...here, prior to make maintainer-distcheck. + Update the instructions to match this particular release process. + * Makefile.am (.version, announcement): Allow for VPATH build. + * cfg.mk (gnulib_dir): Likewise. + * doc/Makefile.am ($(srcdir)/m4.1): Include release number in man + page. + +2008-04-01 Eric Blake + + Speed up index builtin. + * m4/gnulib-cache: Import strstr module. + * NEWS: Mention the speedup. + +2008-03-29 Eric Blake + + Fix testsuite on mingw, OpenBSD. + * src/format.c (ARG_DOUBLE): Use strtod, not atof. + * src/Makefile.am (m4_LDADD): Use POW_LIB when needed. + * doc/m4.texinfo (Format): Add hex-float support. + * NEWS: Document this. + +2008-03-27 Eric Blake + + Pull other useful doc fixes from branch-1.6. + * doc/m4.texinfo (Arguments): Enable test of + --warn-macro-sequence. + (Defn): Test length of builtin token. + (Builtin, Ifelse, Changequote): Add more regression tests. + +2008-03-27 Eric Blake + + Add test for divert bug on 2007-05-28, patched 2007-07-21. + * doc/m4.texinfo (Diversions): Add test. + +2008-03-24 Eric Blake + + Pull GNUmakefile from gnulib. + * m4/gnulib-cache.m4: Import gnumakefile module. + * GNUmakefile: Remove from version control; supplied by gnulib + instead. + * configure.ac (AC_INIT): Track intra-release version with + git-version-gen. + (AC_CONFIG_LINKS): Let gnulib do this now. + * Makefile.am (distclean-local): Likewise. + (EXTRA_DIST): Likewise. Also handle renamed files. + * (.version, dist-hook): Improve version handling. + * Makefile.cfg: Rename... + * cfg.mk: ...to this. + * Makefile.maint: Rename... + * maint.mk: ...to this. + (ME, makefile-check, m4-check): Use new macro instead of + hard-coded name. + * HACKING: Mention that maintainer rules should now work in VPATH + builds. + +2008-03-15 Eric Blake + + Document join, in order to fix bug in m4wrap example. + * doc/m4.texinfo (Improved m4wrap): New node. + (Defn, Location): Enhance tests. + (Shift): Document the composite macro join. + (Incompatibilities): Move documentation of LIFO vs. FIFO... + (M4wrap): ...here, to match improved example. + +2008-03-10 Eric Blake + + Allow 'make installcheck' with './configure --program-prefix'. + * checks/Makefile.in (program_transform_name): New macro. + (installcheck): Use it to transform name of m4 before testing. + * checks/check-them (m4): Add -m option, to allow testing m4 by a + different name. + * checks/get-them: Allow xout and xerr notation. + +2008-02-25 Eric Blake + + Improve release process. + * configure.ac (AM_INIT_AUTOMAKE): Increase requirement, and add + dist-lzma. + * HACKING: Update for git release procedures. + * Makefile.cfg: New file. + * GNUmakefile: Use it. + * Makefile.maint (gzip_rsyncable, GZIP_ENV, GIT, VC, VC-tag) + (VERSION_REGEXP, this-vc-tag, my_distdir, null_AM_MAKEFLAGS) + (TMPDIR, gnulib-version): New macros, borrowed from coreutils. + (makefile-check, news-date-check, changelog-check, m4-check) + (vc-diff-check, maintainer-distcheck, vc-dist, my-distcheck) + (announcement, alpha, beta, major): New rules, borrowed from + coreutils. + (TEXI2HTML, cvs-release, update-timestamps, cvs-news, cvs-commit) + (cvs-dist): Delete. + * Makefile.am (EXTRA_DIST): Distribute new file. + +2008-02-19 Eric Blake + + Clean up foreach example. + * doc/m4.texinfo (Foreach, Improved foreach): Document another + shortcoming in foreach.m4. + +2008-02-16 Eric Blake + + Add regression test for multi-character quote recursion. + * examples/foreach2.m4: Use $0 rather than spelling out name. + * examples/foreachq2.m4: Likewise. + * examples/forloop2.m4: Likewise. + * examples/hanoi.m4: Likewise. + * examples/trace.m4: Likewise. + * doc/m4.texinfo (Improved forloop): Document advantage of $0. + (Improved foreach): Adjust dump from file. + +2008-02-13 Eric Blake + + Fix texinfo grammar. + * doc/m4.texinfo (Incompatibilities): Use @. after capital. + (History): Use @: after abbreviations. + (M4exit): Use correct Latin abbreviation. + +2008-02-11 Eric Blake + + Document behavior of __gnu__(). + * doc/m4.texinfo (Platform macros): Enhance test. + (Macro expansion): New test. + +2008-01-31 Ralf Wildenhues + + * checks/Makefile.in: Use @SET_MAKE@, and use @SHELL@ rather + than hard-coding /bin/sh. + * THANKS: Update. + Reported by Lawson Chan. + +2007-12-13 Paolo Bonzini (tiny change) + + * doc/m4.texinfo (Inhibiting Invocation): Fix quoting of a quoting + example. + * THANKS: Update. + Reported by Giovanni Toffetti. + +2007-12-07 Eric Blake + + Minor security fix: Quote output of mkstemp. + * src/builtin.c (mkstemp_helper): Produce quoted output. + * doc/m4.texinfo (Mkstemp): Update the documentation and tests. + * NEWS: Document this change. + +2007-12-04 Eric Blake + + Fix builds with OpenBSD make. + * doc/Makefile.am (HELP2MAN): New macro. + (man_MANS, m4.1): Fix rules for building m4.1 into srcdir. + * README: Update copyright. + * HACKING: Mention help2man and makeinfo dependencies. + +2007-11-22 Eric Blake + + Security fix: avoid arbitrary code execution with 'm4 -F'. + * src/freeze.c (produce_frozen_state): Never pass raw file name as + printf format. + * NEWS: Document this fix. + +2007-11-07 Eric Blake + + * doc/m4.texinfo (Pseudo Arguments): Test more corner cases. + +2007-11-05 Eric Blake + + Use build-aux directory. + * configure.ac (PACKAGE, VERSION): Delete, since Automake does + this now. + (AC_CONFIG_AUX_DIR): Add, with auxiliary files in build-aux + instead of the top level. + (AC_INIT_AUTOMAKE): Increase requirement, and add dist-lzma. + * Makefile.am (EXTRA_DIST): Gnulib now manages gendocs.sh. + * bootstrap: Adjust accordingly. + * m4/gnulib-cache.m4: Add --aux-dir option. + * doc/Makefile.am (m4.1): Rewrite rule to use build-aux/missing. + +2007-10-31 Eric Blake + + Test more corner cases. + * doc/m4.texinfo (Changecom, Pseudo Arguments): Beef up tests. + (Improved foreach): Document alternate foreachq style. + +2007-10-28 Eric Blake + + More test coverage for autoconf usage patterns. + * doc/m4.texinfo (Inhibiting Invocation, Pseudo Arguments) + (Builtin): Add new undocumented tests. + (Shift): Document cond macro, and add new test. + +2007-10-27 Eric Blake + + Document one use of changequote(`(',`)'). + * doc/m4.texinfo (Changequote): Add new test, based on recent + autoconf addition of m4_expand. + +2007-10-22 Eric Blake + + Never let printf failures go undetected. + * m4/gnulib-cache.m4: Import announce-gen, git-version-gen, + intprops, strtod, and xprintf modules. Remove deprecated free + module. Replace vasprintf-posix and xvasprintf with + xvasprintf-posix. + * src/m4.h: Include xprintf.h. + * src/builtin.c (ntoa): Export. + (m4_errprint): Adjust all *printf callers. + * src/debug.c (debug_message_prefix, trace_format): Likewise. + * src/freeze.c (produce_frozen_state): Likewise. + * src/input.c [DEBUG_INPUT]: Likewise. + * src/m4.c (usage): Likewise. + * src/m4.h (DEBUG_PRINT1, DEBUG_PRINT3, DEBUG_MESSAGE) + (DEBUG_MESSAGE1, DEBUG_MESSAGE2): Likewise. + * src/output.c (shipout_text, freeze_diversione): Likewise. + * src/path.c [DEBUG_INCL]: Likewise. + * src/stackovf.c (process_sigsegv) [DEBUG_STKOVF]: Likewise. + * src/symtab.c [DEBUG_SYM]: Likewise. + +2007-10-17 Eric Blake + + Fix 'm4 -F file -t undefined'. + * src/freeze.c (produce_frozen_state): Avoid core dump. + * doc/m4.texinfo (Using frozen files): Test for the bug. + * NEWS: Mention the fix. + +2007-10-09 Eric Blake + + Avoid regexp regression. + * doc/m4.texinfo (Regexp, Patsubst): Test \ expansion. + +2007-10-02 Eric Blake + + Add more examples and tests. + * doc/m4.texinfo (Patsubst): Use the examples directory. Also + document shortfall. + (Improved capitalize): New node. + (Index macro, Regexp): Test more code paths. + * examples/capitalize.m4: Update to match manual. + * examples/capitalize2.m4: New file. + * examples/foreachq3.m4: Likewise. + * examples/join.m4: Likewise. + * examples/loop.m4: Likewise. + * examples/wraplifo.m4: Likewise. + * examples/wraplifo2.m4: Likewise. + * examples/Makefile.am (EXTRA_DIST): Distribute new files. + +2007-09-24 Eric Blake + + Create .gitignore alongside .cvsignore. + * bootstrap (LC_ALL): Set up front. + (version control) Borrow idea from head, to avoid churn in + m4/.*ignore files modified by gnulib-tool. + +2007-09-13 Eric Blake + + * AUTHORS: Fix typo. + +2007-09-07 Eric Blake + + * AUTHORS: Simplify, to match libtool and autoconf layout. + * THANKS: Sync with head. + +2007-08-10 Eric Blake + + * doc/m4.texinfo (Compatibility): Sync with head. + +2007-08-10 Konrad Schwarz (tiny change) + and Eric Blake + + * doc/m4.texinfo (Defn): Update wording. + +2007-08-09 Eric Blake + + POSIX requires defn(`a',`b') to concatenate definitions. + * src/builtin.c (m4_defn): Allow multiple arguments, but warn if + trying to mix a builtin with anything else. + * doc/m4.texinfo (Defn): Document a use for this POSIX + requirement. + (Incompatibilities): Update to match current status. + * NEWS: Document this change. + * THANKS: Update. + Reported by Konrad Schwarz. + +2007-08-04 Eric Blake + + Normalize all GPL license notices. + * GNUmakefile: Update license wording. + * Makefile.am: Likewise. + * Makefile.maint: Likewise. + * bootstrap: Likewise. + * commit: Likewise. + * configure.ac: Likewise. + * checks/Makefile.in: Likewise. + * doc/Makefile.am: Likewise. + * examples/Makefile.am: Likewise. + * src/Makefile.am: Likewise. + * src/builtin.c: Likewise. + * src/debug.c: Likewise. + * src/eval.c: Likewise. + * src/format.c: Likewise. + * src/freeze.c: Likewise. + * src/input.c: Likewise. + * src/m4.c: Likewise. + * src/m4.h: Likewise. + * src/macro.c: Likewise. + * src/output.c: Likewise. + * src/path.c: Likewise. + * src/stackovf.c: Likewise. + * src/symtab.c: Likewise. + +2007-07-21 Eric Blake + + Fix regression on NetBSD from 2007-05-28. + * src/output.c (m4_tmpopen): Explicitly reset append-mode stream + position to byte 0. + * NEWS: Document this fix. + * THANKS: Update. + Reported by Thomas Klausner. + +2007-07-20 Eric Blake + + Fix 'make distcheck' issues. + * Makefile.am (EXTRA_DIST): No need to distribute + gpl-3.0.texi.diff anymore. + * m4/gnulib-cache.m4: Update to latest gnulib. + +2007-07-14 Eric Blake + + Reflect upstream license .texi changes. + * doc/m4.texinfo (Copying): Rename node... + (GNU General Public License): ...to this. + (GNU Free Documentation License): Adjust node location. + * local/doc/gpl-3.0.texi.diff: Remove file. + +2007-07-10 Eric Blake + + Start 1.4.10a. + * configure.ac (AC_INIT): Bump version number. + * NEWS: Start changes since 1.4.10. + * doc/m4.texinfo (History): Mention 1.4.11. + (Copying This Package, Copying This Manual): Add index entries. + * local/lib/version-etc.c.diff: Delete, now that gnulib has been + updated. + * Makefile.am (EXTRA_DIST): Remove dead file. + 2007-07-09 Eric Blake - Release 1.4.10: + Release Version 1.4.10. * doc/Makefile.am (m4_TEXINFOS): Distribute gpl-3.0.texi. * Makefile.am (EXTRA_DIST): Distribute gnulib diffs. * configure.ac (AC_INIT): Bump version number. @@ -78,7 +431,7 @@ * configure.ac (AC_INIT): Bump version number. * NEWS: Start changes since 1.4.9b, and fix typo. - Beta Release 1.4.9b: + Beta Release Version 1.4.9b. * configure.ac (AC_INIT): Bump version number. * NEWS: Describe changes since 1.4.9. @@ -3772,14 +4125,12 @@ Mon Jan 22 21:08:52 1990 Rene' Seindal ----- - $Revision: 1.1.1.1.2.278 $ $Date: 2007/07/10 03:50:13 $ - Local Variables: coding: utf-8 End: Copyright (C) 1990, 1991, 1992, 1993, 1994, 2000, 2001, 2003, - 2005, 2006, 2007 Free Software Foundation, Inc. + 2005, 2006, 2007, 2008 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted provided the copyright notice diff -ruNp m4-1.4.10/GNUmakefile m4-1.4.11/GNUmakefile --- m4-1.4.10/GNUmakefile 2007-07-04 21:56:02.000000000 -0600 +++ m4-1.4.11/GNUmakefile 2008-03-27 21:28:57.000000000 -0600 @@ -1,24 +1,24 @@ -# Having a separate GNUmakefile lets me `include' both Makefile.maint -# and Makefile. +# Having a separate GNUmakefile lets me `include' the dynamically +# generated rules created via cfg.mk (package-local configuration) +# as well as maint.mk (generic maintainer rules). # This makefile is used only if you run GNU Make. # It is necessary if you want to build targets usually of interest # only to the maintainer. -# Copyright (C) 2001, 2003, 2006, 2007 Free Software Foundation, Inc. -# -# This program is free software; you can redistribute it and/or modify +# Copyright (C) 2001, 2003, 2006-2008 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 +# 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, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # Systems where /bin/sh is not the default shell need this. The $(shell) # command below won't work with e.g. stock DOS/Windows shells. @@ -30,21 +30,50 @@ else SHELL = sh endif -have-Makefile := $(shell test -f Makefile && echo yes) - # If the user runs GNU make but has not yet run ./configure, # give them a diagnostic. -ifeq ($(have-Makefile),yes) +_have-Makefile := $(shell test -f Makefile && echo yes) +ifeq ($(_have-Makefile),yes) # Make tar archive easier to reproduce. export TAR_OPTIONS = --owner=0 --group=0 --numeric-owner include Makefile -include $(srcdir)/Makefile.maint + +# Some projects override e.g., _autoreconf here. +-include $(srcdir)/cfg.mk +include $(srcdir)/maint.mk + +# Allow cfg.mk to override these. +_build-aux ?= build-aux +_autoreconf ?= autoreconf + +# Ensure that $(VERSION) is up to date for dist-related targets, but not +# for others: rerunning autoreconf and recompiling everything isn't cheap. +_have-git-version-gen := \ + $(shell test -f $(srcdir)/$(_build-aux)/git-version-gen && echo yes) +ifeq ($(_have-git-version-gen)0,yes$(MAKELEVEL)) + _is-dist-target = $(filter-out %clean, \ + $(filter dist% alpha beta major,$(MAKECMDGOALS))) + ifneq (,$(_is-dist-target)) + _curr-ver := $(shell cd $(srcdir) && ./$(_build-aux)/git-version-gen \ + $(srcdir)/.tarball-version) + ifneq ($(_curr-ver),$(VERSION)) + $(info INFO: running autoreconf for new version string: $(_curr-ver)) + _dummy := $(shell cd $(srcdir) && rm -rf autom4te.cache && $(_autoreconf))) + endif + endif +endif else -all: +.DEFAULT_GOAL := abort-due-to-no-makefile + +# The package can override .DEFAULT_GOAL to run actions like autoreconf. +-include ./cfg.mk +include ./maint.mk + +abort-due-to-no-makefile: @echo There seems to be no Makefile in this directory. 1>&2 @echo "You must run ./configure before running \`make'." 1>&2 @exit 1 diff -ruNp m4-1.4.10/INSTALL m4-1.4.11/INSTALL --- m4-1.4.10/INSTALL 2007-07-09 21:15:34.000000000 -0600 +++ m4-1.4.11/INSTALL 2008-04-02 06:45:31.000000000 -0600 @@ -67,6 +67,9 @@ The simplest way to compile this package all sorts of other programs in order to regenerate files that came with the distribution. + 6. Often, you can also type `make uninstall' to remove the installed + files again. + Compilers and Options ===================== diff -ruNp m4-1.4.10/Makefile.am m4-1.4.11/Makefile.am --- m4-1.4.10/Makefile.am 2007-07-09 21:29:49.000000000 -0600 +++ m4-1.4.11/Makefile.am 2008-04-01 21:48:32.000000000 -0600 @@ -1,29 +1,28 @@ -## This file is part of GNU M4. +## Makefile.am - template for generating Makefile via Automake +## +## Copyright (C) 2000, 2001, 2003, 2004, 2005, 2006, 2007, 2008 Free +## Software Foundation, Inc. ## -## Copyright (C) 2000, 2001, 2003, 2004, 2005, 2006, 2007 Free Software -## Foundation, Inc. +## This file is part of GNU M4. ## -## This program is free software; you can redistribute it and/or modify +## GNU M4 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 +## 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, +## GNU M4 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; see the file COPYING. If not, write to -## the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -## Boston, MA 02110-1301, USA. +## along with this program. If not, see . ## ## Written by Gary V. Vaughan SUBDIRS = . examples lib src doc tests checks -EXTRA_DIST = bootstrap c-boxes.el gendocs.sh GNUmakefile Makefile.maint \ - m4/gnulib-cache.m4 local/doc/gpl-3.0.texi.diff \ - local/lib/version-etc.c.diff +EXTRA_DIST = bootstrap c-boxes.el cfg.mk maint.mk \ + .version m4/gnulib-cache.m4 DISTCLEANFILES = stamp-h ## maintainer-clean should remove as much as possible that ./bootstrap can ## recreate. In the m4 directory, keep only gnulib-cache.m4. @@ -34,3 +33,12 @@ MAINTAINERCLEANFILES = COPYING INSTALL M ACLOCAL_AMFLAGS = -I m4 DISTCHECK_CONFIGURE_FLAGS = --enable-changeword + +BUILT_SOURCES = $(top_srcdir)/.version +$(top_srcdir)/.version: + echo $(VERSION) > $@-t && mv $@-t $@ + +# Arrange so that .tarball-version appears only in the distribution +# tarball, and never in a checked-out repository. +dist-hook: + echo $(VERSION) > $(distdir)/.tarball-version diff -ruNp m4-1.4.10/Makefile.in m4-1.4.11/Makefile.in --- m4-1.4.10/Makefile.in 2007-07-09 21:30:00.000000000 -0600 +++ m4-1.4.11/Makefile.in 2008-04-02 06:45:30.000000000 -0600 @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.10 from Makefile.am. +# Makefile.in generated by automake 1.10.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -35,8 +35,10 @@ subdir = . DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(top_srcdir)/checks/Makefile.in \ $(top_srcdir)/configure AUTHORS BACKLOG COPYING ChangeLog \ - INSTALL NEWS THANKS TODO config.guess config.sub depcomp \ - install-sh missing + INSTALL NEWS THANKS TODO build-aux/config.guess \ + build-aux/config.sub build-aux/depcomp build-aux/install-sh \ + build-aux/mdate-sh build-aux/missing build-aux/texinfo.tex \ + config.guess config.sub depcomp install-sh missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/alloca.m4 \ $(top_srcdir)/m4/assert.m4 $(top_srcdir)/m4/cloexec.m4 \ @@ -48,22 +50,23 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/a $(top_srcdir)/m4/fatal-signal.m4 $(top_srcdir)/m4/fflush.m4 \ $(top_srcdir)/m4/float_h.m4 $(top_srcdir)/m4/fpending.m4 \ $(top_srcdir)/m4/fpieee.m4 $(top_srcdir)/m4/fpurge.m4 \ - $(top_srcdir)/m4/freading.m4 $(top_srcdir)/m4/free.m4 \ - $(top_srcdir)/m4/frexp.m4 $(top_srcdir)/m4/frexpl.m4 \ - $(top_srcdir)/m4/fseeko.m4 $(top_srcdir)/m4/ftello.m4 \ - $(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gettimeofday.m4 \ - $(top_srcdir)/m4/gl_list.m4 $(top_srcdir)/m4/glibc21.m4 \ - $(top_srcdir)/m4/gnulib-common.m4 \ + $(top_srcdir)/m4/freading.m4 $(top_srcdir)/m4/frexp.m4 \ + $(top_srcdir)/m4/frexpl.m4 $(top_srcdir)/m4/fseeko.m4 \ + $(top_srcdir)/m4/ftello.m4 $(top_srcdir)/m4/getopt.m4 \ + $(top_srcdir)/m4/gettimeofday.m4 $(top_srcdir)/m4/gl_list.m4 \ + $(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/gnulib-common.m4 \ $(top_srcdir)/m4/gnulib-comp.m4 \ $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/inline.m4 \ $(top_srcdir)/m4/intmax_t.m4 $(top_srcdir)/m4/inttypes_h.m4 \ - $(top_srcdir)/m4/isnan.m4 $(top_srcdir)/m4/isnanf.m4 \ + $(top_srcdir)/m4/isnand.m4 $(top_srcdir)/m4/isnanf.m4 \ $(top_srcdir)/m4/isnanl.m4 $(top_srcdir)/m4/ldexpl.m4 \ $(top_srcdir)/m4/localcharset.m4 $(top_srcdir)/m4/longlong.m4 \ - $(top_srcdir)/m4/lseek.m4 $(top_srcdir)/m4/malloca.m4 \ - $(top_srcdir)/m4/math_h.m4 $(top_srcdir)/m4/mbrtowc.m4 \ - $(top_srcdir)/m4/mbstate_t.m4 $(top_srcdir)/m4/mkdtemp.m4 \ - $(top_srcdir)/m4/mkstemp.m4 $(top_srcdir)/m4/pathmax.m4 \ + $(top_srcdir)/m4/lseek.m4 $(top_srcdir)/m4/malloc.m4 \ + $(top_srcdir)/m4/malloca.m4 $(top_srcdir)/m4/math_h.m4 \ + $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbstate_t.m4 \ + $(top_srcdir)/m4/memchr.m4 $(top_srcdir)/m4/memcmp.m4 \ + $(top_srcdir)/m4/mkdtemp.m4 $(top_srcdir)/m4/mkstemp.m4 \ + $(top_srcdir)/m4/nocrash.m4 $(top_srcdir)/m4/pathmax.m4 \ $(top_srcdir)/m4/printf-frexp.m4 \ $(top_srcdir)/m4/printf-frexpl.m4 $(top_srcdir)/m4/printf.m4 \ $(top_srcdir)/m4/quotearg.m4 $(top_srcdir)/m4/regex.m4 \ @@ -74,11 +77,13 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/a $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdint_h.m4 \ $(top_srcdir)/m4/stdio-safer.m4 $(top_srcdir)/m4/stdio_h.m4 \ $(top_srcdir)/m4/stdlib-safer.m4 $(top_srcdir)/m4/stdlib_h.m4 \ + $(top_srcdir)/m4/strerror.m4 $(top_srcdir)/m4/string_h.m4 \ + $(top_srcdir)/m4/strstr.m4 $(top_srcdir)/m4/strtod.m4 \ $(top_srcdir)/m4/strtol.m4 $(top_srcdir)/m4/sys_stat_h.m4 \ $(top_srcdir)/m4/sys_time_h.m4 $(top_srcdir)/m4/tempname.m4 \ - $(top_srcdir)/m4/tmpdir.m4 $(top_srcdir)/m4/ulonglong.m4 \ - $(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/unistd_h.m4 \ - $(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/vasnprintf.m4 \ + $(top_srcdir)/m4/tmpdir.m4 $(top_srcdir)/m4/unistd-safer.m4 \ + $(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/unlocked-io.m4 \ + $(top_srcdir)/m4/vasnprintf.m4 \ $(top_srcdir)/m4/vasprintf-posix.m4 \ $(top_srcdir)/m4/vasprintf.m4 $(top_srcdir)/m4/wchar.m4 \ $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wctype.m4 \ @@ -113,7 +118,8 @@ am__remove_distdir = \ { test ! -d $(distdir) \ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr $(distdir); }; } -DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2 +DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2 \ + $(distdir).tar.lzma GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print @@ -147,11 +153,19 @@ EXEEXT = @EXEEXT@ FLOAT_H = @FLOAT_H@ GETOPT_H = @GETOPT_H@ GLIBC21 = @GLIBC21@ +GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@ +GNULIB_CEILF = @GNULIB_CEILF@ +GNULIB_CEILL = @GNULIB_CEILL@ GNULIB_CHOWN = @GNULIB_CHOWN@ GNULIB_DUP2 = @GNULIB_DUP2@ +GNULIB_ENVIRON = @GNULIB_ENVIRON@ GNULIB_FCHDIR = @GNULIB_FCHDIR@ GNULIB_FFLUSH = @GNULIB_FFLUSH@ +GNULIB_FLOORF = @GNULIB_FLOORF@ +GNULIB_FLOORL = @GNULIB_FLOORL@ +GNULIB_FOPEN = @GNULIB_FOPEN@ GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@ +GNULIB_FREOPEN = @GNULIB_FREOPEN@ GNULIB_FREXP = @GNULIB_FREXP@ GNULIB_FREXPL = @GNULIB_FREXPL@ GNULIB_FSEEK = @GNULIB_FSEEK@ @@ -160,21 +174,67 @@ GNULIB_FTELL = @GNULIB_FTELL@ GNULIB_FTELLO = @GNULIB_FTELLO@ GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@ GNULIB_GETCWD = @GNULIB_GETCWD@ +GNULIB_GETDELIM = @GNULIB_GETDELIM@ +GNULIB_GETLINE = @GNULIB_GETLINE@ GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@ +GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@ GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@ +GNULIB_ISFINITE = @GNULIB_ISFINITE@ GNULIB_LCHOWN = @GNULIB_LCHOWN@ GNULIB_LDEXPL = @GNULIB_LDEXPL@ GNULIB_LSEEK = @GNULIB_LSEEK@ +GNULIB_MALLOC_POSIX = @GNULIB_MALLOC_POSIX@ GNULIB_MATHL = @GNULIB_MATHL@ +GNULIB_MBSCASECMP = @GNULIB_MBSCASECMP@ +GNULIB_MBSCASESTR = @GNULIB_MBSCASESTR@ +GNULIB_MBSCHR = @GNULIB_MBSCHR@ +GNULIB_MBSCSPN = @GNULIB_MBSCSPN@ +GNULIB_MBSLEN = @GNULIB_MBSLEN@ +GNULIB_MBSNCASECMP = @GNULIB_MBSNCASECMP@ +GNULIB_MBSNLEN = @GNULIB_MBSNLEN@ +GNULIB_MBSPBRK = @GNULIB_MBSPBRK@ +GNULIB_MBSPCASECMP = @GNULIB_MBSPCASECMP@ +GNULIB_MBSRCHR = @GNULIB_MBSRCHR@ +GNULIB_MBSSEP = @GNULIB_MBSSEP@ +GNULIB_MBSSPN = @GNULIB_MBSSPN@ +GNULIB_MBSSTR = @GNULIB_MBSSTR@ +GNULIB_MBSTOK_R = @GNULIB_MBSTOK_R@ +GNULIB_MEMMEM = @GNULIB_MEMMEM@ +GNULIB_MEMPCPY = @GNULIB_MEMPCPY@ +GNULIB_MEMRCHR = @GNULIB_MEMRCHR@ GNULIB_MKDTEMP = @GNULIB_MKDTEMP@ GNULIB_MKSTEMP = @GNULIB_MKSTEMP@ GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@ +GNULIB_PUTENV = @GNULIB_PUTENV@ GNULIB_READLINK = @GNULIB_READLINK@ +GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@ +GNULIB_ROUND = @GNULIB_ROUND@ +GNULIB_ROUNDF = @GNULIB_ROUNDF@ +GNULIB_ROUNDL = @GNULIB_ROUNDL@ +GNULIB_SETENV = @GNULIB_SETENV@ GNULIB_SIGNBIT = @GNULIB_SIGNBIT@ GNULIB_SIGPROCMASK = @GNULIB_SIGPROCMASK@ GNULIB_SLEEP = @GNULIB_SLEEP@ GNULIB_SNPRINTF = @GNULIB_SNPRINTF@ GNULIB_SPRINTF_POSIX = @GNULIB_SPRINTF_POSIX@ +GNULIB_STPCPY = @GNULIB_STPCPY@ +GNULIB_STPNCPY = @GNULIB_STPNCPY@ +GNULIB_STRCASESTR = @GNULIB_STRCASESTR@ +GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@ +GNULIB_STRDUP = @GNULIB_STRDUP@ +GNULIB_STRERROR = @GNULIB_STRERROR@ +GNULIB_STRNDUP = @GNULIB_STRNDUP@ +GNULIB_STRNLEN = @GNULIB_STRNLEN@ +GNULIB_STRPBRK = @GNULIB_STRPBRK@ +GNULIB_STRSEP = @GNULIB_STRSEP@ +GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@ +GNULIB_STRSTR = @GNULIB_STRSTR@ +GNULIB_STRTOD = @GNULIB_STRTOD@ +GNULIB_STRTOK_R = @GNULIB_STRTOK_R@ +GNULIB_TRUNC = @GNULIB_TRUNC@ +GNULIB_TRUNCF = @GNULIB_TRUNCF@ +GNULIB_TRUNCL = @GNULIB_TRUNCL@ +GNULIB_UNSETENV = @GNULIB_UNSETENV@ GNULIB_VASPRINTF = @GNULIB_VASPRINTF@ GNULIB_VFPRINTF_POSIX = @GNULIB_VFPRINTF_POSIX@ GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@ @@ -182,49 +242,78 @@ GNULIB_VSNPRINTF = @GNULIB_VSNPRINTF@ GNULIB_VSPRINTF_POSIX = @GNULIB_VSPRINTF_POSIX@ GNULIB_WCWIDTH = @GNULIB_WCWIDTH@ GREP = @GREP@ +HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@ HAVE_DECL_ACOSL = @HAVE_DECL_ACOSL@ HAVE_DECL_ASINL = @HAVE_DECL_ASINL@ HAVE_DECL_ATANL = @HAVE_DECL_ATANL@ -HAVE_DECL_CEILL = @HAVE_DECL_CEILL@ HAVE_DECL_COSL = @HAVE_DECL_COSL@ +HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@ HAVE_DECL_EXPL = @HAVE_DECL_EXPL@ -HAVE_DECL_FLOORL = @HAVE_DECL_FLOORL@ HAVE_DECL_FREXPL = @HAVE_DECL_FREXPL@ +HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@ +HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@ HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ HAVE_DECL_LDEXPL = @HAVE_DECL_LDEXPL@ HAVE_DECL_LOGL = @HAVE_DECL_LOGL@ +HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@ +HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@ HAVE_DECL_MKDIR = @HAVE_DECL_MKDIR@ HAVE_DECL_SINL = @HAVE_DECL_SINL@ HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@ HAVE_DECL_SQRTL = @HAVE_DECL_SQRTL@ +HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@ +HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@ +HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@ +HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@ +HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@ +HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@ HAVE_DECL_TANL = @HAVE_DECL_TANL@ +HAVE_DECL_TRUNC = @HAVE_DECL_TRUNC@ +HAVE_DECL_TRUNCF = @HAVE_DECL_TRUNCF@ +HAVE_DECL_TRUNCL = @HAVE_DECL_TRUNCL@ HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@ HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@ HAVE_DUP2 = @HAVE_DUP2@ HAVE_FSEEKO = @HAVE_FSEEKO@ HAVE_FTELLO = @HAVE_FTELLO@ HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ +HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@ HAVE_GETSUBOPT = @HAVE_GETSUBOPT@ HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ HAVE_IO_H = @HAVE_IO_H@ HAVE_ISWCNTRL = @HAVE_ISWCNTRL@ HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ HAVE_LSTAT = @HAVE_LSTAT@ +HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@ +HAVE_MEMPCPY = @HAVE_MEMPCPY@ HAVE_MKDTEMP = @HAVE_MKDTEMP@ +HAVE_OS_H = @HAVE_OS_H@ HAVE_POSIX_SIGNALBLOCKING = @HAVE_POSIX_SIGNALBLOCKING@ HAVE_READLINK = @HAVE_READLINK@ +HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@ +HAVE_SETENV = @HAVE_SETENV@ HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@ HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@ HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@ HAVE_SIGSET_T = @HAVE_SIGSET_T@ HAVE_SLEEP = @HAVE_SLEEP@ HAVE_STDINT_H = @HAVE_STDINT_H@ +HAVE_STPCPY = @HAVE_STPCPY@ +HAVE_STPNCPY = @HAVE_STPNCPY@ +HAVE_STRCASESTR = @HAVE_STRCASESTR@ +HAVE_STRCHRNUL = @HAVE_STRCHRNUL@ +HAVE_STRNDUP = @HAVE_STRNDUP@ +HAVE_STRPBRK = @HAVE_STRPBRK@ +HAVE_STRSEP = @HAVE_STRSEP@ +HAVE_STRTOD = @HAVE_STRTOD@ HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@ HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@ HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@ +HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ HAVE_UNISTD_H = @HAVE_UNISTD_H@ +HAVE_UNSETENV = @HAVE_UNSETENV@ HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@ HAVE_VASPRINTF = @HAVE_VASPRINTF@ HAVE_WCHAR_H = @HAVE_WCHAR_H@ @@ -243,18 +332,24 @@ LIBM4_LIBDEPS = @LIBM4_LIBDEPS@ LIBM4_LTLIBDEPS = @LIBM4_LTLIBDEPS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ +LIBTESTS_LIBDEPS = @LIBTESTS_LIBDEPS@ +LOCALCHARSET_TESTS_ENVIRONMENT = @LOCALCHARSET_TESTS_ENVIRONMENT@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ M4_LIBOBJS = @M4_LIBOBJS@ M4_LTLIBOBJS = @M4_LTLIBOBJS@ +M4tests_LIBOBJS = @M4tests_LIBOBJS@ +M4tests_LTLIBOBJS = @M4tests_LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ NEXT_FLOAT_H = @NEXT_FLOAT_H@ NEXT_MATH_H = @NEXT_MATH_H@ NEXT_SIGNAL_H = @NEXT_SIGNAL_H@ +NEXT_STDARG_H = @NEXT_STDARG_H@ NEXT_STDINT_H = @NEXT_STDINT_H@ NEXT_STDIO_H = @NEXT_STDIO_H@ NEXT_STDLIB_H = @NEXT_STDLIB_H@ +NEXT_STRING_H = @NEXT_STRING_H@ NEXT_SYS_STAT_H = @NEXT_SYS_STAT_H@ NEXT_SYS_TIME_H = @NEXT_SYS_TIME_H@ NEXT_UNISTD_H = @NEXT_UNISTD_H@ @@ -268,12 +363,19 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +POW_LIB = @POW_LIB@ PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@ RANLIB = @RANLIB@ +REPLACE_CEILF = @REPLACE_CEILF@ +REPLACE_CEILL = @REPLACE_CEILL@ REPLACE_CHOWN = @REPLACE_CHOWN@ REPLACE_FCHDIR = @REPLACE_FCHDIR@ REPLACE_FFLUSH = @REPLACE_FFLUSH@ +REPLACE_FLOORF = @REPLACE_FLOORF@ +REPLACE_FLOORL = @REPLACE_FLOORL@ +REPLACE_FOPEN = @REPLACE_FOPEN@ REPLACE_FPRINTF = @REPLACE_FPRINTF@ +REPLACE_FREOPEN = @REPLACE_FREOPEN@ REPLACE_FREXP = @REPLACE_FREXP@ REPLACE_FREXPL = @REPLACE_FREXPL@ REPLACE_FSEEK = @REPLACE_FSEEK@ @@ -281,15 +383,29 @@ REPLACE_FSEEKO = @REPLACE_FSEEKO@ REPLACE_FTELL = @REPLACE_FTELL@ REPLACE_FTELLO = @REPLACE_FTELLO@ REPLACE_GETCWD = @REPLACE_GETCWD@ +REPLACE_GETLINE = @REPLACE_GETLINE@ +REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@ REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@ +REPLACE_ISFINITE = @REPLACE_ISFINITE@ REPLACE_LCHOWN = @REPLACE_LCHOWN@ REPLACE_LDEXPL = @REPLACE_LDEXPL@ REPLACE_LSEEK = @REPLACE_LSEEK@ +REPLACE_MEMMEM = @REPLACE_MEMMEM@ REPLACE_MKSTEMP = @REPLACE_MKSTEMP@ REPLACE_PRINTF = @REPLACE_PRINTF@ +REPLACE_PUTENV = @REPLACE_PUTENV@ +REPLACE_ROUND = @REPLACE_ROUND@ +REPLACE_ROUNDF = @REPLACE_ROUNDF@ +REPLACE_ROUNDL = @REPLACE_ROUNDL@ REPLACE_SIGNBIT = @REPLACE_SIGNBIT@ +REPLACE_SIGNBIT_USING_GCC = @REPLACE_SIGNBIT_USING_GCC@ REPLACE_SNPRINTF = @REPLACE_SNPRINTF@ REPLACE_SPRINTF = @REPLACE_SPRINTF@ +REPLACE_STRCASESTR = @REPLACE_STRCASESTR@ +REPLACE_STRERROR = @REPLACE_STRERROR@ +REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@ +REPLACE_STRSTR = @REPLACE_STRSTR@ +REPLACE_STRTOD = @REPLACE_STRTOD@ REPLACE_VASPRINTF = @REPLACE_VASPRINTF@ REPLACE_VFPRINTF = @REPLACE_VFPRINTF@ REPLACE_VPRINTF = @REPLACE_VPRINTF@ @@ -300,12 +416,14 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@ SIZE_T_SUFFIX = @SIZE_T_SUFFIX@ +STDARG_H = @STDARG_H@ STDBOOL_H = @STDBOOL_H@ STDINT_H = @STDINT_H@ STRIP = @STRIP@ SYS_STAT_H = @SYS_STAT_H@ SYS_TIME_H = @SYS_TIME_H@ VERSION = @VERSION@ +VOID_UNSETENV = @VOID_UNSETENV@ WCHAR_H = @WCHAR_H@ WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ WCTYPE_H = @WCTYPE_H@ @@ -360,9 +478,8 @@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = . examples lib src doc tests checks -EXTRA_DIST = bootstrap c-boxes.el gendocs.sh GNUmakefile Makefile.maint \ - m4/gnulib-cache.m4 local/doc/gpl-3.0.texi.diff \ - local/lib/version-etc.c.diff +EXTRA_DIST = bootstrap c-boxes.el cfg.mk maint.mk \ + .version m4/gnulib-cache.m4 DISTCLEANFILES = stamp-h MAINTAINERCLEANFILES = COPYING INSTALL Makefile.in aclocal.m4 \ @@ -372,7 +489,9 @@ MAINTAINERCLEANFILES = COPYING INSTALL M ACLOCAL_AMFLAGS = -I m4 DISTCHECK_CONFIGURE_FLAGS = --enable-changeword -all: all-recursive +BUILT_SOURCES = $(top_srcdir)/.version +all: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: am--refresh: @@ -486,8 +605,8 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS @@ -512,8 +631,8 @@ TAGS: tags-recursive $(HEADERS) $(SOURCE unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ @@ -523,13 +642,12 @@ ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ - here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique @@ -587,6 +705,9 @@ distdir: $(DISTFILES) || exit 1; \ fi; \ done + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" distdir="$(distdir)" \ + dist-hook -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ @@ -598,6 +719,9 @@ dist-gzip: distdir dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) +dist-lzma: distdir + tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma + $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z @@ -615,6 +739,7 @@ dist-zip: distdir dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then @@ -626,6 +751,8 @@ distcheck: dist GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.lzma*) \ + unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ @@ -685,11 +812,13 @@ distcleancheck: distclean $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am -check: check-recursive +check: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: -install: install-recursive +install: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive @@ -714,6 +843,7 @@ distclean-generic: maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-recursive @@ -778,18 +908,25 @@ uninstall-am: .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am am--refresh check check-am clean clean-generic \ ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \ - dist-shar dist-tarZ dist-zip distcheck distclean \ - distclean-generic distclean-tags distcleancheck distdir \ - distuninstallcheck dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - installdirs-am maintainer-clean maintainer-clean-generic \ - mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ - tags-recursive uninstall uninstall-am - + dist-hook dist-lzma dist-shar dist-tarZ dist-zip distcheck \ + distclean distclean-generic distclean-tags distcleancheck \ + distdir distuninstallcheck dvi dvi-am html html-am info \ + info-am install install-am install-data install-data-am \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-html install-html-am install-info install-info-am \ + install-man install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ + pdf-am ps ps-am tags tags-recursive uninstall uninstall-am + +$(top_srcdir)/.version: + echo $(VERSION) > $@-t && mv $@-t $@ + +# Arrange so that .tarball-version appears only in the distribution +# tarball, and never in a checked-out repository. +dist-hook: + echo $(VERSION) > $(distdir)/.tarball-version # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff -ruNp m4-1.4.10/Makefile.maint m4-1.4.11/Makefile.maint --- m4-1.4.10/Makefile.maint 2007-07-04 21:56:02.000000000 -0600 +++ m4-1.4.11/Makefile.maint 1969-12-31 17:00:00.000000000 -0700 @@ -1,146 +0,0 @@ -## Makefile.maint -- Makefile rules for m4 maintainers -*-Makefile-*- -## -## Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation -## -## 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; see the file COPYING. If not, write to -## the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -## Boston, MA 02110-1301, USA. - -TEXI2HTML = texi2html - -.PHONY: cvs-release -cvs-release: version-check prev-tarball cvs-news cvs-commit cvs-dist deltas web-manual - @tarname="$(PACKAGE)-$(VERSION).tar.gz"; \ - diffname="$(PACKAGE)-$(LASTRELEASE)-$(VERSION).diff.gz"; \ - xdeltaname="$(PACKAGE)-$(LASTRELEASE)-$(VERSION).xdelta"; \ - echo " *** Upload $$tarname, $$tarname.sig,";\ - echo " *** $$tarname.directive.asc, $$diffname,"; \ - echo " *** $$diffname.sig, $$diffname.directive.asc,"; \ - echo " *** $$xdeltaname, $$xdeltaname.sig and";\ - echo " *** $$xdeltaname.directive.asc to either" - echo " *** /incoming/alpha or /incoming/ftp on ftp-upload.gnu.org." - -.PHONY: version-check -version-check: - @case $(VERSION) in \ - *[acegikmoqsuwy]) \ - echo "Version \`$(VERSION)' is not a releasable version, please read:"; \ - echo " http://www.gnu.org/software/libtool/contribute.html"; \ - exit 1; \ - ;; \ - esac - -.PHONY: prev-tarball -prev-tarball: -## Make sure we have the previous release tarball in the tree. - @if test -z "$(LASTRELEASE)"; \ - then echo "LASTRELEASE is not set"; exit 1; fi - @ofile="$(PACKAGE)-$(LASTRELEASE).tar.gz"; \ - if test -f $$ofile; then :; \ - else echo "Cannot make deltas without $$ofile"; exit 1; fi - -# TSDEPS will be defined to TSDEPS_DIST at `make dist' time -TSDEPS = -TSDEPS_DIST = ChangeLog -CVS = cvs # set it to `:' to avoid CVS operations - -.PHONY: timestamps update-timestamps -timestamps: update-timestamps -update-timestamps: - @if (cd $(srcdir) && test -d CVS && \ - $(CVS) -n update $(TSDEPS_DIST) | grep '^M'); then \ - echo "Cannot make cvs-dist before commit"; exit 1; else :; fi - - -.PHONY: cvs-news -cvs-news: -## Make sure the NEWS file is up-to-date: - @if sed '1,4d;5q' $(srcdir)/NEWS | grep -e "$(VERSION)" >/dev/null; \ - then :; \ - else \ - echo "NEWS not updated; not releasing" 1>&2; \ - exit 1; \ - fi - -.PHONY: cvs-commit -cvs-commit: cvs-news - cd $(srcdir) && $(SHELL) ./commit - -.PHONY: cvs-dist -cvs-dist: cvs-news timestamps -## Build the distribution: - $(MAKE) dist -## Finally, if everything was successful, tag the release - cd $(srcdir) \ - && $(CVS) -q tag `echo "release-$(VERSION)" | sed 's/\./_/g'` - -.PHONY: new-tarball -new-tarball: -## Make sure we have the new release tarball in the tree. - @ofile="$(PACKAGE)-$(VERSION).tar.gz"; \ - if test -f $$ofile; then :; \ - else echo "Cannot make deltas without $$ofile"; exit 1; fi - -.PHONY: got-xdelta -got-xdelta: -## Make sure xdelta exists; - @if ($(XDELTA) --version 2>&1 | grep version)>/dev/null 2>/dev/null; \ - then :;\ - else \ - echo "Get xdelta from http://sourceforge.net/projects/xdelta."; \ - exit 1; \ - fi - -.PHONY: deltas -deltas: delta-diff delta-xdelta - -DIFF = diff -DIFF_OPTIONS = -ruNp - -.PHONY: delta-diff -delta-diff: prev-tarball new-tarball -## Unpack the tarballs somewhere to diff them - rm -rf delta-diff - mkdir delta-diff - - ofile="../$(PACKAGE)-$(LASTRELEASE)-$(VERSION).diff.gz"; \ - cd delta-diff \ - && tar xzf "../$(PACKAGE)-$(LASTRELEASE).tar.gz" \ - && tar xzf "../$(PACKAGE)-$(VERSION).tar.gz" \ - && $(DIFF) $(DIFF_OPTIONS) \ - $(PACKAGE)-$(LASTRELEASE) $(PACKAGE)-$(VERSION) \ - | GZIP=$(GZIP_ENV) gzip -c > $$ofile - - rm -rf delta-diff - -XDELTA = xdelta -XDELTA_OPTIONS = -9 - -.PHONY: delta-xdelta -delta-xdelta: prev-tarball new-tarball got-xdelta -## Generate the delta file (xdelta has weird exit statuses, so we need to -## add some shell code to keep make happy), and then generate the signatures -## for FSF ftp-upload: - ofile="$(PACKAGE)-$(LASTRELEASE)-$(VERSION).xdelta"; \ - ( test -z `$(XDELTA) delta $(XDELTA_OPTIONS) \ - $(PACKAGE)-$(LASTRELEASE).tar.gz $(PACKAGE)-$(VERSION).tar.gz \ - $$ofile 2>&1` \ - && : ) - -.PHONY: web-manual -web-manual: - @cd ./doc ; \ - $(SHELL) ../gendocs.sh $(PACKAGE) \ - "GNU $(PACKAGE)- GNU macro processor" - @echo " *** Upload the doc/manual directory to web-cvs." diff -ruNp m4-1.4.10/NEWS m4-1.4.11/NEWS --- m4-1.4.10/NEWS 2007-07-09 21:09:07.000000000 -0600 +++ m4-1.4.11/NEWS 2008-04-02 06:07:33.000000000 -0600 @@ -1,288 +1,414 @@ GNU M4 NEWS - User visible changes. -Copyright (C) 1992, 1993, 1994, 2004, 2005, 2006, 2007 Free Software +Copyright (C) 1992, 1993, 1994, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. -Version 1.4.10 - 09 Jul 2007, by Eric Blake (CVS version 1.4.9c) +* Noteworthy changes in Version 1.4.11 (2008-04-02) [stable] + Released by Eric Blake, based on git version 1.4.10a -* Upgrade from GPL version 2 to GPL version 3 or later. -* A number of portability improvements inherited from gnulib. -* Avoid undefined behavior introduced in 1.4.9b in the `format' builtin - when handling %c. However, this area of code has never been documented, - and currently does not match the POSIX behavior of printf(1), so it may - have further changes in the next version. - -Version 1.4.9b - 29 May 2007, by Eric Blake (CVS version 1.4.9a) - -* Fix regression introduced in 1.4.9 in the `eval' builtin when performing - division. -* Fix regression introduced in 1.4.8 in the `-F' option that made it - impossible to freeze more than 512 kibibytes of diverted text. -* The synclines option `-s' no longer generates sync lines in the middle of - multiline comments or quoted strings. -* Work around a number of corner-case POSIX compliance bugs in various - broken stdio libraries. In particular, the `syscmd' builtin behaves - more predictably when stdin is seekable. -* The `format' builtin now understands formats such as %a, %A, and %'hhd, - and works around a number of platform printf bugs. Furthermore, the - sequence format(%*.*d,-1,-1,1) no longer outputs random data. However, - some non-compliant platforms such as mingw still have known bugs in - strtod that may cause testsuite failures. -* The testsuite is improved to also run gnulib portability tests for the - features that M4 imports from gnulib. - -Version 1.4.9 - 23 Mar 2007, by Eric Blake (CVS version 1.4.8c) - -* Minor documentation and portability cleanups. - -Version 1.4.8b - 24 Feb 2007, by Eric Blake (CVS version 1.4.8a) - -* Fix a regression introduced in 1.4.8 that made m4 unable to process - files larger than 2GiB on some platforms. -* Fix a regression introduced in 1.4.8 that made m4 dump core when - invoked as 'm4 -- file'. -* The `eval' builtin now follows C precedence rules. Additionally, the - short-circuit operators correctly short-circuit division by zero. The - previously undocumented alias of '=' meaning '==' in eval now triggers a - deprecation warning, so that a future version of M4 can implement a form - of variable assignment as an extension. -* The `include' builtin now affects exit status on failure, as required by - POSIX. Use `sinclude' if you need a successful exit status. -* The `-E'/`--fatal-warnings' command-line option now has two levels. When - specified only once, warnings affect exit status, but execution - continues, so that you can see all warnings instead of fixing them one - at a time. To acheive 1.4.8 behavior, where the first warning - immediately exits, specify -E twice on the command line. -* A new `--warn-macro-sequence' command-line option allows detection of - sequences in `define' and `pushdef' definitions that match an optional - regular expression. The default regular expression is - `\$\({[^}]*}\|[0-9][0-9]+\)', corresponding to the sequences that might - not behave correctly when upgrading to the eventual M4 2.0. By default, - M4 2.0 will follow the POSIX requirement that a macro definition - containing `$11' must expand to the first argument concatenated with 1, - rather than the eleventh argument; and will take advantage of the POSIX - wording that allows implementations to treat `${11}' as the eleventh - argument instead of literal text. Be aware that Autoconf 2.61 will not - work with this option enabled with the default regular expression; but - Autoconf 2.62 will be compatible with this option. -* Improved portability to platforms such as BSD/OS and AIX. - -Version 1.4.8 - 20 November 2006, by Eric Blake (CVS version 1.4.7a) - -* The `divert' macro and `-H'/`--hashsize' command line option no longer - cause a core dump when handed extra large values. Also, `divert' now - uses memory proportional to the number of diversions in use, rather than - to the maximum diversion number encountered, so that large diversion - numbers are less likely to exhaust system memory; and is no longer - limited by the maximum number of file descriptors. -* The `--help' and `--version' command line options now consistently - override all earlier options. For example, `m4 --debugfile=trace - --help' now no longer accidentally creates an empty file `trace'. -* The `-L'/`--nesting-limit' command line option can now be set to 0 - to remove the default limit of 1024. However, it is still possible that - heavily nested input can cause abrupt program termination due to stack - overflow. -* Problems encountered when writing to standard error, such as with the - `errprint' macro, now always cause a non-zero exit status. -* Warnings and errors issued during macro expansion are now consistently - reported at the line where the macro name was detected, rather than - where the close parenthesis resides. Text wrapped by `m4wrap' now - remembers the location that was in effect when m4wrap was invoked, - rather than changing to line 0 and the empty string for a file. The - macros `__line__' and `__file__' now work correctly even as the last - token in an included file. -* The `builtin' and `indir' macros now transparently handle builtin - tokens generated by `defn'. -* When diversions created by the `divert' macro collect enough text that - M4 must use temporary files, the environment variable $TMPDIR is now - consulted, and a better effort is made to clean up those files in the - event of a fatal signal. -* The `mkstemp' builtin is added with the same GNU semantics as `maketemp', - based on the recommendation of POSIX to deprecate the POSIX semantics of - `maketemp' as inherently insecure. In GNU mode (no -G supplied on the - command line), `maketemp' silently retains the secure GNU semantics, but - a future release of M4 will change this to emit a warning. In - traditional mode (m4 -G), `maketemp' now uses the POSIX-mandated insecure - semantics, and issues a warning that you should convert your script to - use `mkstemp' instead. Additionally, `mkstemp' and `maketemp' are now - well-defined even if the template argument does not end in six `X' - characters. -* The manual has been improved, including a new section on a composite - macro `foreach'. -* The `changecom' and `changequote' macros now treat an empty second - argument the same as if it were missing, rather than using the empty - string and making it impossible to end a comment or quote. -* The `translit' macro now operates in linear instead of quadratic time, - and is now eight-bit clean. -* The `-D', `-U', `-s', and `-t' command line options now take effect - after any files encountered earlier on the command line, rather than up - front, as is done in traditional implementations and required by POSIX. - -Version 1.4.7 - 25 September 2006, by Eric Blake (CVS version 1.4.6a) - -* Fix regression from 1.4.5 in handling a file that ends in a macro - expansion without arguments instead of a newline. -* The define and pushdef macros now warn when the first argument is not - a string, rather than silently doing nothing. -* Standard input can now be read more than once, as in 'm4 - file -', and - is not closed until all wrapped text is handled. This makes a - difference when stdin is not a regular file, and also fixes bugs when - using the syscmd or esyscmd macros from wrapped text. -* When standard input is a seekable file, the m4exit, syscmd, and esyscmd - macros now restore the current position to the next unread byte rather - than discarding an arbitrary amount of buffered data. -* SysV command-line compatibility is no longer a goal of GNU M4; the - focus will be instead on POSIX compatibility. This release continues to - support previous usage, but adds warnings in areas which will allow a - future version of GNU M4 to use its own extensions without being tied to - the SysV command line interface. -* The no-op compatibility command line options -B, -N, -S, -T, and - --diversions may be withdrawn or assigned new meanings in future - releases, so they now issue a warning if used. -* A new command line option -i replaces the compatibility -e as the - short spelling of --interactive, for consistency with other GNU tools; a - warning is issued if the old spelling is used, and it may be assigned new - meaning in future releases. -* A new command line option --debugfile replaces the options -o and - --error-output as the preferred spelling. The old options were - misleading in their names and inconsistent with other GNU tools; they are - still silently accepted, but no longer documented in --help, and may be - assigned new meanings in future releases. - -Version 1.4.6 - 25 August 2006, by Eric Blake (CVS version 1.4.5a) - -* Fix buffer overruns in regexp and patsubst macros when handed a trailing - backslash in the replacement text, or when handling \n substitutions - beyond the number of \(\) groups. -* Fix memory leak in regexp, patsubst, and changeword macros. -* The format macro now understands %F, %g, and %G. -* When loading frozen files, m4 now exits with status 63 if version - mismatch is detected. -* Fix bugs that occurred when invoked with stdout or stderr closed, - and detect write failures to stdout or to the target of the - debugfile macro. In particular, the syscmd and esyscmd macros can - no longer interfere with the debug stream or diversions. -* The m4exit macro now converts values outside the range 0-255 to 1. -* It is now an error if a command-line input file ends in the middle of a - comment, matching the behavior of mid-string and mid-argument - collection. -* The dnl macro now warns if end of file is encountered instead of a - newline. -* The error message when end of file is encountered now uses the file and - line where the dangling construct started, rather than `NONE:0:'. -* The debugmode and __file__ macros, and the -s/--synclines option, now - show what directory a file was found in when the -I/--include option or - M4PATH variable had an effect. -* The changequote and changecom macros now work with 8-bit characters, and - quotes and comments that begin with `(' are properly recognized - following a word. -* The new macro __program__ is added, which allows the input file to issue - an error message that resembles messages from m4. Warning and error - messages have been reformatted to comply with GNU Coding Standards. -* The errprint, m4wrap, and shift macros are now recognized only with - arguments. -* The index, substr, translit, regexp, and patsubst macros now produce - output when given only one argument, but still warn about a missing - second argument. -* The patsubst macro now reliably finds zero-length matches at the end - of a string. - -Version 1.4.5 - 15 July 2006, by Eric Blake (CVS version 1.4.4c) - -* Fix sysval on BeOS, OS/2, and other systems that store exit status - in the low-order byte. Additionally, on Unix platforms, if syscmd was - terminated by a signal, sysval now displays the signal number shifted - left by eight bits, to match traditional m4 implementations. -* The maketemp macro is no longer subject to platform limitations (such as - 26 or 32 max files from a given template). -* Frozen files now require that the first directive be V (version), to - better diagnose version mismatch. Additionally, if the F directive - (builtin function) names an unknown builtin that existed in the m4 that - froze the file but not in the current m4 (for example, changeword), the - warning is deferred until an attempt is made to actually use the - builtin. This allows downgrading from beta m4-1.4o to stable m4-1.4.5 - without breaking autoconf. -* The format and indir macros are now recognized only with arguments. -* The eval macro no longer crashes on x86 architectures when dividing the - minimum integer by -1. -* On systems with ecvt and fcvt, format no longer truncates trailing - zeroes on integers printed with %.0f. On systems without these - functions, format is no longer subject to a buffer overflow that - permitted arbitrary code execution. -* On native Windows builds, the macro __windows__ is provided instead of - __unix__. Likewise, on OS/2 builds, the macro __os2__ is provided. This - allows input files to determine when syscmd might behave differently. -* Fix bug in 1.4.3 patch to use \n line-endings that did not work for - cygwin. -* When given the empty string or 0, undivert is now documented as a no-op - rather than closing stdout, warning about a non-existent file, or trying - to read a directory as a file. -* Many documentation improvements. Also, the manual is now distributed - under FDL 1.2, rather than a stricter verbatim-only license. -* Raise the -L (--nesting-limit) command line option limit from 250 to - 1024. -* The decr, incr, divert, m4exit, and substr macros treat an empty number - as 0, issue a warning, and expand as normal; rather than issuing an error - and expanding to the empty string. -* The eval macro now treats an empty radix argument as 10, handles radix 1, - and treats the width argument as number of digits excluding the sign, - for compatibility with other m4 implementations. -* The ifdef, divert, m4exit, substr, and translit macros now correctly - ignore extra arguments. -* The popdef and undefine macros now correctly accept multiple arguments. -* Although changeword is on its last leg, if enabled, it now reverts to the - default (faster) regexp when passed the empty string. -* The regexp and substr macros now warn and ignore a trailing backslash in - the replacement, and warn on \n for n larger than the number of - sub-expressions in the regexp. - -Version 1.4.4b - 17 June 2006, by Eric Blake (CVS version 1.4.4a) - -* Fix a recursive push_string crashing bug, which affected changequote of - three or more characters on some compilers. -* Use automake to fix build portability issues. -* Fix a recursive m4wrap crashing bug. -* Fix a 1 in 2**32 hash crashing bug. -* Tracing a macro by name is now persistent, even if the macro is - subsequently undefined or redefined. The traceon and traceoff macros no - longer warn about undefined symbols. This solves a crash when using - indir on an undefined macro traced with the -t option, as well as an - incorrect result of ifdef. Furthermore, tracing is no longer transferred - with builtins, solving the bug of "m4 -tm4_eval" failing to give trace - output on the input "define(`m4_eval',defn(`eval'))m4_eval(1)". -* Fix a crash when a macro is undefined while collecting its arguments, by - always using the definition that was in effect before argument - collection. This behavior matches the C pre-processor, and means that - the sequence "define(`f',`1')f(define(`f',`2'))f" is now documented to - result in "12", rather than the previously undocumented "22". -* Update the regex engine to fix several bugs. -* Fix a potential crash on machines where char is signed. - -Version 1.4.4 - October 2005, by Gary V. Vaughan - -* ./configure --infodir=/usr/share/info now works correctly. -* When any file named on the command line is missing exit with status 1. - -Version 1.4.3 - March 2005, by Gary V. Vaughan - -* DESTDIR installs now work correctly. -* Don't segfault with uncompilable regexps to changeword(). -* Always use \n line-endings for frozen files (fixes a Windows bug). -* Portability fix for systems lacking mkstemp(3). -* Approximately 20% speed up in the common case of usage with autoconf. -* Supported on QNX 6.3. - -Version 1.4.2 - August 2004, by Paul Eggert - -* No user visible changes; portability bug fixes only. +** Security fixes for the -F option, for bugs present since -F was + introduced in 1.3: Avoid core dump with 'm4 -F file -t undefined', and + avoid arbitrary code execution with certain file names. -Version 1.4.1 - June 2004, by Paul Eggert +** Fix regression introduced in 1.4.9b in the `divert' builtin when more + than 512 kibibytes are saved in diversions on platforms like NetBSD + or darwin where fopen(name,"a+") seeks to the end of the file. -* maketemp now creates an empty file with the given name, instead of merely - returning the name of a nonexistent file. This closes a security hole. +** The output of the `maketemp' and `mkstemp' builtins is now quoted if a + file was created. This is a minor security fix, because it was possible + (although rather unlikely) that an unquoted string could match an + existing macro name, such that use of the `mkstemp' output would trigger + inadvertent macro expansion and operate on the wrong file name. -Version 1.4 - October 1994, by Franc,ois Pinard +** Enhance the `defn' builtin to support concatenation of multiple text + arguments, as required by POSIX. However, at this time, it is not + possible to concatenate a builtin macro with anything else; a warning is + now issued if this is attempted, although a future version of M4 may + lift this restriction to match other implementations. + +** Enhance the `format' builtin to parse all C99 floating point numbers, + even on platforms where strtod(3) is buggy, although the replacement + function does have the known issue of rounding errors when parsing + some decimal floating point values. This fixes testsuite failures + introduced in 1.4.9b. + +** Enhance the `index' builtin to guarantee linear behavior, in spite of + the surprisingly large number of systems with a brain-dead quadratic + strstr(3). + +** A number of portability improvements inherited from gnulib. + +* Noteworthy changes in Version 1.4.10 (2007-07-09) [stable] + Released by Eric Blake, based on CVS version 1.4.9c + +** Upgrade from GPL version 2 to GPL version 3 or later. + +** A number of portability improvements inherited from gnulib. + +** Avoid undefined behavior introduced in 1.4.9b in the `format' builtin + when handling %c. However, this area of code has never been documented, + and currently does not match the POSIX behavior of printf(1), so it may + have further changes in the next version. + +* Noteworthy changes in Version 1.4.9b (2007-05-29) [beta] + Released by Eric Blake, based on CVS version 1.4.9a + +** Fix regression introduced in 1.4.9 in the `eval' builtin when performing + division. + +** Fix regression introduced in 1.4.8 in the `-F' option that made it + impossible to freeze more than 512 kibibytes of diverted text. + +** The synclines option `-s' no longer generates sync lines in the middle of + multiline comments or quoted strings. + +** Work around a number of corner-case POSIX compliance bugs in various + broken stdio libraries. In particular, the `syscmd' builtin behaves + more predictably when stdin is seekable. + +** The `format' builtin now understands formats such as %a, %A, and %'hhd, + and works around a number of platform printf bugs. Furthermore, the + sequence format(%*.*d,-1,-1,1) no longer outputs random data. However, + some non-compliant platforms such as mingw still have known bugs in + strtod that may cause testsuite failures. + +** The testsuite is improved to also run gnulib portability tests for the + features that M4 imports from gnulib. + +* Noteworthy changes in Version 1.4.9 (2007-03-23) [stable] + Released by Eric Blake, based on CVS version 1.4.8c + +** Minor documentation and portability cleanups. + +* Noteworthy changes in Version 1.4.8b (2007-02-24) [beta] + Released by Eric Blake, based on CVS version 1.4.8a + +** Fix a regression introduced in 1.4.8 that made m4 unable to process + files larger than 2GiB on some platforms. + +** Fix a regression introduced in 1.4.8 that made m4 dump core when + invoked as 'm4 -- file'. + +** The `eval' builtin now follows C precedence rules. Additionally, the + short-circuit operators correctly short-circuit division by zero. The + previously undocumented alias of '=' meaning '==' in eval now triggers a + deprecation warning, so that a future version of M4 can implement a form + of variable assignment as an extension. + +** The `include' builtin now affects exit status on failure, as required by + POSIX. Use `sinclude' if you need a successful exit status. + +** The `-E'/`--fatal-warnings' command-line option now has two levels. When + specified only once, warnings affect exit status, but execution + continues, so that you can see all warnings instead of fixing them one + at a time. To achieve 1.4.8 behavior, where the first warning + immediately exits, specify -E twice on the command line. + +** A new `--warn-macro-sequence' command-line option allows detection of + sequences in `define' and `pushdef' definitions that match an optional + regular expression. The default regular expression is + `\$\({[^}]*}\|[0-9][0-9]+\)', corresponding to the sequences that might + not behave correctly when upgrading to the eventual M4 2.0. By default, + M4 2.0 will follow the POSIX requirement that a macro definition + containing `$11' must expand to the first argument concatenated with 1, + rather than the eleventh argument; and will take advantage of the POSIX + wording that allows implementations to treat `${11}' as the eleventh + argument instead of literal text. Be aware that Autoconf 2.61 will not + work with this option enabled with the default regular expression; but + Autoconf 2.62 will be compatible with this option. + +** Improved portability to platforms such as BSD/OS and AIX. + +* Noteworthy changes in Version 1.4.8 (2006-11-20) [stable] + Released by Eric Blake, based on CVS version 1.4.7a + +** The `divert' macro and `-H'/`--hashsize' command line option no longer + cause a core dump when handed extra large values. Also, `divert' now + uses memory proportional to the number of diversions in use, rather than + to the maximum diversion number encountered, so that large diversion + numbers are less likely to exhaust system memory; and is no longer + limited by the maximum number of file descriptors. + +** The `--help' and `--version' command line options now consistently + override all earlier options. For example, `m4 --debugfile=trace + --help' now no longer accidentally creates an empty file `trace'. + +** The `-L'/`--nesting-limit' command line option can now be set to 0 + to remove the default limit of 1024. However, it is still possible that + heavily nested input can cause abrupt program termination due to stack + overflow. + +** Problems encountered when writing to standard error, such as with the + `errprint' macro, now always cause a non-zero exit status. + +** Warnings and errors issued during macro expansion are now consistently + reported at the line where the macro name was detected, rather than + where the close parenthesis resides. Text wrapped by `m4wrap' now + remembers the location that was in effect when m4wrap was invoked, + rather than changing to line 0 and the empty string for a file. The + macros `__line__' and `__file__' now work correctly even as the last + token in an included file. + +** The `builtin' and `indir' macros now transparently handle builtin + tokens generated by `defn'. + +** When diversions created by the `divert' macro collect enough text that + M4 must use temporary files, the environment variable $TMPDIR is now + consulted, and a better effort is made to clean up those files in the + event of a fatal signal. + +** The `mkstemp' builtin is added with the same GNU semantics as `maketemp', + based on the recommendation of POSIX to deprecate the POSIX semantics of + `maketemp' as inherently insecure. In GNU mode (no -G supplied on the + command line), `maketemp' silently retains the secure GNU semantics, but + a future release of M4 will change this to emit a warning. In + traditional mode (m4 -G), `maketemp' now uses the POSIX-mandated + insecure semantics, and issues a warning that you should convert your + script to use `mkstemp' instead. Additionally, `mkstemp' and `maketemp' + are now well-defined even if the template argument does not end in six + `X' characters. + +** The manual has been improved, including a new section on a composite + macro `foreach'. + +** The `changecom' and `changequote' macros now treat an empty second + argument the same as if it were missing, rather than using the empty + string and making it impossible to end a comment or quote. + +** The `translit' macro now operates in linear instead of quadratic time, + and is now eight-bit clean. + +** The `-D', `-U', `-s', and `-t' command line options now take effect + after any files encountered earlier on the command line, rather than up + front, as is done in traditional implementations and required by POSIX. + +* Noteworthy changes in Version 1.4.7 (2006-09-25) [stable] + Released by Eric Blake, based on CVS version 1.4.6a + +** Fix regression from 1.4.5 in handling a file that ends in a macro + expansion without arguments instead of a newline. + +** The define and pushdef macros now warn when the first argument is not + a string, rather than silently doing nothing. + +** Standard input can now be read more than once, as in 'm4 - file -', and + is not closed until all wrapped text is handled. This makes a + difference when stdin is not a regular file, and also fixes bugs when + using the syscmd or esyscmd macros from wrapped text. + +** When standard input is a seekable file, the m4exit, syscmd, and esyscmd + macros now restore the current position to the next unread byte rather + than discarding an arbitrary amount of buffered data. + +** SysV command-line compatibility is no longer a goal of GNU M4; the + focus will be instead on POSIX compatibility. This release continues to + support previous usage, but adds warnings in areas which will allow a + future version of GNU M4 to use its own extensions without being tied to + the SysV command line interface. + +** The no-op compatibility command line options -B, -N, -S, -T, and + --diversions may be withdrawn or assigned new meanings in future + releases, so they now issue a warning if used. + +** A new command line option -i replaces the compatibility -e as the + short spelling of --interactive, for consistency with other GNU tools; a + warning is issued if the old spelling is used, and it may be assigned + new meaning in future releases. + +** A new command line option --debugfile replaces the options -o and + --error-output as the preferred spelling. The old options were + misleading in their names and inconsistent with other GNU tools; they + are still silently accepted, but no longer documented in --help, and may + be assigned new meanings in future releases. + +* Noteworthy changes in Version 1.4.6 (2006-08-25) [stable] + Released by Eric Blake, based on CVS version 1.4.5a + +** Fix buffer overruns in regexp and patsubst macros when handed a trailing + backslash in the replacement text, or when handling \n substitutions + beyond the number of \(\) groups. + +** Fix memory leak in regexp, patsubst, and changeword macros. + +** The format macro now understands %F, %g, and %G. + +** When loading frozen files, m4 now exits with status 63 if version + mismatch is detected. + +** Fix bugs that occurred when invoked with stdout or stderr closed, + and detect write failures to stdout or to the target of the debugfile + macro. In particular, the syscmd and esyscmd macros can no longer + interfere with the debug stream or diversions. + +** The m4exit macro now converts values outside the range 0-255 to 1. + +** It is now an error if a command-line input file ends in the middle of a + comment, matching the behavior of mid-string and mid-argument + collection. + +** The dnl macro now warns if end of file is encountered instead of a + newline. + +** The error message when end of file is encountered now uses the file and + line where the dangling construct started, rather than `NONE:0:'. + +** The debugmode and __file__ macros, and the -s/--synclines option, now + show what directory a file was found in when the -I/--include option or + M4PATH variable had an effect. + +** The changequote and changecom macros now work with 8-bit characters, and + quotes and comments that begin with `(' are properly recognized + following a word. + +** The new macro __program__ is added, which allows the input file to issue + an error message that resembles messages from m4. Warning and error + messages have been reformatted to comply with GNU Coding Standards. + +** The errprint, m4wrap, and shift macros are now recognized only with + arguments. + +** The index, substr, translit, regexp, and patsubst macros now produce + output when given only one argument, but still warn about a missing + second argument. + +** The patsubst macro now reliably finds zero-length matches at the end + of a string. + +* Noteworthy changes in Version 1.4.5 (2006-07-15) [stable] + Released by Eric Blake, based on CVS version 1.4.4c + +** Fix sysval on BeOS, OS/2, and other systems that store exit status + in the low-order byte. Additionally, on Unix platforms, if syscmd was + terminated by a signal, sysval now displays the signal number shifted + left by eight bits, to match traditional m4 implementations. + +** The maketemp macro is no longer subject to platform limitations (such as + 26 or 32 max files from a given template). + +** Frozen files now require that the first directive be V (version), to + better diagnose version mismatch. Additionally, if the F directive + (builtin function) names an unknown builtin that existed in the m4 that + froze the file but not in the current m4 (for example, changeword), the + warning is deferred until an attempt is made to actually use the + builtin. This allows downgrading from beta m4-1.4o to stable m4-1.4.5 + without breaking autoconf. + +** The format and indir macros are now recognized only with arguments. + +** The eval macro no longer crashes on x86 architectures when dividing the + minimum integer by -1. + +** On systems with ecvt and fcvt, format no longer truncates trailing + zeroes on integers printed with %.0f. On systems without these + functions, format is no longer subject to a buffer overflow that + permitted arbitrary code execution. + +** On native Windows builds, the macro __windows__ is provided instead of + __unix__. Likewise, on OS/2 builds, the macro __os2__ is provided. + This allows input files to determine when syscmd might behave + differently. + +** Fix bug in 1.4.3 patch to use \n line-endings that did not work for + cygwin. + +** When given the empty string or 0, undivert is now documented as a no-op + rather than closing stdout, warning about a non-existent file, or trying + to read a directory as a file. + +** Many documentation improvements. Also, the manual is now distributed + under FDL 1.2, rather than a stricter verbatim-only license. + +** Raise the -L (--nesting-limit) command line option limit from 250 to + 1024. + +** The decr, incr, divert, m4exit, and substr macros treat an empty number + as 0, issue a warning, and expand as normal; rather than issuing an + error and expanding to the empty string. + +** The eval macro now treats an empty radix argument as 10, handles radix 1, + and treats the width argument as number of digits excluding the sign, + for compatibility with other m4 implementations. + +** The ifdef, divert, m4exit, substr, and translit macros now correctly + ignore extra arguments. + +** The popdef and undefine macros now correctly accept multiple arguments. + +** Although changeword is on its last leg, if enabled, it now reverts to the + default (faster) regexp when passed the empty string. + +** The regexp and substr macros now warn and ignore a trailing backslash in + the replacement, and warn on \n for n larger than the number of + sub-expressions in the regexp. + +* Noteworthy changes in Version 1.4.4b (2006-06-17) [beta] + Released by Eric Blake, based on CVS version 1.4.4a + +** Fix a recursive push_string crashing bug, which affected changequote of + three or more characters on some compilers. + +** Use automake to fix build portability issues. + +** Fix a recursive m4wrap crashing bug. + +** Fix a 1 in 2**32 hash crashing bug. + +** Tracing a macro by name is now persistent, even if the macro is + subsequently undefined or redefined. The traceon and traceoff macros no + longer warn about undefined symbols. This solves a crash when using + indir on an undefined macro traced with the -t option, as well as an + incorrect result of ifdef. Furthermore, tracing is no longer + transferred with builtins, solving the bug of "m4 -tm4_eval" failing to + give trace output on the input + "define(`m4_eval',defn(`eval'))m4_eval(1)". + +** Fix a crash when a macro is undefined while collecting its arguments, by + always using the definition that was in effect before argument + collection. This behavior matches the C pre-processor, and means that + the sequence "define(`f',`1')f(define(`f',`2'))f" is now documented to + result in "12", rather than the previously undocumented "22". + +** Update the regex engine to fix several bugs. + +** Fix a potential crash on machines where char is signed. + +* Noteworthy changes in Version 1.4.4 (Oct 2005) [stable] + Released by Gary V. Vaughan + +** ./configure --infodir=/usr/share/info now works correctly. + +** When any file named on the command line is missing exit with status 1. + +* Noteworthy changes in Version 1.4.3 (Mar 2005) [stable] + Released by Gary V. Vaughan + +** DESTDIR installs now work correctly. + +** Don't segfault with uncompilable regexps to changeword(). + +** Always use \n line-endings for frozen files (fixes a Windows bug). + +** Portability fix for systems lacking mkstemp(3). + +** Approximately 20% speed up in the common case of usage with autoconf. + +** Supported on QNX 6.3. + +* Noteworthy changes in Version 1.4.2 (Aug 2004) [stable] + Released by Paul Eggert + +** No user visible changes; portability bug fixes only. + +* Noteworthy changes in Version 1.4.1 (Jun 2004) [stable] + Released by Paul Eggert + +** maketemp now creates an empty file with the given name, instead of merely + returning the name of a nonexistent file. This closes a security hole. + +* Noteworthy changes in Version 1.4 (Oct 1994) [stable] + Released by Franc,ois Pinard + +** (No user visible changes) -(No user visible changes) Version 1.3 - September 1994, by Franc,ois Pinard diff -ruNp m4-1.4.10/README m4-1.4.11/README --- m4-1.4.10/README 2007-07-04 21:56:02.000000000 -0600 +++ m4-1.4.11/README 2008-03-29 16:33:27.000000000 -0600 @@ -10,13 +10,14 @@ This release is considered stable. If GNU `m4' is meant to serve GNU `autoconf', beware that `m4' should be fully installed *prior to* configuring `autoconf' itself. -Likewise, if you intend on hacking GNU `m4' from CVS, the bootstrap +Likewise, if you intend on hacking GNU `m4' from git, the bootstrap process requires that you first install a released copy of GNU `m4'. If you are just trying to build `m4' from a released tarball, you should not normally need to run `./bootstrap' or `autoreconf'; just go ahead and start with `./configure'. If you are trying to build `m4' -from CVS, more information can be found in the CVS-only file HACKING. +from git, more information can be found in the version-control-only +file HACKING. In the subdirectory `examples' you will find various m4 files, ranging from trivial test files to rather advanced macros. If you intend to @@ -46,7 +47,8 @@ solution, from which the problem might b ======================================================================== -Copyright (C) 2000, 2005, 2006 Free Software Foundation, Inc. +Copyright (C) 2000, 2005, 2006, 2007, 2008 Free Software Foundation, +Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or diff -ruNp m4-1.4.10/THANKS m4-1.4.11/THANKS --- m4-1.4.10/THANKS 2007-05-29 19:34:53.000000000 -0600 +++ m4-1.4.11/THANKS 2008-03-29 16:33:27.000000000 -0600 @@ -6,7 +6,7 @@ various improvements or submitting actua these people. Help me keep it complete and exempt of errors. Akiko Matsushita matusita@sra.co.jp -Akim Demaille akim@epita.fr +Akim Demaille demaille@inf.enst.fr Alan Magnuson awm@osc.edu Albert Chin m4-discuss@mlists.thewrittenword.com Alexander Lehmann alex@hal.rhein-main.de @@ -37,6 +37,7 @@ François Pinard pinard@iro.umontreal.c Frank Schwidom schwidom@impernet.de Gary V. Vaughan gary@gnu.org Geoff Russell grussell@guest.adelaide.edu.au +Giovanni Toffetti toffettg@lu.unisi.ch Greg A. Woods woods@web.apc.org Hal Peterson hrp@pecan.cray.com Hoang Uong hoang@ornews.intel.com @@ -56,8 +57,10 @@ Karl Berry karl@freefriends.org Karl Nelson nelson85@llnl.gov Karl Vogel vogelke@c-17igp.wpafb.af.mil Kaveh R. Ghazi ghazi@noc.rutgers.edu +Konrad Schwarz konrad.schwarz@siemens.com Kristine Lund lund@lpnaxp.in2p3.fr Krste Asanovic krste@icsi.berkeley.edu +Lawson Chan Lawson.Chan@tdsecurities.com Marion Hakanson hakanson@cse.ogi.edu Mark Seiden mis@seiden.com Martin Koeppe mkoeppe@gmx.de @@ -73,8 +76,9 @@ Nelson H. F. Beebe beebe@math.utah.edu Nick S. Kanakakorn skanan@otl.scu.edu Nicolas Lichtmaier nick@technisys.com.ar Nicolas Pioch pioch@inf.enst.fr -Noah Friedman friedman@gnu.ai.mit.edu +Noah Friedman friedman@gnu.org Noah Misch noah@cs.caltech.edu +Paolo Bonzini bonzini@gnu.org Paul Eggert eggert@cs.ucla.edu Pete Chown pete.chown@dale.dircon.co.uk Pierre Gaumond gaumondp@ere.umontreal.ca @@ -86,7 +90,7 @@ Richard Stallman rms@gnu.org Robert Bernstein rocky@panix.com Robert Bihlmeyer robbe@orcus.priv.at Roland H. Pesch roland@wrs.com -Roland McGrath roland@gnu.ai.mit.edu +Roland McGrath roland@gnu.org Sami Liedes sliedes@cc.hut.fi Santiago Vila sanvila@debian.org Scott Bartram deneb!scottb @@ -97,6 +101,7 @@ Stepan Kasal kasal@ucw.cz Stephen Perkins perkins@cps.msu.edu Steve Williamson willy@uinpla.npl.uiuc.edu Steven Augart saugart@yahoo.com +Thomas Klausner tk@giga.or.at Thorsten Ohl ohl@physics.harvard.edu Tom McConnell tmcconne@sedona.intel.com Tom Quinn trq@dionysos.thphys.ox.ac.uk diff -ruNp m4-1.4.10/aclocal.m4 m4-1.4.11/aclocal.m4 --- m4-1.4.10/aclocal.m4 2007-07-09 21:14:48.000000000 -0600 +++ m4-1.4.11/aclocal.m4 2008-04-02 06:44:30.000000000 -0600 @@ -1,7 +1,7 @@ -# generated automatically by aclocal 1.10 -*- Autoconf -*- +# generated automatically by aclocal 1.10.1 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006 Free Software Foundation, Inc. +# 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -11,12 +11,15 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. -m4_if(m4_PACKAGE_VERSION, [2.61],, -[m4_fatal([this file was generated for autoconf 2.61. -You have another version of autoconf. If you want to use that, -you should regenerate the build system entirely.], [63])]) +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +m4_if(AC_AUTOCONF_VERSION, [2.61],, +[m4_warning([this file was generated for autoconf 2.61. +You have another version of autoconf. It may work, but is not guaranteed to. +If you have problems, you may need to regenerate the build system entirely. +To do so, use the procedure documented by the package, typically `autoreconf'.])]) -# Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc. +# Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -31,7 +34,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.10' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.10], [], +m4_if([$1], [1.10.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -47,8 +50,10 @@ m4_define([_AM_AUTOCONF_VERSION], []) # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.10])dnl -_AM_AUTOCONF_VERSION(m4_PACKAGE_VERSION)]) +[AM_AUTOMAKE_VERSION([1.10.1])dnl +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +_AM_AUTOCONF_VERSION(AC_AUTOCONF_VERSION)]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- @@ -320,7 +325,7 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. - if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue @@ -368,13 +373,13 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS] # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006 Free Software Foundation, Inc. +# 2005, 2006, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 12 +# serial 13 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. @@ -479,16 +484,17 @@ AC_PROVIDE_IFELSE([AC_PROG_OBJC], # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. +_am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in - $1 | $1:* ) + $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done -echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) +echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # @@ -760,7 +766,7 @@ AC_SUBST([INSTALL_STRIP_PROGRAM])]) # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- -# Prevent Automake from outputing VARIABLE = @VARIABLE@ in Makefile.in. +# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) @@ -880,7 +886,6 @@ m4_include([m4/fpending.m4]) m4_include([m4/fpieee.m4]) m4_include([m4/fpurge.m4]) m4_include([m4/freading.m4]) -m4_include([m4/free.m4]) m4_include([m4/frexp.m4]) m4_include([m4/frexpl.m4]) m4_include([m4/fseeko.m4]) @@ -895,19 +900,23 @@ m4_include([m4/include_next.m4]) m4_include([m4/inline.m4]) m4_include([m4/intmax_t.m4]) m4_include([m4/inttypes_h.m4]) -m4_include([m4/isnan.m4]) +m4_include([m4/isnand.m4]) m4_include([m4/isnanf.m4]) m4_include([m4/isnanl.m4]) m4_include([m4/ldexpl.m4]) m4_include([m4/localcharset.m4]) m4_include([m4/longlong.m4]) m4_include([m4/lseek.m4]) +m4_include([m4/malloc.m4]) m4_include([m4/malloca.m4]) m4_include([m4/math_h.m4]) m4_include([m4/mbrtowc.m4]) m4_include([m4/mbstate_t.m4]) +m4_include([m4/memchr.m4]) +m4_include([m4/memcmp.m4]) m4_include([m4/mkdtemp.m4]) m4_include([m4/mkstemp.m4]) +m4_include([m4/nocrash.m4]) m4_include([m4/pathmax.m4]) m4_include([m4/printf-frexp.m4]) m4_include([m4/printf-frexpl.m4]) @@ -928,12 +937,15 @@ m4_include([m4/stdio-safer.m4]) m4_include([m4/stdio_h.m4]) m4_include([m4/stdlib-safer.m4]) m4_include([m4/stdlib_h.m4]) +m4_include([m4/strerror.m4]) +m4_include([m4/string_h.m4]) +m4_include([m4/strstr.m4]) +m4_include([m4/strtod.m4]) m4_include([m4/strtol.m4]) m4_include([m4/sys_stat_h.m4]) m4_include([m4/sys_time_h.m4]) m4_include([m4/tempname.m4]) m4_include([m4/tmpdir.m4]) -m4_include([m4/ulonglong.m4]) m4_include([m4/unistd-safer.m4]) m4_include([m4/unistd_h.m4]) m4_include([m4/unlocked-io.m4]) diff -ruNp m4-1.4.10/bootstrap m4-1.4.11/bootstrap --- m4-1.4.10/bootstrap 2007-07-04 21:56:03.000000000 -0600 +++ m4-1.4.11/bootstrap 2008-03-29 16:33:27.000000000 -0600 @@ -1,42 +1,40 @@ #! /bin/sh -# bootstrap (GNU M4) version 2007-07-04 +# bootstrap (GNU M4) version 2008-03-25 # Written by Gary V. Vaughan -# Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc. -# This is free software; see the source for copying conditions. There is NO -# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, +# Inc. -# This program is free software; you can redistribute it and/or modify +# This file is part of GNU M4. +# +# GNU M4 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 +# 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. +# GNU M4 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, a copy can be downloaded from -# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free -# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, -# MA 02110-1301, USA. +# along with this program. If not, see . # Usage: $progname [options] -# -f --force bootstrap even when sources are not from CVS +# -f --force bootstrap even when sources are not from git # -v --version print version information # -h,-? --help print short or long help message # You can also set the following variables to help $progname # locate the right tools: -# AUTORECONF, GNULIB_TOOL, RM, SED +# AUTORECONF, GNULIB_TOOL, M4, RM, SED -# This script bootstraps a CVS checkout of GNU M4 by correctly +# This script bootstraps a git or CVS checkout of GNU M4 by correctly # calling out to parts of the GNU Build Platform. Currently this -# requires GNU Autoconf 2.60, GNU Automake 1.9.6, and bleeding edge -# CVS snapshots of GNU Gnulib. +# requires GNU Autoconf 2.60, GNU Automake 1.10.1, and bleeding edge +# git or CVS snapshots of GNU Gnulib. # Report bugs to @@ -45,6 +43,12 @@ : ${RM=rm -f} : ${SED=sed} +# Ensure file names are sorted consistently across platforms. +LC_ALL=C +export LC_ALL + +config_macro_dir=m4 + dirname="s,/[^/]*$,," basename="s,^.*/,,g" @@ -59,8 +63,8 @@ progpath="$0" progname=`echo "$progpath" | $SED "$basename"` PROGRAM=bootstrap -# Detect whether this is a CVS checkout or a tarball -CVS_only_file=HACKING +# Detect whether this is a version control system checkout or a tarball +vcs_only_file=HACKING # func_echo arg... # Echo program name prefixed message. @@ -124,7 +128,7 @@ func_missing_arg () func_usage () { $SED '/^# Usage:/,/# -h/ { - s/^# //; s/^# *$//; + s/^# //; s/^# *$//; s/\$progname/'$progname'/; p; }; d' < "$progpath" @@ -138,7 +142,7 @@ func_usage () func_help () { $SED '/^# Usage:/,/# Report bugs to/ { - s/^# //; s/^# *$//; + s/^# //; s/^# *$//; s/\$progname/'$progname'/; p; }; d' < "$progpath" @@ -150,9 +154,9 @@ func_help () func_version () { $SED '/^# '$PROGRAM' (GNU /,/# warranty; / { - s/^# //; s/^# *$//; - s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/; - p; + s/^# //; s/^# *$//; + s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/; + p; }; d' < "$progpath" exit $EXIT_SUCCESS } @@ -184,7 +188,7 @@ func_update () shift case $opt in # Separate optargs to short options: - -f|--force) CVS_only_file= ;; + -f|--force) vcs_only_file= ;; -\?|-h) func_usage ;; --help) func_help ;; --version) func_version ;; @@ -197,11 +201,49 @@ func_update () # Bail if the options were screwed $exit_cmd $EXIT_FAILURE - if test -n "$CVS_only_file" && test ! -r "$CVS_only_file"; then - func_fatal_error "Bootstrapping from a non-CVS distribution is risky." + if test -n "$vcs_only_file" && test ! -r "$vcs_only_file"; then + func_fatal_error \ + "Bootstrapping from a non-version-control distribution is risky." fi } +## ---------------- ## +## Version control. ## +## ---------------- ## + +# gnulib-tool updates m4/.{git,cvs}ignore and lib/.{git,cvs}ignore, and +# keeping generated files under version control does not make sense. +# Since lib is entirely ignored, we only need to prepopulate the m4 ignore +# files with generated files not tracked by gnulib-tool. +if test -f $config_macro_dir/.gitignore ; then + : +else + func_echo "creating initial $config_macro_dir/.cvsignore" + cat > $config_macro_dir/.cvsignore <<\EOF +# files created by gnulib, but that gnulib doesn't track +*~ +.cvsignore +.gitignore +gnulib-comp.m4 +# gnulib-tool edits below here +EOF + func_echo "creating initial $config_macro_dir/.gitignore" + cp $config_macro_dir/.cvsignore $config_macro_dir/.gitignore +fi + +# See if we can use gnulib's git-merge-changelog merge driver. +if test -d .git && (git --version) >/dev/null 2>/dev/null ; then + if git config merge.merge-changelog.driver >/dev/null ; then + : + elif (git-merge-changelog --version) >/dev/null 2>/dev/null ; then + func_echo "initializing git-merge-changelog driver" + git config merge.merge-changelog.name 'GNU-style ChangeLog merge driver' + git config merge.merge-changelog.driver 'git-merge-changelog %O %A %B' + else + func_echo "consider installing git-merge-changelog from gnulib" + fi +fi + ## ---------------------------- ## ## Find the gnulib module tree. ## ## ---------------------------- ## @@ -218,7 +260,7 @@ while test -h "$gnulibdir"; do # Resolve symbolic link. sedexpr1='s, -> ,#%%#,' sedexpr2='s,^.*#%%#\(.*\)$,\1,p' - linkval=`LC_ALL=C ls -l "$gnulibdir" | $SED "$sedexpr1" | $SED -n "$sedexpr2"` + linkval=`ls -l "$gnulibdir" | $SED "$sedexpr1" | $SED -n "$sedexpr2"` test -n "$linkval" || break case "$linkval" in @@ -248,13 +290,13 @@ $AUTORECONF --force --verbose --install ## Gnulib is more up-to-date than automake. ## ## ---------------------------------------- ## -func_update "$gnulibdir"/build-aux/config.guess config.guess -func_update "$gnulibdir"/build-aux/config.sub config.sub -func_update "$gnulibdir"/build-aux/depcomp depcomp -func_update "$gnulibdir"/build-aux/install-sh install-sh -func_update "$gnulibdir"/build-aux/mdate-sh doc/mdate-sh -func_update "$gnulibdir"/build-aux/missing missing -func_update "$gnulibdir"/build-aux/texinfo.tex doc/texinfo.tex +func_update "$gnulibdir"/build-aux/config.guess build-aux/config.guess +func_update "$gnulibdir"/build-aux/config.sub build-aux/config.sub +func_update "$gnulibdir"/build-aux/depcomp build-aux/depcomp +func_update "$gnulibdir"/build-aux/install-sh build-aux/install-sh +func_update "$gnulibdir"/build-aux/mdate-sh build-aux/mdate-sh +func_update "$gnulibdir"/build-aux/missing build-aux/missing +func_update "$gnulibdir"/build-aux/texinfo.tex build-aux/texinfo.tex func_update "$gnulibdir"/doc/COPYINGv3 COPYING func_update "$gnulibdir"/doc/INSTALL INSTALL diff -ruNp m4-1.4.10/build-aux/announce-gen m4-1.4.11/build-aux/announce-gen --- m4-1.4.10/build-aux/announce-gen 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/build-aux/announce-gen 2008-02-25 21:04:09.000000000 -0700 @@ -0,0 +1,516 @@ +#!/usr/bin/perl -w +# Generate a release announcement message. + +my $VERSION = '2008-02-08 10:34'; # UTC +# The definition above must lie within the first 8 lines in order +# for the Emacs time-stamp write hook (at end) to update it. +# If you change this file with Emacs, please let the write hook +# do its job. Otherwise, update this string manually. + +# Copyright (C) 2002-2008 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 . + +# Written by Jim Meyering + +use strict; + +use Getopt::Long; +use Digest::MD5; +use Digest::SHA1; +use POSIX qw(strftime); + +(my $ME = $0) =~ s|.*/||; + +my %valid_release_types = map {$_ => 1} qw (alpha beta major); + +END +{ + # Nobody ever checks the status of print()s. That's okay, because + # if any do fail, we're guaranteed to get an indicator when we close() + # the filehandle. + # + # Close stdout now, and if there were no errors, return happy status. + # If stdout has already been closed by the script, though, do nothing. + defined fileno STDOUT + or return; + close STDOUT + and return; + + # Errors closing stdout. Indicate that, and hope stderr is OK. + warn "$ME: closing standard output: $!\n"; + + # Don't be so arrogant as to assume that we're the first END handler + # defined, and thus the last one invoked. There may be others yet + # to come. $? will be passed on to them, and to the final _exit(). + # + # If it isn't already an error, make it one (and if it _is_ an error, + # preserve the value: it might be important). + $? ||= 1; +} + +sub usage ($) +{ + my ($exit_code) = @_; + my $STREAM = ($exit_code == 0 ? *STDOUT : *STDERR); + if ($exit_code != 0) + { + print $STREAM "Try `$ME --help' for more information.\n"; + } + else + { + my @types = sort keys %valid_release_types; + print $STREAM < = C + +Compute the sizes of the C<@file> and return them as a hash. Return +C if one of the computation failed. + +=cut + +sub sizes (@) +{ + my (@file) = @_; + + my $fail = 0; + my %res; + foreach my $f (@file) + { + my $cmd = "du --human $f"; + my $t = `$cmd`; + # FIXME-someday: give a better diagnostic, a la $PROCESS_STATUS + $@ + and (warn "$ME: command failed: `$cmd'\n"), $fail = 1; + chomp $t; + $t =~ s/^([\d.]+[MkK]).*/${1}B/; + $res{$f} = $t; + } + return $fail ? undef : %res; +} + +=item C dedicated to the list of <@file>, which +sizes are stored in C<%size>, and which are available from the C<@url>. + +=cut + +sub print_locations ($\@\%@) +{ + my ($title, $url, $size, @file) = @_; + print "Here are the $title:\n"; + foreach my $url (@{$url}) + { + for my $file (@file) + { + print " $url/$file"; + print " (", $$size{$file}, ")" + if exists $$size{$file}; + print "\n"; + } + } + print "\n"; +} + +=item C. + +=cut + +sub print_checksums (@) +{ + my (@file) = @_; + + print "Here are the MD5 and SHA1 checksums:\n"; + print "\n"; + + foreach my $meth (qw (md5 sha1)) + { + foreach my $f (@file) + { + open IN, '<', $f + or die "$ME: $f: cannot open for reading: $!\n"; + binmode IN; + my $dig = + ($meth eq 'md5' + ? Digest::MD5->new->addfile(*IN)->hexdigest + : Digest::SHA1->new->addfile(*IN)->hexdigest); + close IN; + print "$dig $f\n"; + } + } + + +} + +=item C addressing changes +between versions C<$prev_version> and C<$curr_version>. + +=cut + +sub print_news_deltas ($$$) +{ + my ($news_file, $prev_version, $curr_version) = @_; + + print "\n$news_file\n\n"; + + # Print all lines from $news_file, starting with the first one + # that mentions $curr_version up to but not including + # the first occurrence of $prev_version. + my $in_items; + + my $re_prefix = qr/\* (?:Noteworthy|Major) change/; + + open NEWS, '<', $news_file + or die "$ME: $news_file: cannot open for reading: $!\n"; + while (defined (my $line = )) + { + if ( ! $in_items) + { + # Match lines like these: + # * Major changes in release 5.0.1: + # * Noteworthy changes in release 6.6 (2006-11-22) [stable] + $line =~ /^$re_prefix.*(?:[^\d.]|$)\Q$curr_version\E(?:[^\d.]|$)/o + or next; + $in_items = 1; + print $line; + } + else + { + # This regexp must not match version numbers in NEWS items. + # For example, they might well say `introduced in 4.5.5', + # and we don't want that to match. + $line =~ /^$re_prefix.*(?:[^\d.]|$)\Q$prev_version\E(?:[^\d.]|$)/o + and last; + print $line; + } + } + close NEWS; + + $in_items + or die "$ME: $news_file: no matching lines for `$curr_version'\n"; +} + +sub print_changelog_deltas ($$) +{ + my ($package_name, $prev_version) = @_; + + # Print new ChangeLog entries. + + # First find all CVS-controlled ChangeLog files. + use File::Find; + my @changelog; + find ({wanted => sub {$_ eq 'ChangeLog' && -d 'CVS' + and push @changelog, $File::Find::name}}, + '.'); + + # If there are no ChangeLog files, we're done. + @changelog + or return; + my %changelog = map {$_ => 1} @changelog; + + # Reorder the list of files so that if there are ChangeLog + # files in the specified directories, they're listed first, + # in this order: + my @dir = qw ( . src lib m4 config doc ); + + # A typical @changelog array might look like this: + # ./ChangeLog + # ./po/ChangeLog + # ./m4/ChangeLog + # ./lib/ChangeLog + # ./doc/ChangeLog + # ./config/ChangeLog + my @reordered; + foreach my $d (@dir) + { + my $dot_slash = $d eq '.' ? $d : "./$d"; + my $target = "$dot_slash/ChangeLog"; + delete $changelog{$target} + and push @reordered, $target; + } + + # Append any remaining ChangeLog files. + push @reordered, sort keys %changelog; + + # Remove leading `./'. + @reordered = map { s!^\./!!; $_ } @reordered; + + print "\nChangeLog entries:\n\n"; + # print join ("\n", @reordered), "\n"; + + $prev_version =~ s/\./_/g; + my $prev_cvs_tag = "\U$package_name\E-$prev_version"; + + my $cmd = "cvs -n diff -u -r$prev_cvs_tag -rHEAD @reordered"; + open DIFF, '-|', $cmd + or die "$ME: cannot run `$cmd': $!\n"; + # Print two types of lines, making minor changes: + # Lines starting with `+++ ', e.g., + # +++ ChangeLog 22 Feb 2003 16:52:51 -0000 1.247 + # and those starting with `+'. + # Don't print the others. + my $prev_printed_line_empty = 1; + while (defined (my $line = )) + { + if ($line =~ /^\+\+\+ /) + { + my $separator = "*"x70 ."\n"; + $line =~ s///; + $line =~ s/\s.*//; + $prev_printed_line_empty + or print "\n"; + print $separator, $line, $separator; + } + elsif ($line =~ /^\+/) + { + $line =~ s///; + print $line; + $prev_printed_line_empty = ($line =~ /^$/); + } + } + close DIFF; + + # The exit code should be 1. + # Allow in case there are no modified ChangeLog entries. + $? == 256 || $? == 128 + or warn "$ME: warning: `cmd' had unexpected exit code or signal ($?)\n"; +} + +sub get_tool_versions ($$) +{ + my ($tool_list, $gnulib_version) = @_; + @$tool_list + or return (); + + my $fail; + my @tool_version_pair; + foreach my $t (@$tool_list) + { + if ($t eq 'gnulib') + { + push @tool_version_pair, ucfirst $t . ' ' . $gnulib_version; + next; + } + # Assume that the last "word" on the first line of + # `tool --version` output is the version string. + my ($first_line, undef) = split ("\n", `$t --version`); + if ($first_line =~ /.* (\d[\w.-]+)$/) + { + $t = ucfirst $t; + push @tool_version_pair, "$t $1"; + } + else + { + defined $first_line + and $first_line = ''; + warn "$ME: $t: unexpected --version output\n:$first_line"; + $fail = 1; + } + } + + $fail + and exit 1; + + return @tool_version_pair; +} + +{ + # Neutralize the locale, so that, for instance, "du" does not + # issue "1,2" instead of "1.2", what confuses our regexps. + $ENV{LC_ALL} = "C"; + + my $release_type; + my $package_name; + my $prev_version; + my $curr_version; + my $gpg_key_id; + my @url_dir_list; + my @news_file; + my $bootstrap_tools; + my $gnulib_version; + + GetOptions + ( + 'release-type=s' => \$release_type, + 'package-name=s' => \$package_name, + 'previous-version=s' => \$prev_version, + 'current-version=s' => \$curr_version, + 'gpg-key-id=s' => \$gpg_key_id, + 'url-directory=s' => \@url_dir_list, + 'news=s' => \@news_file, + 'bootstrap-tools=s' => \$bootstrap_tools, + 'gnulib-version=s' => \$gnulib_version, + + help => sub { usage 0 }, + version => sub { print "$ME version $VERSION\n"; exit }, + ) or usage 1; + + my $fail = 0; + # Ensure that sure each required option is specified. + $release_type + or (warn "$ME: release type not specified\n"), $fail = 1; + $package_name + or (warn "$ME: package name not specified\n"), $fail = 1; + $prev_version + or (warn "$ME: previous version string not specified\n"), $fail = 1; + $curr_version + or (warn "$ME: current version string not specified\n"), $fail = 1; + $gpg_key_id + or (warn "$ME: GnuPG key ID not specified\n"), $fail = 1; + @url_dir_list + or (warn "$ME: URL directory name(s) not specified\n"), $fail = 1; + + my @tool_list = split ',', $bootstrap_tools; + + grep (/^gnulib$/, @tool_list) ^ defined $gnulib_version + and (warn "$ME: when specifying gnulib as a tool, you must also specify\n" + . "--gnulib-version=V, where V is the result of running git describe\n" + . "in the gnulib source directory.\n"), $fail = 1; + + exists $valid_release_types{$release_type} + or (warn "$ME: `$release_type': invalid release type\n"), $fail = 1; + + @ARGV + and (warn "$ME: too many arguments:\n", join ("\n", @ARGV), "\n"), + $fail = 1; + $fail + and usage 1; + + my $my_distdir = "$package_name-$curr_version"; + my $tgz = "$my_distdir.tar.gz"; + my $tbz = "$my_distdir.tar.bz2"; + my $lzma = "$my_distdir.tar.lzma"; + my $xd = "$package_name-$prev_version-$curr_version.xdelta"; + + my @tarballs = grep {-f $_} ($tgz, $tbz, $lzma); + my @sizable = @tarballs; + -f $xd + and push @sizable, $xd; + my %size = sizes (@sizable); + %size + or exit 1; + + # The markup is escaped as <\# so that when this script is sent by + # mail (or part of a diff), Gnus is not triggered. + print < + +FIXME: put comments here + +EOF + + print_locations ("compressed sources", @url_dir_list, %size, @tarballs); + -f $xd + and print_locations ("xdelta diffs (useful? if so, " + . "please tell bug-gnulib\@gnu.org)", + @url_dir_list, %size, $xd); + my @sig_files = map { "$_.sig" } @tarballs; + print_locations ("GPG detached signatures[*]", @url_dir_list, %size, + @sig_files); + + print_checksums (@sizable); + + print <. +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ; set_cc_for_build= ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit ;; + *:SolidBSD:*:*) + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) + echo powerpc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit ;; + alpha:OSF1:*:*) + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit ;; + arm:riscos:*:*|arm:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } + echo mips-mips-riscos${UNAME_RELEASE} + exit ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit ;; + *:AIX:*:[456]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep __LP64__ >/dev/null + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + echo unknown-hitachi-hiuxwe2 + exit ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:FreeBSD:*:*) + case ${UNAME_MACHINE} in + pc98) + echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + amd64) + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit ;; + *:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit ;; + *:Interix*:[3456]*) + case ${UNAME_MACHINE} in + x86) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + EM64T | authenticamd) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; + IA64) + echo ia64-unknown-interix${UNAME_RELEASE} + exit ;; + esac ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix + exit ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + *:GNU:*:*) + # the GNU system + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + exit ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit ;; + arm*:Linux:*:*) + eval $set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + echo ${UNAME_MACHINE}-unknown-linux-gnu + else + echo ${UNAME_MACHINE}-unknown-linux-gnueabi + fi + exit ;; + avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit ;; + crisv32:Linux:*:*) + echo crisv32-axis-linux-gnu + exit ;; + frv:Linux:*:*) + echo frv-unknown-linux-gnu + exit ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + mips:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips + #undef mipsel + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mipsel + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips + #else + CPU= + #endif + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips64 + #undef mips64el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mips64el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips64 + #else + CPU= + #endif + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + or32:Linux:*:*) + echo or32-unknown-linux-gnu + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-gnu + exit ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit ;; + xtensa*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + i*86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + # Set LC_ALL=C to ensure ld outputs messages in English. + ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ + | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g + s/.*supported targets: *// + s/ .*// + p'` + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit ;; + coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit ;; + esac + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + #ifdef __ELF__ + # ifdef __GLIBC__ + # if __GLIBC__ >= 2 + LIBC=gnu + # else + LIBC=gnulibc1 + # endif + # else + LIBC=gnulibc1 + # endif + #else + #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) + LIBC=gnu + #else + LIBC=gnuaout + #endif + #endif + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^LIBC/{ + s: ::g + p + }'`" + test x"${LIBC}" != x && { + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit + } + test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit ;; + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. + echo i586-pc-haiku + exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit ;; + SX-7:SUPER-UX:*:*) + echo sx7-nec-superux${UNAME_RELEASE} + exit ;; + SX-8:SUPER-UX:*:*) + echo sx8-nec-superux${UNAME_RELEASE} + exit ;; + SX-8R:SUPER-UX:*:*) + echo sx8r-nec-superux${UNAME_RELEASE} + exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in + unknown) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit ;; + NSE-?:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; + i*86:rdos:*:*) + echo ${UNAME_MACHINE}-pc-rdos + exit ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix\n"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + c34*) + echo c34-convex-bsd + exit ;; + c38*) + echo c38-convex-bsd + exit ;; + c4*) + echo c4-convex-bsd + exit ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff -ruNp m4-1.4.10/build-aux/config.sub m4-1.4.11/build-aux/config.sub --- m4-1.4.10/build-aux/config.sub 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/build-aux/config.sub 2008-04-02 06:45:31.000000000 -0600 @@ -0,0 +1,1662 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 +# Free Software Foundation, Inc. + +timestamp='2008-03-26' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file 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 2 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, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit ;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ + uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis | -knuth | -cray) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco6) + os=-sco5v6 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ + | bfin \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fido | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | mcore | mep | metag \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64octeon | mips64octeonel \ + | mips64orion | mips64orionel \ + | mips64r5900 | mips64r5900el \ + | mips64vr | mips64vrel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | mt \ + | msp430 \ + | nios | nios2 \ + | ns16k | ns32k \ + | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | score \ + | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu | strongarm \ + | tahoe | thumb | tic4x | tic80 | tron \ + | v850 | v850e \ + | we32k \ + | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ + | z8k) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + ms1) + basic_machine=mt-unknown + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* | avr32-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | m32c-* | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64octeon-* | mips64octeonel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64r5900-* | mips64r5900el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ + | msp430-* \ + | nios-* | nios2-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \ + | tron-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ + | xstormy16-* | xtensa*-* \ + | ymp-* \ + | z8k-*) + ;; + # Recognize the basic CPU types without company name, with glob match. + xtensa*) + basic_machine=$basic_machine-unknown + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + abacus) + basic_machine=abacus-unknown + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amd64) + basic_machine=x86_64-pc + ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + blackfin) + basic_machine=bfin-unknown + os=-linux + ;; + blackfin-*) + basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16) + basic_machine=cr16-unknown + os=-elf + ;; + crds | unos) + basic_machine=m68k-crds + ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m68knommu) + basic_machine=m68k-unknown + os=-linux + ;; + m68knommu-*) + basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + mingw32ce) + basic_machine=arm-unknown + os=-mingw32ce + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + openrisc | openrisc-*) + basic_machine=or32-unknown + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + parisc) + basic_machine=hppa-unknown + os=-linux + ;; + parisc-*) + basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rdos) + basic_machine=i386-pc + os=-rdos + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh5el) + basic_machine=sh5le-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tic55x | c55x*) + basic_machine=tic55x-unknown + os=-coff + ;; + tic6x | c6x*) + basic_machine=tic6x-unknown + os=-coff + ;; + tile*) + basic_machine=tile-unknown + os=-linux-gnu + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + mmix) + basic_machine=mmix-knuth + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -openbsd* | -solidbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -os400*) + os=-os400 + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -syllable*) + os=-syllable + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -tpf*) + os=-tpf + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -kaos*) + os=-kaos + ;; + -zvmoe) + os=-zvmoe + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + score-*) + os=-elf + ;; + spu-*) + os=-elf + ;; + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mep-*) + os=-elf + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-haiku) + os=-haiku + ;; + *-ibm) + os=-aix + ;; + *-knuth) + os=-mmixware + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -os400*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -tpf*) + vendor=ibm + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff -ruNp m4-1.4.10/build-aux/depcomp m4-1.4.11/build-aux/depcomp --- m4-1.4.10/build-aux/depcomp 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/build-aux/depcomp 2008-04-02 06:45:31.000000000 -0600 @@ -0,0 +1,587 @@ +#! /bin/sh +# depcomp - compile a program generating dependencies as side-effects + +scriptversion=2007-03-29.01 + +# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007 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, 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 . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Alexandre Oliva . + +case $1 in + '') + echo "$0: No command. Try \`$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: depcomp [--help] [--version] PROGRAM [ARGS] + +Run PROGRAMS ARGS to compile a file, generating dependencies +as side-effects. + +Environment variables: + depmode Dependency tracking mode. + source Source file read by `PROGRAMS ARGS'. + object Object file output by `PROGRAMS ARGS'. + DEPDIR directory where to store dependencies. + depfile Dependency file to output. + tmpdepfile Temporary file to use when outputing dependencies. + libtool Whether libtool is used (yes/no). + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "depcomp $scriptversion" + exit $? + ;; +esac + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi + +# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. +depfile=${depfile-`echo "$object" | + sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. +## Unfortunately, FreeBSD c89 acceptance of flags depends upon +## the command line argument order; so add the flags where they +## appear in depend2.am. Note that the slowdown incurred here +## affects only configure: in makefiles, %FASTDEP% shortcuts this. + for arg + do + case $arg in + -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; + *) set fnord "$@" "$arg" ;; + esac + shift # fnord + shift # $arg + done + "$@" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz +## The second -e expression handles DOS-style file names with drive letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the `deleted header file' problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. + tr ' ' ' +' < "$tmpdepfile" | +## Some versions of gcc put a space before the `:'. On the theory +## that the space means something, we add a space to the output as +## well. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like `#:fec' to the end of the + # dependency line. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ + tr ' +' ' ' >> $depfile + echo >> $depfile + + # The second pass generates a dummy entry for each header file. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> $depfile + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. In older versions, this file always lives in the + # current directory. Also, the AIX compiler puts `$object:' at the + # start of each line; $object doesn't have directory information. + # Version 6 uses the directory in both cases. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + if test "$libtool" = yes; then + tmpdepfile1=$dir$base.u + tmpdepfile2=$base.u + tmpdepfile3=$dir.libs/$base.u + "$@" -Wc,-M + else + tmpdepfile1=$dir$base.u + tmpdepfile2=$dir$base.u + tmpdepfile3=$dir$base.u + "$@" -M + fi + stat=$? + + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + # Each line is of the form `foo.o: dependent.h'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +icc) + # Intel's C compiler understands `-MD -MF file'. However on + # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c + # ICC 7.0 will fill foo.d with something like + # foo.o: sub/foo.c + # foo.o: sub/foo.h + # which is wrong. We want: + # sub/foo.o: sub/foo.c + # sub/foo.o: sub/foo.h + # sub/foo.c: + # sub/foo.h: + # ICC 7.1 will output + # foo.o: sub/foo.c sub/foo.h + # and will wrap long lines using \ : + # foo.o: sub/foo.c ... \ + # sub/foo.h ... \ + # ... + + "$@" -MD -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each line is of the form `foo.o: dependent.h', + # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | + sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp2) + # The "hp" stanza above does not work with aCC (C++) and HP's ia64 + # compilers, which have integrated preprocessors. The correct option + # to use with these is +Maked; it writes dependencies to a file named + # 'foo.d', which lands next to the object file, wherever that + # happens to be. + # Much of this is similar to the tru64 case; see comments there. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + if test "$libtool" = yes; then + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir.libs/$base.d + "$@" -Wc,+Maked + else + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir$base.d + "$@" +Maked + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" + # Add `dependent.h:' lines. + sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" "$tmpdepfile2" + ;; + +tru64) + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in `foo.d' instead, so we check for that too. + # Subdirectories are respected. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + + if test "$libtool" = yes; then + # With Tru64 cc, shared objects can also be used to make a + # static library. This mechanism is used in libtool 1.4 series to + # handle both shared and static libraries in a single compilation. + # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. + # + # With libtool 1.5 this exception was removed, and libtool now + # generates 2 separate objects for the 2 libraries. These two + # compilations output dependencies in $dir.libs/$base.o.d and + # in $dir$base.o.d. We have to check for both files, because + # one of the two compilations can be disabled. We should prefer + # $dir$base.o.d over $dir.libs/$base.o.d because the latter is + # automatically cleaned when .libs/ is deleted, while ignoring + # the former would cause a distcleancheck panic. + tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 + tmpdepfile2=$dir$base.o.d # libtool 1.5 + tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 + tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 + "$@" -Wc,-MD + else + tmpdepfile1=$dir$base.o.d + tmpdepfile2=$dir$base.d + tmpdepfile3=$dir$base.d + tmpdepfile4=$dir$base.d + "$@" -MD + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + test -z "$dashmflag" && dashmflag=-M + # Require at least two characters before searching for `:' + # in the target name. This is to cope with DOS-style filenames: + # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. + "$@" $dashmflag | + sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + tr ' ' ' +' < "$tmpdepfile" | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +dashXmstdout) + # This case only exists to satisfy depend.m4. It is never actually + # run, as this mode is specially recognized in the preamble. + exit 1 + ;; + +makedepend) + "$@" || exit $? + # Remove any Libtool call + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + # X makedepend + shift + cleared=no + for arg in "$@"; do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + # Strip any option that makedepend may not understand. Remove + # the object too, otherwise makedepend will parse it as a source file. + -*|$object) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix="`echo $object | sed 's/^.*\././'`" + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + sed '1,2d' "$tmpdepfile" | tr ' ' ' +' | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + "$@" -E | + sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ + -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | + sed '$ s: \\$::' > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o, + # because we must use -o when running libtool. + "$@" || exit $? + IFS=" " + for arg + do + case "$arg" in + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) + set fnord "$@" "$arg" + shift + shift + ;; + esac + done + "$@" -E | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" + echo " " >> "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff -ruNp m4-1.4.10/build-aux/gendocs.sh m4-1.4.11/build-aux/gendocs.sh --- m4-1.4.10/build-aux/gendocs.sh 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/build-aux/gendocs.sh 2008-03-10 20:11:15.000000000 -0600 @@ -0,0 +1,346 @@ +#!/bin/sh +# gendocs.sh -- generate a GNU manual in many formats. This script is +# mentioned in maintain.texi. See the help message below for usage details. + +scriptversion=2008-03-05.14 + +# Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 +# 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 . +# +# Original author: Mohit Agarwal. +# Send bug reports and any other correspondence to bug-texinfo@gnu.org. + +prog=`basename "$0"` +srcdir=`pwd` + +scripturl="http://savannah.gnu.org/cgi-bin/viewcvs/~checkout~/texinfo/texinfo/util/gendocs.sh" +templateurl="http://savannah.gnu.org/cgi-bin/viewcvs/~checkout~/texinfo/texinfo/util/gendocs_template" + +: ${SETLANG="env LANG= LC_MESSAGES= LC_ALL= LANGUAGE="} +: ${MAKEINFO="makeinfo"} +: ${TEXI2DVI="texi2dvi -t @finalout"} +: ${DVIPS="dvips"} +: ${DOCBOOK2HTML="docbook2html"} +: ${DOCBOOK2PDF="docbook2pdf"} +: ${DOCBOOK2PS="docbook2ps"} +: ${DOCBOOK2TXT="docbook2txt"} +: ${GENDOCS_TEMPLATE_DIR="."} +: ${TEXI2HTML="texi2html"} +unset CDPATH +unset use_texi2html + +version="gendocs.sh $scriptversion + +Copyright (C) 2007 Free Software Foundation, Inc. +There is NO warranty. You may redistribute this software +under the terms of the GNU General Public License. +For more information about these matters, see the files named COPYING." + +usage="Usage: $prog [OPTION]... PACKAGE MANUAL-TITLE + +Generate various output formats from PACKAGE.texinfo (or .texi or .txi) source. +See the GNU Maintainers document for a more extensive discussion: + http://www.gnu.org/prep/maintain_toc.html + +Options: + -o OUTDIR write files into OUTDIR, instead of manual/. + --docbook convert to DocBook too (xml, txt, html, pdf and ps). + --html ARG pass indicated ARG to makeinfo or texi2html for HTML targets. + --texi2html use texi2html to generate HTML targets. + --help display this help and exit successfully. + --version display version information and exit successfully. + +Simple example: $prog emacs \"GNU Emacs Manual\" + +Typical sequence: + cd YOURPACKAGESOURCE/doc + wget \"$scripturl\" + wget \"$templateurl\" + $prog YOURMANUAL \"GNU YOURMANUAL - One-line description\" + +Output will be in a new subdirectory \"manual\" (by default, use -o OUTDIR +to override). Move all the new files into your web CVS tree, as +explained in the Web Pages node of maintain.texi. + +MANUAL-TITLE is included as part of the HTML of the overall +manual/index.html file. It should include the name of the package being +documented. manual/index.html is created by substitution from the file +$GENDOCS_TEMPLATE_DIR/gendocs_template. (Feel free to modify the +generic template for your own purposes.) + +If you have several manuals, you'll need to run this script several +times with different YOURMANUAL values, specifying a different output +directory with -o each time. Then write (by hand) an overall index.html +with links to them all. + +If a manual's texinfo sources are spread across several directories, +first copy or symlink all Texinfo sources into a single directory. +(Part of the script's work is to make a tar.gz of the sources.) + +You can set the environment variables MAKEINFO, TEXI2DVI, and DVIPS to +control the programs that get executed, and GENDOCS_TEMPLATE_DIR to +control where the gendocs_template file is looked for. (With --docbook, +the environment variables DOCBOOK2HTML, DOCBOOK2PDF, DOCBOOK2PS, and +DOCBOOK2TXT are also respected.) + +By default, makeinfo is run in the default (English) locale, since +that's the language of most Texinfo manuals. If you happen to have a +non-English manual and non-English web site, check the SETLANG setting +in the source. + +Email bug reports or enhancement requests to bug-texinfo@gnu.org. +" + +calcsize() +{ + size=`ls -ksl $1 | awk '{print $1}'` + echo $size +} + +outdir=manual +html= +PACKAGE= +MANUAL_TITLE= + +while test $# -gt 0; do + case $1 in + --help) echo "$usage"; exit 0;; + --version) echo "$version"; exit 0;; + -o) shift; outdir=$1;; + --docbook) docbook=yes;; + --html) shift; html=$1;; + --texi2html) use_texi2html=1;; + -*) + echo "$0: Unknown or ambiguous option \`$1'." >&2 + echo "$0: Try \`--help' for more information." >&2 + exit 1;; + *) + if test -z "$PACKAGE"; then + PACKAGE=$1 + elif test -z "$MANUAL_TITLE"; then + MANUAL_TITLE=$1 + else + echo "$0: extra non-option argument \`$1'." >&2 + exit 1 + fi;; + esac + shift +done + +if test -s "$srcdir/$PACKAGE.texinfo"; then + srcfile=$srcdir/$PACKAGE.texinfo +elif test -s "$srcdir/$PACKAGE.texi"; then + srcfile=$srcdir/$PACKAGE.texi +elif test -s "$srcdir/$PACKAGE.txi"; then + srcfile=$srcdir/$PACKAGE.txi +else + echo "$0: cannot find .texinfo or .texi or .txi for $PACKAGE in $srcdir." >&2 + exit 1 +fi + +if test ! -r $GENDOCS_TEMPLATE_DIR/gendocs_template; then + echo "$0: cannot read $GENDOCS_TEMPLATE_DIR/gendocs_template." >&2 + echo "$0: it is available from $templateurl." >&2 + exit 1 +fi + +echo Generating output formats for $srcfile + +cmd="$SETLANG $MAKEINFO -o $PACKAGE.info \"$srcfile\"" +echo "Generating info files... ($cmd)" +eval "$cmd" +mkdir -p $outdir/ +tar czf $outdir/$PACKAGE.info.tar.gz $PACKAGE.info* +info_tgz_size=`calcsize $outdir/$PACKAGE.info.tar.gz` +# do not mv the info files, there's no point in having them available +# separately on the web. + +cmd="${TEXI2DVI} \"$srcfile\"" +echo "Generating dvi ... ($cmd)" +eval "$cmd" + +# now, before we compress dvi: +echo Generating postscript... +${DVIPS} $PACKAGE -o +gzip -f -9 $PACKAGE.ps +ps_gz_size=`calcsize $PACKAGE.ps.gz` +mv $PACKAGE.ps.gz $outdir/ + +# compress/finish dvi: +gzip -f -9 $PACKAGE.dvi +dvi_gz_size=`calcsize $PACKAGE.dvi.gz` +mv $PACKAGE.dvi.gz $outdir/ + +cmd="${TEXI2DVI} --pdf \"$srcfile\"" +echo "Generating pdf ... ($cmd)" +eval "$cmd" +pdf_size=`calcsize $PACKAGE.pdf` +mv $PACKAGE.pdf $outdir/ + +cmd="$SETLANG $MAKEINFO -o $PACKAGE.txt --no-split --no-headers \"$srcfile\"" +echo "Generating ASCII... ($cmd)" +eval "$cmd" +ascii_size=`calcsize $PACKAGE.txt` +gzip -f -9 -c $PACKAGE.txt >$outdir/$PACKAGE.txt.gz +ascii_gz_size=`calcsize $outdir/$PACKAGE.txt.gz` +mv $PACKAGE.txt $outdir/ + +html_split() { + cmd="$SETLANG $TEXI2HTML --output $PACKAGE.html --split=$1 $html --node-files \"$srcfile\"" + echo "Generating html by $1... ($cmd)" + eval "$cmd" + split_html_dir=$PACKAGE.html + ( + cd ${split_html_dir} || exit 1 + ln -sf ${PACKAGE}.html index.html + tar -czf ../$outdir/${PACKAGE}.html_$1.tar.gz -- *.html + ) + eval html_$1_tgz_size=`calcsize $outdir/${PACKAGE}.html_$1.tar.gz` + rm -f $outdir/html_$1/*.html + mkdir -p $outdir/html_$1/ + mv ${split_html_dir}/*.html $outdir/html_$1/ + rmdir ${split_html_dir} +} + +if test -z "$use_texi2html"; then + cmd="$SETLANG $MAKEINFO --no-split --html -o $PACKAGE.html $html \"$srcfile\"" + echo "Generating monolithic html... ($cmd)" + rm -rf $PACKAGE.html # in case a directory is left over + eval "$cmd" + html_mono_size=`calcsize $PACKAGE.html` + gzip -f -9 -c $PACKAGE.html >$outdir/$PACKAGE.html.gz + html_mono_gz_size=`calcsize $outdir/$PACKAGE.html.gz` + mv $PACKAGE.html $outdir/ + + cmd="$SETLANG $MAKEINFO --html -o $PACKAGE.html $html \"$srcfile\"" + echo "Generating html by node... ($cmd)" + eval "$cmd" + split_html_dir=$PACKAGE.html + ( + cd ${split_html_dir} || exit 1 + tar -czf ../$outdir/${PACKAGE}.html_node.tar.gz -- *.html + ) + html_node_tgz_size=`calcsize $outdir/${PACKAGE}.html_node.tar.gz` + rm -f $outdir/html_node/*.html + mkdir -p $outdir/html_node/ + mv ${split_html_dir}/*.html $outdir/html_node/ + rmdir ${split_html_dir} +else + cmd="$SETLANG $TEXI2HTML --output $PACKAGE.html $html \"$srcfile\"" + echo "Generating monolithic html... ($cmd)" + rm -rf $PACKAGE.html # in case a directory is left over + eval "$cmd" + html_mono_size=`calcsize $PACKAGE.html` + gzip -f -9 -c $PACKAGE.html >$outdir/$PACKAGE.html.gz + html_mono_gz_size=`calcsize $outdir/$PACKAGE.html.gz` + mv $PACKAGE.html $outdir/ + + html_split node + html_split chapter + html_split section +fi + +echo Making .tar.gz for sources... +srcfiles=`ls *.texinfo *.texi *.txi *.eps 2>/dev/null` +tar cvzfh $outdir/$PACKAGE.texi.tar.gz $srcfiles +texi_tgz_size=`calcsize $outdir/$PACKAGE.texi.tar.gz` + +if test -n "$docbook"; then + cmd="$SETLANG $MAKEINFO -o - --docbook \"$srcfile\" > ${srcdir}/$PACKAGE-db.xml" + echo "Generating docbook XML... $(cmd)" + eval "$cmd" + docbook_xml_size=`calcsize $PACKAGE-db.xml` + gzip -f -9 -c $PACKAGE-db.xml >$outdir/$PACKAGE-db.xml.gz + docbook_xml_gz_size=`calcsize $outdir/$PACKAGE-db.xml.gz` + mv $PACKAGE-db.xml $outdir/ + + cmd="${DOCBOOK2HTML} -o $split_html_db_dir ${outdir}/$PACKAGE-db.xml" + echo "Generating docbook HTML... ($cmd)" + eval "$cmd" + split_html_db_dir=html_node_db + ( + cd ${split_html_db_dir} || exit 1 + tar -czf ../$outdir/${PACKAGE}.html_node_db.tar.gz -- *.html + ) + html_node_db_tgz_size=`calcsize $outdir/${PACKAGE}.html_node_db.tar.gz` + rm -f $outdir/html_node_db/*.html + mkdir -p $outdir/html_node_db + mv ${split_html_db_dir}/*.html $outdir/html_node_db/ + rmdir ${split_html_db_dir} + + cmd="${DOCBOOK2TXT} ${outdir}/$PACKAGE-db.xml" + echo "Generating docbook ASCII... ($cmd)" + eval "$cmd" + docbook_ascii_size=`calcsize $PACKAGE-db.txt` + mv $PACKAGE-db.txt $outdir/ + + cmd="${DOCBOOK2PS} ${outdir}/$PACKAGE-db.xml" + echo "Generating docbook PS... $(cmd)" + eval "$cmd" + gzip -f -9 -c $PACKAGE-db.ps >$outdir/$PACKAGE-db.ps.gz + docbook_ps_gz_size=`calcsize $outdir/$PACKAGE-db.ps.gz` + mv $PACKAGE-db.ps $outdir/ + + cmd="${DOCBOOK2PDF} ${outdir}/$PACKAGE-db.xml" + echo "Generating docbook PDF... ($cmd)" + eval "$cmd" + docbook_pdf_size=`calcsize $PACKAGE-db.pdf` + mv $PACKAGE-db.pdf $outdir/ +fi + +echo Writing index file... +if test -z "$use_texi2html"; then + CONDS="/%%IF *HTML_SECTION%%/,/%%ENDIF *HTML_SECTION%%/d;\ + /%%IF *HTML_CHAPTER%%/,/%%ENDIF *HTML_CHAPTER%%/d" +else + CONDS="/%%ENDIF.*%%/d;/%%IF *HTML_SECTION%%/d;/%%IF *HTML_CHAPTER%%/d" +fi +curdate=`$SETLANG date '+%B %d, %Y'` +sed \ + -e "s!%%TITLE%%!$MANUAL_TITLE!g" \ + -e "s!%%DATE%%!$curdate!g" \ + -e "s!%%PACKAGE%%!$PACKAGE!g" \ + -e "s!%%HTML_MONO_SIZE%%!$html_mono_size!g" \ + -e "s!%%HTML_MONO_GZ_SIZE%%!$html_mono_gz_size!g" \ + -e "s!%%HTML_NODE_TGZ_SIZE%%!$html_node_tgz_size!g" \ + -e "s!%%HTML_SECTION_TGZ_SIZE%%!$html_section_tgz_size!g" \ + -e "s!%%HTML_CHAPTER_TGZ_SIZE%%!$html_chapter_tgz_size!g" \ + -e "s!%%INFO_TGZ_SIZE%%!$info_tgz_size!g" \ + -e "s!%%DVI_GZ_SIZE%%!$dvi_gz_size!g" \ + -e "s!%%PDF_SIZE%%!$pdf_size!g" \ + -e "s!%%PS_GZ_SIZE%%!$ps_gz_size!g" \ + -e "s!%%ASCII_SIZE%%!$ascii_size!g" \ + -e "s!%%ASCII_GZ_SIZE%%!$ascii_gz_size!g" \ + -e "s!%%TEXI_TGZ_SIZE%%!$texi_tgz_size!g" \ + -e "s!%%DOCBOOK_HTML_NODE_TGZ_SIZE%%!$html_node_db_tgz_size!g" \ + -e "s!%%DOCBOOK_ASCII_SIZE%%!$docbook_ascii_size!g" \ + -e "s!%%DOCBOOK_PS_GZ_SIZE%%!$docbook_ps_gz_size!g" \ + -e "s!%%DOCBOOK_PDF_SIZE%%!$docbook_pdf_size!g" \ + -e "s!%%DOCBOOK_XML_SIZE%%!$docbook_xml_size!g" \ + -e "s!%%DOCBOOK_XML_GZ_SIZE%%!$docbook_xml_gz_size!g" \ + -e "s,%%SCRIPTURL%%,$scripturl,g" \ + -e "s!%%SCRIPTNAME%%!$prog!g" \ + -e "$CONDS" \ +$GENDOCS_TEMPLATE_DIR/gendocs_template >$outdir/index.html + +echo "Done! See $outdir/ subdirectory for new files." + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff -ruNp m4-1.4.10/build-aux/git-version-gen m4-1.4.11/build-aux/git-version-gen --- m4-1.4.10/build-aux/git-version-gen 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/build-aux/git-version-gen 2008-03-10 20:11:16.000000000 -0600 @@ -0,0 +1,109 @@ +#!/bin/sh +# Print a version string. +scriptversion=2008-03-02.16 + +# Copyright (C) 2007 Free Software Foundation +# +# 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, 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, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. + +# This script is derived from GIT-VERSION-GEN from GIT: http://git.or.cz/. +# It may be run two ways: +# - from a git repository in which the "git describe" command below +# produces useful output (thus requiring at least one signed tag) +# - from a non-git-repo directory containing a .tarball-version file, which +# presumes this script is invoked like "./git-version-gen .tarball-version". + +case $# in + 1) ;; + *) echo 1>&2 "Usage: $0 \$srcdir/.tarball-version"; exit 1;; +esac + +tarball_version_file=$1 +nl=' +' + +# First see if there is a tarball-only version file. +# then try "git describe", then default. +if test -f $tarball_version_file +then + v=`cat $tarball_version_file` || exit 1 + case $v in + *$nl*) v= ;; # reject multi-line output + [0-9]*) ;; + *) v= ;; + esac + test -z "$v" \ + && echo "$0: WARNING: $tarball_version_file seems to be damaged" 1>&2 +fi + +if test -n "$v" +then + : # use $v +elif test -d .git \ + && v=`git describe --abbrev=4 HEAD 2>/dev/null` \ + && case $v in + v[0-9]*) ;; + *) (exit 1) ;; + esac +then + # Is this a new git that lists number of commits since the last + # tag or the previous older version that did not? + # Newer: v6.10-77-g0f8faeb + # Older: v6.10-g0f8faeb + case $v in + *-*-*) : git describe is okay three part flavor ;; + *-*) + : git describe is older two part flavor + # Recreate the number of commits and rewrite such that the + # result is the same as if we were using the newer version + # of git describe. + vtag=`echo "$v" | sed 's/-.*//'` + numcommits=`git rev-list "$vtag"..HEAD | wc -l` + v=`echo "$v" | sed "s/\(.*\)-\(.*\)/\1-$numcommits-\2/"`; + ;; + esac + + # Change the first '-' to a '.', so version-comparing tools work properly. + # Remove the "g" in git describe's output string, to save a byte. + v=`echo "$v" | sed 's/-/./;s/\(.*\)-g/\1-/'`; +else + v=UNKNOWN +fi + +v=`echo "$v" |sed 's/^v//'` + +# Don't declare a version "dirty" merely because a time stamp has changed. +git status > /dev/null 2>&1 + +dirty=`sh -c 'git diff-index --name-only HEAD' 2>/dev/null` || dirty= +case "$dirty" in + '') ;; + *) # Append the suffix only if there isn't one already. + case $v in + *-dirty) ;; + *) v="$v-dirty" ;; + esac ;; +esac + +# Omit the trailing newline, so that m4_esyscmd can use the result directly. +echo "$v" | tr -d '\012' + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff -ruNp m4-1.4.10/build-aux/gnupload m4-1.4.11/build-aux/gnupload --- m4-1.4.10/build-aux/gnupload 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/build-aux/gnupload 2008-01-26 16:04:12.000000000 -0700 @@ -0,0 +1,183 @@ +#!/bin/sh +# Sign files and upload them. + +scriptversion=2007-12-18.17 + +# Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation +# +# 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, 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/>. + +# Originally written by Alexandre Duret-Lutz <adl@gnu.org>. + +set -e + +GPG='gpg --batch --no-tty' +to= + +usage="Usage: $0 [OPTIONS]... FILES... + +Sign all FILES, and upload them to selected destinations, according to +<http://www.gnu.org/prep/maintain/html_node/Automated-FTP-Uploads.html>. + +Options: + --help print this help text and exit + --to DEST specify one destination for FILES + (multiple --to options are allowed) + --user NAME sign with key NAME + --version output version information and exit + +Recognized destinations are: + alpha.gnu.org:DIRECTORY + savannah.gnu.org:DIRECTORY + savannah.nongnu.org:DIRECTORY + ftp.gnu.org:DIRECTORY + build directive files and upload files by FTP + [user@]host:DIRECTORY upload files with scp + +Example: + gnupload --to sources.redhat.com:~ftp/pub/automake \\ + --to alpha.gnu.org:automake \\ + automake-1.8.2b.tar.gz automake-1.8.2b.tar.bz2 + +Report bugs to <bug-automake@gnu.org>. +Send patches to <automake-patches@gnu.org>." + +while test -n "$1"; do + case $1 in + --help) + echo "$usage" + exit $? + ;; + --to) + if test -z "$2"; then + echo "$0: Missing argument for --to" 1>&2 + exit 1 + else + to="$to $2" + shift 2 + fi + ;; + --user) + if test -z "$2"; then + echo "$0: Missing argument for --user" 1>&2 + exit 1 + else + GPG="$GPG --local-user $2" + shift 2 + fi + ;; + --version) + echo "gnupload $scriptversion" + exit $? + ;; + -*) + echo "$0: Unknown option \`$1', try \`$0 --help'" 1>&2 + exit 1 + ;; + *) + break + ;; + esac +done + +if test $# = 0; then + echo "$0: No file to upload" 1>&2 + exit 1 +else + : +fi + +# Make sure all files exist. We don't want to ask +# for the passphrase if the script will fail. +for file +do + if test ! -f $file; then + echo "$0: Cannot find \`$file'" 1>&2 + exit 1 + else + : + fi +done + +# Make sure passphrase is not exported in the environment. +unset passphrase + +# Reset PATH to be sure that echo is a built-in. We will later use +# `echo $passphrase' to output the passphrase, so it is important that +# it is a built-in (third-party programs tend to appear in `ps' +# listings with their arguments...). +# Remember this script runs with `set -e', so if echo is not built-in +# it will exit now. +PATH=/empty echo -n "Enter GPG passphrase: " +stty -echo +read -r passphrase +stty echo +echo + +for file +do + echo "Signing $file..." + rm -f $file.sig + echo $passphrase | $GPG --passphrase-fd 0 -ba -o $file.sig $file +done + +for dest in $to +do + for file + do + echo "Uploading $file to $dest..." + files="$file $file.sig" + destdir=`echo $dest | sed 's/[^:]*://'` + case $dest in + alpha.gnu.org:*) + rm -f $file.directive $file.directive.asc + cat >$file.directive<<EOF +version: 1.1 +directory: $destdir +filename: $file +EOF + echo "$passphrase" | $GPG --passphrase-fd 0 --clearsign $file.directive + ncftpput ftp-upload.gnu.org /incoming/alpha $files $file.directive.asc + rm -f $file.directive $file.directive.asc + ;; + ftp.gnu.org:*) + rm -f $file.directive $file.directive.asc + cat >$file.directive<<EOF +version: 1.1 +directory: $destdir +filename: $file +EOF + echo "$passphrase" | $GPG --passphrase-fd 0 --clearsign $file.directive + ncftpput ftp-upload.gnu.org /incoming/ftp $files $file.directive.asc + rm -f $file.directive $file.directive.asc + ;; + savannah.gnu.org:*) + ncftpput savannah.gnu.org /incoming/savannah/$destdir $files + ;; + savannah.nongnu.org:*) + ncftpput savannah.nongnu.org /incoming/savannah/$destdir $files + ;; + *) + scp $files $dest + ;; + esac + done +done + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff -ruNp m4-1.4.10/build-aux/install-sh m4-1.4.11/build-aux/install-sh --- m4-1.4.10/build-aux/install-sh 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/build-aux/install-sh 2008-04-02 06:45:27.000000000 -0600 @@ -0,0 +1,519 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2006-12-25.00 + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. + +nl=' +' +IFS=" "" $nl" + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit=${DOITPROG-} +if test -z "$doit"; then + doit_exec=exec +else + doit_exec=$doit +fi + +# Put in absolute file names if you don't have them in your path; +# or use environment vars. + +chgrpprog=${CHGRPPROG-chgrp} +chmodprog=${CHMODPROG-chmod} +chownprog=${CHOWNPROG-chown} +cmpprog=${CMPPROG-cmp} +cpprog=${CPPROG-cp} +mkdirprog=${MKDIRPROG-mkdir} +mvprog=${MVPROG-mv} +rmprog=${RMPROG-rm} +stripprog=${STRIPPROG-strip} + +posix_glob='?' +initialize_posix_glob=' + test "$posix_glob" != "?" || { + if (set -f) 2>/dev/null; then + posix_glob= + else + posix_glob=: + fi + } +' + +posix_mkdir= + +# Desired mode of installed file. +mode=0755 + +chgrpcmd= +chmodcmd=$chmodprog +chowncmd= +mvcmd=$mvprog +rmcmd="$rmprog -f" +stripcmd= + +src= +dst= +dir_arg= +dst_arg= + +copy_on_change=false +no_target_directory= + +usage="\ +Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: + --help display this help and exit. + --version display version info and exit. + + -c (ignored) + -C install only if different (preserve the last data modification time) + -d create directories instead of installing files. + -g GROUP $chgrpprog installed files to GROUP. + -m MODE $chmodprog installed files to MODE. + -o USER $chownprog installed files to USER. + -s $stripprog installed files. + -t DIRECTORY install into DIRECTORY. + -T report an error if DSTFILE is a directory. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG + RMPROG STRIPPROG +" + +while test $# -ne 0; do + case $1 in + -c) ;; + + -C) copy_on_change=true;; + + -d) dir_arg=true;; + + -g) chgrpcmd="$chgrpprog $2" + shift;; + + --help) echo "$usage"; exit $?;; + + -m) mode=$2 + case $mode in + *' '* | *' '* | *' +'* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; + + -o) chowncmd="$chownprog $2" + shift;; + + -s) stripcmd=$stripprog;; + + -t) dst_arg=$2 + shift;; + + -T) no_target_directory=true;; + + --version) echo "$0 $scriptversion"; exit $?;; + + --) shift + break;; + + -*) echo "$0: invalid option: $1" >&2 + exit 1;; + + *) break;; + esac + shift +done + +if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then + # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dst_arg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dst_arg" + shift # fnord + fi + shift # arg + dst_arg=$arg + done +fi + +if test $# -eq 0; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call `install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +if test -z "$dir_arg"; then + trap '(exit $?); exit' 1 2 13 15 + + # Set umask so as not to create temps with too-generous modes. + # However, 'strip' requires both read and write access to temps. + case $mode in + # Optimize common cases. + *644) cp_umask=133;; + *755) cp_umask=22;; + + *[0-7]) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw='% 200' + fi + cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; + *) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw=,u+rw + fi + cp_umask=$mode$u_plus_rw;; + esac +fi + +for src +do + # Protect names starting with `-'. + case $src in + -*) src=./$src;; + esac + + if test -n "$dir_arg"; then + dst=$src + dstdir=$dst + test -d "$dstdir" + dstdir_status=$? + else + + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dst_arg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + + dst=$dst_arg + # Protect names starting with `-'. + case $dst in + -*) dst=./$dst;; + esac + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test -n "$no_target_directory"; then + echo "$0: $dst_arg: Is a directory" >&2 + exit 1 + fi + dstdir=$dst + dst=$dstdir/`basename "$src"` + dstdir_status=0 + else + # Prefer dirname, but fall back on a substitute if dirname fails. + dstdir=` + (dirname "$dst") 2>/dev/null || + expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$dst" : 'X\(//\)[^/]' \| \ + X"$dst" : 'X\(//\)$' \| \ + X"$dst" : 'X\(/\)' \| . 2>/dev/null || + echo X"$dst" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q' + ` + + test -d "$dstdir" + dstdir_status=$? + fi + fi + + obsolete_mkdir_used=false + + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # Create intermediate dirs using mode 755 as modified by the umask. + # This is like FreeBSD 'install' as of 1997-10-28. + umask=`umask` + case $stripcmd.$umask in + # Optimize common cases. + *[2367][2367]) mkdir_umask=$umask;; + .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; + + *[0-7]) + mkdir_umask=`expr $umask + 22 \ + - $umask % 100 % 40 + $umask % 20 \ + - $umask % 10 % 4 + $umask % 2 + `;; + *) mkdir_umask=$umask,go-w;; + esac + + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi + + posix_mkdir=false + case $umask in + *[123567][0-7][0-7]) + # POSIX mkdir -p sets u+wx bits regardless of umask, which + # is incompatible with FreeBSD 'install' when (umask & 300) != 0. + ;; + *) + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 + + if (umask $mkdir_umask && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writeable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + ls_ld_tmpdir=`ls -ld "$tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/d" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null + fi + trap '' 0;; + esac;; + esac + + if + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else + + # The umask is ridiculous, or mkdir does not conform to POSIX, + # or it failed possibly due to a race condition. Create the + # directory the slow way, step by step, checking for races as we go. + + case $dstdir in + /*) prefix='/';; + -*) prefix='./';; + *) prefix='';; + esac + + eval "$initialize_posix_glob" + + oIFS=$IFS + IFS=/ + $posix_glob set -f + set fnord $dstdir + shift + $posix_glob set +f + IFS=$oIFS + + prefixes= + + for d + do + test -z "$d" && continue + + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask=$mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ + done + + if test -n "$prefixes"; then + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true + fi + fi + fi + + if test -n "$dir_arg"; then + { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && + { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || + test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 + else + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + + # Copy the file name to the temp name. + (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && + { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && + { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && + + # If -C, don't bother to copy if it wouldn't change the file. + if $copy_on_change && + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && + + eval "$initialize_posix_glob" && + $posix_glob set -f && + set X $old && old=:$2:$4:$5:$6 && + set X $new && new=:$2:$4:$5:$6 && + $posix_glob set +f && + + test "$old" = "$new" && + $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 + then + rm -f "$dsttmp" + else + # Rename the file to the real destination. + $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || + + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + { + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + test ! -f "$dst" || + $doit $rmcmd -f "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } + } || + { echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" + } + fi || exit 1 + + trap '' 0 + fi +done + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff -ruNp m4-1.4.10/build-aux/link-warning.h m4-1.4.11/build-aux/link-warning.h --- m4-1.4.10/build-aux/link-warning.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/build-aux/link-warning.h 2007-11-03 11:13:05.000000000 -0600 @@ -0,0 +1,28 @@ +/* GL_LINK_WARNING("literal string") arranges to emit the literal string as + a linker warning on most glibc systems. + We use a linker warning rather than a preprocessor warning, because + #warning cannot be used inside macros. */ +#ifndef GL_LINK_WARNING + /* This works on platforms with GNU ld and ELF object format. + Testing __GLIBC__ is sufficient for asserting that GNU ld is in use. + Testing __ELF__ guarantees the ELF object format. + Testing __GNUC__ is necessary for the compound expression syntax. */ +# if defined __GLIBC__ && defined __ELF__ && defined __GNUC__ +# define GL_LINK_WARNING(message) \ + GL_LINK_WARNING1 (__FILE__, __LINE__, message) +# define GL_LINK_WARNING1(file, line, message) \ + GL_LINK_WARNING2 (file, line, message) /* macroexpand file and line */ +# define GL_LINK_WARNING2(file, line, message) \ + GL_LINK_WARNING3 (file ":" #line ": warning: " message) +# define GL_LINK_WARNING3(message) \ + ({ static const char warning[sizeof (message)] \ + __attribute__ ((__unused__, \ + __section__ (".gnu.warning"), \ + __aligned__ (1))) \ + = message "\n"; \ + (void)0; \ + }) +# else +# define GL_LINK_WARNING(message) ((void) 0) +# endif +#endif diff -ruNp m4-1.4.10/build-aux/mdate-sh m4-1.4.11/build-aux/mdate-sh --- m4-1.4.10/build-aux/mdate-sh 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/build-aux/mdate-sh 2008-04-02 06:45:31.000000000 -0600 @@ -0,0 +1,204 @@ +#!/bin/sh +# Get modification time of a file or directory and pretty-print it. + +scriptversion=2007-03-30.02 + +# Copyright (C) 1995, 1996, 1997, 2003, 2004, 2005, 2007 Free Software +# Foundation, Inc. +# written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, June 1995 +# +# 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, 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/>. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to <bug-automake@gnu.org> or send patches to +# <automake-patches@gnu.org>. + +case $1 in + '') + echo "$0: No file. Try \`$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: mdate-sh [--help] [--version] FILE + +Pretty-print the modification time of FILE. + +Report bugs to <bug-automake@gnu.org>. +EOF + exit $? + ;; + -v | --v*) + echo "mdate-sh $scriptversion" + exit $? + ;; +esac + +# Prevent date giving response in another language. +LANG=C +export LANG +LC_ALL=C +export LC_ALL +LC_TIME=C +export LC_TIME + +# GNU ls changes its time format in response to the TIME_STYLE +# variable. Since we cannot assume `unset' works, revert this +# variable to its documented default. +if test "${TIME_STYLE+set}" = set; then + TIME_STYLE=posix-long-iso + export TIME_STYLE +fi + +save_arg1=$1 + +# Find out how to get the extended ls output of a file or directory. +if ls -L /dev/null 1>/dev/null 2>&1; then + ls_command='ls -L -l -d' +else + ls_command='ls -l -d' +fi +# Avoid user/group names that might have spaces, when possible. +if ls -n /dev/null 1>/dev/null 2>&1; then + ls_command="$ls_command -n" +fi + +# A `ls -l' line looks as follows on OS/2. +# drwxrwx--- 0 Aug 11 2001 foo +# This differs from Unix, which adds ownership information. +# drwxrwx--- 2 root root 4096 Aug 11 2001 foo +# +# To find the date, we split the line on spaces and iterate on words +# until we find a month. This cannot work with files whose owner is a +# user named `Jan', or `Feb', etc. However, it's unlikely that `/' +# will be owned by a user whose name is a month. So we first look at +# the extended ls output of the root directory to decide how many +# words should be skipped to get the date. + +# On HPUX /bin/sh, "set" interprets "-rw-r--r--" as options, so the "x" below. +set x`$ls_command /` + +# Find which argument is the month. +month= +command= +until test $month +do + shift + # Add another shift to the command. + command="$command shift;" + case $1 in + Jan) month=January; nummonth=1;; + Feb) month=February; nummonth=2;; + Mar) month=March; nummonth=3;; + Apr) month=April; nummonth=4;; + May) month=May; nummonth=5;; + Jun) month=June; nummonth=6;; + Jul) month=July; nummonth=7;; + Aug) month=August; nummonth=8;; + Sep) month=September; nummonth=9;; + Oct) month=October; nummonth=10;; + Nov) month=November; nummonth=11;; + Dec) month=December; nummonth=12;; + esac +done + +# Get the extended ls output of the file or directory. +set dummy x`eval "$ls_command \"\$save_arg1\""` + +# Remove all preceding arguments +eval $command + +# Because of the dummy argument above, month is in $2. +# +# On a POSIX system, we should have +# +# $# = 5 +# $1 = file size +# $2 = month +# $3 = day +# $4 = year or time +# $5 = filename +# +# On Darwin 7.7.0 and 7.6.0, we have +# +# $# = 4 +# $1 = day +# $2 = month +# $3 = year or time +# $4 = filename + +# Get the month. +case $2 in + Jan) month=January; nummonth=1;; + Feb) month=February; nummonth=2;; + Mar) month=March; nummonth=3;; + Apr) month=April; nummonth=4;; + May) month=May; nummonth=5;; + Jun) month=June; nummonth=6;; + Jul) month=July; nummonth=7;; + Aug) month=August; nummonth=8;; + Sep) month=September; nummonth=9;; + Oct) month=October; nummonth=10;; + Nov) month=November; nummonth=11;; + Dec) month=December; nummonth=12;; +esac + +case $3 in + ???*) day=$1;; + *) day=$3; shift;; +esac + +# Here we have to deal with the problem that the ls output gives either +# the time of day or the year. +case $3 in + *:*) set `date`; eval year=\$$# + case $2 in + Jan) nummonthtod=1;; + Feb) nummonthtod=2;; + Mar) nummonthtod=3;; + Apr) nummonthtod=4;; + May) nummonthtod=5;; + Jun) nummonthtod=6;; + Jul) nummonthtod=7;; + Aug) nummonthtod=8;; + Sep) nummonthtod=9;; + Oct) nummonthtod=10;; + Nov) nummonthtod=11;; + Dec) nummonthtod=12;; + esac + # For the first six month of the year the time notation can also + # be used for files modified in the last year. + if (expr $nummonth \> $nummonthtod) > /dev/null; + then + year=`expr $year - 1` + fi;; + *) year=$3;; +esac + +# The result. +echo $day $month $year + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff -ruNp m4-1.4.10/build-aux/missing m4-1.4.11/build-aux/missing --- m4-1.4.10/build-aux/missing 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/build-aux/missing 2008-04-02 06:45:31.000000000 -0600 @@ -0,0 +1,365 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. + +scriptversion=2006-05-10.23 + +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006 +# Free Software Foundation, Inc. +# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. + +# 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, 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/>. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +run=: +sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' +sed_minuso='s/.* -o \([^ ]*\).*/\1/p' + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +msg="missing on your system" + +case $1 in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + # Exit code 63 means version mismatch. This often happens + # when the user try to use an ancient version of a tool on + # a file that requires a minimum version. In this case we + # we should proceed has if the program had been absent, or + # if --run hadn't been passed. + if test $? = 63; then + run=: + msg="probably too old" + fi + ;; + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + autom4te touch the output file, or create a stub one + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + tar try tar, gnutar, gtar, then tar without non-portable flags + yacc create \`y.tab.[ch]', if possible, from existing .[ch] + +Send bug reports to <bug-automake@gnu.org>." + exit $? + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing $scriptversion (GNU Automake)" + exit $? + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + +esac + +# Now exit if we have it, but it failed. Also exit now if we +# don't have it and --version was passed (most likely to detect +# the program). +case $1 in + lex|yacc) + # Not GNU programs, they don't have --version. + ;; + + tar) + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + exit 1 + fi + ;; + + *) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + # Could not run --version or --help. This is probably someone + # running `$TOOL --version' or `$TOOL --help' to check whether + # $TOOL exists and not knowing $TOOL uses missing. + exit 1 + fi + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case $1 in + aclocal*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case $f in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + autom4te) + echo 1>&2 "\ +WARNING: \`$1' is needed, but is $msg. + You might have modified some files without having the + proper tools for further handling them. + You can get \`$1' as part of \`Autoconf' from any GNU + archive site." + + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo "#! /bin/sh" + echo "# Created by GNU Automake missing as a replacement of" + echo "# $ $@" + echo "exit 0" + chmod +x $file + exit 1 + fi + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' $msg. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if test $# -ne 1; then + eval LASTARG="\${$#}" + case $LASTARG in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if test ! -f y.tab.h; then + echo >y.tab.h + fi + if test ! -f y.tab.c; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if test $# -ne 1; then + eval LASTARG="\${$#}" + case $LASTARG in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if test ! -f lex.yy.c; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + help2man) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit 1 + fi + ;; + + makeinfo) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + # The file to touch is that specified with -o ... + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -z "$file"; then + # ... or it is the one specified with @setfilename ... + infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n ' + /^@setfilename/{ + s/.* \([^ ]*\) *$/\1/ + p + q + }' $infile` + # ... or it is derived from the source name (dir/f.texi becomes f.info) + test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info + fi + # If the file does not exist, the user really needs makeinfo; + # let's fail without touching anything. + test -f $file || exit 1 + touch $file + ;; + + tar) + shift + + # We have already tried tar in the generic part. + # Look for gnutar/gtar before invocation to avoid ugly error + # messages. + if (gnutar --version > /dev/null 2>&1); then + gnutar "$@" && exit 0 + fi + if (gtar --version > /dev/null 2>&1); then + gtar "$@" && exit 0 + fi + firstarg="$1" + if shift; then + case $firstarg in + *o*) + firstarg=`echo "$firstarg" | sed s/o//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + case $firstarg in + *h*) + firstarg=`echo "$firstarg" | sed s/h//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + fi + + echo 1>&2 "\ +WARNING: I can't seem to be able to run \`tar' with the given arguments. + You may want to install GNU tar or Free paxutils, or check the + command line arguments." + exit 1 + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and is $msg. + You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequisites for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff -ruNp m4-1.4.10/build-aux/texinfo.tex m4-1.4.11/build-aux/texinfo.tex --- m4-1.4.10/build-aux/texinfo.tex 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/build-aux/texinfo.tex 2008-04-02 06:45:31.000000000 -0600 @@ -0,0 +1,8985 @@ +% texinfo.tex -- TeX macros to handle Texinfo files. +% +% Load plain if necessary, i.e., if running under initex. +\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi +% +\def\texinfoversion{2008-03-31.10} +% +% Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, +% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +% 2007, 2008 Free Software Foundation, Inc. +% +% This texinfo.tex file 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 texinfo.tex file 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/>. +% +% As a special exception, when this file is read by TeX when processing +% a Texinfo source document, you may use the result without +% restriction. (This has been our intent since Texinfo was invented.) +% +% Please try the latest version of texinfo.tex before submitting bug +% reports; you can get the latest version from: +% http://www.gnu.org/software/texinfo/ (the Texinfo home page), or +% ftp://tug.org/tex/texinfo.tex +% (and all CTAN mirrors, see http://www.ctan.org). +% The texinfo.tex in any given distribution could well be out +% of date, so if that's what you're using, please check. +% +% Send bug reports to bug-texinfo@gnu.org. Please include including a +% complete document in each bug report with which we can reproduce the +% problem. Patches are, of course, greatly appreciated. +% +% To process a Texinfo manual with TeX, it's most reliable to use the +% texi2dvi shell script that comes with the distribution. For a simple +% manual foo.texi, however, you can get away with this: +% tex foo.texi +% texindex foo.?? +% tex foo.texi +% tex foo.texi +% dvips foo.dvi -o # or whatever; this makes foo.ps. +% The extra TeX runs get the cross-reference information correct. +% Sometimes one run after texindex suffices, and sometimes you need more +% than two; texi2dvi does it as many times as necessary. +% +% It is possible to adapt texinfo.tex for other languages, to some +% extent. You can get the existing language-specific files from the +% full Texinfo distribution. +% +% The GNU Texinfo home page is http://www.gnu.org/software/texinfo. + + +\message{Loading texinfo [version \texinfoversion]:} + +% If in a .fmt file, print the version number +% and turn on active characters that we couldn't do earlier because +% they might have appeared in the input file name. +\everyjob{\message{[Texinfo version \texinfoversion]}% + \catcode`+=\active \catcode`\_=\active} + + +\chardef\other=12 + +% We never want plain's \outer definition of \+ in Texinfo. +% For @tex, we can use \tabalign. +\let\+ = \relax + +% Save some plain tex macros whose names we will redefine. +\let\ptexb=\b +\let\ptexbullet=\bullet +\let\ptexc=\c +\let\ptexcomma=\, +\let\ptexdot=\. +\let\ptexdots=\dots +\let\ptexend=\end +\let\ptexequiv=\equiv +\let\ptexexclam=\! +\let\ptexfootnote=\footnote +\let\ptexgtr=> +\let\ptexhat=^ +\let\ptexi=\i +\let\ptexindent=\indent +\let\ptexinsert=\insert +\let\ptexlbrace=\{ +\let\ptexless=< +\let\ptexnewwrite\newwrite +\let\ptexnoindent=\noindent +\let\ptexplus=+ +\let\ptexrbrace=\} +\let\ptexslash=\/ +\let\ptexstar=\* +\let\ptext=\t +\let\ptextop=\top + +% If this character appears in an error message or help string, it +% starts a new line in the output. +\newlinechar = `^^J + +% Use TeX 3.0's \inputlineno to get the line number, for better error +% messages, but if we're using an old version of TeX, don't do anything. +% +\ifx\inputlineno\thisisundefined + \let\linenumber = \empty % Pre-3.0. +\else + \def\linenumber{l.\the\inputlineno:\space} +\fi + +% Set up fixed words for English if not already set. +\ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi +\ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi +\ifx\putwordfile\undefined \gdef\putwordfile{file}\fi +\ifx\putwordin\undefined \gdef\putwordin{in}\fi +\ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi +\ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi +\ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi +\ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi +\ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi +\ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi +\ifx\putwordof\undefined \gdef\putwordof{of}\fi +\ifx\putwordon\undefined \gdef\putwordon{on}\fi +\ifx\putwordpage\undefined \gdef\putwordpage{page}\fi +\ifx\putwordsection\undefined \gdef\putwordsection{section}\fi +\ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi +\ifx\putwordsee\undefined \gdef\putwordsee{see}\fi +\ifx\putwordSee\undefined \gdef\putwordSee{See}\fi +\ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi +\ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi +% +\ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi +\ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi +\ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi +\ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi +\ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi +\ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi +\ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi +\ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi +\ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi +\ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi +\ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi +\ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi +% +\ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi +\ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi +\ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi +\ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi +\ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi + +% Since the category of space is not known, we have to be careful. +\chardef\spacecat = 10 +\def\spaceisspace{\catcode`\ =\spacecat} + +% sometimes characters are active, so we need control sequences. +\chardef\colonChar = `\: +\chardef\commaChar = `\, +\chardef\dashChar = `\- +\chardef\dotChar = `\. +\chardef\exclamChar= `\! +\chardef\lquoteChar= `\` +\chardef\questChar = `\? +\chardef\rquoteChar= `\' +\chardef\semiChar = `\; +\chardef\underChar = `\_ + +% Ignore a token. +% +\def\gobble#1{} + +% The following is used inside several \edef's. +\def\makecsname#1{\expandafter\noexpand\csname#1\endcsname} + +% Hyphenation fixes. +\hyphenation{ + Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script + ap-pen-dix bit-map bit-maps + data-base data-bases eshell fall-ing half-way long-est man-u-script + man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm + par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces + spell-ing spell-ings + stand-alone strong-est time-stamp time-stamps which-ever white-space + wide-spread wrap-around +} + +% Margin to add to right of even pages, to left of odd pages. +\newdimen\bindingoffset +\newdimen\normaloffset +\newdimen\pagewidth \newdimen\pageheight + +% For a final copy, take out the rectangles +% that mark overfull boxes (in case you have decided +% that the text looks ok even though it passes the margin). +% +\def\finalout{\overfullrule=0pt} + +% @| inserts a changebar to the left of the current line. It should +% surround any changed text. This approach does *not* work if the +% change spans more than two lines of output. To handle that, we would +% have adopt a much more difficult approach (putting marks into the main +% vertical list for the beginning and end of each change). +% +\def\|{% + % \vadjust can only be used in horizontal mode. + \leavevmode + % + % Append this vertical mode material after the current line in the output. + \vadjust{% + % We want to insert a rule with the height and depth of the current + % leading; that is exactly what \strutbox is supposed to record. + \vskip-\baselineskip + % + % \vadjust-items are inserted at the left edge of the type. So + % the \llap here moves out into the left-hand margin. + \llap{% + % + % For a thicker or thinner bar, change the `1pt'. + \vrule height\baselineskip width1pt + % + % This is the space between the bar and the text. + \hskip 12pt + }% + }% +} + +% Sometimes it is convenient to have everything in the transcript file +% and nothing on the terminal. We don't just call \tracingall here, +% since that produces some useless output on the terminal. We also make +% some effort to order the tracing commands to reduce output in the log +% file; cf. trace.sty in LaTeX. +% +\def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}% +\def\loggingall{% + \tracingstats2 + \tracingpages1 + \tracinglostchars2 % 2 gives us more in etex + \tracingparagraphs1 + \tracingoutput1 + \tracingmacros2 + \tracingrestores1 + \showboxbreadth\maxdimen \showboxdepth\maxdimen + \ifx\eTeXversion\undefined\else % etex gives us more logging + \tracingscantokens1 + \tracingifs1 + \tracinggroups1 + \tracingnesting2 + \tracingassigns1 + \fi + \tracingcommands3 % 3 gives us more in etex + \errorcontextlines16 +}% + +% add check for \lastpenalty to plain's definitions. If the last thing +% we did was a \nobreak, we don't want to insert more space. +% +\def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount + \removelastskip\penalty-50\smallskip\fi\fi} +\def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount + \removelastskip\penalty-100\medskip\fi\fi} +\def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount + \removelastskip\penalty-200\bigskip\fi\fi} + +% For @cropmarks command. +% Do @cropmarks to get crop marks. +% +\newif\ifcropmarks +\let\cropmarks = \cropmarkstrue +% +% Dimensions to add cropmarks at corners. +% Added by P. A. MacKay, 12 Nov. 1986 +% +\newdimen\outerhsize \newdimen\outervsize % set by the paper size routines +\newdimen\cornerlong \cornerlong=1pc +\newdimen\cornerthick \cornerthick=.3pt +\newdimen\topandbottommargin \topandbottommargin=.75in + +% Output a mark which sets \thischapter, \thissection and \thiscolor. +% We dump everything together because we only have one kind of mark. +% This works because we only use \botmark / \topmark, not \firstmark. +% +% A mark contains a subexpression of the \ifcase ... \fi construct. +% \get*marks macros below extract the needed part using \ifcase. +% +% Another complication is to let the user choose whether \thischapter +% (\thissection) refers to the chapter (section) in effect at the top +% of a page, or that at the bottom of a page. The solution is +% described on page 260 of The TeXbook. It involves outputting two +% marks for the sectioning macros, one before the section break, and +% one after. I won't pretend I can describe this better than DEK... +\def\domark{% + \toks0=\expandafter{\lastchapterdefs}% + \toks2=\expandafter{\lastsectiondefs}% + \toks4=\expandafter{\prevchapterdefs}% + \toks6=\expandafter{\prevsectiondefs}% + \toks8=\expandafter{\lastcolordefs}% + \mark{% + \the\toks0 \the\toks2 + \noexpand\or \the\toks4 \the\toks6 + \noexpand\else \the\toks8 + }% +} +% \topmark doesn't work for the very first chapter (after the title +% page or the contents), so we use \firstmark there -- this gets us +% the mark with the chapter defs, unless the user sneaks in, e.g., +% @setcolor (or @url, or @link, etc.) between @contents and the very +% first @chapter. +\def\gettopheadingmarks{% + \ifcase0\topmark\fi + \ifx\thischapter\empty \ifcase0\firstmark\fi \fi +} +\def\getbottomheadingmarks{\ifcase1\botmark\fi} +\def\getcolormarks{\ifcase2\topmark\fi} + +% Avoid "undefined control sequence" errors. +\def\lastchapterdefs{} +\def\lastsectiondefs{} +\def\prevchapterdefs{} +\def\prevsectiondefs{} +\def\lastcolordefs{} + +% Main output routine. +\chardef\PAGE = 255 +\output = {\onepageout{\pagecontents\PAGE}} + +\newbox\headlinebox +\newbox\footlinebox + +% \onepageout takes a vbox as an argument. Note that \pagecontents +% does insertions, but you have to call it yourself. +\def\onepageout#1{% + \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi + % + \ifodd\pageno \advance\hoffset by \bindingoffset + \else \advance\hoffset by -\bindingoffset\fi + % + % Do this outside of the \shipout so @code etc. will be expanded in + % the headline as they should be, not taken literally (outputting ''code). + \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi + \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}% + \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi + \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}% + % + {% + % Have to do this stuff outside the \shipout because we want it to + % take effect in \write's, yet the group defined by the \vbox ends + % before the \shipout runs. + % + \indexdummies % don't expand commands in the output. + \normalturnoffactive % \ in index entries must not stay \, e.g., if + % the page break happens to be in the middle of an example. + % We don't want .vr (or whatever) entries like this: + % \entry{{\tt \indexbackslash }acronym}{32}{\code {\acronym}} + % "\acronym" won't work when it's read back in; + % it needs to be + % {\code {{\tt \backslashcurfont }acronym} + \shipout\vbox{% + % Do this early so pdf references go to the beginning of the page. + \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi + % + \ifcropmarks \vbox to \outervsize\bgroup + \hsize = \outerhsize + \vskip-\topandbottommargin + \vtop to0pt{% + \line{\ewtop\hfil\ewtop}% + \nointerlineskip + \line{% + \vbox{\moveleft\cornerthick\nstop}% + \hfill + \vbox{\moveright\cornerthick\nstop}% + }% + \vss}% + \vskip\topandbottommargin + \line\bgroup + \hfil % center the page within the outer (page) hsize. + \ifodd\pageno\hskip\bindingoffset\fi + \vbox\bgroup + \fi + % + \unvbox\headlinebox + \pagebody{#1}% + \ifdim\ht\footlinebox > 0pt + % Only leave this space if the footline is nonempty. + % (We lessened \vsize for it in \oddfootingyyy.) + % The \baselineskip=24pt in plain's \makefootline has no effect. + \vskip 24pt + \unvbox\footlinebox + \fi + % + \ifcropmarks + \egroup % end of \vbox\bgroup + \hfil\egroup % end of (centering) \line\bgroup + \vskip\topandbottommargin plus1fill minus1fill + \boxmaxdepth = \cornerthick + \vbox to0pt{\vss + \line{% + \vbox{\moveleft\cornerthick\nsbot}% + \hfill + \vbox{\moveright\cornerthick\nsbot}% + }% + \nointerlineskip + \line{\ewbot\hfil\ewbot}% + }% + \egroup % \vbox from first cropmarks clause + \fi + }% end of \shipout\vbox + }% end of group with \indexdummies + \advancepageno + \ifnum\outputpenalty>-20000 \else\dosupereject\fi +} + +\newinsert\margin \dimen\margin=\maxdimen + +\def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}} +{\catcode`\@ =11 +\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi +% marginal hacks, juha@viisa.uucp (Juha Takala) +\ifvoid\margin\else % marginal info is present + \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi +\dimen@=\dp#1\relax \unvbox#1\relax +\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi +\ifr@ggedbottom \kern-\dimen@ \vfil \fi} +} + +% Here are the rules for the cropmarks. Note that they are +% offset so that the space between them is truly \outerhsize or \outervsize +% (P. A. MacKay, 12 November, 1986) +% +\def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong} +\def\nstop{\vbox + {\hrule height\cornerthick depth\cornerlong width\cornerthick}} +\def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong} +\def\nsbot{\vbox + {\hrule height\cornerlong depth\cornerthick width\cornerthick}} + +% Parse an argument, then pass it to #1. The argument is the rest of +% the input line (except we remove a trailing comment). #1 should be a +% macro which expects an ordinary undelimited TeX argument. +% +\def\parsearg{\parseargusing{}} +\def\parseargusing#1#2{% + \def\argtorun{#2}% + \begingroup + \obeylines + \spaceisspace + #1% + \parseargline\empty% Insert the \empty token, see \finishparsearg below. +} + +{\obeylines % + \gdef\parseargline#1^^M{% + \endgroup % End of the group started in \parsearg. + \argremovecomment #1\comment\ArgTerm% + }% +} + +% First remove any @comment, then any @c comment. +\def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm} +\def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm} + +% Each occurence of `\^^M' or `<space>\^^M' is replaced by a single space. +% +% \argremovec might leave us with trailing space, e.g., +% @end itemize @c foo +% This space token undergoes the same procedure and is eventually removed +% by \finishparsearg. +% +\def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M} +\def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M} +\def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{% + \def\temp{#3}% + \ifx\temp\empty + % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp: + \let\temp\finishparsearg + \else + \let\temp\argcheckspaces + \fi + % Put the space token in: + \temp#1 #3\ArgTerm +} + +% If a _delimited_ argument is enclosed in braces, they get stripped; so +% to get _exactly_ the rest of the line, we had to prevent such situation. +% We prepended an \empty token at the very beginning and we expand it now, +% just before passing the control to \argtorun. +% (Similarily, we have to think about #3 of \argcheckspacesY above: it is +% either the null string, or it ends with \^^M---thus there is no danger +% that a pair of braces would be stripped. +% +% But first, we have to remove the trailing space token. +% +\def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}} + +% \parseargdef\foo{...} +% is roughly equivalent to +% \def\foo{\parsearg\Xfoo} +% \def\Xfoo#1{...} +% +% Actually, I use \csname\string\foo\endcsname, ie. \\foo, as it is my +% favourite TeX trick. --kasal, 16nov03 + +\def\parseargdef#1{% + \expandafter \doparseargdef \csname\string#1\endcsname #1% +} +\def\doparseargdef#1#2{% + \def#2{\parsearg#1}% + \def#1##1% +} + +% Several utility definitions with active space: +{ + \obeyspaces + \gdef\obeyedspace{ } + + % Make each space character in the input produce a normal interword + % space in the output. Don't allow a line break at this space, as this + % is used only in environments like @example, where each line of input + % should produce a line of output anyway. + % + \gdef\sepspaces{\obeyspaces\let =\tie} + + % If an index command is used in an @example environment, any spaces + % therein should become regular spaces in the raw index file, not the + % expansion of \tie (\leavevmode \penalty \@M \ ). + \gdef\unsepspaces{\let =\space} +} + + +\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next} + +% Define the framework for environments in texinfo.tex. It's used like this: +% +% \envdef\foo{...} +% \def\Efoo{...} +% +% It's the responsibility of \envdef to insert \begingroup before the +% actual body; @end closes the group after calling \Efoo. \envdef also +% defines \thisenv, so the current environment is known; @end checks +% whether the environment name matches. The \checkenv macro can also be +% used to check whether the current environment is the one expected. +% +% Non-false conditionals (@iftex, @ifset) don't fit into this, so they +% are not treated as enviroments; they don't open a group. (The +% implementation of @end takes care not to call \endgroup in this +% special case.) + + +% At runtime, environments start with this: +\def\startenvironment#1{\begingroup\def\thisenv{#1}} +% initialize +\let\thisenv\empty + +% ... but they get defined via ``\envdef\foo{...}'': +\long\def\envdef#1#2{\def#1{\startenvironment#1#2}} +\def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}} + +% Check whether we're in the right environment: +\def\checkenv#1{% + \def\temp{#1}% + \ifx\thisenv\temp + \else + \badenverr + \fi +} + +% Evironment mismatch, #1 expected: +\def\badenverr{% + \errhelp = \EMsimple + \errmessage{This command can appear only \inenvironment\temp, + not \inenvironment\thisenv}% +} +\def\inenvironment#1{% + \ifx#1\empty + out of any environment% + \else + in environment \expandafter\string#1% + \fi +} + +% @end foo executes the definition of \Efoo. +% But first, it executes a specialized version of \checkenv +% +\parseargdef\end{% + \if 1\csname iscond.#1\endcsname + \else + % The general wording of \badenverr may not be ideal, but... --kasal, 06nov03 + \expandafter\checkenv\csname#1\endcsname + \csname E#1\endcsname + \endgroup + \fi +} + +\newhelp\EMsimple{Press RETURN to continue.} + + +%% Simple single-character @ commands + +% @@ prints an @ +% Kludge this until the fonts are right (grr). +\def\@{{\tt\char64}} + +% This is turned off because it was never documented +% and you can use @w{...} around a quote to suppress ligatures. +%% Define @` and @' to be the same as ` and ' +%% but suppressing ligatures. +%\def\`{{`}} +%\def\'{{'}} + +% Used to generate quoted braces. +\def\mylbrace {{\tt\char123}} +\def\myrbrace {{\tt\char125}} +\let\{=\mylbrace +\let\}=\myrbrace +\begingroup + % Definitions to produce \{ and \} commands for indices, + % and @{ and @} for the aux/toc files. + \catcode`\{ = \other \catcode`\} = \other + \catcode`\[ = 1 \catcode`\] = 2 + \catcode`\! = 0 \catcode`\\ = \other + !gdef!lbracecmd[\{]% + !gdef!rbracecmd[\}]% + !gdef!lbraceatcmd[@{]% + !gdef!rbraceatcmd[@}]% +!endgroup + +% @comma{} to avoid , parsing problems. +\let\comma = , + +% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent +% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H. +\let\, = \c +\let\dotaccent = \. +\def\ringaccent#1{{\accent23 #1}} +\let\tieaccent = \t +\let\ubaraccent = \b +\let\udotaccent = \d + +% Other special characters: @questiondown @exclamdown @ordf @ordm +% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss. +\def\questiondown{?`} +\def\exclamdown{!`} +\def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}} +\def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}} + +% Dotless i and dotless j, used for accents. +\def\imacro{i} +\def\jmacro{j} +\def\dotless#1{% + \def\temp{#1}% + \ifx\temp\imacro \ptexi + \else\ifx\temp\jmacro \j + \else \errmessage{@dotless can be used only with i or j}% + \fi\fi +} + +% The \TeX{} logo, as in plain, but resetting the spacing so that a +% period following counts as ending a sentence. (Idea found in latex.) +% +\edef\TeX{\TeX \spacefactor=1000 } + +% @LaTeX{} logo. Not quite the same results as the definition in +% latex.ltx, since we use a different font for the raised A; it's most +% convenient for us to use an explicitly smaller font, rather than using +% the \scriptstyle font (since we don't reset \scriptstyle and +% \scriptscriptstyle). +% +\def\LaTeX{% + L\kern-.36em + {\setbox0=\hbox{T}% + \vbox to \ht0{\hbox{\selectfonts\lllsize A}\vss}}% + \kern-.15em + \TeX +} + +% Be sure we're in horizontal mode when doing a tie, since we make space +% equivalent to this in @example-like environments. Otherwise, a space +% at the beginning of a line will start with \penalty -- and +% since \penalty is valid in vertical mode, we'd end up putting the +% penalty on the vertical list instead of in the new paragraph. +{\catcode`@ = 11 + % Avoid using \@M directly, because that causes trouble + % if the definition is written into an index file. + \global\let\tiepenalty = \@M + \gdef\tie{\leavevmode\penalty\tiepenalty\ } +} + +% @: forces normal size whitespace following. +\def\:{\spacefactor=1000 } + +% @* forces a line break. +\def\*{\hfil\break\hbox{}\ignorespaces} + +% @/ allows a line break. +\let\/=\allowbreak + +% @. is an end-of-sentence period. +\def\.{.\spacefactor=\endofsentencespacefactor\space} + +% @! is an end-of-sentence bang. +\def\!{!\spacefactor=\endofsentencespacefactor\space} + +% @? is an end-of-sentence query. +\def\?{?\spacefactor=\endofsentencespacefactor\space} + +% @frenchspacing on|off says whether to put extra space after punctuation. +% +\def\onword{on} +\def\offword{off} +% +\parseargdef\frenchspacing{% + \def\temp{#1}% + \ifx\temp\onword \plainfrenchspacing + \else\ifx\temp\offword \plainnonfrenchspacing + \else + \errhelp = \EMsimple + \errmessage{Unknown @frenchspacing option `\temp', must be on/off}% + \fi\fi +} + +% @w prevents a word break. Without the \leavevmode, @w at the +% beginning of a paragraph, when TeX is still in vertical mode, would +% produce a whole line of output instead of starting the paragraph. +\def\w#1{\leavevmode\hbox{#1}} + +% @group ... @end group forces ... to be all on one page, by enclosing +% it in a TeX vbox. We use \vtop instead of \vbox to construct the box +% to keep its height that of a normal line. According to the rules for +% \topskip (p.114 of the TeXbook), the glue inserted is +% max (\topskip - \ht (first item), 0). If that height is large, +% therefore, no glue is inserted, and the space between the headline and +% the text is small, which looks bad. +% +% Another complication is that the group might be very large. This can +% cause the glue on the previous page to be unduly stretched, because it +% does not have much material. In this case, it's better to add an +% explicit \vfill so that the extra space is at the bottom. The +% threshold for doing this is if the group is more than \vfilllimit +% percent of a page (\vfilllimit can be changed inside of @tex). +% +\newbox\groupbox +\def\vfilllimit{0.7} +% +\envdef\group{% + \ifnum\catcode`\^^M=\active \else + \errhelp = \groupinvalidhelp + \errmessage{@group invalid in context where filling is enabled}% + \fi + \startsavinginserts + % + \setbox\groupbox = \vtop\bgroup + % Do @comment since we are called inside an environment such as + % @example, where each end-of-line in the input causes an + % end-of-line in the output. We don't want the end-of-line after + % the `@group' to put extra space in the output. Since @group + % should appear on a line by itself (according to the Texinfo + % manual), we don't worry about eating any user text. + \comment +} +% +% The \vtop produces a box with normal height and large depth; thus, TeX puts +% \baselineskip glue before it, and (when the next line of text is done) +% \lineskip glue after it. Thus, space below is not quite equal to space +% above. But it's pretty close. +\def\Egroup{% + % To get correct interline space between the last line of the group + % and the first line afterwards, we have to propagate \prevdepth. + \endgraf % Not \par, as it may have been set to \lisppar. + \global\dimen1 = \prevdepth + \egroup % End the \vtop. + % \dimen0 is the vertical size of the group's box. + \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox + % \dimen2 is how much space is left on the page (more or less). + \dimen2 = \pageheight \advance\dimen2 by -\pagetotal + % if the group doesn't fit on the current page, and it's a big big + % group, force a page break. + \ifdim \dimen0 > \dimen2 + \ifdim \pagetotal < \vfilllimit\pageheight + \page + \fi + \fi + \box\groupbox + \prevdepth = \dimen1 + \checkinserts +} +% +% TeX puts in an \escapechar (i.e., `@') at the beginning of the help +% message, so this ends up printing `@group can only ...'. +% +\newhelp\groupinvalidhelp{% +group can only be used in environments such as @example,^^J% +where each line of input produces a line of output.} + +% @need space-in-mils +% forces a page break if there is not space-in-mils remaining. + +\newdimen\mil \mil=0.001in + +% Old definition--didn't work. +%\parseargdef\need{\par % +%% This method tries to make TeX break the page naturally +%% if the depth of the box does not fit. +%{\baselineskip=0pt% +%\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak +%\prevdepth=-1000pt +%}} + +\parseargdef\need{% + % Ensure vertical mode, so we don't make a big box in the middle of a + % paragraph. + \par + % + % If the @need value is less than one line space, it's useless. + \dimen0 = #1\mil + \dimen2 = \ht\strutbox + \advance\dimen2 by \dp\strutbox + \ifdim\dimen0 > \dimen2 + % + % Do a \strut just to make the height of this box be normal, so the + % normal leading is inserted relative to the preceding line. + % And a page break here is fine. + \vtop to #1\mil{\strut\vfil}% + % + % TeX does not even consider page breaks if a penalty added to the + % main vertical list is 10000 or more. But in order to see if the + % empty box we just added fits on the page, we must make it consider + % page breaks. On the other hand, we don't want to actually break the + % page after the empty box. So we use a penalty of 9999. + % + % There is an extremely small chance that TeX will actually break the + % page at this \penalty, if there are no other feasible breakpoints in + % sight. (If the user is using lots of big @group commands, which + % almost-but-not-quite fill up a page, TeX will have a hard time doing + % good page breaking, for example.) However, I could not construct an + % example where a page broke at this \penalty; if it happens in a real + % document, then we can reconsider our strategy. + \penalty9999 + % + % Back up by the size of the box, whether we did a page break or not. + \kern -#1\mil + % + % Do not allow a page break right after this kern. + \nobreak + \fi +} + +% @br forces paragraph break (and is undocumented). + +\let\br = \par + +% @page forces the start of a new page. +% +\def\page{\par\vfill\supereject} + +% @exdent text.... +% outputs text on separate line in roman font, starting at standard page margin + +% This records the amount of indent in the innermost environment. +% That's how much \exdent should take out. +\newskip\exdentamount + +% This defn is used inside fill environments such as @defun. +\parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break} + +% This defn is used inside nofill environments such as @example. +\parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount + \leftline{\hskip\leftskip{\rm#1}}}} + +% @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current +% paragraph. For more general purposes, use the \margin insertion +% class. WHICH is `l' or `r'. +% +\newskip\inmarginspacing \inmarginspacing=1cm +\def\strutdepth{\dp\strutbox} +% +\def\doinmargin#1#2{\strut\vadjust{% + \nobreak + \kern-\strutdepth + \vtop to \strutdepth{% + \baselineskip=\strutdepth + \vss + % if you have multiple lines of stuff to put here, you'll need to + % make the vbox yourself of the appropriate size. + \ifx#1l% + \llap{\ignorespaces #2\hskip\inmarginspacing}% + \else + \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}% + \fi + \null + }% +}} +\def\inleftmargin{\doinmargin l} +\def\inrightmargin{\doinmargin r} +% +% @inmargin{TEXT [, RIGHT-TEXT]} +% (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right; +% else use TEXT for both). +% +\def\inmargin#1{\parseinmargin #1,,\finish} +\def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing. + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0 > 0pt + \def\lefttext{#1}% have both texts + \def\righttext{#2}% + \else + \def\lefttext{#1}% have only one text + \def\righttext{#1}% + \fi + % + \ifodd\pageno + \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin + \else + \def\temp{\inleftmargin\lefttext}% + \fi + \temp +} + +% @include FILE -- \input text of FILE. +% +\def\include{\parseargusing\filenamecatcodes\includezzz} +\def\includezzz#1{% + \pushthisfilestack + \def\thisfile{#1}% + {% + \makevalueexpandable % we want to expand any @value in FILE. + \turnoffactive % and allow special characters in the expansion + \edef\temp{\noexpand\input #1 }% + % + % This trickery is to read FILE outside of a group, in case it makes + % definitions, etc. + \expandafter + }\temp + \popthisfilestack +} +\def\filenamecatcodes{% + \catcode`\\=\other + \catcode`~=\other + \catcode`^=\other + \catcode`_=\other + \catcode`|=\other + \catcode`<=\other + \catcode`>=\other + \catcode`+=\other + \catcode`-=\other +} + +\def\pushthisfilestack{% + \expandafter\pushthisfilestackX\popthisfilestack\StackTerm +} +\def\pushthisfilestackX{% + \expandafter\pushthisfilestackY\thisfile\StackTerm +} +\def\pushthisfilestackY #1\StackTerm #2\StackTerm {% + \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}% +} + +\def\popthisfilestack{\errthisfilestackempty} +\def\errthisfilestackempty{\errmessage{Internal error: + the stack of filenames is empty.}} + +\def\thisfile{} + +% @center line +% outputs that line, centered. +% +\parseargdef\center{% + \ifhmode + \let\next\centerH + \else + \let\next\centerV + \fi + \next{\hfil \ignorespaces#1\unskip \hfil}% +} +\def\centerH#1{% + {% + \hfil\break + \advance\hsize by -\leftskip + \advance\hsize by -\rightskip + \line{#1}% + \break + }% +} +\def\centerV#1{\line{\kern\leftskip #1\kern\rightskip}} + +% @sp n outputs n lines of vertical space + +\parseargdef\sp{\vskip #1\baselineskip} + +% @comment ...line which is ignored... +% @c is the same as @comment +% @ignore ... @end ignore is another way to write a comment + +\def\comment{\begingroup \catcode`\^^M=\other% +\catcode`\@=\other \catcode`\{=\other \catcode`\}=\other% +\commentxxx} +{\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}} + +\let\c=\comment + +% @paragraphindent NCHARS +% We'll use ems for NCHARS, close enough. +% NCHARS can also be the word `asis' or `none'. +% We cannot feasibly implement @paragraphindent asis, though. +% +\def\asisword{asis} % no translation, these are keywords +\def\noneword{none} +% +\parseargdef\paragraphindent{% + \def\temp{#1}% + \ifx\temp\asisword + \else + \ifx\temp\noneword + \defaultparindent = 0pt + \else + \defaultparindent = #1em + \fi + \fi + \parindent = \defaultparindent +} + +% @exampleindent NCHARS +% We'll use ems for NCHARS like @paragraphindent. +% It seems @exampleindent asis isn't necessary, but +% I preserve it to make it similar to @paragraphindent. +\parseargdef\exampleindent{% + \def\temp{#1}% + \ifx\temp\asisword + \else + \ifx\temp\noneword + \lispnarrowing = 0pt + \else + \lispnarrowing = #1em + \fi + \fi +} + +% @firstparagraphindent WORD +% If WORD is `none', then suppress indentation of the first paragraph +% after a section heading. If WORD is `insert', then do indent at such +% paragraphs. +% +% The paragraph indentation is suppressed or not by calling +% \suppressfirstparagraphindent, which the sectioning commands do. +% We switch the definition of this back and forth according to WORD. +% By default, we suppress indentation. +% +\def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent} +\def\insertword{insert} +% +\parseargdef\firstparagraphindent{% + \def\temp{#1}% + \ifx\temp\noneword + \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent + \else\ifx\temp\insertword + \let\suppressfirstparagraphindent = \relax + \else + \errhelp = \EMsimple + \errmessage{Unknown @firstparagraphindent option `\temp'}% + \fi\fi +} + +% Here is how we actually suppress indentation. Redefine \everypar to +% \kern backwards by \parindent, and then reset itself to empty. +% +% We also make \indent itself not actually do anything until the next +% paragraph. +% +\gdef\dosuppressfirstparagraphindent{% + \gdef\indent{% + \restorefirstparagraphindent + \indent + }% + \gdef\noindent{% + \restorefirstparagraphindent + \noindent + }% + \global\everypar = {% + \kern -\parindent + \restorefirstparagraphindent + }% +} + +\gdef\restorefirstparagraphindent{% + \global \let \indent = \ptexindent + \global \let \noindent = \ptexnoindent + \global \everypar = {}% +} + + +% @asis just yields its argument. Used with @table, for example. +% +\def\asis#1{#1} + +% @math outputs its argument in math mode. +% +% One complication: _ usually means subscripts, but it could also mean +% an actual _ character, as in @math{@var{some_variable} + 1}. So make +% _ active, and distinguish by seeing if the current family is \slfam, +% which is what @var uses. +{ + \catcode`\_ = \active + \gdef\mathunderscore{% + \catcode`\_=\active + \def_{\ifnum\fam=\slfam \_\else\sb\fi}% + } +} +% Another complication: we want \\ (and @\) to output a \ character. +% FYI, plain.tex uses \\ as a temporary control sequence (why?), but +% this is not advertised and we don't care. Texinfo does not +% otherwise define @\. +% +% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\. +\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi} +% +\def\math{% + \tex + \mathunderscore + \let\\ = \mathbackslash + \mathactive + $\finishmath +} +\def\finishmath#1{#1$\endgroup} % Close the group opened by \tex. + +% Some active characters (such as <) are spaced differently in math. +% We have to reset their definitions in case the @math was an argument +% to a command which sets the catcodes (such as @item or @section). +% +{ + \catcode`^ = \active + \catcode`< = \active + \catcode`> = \active + \catcode`+ = \active + \gdef\mathactive{% + \let^ = \ptexhat + \let< = \ptexless + \let> = \ptexgtr + \let+ = \ptexplus + } +} + +% @bullet and @minus need the same treatment as @math, just above. +\def\bullet{$\ptexbullet$} +\def\minus{$-$} + +% @dots{} outputs an ellipsis using the current font. +% We do .5em per period so that it has the same spacing in the cm +% typewriter fonts as three actual period characters; on the other hand, +% in other typewriter fonts three periods are wider than 1.5em. So do +% whichever is larger. +% +\def\dots{% + \leavevmode + \setbox0=\hbox{...}% get width of three periods + \ifdim\wd0 > 1.5em + \dimen0 = \wd0 + \else + \dimen0 = 1.5em + \fi + \hbox to \dimen0{% + \hskip 0pt plus.25fil + .\hskip 0pt plus1fil + .\hskip 0pt plus1fil + .\hskip 0pt plus.5fil + }% +} + +% @enddots{} is an end-of-sentence ellipsis. +% +\def\enddots{% + \dots + \spacefactor=\endofsentencespacefactor +} + +% @comma{} is so commas can be inserted into text without messing up +% Texinfo's parsing. +% +\let\comma = , + +% @refill is a no-op. +\let\refill=\relax + +% If working on a large document in chapters, it is convenient to +% be able to disable indexing, cross-referencing, and contents, for test runs. +% This is done with @novalidate (before @setfilename). +% +\newif\iflinks \linkstrue % by default we want the aux files. +\let\novalidate = \linksfalse + +% @setfilename is done at the beginning of every texinfo file. +% So open here the files we need to have open while reading the input. +% This makes it possible to make a .fmt file for texinfo. +\def\setfilename{% + \fixbackslash % Turn off hack to swallow `\input texinfo'. + \iflinks + \tryauxfile + % Open the new aux file. TeX will close it automatically at exit. + \immediate\openout\auxfile=\jobname.aux + \fi % \openindices needs to do some work in any case. + \openindices + \let\setfilename=\comment % Ignore extra @setfilename cmds. + % + % If texinfo.cnf is present on the system, read it. + % Useful for site-wide @afourpaper, etc. + \openin 1 texinfo.cnf + \ifeof 1 \else \input texinfo.cnf \fi + \closein 1 + % + \comment % Ignore the actual filename. +} + +% Called from \setfilename. +% +\def\openindices{% + \newindex{cp}% + \newcodeindex{fn}% + \newcodeindex{vr}% + \newcodeindex{tp}% + \newcodeindex{ky}% + \newcodeindex{pg}% +} + +% @bye. +\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend} + + +\message{pdf,} +% adobe `portable' document format +\newcount\tempnum +\newcount\lnkcount +\newtoks\filename +\newcount\filenamelength +\newcount\pgn +\newtoks\toksA +\newtoks\toksB +\newtoks\toksC +\newtoks\toksD +\newbox\boxA +\newcount\countA +\newif\ifpdf +\newif\ifpdfmakepagedest + +% when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1 +% can be set). So we test for \relax and 0 as well as \undefined, +% borrowed from ifpdf.sty. +\ifx\pdfoutput\undefined +\else + \ifx\pdfoutput\relax + \else + \ifcase\pdfoutput + \else + \pdftrue + \fi + \fi +\fi + +% PDF uses PostScript string constants for the names of xref targets, +% for display in the outlines, and in other places. Thus, we have to +% double any backslashes. Otherwise, a name like "\node" will be +% interpreted as a newline (\n), followed by o, d, e. Not good. +% http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html +% (and related messages, the final outcome is that it is up to the TeX +% user to double the backslashes and otherwise make the string valid, so +% that's what we do). + +% double active backslashes. +% +{\catcode`\@=0 \catcode`\\=\active + @gdef@activebackslashdouble{% + @catcode`@\=@active + @let\=@doublebackslash} +} + +% To handle parens, we must adopt a different approach, since parens are +% not active characters. hyperref.dtx (which has the same problem as +% us) handles it with this amazing macro to replace tokens, with minor +% changes for Texinfo. It is included here under the GPL by permission +% from the author, Heiko Oberdiek. +% +% #1 is the tokens to replace. +% #2 is the replacement. +% #3 is the control sequence with the string. +% +\def\HyPsdSubst#1#2#3{% + \def\HyPsdReplace##1#1##2\END{% + ##1% + \ifx\\##2\\% + \else + #2% + \HyReturnAfterFi{% + \HyPsdReplace##2\END + }% + \fi + }% + \xdef#3{\expandafter\HyPsdReplace#3#1\END}% +} +\long\def\HyReturnAfterFi#1\fi{\fi#1} + +% #1 is a control sequence in which to do the replacements. +\def\backslashparens#1{% + \xdef#1{#1}% redefine it as its expansion; the definition is simply + % \lastnode when called from \setref -> \pdfmkdest. + \HyPsdSubst{(}{\realbackslash(}{#1}% + \HyPsdSubst{)}{\realbackslash)}{#1}% +} + +\newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images +with PDF output, and none of those formats could be found. (.eps cannot +be supported due to the design of the PDF format; use regular TeX (DVI +output) for that.)} + +\ifpdf + % + % Color manipulation macros based on pdfcolor.tex. + \def\cmykDarkRed{0.28 1 1 0.35} + \def\cmykBlack{0 0 0 1} + % + \def\pdfsetcolor#1{\pdfliteral{#1 k}} + % Set color, and create a mark which defines \thiscolor accordingly, + % so that \makeheadline knows which color to restore. + \def\setcolor#1{% + \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}% + \domark + \pdfsetcolor{#1}% + } + % + \def\maincolor{\cmykBlack} + \pdfsetcolor{\maincolor} + \edef\thiscolor{\maincolor} + \def\lastcolordefs{} + % + \def\makefootline{% + \baselineskip24pt + \line{\pdfsetcolor{\maincolor}\the\footline}% + } + % + \def\makeheadline{% + \vbox to 0pt{% + \vskip-22.5pt + \line{% + \vbox to8.5pt{}% + % Extract \thiscolor definition from the marks. + \getcolormarks + % Typeset the headline with \maincolor, then restore the color. + \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}% + }% + \vss + }% + \nointerlineskip + } + % + % + \pdfcatalog{/PageMode /UseOutlines} + % + % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto). + \def\dopdfimage#1#2#3{% + \def\imagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}% + \def\imageheight{#3}\setbox2 = \hbox{\ignorespaces #3}% + % + % pdftex (and the PDF format) support .png, .jpg, .pdf (among + % others). Let's try in that order. + \let\pdfimgext=\empty + \begingroup + \openin 1 #1.png \ifeof 1 + \openin 1 #1.jpg \ifeof 1 + \openin 1 #1.jpeg \ifeof 1 + \openin 1 #1.JPG \ifeof 1 + \openin 1 #1.pdf \ifeof 1 + \openin 1 #1.PDF \ifeof 1 + \errhelp = \nopdfimagehelp + \errmessage{Could not find image file #1 for pdf}% + \else \gdef\pdfimgext{PDF}% + \fi + \else \gdef\pdfimgext{pdf}% + \fi + \else \gdef\pdfimgext{JPG}% + \fi + \else \gdef\pdfimgext{jpeg}% + \fi + \else \gdef\pdfimgext{jpg}% + \fi + \else \gdef\pdfimgext{png}% + \fi + \closein 1 + \endgroup + % + % without \immediate, ancient pdftex seg faults when the same image is + % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.) + \ifnum\pdftexversion < 14 + \immediate\pdfimage + \else + \immediate\pdfximage + \fi + \ifdim \wd0 >0pt width \imagewidth \fi + \ifdim \wd2 >0pt height \imageheight \fi + \ifnum\pdftexversion<13 + #1.\pdfimgext + \else + {#1.\pdfimgext}% + \fi + \ifnum\pdftexversion < 14 \else + \pdfrefximage \pdflastximage + \fi} + % + \def\pdfmkdest#1{{% + % We have to set dummies so commands such as @code, and characters + % such as \, aren't expanded when present in a section title. + \indexnofonts + \turnoffactive + \activebackslashdouble + \makevalueexpandable + \def\pdfdestname{#1}% + \backslashparens\pdfdestname + \safewhatsit{\pdfdest name{\pdfdestname} xyz}% + }} + % + % used to mark target names; must be expandable. + \def\pdfmkpgn#1{#1} + % + % by default, use a color that is dark enough to print on paper as + % nearly black, but still distinguishable for online viewing. + \def\urlcolor{\cmykDarkRed} + \def\linkcolor{\cmykDarkRed} + \def\endlink{\setcolor{\maincolor}\pdfendlink} + % + % Adding outlines to PDF; macros for calculating structure of outlines + % come from Petr Olsak + \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0% + \else \csname#1\endcsname \fi} + \def\advancenumber#1{\tempnum=\expnumber{#1}\relax + \advance\tempnum by 1 + \expandafter\xdef\csname#1\endcsname{\the\tempnum}} + % + % #1 is the section text, which is what will be displayed in the + % outline by the pdf viewer. #2 is the pdf expression for the number + % of subentries (or empty, for subsubsections). #3 is the node text, + % which might be empty if this toc entry had no corresponding node. + % #4 is the page number + % + \def\dopdfoutline#1#2#3#4{% + % Generate a link to the node text if that exists; else, use the + % page number. We could generate a destination for the section + % text in the case where a section has no node, but it doesn't + % seem worth the trouble, since most documents are normally structured. + \def\pdfoutlinedest{#3}% + \ifx\pdfoutlinedest\empty + \def\pdfoutlinedest{#4}% + \else + % Doubled backslashes in the name. + {\activebackslashdouble \xdef\pdfoutlinedest{#3}% + \backslashparens\pdfoutlinedest}% + \fi + % + % Also double the backslashes in the display string. + {\activebackslashdouble \xdef\pdfoutlinetext{#1}% + \backslashparens\pdfoutlinetext}% + % + \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}% + } + % + \def\pdfmakeoutlines{% + \begingroup + % Thanh's hack / proper braces in bookmarks + \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace + \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace + % + % Read toc silently, to get counts of subentries for \pdfoutline. + \def\numchapentry##1##2##3##4{% + \def\thischapnum{##2}% + \def\thissecnum{0}% + \def\thissubsecnum{0}% + }% + \def\numsecentry##1##2##3##4{% + \advancenumber{chap\thischapnum}% + \def\thissecnum{##2}% + \def\thissubsecnum{0}% + }% + \def\numsubsecentry##1##2##3##4{% + \advancenumber{sec\thissecnum}% + \def\thissubsecnum{##2}% + }% + \def\numsubsubsecentry##1##2##3##4{% + \advancenumber{subsec\thissubsecnum}% + }% + \def\thischapnum{0}% + \def\thissecnum{0}% + \def\thissubsecnum{0}% + % + % use \def rather than \let here because we redefine \chapentry et + % al. a second time, below. + \def\appentry{\numchapentry}% + \def\appsecentry{\numsecentry}% + \def\appsubsecentry{\numsubsecentry}% + \def\appsubsubsecentry{\numsubsubsecentry}% + \def\unnchapentry{\numchapentry}% + \def\unnsecentry{\numsecentry}% + \def\unnsubsecentry{\numsubsecentry}% + \def\unnsubsubsecentry{\numsubsubsecentry}% + \readdatafile{toc}% + % + % Read toc second time, this time actually producing the outlines. + % The `-' means take the \expnumber as the absolute number of + % subentries, which we calculated on our first read of the .toc above. + % + % We use the node names as the destinations. + \def\numchapentry##1##2##3##4{% + \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}% + \def\numsecentry##1##2##3##4{% + \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}% + \def\numsubsecentry##1##2##3##4{% + \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}% + \def\numsubsubsecentry##1##2##3##4{% count is always zero + \dopdfoutline{##1}{}{##3}{##4}}% + % + % PDF outlines are displayed using system fonts, instead of + % document fonts. Therefore we cannot use special characters, + % since the encoding is unknown. For example, the eogonek from + % Latin 2 (0xea) gets translated to a | character. Info from + % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100. + % + % xx to do this right, we have to translate 8-bit characters to + % their "best" equivalent, based on the @documentencoding. Right + % now, I guess we'll just let the pdf reader have its way. + \indexnofonts + \setupdatafile + \catcode`\\=\active \otherbackslash + \input \tocreadfilename + \endgroup + } + % + \def\skipspaces#1{\def\PP{#1}\def\D{|}% + \ifx\PP\D\let\nextsp\relax + \else\let\nextsp\skipspaces + \ifx\p\space\else\addtokens{\filename}{\PP}% + \advance\filenamelength by 1 + \fi + \fi + \nextsp} + \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax} + \ifnum\pdftexversion < 14 + \let \startlink \pdfannotlink + \else + \let \startlink \pdfstartlink + \fi + % make a live url in pdf output. + \def\pdfurl#1{% + \begingroup + % it seems we really need yet another set of dummies; have not + % tried to figure out what each command should do in the context + % of @url. for now, just make @/ a no-op, that's the only one + % people have actually reported a problem with. + % + \normalturnoffactive + \def\@{@}% + \let\/=\empty + \makevalueexpandable + \leavevmode\setcolor{\urlcolor}% + \startlink attr{/Border [0 0 0]}% + user{/Subtype /Link /A << /S /URI /URI (#1) >>}% + \endgroup} + \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}} + \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} + \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks} + \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}} + \def\maketoks{% + \expandafter\poptoks\the\toksA|ENDTOKS|\relax + \ifx\first0\adn0 + \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3 + \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6 + \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9 + \else + \ifnum0=\countA\else\makelink\fi + \ifx\first.\let\next=\done\else + \let\next=\maketoks + \addtokens{\toksB}{\the\toksD} + \ifx\first,\addtokens{\toksB}{\space}\fi + \fi + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi + \next} + \def\makelink{\addtokens{\toksB}% + {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0} + \def\pdflink#1{% + \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}} + \setcolor{\linkcolor}#1\endlink} + \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} +\else + \let\pdfmkdest = \gobble + \let\pdfurl = \gobble + \let\endlink = \relax + \let\setcolor = \gobble + \let\pdfsetcolor = \gobble + \let\pdfmakeoutlines = \relax +\fi % \ifx\pdfoutput + + +\message{fonts,} + +% Change the current font style to #1, remembering it in \curfontstyle. +% For now, we do not accumulate font styles: @b{@i{foo}} prints foo in +% italics, not bold italics. +% +\def\setfontstyle#1{% + \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd. + \csname ten#1\endcsname % change the current font +} + +% Select #1 fonts with the current style. +% +\def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname} + +\def\rm{\fam=0 \setfontstyle{rm}} +\def\it{\fam=\itfam \setfontstyle{it}} +\def\sl{\fam=\slfam \setfontstyle{sl}} +\def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf} +\def\tt{\fam=\ttfam \setfontstyle{tt}} + +% Texinfo sort of supports the sans serif font style, which plain TeX does not. +% So we set up a \sf. +\newfam\sffam +\def\sf{\fam=\sffam \setfontstyle{sf}} +\let\li = \sf % Sometimes we call it \li, not \sf. + +% We don't need math for this font style. +\def\ttsl{\setfontstyle{ttsl}} + + +% Default leading. +\newdimen\textleading \textleading = 13.2pt + +% Set the baselineskip to #1, and the lineskip and strut size +% correspondingly. There is no deep meaning behind these magic numbers +% used as factors; they just match (closely enough) what Knuth defined. +% +\def\lineskipfactor{.08333} +\def\strutheightpercent{.70833} +\def\strutdepthpercent {.29167} +% +% can get a sort of poor man's double spacing by redefining this. +\def\baselinefactor{1} +% +\def\setleading#1{% + \dimen0 = #1\relax + \normalbaselineskip = \baselinefactor\dimen0 + \normallineskip = \lineskipfactor\normalbaselineskip + \normalbaselines + \setbox\strutbox =\hbox{% + \vrule width0pt height\strutheightpercent\baselineskip + depth \strutdepthpercent \baselineskip + }% +} + +% PDF CMaps. See also LaTeX's t1.cmap. +% +% do nothing with this by default. +\expandafter\let\csname cmapOT1\endcsname\gobble +\expandafter\let\csname cmapOT1IT\endcsname\gobble +\expandafter\let\csname cmapOT1TT\endcsname\gobble + +% if we are producing pdf, and we have \pdffontattr, then define cmaps. +% (\pdffontattr was introduced many years ago, but people still run +% older pdftex's; it's easy to conditionalize, so we do.) +\ifpdf \ifx\pdffontattr\undefined \else + \begingroup + \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. + \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap +%%DocumentNeededResources: ProcSet (CIDInit) +%%IncludeResource: ProcSet (CIDInit) +%%BeginResource: CMap (TeX-OT1-0) +%%Title: (TeX-OT1-0 TeX OT1 0) +%%Version: 1.000 +%%EndComments +/CIDInit /ProcSet findresource begin +12 dict begin +begincmap +/CIDSystemInfo +<< /Registry (TeX) +/Ordering (OT1) +/Supplement 0 +>> def +/CMapName /TeX-OT1-0 def +/CMapType 2 def +1 begincodespacerange +<00> <7F> +endcodespacerange +8 beginbfrange +<00> <01> <0393> +<09> <0A> <03A8> +<23> <26> <0023> +<28> <3B> <0028> +<3F> <5B> <003F> +<5D> <5E> <005D> +<61> <7A> <0061> +<7B> <7C> <2013> +endbfrange +40 beginbfchar +<02> <0398> +<03> <039B> +<04> <039E> +<05> <03A0> +<06> <03A3> +<07> <03D2> +<08> <03A6> +<0B> <00660066> +<0C> <00660069> +<0D> <0066006C> +<0E> <006600660069> +<0F> <00660066006C> +<10> <0131> +<11> <0237> +<12> <0060> +<13> <00B4> +<14> <02C7> +<15> <02D8> +<16> <00AF> +<17> <02DA> +<18> <00B8> +<19> <00DF> +<1A> <00E6> +<1B> <0153> +<1C> <00F8> +<1D> <00C6> +<1E> <0152> +<1F> <00D8> +<21> <0021> +<22> <201D> +<27> <2019> +<3C> <00A1> +<3D> <003D> +<3E> <00BF> +<5C> <201C> +<5F> <02D9> +<60> <2018> +<7D> <02DD> +<7E> <007E> +<7F> <00A8> +endbfchar +endcmap +CMapName currentdict /CMap defineresource pop +end +end +%%EndResource +%%EOF + }\endgroup + \expandafter\edef\csname cmapOT1\endcsname#1{% + \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% + }% +% +% \cmapOT1IT + \begingroup + \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. + \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap +%%DocumentNeededResources: ProcSet (CIDInit) +%%IncludeResource: ProcSet (CIDInit) +%%BeginResource: CMap (TeX-OT1IT-0) +%%Title: (TeX-OT1IT-0 TeX OT1IT 0) +%%Version: 1.000 +%%EndComments +/CIDInit /ProcSet findresource begin +12 dict begin +begincmap +/CIDSystemInfo +<< /Registry (TeX) +/Ordering (OT1IT) +/Supplement 0 +>> def +/CMapName /TeX-OT1IT-0 def +/CMapType 2 def +1 begincodespacerange +<00> <7F> +endcodespacerange +8 beginbfrange +<00> <01> <0393> +<09> <0A> <03A8> +<25> <26> <0025> +<28> <3B> <0028> +<3F> <5B> <003F> +<5D> <5E> <005D> +<61> <7A> <0061> +<7B> <7C> <2013> +endbfrange +42 beginbfchar +<02> <0398> +<03> <039B> +<04> <039E> +<05> <03A0> +<06> <03A3> +<07> <03D2> +<08> <03A6> +<0B> <00660066> +<0C> <00660069> +<0D> <0066006C> +<0E> <006600660069> +<0F> <00660066006C> +<10> <0131> +<11> <0237> +<12> <0060> +<13> <00B4> +<14> <02C7> +<15> <02D8> +<16> <00AF> +<17> <02DA> +<18> <00B8> +<19> <00DF> +<1A> <00E6> +<1B> <0153> +<1C> <00F8> +<1D> <00C6> +<1E> <0152> +<1F> <00D8> +<21> <0021> +<22> <201D> +<23> <0023> +<24> <00A3> +<27> <2019> +<3C> <00A1> +<3D> <003D> +<3E> <00BF> +<5C> <201C> +<5F> <02D9> +<60> <2018> +<7D> <02DD> +<7E> <007E> +<7F> <00A8> +endbfchar +endcmap +CMapName currentdict /CMap defineresource pop +end +end +%%EndResource +%%EOF + }\endgroup + \expandafter\edef\csname cmapOT1IT\endcsname#1{% + \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% + }% +% +% \cmapOT1TT + \begingroup + \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. + \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap +%%DocumentNeededResources: ProcSet (CIDInit) +%%IncludeResource: ProcSet (CIDInit) +%%BeginResource: CMap (TeX-OT1TT-0) +%%Title: (TeX-OT1TT-0 TeX OT1TT 0) +%%Version: 1.000 +%%EndComments +/CIDInit /ProcSet findresource begin +12 dict begin +begincmap +/CIDSystemInfo +<< /Registry (TeX) +/Ordering (OT1TT) +/Supplement 0 +>> def +/CMapName /TeX-OT1TT-0 def +/CMapType 2 def +1 begincodespacerange +<00> <7F> +endcodespacerange +5 beginbfrange +<00> <01> <0393> +<09> <0A> <03A8> +<21> <26> <0021> +<28> <5F> <0028> +<61> <7E> <0061> +endbfrange +32 beginbfchar +<02> <0398> +<03> <039B> +<04> <039E> +<05> <03A0> +<06> <03A3> +<07> <03D2> +<08> <03A6> +<0B> <2191> +<0C> <2193> +<0D> <0027> +<0E> <00A1> +<0F> <00BF> +<10> <0131> +<11> <0237> +<12> <0060> +<13> <00B4> +<14> <02C7> +<15> <02D8> +<16> <00AF> +<17> <02DA> +<18> <00B8> +<19> <00DF> +<1A> <00E6> +<1B> <0153> +<1C> <00F8> +<1D> <00C6> +<1E> <0152> +<1F> <00D8> +<20> <2423> +<27> <2019> +<60> <2018> +<7F> <00A8> +endbfchar +endcmap +CMapName currentdict /CMap defineresource pop +end +end +%%EndResource +%%EOF + }\endgroup + \expandafter\edef\csname cmapOT1TT\endcsname#1{% + \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% + }% +\fi\fi + + +% Set the font macro #1 to the font named #2, adding on the +% specified font prefix (normally `cm'). +% #3 is the font's design size, #4 is a scale factor, #5 is the CMap +% encoding (currently only OT1, OT1IT and OT1TT are allowed, pass +% empty to omit). +\def\setfont#1#2#3#4#5{% + \font#1=\fontprefix#2#3 scaled #4 + \csname cmap#5\endcsname#1% +} +% This is what gets called when #5 of \setfont is empty. +\let\cmap\gobble +% emacs-page end of cmaps + +% Use cm as the default font prefix. +% To specify the font prefix, you must define \fontprefix +% before you read in texinfo.tex. +\ifx\fontprefix\undefined +\def\fontprefix{cm} +\fi +% Support font families that don't use the same naming scheme as CM. +\def\rmshape{r} +\def\rmbshape{bx} %where the normal face is bold +\def\bfshape{b} +\def\bxshape{bx} +\def\ttshape{tt} +\def\ttbshape{tt} +\def\ttslshape{sltt} +\def\itshape{ti} +\def\itbshape{bxti} +\def\slshape{sl} +\def\slbshape{bxsl} +\def\sfshape{ss} +\def\sfbshape{ss} +\def\scshape{csc} +\def\scbshape{csc} + +% Definitions for a main text size of 11pt. This is the default in +% Texinfo. +% +\def\definetextfontsizexi{% +% Text fonts (11.2pt, magstep1). +\def\textnominalsize{11pt} +\edef\mainmagstep{\magstephalf} +\setfont\textrm\rmshape{10}{\mainmagstep}{OT1} +\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT} +\setfont\textbf\bfshape{10}{\mainmagstep}{OT1} +\setfont\textit\itshape{10}{\mainmagstep}{OT1IT} +\setfont\textsl\slshape{10}{\mainmagstep}{OT1} +\setfont\textsf\sfshape{10}{\mainmagstep}{OT1} +\setfont\textsc\scshape{10}{\mainmagstep}{OT1} +\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT} +\font\texti=cmmi10 scaled \mainmagstep +\font\textsy=cmsy10 scaled \mainmagstep +\def\textecsize{1095} + +% A few fonts for @defun names and args. +\setfont\defbf\bfshape{10}{\magstep1}{OT1} +\setfont\deftt\ttshape{10}{\magstep1}{OT1TT} +\setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT} +\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} + +% Fonts for indices, footnotes, small examples (9pt). +\def\smallnominalsize{9pt} +\setfont\smallrm\rmshape{9}{1000}{OT1} +\setfont\smalltt\ttshape{9}{1000}{OT1TT} +\setfont\smallbf\bfshape{10}{900}{OT1} +\setfont\smallit\itshape{9}{1000}{OT1IT} +\setfont\smallsl\slshape{9}{1000}{OT1} +\setfont\smallsf\sfshape{9}{1000}{OT1} +\setfont\smallsc\scshape{10}{900}{OT1} +\setfont\smallttsl\ttslshape{10}{900}{OT1TT} +\font\smalli=cmmi9 +\font\smallsy=cmsy9 +\def\smallecsize{0900} + +% Fonts for small examples (8pt). +\def\smallernominalsize{8pt} +\setfont\smallerrm\rmshape{8}{1000}{OT1} +\setfont\smallertt\ttshape{8}{1000}{OT1TT} +\setfont\smallerbf\bfshape{10}{800}{OT1} +\setfont\smallerit\itshape{8}{1000}{OT1IT} +\setfont\smallersl\slshape{8}{1000}{OT1} +\setfont\smallersf\sfshape{8}{1000}{OT1} +\setfont\smallersc\scshape{10}{800}{OT1} +\setfont\smallerttsl\ttslshape{10}{800}{OT1TT} +\font\smalleri=cmmi8 +\font\smallersy=cmsy8 +\def\smallerecsize{0800} + +% Fonts for title page (20.4pt): +\def\titlenominalsize{20pt} +\setfont\titlerm\rmbshape{12}{\magstep3}{OT1} +\setfont\titleit\itbshape{10}{\magstep4}{OT1IT} +\setfont\titlesl\slbshape{10}{\magstep4}{OT1} +\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT} +\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT} +\setfont\titlesf\sfbshape{17}{\magstep1}{OT1} +\let\titlebf=\titlerm +\setfont\titlesc\scbshape{10}{\magstep4}{OT1} +\font\titlei=cmmi12 scaled \magstep3 +\font\titlesy=cmsy10 scaled \magstep4 +\def\authorrm{\secrm} +\def\authortt{\sectt} +\def\titleecsize{2074} + +% Chapter (and unnumbered) fonts (17.28pt). +\def\chapnominalsize{17pt} +\setfont\chaprm\rmbshape{12}{\magstep2}{OT1} +\setfont\chapit\itbshape{10}{\magstep3}{OT1IT} +\setfont\chapsl\slbshape{10}{\magstep3}{OT1} +\setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT} +\setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT} +\setfont\chapsf\sfbshape{17}{1000}{OT1} +\let\chapbf=\chaprm +\setfont\chapsc\scbshape{10}{\magstep3}{OT1} +\font\chapi=cmmi12 scaled \magstep2 +\font\chapsy=cmsy10 scaled \magstep3 +\def\chapecsize{1728} + +% Section fonts (14.4pt). +\def\secnominalsize{14pt} +\setfont\secrm\rmbshape{12}{\magstep1}{OT1} +\setfont\secit\itbshape{10}{\magstep2}{OT1IT} +\setfont\secsl\slbshape{10}{\magstep2}{OT1} +\setfont\sectt\ttbshape{12}{\magstep1}{OT1TT} +\setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT} +\setfont\secsf\sfbshape{12}{\magstep1}{OT1} +\let\secbf\secrm +\setfont\secsc\scbshape{10}{\magstep2}{OT1} +\font\seci=cmmi12 scaled \magstep1 +\font\secsy=cmsy10 scaled \magstep2 +\def\sececsize{1440} + +% Subsection fonts (13.15pt). +\def\ssecnominalsize{13pt} +\setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1} +\setfont\ssecit\itbshape{10}{1315}{OT1IT} +\setfont\ssecsl\slbshape{10}{1315}{OT1} +\setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT} +\setfont\ssecttsl\ttslshape{10}{1315}{OT1TT} +\setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1} +\let\ssecbf\ssecrm +\setfont\ssecsc\scbshape{10}{1315}{OT1} +\font\sseci=cmmi12 scaled \magstephalf +\font\ssecsy=cmsy10 scaled 1315 +\def\ssececsize{1200} + +% Reduced fonts for @acro in text (10pt). +\def\reducednominalsize{10pt} +\setfont\reducedrm\rmshape{10}{1000}{OT1} +\setfont\reducedtt\ttshape{10}{1000}{OT1TT} +\setfont\reducedbf\bfshape{10}{1000}{OT1} +\setfont\reducedit\itshape{10}{1000}{OT1IT} +\setfont\reducedsl\slshape{10}{1000}{OT1} +\setfont\reducedsf\sfshape{10}{1000}{OT1} +\setfont\reducedsc\scshape{10}{1000}{OT1} +\setfont\reducedttsl\ttslshape{10}{1000}{OT1TT} +\font\reducedi=cmmi10 +\font\reducedsy=cmsy10 +\def\reducedecsize{1000} + +% reset the current fonts +\textfonts +\rm +} % end of 11pt text font size definitions + + +% Definitions to make the main text be 10pt Computer Modern, with +% section, chapter, etc., sizes following suit. This is for the GNU +% Press printing of the Emacs 22 manual. Maybe other manuals in the +% future. Used with @smallbook, which sets the leading to 12pt. +% +\def\definetextfontsizex{% +% Text fonts (10pt). +\def\textnominalsize{10pt} +\edef\mainmagstep{1000} +\setfont\textrm\rmshape{10}{\mainmagstep}{OT1} +\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT} +\setfont\textbf\bfshape{10}{\mainmagstep}{OT1} +\setfont\textit\itshape{10}{\mainmagstep}{OT1IT} +\setfont\textsl\slshape{10}{\mainmagstep}{OT1} +\setfont\textsf\sfshape{10}{\mainmagstep}{OT1} +\setfont\textsc\scshape{10}{\mainmagstep}{OT1} +\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT} +\font\texti=cmmi10 scaled \mainmagstep +\font\textsy=cmsy10 scaled \mainmagstep +\def\textecsize{1000} + +% A few fonts for @defun names and args. +\setfont\defbf\bfshape{10}{\magstephalf}{OT1} +\setfont\deftt\ttshape{10}{\magstephalf}{OT1TT} +\setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT} +\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} + +% Fonts for indices, footnotes, small examples (9pt). +\def\smallnominalsize{9pt} +\setfont\smallrm\rmshape{9}{1000}{OT1} +\setfont\smalltt\ttshape{9}{1000}{OT1TT} +\setfont\smallbf\bfshape{10}{900}{OT1} +\setfont\smallit\itshape{9}{1000}{OT1IT} +\setfont\smallsl\slshape{9}{1000}{OT1} +\setfont\smallsf\sfshape{9}{1000}{OT1} +\setfont\smallsc\scshape{10}{900}{OT1} +\setfont\smallttsl\ttslshape{10}{900}{OT1TT} +\font\smalli=cmmi9 +\font\smallsy=cmsy9 +\def\smallecsize{0900} + +% Fonts for small examples (8pt). +\def\smallernominalsize{8pt} +\setfont\smallerrm\rmshape{8}{1000}{OT1} +\setfont\smallertt\ttshape{8}{1000}{OT1TT} +\setfont\smallerbf\bfshape{10}{800}{OT1} +\setfont\smallerit\itshape{8}{1000}{OT1IT} +\setfont\smallersl\slshape{8}{1000}{OT1} +\setfont\smallersf\sfshape{8}{1000}{OT1} +\setfont\smallersc\scshape{10}{800}{OT1} +\setfont\smallerttsl\ttslshape{10}{800}{OT1TT} +\font\smalleri=cmmi8 +\font\smallersy=cmsy8 +\def\smallerecsize{0800} + +% Fonts for title page (20.4pt): +\def\titlenominalsize{20pt} +\setfont\titlerm\rmbshape{12}{\magstep3}{OT1} +\setfont\titleit\itbshape{10}{\magstep4}{OT1IT} +\setfont\titlesl\slbshape{10}{\magstep4}{OT1} +\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT} +\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT} +\setfont\titlesf\sfbshape{17}{\magstep1}{OT1} +\let\titlebf=\titlerm +\setfont\titlesc\scbshape{10}{\magstep4}{OT1} +\font\titlei=cmmi12 scaled \magstep3 +\font\titlesy=cmsy10 scaled \magstep4 +\def\authorrm{\secrm} +\def\authortt{\sectt} +\def\titleecsize{2074} + +% Chapter fonts (14.4pt). +\def\chapnominalsize{14pt} +\setfont\chaprm\rmbshape{12}{\magstep1}{OT1} +\setfont\chapit\itbshape{10}{\magstep2}{OT1IT} +\setfont\chapsl\slbshape{10}{\magstep2}{OT1} +\setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT} +\setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT} +\setfont\chapsf\sfbshape{12}{\magstep1}{OT1} +\let\chapbf\chaprm +\setfont\chapsc\scbshape{10}{\magstep2}{OT1} +\font\chapi=cmmi12 scaled \magstep1 +\font\chapsy=cmsy10 scaled \magstep2 +\def\chapecsize{1440} + +% Section fonts (12pt). +\def\secnominalsize{12pt} +\setfont\secrm\rmbshape{12}{1000}{OT1} +\setfont\secit\itbshape{10}{\magstep1}{OT1IT} +\setfont\secsl\slbshape{10}{\magstep1}{OT1} +\setfont\sectt\ttbshape{12}{1000}{OT1TT} +\setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT} +\setfont\secsf\sfbshape{12}{1000}{OT1} +\let\secbf\secrm +\setfont\secsc\scbshape{10}{\magstep1}{OT1} +\font\seci=cmmi12 +\font\secsy=cmsy10 scaled \magstep1 +\def\sececsize{1200} + +% Subsection fonts (10pt). +\def\ssecnominalsize{10pt} +\setfont\ssecrm\rmbshape{10}{1000}{OT1} +\setfont\ssecit\itbshape{10}{1000}{OT1IT} +\setfont\ssecsl\slbshape{10}{1000}{OT1} +\setfont\ssectt\ttbshape{10}{1000}{OT1TT} +\setfont\ssecttsl\ttslshape{10}{1000}{OT1TT} +\setfont\ssecsf\sfbshape{10}{1000}{OT1} +\let\ssecbf\ssecrm +\setfont\ssecsc\scbshape{10}{1000}{OT1} +\font\sseci=cmmi10 +\font\ssecsy=cmsy10 +\def\ssececsize{1000} + +% Reduced fonts for @acro in text (9pt). +\def\reducednominalsize{9pt} +\setfont\reducedrm\rmshape{9}{1000}{OT1} +\setfont\reducedtt\ttshape{9}{1000}{OT1TT} +\setfont\reducedbf\bfshape{10}{900}{OT1} +\setfont\reducedit\itshape{9}{1000}{OT1IT} +\setfont\reducedsl\slshape{9}{1000}{OT1} +\setfont\reducedsf\sfshape{9}{1000}{OT1} +\setfont\reducedsc\scshape{10}{900}{OT1} +\setfont\reducedttsl\ttslshape{10}{900}{OT1TT} +\font\reducedi=cmmi9 +\font\reducedsy=cmsy9 +\def\reducedecsize{0900} + +% reduce space between paragraphs +\divide\parskip by 2 + +% reset the current fonts +\textfonts +\rm +} % end of 10pt text font size definitions + + +% We provide the user-level command +% @fonttextsize 10 +% (or 11) to redefine the text font size. pt is assumed. +% +\def\xword{10} +\def\xiword{11} +% +\parseargdef\fonttextsize{% + \def\textsizearg{#1}% + \wlog{doing @fonttextsize \textsizearg}% + % + % Set \globaldefs so that documents can use this inside @tex, since + % makeinfo 4.8 does not support it, but we need it nonetheless. + % + \begingroup \globaldefs=1 + \ifx\textsizearg\xword \definetextfontsizex + \else \ifx\textsizearg\xiword \definetextfontsizexi + \else + \errhelp=\EMsimple + \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'} + \fi\fi + \endgroup +} + + +% In order for the font changes to affect most math symbols and letters, +% we have to define the \textfont of the standard families. Since +% texinfo doesn't allow for producing subscripts and superscripts except +% in the main text, we don't bother to reset \scriptfont and +% \scriptscriptfont (which would also require loading a lot more fonts). +% +\def\resetmathfonts{% + \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy + \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf + \textfont\ttfam=\tentt \textfont\sffam=\tensf +} + +% The font-changing commands redefine the meanings of \tenSTYLE, instead +% of just \STYLE. We do this because \STYLE needs to also set the +% current \fam for math mode. Our \STYLE (e.g., \rm) commands hardwire +% \tenSTYLE to set the current font. +% +% Each font-changing command also sets the names \lsize (one size lower) +% and \lllsize (three sizes lower). These relative commands are used in +% the LaTeX logo and acronyms. +% +% This all needs generalizing, badly. +% +\def\textfonts{% + \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl + \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc + \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy + \let\tenttsl=\textttsl + \def\curfontsize{text}% + \def\lsize{reduced}\def\lllsize{smaller}% + \resetmathfonts \setleading{\textleading}} +\def\titlefonts{% + \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl + \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc + \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy + \let\tenttsl=\titlettsl + \def\curfontsize{title}% + \def\lsize{chap}\def\lllsize{subsec}% + \resetmathfonts \setleading{25pt}} +\def\titlefont#1{{\titlefonts\rm #1}} +\def\chapfonts{% + \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl + \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc + \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy + \let\tenttsl=\chapttsl + \def\curfontsize{chap}% + \def\lsize{sec}\def\lllsize{text}% + \resetmathfonts \setleading{19pt}} +\def\secfonts{% + \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl + \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc + \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy + \let\tenttsl=\secttsl + \def\curfontsize{sec}% + \def\lsize{subsec}\def\lllsize{reduced}% + \resetmathfonts \setleading{16pt}} +\def\subsecfonts{% + \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl + \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc + \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy + \let\tenttsl=\ssecttsl + \def\curfontsize{ssec}% + \def\lsize{text}\def\lllsize{small}% + \resetmathfonts \setleading{15pt}} +\let\subsubsecfonts = \subsecfonts +\def\reducedfonts{% + \let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl + \let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc + \let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy + \let\tenttsl=\reducedttsl + \def\curfontsize{reduced}% + \def\lsize{small}\def\lllsize{smaller}% + \resetmathfonts \setleading{10.5pt}} +\def\smallfonts{% + \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl + \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc + \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy + \let\tenttsl=\smallttsl + \def\curfontsize{small}% + \def\lsize{smaller}\def\lllsize{smaller}% + \resetmathfonts \setleading{10.5pt}} +\def\smallerfonts{% + \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl + \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc + \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy + \let\tenttsl=\smallerttsl + \def\curfontsize{smaller}% + \def\lsize{smaller}\def\lllsize{smaller}% + \resetmathfonts \setleading{9.5pt}} + +% Set the fonts to use with the @small... environments. +\let\smallexamplefonts = \smallfonts + +% About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample +% can fit this many characters: +% 8.5x11=86 smallbook=72 a4=90 a5=69 +% If we use \scriptfonts (8pt), then we can fit this many characters: +% 8.5x11=90+ smallbook=80 a4=90+ a5=77 +% For me, subjectively, the few extra characters that fit aren't worth +% the additional smallness of 8pt. So I'm making the default 9pt. +% +% By the way, for comparison, here's what fits with @example (10pt): +% 8.5x11=71 smallbook=60 a4=75 a5=58 +% +% I wish the USA used A4 paper. +% --karl, 24jan03. + + +% Set up the default fonts, so we can use them for creating boxes. +% +\definetextfontsizexi + +% Define these so they can be easily changed for other fonts. +\def\angleleft{$\langle$} +\def\angleright{$\rangle$} + +% Count depth in font-changes, for error checks +\newcount\fontdepth \fontdepth=0 + +% Fonts for short table of contents. +\setfont\shortcontrm\rmshape{12}{1000}{OT1} +\setfont\shortcontbf\bfshape{10}{\magstep1}{OT1} % no cmb12 +\setfont\shortcontsl\slshape{12}{1000}{OT1} +\setfont\shortconttt\ttshape{12}{1000}{OT1TT} + +%% Add scribe-like font environments, plus @l for inline lisp (usually sans +%% serif) and @ii for TeX italic + +% \smartitalic{ARG} outputs arg in italics, followed by an italic correction +% unless the following character is such as not to need one. +\def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else + \ptexslash\fi\fi\fi} +\def\smartslanted#1{{\ifusingtt\ttsl\sl #1}\futurelet\next\smartitalicx} +\def\smartitalic#1{{\ifusingtt\ttsl\it #1}\futurelet\next\smartitalicx} + +% like \smartslanted except unconditionally uses \ttsl. +% @var is set to this for defun arguments. +\def\ttslanted#1{{\ttsl #1}\futurelet\next\smartitalicx} + +% like \smartslanted except unconditionally use \sl. We never want +% ttsl for book titles, do we? +\def\cite#1{{\sl #1}\futurelet\next\smartitalicx} + +\let\i=\smartitalic +\let\slanted=\smartslanted +\let\var=\smartslanted +\let\dfn=\smartslanted +\let\emph=\smartitalic + +% @b, explicit bold. +\def\b#1{{\bf #1}} +\let\strong=\b + +% @sansserif, explicit sans. +\def\sansserif#1{{\sf #1}} + +% We can't just use \exhyphenpenalty, because that only has effect at +% the end of a paragraph. Restore normal hyphenation at the end of the +% group within which \nohyphenation is presumably called. +% +\def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation} +\def\restorehyphenation{\hyphenchar\font = `- } + +% Set sfcode to normal for the chars that usually have another value. +% Can't use plain's \frenchspacing because it uses the `\x notation, and +% sometimes \x has an active definition that messes things up. +% +\catcode`@=11 + \def\plainfrenchspacing{% + \sfcode\dotChar =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m + \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m + \def\endofsentencespacefactor{1000}% for @. and friends + } + \def\plainnonfrenchspacing{% + \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000 + \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250 + \def\endofsentencespacefactor{3000}% for @. and friends + } +\catcode`@=\other +\def\endofsentencespacefactor{3000}% default + +\def\t#1{% + {\tt \rawbackslash \plainfrenchspacing #1}% + \null +} +\def\samp#1{`\tclose{#1}'\null} +\setfont\keyrm\rmshape{8}{1000}{OT1} +\font\keysy=cmsy9 +\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{% + \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{% + \vbox{\hrule\kern-0.4pt + \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}% + \kern-0.4pt\hrule}% + \kern-.06em\raise0.4pt\hbox{\angleright}}}} +\def\key #1{{\nohyphenation \uppercase{#1}}\null} +% The old definition, with no lozenge: +%\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null} +\def\ctrl #1{{\tt \rawbackslash \hat}#1} + +% @file, @option are the same as @samp. +\let\file=\samp +\let\option=\samp + +% @code is a modification of @t, +% which makes spaces the same size as normal in the surrounding text. +\def\tclose#1{% + {% + % Change normal interword space to be same as for the current font. + \spaceskip = \fontdimen2\font + % + % Switch to typewriter. + \tt + % + % But `\ ' produces the large typewriter interword space. + \def\ {{\spaceskip = 0pt{} }}% + % + % Turn off hyphenation. + \nohyphenation + % + \rawbackslash + \plainfrenchspacing + #1% + }% + \null +} + +% We *must* turn on hyphenation at `-' and `_' in @code. +% Otherwise, it is too hard to avoid overfull hboxes +% in the Emacs manual, the Library manual, etc. + +% Unfortunately, TeX uses one parameter (\hyphenchar) to control +% both hyphenation at - and hyphenation within words. +% We must therefore turn them both off (\tclose does that) +% and arrange explicitly to hyphenate at a dash. +% -- rms. +{ + \catcode`\-=\active \catcode`\_=\active + \catcode`\'=\active \catcode`\`=\active + % + \global\def\code{\begingroup + \catcode\rquoteChar=\active \catcode\lquoteChar=\active + \let'\codequoteright \let`\codequoteleft + % + \catcode\dashChar=\active \catcode\underChar=\active + \ifallowcodebreaks + \let-\codedash + \let_\codeunder + \else + \let-\realdash + \let_\realunder + \fi + \codex + } +} + +\def\realdash{-} +\def\codedash{-\discretionary{}{}{}} +\def\codeunder{% + % this is all so @math{@code{var_name}+1} can work. In math mode, _ + % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.) + % will therefore expand the active definition of _, which is us + % (inside @code that is), therefore an endless loop. + \ifusingtt{\ifmmode + \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_. + \else\normalunderscore \fi + \discretionary{}{}{}}% + {\_}% +} +\def\codex #1{\tclose{#1}\endgroup} + +% An additional complication: the above will allow breaks after, e.g., +% each of the four underscores in __typeof__. This is undesirable in +% some manuals, especially if they don't have long identifiers in +% general. @allowcodebreaks provides a way to control this. +% +\newif\ifallowcodebreaks \allowcodebreakstrue + +\def\keywordtrue{true} +\def\keywordfalse{false} + +\parseargdef\allowcodebreaks{% + \def\txiarg{#1}% + \ifx\txiarg\keywordtrue + \allowcodebreakstrue + \else\ifx\txiarg\keywordfalse + \allowcodebreaksfalse + \else + \errhelp = \EMsimple + \errmessage{Unknown @allowcodebreaks option `\txiarg'}% + \fi\fi +} + +% @kbd is like @code, except that if the argument is just one @key command, +% then @kbd has no effect. + +% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always), +% `example' (@kbd uses ttsl only inside of @example and friends), +% or `code' (@kbd uses normal tty font always). +\parseargdef\kbdinputstyle{% + \def\txiarg{#1}% + \ifx\txiarg\worddistinct + \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}% + \else\ifx\txiarg\wordexample + \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}% + \else\ifx\txiarg\wordcode + \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}% + \else + \errhelp = \EMsimple + \errmessage{Unknown @kbdinputstyle option `\txiarg'}% + \fi\fi\fi +} +\def\worddistinct{distinct} +\def\wordexample{example} +\def\wordcode{code} + +% Default is `distinct.' +\kbdinputstyle distinct + +\def\xkey{\key} +\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}% +\ifx\one\xkey\ifx\threex\three \key{#2}% +\else{\tclose{\kbdfont\look}}\fi +\else{\tclose{\kbdfont\look}}\fi} + +% For @indicateurl, @env, @command quotes seem unnecessary, so use \code. +\let\indicateurl=\code +\let\env=\code +\let\command=\code + +% @clicksequence{File @click{} Open ...} +\def\clicksequence#1{\begingroup #1\endgroup} + +% @clickstyle @arrow (by default) +\parseargdef\clickstyle{\def\click{#1}} +\def\click{\arrow} + +% @uref (abbreviation for `urlref') takes an optional (comma-separated) +% second argument specifying the text to display and an optional third +% arg as text to display instead of (rather than in addition to) the url +% itself. First (mandatory) arg is the url. Perhaps eventually put in +% a hypertex \special here. +% +\def\uref#1{\douref #1,,,\finish} +\def\douref#1,#2,#3,#4\finish{\begingroup + \unsepspaces + \pdfurl{#1}% + \setbox0 = \hbox{\ignorespaces #3}% + \ifdim\wd0 > 0pt + \unhbox0 % third arg given, show only that + \else + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0 > 0pt + \ifpdf + \unhbox0 % PDF: 2nd arg given, show only it + \else + \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url + \fi + \else + \code{#1}% only url given, so show it + \fi + \fi + \endlink +\endgroup} + +% @url synonym for @uref, since that's how everyone uses it. +% +\let\url=\uref + +% rms does not like angle brackets --karl, 17may97. +% So now @email is just like @uref, unless we are pdf. +% +%\def\email#1{\angleleft{\tt #1}\angleright} +\ifpdf + \def\email#1{\doemail#1,,\finish} + \def\doemail#1,#2,#3\finish{\begingroup + \unsepspaces + \pdfurl{mailto:#1}% + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi + \endlink + \endgroup} +\else + \let\email=\uref +\fi + +% Check if we are currently using a typewriter font. Since all the +% Computer Modern typewriter fonts have zero interword stretch (and +% shrink), and it is reasonable to expect all typewriter fonts to have +% this property, we can check that font parameter. +% +\def\ifmonospace{\ifdim\fontdimen3\font=0pt } + +% Typeset a dimension, e.g., `in' or `pt'. The only reason for the +% argument is to make the input look right: @dmn{pt} instead of @dmn{}pt. +% +\def\dmn#1{\thinspace #1} + +\def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par} + +% @l was never documented to mean ``switch to the Lisp font'', +% and it is not used as such in any manual I can find. We need it for +% Polish suppressed-l. --karl, 22sep96. +%\def\l#1{{\li #1}\null} + +% Explicit font changes: @r, @sc, undocumented @ii. +\def\r#1{{\rm #1}} % roman font +\def\sc#1{{\smallcaps#1}} % smallcaps font +\def\ii#1{{\it #1}} % italic font + +% @acronym for "FBI", "NATO", and the like. +% We print this one point size smaller, since it's intended for +% all-uppercase. +% +\def\acronym#1{\doacronym #1,,\finish} +\def\doacronym#1,#2,#3\finish{% + {\selectfonts\lsize #1}% + \def\temp{#2}% + \ifx\temp\empty \else + \space ({\unsepspaces \ignorespaces \temp \unskip})% + \fi +} + +% @abbr for "Comput. J." and the like. +% No font change, but don't do end-of-sentence spacing. +% +\def\abbr#1{\doabbr #1,,\finish} +\def\doabbr#1,#2,#3\finish{% + {\plainfrenchspacing #1}% + \def\temp{#2}% + \ifx\temp\empty \else + \space ({\unsepspaces \ignorespaces \temp \unskip})% + \fi +} + +% @pounds{} is a sterling sign, which Knuth put in the CM italic font. +% +\def\pounds{{\it\$}} + +% @euro{} comes from a separate font, depending on the current style. +% We use the free feym* fonts from the eurosym package by Henrik +% Theiling, which support regular, slanted, bold and bold slanted (and +% "outlined" (blackboard board, sort of) versions, which we don't need). +% It is available from http://www.ctan.org/tex-archive/fonts/eurosym. +% +% Although only regular is the truly official Euro symbol, we ignore +% that. The Euro is designed to be slightly taller than the regular +% font height. +% +% feymr - regular +% feymo - slanted +% feybr - bold +% feybo - bold slanted +% +% There is no good (free) typewriter version, to my knowledge. +% A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide. +% Hmm. +% +% Also doesn't work in math. Do we need to do math with euro symbols? +% Hope not. +% +% +\def\euro{{\eurofont e}} +\def\eurofont{% + % We set the font at each command, rather than predefining it in + % \textfonts and the other font-switching commands, so that + % installations which never need the symbol don't have to have the + % font installed. + % + % There is only one designed size (nominal 10pt), so we always scale + % that to the current nominal size. + % + % By the way, simply using "at 1em" works for cmr10 and the like, but + % does not work for cmbx10 and other extended/shrunken fonts. + % + \def\eurosize{\csname\curfontsize nominalsize\endcsname}% + % + \ifx\curfontstyle\bfstylename + % bold: + \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize + \else + % regular: + \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize + \fi + \thiseurofont +} + +% Hacks for glyphs from the EC fonts similar to \euro. We don't +% use \let for the aliases, because sometimes we redefine the original +% macro, and the alias should reflect the redefinition. +\def\guillemetleft{{\ecfont \char"13}} +\def\guillemotleft{\guillemetleft} +\def\guillemetright{{\ecfont \char"14}} +\def\guillemotright{\guillemetright} +\def\guilsinglleft{{\ecfont \char"0E}} +\def\guilsinglright{{\ecfont \char"0F}} +\def\quotedblbase{{\ecfont \char"12}} +\def\quotesinglbase{{\ecfont \char"0D}} +% +\def\ecfont{% + % We can't distinguish serif/sanserif and italic/slanted, but this + % is used for crude hacks anyway (like adding French and German + % quotes to documents typeset with CM, where we lose kerning), so + % hopefully nobody will notice/care. + \edef\ecsize{\csname\curfontsize ecsize\endcsname}% + \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}% + \ifx\curfontstyle\bfstylename + % bold: + \font\thisecfont = ecb\ifusingit{i}{x}\ecsize \space at \nominalsize + \else + % regular: + \font\thisecfont = ec\ifusingit{ti}{rm}\ecsize \space at \nominalsize + \fi + \thisecfont +} + +% @registeredsymbol - R in a circle. The font for the R should really +% be smaller yet, but lllsize is the best we can do for now. +% Adapted from the plain.tex definition of \copyright. +% +\def\registeredsymbol{% + $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}% + \hfil\crcr\Orb}}% + }$% +} + +% @textdegree - the normal degrees sign. +% +\def\textdegree{$^\circ$} + +% Laurent Siebenmann reports \Orb undefined with: +% Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38 +% so we'll define it if necessary. +% +\ifx\Orb\undefined +\def\Orb{\mathhexbox20D} +\fi + +% Quotes. +\chardef\quotedblleft="5C +\chardef\quotedblright=`\" +\chardef\quoteleft=`\` +\chardef\quoteright=`\' + + +\message{page headings,} + +\newskip\titlepagetopglue \titlepagetopglue = 1.5in +\newskip\titlepagebottomglue \titlepagebottomglue = 2pc + +% First the title page. Must do @settitle before @titlepage. +\newif\ifseenauthor +\newif\iffinishedtitlepage + +% Do an implicit @contents or @shortcontents after @end titlepage if the +% user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage. +% +\newif\ifsetcontentsaftertitlepage + \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue +\newif\ifsetshortcontentsaftertitlepage + \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue + +\parseargdef\shorttitlepage{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}% + \endgroup\page\hbox{}\page} + +\envdef\titlepage{% + % Open one extra group, as we want to close it in the middle of \Etitlepage. + \begingroup + \parindent=0pt \textfonts + % Leave some space at the very top of the page. + \vglue\titlepagetopglue + % No rule at page bottom unless we print one at the top with @title. + \finishedtitlepagetrue + % + % Most title ``pages'' are actually two pages long, with space + % at the top of the second. We don't want the ragged left on the second. + \let\oldpage = \page + \def\page{% + \iffinishedtitlepage\else + \finishtitlepage + \fi + \let\page = \oldpage + \page + \null + }% +} + +\def\Etitlepage{% + \iffinishedtitlepage\else + \finishtitlepage + \fi + % It is important to do the page break before ending the group, + % because the headline and footline are only empty inside the group. + % If we use the new definition of \page, we always get a blank page + % after the title page, which we certainly don't want. + \oldpage + \endgroup + % + % Need this before the \...aftertitlepage checks so that if they are + % in effect the toc pages will come out with page numbers. + \HEADINGSon + % + % If they want short, they certainly want long too. + \ifsetshortcontentsaftertitlepage + \shortcontents + \contents + \global\let\shortcontents = \relax + \global\let\contents = \relax + \fi + % + \ifsetcontentsaftertitlepage + \contents + \global\let\contents = \relax + \global\let\shortcontents = \relax + \fi +} + +\def\finishtitlepage{% + \vskip4pt \hrule height 2pt width \hsize + \vskip\titlepagebottomglue + \finishedtitlepagetrue +} + +%%% Macros to be used within @titlepage: + +\let\subtitlerm=\tenrm +\def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines} + +\def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines + \let\tt=\authortt} + +\parseargdef\title{% + \checkenv\titlepage + \leftline{\titlefonts\rm #1} + % print a rule at the page bottom also. + \finishedtitlepagefalse + \vskip4pt \hrule height 4pt width \hsize \vskip4pt +} + +\parseargdef\subtitle{% + \checkenv\titlepage + {\subtitlefont \rightline{#1}}% +} + +% @author should come last, but may come many times. +% It can also be used inside @quotation. +% +\parseargdef\author{% + \def\temp{\quotation}% + \ifx\thisenv\temp + \def\quotationauthor{#1}% printed in \Equotation. + \else + \checkenv\titlepage + \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi + {\authorfont \leftline{#1}}% + \fi +} + + +%%% Set up page headings and footings. + +\let\thispage=\folio + +\newtoks\evenheadline % headline on even pages +\newtoks\oddheadline % headline on odd pages +\newtoks\evenfootline % footline on even pages +\newtoks\oddfootline % footline on odd pages + +% Now make TeX use those variables +\headline={{\textfonts\rm \ifodd\pageno \the\oddheadline + \else \the\evenheadline \fi}} +\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline + \else \the\evenfootline \fi}\HEADINGShook} +\let\HEADINGShook=\relax + +% Commands to set those variables. +% For example, this is what @headings on does +% @evenheading @thistitle|@thispage|@thischapter +% @oddheading @thischapter|@thispage|@thistitle +% @evenfooting @thisfile|| +% @oddfooting ||@thisfile + + +\def\evenheading{\parsearg\evenheadingxxx} +\def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish} +\def\evenheadingyyy #1\|#2\|#3\|#4\finish{% +\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} + +\def\oddheading{\parsearg\oddheadingxxx} +\def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish} +\def\oddheadingyyy #1\|#2\|#3\|#4\finish{% +\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} + +\parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}% + +\def\evenfooting{\parsearg\evenfootingxxx} +\def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish} +\def\evenfootingyyy #1\|#2\|#3\|#4\finish{% +\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} + +\def\oddfooting{\parsearg\oddfootingxxx} +\def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish} +\def\oddfootingyyy #1\|#2\|#3\|#4\finish{% + \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}% + % + % Leave some space for the footline. Hopefully ok to assume + % @evenfooting will not be used by itself. + \global\advance\pageheight by -12pt + \global\advance\vsize by -12pt +} + +\parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}} + +% @evenheadingmarks top \thischapter <- chapter at the top of a page +% @evenheadingmarks bottom \thischapter <- chapter at the bottom of a page +% +% The same set of arguments for: +% +% @oddheadingmarks +% @evenfootingmarks +% @oddfootingmarks +% @everyheadingmarks +% @everyfootingmarks + +\def\evenheadingmarks{\headingmarks{even}{heading}} +\def\oddheadingmarks{\headingmarks{odd}{heading}} +\def\evenfootingmarks{\headingmarks{even}{footing}} +\def\oddfootingmarks{\headingmarks{odd}{footing}} +\def\everyheadingmarks#1 {\headingmarks{even}{heading}{#1} + \headingmarks{odd}{heading}{#1} } +\def\everyfootingmarks#1 {\headingmarks{even}{footing}{#1} + \headingmarks{odd}{footing}{#1} } +% #1 = even/odd, #2 = heading/footing, #3 = top/bottom. +\def\headingmarks#1#2#3 {% + \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname + \global\expandafter\let\csname get#1#2marks\endcsname \temp +} + +\everyheadingmarks bottom +\everyfootingmarks bottom + +% @headings double turns headings on for double-sided printing. +% @headings single turns headings on for single-sided printing. +% @headings off turns them off. +% @headings on same as @headings double, retained for compatibility. +% @headings after turns on double-sided headings after this page. +% @headings doubleafter turns on double-sided headings after this page. +% @headings singleafter turns on single-sided headings after this page. +% By default, they are off at the start of a document, +% and turned `on' after @end titlepage. + +\def\headings #1 {\csname HEADINGS#1\endcsname} + +\def\HEADINGSoff{% +\global\evenheadline={\hfil} \global\evenfootline={\hfil} +\global\oddheadline={\hfil} \global\oddfootline={\hfil}} +\HEADINGSoff +% When we turn headings on, set the page number to 1. +% For double-sided printing, put current file name in lower left corner, +% chapter name on inside top of right hand pages, document +% title on inside top of left hand pages, and page numbers on outside top +% edge of all pages. +\def\HEADINGSdouble{% +\global\pageno=1 +\global\evenfootline={\hfil} +\global\oddfootline={\hfil} +\global\evenheadline={\line{\folio\hfil\thistitle}} +\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\let\contentsalignmacro = \chapoddpage +} +\let\contentsalignmacro = \chappager + +% For single-sided printing, chapter title goes across top left of page, +% page number on top right. +\def\HEADINGSsingle{% +\global\pageno=1 +\global\evenfootline={\hfil} +\global\oddfootline={\hfil} +\global\evenheadline={\line{\thischapter\hfil\folio}} +\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\let\contentsalignmacro = \chappager +} +\def\HEADINGSon{\HEADINGSdouble} + +\def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex} +\let\HEADINGSdoubleafter=\HEADINGSafter +\def\HEADINGSdoublex{% +\global\evenfootline={\hfil} +\global\oddfootline={\hfil} +\global\evenheadline={\line{\folio\hfil\thistitle}} +\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\let\contentsalignmacro = \chapoddpage +} + +\def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex} +\def\HEADINGSsinglex{% +\global\evenfootline={\hfil} +\global\oddfootline={\hfil} +\global\evenheadline={\line{\thischapter\hfil\folio}} +\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\let\contentsalignmacro = \chappager +} + +% Subroutines used in generating headings +% This produces Day Month Year style of output. +% Only define if not already defined, in case a txi-??.tex file has set +% up a different format (e.g., txi-cs.tex does this). +\ifx\today\undefined +\def\today{% + \number\day\space + \ifcase\month + \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr + \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug + \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec + \fi + \space\number\year} +\fi + +% @settitle line... specifies the title of the document, for headings. +% It generates no output of its own. +\def\thistitle{\putwordNoTitle} +\def\settitle{\parsearg{\gdef\thistitle}} + + +\message{tables,} +% Tables -- @table, @ftable, @vtable, @item(x). + +% default indentation of table text +\newdimen\tableindent \tableindent=.8in +% default indentation of @itemize and @enumerate text +\newdimen\itemindent \itemindent=.3in +% margin between end of table item and start of table text. +\newdimen\itemmargin \itemmargin=.1in + +% used internally for \itemindent minus \itemmargin +\newdimen\itemmax + +% Note @table, @ftable, and @vtable define @item, @itemx, etc., with +% these defs. +% They also define \itemindex +% to index the item name in whatever manner is desired (perhaps none). + +\newif\ifitemxneedsnegativevskip + +\def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi} + +\def\internalBitem{\smallbreak \parsearg\itemzzz} +\def\internalBitemx{\itemxpar \parsearg\itemzzz} + +\def\itemzzz #1{\begingroup % + \advance\hsize by -\rightskip + \advance\hsize by -\tableindent + \setbox0=\hbox{\itemindicate{#1}}% + \itemindex{#1}% + \nobreak % This prevents a break before @itemx. + % + % If the item text does not fit in the space we have, put it on a line + % by itself, and do not allow a page break either before or after that + % line. We do not start a paragraph here because then if the next + % command is, e.g., @kindex, the whatsit would get put into the + % horizontal list on a line by itself, resulting in extra blank space. + \ifdim \wd0>\itemmax + % + % Make this a paragraph so we get the \parskip glue and wrapping, + % but leave it ragged-right. + \begingroup + \advance\leftskip by-\tableindent + \advance\hsize by\tableindent + \advance\rightskip by0pt plus1fil + \leavevmode\unhbox0\par + \endgroup + % + % We're going to be starting a paragraph, but we don't want the + % \parskip glue -- logically it's part of the @item we just started. + \nobreak \vskip-\parskip + % + % Stop a page break at the \parskip glue coming up. However, if + % what follows is an environment such as @example, there will be no + % \parskip glue; then the negative vskip we just inserted would + % cause the example and the item to crash together. So we use this + % bizarre value of 10001 as a signal to \aboveenvbreak to insert + % \parskip glue after all. Section titles are handled this way also. + % + \penalty 10001 + \endgroup + \itemxneedsnegativevskipfalse + \else + % The item text fits into the space. Start a paragraph, so that the + % following text (if any) will end up on the same line. + \noindent + % Do this with kerns and \unhbox so that if there is a footnote in + % the item text, it can migrate to the main vertical list and + % eventually be printed. + \nobreak\kern-\tableindent + \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0 + \unhbox0 + \nobreak\kern\dimen0 + \endgroup + \itemxneedsnegativevskiptrue + \fi +} + +\def\item{\errmessage{@item while not in a list environment}} +\def\itemx{\errmessage{@itemx while not in a list environment}} + +% @table, @ftable, @vtable. +\envdef\table{% + \let\itemindex\gobble + \tablecheck{table}% +} +\envdef\ftable{% + \def\itemindex ##1{\doind {fn}{\code{##1}}}% + \tablecheck{ftable}% +} +\envdef\vtable{% + \def\itemindex ##1{\doind {vr}{\code{##1}}}% + \tablecheck{vtable}% +} +\def\tablecheck#1{% + \ifnum \the\catcode`\^^M=\active + \endgroup + \errmessage{This command won't work in this context; perhaps the problem is + that we are \inenvironment\thisenv}% + \def\next{\doignore{#1}}% + \else + \let\next\tablex + \fi + \next +} +\def\tablex#1{% + \def\itemindicate{#1}% + \parsearg\tabley +} +\def\tabley#1{% + {% + \makevalueexpandable + \edef\temp{\noexpand\tablez #1\space\space\space}% + \expandafter + }\temp \endtablez +} +\def\tablez #1 #2 #3 #4\endtablez{% + \aboveenvbreak + \ifnum 0#1>0 \advance \leftskip by #1\mil \fi + \ifnum 0#2>0 \tableindent=#2\mil \fi + \ifnum 0#3>0 \advance \rightskip by #3\mil \fi + \itemmax=\tableindent + \advance \itemmax by -\itemmargin + \advance \leftskip by \tableindent + \exdentamount=\tableindent + \parindent = 0pt + \parskip = \smallskipamount + \ifdim \parskip=0pt \parskip=2pt \fi + \let\item = \internalBitem + \let\itemx = \internalBitemx +} +\def\Etable{\endgraf\afterenvbreak} +\let\Eftable\Etable +\let\Evtable\Etable +\let\Eitemize\Etable +\let\Eenumerate\Etable + +% This is the counter used by @enumerate, which is really @itemize + +\newcount \itemno + +\envdef\itemize{\parsearg\doitemize} + +\def\doitemize#1{% + \aboveenvbreak + \itemmax=\itemindent + \advance\itemmax by -\itemmargin + \advance\leftskip by \itemindent + \exdentamount=\itemindent + \parindent=0pt + \parskip=\smallskipamount + \ifdim\parskip=0pt \parskip=2pt \fi + \def\itemcontents{#1}% + % @itemize with no arg is equivalent to @itemize @bullet. + \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi + \let\item=\itemizeitem +} + +% Definition of @item while inside @itemize and @enumerate. +% +\def\itemizeitem{% + \advance\itemno by 1 % for enumerations + {\let\par=\endgraf \smallbreak}% reasonable place to break + {% + % If the document has an @itemize directly after a section title, a + % \nobreak will be last on the list, and \sectionheading will have + % done a \vskip-\parskip. In that case, we don't want to zero + % parskip, or the item text will crash with the heading. On the + % other hand, when there is normal text preceding the item (as there + % usually is), we do want to zero parskip, or there would be too much + % space. In that case, we won't have a \nobreak before. At least + % that's the theory. + \ifnum\lastpenalty<10000 \parskip=0in \fi + \noindent + \hbox to 0pt{\hss \itemcontents \kern\itemmargin}% + \vadjust{\penalty 1200}}% not good to break after first line of item. + \flushcr +} + +% \splitoff TOKENS\endmark defines \first to be the first token in +% TOKENS, and \rest to be the remainder. +% +\def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}% + +% Allow an optional argument of an uppercase letter, lowercase letter, +% or number, to specify the first label in the enumerated list. No +% argument is the same as `1'. +% +\envparseargdef\enumerate{\enumeratey #1 \endenumeratey} +\def\enumeratey #1 #2\endenumeratey{% + % If we were given no argument, pretend we were given `1'. + \def\thearg{#1}% + \ifx\thearg\empty \def\thearg{1}\fi + % + % Detect if the argument is a single token. If so, it might be a + % letter. Otherwise, the only valid thing it can be is a number. + % (We will always have one token, because of the test we just made. + % This is a good thing, since \splitoff doesn't work given nothing at + % all -- the first parameter is undelimited.) + \expandafter\splitoff\thearg\endmark + \ifx\rest\empty + % Only one token in the argument. It could still be anything. + % A ``lowercase letter'' is one whose \lccode is nonzero. + % An ``uppercase letter'' is one whose \lccode is both nonzero, and + % not equal to itself. + % Otherwise, we assume it's a number. + % + % We need the \relax at the end of the \ifnum lines to stop TeX from + % continuing to look for a <number>. + % + \ifnum\lccode\expandafter`\thearg=0\relax + \numericenumerate % a number (we hope) + \else + % It's a letter. + \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax + \lowercaseenumerate % lowercase letter + \else + \uppercaseenumerate % uppercase letter + \fi + \fi + \else + % Multiple tokens in the argument. We hope it's a number. + \numericenumerate + \fi +} + +% An @enumerate whose labels are integers. The starting integer is +% given in \thearg. +% +\def\numericenumerate{% + \itemno = \thearg + \startenumeration{\the\itemno}% +} + +% The starting (lowercase) letter is in \thearg. +\def\lowercaseenumerate{% + \itemno = \expandafter`\thearg + \startenumeration{% + % Be sure we're not beyond the end of the alphabet. + \ifnum\itemno=0 + \errmessage{No more lowercase letters in @enumerate; get a bigger + alphabet}% + \fi + \char\lccode\itemno + }% +} + +% The starting (uppercase) letter is in \thearg. +\def\uppercaseenumerate{% + \itemno = \expandafter`\thearg + \startenumeration{% + % Be sure we're not beyond the end of the alphabet. + \ifnum\itemno=0 + \errmessage{No more uppercase letters in @enumerate; get a bigger + alphabet} + \fi + \char\uccode\itemno + }% +} + +% Call \doitemize, adding a period to the first argument and supplying the +% common last two arguments. Also subtract one from the initial value in +% \itemno, since @item increments \itemno. +% +\def\startenumeration#1{% + \advance\itemno by -1 + \doitemize{#1.}\flushcr +} + +% @alphaenumerate and @capsenumerate are abbreviations for giving an arg +% to @enumerate. +% +\def\alphaenumerate{\enumerate{a}} +\def\capsenumerate{\enumerate{A}} +\def\Ealphaenumerate{\Eenumerate} +\def\Ecapsenumerate{\Eenumerate} + + +% @multitable macros +% Amy Hendrickson, 8/18/94, 3/6/96 +% +% @multitable ... @end multitable will make as many columns as desired. +% Contents of each column will wrap at width given in preamble. Width +% can be specified either with sample text given in a template line, +% or in percent of \hsize, the current width of text on page. + +% Table can continue over pages but will only break between lines. + +% To make preamble: +% +% Either define widths of columns in terms of percent of \hsize: +% @multitable @columnfractions .25 .3 .45 +% @item ... +% +% Numbers following @columnfractions are the percent of the total +% current hsize to be used for each column. You may use as many +% columns as desired. + + +% Or use a template: +% @multitable {Column 1 template} {Column 2 template} {Column 3 template} +% @item ... +% using the widest term desired in each column. + +% Each new table line starts with @item, each subsequent new column +% starts with @tab. Empty columns may be produced by supplying @tab's +% with nothing between them for as many times as empty columns are needed, +% ie, @tab@tab@tab will produce two empty columns. + +% @item, @tab do not need to be on their own lines, but it will not hurt +% if they are. + +% Sample multitable: + +% @multitable {Column 1 template} {Column 2 template} {Column 3 template} +% @item first col stuff @tab second col stuff @tab third col +% @item +% first col stuff +% @tab +% second col stuff +% @tab +% third col +% @item first col stuff @tab second col stuff +% @tab Many paragraphs of text may be used in any column. +% +% They will wrap at the width determined by the template. +% @item@tab@tab This will be in third column. +% @end multitable + +% Default dimensions may be reset by user. +% @multitableparskip is vertical space between paragraphs in table. +% @multitableparindent is paragraph indent in table. +% @multitablecolmargin is horizontal space to be left between columns. +% @multitablelinespace is space to leave between table items, baseline +% to baseline. +% 0pt means it depends on current normal line spacing. +% +\newskip\multitableparskip +\newskip\multitableparindent +\newdimen\multitablecolspace +\newskip\multitablelinespace +\multitableparskip=0pt +\multitableparindent=6pt +\multitablecolspace=12pt +\multitablelinespace=0pt + +% Macros used to set up halign preamble: +% +\let\endsetuptable\relax +\def\xendsetuptable{\endsetuptable} +\let\columnfractions\relax +\def\xcolumnfractions{\columnfractions} +\newif\ifsetpercent + +% #1 is the @columnfraction, usually a decimal number like .5, but might +% be just 1. We just use it, whatever it is. +% +\def\pickupwholefraction#1 {% + \global\advance\colcount by 1 + \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}% + \setuptable +} + +\newcount\colcount +\def\setuptable#1{% + \def\firstarg{#1}% + \ifx\firstarg\xendsetuptable + \let\go = \relax + \else + \ifx\firstarg\xcolumnfractions + \global\setpercenttrue + \else + \ifsetpercent + \let\go\pickupwholefraction + \else + \global\advance\colcount by 1 + \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a + % separator; typically that is always in the input, anyway. + \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}% + \fi + \fi + \ifx\go\pickupwholefraction + % Put the argument back for the \pickupwholefraction call, so + % we'll always have a period there to be parsed. + \def\go{\pickupwholefraction#1}% + \else + \let\go = \setuptable + \fi% + \fi + \go +} + +% multitable-only commands. +% +% @headitem starts a heading row, which we typeset in bold. +% Assignments have to be global since we are inside the implicit group +% of an alignment entry. Note that \everycr resets \everytab. +\def\headitem{\checkenv\multitable \crcr \global\everytab={\bf}\the\everytab}% +% +% A \tab used to include \hskip1sp. But then the space in a template +% line is not enough. That is bad. So let's go back to just `&' until +% we encounter the problem it was intended to solve again. +% --karl, nathan@acm.org, 20apr99. +\def\tab{\checkenv\multitable &\the\everytab}% + +% @multitable ... @end multitable definitions: +% +\newtoks\everytab % insert after every tab. +% +\envdef\multitable{% + \vskip\parskip + \startsavinginserts + % + % @item within a multitable starts a normal row. + % We use \def instead of \let so that if one of the multitable entries + % contains an @itemize, we don't choke on the \item (seen as \crcr aka + % \endtemplate) expanding \doitemize. + \def\item{\crcr}% + % + \tolerance=9500 + \hbadness=9500 + \setmultitablespacing + \parskip=\multitableparskip + \parindent=\multitableparindent + \overfullrule=0pt + \global\colcount=0 + % + \everycr = {% + \noalign{% + \global\everytab={}% + \global\colcount=0 % Reset the column counter. + % Check for saved footnotes, etc. + \checkinserts + % Keeps underfull box messages off when table breaks over pages. + %\filbreak + % Maybe so, but it also creates really weird page breaks when the + % table breaks over pages. Wouldn't \vfil be better? Wait until the + % problem manifests itself, so it can be fixed for real --karl. + }% + }% + % + \parsearg\domultitable +} +\def\domultitable#1{% + % To parse everything between @multitable and @item: + \setuptable#1 \endsetuptable + % + % This preamble sets up a generic column definition, which will + % be used as many times as user calls for columns. + % \vtop will set a single line and will also let text wrap and + % continue for many paragraphs if desired. + \halign\bgroup &% + \global\advance\colcount by 1 + \multistrut + \vtop{% + % Use the current \colcount to find the correct column width: + \hsize=\expandafter\csname col\the\colcount\endcsname + % + % In order to keep entries from bumping into each other + % we will add a \leftskip of \multitablecolspace to all columns after + % the first one. + % + % If a template has been used, we will add \multitablecolspace + % to the width of each template entry. + % + % If the user has set preamble in terms of percent of \hsize we will + % use that dimension as the width of the column, and the \leftskip + % will keep entries from bumping into each other. Table will start at + % left margin and final column will justify at right margin. + % + % Make sure we don't inherit \rightskip from the outer environment. + \rightskip=0pt + \ifnum\colcount=1 + % The first column will be indented with the surrounding text. + \advance\hsize by\leftskip + \else + \ifsetpercent \else + % If user has not set preamble in terms of percent of \hsize + % we will advance \hsize by \multitablecolspace. + \advance\hsize by \multitablecolspace + \fi + % In either case we will make \leftskip=\multitablecolspace: + \leftskip=\multitablecolspace + \fi + % Ignoring space at the beginning and end avoids an occasional spurious + % blank line, when TeX decides to break the line at the space before the + % box from the multistrut, so the strut ends up on a line by itself. + % For example: + % @multitable @columnfractions .11 .89 + % @item @code{#} + % @tab Legal holiday which is valid in major parts of the whole country. + % Is automatically provided with highlighting sequences respectively + % marking characters. + \noindent\ignorespaces##\unskip\multistrut + }\cr +} +\def\Emultitable{% + \crcr + \egroup % end the \halign + \global\setpercentfalse +} + +\def\setmultitablespacing{% + \def\multistrut{\strut}% just use the standard line spacing + % + % Compute \multitablelinespace (if not defined by user) for use in + % \multitableparskip calculation. We used define \multistrut based on + % this, but (ironically) that caused the spacing to be off. + % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100. +\ifdim\multitablelinespace=0pt +\setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip +\global\advance\multitablelinespace by-\ht0 +\fi +%% Test to see if parskip is larger than space between lines of +%% table. If not, do nothing. +%% If so, set to same dimension as multitablelinespace. +\ifdim\multitableparskip>\multitablelinespace +\global\multitableparskip=\multitablelinespace +\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller + %% than skip between lines in the table. +\fi% +\ifdim\multitableparskip=0pt +\global\multitableparskip=\multitablelinespace +\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller + %% than skip between lines in the table. +\fi} + + +\message{conditionals,} + +% @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext, +% @ifnotxml always succeed. They currently do nothing; we don't +% attempt to check whether the conditionals are properly nested. But we +% have to remember that they are conditionals, so that @end doesn't +% attempt to close an environment group. +% +\def\makecond#1{% + \expandafter\let\csname #1\endcsname = \relax + \expandafter\let\csname iscond.#1\endcsname = 1 +} +\makecond{iftex} +\makecond{ifnotdocbook} +\makecond{ifnothtml} +\makecond{ifnotinfo} +\makecond{ifnotplaintext} +\makecond{ifnotxml} + +% Ignore @ignore, @ifhtml, @ifinfo, and the like. +% +\def\direntry{\doignore{direntry}} +\def\documentdescription{\doignore{documentdescription}} +\def\docbook{\doignore{docbook}} +\def\html{\doignore{html}} +\def\ifdocbook{\doignore{ifdocbook}} +\def\ifhtml{\doignore{ifhtml}} +\def\ifinfo{\doignore{ifinfo}} +\def\ifnottex{\doignore{ifnottex}} +\def\ifplaintext{\doignore{ifplaintext}} +\def\ifxml{\doignore{ifxml}} +\def\ignore{\doignore{ignore}} +\def\menu{\doignore{menu}} +\def\xml{\doignore{xml}} + +% Ignore text until a line `@end #1', keeping track of nested conditionals. +% +% A count to remember the depth of nesting. +\newcount\doignorecount + +\def\doignore#1{\begingroup + % Scan in ``verbatim'' mode: + \obeylines + \catcode`\@ = \other + \catcode`\{ = \other + \catcode`\} = \other + % + % Make sure that spaces turn into tokens that match what \doignoretext wants. + \spaceisspace + % + % Count number of #1's that we've seen. + \doignorecount = 0 + % + % Swallow text until we reach the matching `@end #1'. + \dodoignore{#1}% +} + +{ \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source. + \obeylines % + % + \gdef\dodoignore#1{% + % #1 contains the command name as a string, e.g., `ifinfo'. + % + % Define a command to find the next `@end #1'. + \long\def\doignoretext##1^^M@end #1{% + \doignoretextyyy##1^^M@#1\_STOP_}% + % + % And this command to find another #1 command, at the beginning of a + % line. (Otherwise, we would consider a line `@c @ifset', for + % example, to count as an @ifset for nesting.) + \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}% + % + % And now expand that command. + \doignoretext ^^M% + }% +} + +\def\doignoreyyy#1{% + \def\temp{#1}% + \ifx\temp\empty % Nothing found. + \let\next\doignoretextzzz + \else % Found a nested condition, ... + \advance\doignorecount by 1 + \let\next\doignoretextyyy % ..., look for another. + % If we're here, #1 ends with ^^M\ifinfo (for example). + \fi + \next #1% the token \_STOP_ is present just after this macro. +} + +% We have to swallow the remaining "\_STOP_". +% +\def\doignoretextzzz#1{% + \ifnum\doignorecount = 0 % We have just found the outermost @end. + \let\next\enddoignore + \else % Still inside a nested condition. + \advance\doignorecount by -1 + \let\next\doignoretext % Look for the next @end. + \fi + \next +} + +% Finish off ignored text. +{ \obeylines% + % Ignore anything after the last `@end #1'; this matters in verbatim + % environments, where otherwise the newline after an ignored conditional + % would result in a blank line in the output. + \gdef\enddoignore#1^^M{\endgroup\ignorespaces}% +} + + +% @set VAR sets the variable VAR to an empty value. +% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE. +% +% Since we want to separate VAR from REST-OF-LINE (which might be +% empty), we can't just use \parsearg; we have to insert a space of our +% own to delimit the rest of the line, and then take it out again if we +% didn't need it. +% We rely on the fact that \parsearg sets \catcode`\ =10. +% +\parseargdef\set{\setyyy#1 \endsetyyy} +\def\setyyy#1 #2\endsetyyy{% + {% + \makevalueexpandable + \def\temp{#2}% + \edef\next{\gdef\makecsname{SET#1}}% + \ifx\temp\empty + \next{}% + \else + \setzzz#2\endsetzzz + \fi + }% +} +% Remove the trailing space \setxxx inserted. +\def\setzzz#1 \endsetzzz{\next{#1}} + +% @clear VAR clears (i.e., unsets) the variable VAR. +% +\parseargdef\clear{% + {% + \makevalueexpandable + \global\expandafter\let\csname SET#1\endcsname=\relax + }% +} + +% @value{foo} gets the text saved in variable foo. +\def\value{\begingroup\makevalueexpandable\valuexxx} +\def\valuexxx#1{\expandablevalue{#1}\endgroup} +{ + \catcode`\- = \active \catcode`\_ = \active + % + \gdef\makevalueexpandable{% + \let\value = \expandablevalue + % We don't want these characters active, ... + \catcode`\-=\other \catcode`\_=\other + % ..., but we might end up with active ones in the argument if + % we're called from @code, as @code{@value{foo-bar_}}, though. + % So \let them to their normal equivalents. + \let-\realdash \let_\normalunderscore + } +} + +% We have this subroutine so that we can handle at least some @value's +% properly in indexes (we call \makevalueexpandable in \indexdummies). +% The command has to be fully expandable (if the variable is set), since +% the result winds up in the index file. This means that if the +% variable's value contains other Texinfo commands, it's almost certain +% it will fail (although perhaps we could fix that with sufficient work +% to do a one-level expansion on the result, instead of complete). +% +\def\expandablevalue#1{% + \expandafter\ifx\csname SET#1\endcsname\relax + {[No value for ``#1'']}% + \message{Variable `#1', used in @value, is not set.}% + \else + \csname SET#1\endcsname + \fi +} + +% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined +% with @set. +% +% To get special treatment of `@end ifset,' call \makeond and the redefine. +% +\makecond{ifset} +\def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}} +\def\doifset#1#2{% + {% + \makevalueexpandable + \let\next=\empty + \expandafter\ifx\csname SET#2\endcsname\relax + #1% If not set, redefine \next. + \fi + \expandafter + }\next +} +\def\ifsetfail{\doignore{ifset}} + +% @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been +% defined with @set, or has been undefined with @clear. +% +% The `\else' inside the `\doifset' parameter is a trick to reuse the +% above code: if the variable is not set, do nothing, if it is set, +% then redefine \next to \ifclearfail. +% +\makecond{ifclear} +\def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}} +\def\ifclearfail{\doignore{ifclear}} + +% @dircategory CATEGORY -- specify a category of the dir file +% which this file should belong to. Ignore this in TeX. +\let\dircategory=\comment + +% @defininfoenclose. +\let\definfoenclose=\comment + + +\message{indexing,} +% Index generation facilities + +% Define \newwrite to be identical to plain tex's \newwrite +% except not \outer, so it can be used within macros and \if's. +\edef\newwrite{\makecsname{ptexnewwrite}} + +% \newindex {foo} defines an index named foo. +% It automatically defines \fooindex such that +% \fooindex ...rest of line... puts an entry in the index foo. +% It also defines \fooindfile to be the number of the output channel for +% the file that accumulates this index. The file's extension is foo. +% The name of an index should be no more than 2 characters long +% for the sake of vms. +% +\def\newindex#1{% + \iflinks + \expandafter\newwrite \csname#1indfile\endcsname + \openout \csname#1indfile\endcsname \jobname.#1 % Open the file + \fi + \expandafter\xdef\csname#1index\endcsname{% % Define @#1index + \noexpand\doindex{#1}} +} + +% @defindex foo == \newindex{foo} +% +\def\defindex{\parsearg\newindex} + +% Define @defcodeindex, like @defindex except put all entries in @code. +% +\def\defcodeindex{\parsearg\newcodeindex} +% +\def\newcodeindex#1{% + \iflinks + \expandafter\newwrite \csname#1indfile\endcsname + \openout \csname#1indfile\endcsname \jobname.#1 + \fi + \expandafter\xdef\csname#1index\endcsname{% + \noexpand\docodeindex{#1}}% +} + + +% @synindex foo bar makes index foo feed into index bar. +% Do this instead of @defindex foo if you don't want it as a separate index. +% +% @syncodeindex foo bar similar, but put all entries made for index foo +% inside @code. +% +\def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}} +\def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}} + +% #1 is \doindex or \docodeindex, #2 the index getting redefined (foo), +% #3 the target index (bar). +\def\dosynindex#1#2#3{% + % Only do \closeout if we haven't already done it, else we'll end up + % closing the target index. + \expandafter \ifx\csname donesynindex#2\endcsname \undefined + % The \closeout helps reduce unnecessary open files; the limit on the + % Acorn RISC OS is a mere 16 files. + \expandafter\closeout\csname#2indfile\endcsname + \expandafter\let\csname\donesynindex#2\endcsname = 1 + \fi + % redefine \fooindfile: + \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname + \expandafter\let\csname#2indfile\endcsname=\temp + % redefine \fooindex: + \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}% +} + +% Define \doindex, the driver for all \fooindex macros. +% Argument #1 is generated by the calling \fooindex macro, +% and it is "foo", the name of the index. + +% \doindex just uses \parsearg; it calls \doind for the actual work. +% This is because \doind is more useful to call from other macros. + +% There is also \dosubind {index}{topic}{subtopic} +% which makes an entry in a two-level index such as the operation index. + +\def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer} +\def\singleindexer #1{\doind{\indexname}{#1}} + +% like the previous two, but they put @code around the argument. +\def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer} +\def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}} + +% Take care of Texinfo commands that can appear in an index entry. +% Since there are some commands we want to expand, and others we don't, +% we have to laboriously prevent expansion for those that we don't. +% +\def\indexdummies{% + \escapechar = `\\ % use backslash in output files. + \def\@{@}% change to @@ when we switch to @ as escape char in index files. + \def\ {\realbackslash\space }% + % + % Need these in case \tex is in effect and \{ is a \delimiter again. + % But can't use \lbracecmd and \rbracecmd because texindex assumes + % braces and backslashes are used only as delimiters. + \let\{ = \mylbrace + \let\} = \myrbrace + % + % I don't entirely understand this, but when an index entry is + % generated from a macro call, the \endinput which \scanmacro inserts + % causes processing to be prematurely terminated. This is, + % apparently, because \indexsorttmp is fully expanded, and \endinput + % is an expandable command. The redefinition below makes \endinput + % disappear altogether for that purpose -- although logging shows that + % processing continues to some further point. On the other hand, it + % seems \endinput does not hurt in the printed index arg, since that + % is still getting written without apparent harm. + % + % Sample source (mac-idx3.tex, reported by Graham Percival to + % help-texinfo, 22may06): + % @macro funindex {WORD} + % @findex xyz + % @end macro + % ... + % @funindex commtest + % + % The above is not enough to reproduce the bug, but it gives the flavor. + % + % Sample whatsit resulting: + % .@write3{\entry{xyz}{@folio }{@code {xyz@endinput }}} + % + % So: + \let\endinput = \empty + % + % Do the redefinitions. + \commondummies +} + +% For the aux and toc files, @ is the escape character. So we want to +% redefine everything using @ as the escape character (instead of +% \realbackslash, still used for index files). When everything uses @, +% this will be simpler. +% +\def\atdummies{% + \def\@{@@}% + \def\ {@ }% + \let\{ = \lbraceatcmd + \let\} = \rbraceatcmd + % + % Do the redefinitions. + \commondummies + \otherbackslash +} + +% Called from \indexdummies and \atdummies. +% +\def\commondummies{% + % + % \definedummyword defines \#1 as \string\#1\space, thus effectively + % preventing its expansion. This is used only for control% words, + % not control letters, because the \space would be incorrect for + % control characters, but is needed to separate the control word + % from whatever follows. + % + % For control letters, we have \definedummyletter, which omits the + % space. + % + % These can be used both for control words that take an argument and + % those that do not. If it is followed by {arg} in the input, then + % that will dutifully get written to the index (or wherever). + % + \def\definedummyword ##1{\def##1{\string##1\space}}% + \def\definedummyletter##1{\def##1{\string##1}}% + \let\definedummyaccent\definedummyletter + % + \commondummiesnofonts + % + \definedummyletter\_% + % + % Non-English letters. + \definedummyword\AA + \definedummyword\AE + \definedummyword\L + \definedummyword\OE + \definedummyword\O + \definedummyword\aa + \definedummyword\ae + \definedummyword\l + \definedummyword\oe + \definedummyword\o + \definedummyword\ss + \definedummyword\exclamdown + \definedummyword\questiondown + \definedummyword\ordf + \definedummyword\ordm + % + % Although these internal commands shouldn't show up, sometimes they do. + \definedummyword\bf + \definedummyword\gtr + \definedummyword\hat + \definedummyword\less + \definedummyword\sf + \definedummyword\sl + \definedummyword\tclose + \definedummyword\tt + % + \definedummyword\LaTeX + \definedummyword\TeX + % + % Assorted special characters. + \definedummyword\bullet + \definedummyword\comma + \definedummyword\copyright + \definedummyword\registeredsymbol + \definedummyword\dots + \definedummyword\enddots + \definedummyword\equiv + \definedummyword\error + \definedummyword\euro + \definedummyword\guillemetleft + \definedummyword\guillemetright + \definedummyword\guilsinglleft + \definedummyword\guilsinglright + \definedummyword\expansion + \definedummyword\minus + \definedummyword\pounds + \definedummyword\point + \definedummyword\print + \definedummyword\quotedblbase + \definedummyword\quotedblleft + \definedummyword\quotedblright + \definedummyword\quoteleft + \definedummyword\quoteright + \definedummyword\quotesinglbase + \definedummyword\result + \definedummyword\textdegree + % + % We want to disable all macros so that they are not expanded by \write. + \macrolist + % + \normalturnoffactive + % + % Handle some cases of @value -- where it does not contain any + % (non-fully-expandable) commands. + \makevalueexpandable +} + +% \commondummiesnofonts: common to \commondummies and \indexnofonts. +% +\def\commondummiesnofonts{% + % Control letters and accents. + \definedummyletter\!% + \definedummyaccent\"% + \definedummyaccent\'% + \definedummyletter\*% + \definedummyaccent\,% + \definedummyletter\.% + \definedummyletter\/% + \definedummyletter\:% + \definedummyaccent\=% + \definedummyletter\?% + \definedummyaccent\^% + \definedummyaccent\`% + \definedummyaccent\~% + \definedummyword\u + \definedummyword\v + \definedummyword\H + \definedummyword\dotaccent + \definedummyword\ringaccent + \definedummyword\tieaccent + \definedummyword\ubaraccent + \definedummyword\udotaccent + \definedummyword\dotless + % + % Texinfo font commands. + \definedummyword\b + \definedummyword\i + \definedummyword\r + \definedummyword\sc + \definedummyword\t + % + % Commands that take arguments. + \definedummyword\acronym + \definedummyword\cite + \definedummyword\code + \definedummyword\command + \definedummyword\dfn + \definedummyword\emph + \definedummyword\env + \definedummyword\file + \definedummyword\kbd + \definedummyword\key + \definedummyword\math + \definedummyword\option + \definedummyword\pxref + \definedummyword\ref + \definedummyword\samp + \definedummyword\strong + \definedummyword\tie + \definedummyword\uref + \definedummyword\url + \definedummyword\var + \definedummyword\verb + \definedummyword\w + \definedummyword\xref +} + +% \indexnofonts is used when outputting the strings to sort the index +% by, and when constructing control sequence names. It eliminates all +% control sequences and just writes whatever the best ASCII sort string +% would be for a given command (usually its argument). +% +\def\indexnofonts{% + % Accent commands should become @asis. + \def\definedummyaccent##1{\let##1\asis}% + % We can just ignore other control letters. + \def\definedummyletter##1{\let##1\empty}% + % Hopefully, all control words can become @asis. + \let\definedummyword\definedummyaccent + % + \commondummiesnofonts + % + % Don't no-op \tt, since it isn't a user-level command + % and is used in the definitions of the active chars like <, >, |, etc. + % Likewise with the other plain tex font commands. + %\let\tt=\asis + % + \def\ { }% + \def\@{@}% + % how to handle braces? + \def\_{\normalunderscore}% + % + % Non-English letters. + \def\AA{AA}% + \def\AE{AE}% + \def\L{L}% + \def\OE{OE}% + \def\O{O}% + \def\aa{aa}% + \def\ae{ae}% + \def\l{l}% + \def\oe{oe}% + \def\o{o}% + \def\ss{ss}% + \def\exclamdown{!}% + \def\questiondown{?}% + \def\ordf{a}% + \def\ordm{o}% + % + \def\LaTeX{LaTeX}% + \def\TeX{TeX}% + % + % Assorted special characters. + % (The following {} will end up in the sort string, but that's ok.) + \def\bullet{bullet}% + \def\comma{,}% + \def\copyright{copyright}% + \def\registeredsymbol{R}% + \def\dots{...}% + \def\enddots{...}% + \def\equiv{==}% + \def\error{error}% + \def\euro{euro}% + \def\guillemetleft{<<}% + \def\guillemetright{>>}% + \def\guilsinglleft{<}% + \def\guilsinglright{>}% + \def\expansion{==>}% + \def\minus{-}% + \def\pounds{pounds}% + \def\point{.}% + \def\print{-|}% + \def\quotedblbase{"}% + \def\quotedblleft{"}% + \def\quotedblright{"}% + \def\quoteleft{`}% + \def\quoteright{'}% + \def\quotesinglbase{,}% + \def\result{=>}% + \def\textdegree{degrees}% + % + % We need to get rid of all macros, leaving only the arguments (if present). + % Of course this is not nearly correct, but it is the best we can do for now. + % makeinfo does not expand macros in the argument to @deffn, which ends up + % writing an index entry, and texindex isn't prepared for an index sort entry + % that starts with \. + % + % Since macro invocations are followed by braces, we can just redefine them + % to take a single TeX argument. The case of a macro invocation that + % goes to end-of-line is not handled. + % + \macrolist +} + +\let\indexbackslash=0 %overridden during \printindex. +\let\SETmarginindex=\relax % put index entries in margin (undocumented)? + +% Most index entries go through here, but \dosubind is the general case. +% #1 is the index name, #2 is the entry text. +\def\doind#1#2{\dosubind{#1}{#2}{}} + +% Workhorse for all \fooindexes. +% #1 is name of index, #2 is stuff to put there, #3 is subentry -- +% empty if called from \doind, as we usually are (the main exception +% is with most defuns, which call us directly). +% +\def\dosubind#1#2#3{% + \iflinks + {% + % Store the main index entry text (including the third arg). + \toks0 = {#2}% + % If third arg is present, precede it with a space. + \def\thirdarg{#3}% + \ifx\thirdarg\empty \else + \toks0 = \expandafter{\the\toks0 \space #3}% + \fi + % + \edef\writeto{\csname#1indfile\endcsname}% + % + \safewhatsit\dosubindwrite + }% + \fi +} + +% Write the entry in \toks0 to the index file: +% +\def\dosubindwrite{% + % Put the index entry in the margin if desired. + \ifx\SETmarginindex\relax\else + \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}% + \fi + % + % Remember, we are within a group. + \indexdummies % Must do this here, since \bf, etc expand at this stage + \def\backslashcurfont{\indexbackslash}% \indexbackslash isn't defined now + % so it will be output as is; and it will print as backslash. + % + % Process the index entry with all font commands turned off, to + % get the string to sort by. + {\indexnofonts + \edef\temp{\the\toks0}% need full expansion + \xdef\indexsorttmp{\temp}% + }% + % + % Set up the complete index entry, with both the sort key and + % the original text, including any font commands. We write + % three arguments to \entry to the .?? file (four in the + % subentry case), texindex reduces to two when writing the .??s + % sorted result. + \edef\temp{% + \write\writeto{% + \string\entry{\indexsorttmp}{\noexpand\folio}{\the\toks0}}% + }% + \temp +} + +% Take care of unwanted page breaks/skips around a whatsit: +% +% If a skip is the last thing on the list now, preserve it +% by backing up by \lastskip, doing the \write, then inserting +% the skip again. Otherwise, the whatsit generated by the +% \write or \pdfdest will make \lastskip zero. The result is that +% sequences like this: +% @end defun +% @tindex whatever +% @defun ... +% will have extra space inserted, because the \medbreak in the +% start of the @defun won't see the skip inserted by the @end of +% the previous defun. +% +% But don't do any of this if we're not in vertical mode. We +% don't want to do a \vskip and prematurely end a paragraph. +% +% Avoid page breaks due to these extra skips, too. +% +% But wait, there is a catch there: +% We'll have to check whether \lastskip is zero skip. \ifdim is not +% sufficient for this purpose, as it ignores stretch and shrink parts +% of the skip. The only way seems to be to check the textual +% representation of the skip. +% +% The following is almost like \def\zeroskipmacro{0.0pt} except that +% the ``p'' and ``t'' characters have catcode \other, not 11 (letter). +% +\edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname} +% +\newskip\whatsitskip +\newcount\whatsitpenalty +% +% ..., ready, GO: +% +\def\safewhatsit#1{% +\ifhmode + #1% +\else + % \lastskip and \lastpenalty cannot both be nonzero simultaneously. + \whatsitskip = \lastskip + \edef\lastskipmacro{\the\lastskip}% + \whatsitpenalty = \lastpenalty + % + % If \lastskip is nonzero, that means the last item was a + % skip. And since a skip is discardable, that means this + % -\whatsitskip glue we're inserting is preceded by a + % non-discardable item, therefore it is not a potential + % breakpoint, therefore no \nobreak needed. + \ifx\lastskipmacro\zeroskipmacro + \else + \vskip-\whatsitskip + \fi + % + #1% + % + \ifx\lastskipmacro\zeroskipmacro + % If \lastskip was zero, perhaps the last item was a penalty, and + % perhaps it was >=10000, e.g., a \nobreak. In that case, we want + % to re-insert the same penalty (values >10000 are used for various + % signals); since we just inserted a non-discardable item, any + % following glue (such as a \parskip) would be a breakpoint. For example: + % + % @deffn deffn-whatever + % @vindex index-whatever + % Description. + % would allow a break between the index-whatever whatsit + % and the "Description." paragraph. + \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi + \else + % On the other hand, if we had a nonzero \lastskip, + % this make-up glue would be preceded by a non-discardable item + % (the whatsit from the \write), so we must insert a \nobreak. + \nobreak\vskip\whatsitskip + \fi +\fi +} + +% The index entry written in the file actually looks like +% \entry {sortstring}{page}{topic} +% or +% \entry {sortstring}{page}{topic}{subtopic} +% The texindex program reads in these files and writes files +% containing these kinds of lines: +% \initial {c} +% before the first topic whose initial is c +% \entry {topic}{pagelist} +% for a topic that is used without subtopics +% \primary {topic} +% for the beginning of a topic that is used with subtopics +% \secondary {subtopic}{pagelist} +% for each subtopic. + +% Define the user-accessible indexing commands +% @findex, @vindex, @kindex, @cindex. + +\def\findex {\fnindex} +\def\kindex {\kyindex} +\def\cindex {\cpindex} +\def\vindex {\vrindex} +\def\tindex {\tpindex} +\def\pindex {\pgindex} + +\def\cindexsub {\begingroup\obeylines\cindexsub} +{\obeylines % +\gdef\cindexsub "#1" #2^^M{\endgroup % +\dosubind{cp}{#2}{#1}}} + +% Define the macros used in formatting output of the sorted index material. + +% @printindex causes a particular index (the ??s file) to get printed. +% It does not print any chapter heading (usually an @unnumbered). +% +\parseargdef\printindex{\begingroup + \dobreak \chapheadingskip{10000}% + % + \smallfonts \rm + \tolerance = 9500 + \plainfrenchspacing + \everypar = {}% don't want the \kern\-parindent from indentation suppression. + % + % See if the index file exists and is nonempty. + % Change catcode of @ here so that if the index file contains + % \initial {@} + % as its first line, TeX doesn't complain about mismatched braces + % (because it thinks @} is a control sequence). + \catcode`\@ = 11 + \openin 1 \jobname.#1s + \ifeof 1 + % \enddoublecolumns gets confused if there is no text in the index, + % and it loses the chapter title and the aux file entries for the + % index. The easiest way to prevent this problem is to make sure + % there is some text. + \putwordIndexNonexistent + \else + % + % If the index file exists but is empty, then \openin leaves \ifeof + % false. We have to make TeX try to read something from the file, so + % it can discover if there is anything in it. + \read 1 to \temp + \ifeof 1 + \putwordIndexIsEmpty + \else + % Index files are almost Texinfo source, but we use \ as the escape + % character. It would be better to use @, but that's too big a change + % to make right now. + \def\indexbackslash{\backslashcurfont}% + \catcode`\\ = 0 + \escapechar = `\\ + \begindoublecolumns + \input \jobname.#1s + \enddoublecolumns + \fi + \fi + \closein 1 +\endgroup} + +% These macros are used by the sorted index file itself. +% Change them to control the appearance of the index. + +\def\initial#1{{% + % Some minor font changes for the special characters. + \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt + % + % Remove any glue we may have, we'll be inserting our own. + \removelastskip + % + % We like breaks before the index initials, so insert a bonus. + \nobreak + \vskip 0pt plus 3\baselineskip + \penalty 0 + \vskip 0pt plus -3\baselineskip + % + % Typeset the initial. Making this add up to a whole number of + % baselineskips increases the chance of the dots lining up from column + % to column. It still won't often be perfect, because of the stretch + % we need before each entry, but it's better. + % + % No shrink because it confuses \balancecolumns. + \vskip 1.67\baselineskip plus .5\baselineskip + \leftline{\secbf #1}% + % Do our best not to break after the initial. + \nobreak + \vskip .33\baselineskip plus .1\baselineskip +}} + +% \entry typesets a paragraph consisting of the text (#1), dot leaders, and +% then page number (#2) flushed to the right margin. It is used for index +% and table of contents entries. The paragraph is indented by \leftskip. +% +% A straightforward implementation would start like this: +% \def\entry#1#2{... +% But this frozes the catcodes in the argument, and can cause problems to +% @code, which sets - active. This problem was fixed by a kludge--- +% ``-'' was active throughout whole index, but this isn't really right. +% +% The right solution is to prevent \entry from swallowing the whole text. +% --kasal, 21nov03 +\def\entry{% + \begingroup + % + % Start a new paragraph if necessary, so our assignments below can't + % affect previous text. + \par + % + % Do not fill out the last line with white space. + \parfillskip = 0in + % + % No extra space above this paragraph. + \parskip = 0in + % + % Do not prefer a separate line ending with a hyphen to fewer lines. + \finalhyphendemerits = 0 + % + % \hangindent is only relevant when the entry text and page number + % don't both fit on one line. In that case, bob suggests starting the + % dots pretty far over on the line. Unfortunately, a large + % indentation looks wrong when the entry text itself is broken across + % lines. So we use a small indentation and put up with long leaders. + % + % \hangafter is reset to 1 (which is the value we want) at the start + % of each paragraph, so we need not do anything with that. + \hangindent = 2em + % + % When the entry text needs to be broken, just fill out the first line + % with blank space. + \rightskip = 0pt plus1fil + % + % A bit of stretch before each entry for the benefit of balancing + % columns. + \vskip 0pt plus1pt + % + % Swallow the left brace of the text (first parameter): + \afterassignment\doentry + \let\temp = +} +\def\doentry{% + \bgroup % Instead of the swallowed brace. + \noindent + \aftergroup\finishentry + % And now comes the text of the entry. +} +\def\finishentry#1{% + % #1 is the page number. + % + % The following is kludged to not output a line of dots in the index if + % there are no page numbers. The next person who breaks this will be + % cursed by a Unix daemon. + \setbox\boxA = \hbox{#1}% + \ifdim\wd\boxA = 0pt + \ % + \else + % + % If we must, put the page number on a line of its own, and fill out + % this line with blank space. (The \hfil is overwhelmed with the + % fill leaders glue in \indexdotfill if the page number does fit.) + \hfil\penalty50 + \null\nobreak\indexdotfill % Have leaders before the page number. + % + % The `\ ' here is removed by the implicit \unskip that TeX does as + % part of (the primitive) \par. Without it, a spurious underfull + % \hbox ensues. + \ifpdf + \pdfgettoks#1.% + \ \the\toksA + \else + \ #1% + \fi + \fi + \par + \endgroup +} + +% Like plain.tex's \dotfill, except uses up at least 1 em. +\def\indexdotfill{\cleaders + \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1fill} + +\def\primary #1{\line{#1\hfil}} + +\newskip\secondaryindent \secondaryindent=0.5cm +\def\secondary#1#2{{% + \parfillskip=0in + \parskip=0in + \hangindent=1in + \hangafter=1 + \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill + \ifpdf + \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph. + \else + #2 + \fi + \par +}} + +% Define two-column mode, which we use to typeset indexes. +% Adapted from the TeXbook, page 416, which is to say, +% the manmac.tex format used to print the TeXbook itself. +\catcode`\@=11 + +\newbox\partialpage +\newdimen\doublecolumnhsize + +\def\begindoublecolumns{\begingroup % ended by \enddoublecolumns + % Grab any single-column material above us. + \output = {% + % + % Here is a possibility not foreseen in manmac: if we accumulate a + % whole lot of material, we might end up calling this \output + % routine twice in a row (see the doublecol-lose test, which is + % essentially a couple of indexes with @setchapternewpage off). In + % that case we just ship out what is in \partialpage with the normal + % output routine. Generally, \partialpage will be empty when this + % runs and this will be a no-op. See the indexspread.tex test case. + \ifvoid\partialpage \else + \onepageout{\pagecontents\partialpage}% + \fi + % + \global\setbox\partialpage = \vbox{% + % Unvbox the main output page. + \unvbox\PAGE + \kern-\topskip \kern\baselineskip + }% + }% + \eject % run that output routine to set \partialpage + % + % Use the double-column output routine for subsequent pages. + \output = {\doublecolumnout}% + % + % Change the page size parameters. We could do this once outside this + % routine, in each of @smallbook, @afourpaper, and the default 8.5x11 + % format, but then we repeat the same computation. Repeating a couple + % of assignments once per index is clearly meaningless for the + % execution time, so we may as well do it in one place. + % + % First we halve the line length, less a little for the gutter between + % the columns. We compute the gutter based on the line length, so it + % changes automatically with the paper format. The magic constant + % below is chosen so that the gutter has the same value (well, +-<1pt) + % as it did when we hard-coded it. + % + % We put the result in a separate register, \doublecolumhsize, so we + % can restore it in \pagesofar, after \hsize itself has (potentially) + % been clobbered. + % + \doublecolumnhsize = \hsize + \advance\doublecolumnhsize by -.04154\hsize + \divide\doublecolumnhsize by 2 + \hsize = \doublecolumnhsize + % + % Double the \vsize as well. (We don't need a separate register here, + % since nobody clobbers \vsize.) + \vsize = 2\vsize +} + +% The double-column output routine for all double-column pages except +% the last. +% +\def\doublecolumnout{% + \splittopskip=\topskip \splitmaxdepth=\maxdepth + % Get the available space for the double columns -- the normal + % (undoubled) page height minus any material left over from the + % previous page. + \dimen@ = \vsize + \divide\dimen@ by 2 + \advance\dimen@ by -\ht\partialpage + % + % box0 will be the left-hand column, box2 the right. + \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@ + \onepageout\pagesofar + \unvbox255 + \penalty\outputpenalty +} +% +% Re-output the contents of the output page -- any previous material, +% followed by the two boxes we just split, in box0 and box2. +\def\pagesofar{% + \unvbox\partialpage + % + \hsize = \doublecolumnhsize + \wd0=\hsize \wd2=\hsize + \hbox to\pagewidth{\box0\hfil\box2}% +} +% +% All done with double columns. +\def\enddoublecolumns{% + % The following penalty ensures that the page builder is exercised + % _before_ we change the output routine. This is necessary in the + % following situation: + % + % The last section of the index consists only of a single entry. + % Before this section, \pagetotal is less than \pagegoal, so no + % break occurs before the last section starts. However, the last + % section, consisting of \initial and the single \entry, does not + % fit on the page and has to be broken off. Without the following + % penalty the page builder will not be exercised until \eject + % below, and by that time we'll already have changed the output + % routine to the \balancecolumns version, so the next-to-last + % double-column page will be processed with \balancecolumns, which + % is wrong: The two columns will go to the main vertical list, with + % the broken-off section in the recent contributions. As soon as + % the output routine finishes, TeX starts reconsidering the page + % break. The two columns and the broken-off section both fit on the + % page, because the two columns now take up only half of the page + % goal. When TeX sees \eject from below which follows the final + % section, it invokes the new output routine that we've set after + % \balancecolumns below; \onepageout will try to fit the two columns + % and the final section into the vbox of \pageheight (see + % \pagebody), causing an overfull box. + % + % Note that glue won't work here, because glue does not exercise the + % page builder, unlike penalties (see The TeXbook, pp. 280-281). + \penalty0 + % + \output = {% + % Split the last of the double-column material. Leave it on the + % current page, no automatic page break. + \balancecolumns + % + % If we end up splitting too much material for the current page, + % though, there will be another page break right after this \output + % invocation ends. Having called \balancecolumns once, we do not + % want to call it again. Therefore, reset \output to its normal + % definition right away. (We hope \balancecolumns will never be + % called on to balance too much material, but if it is, this makes + % the output somewhat more palatable.) + \global\output = {\onepageout{\pagecontents\PAGE}}% + }% + \eject + \endgroup % started in \begindoublecolumns + % + % \pagegoal was set to the doubled \vsize above, since we restarted + % the current page. We're now back to normal single-column + % typesetting, so reset \pagegoal to the normal \vsize (after the + % \endgroup where \vsize got restored). + \pagegoal = \vsize +} +% +% Called at the end of the double column material. +\def\balancecolumns{% + \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120. + \dimen@ = \ht0 + \advance\dimen@ by \topskip + \advance\dimen@ by-\baselineskip + \divide\dimen@ by 2 % target to split to + %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}% + \splittopskip = \topskip + % Loop until we get a decent breakpoint. + {% + \vbadness = 10000 + \loop + \global\setbox3 = \copy0 + \global\setbox1 = \vsplit3 to \dimen@ + \ifdim\ht3>\dimen@ + \global\advance\dimen@ by 1pt + \repeat + }% + %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}% + \setbox0=\vbox to\dimen@{\unvbox1}% + \setbox2=\vbox to\dimen@{\unvbox3}% + % + \pagesofar +} +\catcode`\@ = \other + + +\message{sectioning,} +% Chapters, sections, etc. + +% \unnumberedno is an oxymoron, of course. But we count the unnumbered +% sections so that we can refer to them unambiguously in the pdf +% outlines by their "section number". We avoid collisions with chapter +% numbers by starting them at 10000. (If a document ever has 10000 +% chapters, we're in trouble anyway, I'm sure.) +\newcount\unnumberedno \unnumberedno = 10000 +\newcount\chapno +\newcount\secno \secno=0 +\newcount\subsecno \subsecno=0 +\newcount\subsubsecno \subsubsecno=0 + +% This counter is funny since it counts through charcodes of letters A, B, ... +\newcount\appendixno \appendixno = `\@ +% +% \def\appendixletter{\char\the\appendixno} +% We do the following ugly conditional instead of the above simple +% construct for the sake of pdftex, which needs the actual +% letter in the expansion, not just typeset. +% +\def\appendixletter{% + \ifnum\appendixno=`A A% + \else\ifnum\appendixno=`B B% + \else\ifnum\appendixno=`C C% + \else\ifnum\appendixno=`D D% + \else\ifnum\appendixno=`E E% + \else\ifnum\appendixno=`F F% + \else\ifnum\appendixno=`G G% + \else\ifnum\appendixno=`H H% + \else\ifnum\appendixno=`I I% + \else\ifnum\appendixno=`J J% + \else\ifnum\appendixno=`K K% + \else\ifnum\appendixno=`L L% + \else\ifnum\appendixno=`M M% + \else\ifnum\appendixno=`N N% + \else\ifnum\appendixno=`O O% + \else\ifnum\appendixno=`P P% + \else\ifnum\appendixno=`Q Q% + \else\ifnum\appendixno=`R R% + \else\ifnum\appendixno=`S S% + \else\ifnum\appendixno=`T T% + \else\ifnum\appendixno=`U U% + \else\ifnum\appendixno=`V V% + \else\ifnum\appendixno=`W W% + \else\ifnum\appendixno=`X X% + \else\ifnum\appendixno=`Y Y% + \else\ifnum\appendixno=`Z Z% + % The \the is necessary, despite appearances, because \appendixletter is + % expanded while writing the .toc file. \char\appendixno is not + % expandable, thus it is written literally, thus all appendixes come out + % with the same letter (or @) in the toc without it. + \else\char\the\appendixno + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} + +% Each @chapter defines these (using marks) as the number+name, number +% and name of the chapter. Page headings and footings can use +% these. @section does likewise. +\def\thischapter{} +\def\thischapternum{} +\def\thischaptername{} +\def\thissection{} +\def\thissectionnum{} +\def\thissectionname{} + +\newcount\absseclevel % used to calculate proper heading level +\newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count + +% @raisesections: treat @section as chapter, @subsection as section, etc. +\def\raisesections{\global\advance\secbase by -1} +\let\up=\raisesections % original BFox name + +% @lowersections: treat @chapter as section, @section as subsection, etc. +\def\lowersections{\global\advance\secbase by 1} +\let\down=\lowersections % original BFox name + +% we only have subsub. +\chardef\maxseclevel = 3 +% +% A numbered section within an unnumbered changes to unnumbered too. +% To achive this, remember the "biggest" unnum. sec. we are currently in: +\chardef\unmlevel = \maxseclevel +% +% Trace whether the current chapter is an appendix or not: +% \chapheadtype is "N" or "A", unnumbered chapters are ignored. +\def\chapheadtype{N} + +% Choose a heading macro +% #1 is heading type +% #2 is heading level +% #3 is text for heading +\def\genhead#1#2#3{% + % Compute the abs. sec. level: + \absseclevel=#2 + \advance\absseclevel by \secbase + % Make sure \absseclevel doesn't fall outside the range: + \ifnum \absseclevel < 0 + \absseclevel = 0 + \else + \ifnum \absseclevel > 3 + \absseclevel = 3 + \fi + \fi + % The heading type: + \def\headtype{#1}% + \if \headtype U% + \ifnum \absseclevel < \unmlevel + \chardef\unmlevel = \absseclevel + \fi + \else + % Check for appendix sections: + \ifnum \absseclevel = 0 + \edef\chapheadtype{\headtype}% + \else + \if \headtype A\if \chapheadtype N% + \errmessage{@appendix... within a non-appendix chapter}% + \fi\fi + \fi + % Check for numbered within unnumbered: + \ifnum \absseclevel > \unmlevel + \def\headtype{U}% + \else + \chardef\unmlevel = 3 + \fi + \fi + % Now print the heading: + \if \headtype U% + \ifcase\absseclevel + \unnumberedzzz{#3}% + \or \unnumberedseczzz{#3}% + \or \unnumberedsubseczzz{#3}% + \or \unnumberedsubsubseczzz{#3}% + \fi + \else + \if \headtype A% + \ifcase\absseclevel + \appendixzzz{#3}% + \or \appendixsectionzzz{#3}% + \or \appendixsubseczzz{#3}% + \or \appendixsubsubseczzz{#3}% + \fi + \else + \ifcase\absseclevel + \chapterzzz{#3}% + \or \seczzz{#3}% + \or \numberedsubseczzz{#3}% + \or \numberedsubsubseczzz{#3}% + \fi + \fi + \fi + \suppressfirstparagraphindent +} + +% an interface: +\def\numhead{\genhead N} +\def\apphead{\genhead A} +\def\unnmhead{\genhead U} + +% @chapter, @appendix, @unnumbered. Increment top-level counter, reset +% all lower-level sectioning counters to zero. +% +% Also set \chaplevelprefix, which we prepend to @float sequence numbers +% (e.g., figures), q.v. By default (before any chapter), that is empty. +\let\chaplevelprefix = \empty +% +\outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz +\def\chapterzzz#1{% + % section resetting is \global in case the chapter is in a group, such + % as an @include file. + \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 + \global\advance\chapno by 1 + % + % Used for \float. + \gdef\chaplevelprefix{\the\chapno.}% + \resetallfloatnos + % + \message{\putwordChapter\space \the\chapno}% + % + % Write the actual heading. + \chapmacro{#1}{Ynumbered}{\the\chapno}% + % + % So @section and the like are numbered underneath this chapter. + \global\let\section = \numberedsec + \global\let\subsection = \numberedsubsec + \global\let\subsubsection = \numberedsubsubsec +} + +\outer\parseargdef\appendix{\apphead0{#1}} % normally apphead0 calls appendixzzz +\def\appendixzzz#1{% + \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 + \global\advance\appendixno by 1 + \gdef\chaplevelprefix{\appendixletter.}% + \resetallfloatnos + % + \def\appendixnum{\putwordAppendix\space \appendixletter}% + \message{\appendixnum}% + % + \chapmacro{#1}{Yappendix}{\appendixletter}% + % + \global\let\section = \appendixsec + \global\let\subsection = \appendixsubsec + \global\let\subsubsection = \appendixsubsubsec +} + +\outer\parseargdef\unnumbered{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz +\def\unnumberedzzz#1{% + \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 + \global\advance\unnumberedno by 1 + % + % Since an unnumbered has no number, no prefix for figures. + \global\let\chaplevelprefix = \empty + \resetallfloatnos + % + % This used to be simply \message{#1}, but TeX fully expands the + % argument to \message. Therefore, if #1 contained @-commands, TeX + % expanded them. For example, in `@unnumbered The @cite{Book}', TeX + % expanded @cite (which turns out to cause errors because \cite is meant + % to be executed, not expanded). + % + % Anyway, we don't want the fully-expanded definition of @cite to appear + % as a result of the \message, we just want `@cite' itself. We use + % \the<toks register> to achieve this: TeX expands \the<toks> only once, + % simply yielding the contents of <toks register>. (We also do this for + % the toc entries.) + \toks0 = {#1}% + \message{(\the\toks0)}% + % + \chapmacro{#1}{Ynothing}{\the\unnumberedno}% + % + \global\let\section = \unnumberedsec + \global\let\subsection = \unnumberedsubsec + \global\let\subsubsection = \unnumberedsubsubsec +} + +% @centerchap is like @unnumbered, but the heading is centered. +\outer\parseargdef\centerchap{% + % Well, we could do the following in a group, but that would break + % an assumption that \chapmacro is called at the outermost level. + % Thus we are safer this way: --kasal, 24feb04 + \let\centerparametersmaybe = \centerparameters + \unnmhead0{#1}% + \let\centerparametersmaybe = \relax +} + +% @top is like @unnumbered. +\let\top\unnumbered + +% Sections. +\outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz +\def\seczzz#1{% + \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 + \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}% +} + +\outer\parseargdef\appendixsection{\apphead1{#1}} % normally calls appendixsectionzzz +\def\appendixsectionzzz#1{% + \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 + \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}% +} +\let\appendixsec\appendixsection + +\outer\parseargdef\unnumberedsec{\unnmhead1{#1}} % normally calls unnumberedseczzz +\def\unnumberedseczzz#1{% + \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 + \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}% +} + +% Subsections. +\outer\parseargdef\numberedsubsec{\numhead2{#1}} % normally calls numberedsubseczzz +\def\numberedsubseczzz#1{% + \global\subsubsecno=0 \global\advance\subsecno by 1 + \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}% +} + +\outer\parseargdef\appendixsubsec{\apphead2{#1}} % normally calls appendixsubseczzz +\def\appendixsubseczzz#1{% + \global\subsubsecno=0 \global\advance\subsecno by 1 + \sectionheading{#1}{subsec}{Yappendix}% + {\appendixletter.\the\secno.\the\subsecno}% +} + +\outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}} %normally calls unnumberedsubseczzz +\def\unnumberedsubseczzz#1{% + \global\subsubsecno=0 \global\advance\subsecno by 1 + \sectionheading{#1}{subsec}{Ynothing}% + {\the\unnumberedno.\the\secno.\the\subsecno}% +} + +% Subsubsections. +\outer\parseargdef\numberedsubsubsec{\numhead3{#1}} % normally numberedsubsubseczzz +\def\numberedsubsubseczzz#1{% + \global\advance\subsubsecno by 1 + \sectionheading{#1}{subsubsec}{Ynumbered}% + {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}% +} + +\outer\parseargdef\appendixsubsubsec{\apphead3{#1}} % normally appendixsubsubseczzz +\def\appendixsubsubseczzz#1{% + \global\advance\subsubsecno by 1 + \sectionheading{#1}{subsubsec}{Yappendix}% + {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}% +} + +\outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}} %normally unnumberedsubsubseczzz +\def\unnumberedsubsubseczzz#1{% + \global\advance\subsubsecno by 1 + \sectionheading{#1}{subsubsec}{Ynothing}% + {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}% +} + +% These macros control what the section commands do, according +% to what kind of chapter we are in (ordinary, appendix, or unnumbered). +% Define them by default for a numbered chapter. +\let\section = \numberedsec +\let\subsection = \numberedsubsec +\let\subsubsection = \numberedsubsubsec + +% Define @majorheading, @heading and @subheading + +% NOTE on use of \vbox for chapter headings, section headings, and such: +% 1) We use \vbox rather than the earlier \line to permit +% overlong headings to fold. +% 2) \hyphenpenalty is set to 10000 because hyphenation in a +% heading is obnoxious; this forbids it. +% 3) Likewise, headings look best if no \parindent is used, and +% if justification is not attempted. Hence \raggedright. + + +\def\majorheading{% + {\advance\chapheadingskip by 10pt \chapbreak }% + \parsearg\chapheadingzzz +} + +\def\chapheading{\chapbreak \parsearg\chapheadingzzz} +\def\chapheadingzzz#1{% + {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 + \parindent=0pt\raggedright + \rm #1\hfill}}% + \bigskip \par\penalty 200\relax + \suppressfirstparagraphindent +} + +% @heading, @subheading, @subsubheading. +\parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{} + \suppressfirstparagraphindent} +\parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{} + \suppressfirstparagraphindent} +\parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{} + \suppressfirstparagraphindent} + +% These macros generate a chapter, section, etc. heading only +% (including whitespace, linebreaking, etc. around it), +% given all the information in convenient, parsed form. + +%%% Args are the skip and penalty (usually negative) +\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi} + +%%% Define plain chapter starts, and page on/off switching for it +% Parameter controlling skip before chapter headings (if needed) + +\newskip\chapheadingskip + +\def\chapbreak{\dobreak \chapheadingskip {-4000}} +\def\chappager{\par\vfill\supereject} +% Because \domark is called before \chapoddpage, the filler page will +% get the headings for the next chapter, which is wrong. But we don't +% care -- we just disable all headings on the filler page. +\def\chapoddpage{% + \chappager + \ifodd\pageno \else + \begingroup + \evenheadline={\hfil}\evenfootline={\hfil}% + \oddheadline={\hfil}\oddfootline={\hfil}% + \hbox to 0pt{}% + \chappager + \endgroup + \fi +} + +\def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname} + +\def\CHAPPAGoff{% +\global\let\contentsalignmacro = \chappager +\global\let\pchapsepmacro=\chapbreak +\global\let\pagealignmacro=\chappager} + +\def\CHAPPAGon{% +\global\let\contentsalignmacro = \chappager +\global\let\pchapsepmacro=\chappager +\global\let\pagealignmacro=\chappager +\global\def\HEADINGSon{\HEADINGSsingle}} + +\def\CHAPPAGodd{% +\global\let\contentsalignmacro = \chapoddpage +\global\let\pchapsepmacro=\chapoddpage +\global\let\pagealignmacro=\chapoddpage +\global\def\HEADINGSon{\HEADINGSdouble}} + +\CHAPPAGon + +% Chapter opening. +% +% #1 is the text, #2 is the section type (Ynumbered, Ynothing, +% Yappendix, Yomitfromtoc), #3 the chapter number. +% +% To test against our argument. +\def\Ynothingkeyword{Ynothing} +\def\Yomitfromtockeyword{Yomitfromtoc} +\def\Yappendixkeyword{Yappendix} +% +\def\chapmacro#1#2#3{% + % Insert the first mark before the heading break (see notes for \domark). + \let\prevchapterdefs=\lastchapterdefs + \let\prevsectiondefs=\lastsectiondefs + \gdef\lastsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}% + \gdef\thissection{}}% + % + \def\temptype{#2}% + \ifx\temptype\Ynothingkeyword + \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}% + \gdef\thischapter{\thischaptername}}% + \else\ifx\temptype\Yomitfromtockeyword + \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}% + \gdef\thischapter{}}% + \else\ifx\temptype\Yappendixkeyword + \toks0={#1}% + \xdef\lastchapterdefs{% + \gdef\noexpand\thischaptername{\the\toks0}% + \gdef\noexpand\thischapternum{\appendixletter}% + \gdef\noexpand\thischapter{\putwordAppendix{} \noexpand\thischapternum: + \noexpand\thischaptername}% + }% + \else + \toks0={#1}% + \xdef\lastchapterdefs{% + \gdef\noexpand\thischaptername{\the\toks0}% + \gdef\noexpand\thischapternum{\the\chapno}% + \gdef\noexpand\thischapter{\putwordChapter{} \noexpand\thischapternum: + \noexpand\thischaptername}% + }% + \fi\fi\fi + % + % Output the mark. Pass it through \safewhatsit, to take care of + % the preceding space. + \safewhatsit\domark + % + % Insert the chapter heading break. + \pchapsepmacro + % + % Now the second mark, after the heading break. No break points + % between here and the heading. + \let\prevchapterdefs=\lastchapterdefs + \let\prevsectiondefs=\lastsectiondefs + \domark + % + {% + \chapfonts \rm + % + % Have to define \lastsection before calling \donoderef, because the + % xref code eventually uses it. On the other hand, it has to be called + % after \pchapsepmacro, or the headline will change too soon. + \gdef\lastsection{#1}% + % + % Only insert the separating space if we have a chapter/appendix + % number, and don't print the unnumbered ``number''. + \ifx\temptype\Ynothingkeyword + \setbox0 = \hbox{}% + \def\toctype{unnchap}% + \else\ifx\temptype\Yomitfromtockeyword + \setbox0 = \hbox{}% contents like unnumbered, but no toc entry + \def\toctype{omit}% + \else\ifx\temptype\Yappendixkeyword + \setbox0 = \hbox{\putwordAppendix{} #3\enspace}% + \def\toctype{app}% + \else + \setbox0 = \hbox{#3\enspace}% + \def\toctype{numchap}% + \fi\fi\fi + % + % Write the toc entry for this chapter. Must come before the + % \donoderef, because we include the current node name in the toc + % entry, and \donoderef resets it to empty. + \writetocentry{\toctype}{#1}{#3}% + % + % For pdftex, we have to write out the node definition (aka, make + % the pdfdest) after any page break, but before the actual text has + % been typeset. If the destination for the pdf outline is after the + % text, then jumping from the outline may wind up with the text not + % being visible, for instance under high magnification. + \donoderef{#2}% + % + % Typeset the actual heading. + \nobreak % Avoid page breaks at the interline glue. + \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright + \hangindent=\wd0 \centerparametersmaybe + \unhbox0 #1\par}% + }% + \nobreak\bigskip % no page break after a chapter title + \nobreak +} + +% @centerchap -- centered and unnumbered. +\let\centerparametersmaybe = \relax +\def\centerparameters{% + \advance\rightskip by 3\rightskip + \leftskip = \rightskip + \parfillskip = 0pt +} + + +% I don't think this chapter style is supported any more, so I'm not +% updating it with the new noderef stuff. We'll see. --karl, 11aug03. +% +\def\setchapterstyle #1 {\csname CHAPF#1\endcsname} +% +\def\unnchfopen #1{% +\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 + \parindent=0pt\raggedright + \rm #1\hfill}}\bigskip \par\nobreak +} +\def\chfopen #1#2{\chapoddpage {\chapfonts +\vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}% +\par\penalty 5000 % +} +\def\centerchfopen #1{% +\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 + \parindent=0pt + \hfill {\rm #1}\hfill}}\bigskip \par\nobreak +} +\def\CHAPFopen{% + \global\let\chapmacro=\chfopen + \global\let\centerchapmacro=\centerchfopen} + + +% Section titles. These macros combine the section number parts and +% call the generic \sectionheading to do the printing. +% +\newskip\secheadingskip +\def\secheadingbreak{\dobreak \secheadingskip{-1000}} + +% Subsection titles. +\newskip\subsecheadingskip +\def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}} + +% Subsubsection titles. +\def\subsubsecheadingskip{\subsecheadingskip} +\def\subsubsecheadingbreak{\subsecheadingbreak} + + +% Print any size, any type, section title. +% +% #1 is the text, #2 is the section level (sec/subsec/subsubsec), #3 is +% the section type for xrefs (Ynumbered, Ynothing, Yappendix), #4 is the +% section number. +% +\def\seckeyword{sec} +% +\def\sectionheading#1#2#3#4{% + {% + % Switch to the right set of fonts. + \csname #2fonts\endcsname \rm + % + \def\sectionlevel{#2}% + \def\temptype{#3}% + % + % Insert first mark before the heading break (see notes for \domark). + \let\prevsectiondefs=\lastsectiondefs + \ifx\temptype\Ynothingkeyword + \ifx\sectionlevel\seckeyword + \gdef\lastsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}% + \gdef\thissection{\thissectionname}}% + \fi + \else\ifx\temptype\Yomitfromtockeyword + % Don't redefine \thissection. + \else\ifx\temptype\Yappendixkeyword + \ifx\sectionlevel\seckeyword + \toks0={#1}% + \xdef\lastsectiondefs{% + \gdef\noexpand\thissectionname{\the\toks0}% + \gdef\noexpand\thissectionnum{#4}% + \gdef\noexpand\thissection{\putwordSection{} \noexpand\thissectionnum: + \noexpand\thissectionname}% + }% + \fi + \else + \ifx\sectionlevel\seckeyword + \toks0={#1}% + \xdef\lastsectiondefs{% + \gdef\noexpand\thissectionname{\the\toks0}% + \gdef\noexpand\thissectionnum{#4}% + \gdef\noexpand\thissection{\putwordSection{} \noexpand\thissectionnum: + \noexpand\thissectionname}% + }% + \fi + \fi\fi\fi + % + % Output the mark. Pass it through \safewhatsit, to take care of + % the preceding space. + \safewhatsit\domark + % + % Insert space above the heading. + \csname #2headingbreak\endcsname + % + % Now the second mark, after the heading break. No break points + % between here and the heading. + \let\prevsectiondefs=\lastsectiondefs + \domark + % + % Only insert the space after the number if we have a section number. + \ifx\temptype\Ynothingkeyword + \setbox0 = \hbox{}% + \def\toctype{unn}% + \gdef\lastsection{#1}% + \else\ifx\temptype\Yomitfromtockeyword + % for @headings -- no section number, don't include in toc, + % and don't redefine \lastsection. + \setbox0 = \hbox{}% + \def\toctype{omit}% + \let\sectionlevel=\empty + \else\ifx\temptype\Yappendixkeyword + \setbox0 = \hbox{#4\enspace}% + \def\toctype{app}% + \gdef\lastsection{#1}% + \else + \setbox0 = \hbox{#4\enspace}% + \def\toctype{num}% + \gdef\lastsection{#1}% + \fi\fi\fi + % + % Write the toc entry (before \donoderef). See comments in \chapmacro. + \writetocentry{\toctype\sectionlevel}{#1}{#4}% + % + % Write the node reference (= pdf destination for pdftex). + % Again, see comments in \chapmacro. + \donoderef{#3}% + % + % Interline glue will be inserted when the vbox is completed. + % That glue will be a valid breakpoint for the page, since it'll be + % preceded by a whatsit (usually from the \donoderef, or from the + % \writetocentry if there was no node). We don't want to allow that + % break, since then the whatsits could end up on page n while the + % section is on page n+1, thus toc/etc. are wrong. Debian bug 276000. + \nobreak + % + % Output the actual section heading. + \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright + \hangindent=\wd0 % zero if no section number + \unhbox0 #1}% + }% + % Add extra space after the heading -- half of whatever came above it. + % Don't allow stretch, though. + \kern .5 \csname #2headingskip\endcsname + % + % Do not let the kern be a potential breakpoint, as it would be if it + % was followed by glue. + \nobreak + % + % We'll almost certainly start a paragraph next, so don't let that + % glue accumulate. (Not a breakpoint because it's preceded by a + % discardable item.) + \vskip-\parskip + % + % This is purely so the last item on the list is a known \penalty > + % 10000. This is so \startdefun can avoid allowing breakpoints after + % section headings. Otherwise, it would insert a valid breakpoint between: + % + % @section sec-whatever + % @deffn def-whatever + \penalty 10001 +} + + +\message{toc,} +% Table of contents. +\newwrite\tocfile + +% Write an entry to the toc file, opening it if necessary. +% Called from @chapter, etc. +% +% Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno} +% We append the current node name (if any) and page number as additional +% arguments for the \{chap,sec,...}entry macros which will eventually +% read this. The node name is used in the pdf outlines as the +% destination to jump to. +% +% We open the .toc file for writing here instead of at @setfilename (or +% any other fixed time) so that @contents can be anywhere in the document. +% But if #1 is `omit', then we don't do anything. This is used for the +% table of contents chapter openings themselves. +% +\newif\iftocfileopened +\def\omitkeyword{omit}% +% +\def\writetocentry#1#2#3{% + \edef\writetoctype{#1}% + \ifx\writetoctype\omitkeyword \else + \iftocfileopened\else + \immediate\openout\tocfile = \jobname.toc + \global\tocfileopenedtrue + \fi + % + \iflinks + {\atdummies + \edef\temp{% + \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}% + \temp + }% + \fi + \fi + % + % Tell \shipout to create a pdf destination on each page, if we're + % writing pdf. These are used in the table of contents. We can't + % just write one on every page because the title pages are numbered + % 1 and 2 (the page numbers aren't printed), and so are the first + % two pages of the document. Thus, we'd have two destinations named + % `1', and two named `2'. + \ifpdf \global\pdfmakepagedesttrue \fi +} + + +% These characters do not print properly in the Computer Modern roman +% fonts, so we must take special care. This is more or less redundant +% with the Texinfo input format setup at the end of this file. +% +\def\activecatcodes{% + \catcode`\"=\active + \catcode`\$=\active + \catcode`\<=\active + \catcode`\>=\active + \catcode`\\=\active + \catcode`\^=\active + \catcode`\_=\active + \catcode`\|=\active + \catcode`\~=\active +} + + +% Read the toc file, which is essentially Texinfo input. +\def\readtocfile{% + \setupdatafile + \activecatcodes + \input \tocreadfilename +} + +\newskip\contentsrightmargin \contentsrightmargin=1in +\newcount\savepageno +\newcount\lastnegativepageno \lastnegativepageno = -1 + +% Prepare to read what we've written to \tocfile. +% +\def\startcontents#1{% + % If @setchapternewpage on, and @headings double, the contents should + % start on an odd page, unlike chapters. Thus, we maintain + % \contentsalignmacro in parallel with \pagealignmacro. + % From: Torbjorn Granlund <tege@matematik.su.se> + \contentsalignmacro + \immediate\closeout\tocfile + % + % Don't need to put `Contents' or `Short Contents' in the headline. + % It is abundantly clear what they are. + \chapmacro{#1}{Yomitfromtoc}{}% + % + \savepageno = \pageno + \begingroup % Set up to handle contents files properly. + \raggedbottom % Worry more about breakpoints than the bottom. + \advance\hsize by -\contentsrightmargin % Don't use the full line length. + % + % Roman numerals for page numbers. + \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi +} + +% redefined for the two-volume lispref. We always output on +% \jobname.toc even if this is redefined. +% +\def\tocreadfilename{\jobname.toc} + +% Normal (long) toc. +% +\def\contents{% + \startcontents{\putwordTOC}% + \openin 1 \tocreadfilename\space + \ifeof 1 \else + \readtocfile + \fi + \vfill \eject + \contentsalignmacro % in case @setchapternewpage odd is in effect + \ifeof 1 \else + \pdfmakeoutlines + \fi + \closein 1 + \endgroup + \lastnegativepageno = \pageno + \global\pageno = \savepageno +} + +% And just the chapters. +\def\summarycontents{% + \startcontents{\putwordShortTOC}% + % + \let\numchapentry = \shortchapentry + \let\appentry = \shortchapentry + \let\unnchapentry = \shortunnchapentry + % We want a true roman here for the page numbers. + \secfonts + \let\rm=\shortcontrm \let\bf=\shortcontbf + \let\sl=\shortcontsl \let\tt=\shortconttt + \rm + \hyphenpenalty = 10000 + \advance\baselineskip by 1pt % Open it up a little. + \def\numsecentry##1##2##3##4{} + \let\appsecentry = \numsecentry + \let\unnsecentry = \numsecentry + \let\numsubsecentry = \numsecentry + \let\appsubsecentry = \numsecentry + \let\unnsubsecentry = \numsecentry + \let\numsubsubsecentry = \numsecentry + \let\appsubsubsecentry = \numsecentry + \let\unnsubsubsecentry = \numsecentry + \openin 1 \tocreadfilename\space + \ifeof 1 \else + \readtocfile + \fi + \closein 1 + \vfill \eject + \contentsalignmacro % in case @setchapternewpage odd is in effect + \endgroup + \lastnegativepageno = \pageno + \global\pageno = \savepageno +} +\let\shortcontents = \summarycontents + +% Typeset the label for a chapter or appendix for the short contents. +% The arg is, e.g., `A' for an appendix, or `3' for a chapter. +% +\def\shortchaplabel#1{% + % This space should be enough, since a single number is .5em, and the + % widest letter (M) is 1em, at least in the Computer Modern fonts. + % But use \hss just in case. + % (This space doesn't include the extra space that gets added after + % the label; that gets put in by \shortchapentry above.) + % + % We'd like to right-justify chapter numbers, but that looks strange + % with appendix letters. And right-justifying numbers and + % left-justifying letters looks strange when there is less than 10 + % chapters. Have to read the whole toc once to know how many chapters + % there are before deciding ... + \hbox to 1em{#1\hss}% +} + +% These macros generate individual entries in the table of contents. +% The first argument is the chapter or section name. +% The last argument is the page number. +% The arguments in between are the chapter number, section number, ... + +% Chapters, in the main contents. +\def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}} +% +% Chapters, in the short toc. +% See comments in \dochapentry re vbox and related settings. +\def\shortchapentry#1#2#3#4{% + \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}% +} + +% Appendices, in the main contents. +% Need the word Appendix, and a fixed-size box. +% +\def\appendixbox#1{% + % We use M since it's probably the widest letter. + \setbox0 = \hbox{\putwordAppendix{} M}% + \hbox to \wd0{\putwordAppendix{} #1\hss}} +% +\def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\labelspace#1}{#4}} + +% Unnumbered chapters. +\def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}} +\def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}} + +% Sections. +\def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}} +\let\appsecentry=\numsecentry +\def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}} + +% Subsections. +\def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}} +\let\appsubsecentry=\numsubsecentry +\def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}} + +% And subsubsections. +\def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}} +\let\appsubsubsecentry=\numsubsubsecentry +\def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}} + +% This parameter controls the indentation of the various levels. +% Same as \defaultparindent. +\newdimen\tocindent \tocindent = 15pt + +% Now for the actual typesetting. In all these, #1 is the text and #2 is the +% page number. +% +% If the toc has to be broken over pages, we want it to be at chapters +% if at all possible; hence the \penalty. +\def\dochapentry#1#2{% + \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip + \begingroup + \chapentryfonts + \tocentry{#1}{\dopageno\bgroup#2\egroup}% + \endgroup + \nobreak\vskip .25\baselineskip plus.1\baselineskip +} + +\def\dosecentry#1#2{\begingroup + \secentryfonts \leftskip=\tocindent + \tocentry{#1}{\dopageno\bgroup#2\egroup}% +\endgroup} + +\def\dosubsecentry#1#2{\begingroup + \subsecentryfonts \leftskip=2\tocindent + \tocentry{#1}{\dopageno\bgroup#2\egroup}% +\endgroup} + +\def\dosubsubsecentry#1#2{\begingroup + \subsubsecentryfonts \leftskip=3\tocindent + \tocentry{#1}{\dopageno\bgroup#2\egroup}% +\endgroup} + +% We use the same \entry macro as for the index entries. +\let\tocentry = \entry + +% Space between chapter (or whatever) number and the title. +\def\labelspace{\hskip1em \relax} + +\def\dopageno#1{{\rm #1}} +\def\doshortpageno#1{{\rm #1}} + +\def\chapentryfonts{\secfonts \rm} +\def\secentryfonts{\textfonts} +\def\subsecentryfonts{\textfonts} +\def\subsubsecentryfonts{\textfonts} + + +\message{environments,} +% @foo ... @end foo. + +% @point{}, @result{}, @expansion{}, @print{}, @equiv{}. +% +% Since these characters are used in examples, they should be an even number of +% \tt widths. Each \tt character is 1en, so two makes it 1em. +% +\def\point{$\star$} +\def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}} +\def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}} +\def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}} +\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}} +\def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}} + +% The @error{} command. +% Adapted from the TeXbook's \boxit. +% +\newbox\errorbox +% +{\tentt \global\dimen0 = 3em}% Width of the box. +\dimen2 = .55pt % Thickness of rules +% The text. (`r' is open on the right, `e' somewhat less so on the left.) +\setbox0 = \hbox{\kern-.75pt \reducedsf error\kern-1.5pt} +% +\setbox\errorbox=\hbox to \dimen0{\hfil + \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. + \advance\hsize by -2\dimen2 % Rules. + \vbox{% + \hrule height\dimen2 + \hbox{\vrule width\dimen2 \kern3pt % Space to left of text. + \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below. + \kern3pt\vrule width\dimen2}% Space to right. + \hrule height\dimen2} + \hfil} +% +\def\error{\leavevmode\lower.7ex\copy\errorbox} + +% @tex ... @end tex escapes into raw Tex temporarily. +% One exception: @ is still an escape character, so that @end tex works. +% But \@ or @@ will get a plain tex @ character. + +\envdef\tex{% + \catcode `\\=0 \catcode `\{=1 \catcode `\}=2 + \catcode `\$=3 \catcode `\&=4 \catcode `\#=6 + \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie + \catcode `\%=14 + \catcode `\+=\other + \catcode `\"=\other + \catcode `\|=\other + \catcode `\<=\other + \catcode `\>=\other + \escapechar=`\\ + % + \let\b=\ptexb + \let\bullet=\ptexbullet + \let\c=\ptexc + \let\,=\ptexcomma + \let\.=\ptexdot + \let\dots=\ptexdots + \let\equiv=\ptexequiv + \let\!=\ptexexclam + \let\i=\ptexi + \let\indent=\ptexindent + \let\noindent=\ptexnoindent + \let\{=\ptexlbrace + \let\+=\tabalign + \let\}=\ptexrbrace + \let\/=\ptexslash + \let\*=\ptexstar + \let\t=\ptext + \expandafter \let\csname top\endcsname=\ptextop % outer + \let\frenchspacing=\plainfrenchspacing + % + \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}% + \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}% + \def\@{@}% +} +% There is no need to define \Etex. + +% Define @lisp ... @end lisp. +% @lisp environment forms a group so it can rebind things, +% including the definition of @end lisp (which normally is erroneous). + +% Amount to narrow the margins by for @lisp. +\newskip\lispnarrowing \lispnarrowing=0.4in + +% This is the definition that ^^M gets inside @lisp, @example, and other +% such environments. \null is better than a space, since it doesn't +% have any width. +\def\lisppar{\null\endgraf} + +% This space is always present above and below environments. +\newskip\envskipamount \envskipamount = 0pt + +% Make spacing and below environment symmetrical. We use \parskip here +% to help in doing that, since in @example-like environments \parskip +% is reset to zero; thus the \afterenvbreak inserts no space -- but the +% start of the next paragraph will insert \parskip. +% +\def\aboveenvbreak{{% + % =10000 instead of <10000 because of a special case in \itemzzz and + % \sectionheading, q.v. + \ifnum \lastpenalty=10000 \else + \advance\envskipamount by \parskip + \endgraf + \ifdim\lastskip<\envskipamount + \removelastskip + % it's not a good place to break if the last penalty was \nobreak + % or better ... + \ifnum\lastpenalty<10000 \penalty-50 \fi + \vskip\envskipamount + \fi + \fi +}} + +\let\afterenvbreak = \aboveenvbreak + +% \nonarrowing is a flag. If "set", @lisp etc don't narrow margins; it will +% also clear it, so that its embedded environments do the narrowing again. +\let\nonarrowing=\relax + +% @cartouche ... @end cartouche: draw rectangle w/rounded corners around +% environment contents. +\font\circle=lcircle10 +\newdimen\circthick +\newdimen\cartouter\newdimen\cartinner +\newskip\normbskip\newskip\normpskip\newskip\normlskip +\circthick=\fontdimen8\circle +% +\def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth +\def\ctr{{\hskip 6pt\circle\char'010}} +\def\cbl{{\circle\char'012\hskip -6pt}} +\def\cbr{{\hskip 6pt\circle\char'011}} +\def\carttop{\hbox to \cartouter{\hskip\lskip + \ctl\leaders\hrule height\circthick\hfil\ctr + \hskip\rskip}} +\def\cartbot{\hbox to \cartouter{\hskip\lskip + \cbl\leaders\hrule height\circthick\hfil\cbr + \hskip\rskip}} +% +\newskip\lskip\newskip\rskip + +\envdef\cartouche{% + \ifhmode\par\fi % can't be in the midst of a paragraph. + \startsavinginserts + \lskip=\leftskip \rskip=\rightskip + \leftskip=0pt\rightskip=0pt % we want these *outside*. + \cartinner=\hsize \advance\cartinner by-\lskip + \advance\cartinner by-\rskip + \cartouter=\hsize + \advance\cartouter by 18.4pt % allow for 3pt kerns on either + % side, and for 6pt waste from + % each corner char, and rule thickness + \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip + % Flag to tell @lisp, etc., not to narrow margin. + \let\nonarrowing = t% + \vbox\bgroup + \baselineskip=0pt\parskip=0pt\lineskip=0pt + \carttop + \hbox\bgroup + \hskip\lskip + \vrule\kern3pt + \vbox\bgroup + \kern3pt + \hsize=\cartinner + \baselineskip=\normbskip + \lineskip=\normlskip + \parskip=\normpskip + \vskip -\parskip + \comment % For explanation, see the end of \def\group. +} +\def\Ecartouche{% + \ifhmode\par\fi + \kern3pt + \egroup + \kern3pt\vrule + \hskip\rskip + \egroup + \cartbot + \egroup + \checkinserts +} + + +% This macro is called at the beginning of all the @example variants, +% inside a group. +\def\nonfillstart{% + \aboveenvbreak + \hfuzz = 12pt % Don't be fussy + \sepspaces % Make spaces be word-separators rather than space tokens. + \let\par = \lisppar % don't ignore blank lines + \obeylines % each line of input is a line of output + \parskip = 0pt + \parindent = 0pt + \emergencystretch = 0pt % don't try to avoid overfull boxes + \ifx\nonarrowing\relax + \advance \leftskip by \lispnarrowing + \exdentamount=\lispnarrowing + \else + \let\nonarrowing = \relax + \fi + \let\exdent=\nofillexdent +} + +% If you want all examples etc. small: @set dispenvsize small. +% If you want even small examples the full size: @set dispenvsize nosmall. +% This affects the following displayed environments: +% @example, @display, @format, @lisp +% +\def\smallword{small} +\def\nosmallword{nosmall} +\let\SETdispenvsize\relax +\def\setnormaldispenv{% + \ifx\SETdispenvsize\smallword + % end paragraph for sake of leading, in case document has no blank + % line. This is redundant with what happens in \aboveenvbreak, but + % we need to do it before changing the fonts, and it's inconvenient + % to change the fonts afterward. + \ifnum \lastpenalty=10000 \else \endgraf \fi + \smallexamplefonts \rm + \fi +} +\def\setsmalldispenv{% + \ifx\SETdispenvsize\nosmallword + \else + \ifnum \lastpenalty=10000 \else \endgraf \fi + \smallexamplefonts \rm + \fi +} + +% We often define two environments, @foo and @smallfoo. +% Let's do it by one command: +\def\makedispenv #1#2{ + \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2} + \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2} + \expandafter\let\csname E#1\endcsname \afterenvbreak + \expandafter\let\csname Esmall#1\endcsname \afterenvbreak +} + +% Define two synonyms: +\def\maketwodispenvs #1#2#3{ + \makedispenv{#1}{#3} + \makedispenv{#2}{#3} +} + +% @lisp: indented, narrowed, typewriter font; @example: same as @lisp. +% +% @smallexample and @smalllisp: use smaller fonts. +% Originally contributed by Pavel@xerox. +% +\maketwodispenvs {lisp}{example}{% + \nonfillstart + \tt\quoteexpand + \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special. + \gobble % eat return +} +% @display/@smalldisplay: same as @lisp except keep current font. +% +\makedispenv {display}{% + \nonfillstart + \gobble +} + +% @format/@smallformat: same as @display except don't narrow margins. +% +\makedispenv{format}{% + \let\nonarrowing = t% + \nonfillstart + \gobble +} + +% @flushleft: same as @format, but doesn't obey \SETdispenvsize. +\envdef\flushleft{% + \let\nonarrowing = t% + \nonfillstart + \gobble +} +\let\Eflushleft = \afterenvbreak + +% @flushright. +% +\envdef\flushright{% + \let\nonarrowing = t% + \nonfillstart + \advance\leftskip by 0pt plus 1fill + \gobble +} +\let\Eflushright = \afterenvbreak + + +% @quotation does normal linebreaking (hence we can't use \nonfillstart) +% and narrows the margins. We keep \parskip nonzero in general, since +% we're doing normal filling. So, when using \aboveenvbreak and +% \afterenvbreak, temporarily make \parskip 0. +% +\envdef\quotation{% + {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip + \parindent=0pt + % + % @cartouche defines \nonarrowing to inhibit narrowing at next level down. + \ifx\nonarrowing\relax + \advance\leftskip by \lispnarrowing + \advance\rightskip by \lispnarrowing + \exdentamount = \lispnarrowing + \else + \let\nonarrowing = \relax + \fi + \parsearg\quotationlabel +} + +% We have retained a nonzero parskip for the environment, since we're +% doing normal filling. +% +\def\Equotation{% + \par + \ifx\quotationauthor\undefined\else + % indent a bit. + \leftline{\kern 2\leftskip \sl ---\quotationauthor}% + \fi + {\parskip=0pt \afterenvbreak}% +} + +% If we're given an argument, typeset it in bold with a colon after. +\def\quotationlabel#1{% + \def\temp{#1}% + \ifx\temp\empty \else + {\bf #1: }% + \fi +} + + +% LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>} +% If we want to allow any <char> as delimiter, +% we need the curly braces so that makeinfo sees the @verb command, eg: +% `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org +% +% [Knuth]: Donald Ervin Knuth, 1996. The TeXbook. +% +% [Knuth] p.344; only we need to do the other characters Texinfo sets +% active too. Otherwise, they get lost as the first character on a +% verbatim line. +\def\dospecials{% + \do\ \do\\\do\{\do\}\do\$\do\&% + \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~% + \do\<\do\>\do\|\do\@\do+\do\"% +} +% +% [Knuth] p. 380 +\def\uncatcodespecials{% + \def\do##1{\catcode`##1=\other}\dospecials} +% +% [Knuth] pp. 380,381,391 +% Disable Spanish ligatures ?` and !` of \tt font +\begingroup + \catcode`\`=\active\gdef`{\relax\lq} +\endgroup +% +% Setup for the @verb command. +% +% Eight spaces for a tab +\begingroup + \catcode`\^^I=\active + \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }} +\endgroup +% +\def\setupverb{% + \tt % easiest (and conventionally used) font for verbatim + \def\par{\leavevmode\endgraf}% + \catcode`\`=\active + \tabeightspaces + % Respect line breaks, + % print special symbols as themselves, and + % make each space count + % must do in this order: + \obeylines \uncatcodespecials \sepspaces +} + +% Setup for the @verbatim environment +% +% Real tab expansion +\newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount +% +\def\starttabbox{\setbox0=\hbox\bgroup} + +% Allow an option to not replace quotes with a regular directed right +% quote/apostrophe (char 0x27), but instead use the undirected quote +% from cmtt (char 0x0d). The undirected quote is ugly, so don't make it +% the default, but it works for pasting with more pdf viewers (at least +% evince), the lilypond developers report. xpdf does work with the +% regular 0x27. +% +\def\codequoteright{% + \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax + \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax + '% + \else \char'15 \fi + \else \char'15 \fi +} +% +% and a similar option for the left quote char vs. a grave accent. +% Modern fonts display ASCII 0x60 as a grave accent, so some people like +% the code environments to do likewise. +% +\def\codequoteleft{% + \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax + \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax + `% + \else \char'22 \fi + \else \char'22 \fi +} +% +\begingroup + \catcode`\^^I=\active + \gdef\tabexpand{% + \catcode`\^^I=\active + \def^^I{\leavevmode\egroup + \dimen0=\wd0 % the width so far, or since the previous tab + \divide\dimen0 by\tabw + \multiply\dimen0 by\tabw % compute previous multiple of \tabw + \advance\dimen0 by\tabw % advance to next multiple of \tabw + \wd0=\dimen0 \box0 \starttabbox + }% + } + \catcode`\'=\active + \gdef\rquoteexpand{\catcode\rquoteChar=\active \def'{\codequoteright}}% + % + \catcode`\`=\active + \gdef\lquoteexpand{\catcode\lquoteChar=\active \def`{\codequoteleft}}% + % + \gdef\quoteexpand{\rquoteexpand \lquoteexpand}% +\endgroup + +% start the verbatim environment. +\def\setupverbatim{% + \let\nonarrowing = t% + \nonfillstart + % Easiest (and conventionally used) font for verbatim + \tt + \def\par{\leavevmode\egroup\box0\endgraf}% + \catcode`\`=\active + \tabexpand + \quoteexpand + % Respect line breaks, + % print special symbols as themselves, and + % make each space count + % must do in this order: + \obeylines \uncatcodespecials \sepspaces + \everypar{\starttabbox}% +} + +% Do the @verb magic: verbatim text is quoted by unique +% delimiter characters. Before first delimiter expect a +% right brace, after last delimiter expect closing brace: +% +% \def\doverb'{'<char>#1<char>'}'{#1} +% +% [Knuth] p. 382; only eat outer {} +\begingroup + \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other + \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next] +\endgroup +% +\def\verb{\begingroup\setupverb\doverb} +% +% +% Do the @verbatim magic: define the macro \doverbatim so that +% the (first) argument ends when '@end verbatim' is reached, ie: +% +% \def\doverbatim#1@end verbatim{#1} +% +% For Texinfo it's a lot easier than for LaTeX, +% because texinfo's \verbatim doesn't stop at '\end{verbatim}': +% we need not redefine '\', '{' and '}'. +% +% Inspired by LaTeX's verbatim command set [latex.ltx] +% +\begingroup + \catcode`\ =\active + \obeylines % + % ignore everything up to the first ^^M, that's the newline at the end + % of the @verbatim input line itself. Otherwise we get an extra blank + % line in the output. + \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}% + % We really want {...\end verbatim} in the body of the macro, but + % without the active space; thus we have to use \xdef and \gobble. +\endgroup +% +\envdef\verbatim{% + \setupverbatim\doverbatim +} +\let\Everbatim = \afterenvbreak + + +% @verbatiminclude FILE - insert text of file in verbatim environment. +% +\def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude} +% +\def\doverbatiminclude#1{% + {% + \makevalueexpandable + \setupverbatim + \input #1 + \afterenvbreak + }% +} + +% @copying ... @end copying. +% Save the text away for @insertcopying later. +% +% We save the uninterpreted tokens, rather than creating a box. +% Saving the text in a box would be much easier, but then all the +% typesetting commands (@smallbook, font changes, etc.) have to be done +% beforehand -- and a) we want @copying to be done first in the source +% file; b) letting users define the frontmatter in as flexible order as +% possible is very desirable. +% +\def\copying{\checkenv{}\begingroup\scanargctxt\docopying} +\def\docopying#1@end copying{\endgroup\def\copyingtext{#1}} +% +\def\insertcopying{% + \begingroup + \parindent = 0pt % paragraph indentation looks wrong on title page + \scanexp\copyingtext + \endgroup +} + + +\message{defuns,} +% @defun etc. + +\newskip\defbodyindent \defbodyindent=.4in +\newskip\defargsindent \defargsindent=50pt +\newskip\deflastargmargin \deflastargmargin=18pt +\newcount\defunpenalty + +% Start the processing of @deffn: +\def\startdefun{% + \ifnum\lastpenalty<10000 + \medbreak + \defunpenalty=10003 % Will keep this @deffn together with the + % following @def command, see below. + \else + % If there are two @def commands in a row, we'll have a \nobreak, + % which is there to keep the function description together with its + % header. But if there's nothing but headers, we need to allow a + % break somewhere. Check specifically for penalty 10002, inserted + % by \printdefunline, instead of 10000, since the sectioning + % commands also insert a nobreak penalty, and we don't want to allow + % a break between a section heading and a defun. + % + % As a minor refinement, we avoid "club" headers by signalling + % with penalty of 10003 after the very first @deffn in the + % sequence (see above), and penalty of 10002 after any following + % @def command. + \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi + % + % Similarly, after a section heading, do not allow a break. + % But do insert the glue. + \medskip % preceded by discardable penalty, so not a breakpoint + \fi + % + \parindent=0in + \advance\leftskip by \defbodyindent + \exdentamount=\defbodyindent +} + +\def\dodefunx#1{% + % First, check whether we are in the right environment: + \checkenv#1% + % + % As above, allow line break if we have multiple x headers in a row. + % It's not a great place, though. + \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi + % + % And now, it's time to reuse the body of the original defun: + \expandafter\gobbledefun#1% +} +\def\gobbledefun#1\startdefun{} + +% \printdefunline \deffnheader{text} +% +\def\printdefunline#1#2{% + \begingroup + % call \deffnheader: + #1#2 \endheader + % common ending: + \interlinepenalty = 10000 + \advance\rightskip by 0pt plus 1fil + \endgraf + \nobreak\vskip -\parskip + \penalty\defunpenalty % signal to \startdefun and \dodefunx + % Some of the @defun-type tags do not enable magic parentheses, + % rendering the following check redundant. But we don't optimize. + \checkparencounts + \endgroup +} + +\def\Edefun{\endgraf\medbreak} + +% \makedefun{deffn} creates \deffn, \deffnx and \Edeffn; +% the only thing remainnig is to define \deffnheader. +% +\def\makedefun#1{% + \expandafter\let\csname E#1\endcsname = \Edefun + \edef\temp{\noexpand\domakedefun + \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}% + \temp +} + +% \domakedefun \deffn \deffnx \deffnheader +% +% Define \deffn and \deffnx, without parameters. +% \deffnheader has to be defined explicitly. +% +\def\domakedefun#1#2#3{% + \envdef#1{% + \startdefun + \parseargusing\activeparens{\printdefunline#3}% + }% + \def#2{\dodefunx#1}% + \def#3% +} + +%%% Untyped functions: + +% @deffn category name args +\makedefun{deffn}{\deffngeneral{}} + +% @deffn category class name args +\makedefun{defop}#1 {\defopon{#1\ \putwordon}} + +% \defopon {category on}class name args +\def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } + +% \deffngeneral {subind}category name args +% +\def\deffngeneral#1#2 #3 #4\endheader{% + % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}. + \dosubind{fn}{\code{#3}}{#1}% + \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}% +} + +%%% Typed functions: + +% @deftypefn category type name args +\makedefun{deftypefn}{\deftypefngeneral{}} + +% @deftypeop category class type name args +\makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}} + +% \deftypeopon {category on}class type name args +\def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } + +% \deftypefngeneral {subind}category type name args +% +\def\deftypefngeneral#1#2 #3 #4 #5\endheader{% + \dosubind{fn}{\code{#4}}{#1}% + \defname{#2}{#3}{#4}\defunargs{#5\unskip}% +} + +%%% Typed variables: + +% @deftypevr category type var args +\makedefun{deftypevr}{\deftypecvgeneral{}} + +% @deftypecv category class type var args +\makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}} + +% \deftypecvof {category of}class type var args +\def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} } + +% \deftypecvgeneral {subind}category type var args +% +\def\deftypecvgeneral#1#2 #3 #4 #5\endheader{% + \dosubind{vr}{\code{#4}}{#1}% + \defname{#2}{#3}{#4}\defunargs{#5\unskip}% +} + +%%% Untyped variables: + +% @defvr category var args +\makedefun{defvr}#1 {\deftypevrheader{#1} {} } + +% @defcv category class var args +\makedefun{defcv}#1 {\defcvof{#1\ \putwordof}} + +% \defcvof {category of}class var args +\def\defcvof#1#2 {\deftypecvof{#1}#2 {} } + +%%% Type: +% @deftp category name args +\makedefun{deftp}#1 #2 #3\endheader{% + \doind{tp}{\code{#2}}% + \defname{#1}{}{#2}\defunargs{#3\unskip}% +} + +% Remaining @defun-like shortcuts: +\makedefun{defun}{\deffnheader{\putwordDeffunc} } +\makedefun{defmac}{\deffnheader{\putwordDefmac} } +\makedefun{defspec}{\deffnheader{\putwordDefspec} } +\makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} } +\makedefun{defvar}{\defvrheader{\putwordDefvar} } +\makedefun{defopt}{\defvrheader{\putwordDefopt} } +\makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} } +\makedefun{defmethod}{\defopon\putwordMethodon} +\makedefun{deftypemethod}{\deftypeopon\putwordMethodon} +\makedefun{defivar}{\defcvof\putwordInstanceVariableof} +\makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof} + +% \defname, which formats the name of the @def (not the args). +% #1 is the category, such as "Function". +% #2 is the return type, if any. +% #3 is the function name. +% +% We are followed by (but not passed) the arguments, if any. +% +\def\defname#1#2#3{% + % Get the values of \leftskip and \rightskip as they were outside the @def... + \advance\leftskip by -\defbodyindent + % + % How we'll format the type name. Putting it in brackets helps + % distinguish it from the body text that may end up on the next line + % just below it. + \def\temp{#1}% + \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi} + % + % Figure out line sizes for the paragraph shape. + % The first line needs space for \box0; but if \rightskip is nonzero, + % we need only space for the part of \box0 which exceeds it: + \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip + % The continuations: + \dimen2=\hsize \advance\dimen2 by -\defargsindent + % (plain.tex says that \dimen1 should be used only as global.) + \parshape 2 0in \dimen0 \defargsindent \dimen2 + % + % Put the type name to the right margin. + \noindent + \hbox to 0pt{% + \hfil\box0 \kern-\hsize + % \hsize has to be shortened this way: + \kern\leftskip + % Intentionally do not respect \rightskip, since we need the space. + }% + % + % Allow all lines to be underfull without complaint: + \tolerance=10000 \hbadness=10000 + \exdentamount=\defbodyindent + {% + % defun fonts. We use typewriter by default (used to be bold) because: + % . we're printing identifiers, they should be in tt in principle. + % . in languages with many accents, such as Czech or French, it's + % common to leave accents off identifiers. The result looks ok in + % tt, but exceedingly strange in rm. + % . we don't want -- and --- to be treated as ligatures. + % . this still does not fix the ?` and !` ligatures, but so far no + % one has made identifiers using them :). + \df \tt + \def\temp{#2}% return value type + \ifx\temp\empty\else \tclose{\temp} \fi + #3% output function name + }% + {\rm\enskip}% hskip 0.5 em of \tenrm + % + \boldbrax + % arguments will be output next, if any. +} + +% Print arguments in slanted roman (not ttsl), inconsistently with using +% tt for the name. This is because literal text is sometimes needed in +% the argument list (groff manual), and ttsl and tt are not very +% distinguishable. Prevent hyphenation at `-' chars. +% +\def\defunargs#1{% + % use sl by default (not ttsl), + % tt for the names. + \df \sl \hyphenchar\font=0 + % + % On the other hand, if an argument has two dashes (for instance), we + % want a way to get ttsl. Let's try @var for that. + \let\var=\ttslanted + #1% + \sl\hyphenchar\font=45 +} + +% We want ()&[] to print specially on the defun line. +% +\def\activeparens{% + \catcode`\(=\active \catcode`\)=\active + \catcode`\[=\active \catcode`\]=\active + \catcode`\&=\active +} + +% Make control sequences which act like normal parenthesis chars. +\let\lparen = ( \let\rparen = ) + +% Be sure that we always have a definition for `(', etc. For example, +% if the fn name has parens in it, \boldbrax will not be in effect yet, +% so TeX would otherwise complain about undefined control sequence. +{ + \activeparens + \global\let(=\lparen \global\let)=\rparen + \global\let[=\lbrack \global\let]=\rbrack + \global\let& = \& + + \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb} + \gdef\magicamp{\let&=\amprm} +} + +\newcount\parencount + +% If we encounter &foo, then turn on ()-hacking afterwards +\newif\ifampseen +\def\amprm#1 {\ampseentrue{\bf\ }} + +\def\parenfont{% + \ifampseen + % At the first level, print parens in roman, + % otherwise use the default font. + \ifnum \parencount=1 \rm \fi + \else + % The \sf parens (in \boldbrax) actually are a little bolder than + % the contained text. This is especially needed for [ and ] . + \sf + \fi +} +\def\infirstlevel#1{% + \ifampseen + \ifnum\parencount=1 + #1% + \fi + \fi +} +\def\bfafterword#1 {#1 \bf} + +\def\opnr{% + \global\advance\parencount by 1 + {\parenfont(}% + \infirstlevel \bfafterword +} +\def\clnr{% + {\parenfont)}% + \infirstlevel \sl + \global\advance\parencount by -1 +} + +\newcount\brackcount +\def\lbrb{% + \global\advance\brackcount by 1 + {\bf[}% +} +\def\rbrb{% + {\bf]}% + \global\advance\brackcount by -1 +} + +\def\checkparencounts{% + \ifnum\parencount=0 \else \badparencount \fi + \ifnum\brackcount=0 \else \badbrackcount \fi +} +% these should not use \errmessage; the glibc manual, at least, actually +% has such constructs (when documenting function pointers). +\def\badparencount{% + \message{Warning: unbalanced parentheses in @def...}% + \global\parencount=0 +} +\def\badbrackcount{% + \message{Warning: unbalanced square brackets in @def...}% + \global\brackcount=0 +} + + +\message{macros,} +% @macro. + +% To do this right we need a feature of e-TeX, \scantokens, +% which we arrange to emulate with a temporary file in ordinary TeX. +\ifx\eTeXversion\undefined + \newwrite\macscribble + \def\scantokens#1{% + \toks0={#1}% + \immediate\openout\macscribble=\jobname.tmp + \immediate\write\macscribble{\the\toks0}% + \immediate\closeout\macscribble + \input \jobname.tmp + } +\fi + +\def\scanmacro#1{% + \begingroup + \newlinechar`\^^M + \let\xeatspaces\eatspaces + % Undo catcode changes of \startcontents and \doprintindex + % When called from @insertcopying or (short)caption, we need active + % backslash to get it printed correctly. Previously, we had + % \catcode`\\=\other instead. We'll see whether a problem appears + % with macro expansion. --kasal, 19aug04 + \catcode`\@=0 \catcode`\\=\active \escapechar=`\@ + % ... and \example + \spaceisspace + % + % Append \endinput to make sure that TeX does not see the ending newline. + % I've verified that it is necessary both for e-TeX and for ordinary TeX + % --kasal, 29nov03 + \scantokens{#1\endinput}% + \endgroup +} + +\def\scanexp#1{% + \edef\temp{\noexpand\scanmacro{#1}}% + \temp +} + +\newcount\paramno % Count of parameters +\newtoks\macname % Macro name +\newif\ifrecursive % Is it recursive? + +% List of all defined macros in the form +% \definedummyword\macro1\definedummyword\macro2... +% Currently is also contains all @aliases; the list can be split +% if there is a need. +\def\macrolist{} + +% Add the macro to \macrolist +\def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname} +\def\addtomacrolistxxx#1{% + \toks0 = \expandafter{\macrolist\definedummyword#1}% + \xdef\macrolist{\the\toks0}% +} + +% Utility routines. +% This does \let #1 = #2, with \csnames; that is, +% \let \csname#1\endcsname = \csname#2\endcsname +% (except of course we have to play expansion games). +% +\def\cslet#1#2{% + \expandafter\let + \csname#1\expandafter\endcsname + \csname#2\endcsname +} + +% Trim leading and trailing spaces off a string. +% Concepts from aro-bend problem 15 (see CTAN). +{\catcode`\@=11 +\gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }} +\gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@} +\gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @} +\def\unbrace#1{#1} +\unbrace{\gdef\trim@@@ #1 } #2@{#1} +} + +% Trim a single trailing ^^M off a string. +{\catcode`\^^M=\other \catcode`\Q=3% +\gdef\eatcr #1{\eatcra #1Q^^MQ}% +\gdef\eatcra#1^^MQ{\eatcrb#1Q}% +\gdef\eatcrb#1Q#2Q{#1}% +} + +% Macro bodies are absorbed as an argument in a context where +% all characters are catcode 10, 11 or 12, except \ which is active +% (as in normal texinfo). It is necessary to change the definition of \. + +% Non-ASCII encodings make 8-bit characters active, so un-activate +% them to avoid their expansion. Must do this non-globally, to +% confine the change to the current group. + +% It's necessary to have hard CRs when the macro is executed. This is +% done by making ^^M (\endlinechar) catcode 12 when reading the macro +% body, and then making it the \newlinechar in \scanmacro. + +\def\scanctxt{% + \catcode`\"=\other + \catcode`\+=\other + \catcode`\<=\other + \catcode`\>=\other + \catcode`\@=\other + \catcode`\^=\other + \catcode`\_=\other + \catcode`\|=\other + \catcode`\~=\other + \ifx\declaredencoding\ascii \else \setnonasciicharscatcodenonglobal\other \fi +} + +\def\scanargctxt{% + \scanctxt + \catcode`\\=\other + \catcode`\^^M=\other +} + +\def\macrobodyctxt{% + \scanctxt + \catcode`\{=\other + \catcode`\}=\other + \catcode`\^^M=\other + \usembodybackslash +} + +\def\macroargctxt{% + \scanctxt + \catcode`\\=\other +} + +% \mbodybackslash is the definition of \ in @macro bodies. +% It maps \foo\ => \csname macarg.foo\endcsname => #N +% where N is the macro parameter number. +% We define \csname macarg.\endcsname to be \realbackslash, so +% \\ in macro replacement text gets you a backslash. + +{\catcode`@=0 @catcode`@\=@active + @gdef@usembodybackslash{@let\=@mbodybackslash} + @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname} +} +\expandafter\def\csname macarg.\endcsname{\realbackslash} + +\def\macro{\recursivefalse\parsearg\macroxxx} +\def\rmacro{\recursivetrue\parsearg\macroxxx} + +\def\macroxxx#1{% + \getargs{#1}% now \macname is the macname and \argl the arglist + \ifx\argl\empty % no arguments + \paramno=0% + \else + \expandafter\parsemargdef \argl;% + \fi + \if1\csname ismacro.\the\macname\endcsname + \message{Warning: redefining \the\macname}% + \else + \expandafter\ifx\csname \the\macname\endcsname \relax + \else \errmessage{Macro name \the\macname\space already defined}\fi + \global\cslet{macsave.\the\macname}{\the\macname}% + \global\expandafter\let\csname ismacro.\the\macname\endcsname=1% + \addtomacrolist{\the\macname}% + \fi + \begingroup \macrobodyctxt + \ifrecursive \expandafter\parsermacbody + \else \expandafter\parsemacbody + \fi} + +\parseargdef\unmacro{% + \if1\csname ismacro.#1\endcsname + \global\cslet{#1}{macsave.#1}% + \global\expandafter\let \csname ismacro.#1\endcsname=0% + % Remove the macro name from \macrolist: + \begingroup + \expandafter\let\csname#1\endcsname \relax + \let\definedummyword\unmacrodo + \xdef\macrolist{\macrolist}% + \endgroup + \else + \errmessage{Macro #1 not defined}% + \fi +} + +% Called by \do from \dounmacro on each macro. The idea is to omit any +% macro definitions that have been changed to \relax. +% +\def\unmacrodo#1{% + \ifx #1\relax + % remove this + \else + \noexpand\definedummyword \noexpand#1% + \fi +} + +% This makes use of the obscure feature that if the last token of a +% <parameter list> is #, then the preceding argument is delimited by +% an opening brace, and that opening brace is not consumed. +\def\getargs#1{\getargsxxx#1{}} +\def\getargsxxx#1#{\getmacname #1 \relax\getmacargs} +\def\getmacname #1 #2\relax{\macname={#1}} +\def\getmacargs#1{\def\argl{#1}} + +% Parse the optional {params} list. Set up \paramno and \paramlist +% so \defmacro knows what to do. Define \macarg.blah for each blah +% in the params list, to be ##N where N is the position in that list. +% That gets used by \mbodybackslash (above). + +% We need to get `macro parameter char #' into several definitions. +% The technique used is stolen from LaTeX: let \hash be something +% unexpandable, insert that wherever you need a #, and then redefine +% it to # just before using the token list produced. +% +% The same technique is used to protect \eatspaces till just before +% the macro is used. + +\def\parsemargdef#1;{\paramno=0\def\paramlist{}% + \let\hash\relax\let\xeatspaces\relax\parsemargdefxxx#1,;,} +\def\parsemargdefxxx#1,{% + \if#1;\let\next=\relax + \else \let\next=\parsemargdefxxx + \advance\paramno by 1% + \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname + {\xeatspaces{\hash\the\paramno}}% + \edef\paramlist{\paramlist\hash\the\paramno,}% + \fi\next} + +% These two commands read recursive and nonrecursive macro bodies. +% (They're different since rec and nonrec macros end differently.) + +\long\def\parsemacbody#1@end macro% +{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% +\long\def\parsermacbody#1@end rmacro% +{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% + +% This defines the macro itself. There are six cases: recursive and +% nonrecursive macros of zero, one, and many arguments. +% Much magic with \expandafter here. +% \xdef is used so that macro definitions will survive the file +% they're defined in; @include reads the file inside a group. +\def\defmacro{% + \let\hash=##% convert placeholders to macro parameter chars + \ifrecursive + \ifcase\paramno + % 0 + \expandafter\xdef\csname\the\macname\endcsname{% + \noexpand\scanmacro{\temp}}% + \or % 1 + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \noexpand\braceorline + \expandafter\noexpand\csname\the\macname xxx\endcsname}% + \expandafter\xdef\csname\the\macname xxx\endcsname##1{% + \egroup\noexpand\scanmacro{\temp}}% + \else % many + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \noexpand\csname\the\macname xx\endcsname}% + \expandafter\xdef\csname\the\macname xx\endcsname##1{% + \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% + \expandafter\expandafter + \expandafter\xdef + \expandafter\expandafter + \csname\the\macname xxx\endcsname + \paramlist{\egroup\noexpand\scanmacro{\temp}}% + \fi + \else + \ifcase\paramno + % 0 + \expandafter\xdef\csname\the\macname\endcsname{% + \noexpand\norecurse{\the\macname}% + \noexpand\scanmacro{\temp}\egroup}% + \or % 1 + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \noexpand\braceorline + \expandafter\noexpand\csname\the\macname xxx\endcsname}% + \expandafter\xdef\csname\the\macname xxx\endcsname##1{% + \egroup + \noexpand\norecurse{\the\macname}% + \noexpand\scanmacro{\temp}\egroup}% + \else % many + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \expandafter\noexpand\csname\the\macname xx\endcsname}% + \expandafter\xdef\csname\the\macname xx\endcsname##1{% + \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% + \expandafter\expandafter + \expandafter\xdef + \expandafter\expandafter + \csname\the\macname xxx\endcsname + \paramlist{% + \egroup + \noexpand\norecurse{\the\macname}% + \noexpand\scanmacro{\temp}\egroup}% + \fi + \fi} + +\def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}} + +% \braceorline decides whether the next nonwhitespace character is a +% {. If so it reads up to the closing }, if not, it reads the whole +% line. Whatever was read is then fed to the next control sequence +% as an argument (by \parsebrace or \parsearg) +\def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx} +\def\braceorlinexxx{% + \ifx\nchar\bgroup\else + \expandafter\parsearg + \fi \macnamexxx} + + +% @alias. +% We need some trickery to remove the optional spaces around the equal +% sign. Just make them active and then expand them all to nothing. +\def\alias{\parseargusing\obeyspaces\aliasxxx} +\def\aliasxxx #1{\aliasyyy#1\relax} +\def\aliasyyy #1=#2\relax{% + {% + \expandafter\let\obeyedspace=\empty + \addtomacrolist{#1}% + \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}% + }% + \next +} + + +\message{cross references,} + +\newwrite\auxfile +\newif\ifhavexrefs % True if xref values are known. +\newif\ifwarnedxrefs % True if we warned once that they aren't known. + +% @inforef is relatively simple. +\def\inforef #1{\inforefzzz #1,,,,**} +\def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}}, + node \samp{\ignorespaces#1{}}} + +% @node's only job in TeX is to define \lastnode, which is used in +% cross-references. The @node line might or might not have commas, and +% might or might not have spaces before the first comma, like: +% @node foo , bar , ... +% We don't want such trailing spaces in the node name. +% +\parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse} +% +% also remove a trailing comma, in case of something like this: +% @node Help-Cross, , , Cross-refs +\def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse} +\def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}} + +\let\nwnode=\node +\let\lastnode=\empty + +% Write a cross-reference definition for the current node. #1 is the +% type (Ynumbered, Yappendix, Ynothing). +% +\def\donoderef#1{% + \ifx\lastnode\empty\else + \setref{\lastnode}{#1}% + \global\let\lastnode=\empty + \fi +} + +% @anchor{NAME} -- define xref target at arbitrary point. +% +\newcount\savesfregister +% +\def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi} +\def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi} +\def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces} + +% \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an +% anchor), which consists of three parts: +% 1) NAME-title - the current sectioning name taken from \lastsection, +% or the anchor name. +% 2) NAME-snt - section number and type, passed as the SNT arg, or +% empty for anchors. +% 3) NAME-pg - the page number. +% +% This is called from \donoderef, \anchor, and \dofloat. In the case of +% floats, there is an additional part, which is not written here: +% 4) NAME-lof - the text as it should appear in a @listoffloats. +% +\def\setref#1#2{% + \pdfmkdest{#1}% + \iflinks + {% + \atdummies % preserve commands, but don't expand them + \edef\writexrdef##1##2{% + \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef + ##1}{##2}}% these are parameters of \writexrdef + }% + \toks0 = \expandafter{\lastsection}% + \immediate \writexrdef{title}{\the\toks0 }% + \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc. + \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, during \shipout + }% + \fi +} + +% @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is +% the node name, #2 the name of the Info cross-reference, #3 the printed +% node name, #4 the name of the Info file, #5 the name of the printed +% manual. All but the node name can be omitted. +% +\def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]} +\def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]} +\def\ref#1{\xrefX[#1,,,,,,,]} +\def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup + \unsepspaces + \def\printedmanual{\ignorespaces #5}% + \def\printedrefname{\ignorespaces #3}% + \setbox1=\hbox{\printedmanual\unskip}% + \setbox0=\hbox{\printedrefname\unskip}% + \ifdim \wd0 = 0pt + % No printed node name was explicitly given. + \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax + % Use the node name inside the square brackets. + \def\printedrefname{\ignorespaces #1}% + \else + % Use the actual chapter/section title appear inside + % the square brackets. Use the real section title if we have it. + \ifdim \wd1 > 0pt + % It is in another manual, so we don't have it. + \def\printedrefname{\ignorespaces #1}% + \else + \ifhavexrefs + % We know the real title if we have the xref values. + \def\printedrefname{\refx{#1-title}{}}% + \else + % Otherwise just copy the Info node name. + \def\printedrefname{\ignorespaces #1}% + \fi% + \fi + \fi + \fi + % + % Make link in pdf output. + \ifpdf + {\indexnofonts + \turnoffactive + % This expands tokens, so do it after making catcode changes, so _ + % etc. don't get their TeX definitions. + \getfilename{#4}% + % + % See comments at \activebackslashdouble. + {\activebackslashdouble \xdef\pdfxrefdest{#1}% + \backslashparens\pdfxrefdest}% + % + \leavevmode + \startlink attr{/Border [0 0 0]}% + \ifnum\filenamelength>0 + goto file{\the\filename.pdf} name{\pdfxrefdest}% + \else + goto name{\pdfmkpgn{\pdfxrefdest}}% + \fi + }% + \setcolor{\linkcolor}% + \fi + % + % Float references are printed completely differently: "Figure 1.2" + % instead of "[somenode], p.3". We distinguish them by the + % LABEL-title being set to a magic string. + {% + % Have to otherify everything special to allow the \csname to + % include an _ in the xref name, etc. + \indexnofonts + \turnoffactive + \expandafter\global\expandafter\let\expandafter\Xthisreftitle + \csname XR#1-title\endcsname + }% + \iffloat\Xthisreftitle + % If the user specified the print name (third arg) to the ref, + % print it instead of our usual "Figure 1.2". + \ifdim\wd0 = 0pt + \refx{#1-snt}{}% + \else + \printedrefname + \fi + % + % if the user also gave the printed manual name (fifth arg), append + % "in MANUALNAME". + \ifdim \wd1 > 0pt + \space \putwordin{} \cite{\printedmanual}% + \fi + \else + % node/anchor (non-float) references. + % + % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not + % insert empty discretionaries after hyphens, which means that it will + % not find a line break at a hyphen in a node names. Since some manuals + % are best written with fairly long node names, containing hyphens, this + % is a loss. Therefore, we give the text of the node name again, so it + % is as if TeX is seeing it for the first time. + \ifdim \wd1 > 0pt + \putwordSection{} ``\printedrefname'' \putwordin{} \cite{\printedmanual}% + \else + % _ (for example) has to be the character _ for the purposes of the + % control sequence corresponding to the node, but it has to expand + % into the usual \leavevmode...\vrule stuff for purposes of + % printing. So we \turnoffactive for the \refx-snt, back on for the + % printing, back off for the \refx-pg. + {\turnoffactive + % Only output a following space if the -snt ref is nonempty; for + % @unnumbered and @anchor, it won't be. + \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}% + \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi + }% + % output the `[mynode]' via a macro so it can be overridden. + \xrefprintnodename\printedrefname + % + % But we always want a comma and a space: + ,\space + % + % output the `page 3'. + \turnoffactive \putwordpage\tie\refx{#1-pg}{}% + \fi + \fi + \endlink +\endgroup} + +% This macro is called from \xrefX for the `[nodename]' part of xref +% output. It's a separate macro only so it can be changed more easily, +% since square brackets don't work well in some documents. Particularly +% one that Bob is working on :). +% +\def\xrefprintnodename#1{[#1]} + +% Things referred to by \setref. +% +\def\Ynothing{} +\def\Yomitfromtoc{} +\def\Ynumbered{% + \ifnum\secno=0 + \putwordChapter@tie \the\chapno + \else \ifnum\subsecno=0 + \putwordSection@tie \the\chapno.\the\secno + \else \ifnum\subsubsecno=0 + \putwordSection@tie \the\chapno.\the\secno.\the\subsecno + \else + \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno + \fi\fi\fi +} +\def\Yappendix{% + \ifnum\secno=0 + \putwordAppendix@tie @char\the\appendixno{}% + \else \ifnum\subsecno=0 + \putwordSection@tie @char\the\appendixno.\the\secno + \else \ifnum\subsubsecno=0 + \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno + \else + \putwordSection@tie + @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno + \fi\fi\fi +} + +% Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME. +% If its value is nonempty, SUFFIX is output afterward. +% +\def\refx#1#2{% + {% + \indexnofonts + \otherbackslash + \expandafter\global\expandafter\let\expandafter\thisrefX + \csname XR#1\endcsname + }% + \ifx\thisrefX\relax + % If not defined, say something at least. + \angleleft un\-de\-fined\angleright + \iflinks + \ifhavexrefs + \message{\linenumber Undefined cross reference `#1'.}% + \else + \ifwarnedxrefs\else + \global\warnedxrefstrue + \message{Cross reference values unknown; you must run TeX again.}% + \fi + \fi + \fi + \else + % It's defined, so just use it. + \thisrefX + \fi + #2% Output the suffix in any case. +} + +% This is the macro invoked by entries in the aux file. Usually it's +% just a \def (we prepend XR to the control sequence name to avoid +% collisions). But if this is a float type, we have more work to do. +% +\def\xrdef#1#2{% + {% The node name might contain 8-bit characters, which in our current + % implementation are changed to commands like @'e. Don't let these + % mess up the control sequence name. + \indexnofonts + \turnoffactive + \xdef\safexrefname{#1}% + }% + % + \expandafter\gdef\csname XR\safexrefname\endcsname{#2}% remember this xref + % + % Was that xref control sequence that we just defined for a float? + \expandafter\iffloat\csname XR\safexrefname\endcsname + % it was a float, and we have the (safe) float type in \iffloattype. + \expandafter\let\expandafter\floatlist + \csname floatlist\iffloattype\endcsname + % + % Is this the first time we've seen this float type? + \expandafter\ifx\floatlist\relax + \toks0 = {\do}% yes, so just \do + \else + % had it before, so preserve previous elements in list. + \toks0 = \expandafter{\floatlist\do}% + \fi + % + % Remember this xref in the control sequence \floatlistFLOATTYPE, + % for later use in \listoffloats. + \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0 + {\safexrefname}}% + \fi +} + +% Read the last existing aux file, if any. No error if none exists. +% +\def\tryauxfile{% + \openin 1 \jobname.aux + \ifeof 1 \else + \readdatafile{aux}% + \global\havexrefstrue + \fi + \closein 1 +} + +\def\setupdatafile{% + \catcode`\^^@=\other + \catcode`\^^A=\other + \catcode`\^^B=\other + \catcode`\^^C=\other + \catcode`\^^D=\other + \catcode`\^^E=\other + \catcode`\^^F=\other + \catcode`\^^G=\other + \catcode`\^^H=\other + \catcode`\^^K=\other + \catcode`\^^L=\other + \catcode`\^^N=\other + \catcode`\^^P=\other + \catcode`\^^Q=\other + \catcode`\^^R=\other + \catcode`\^^S=\other + \catcode`\^^T=\other + \catcode`\^^U=\other + \catcode`\^^V=\other + \catcode`\^^W=\other + \catcode`\^^X=\other + \catcode`\^^Z=\other + \catcode`\^^[=\other + \catcode`\^^\=\other + \catcode`\^^]=\other + \catcode`\^^^=\other + \catcode`\^^_=\other + % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc. + % in xref tags, i.e., node names. But since ^^e4 notation isn't + % supported in the main text, it doesn't seem desirable. Furthermore, + % that is not enough: for node names that actually contain a ^ + % character, we would end up writing a line like this: 'xrdef {'hat + % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first + % argument, and \hat is not an expandable control sequence. It could + % all be worked out, but why? Either we support ^^ or we don't. + % + % The other change necessary for this was to define \auxhat: + % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter + % and then to call \auxhat in \setq. + % + \catcode`\^=\other + % + % Special characters. Should be turned off anyway, but... + \catcode`\~=\other + \catcode`\[=\other + \catcode`\]=\other + \catcode`\"=\other + \catcode`\_=\other + \catcode`\|=\other + \catcode`\<=\other + \catcode`\>=\other + \catcode`\$=\other + \catcode`\#=\other + \catcode`\&=\other + \catcode`\%=\other + \catcode`+=\other % avoid \+ for paranoia even though we've turned it off + % + % This is to support \ in node names and titles, since the \ + % characters end up in a \csname. It's easier than + % leaving it active and making its active definition an actual \ + % character. What I don't understand is why it works in the *value* + % of the xrdef. Seems like it should be a catcode12 \, and that + % should not typeset properly. But it works, so I'm moving on for + % now. --karl, 15jan04. + \catcode`\\=\other + % + % Make the characters 128-255 be printing characters. + {% + \count1=128 + \def\loop{% + \catcode\count1=\other + \advance\count1 by 1 + \ifnum \count1<256 \loop \fi + }% + }% + % + % @ is our escape character in .aux files, and we need braces. + \catcode`\{=1 + \catcode`\}=2 + \catcode`\@=0 +} + +\def\readdatafile#1{% +\begingroup + \setupdatafile + \input\jobname.#1 +\endgroup} + + +\message{insertions,} +% including footnotes. + +\newcount \footnoteno + +% The trailing space in the following definition for supereject is +% vital for proper filling; pages come out unaligned when you do a +% pagealignmacro call if that space before the closing brace is +% removed. (Generally, numeric constants should always be followed by a +% space to prevent strange expansion errors.) +\def\supereject{\par\penalty -20000\footnoteno =0 } + +% @footnotestyle is meaningful for info output only. +\let\footnotestyle=\comment + +{\catcode `\@=11 +% +% Auto-number footnotes. Otherwise like plain. +\gdef\footnote{% + \let\indent=\ptexindent + \let\noindent=\ptexnoindent + \global\advance\footnoteno by \@ne + \edef\thisfootno{$^{\the\footnoteno}$}% + % + % In case the footnote comes at the end of a sentence, preserve the + % extra spacing after we do the footnote number. + \let\@sf\empty + \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi + % + % Remove inadvertent blank space before typesetting the footnote number. + \unskip + \thisfootno\@sf + \dofootnote +}% + +% Don't bother with the trickery in plain.tex to not require the +% footnote text as a parameter. Our footnotes don't need to be so general. +% +% Oh yes, they do; otherwise, @ifset (and anything else that uses +% \parseargline) fails inside footnotes because the tokens are fixed when +% the footnote is read. --karl, 16nov96. +% +\gdef\dofootnote{% + \insert\footins\bgroup + % We want to typeset this text as a normal paragraph, even if the + % footnote reference occurs in (for example) a display environment. + % So reset some parameters. + \hsize=\pagewidth + \interlinepenalty\interfootnotelinepenalty + \splittopskip\ht\strutbox % top baseline for broken footnotes + \splitmaxdepth\dp\strutbox + \floatingpenalty\@MM + \leftskip\z@skip + \rightskip\z@skip + \spaceskip\z@skip + \xspaceskip\z@skip + \parindent\defaultparindent + % + \smallfonts \rm + % + % Because we use hanging indentation in footnotes, a @noindent appears + % to exdent this text, so make it be a no-op. makeinfo does not use + % hanging indentation so @noindent can still be needed within footnote + % text after an @example or the like (not that this is good style). + \let\noindent = \relax + % + % Hang the footnote text off the number. Use \everypar in case the + % footnote extends for more than one paragraph. + \everypar = {\hang}% + \textindent{\thisfootno}% + % + % Don't crash into the line above the footnote text. Since this + % expands into a box, it must come within the paragraph, lest it + % provide a place where TeX can split the footnote. + \footstrut + \futurelet\next\fo@t +} +}%end \catcode `\@=11 + +% In case a @footnote appears in a vbox, save the footnote text and create +% the real \insert just after the vbox finished. Otherwise, the insertion +% would be lost. +% Similarily, if a @footnote appears inside an alignment, save the footnote +% text to a box and make the \insert when a row of the table is finished. +% And the same can be done for other insert classes. --kasal, 16nov03. + +% Replace the \insert primitive by a cheating macro. +% Deeper inside, just make sure that the saved insertions are not spilled +% out prematurely. +% +\def\startsavinginserts{% + \ifx \insert\ptexinsert + \let\insert\saveinsert + \else + \let\checkinserts\relax + \fi +} + +% This \insert replacement works for both \insert\footins{foo} and +% \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}. +% +\def\saveinsert#1{% + \edef\next{\noexpand\savetobox \makeSAVEname#1}% + \afterassignment\next + % swallow the left brace + \let\temp = +} +\def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}} +\def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1} + +\def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi} + +\def\placesaveins#1{% + \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname + {\box#1}% +} + +% eat @SAVE -- beware, all of them have catcode \other: +{ + \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-) + \gdef\gobblesave @SAVE{} +} + +% initialization: +\def\newsaveins #1{% + \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}% + \next +} +\def\newsaveinsX #1{% + \csname newbox\endcsname #1% + \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts + \checksaveins #1}% +} + +% initialize: +\let\checkinserts\empty +\newsaveins\footins +\newsaveins\margin + + +% @image. We use the macros from epsf.tex to support this. +% If epsf.tex is not installed and @image is used, we complain. +% +% Check for and read epsf.tex up front. If we read it only at @image +% time, we might be inside a group, and then its definitions would get +% undone and the next image would fail. +\openin 1 = epsf.tex +\ifeof 1 \else + % Do not bother showing banner with epsf.tex v2.7k (available in + % doc/epsf.tex and on ctan). + \def\epsfannounce{\toks0 = }% + \input epsf.tex +\fi +\closein 1 +% +% We will only complain once about lack of epsf.tex. +\newif\ifwarnednoepsf +\newhelp\noepsfhelp{epsf.tex must be installed for images to + work. It is also included in the Texinfo distribution, or you can get + it from ftp://tug.org/tex/epsf.tex.} +% +\def\image#1{% + \ifx\epsfbox\undefined + \ifwarnednoepsf \else + \errhelp = \noepsfhelp + \errmessage{epsf.tex not found, images will be ignored}% + \global\warnednoepsftrue + \fi + \else + \imagexxx #1,,,,,\finish + \fi +} +% +% Arguments to @image: +% #1 is (mandatory) image filename; we tack on .eps extension. +% #2 is (optional) width, #3 is (optional) height. +% #4 is (ignored optional) html alt text. +% #5 is (ignored optional) extension. +% #6 is just the usual extra ignored arg for parsing this stuff. +\newif\ifimagevmode +\def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup + \catcode`\^^M = 5 % in case we're inside an example + \normalturnoffactive % allow _ et al. in names + % If the image is by itself, center it. + \ifvmode + \imagevmodetrue + \nobreak\medskip + % Usually we'll have text after the image which will insert + % \parskip glue, so insert it here too to equalize the space + % above and below. + \nobreak\vskip\parskip + \nobreak + \fi + % + % Leave vertical mode so that indentation from an enclosing + % environment such as @quotation is respected. On the other hand, if + % it's at the top level, we don't want the normal paragraph indentation. + \noindent + % + % Output the image. + \ifpdf + \dopdfimage{#1}{#2}{#3}% + \else + % \epsfbox itself resets \epsf?size at each figure. + \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi + \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi + \epsfbox{#1.eps}% + \fi + % + \ifimagevmode \medskip \fi % space after the standalone image +\endgroup} + + +% @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables, +% etc. We don't actually implement floating yet, we always include the +% float "here". But it seemed the best name for the future. +% +\envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish} + +% There may be a space before second and/or third parameter; delete it. +\def\eatcommaspace#1, {#1,} + +% #1 is the optional FLOATTYPE, the text label for this float, typically +% "Figure", "Table", "Example", etc. Can't contain commas. If omitted, +% this float will not be numbered and cannot be referred to. +% +% #2 is the optional xref label. Also must be present for the float to +% be referable. +% +% #3 is the optional positioning argument; for now, it is ignored. It +% will somehow specify the positions allowed to float to (here, top, bottom). +% +% We keep a separate counter for each FLOATTYPE, which we reset at each +% chapter-level command. +\let\resetallfloatnos=\empty +% +\def\dofloat#1,#2,#3,#4\finish{% + \let\thiscaption=\empty + \let\thisshortcaption=\empty + % + % don't lose footnotes inside @float. + % + % BEWARE: when the floats start float, we have to issue warning whenever an + % insert appears inside a float which could possibly float. --kasal, 26may04 + % + \startsavinginserts + % + % We can't be used inside a paragraph. + \par + % + \vtop\bgroup + \def\floattype{#1}% + \def\floatlabel{#2}% + \def\floatloc{#3}% we do nothing with this yet. + % + \ifx\floattype\empty + \let\safefloattype=\empty + \else + {% + % the floattype might have accents or other special characters, + % but we need to use it in a control sequence name. + \indexnofonts + \turnoffactive + \xdef\safefloattype{\floattype}% + }% + \fi + % + % If label is given but no type, we handle that as the empty type. + \ifx\floatlabel\empty \else + % We want each FLOATTYPE to be numbered separately (Figure 1, + % Table 1, Figure 2, ...). (And if no label, no number.) + % + \expandafter\getfloatno\csname\safefloattype floatno\endcsname + \global\advance\floatno by 1 + % + {% + % This magic value for \lastsection is output by \setref as the + % XREFLABEL-title value. \xrefX uses it to distinguish float + % labels (which have a completely different output format) from + % node and anchor labels. And \xrdef uses it to construct the + % lists of floats. + % + \edef\lastsection{\floatmagic=\safefloattype}% + \setref{\floatlabel}{Yfloat}% + }% + \fi + % + % start with \parskip glue, I guess. + \vskip\parskip + % + % Don't suppress indentation if a float happens to start a section. + \restorefirstparagraphindent +} + +% we have these possibilities: +% @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap +% @float Foo,lbl & no caption: Foo 1.1 +% @float Foo & @caption{Cap}: Foo: Cap +% @float Foo & no caption: Foo +% @float ,lbl & Caption{Cap}: 1.1: Cap +% @float ,lbl & no caption: 1.1 +% @float & @caption{Cap}: Cap +% @float & no caption: +% +\def\Efloat{% + \let\floatident = \empty + % + % In all cases, if we have a float type, it comes first. + \ifx\floattype\empty \else \def\floatident{\floattype}\fi + % + % If we have an xref label, the number comes next. + \ifx\floatlabel\empty \else + \ifx\floattype\empty \else % if also had float type, need tie first. + \appendtomacro\floatident{\tie}% + \fi + % the number. + \appendtomacro\floatident{\chaplevelprefix\the\floatno}% + \fi + % + % Start the printed caption with what we've constructed in + % \floatident, but keep it separate; we need \floatident again. + \let\captionline = \floatident + % + \ifx\thiscaption\empty \else + \ifx\floatident\empty \else + \appendtomacro\captionline{: }% had ident, so need a colon between + \fi + % + % caption text. + \appendtomacro\captionline{\scanexp\thiscaption}% + \fi + % + % If we have anything to print, print it, with space before. + % Eventually this needs to become an \insert. + \ifx\captionline\empty \else + \vskip.5\parskip + \captionline + % + % Space below caption. + \vskip\parskip + \fi + % + % If have an xref label, write the list of floats info. Do this + % after the caption, to avoid chance of it being a breakpoint. + \ifx\floatlabel\empty \else + % Write the text that goes in the lof to the aux file as + % \floatlabel-lof. Besides \floatident, we include the short + % caption if specified, else the full caption if specified, else nothing. + {% + \atdummies + % + % since we read the caption text in the macro world, where ^^M + % is turned into a normal character, we have to scan it back, so + % we don't write the literal three characters "^^M" into the aux file. + \scanexp{% + \xdef\noexpand\gtemp{% + \ifx\thisshortcaption\empty + \thiscaption + \else + \thisshortcaption + \fi + }% + }% + \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident + \ifx\gtemp\empty \else : \gtemp \fi}}% + }% + \fi + \egroup % end of \vtop + % + % place the captured inserts + % + % BEWARE: when the floats start floating, we have to issue warning + % whenever an insert appears inside a float which could possibly + % float. --kasal, 26may04 + % + \checkinserts +} + +% Append the tokens #2 to the definition of macro #1, not expanding either. +% +\def\appendtomacro#1#2{% + \expandafter\def\expandafter#1\expandafter{#1#2}% +} + +% @caption, @shortcaption +% +\def\caption{\docaption\thiscaption} +\def\shortcaption{\docaption\thisshortcaption} +\def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption} +\def\defcaption#1#2{\egroup \def#1{#2}} + +% The parameter is the control sequence identifying the counter we are +% going to use. Create it if it doesn't exist and assign it to \floatno. +\def\getfloatno#1{% + \ifx#1\relax + % Haven't seen this figure type before. + \csname newcount\endcsname #1% + % + % Remember to reset this floatno at the next chap. + \expandafter\gdef\expandafter\resetallfloatnos + \expandafter{\resetallfloatnos #1=0 }% + \fi + \let\floatno#1% +} + +% \setref calls this to get the XREFLABEL-snt value. We want an @xref +% to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we +% first read the @float command. +% +\def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}% + +% Magic string used for the XREFLABEL-title value, so \xrefX can +% distinguish floats from other xref types. +\def\floatmagic{!!float!!} + +% #1 is the control sequence we are passed; we expand into a conditional +% which is true if #1 represents a float ref. That is, the magic +% \lastsection value which we \setref above. +% +\def\iffloat#1{\expandafter\doiffloat#1==\finish} +% +% #1 is (maybe) the \floatmagic string. If so, #2 will be the +% (safe) float type for this float. We set \iffloattype to #2. +% +\def\doiffloat#1=#2=#3\finish{% + \def\temp{#1}% + \def\iffloattype{#2}% + \ifx\temp\floatmagic +} + +% @listoffloats FLOATTYPE - print a list of floats like a table of contents. +% +\parseargdef\listoffloats{% + \def\floattype{#1}% floattype + {% + % the floattype might have accents or other special characters, + % but we need to use it in a control sequence name. + \indexnofonts + \turnoffactive + \xdef\safefloattype{\floattype}% + }% + % + % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE. + \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax + \ifhavexrefs + % if the user said @listoffloats foo but never @float foo. + \message{\linenumber No `\safefloattype' floats to list.}% + \fi + \else + \begingroup + \leftskip=\tocindent % indent these entries like a toc + \let\do=\listoffloatsdo + \csname floatlist\safefloattype\endcsname + \endgroup + \fi +} + +% This is called on each entry in a list of floats. We're passed the +% xref label, in the form LABEL-title, which is how we save it in the +% aux file. We strip off the -title and look up \XRLABEL-lof, which +% has the text we're supposed to typeset here. +% +% Figures without xref labels will not be included in the list (since +% they won't appear in the aux file). +% +\def\listoffloatsdo#1{\listoffloatsdoentry#1\finish} +\def\listoffloatsdoentry#1-title\finish{{% + % Can't fully expand XR#1-lof because it can contain anything. Just + % pass the control sequence. On the other hand, XR#1-pg is just the + % page number, and we want to fully expand that so we can get a link + % in pdf output. + \toksA = \expandafter{\csname XR#1-lof\endcsname}% + % + % use the same \entry macro we use to generate the TOC and index. + \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}% + \writeentry +}} + + +\message{localization,} + +% @documentlanguage is usually given very early, just after +% @setfilename. If done too late, it may not override everything +% properly. Single argument is the language (de) or locale (de_DE) +% abbreviation. It would be nice if we could set up a hyphenation file. +% +{ + \catcode`\_ = \active + \globaldefs=1 +\parseargdef\documentlanguage{\begingroup + \let_=\normalunderscore % normal _ character for filenames + \tex % read txi-??.tex file in plain TeX. + % Read the file by the name they passed if it exists. + \openin 1 txi-#1.tex + \ifeof 1 + \documentlanguagetrywithoutunderscore{#1_\finish}% + \else + \input txi-#1.tex + \fi + \closein 1 + \endgroup +\endgroup} +} +% +% If they passed de_DE, and txi-de_DE.tex doesn't exist, +% try txi-de.tex. +% +\def\documentlanguagetrywithoutunderscore#1_#2\finish{% + \openin 1 txi-#1.tex + \ifeof 1 + \errhelp = \nolanghelp + \errmessage{Cannot read language file txi-#1.tex}% + \else + \input txi-#1.tex + \fi + \closein 1 +} +% +\newhelp\nolanghelp{The given language definition file cannot be found or +is empty. Maybe you need to install it? In the current directory +should work if nowhere else does.} + +% Set the catcode of characters 128 through 255 to the specified number. +% +\def\setnonasciicharscatcode#1{% + \count255=128 + \loop\ifnum\count255<256 + \global\catcode\count255=#1\relax + \advance\count255 by 1 + \repeat +} + +\def\setnonasciicharscatcodenonglobal#1{% + \count255=128 + \loop\ifnum\count255<256 + \catcode\count255=#1\relax + \advance\count255 by 1 + \repeat +} + +% @documentencoding sets the definition of non-ASCII characters +% according to the specified encoding. +% +\parseargdef\documentencoding{% + % Encoding being declared for the document. + \def\declaredencoding{\csname #1.enc\endcsname}% + % + % Supported encodings: names converted to tokens in order to be able + % to compare them with \ifx. + \def\ascii{\csname US-ASCII.enc\endcsname}% + \def\latnine{\csname ISO-8859-15.enc\endcsname}% + \def\latone{\csname ISO-8859-1.enc\endcsname}% + \def\lattwo{\csname ISO-8859-2.enc\endcsname}% + \def\utfeight{\csname UTF-8.enc\endcsname}% + % + \ifx \declaredencoding \ascii + \asciichardefs + % + \else \ifx \declaredencoding \lattwo + \setnonasciicharscatcode\active + \lattwochardefs + % + \else \ifx \declaredencoding \latone + \setnonasciicharscatcode\active + \latonechardefs + % + \else \ifx \declaredencoding \latnine + \setnonasciicharscatcode\active + \latninechardefs + % + \else \ifx \declaredencoding \utfeight + \setnonasciicharscatcode\active + \utfeightchardefs + % + \else + \message{Unknown document encoding #1, ignoring.}% + % + \fi % utfeight + \fi % latnine + \fi % latone + \fi % lattwo + \fi % ascii +} + +% A message to be logged when using a character that isn't available +% the default font encoding (OT1). +% +\def\missingcharmsg#1{\message{Character missing in OT1 encoding: #1.}} + +% Take account of \c (plain) vs. \, (Texinfo) difference. +\def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi} + +% First, make active non-ASCII characters in order for them to be +% correctly categorized when TeX reads the replacement text of +% macros containing the character definitions. +\setnonasciicharscatcode\active +% +% Latin1 (ISO-8859-1) character definitions. +\def\latonechardefs{% + \gdef^^a0{~} + \gdef^^a1{\exclamdown} + \gdef^^a2{\missingcharmsg{CENT SIGN}} + \gdef^^a3{{\pounds}} + \gdef^^a4{\missingcharmsg{CURRENCY SIGN}} + \gdef^^a5{\missingcharmsg{YEN SIGN}} + \gdef^^a6{\missingcharmsg{BROKEN BAR}} + \gdef^^a7{\S} + \gdef^^a8{\"{}} + \gdef^^a9{\copyright} + \gdef^^aa{\ordf} + \gdef^^ab{\missingcharmsg{LEFT-POINTING DOUBLE ANGLE QUOTATION MARK}} + \gdef^^ac{$\lnot$} + \gdef^^ad{\-} + \gdef^^ae{\registeredsymbol} + \gdef^^af{\={}} + % + \gdef^^b0{\textdegree} + \gdef^^b1{$\pm$} + \gdef^^b2{$^2$} + \gdef^^b3{$^3$} + \gdef^^b4{\'{}} + \gdef^^b5{$\mu$} + \gdef^^b6{\P} + % + \gdef^^b7{$^.$} + \gdef^^b8{\cedilla\ } + \gdef^^b9{$^1$} + \gdef^^ba{\ordm} + % + \gdef^^bb{\missingcharmsg{RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK}} + \gdef^^bc{$1\over4$} + \gdef^^bd{$1\over2$} + \gdef^^be{$3\over4$} + \gdef^^bf{\questiondown} + % + \gdef^^c0{\`A} + \gdef^^c1{\'A} + \gdef^^c2{\^A} + \gdef^^c3{\~A} + \gdef^^c4{\"A} + \gdef^^c5{\ringaccent A} + \gdef^^c6{\AE} + \gdef^^c7{\cedilla C} + \gdef^^c8{\`E} + \gdef^^c9{\'E} + \gdef^^ca{\^E} + \gdef^^cb{\"E} + \gdef^^cc{\`I} + \gdef^^cd{\'I} + \gdef^^ce{\^I} + \gdef^^cf{\"I} + % + \gdef^^d0{\missingcharmsg{LATIN CAPITAL LETTER ETH}} + \gdef^^d1{\~N} + \gdef^^d2{\`O} + \gdef^^d3{\'O} + \gdef^^d4{\^O} + \gdef^^d5{\~O} + \gdef^^d6{\"O} + \gdef^^d7{$\times$} + \gdef^^d8{\O} + \gdef^^d9{\`U} + \gdef^^da{\'U} + \gdef^^db{\^U} + \gdef^^dc{\"U} + \gdef^^dd{\'Y} + \gdef^^de{\missingcharmsg{LATIN CAPITAL LETTER THORN}} + \gdef^^df{\ss} + % + \gdef^^e0{\`a} + \gdef^^e1{\'a} + \gdef^^e2{\^a} + \gdef^^e3{\~a} + \gdef^^e4{\"a} + \gdef^^e5{\ringaccent a} + \gdef^^e6{\ae} + \gdef^^e7{\cedilla c} + \gdef^^e8{\`e} + \gdef^^e9{\'e} + \gdef^^ea{\^e} + \gdef^^eb{\"e} + \gdef^^ec{\`{\dotless i}} + \gdef^^ed{\'{\dotless i}} + \gdef^^ee{\^{\dotless i}} + \gdef^^ef{\"{\dotless i}} + % + \gdef^^f0{\missingcharmsg{LATIN SMALL LETTER ETH}} + \gdef^^f1{\~n} + \gdef^^f2{\`o} + \gdef^^f3{\'o} + \gdef^^f4{\^o} + \gdef^^f5{\~o} + \gdef^^f6{\"o} + \gdef^^f7{$\div$} + \gdef^^f8{\o} + \gdef^^f9{\`u} + \gdef^^fa{\'u} + \gdef^^fb{\^u} + \gdef^^fc{\"u} + \gdef^^fd{\'y} + \gdef^^fe{\missingcharmsg{LATIN SMALL LETTER THORN}} + \gdef^^ff{\"y} +} + +% Latin9 (ISO-8859-15) encoding character definitions. +\def\latninechardefs{% + % Encoding is almost identical to Latin1. + \latonechardefs + % + \gdef^^a4{\euro} + \gdef^^a6{\v S} + \gdef^^a8{\v s} + \gdef^^b4{\v Z} + \gdef^^b8{\v z} + \gdef^^bc{\OE} + \gdef^^bd{\oe} + \gdef^^be{\"Y} +} + +% Latin2 (ISO-8859-2) character definitions. +\def\lattwochardefs{% + \gdef^^a0{~} + \gdef^^a1{\missingcharmsg{LATIN CAPITAL LETTER A WITH OGONEK}} + \gdef^^a2{\u{}} + \gdef^^a3{\L} + \gdef^^a4{\missingcharmsg{CURRENCY SIGN}} + \gdef^^a5{\v L} + \gdef^^a6{\'S} + \gdef^^a7{\S} + \gdef^^a8{\"{}} + \gdef^^a9{\v S} + \gdef^^aa{\cedilla S} + \gdef^^ab{\v T} + \gdef^^ac{\'Z} + \gdef^^ad{\-} + \gdef^^ae{\v Z} + \gdef^^af{\dotaccent Z} + % + \gdef^^b0{\textdegree} + \gdef^^b1{\missingcharmsg{LATIN SMALL LETTER A WITH OGONEK}} + \gdef^^b2{\missingcharmsg{OGONEK}} + \gdef^^b3{\l} + \gdef^^b4{\'{}} + \gdef^^b5{\v l} + \gdef^^b6{\'s} + \gdef^^b7{\v{}} + \gdef^^b8{\cedilla\ } + \gdef^^b9{\v s} + \gdef^^ba{\cedilla s} + \gdef^^bb{\v t} + \gdef^^bc{\'z} + \gdef^^bd{\H{}} + \gdef^^be{\v z} + \gdef^^bf{\dotaccent z} + % + \gdef^^c0{\'R} + \gdef^^c1{\'A} + \gdef^^c2{\^A} + \gdef^^c3{\u A} + \gdef^^c4{\"A} + \gdef^^c5{\'L} + \gdef^^c6{\'C} + \gdef^^c7{\cedilla C} + \gdef^^c8{\v C} + \gdef^^c9{\'E} + \gdef^^ca{\missingcharmsg{LATIN CAPITAL LETTER E WITH OGONEK}} + \gdef^^cb{\"E} + \gdef^^cc{\v E} + \gdef^^cd{\'I} + \gdef^^ce{\^I} + \gdef^^cf{\v D} + % + \gdef^^d0{\missingcharmsg{LATIN CAPITAL LETTER D WITH STROKE}} + \gdef^^d1{\'N} + \gdef^^d2{\v N} + \gdef^^d3{\'O} + \gdef^^d4{\^O} + \gdef^^d5{\H O} + \gdef^^d6{\"O} + \gdef^^d7{$\times$} + \gdef^^d8{\v R} + \gdef^^d9{\ringaccent U} + \gdef^^da{\'U} + \gdef^^db{\H U} + \gdef^^dc{\"U} + \gdef^^dd{\'Y} + \gdef^^de{\cedilla T} + \gdef^^df{\ss} + % + \gdef^^e0{\'r} + \gdef^^e1{\'a} + \gdef^^e2{\^a} + \gdef^^e3{\u a} + \gdef^^e4{\"a} + \gdef^^e5{\'l} + \gdef^^e6{\'c} + \gdef^^e7{\cedilla c} + \gdef^^e8{\v c} + \gdef^^e9{\'e} + \gdef^^ea{\missingcharmsg{LATIN SMALL LETTER E WITH OGONEK}} + \gdef^^eb{\"e} + \gdef^^ec{\v e} + \gdef^^ed{\'\i} + \gdef^^ee{\^\i} + \gdef^^ef{\v d} + % + \gdef^^f0{\missingcharmsg{LATIN SMALL LETTER D WITH STROKE}} + \gdef^^f1{\'n} + \gdef^^f2{\v n} + \gdef^^f3{\'o} + \gdef^^f4{\^o} + \gdef^^f5{\H o} + \gdef^^f6{\"o} + \gdef^^f7{$\div$} + \gdef^^f8{\v r} + \gdef^^f9{\ringaccent u} + \gdef^^fa{\'u} + \gdef^^fb{\H u} + \gdef^^fc{\"u} + \gdef^^fd{\'y} + \gdef^^fe{\cedilla t} + \gdef^^ff{\dotaccent{}} +} + +% UTF-8 character definitions. +% +% This code to support UTF-8 is based on LaTeX's utf8.def, with some +% changes for Texinfo conventions. It is included here under the GPL by +% permission from Frank Mittelbach and the LaTeX team. +% +\newcount\countUTFx +\newcount\countUTFy +\newcount\countUTFz + +\gdef\UTFviiiTwoOctets#1#2{\expandafter + \UTFviiiDefined\csname u8:#1\string #2\endcsname} +% +\gdef\UTFviiiThreeOctets#1#2#3{\expandafter + \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname} +% +\gdef\UTFviiiFourOctets#1#2#3#4{\expandafter + \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname} + +\gdef\UTFviiiDefined#1{% + \ifx #1\relax + \message{\linenumber Unicode char \string #1 not defined for Texinfo}% + \else + \expandafter #1% + \fi +} + +\begingroup + \catcode`\~13 + \catcode`\"12 + + \def\UTFviiiLoop{% + \global\catcode\countUTFx\active + \uccode`\~\countUTFx + \uppercase\expandafter{\UTFviiiTmp}% + \advance\countUTFx by 1 + \ifnum\countUTFx < \countUTFy + \expandafter\UTFviiiLoop + \fi} + + \countUTFx = "C2 + \countUTFy = "E0 + \def\UTFviiiTmp{% + \xdef~{\noexpand\UTFviiiTwoOctets\string~}} + \UTFviiiLoop + + \countUTFx = "E0 + \countUTFy = "F0 + \def\UTFviiiTmp{% + \xdef~{\noexpand\UTFviiiThreeOctets\string~}} + \UTFviiiLoop + + \countUTFx = "F0 + \countUTFy = "F4 + \def\UTFviiiTmp{% + \xdef~{\noexpand\UTFviiiFourOctets\string~}} + \UTFviiiLoop +\endgroup + +\begingroup + \catcode`\"=12 + \catcode`\<=12 + \catcode`\.=12 + \catcode`\,=12 + \catcode`\;=12 + \catcode`\!=12 + \catcode`\~=13 + + \gdef\DeclareUnicodeCharacter#1#2{% + \countUTFz = "#1\relax + \wlog{\space\space defining Unicode char U+#1 (decimal \the\countUTFz)}% + \begingroup + \parseXMLCharref + \def\UTFviiiTwoOctets##1##2{% + \csname u8:##1\string ##2\endcsname}% + \def\UTFviiiThreeOctets##1##2##3{% + \csname u8:##1\string ##2\string ##3\endcsname}% + \def\UTFviiiFourOctets##1##2##3##4{% + \csname u8:##1\string ##2\string ##3\string ##4\endcsname}% + \expandafter\expandafter\expandafter\expandafter + \expandafter\expandafter\expandafter + \gdef\UTFviiiTmp{#2}% + \endgroup} + + \gdef\parseXMLCharref{% + \ifnum\countUTFz < "A0\relax + \errhelp = \EMsimple + \errmessage{Cannot define Unicode char value < 00A0}% + \else\ifnum\countUTFz < "800\relax + \parseUTFviiiA,% + \parseUTFviiiB C\UTFviiiTwoOctets.,% + \else\ifnum\countUTFz < "10000\relax + \parseUTFviiiA;% + \parseUTFviiiA,% + \parseUTFviiiB E\UTFviiiThreeOctets.{,;}% + \else + \parseUTFviiiA;% + \parseUTFviiiA,% + \parseUTFviiiA!% + \parseUTFviiiB F\UTFviiiFourOctets.{!,;}% + \fi\fi\fi + } + + \gdef\parseUTFviiiA#1{% + \countUTFx = \countUTFz + \divide\countUTFz by 64 + \countUTFy = \countUTFz + \multiply\countUTFz by 64 + \advance\countUTFx by -\countUTFz + \advance\countUTFx by 128 + \uccode `#1\countUTFx + \countUTFz = \countUTFy} + + \gdef\parseUTFviiiB#1#2#3#4{% + \advance\countUTFz by "#10\relax + \uccode `#3\countUTFz + \uppercase{\gdef\UTFviiiTmp{#2#3#4}}} +\endgroup + +\def\utfeightchardefs{% + \DeclareUnicodeCharacter{00A0}{\tie} + \DeclareUnicodeCharacter{00A1}{\exclamdown} + \DeclareUnicodeCharacter{00A3}{\pounds} + \DeclareUnicodeCharacter{00A8}{\"{ }} + \DeclareUnicodeCharacter{00A9}{\copyright} + \DeclareUnicodeCharacter{00AA}{\ordf} + \DeclareUnicodeCharacter{00AB}{\guillemetleft} + \DeclareUnicodeCharacter{00AD}{\-} + \DeclareUnicodeCharacter{00AE}{\registeredsymbol} + \DeclareUnicodeCharacter{00AF}{\={ }} + + \DeclareUnicodeCharacter{00B0}{\ringaccent{ }} + \DeclareUnicodeCharacter{00B4}{\'{ }} + \DeclareUnicodeCharacter{00B8}{\cedilla{ }} + \DeclareUnicodeCharacter{00BA}{\ordm} + \DeclareUnicodeCharacter{00BB}{\guillemetright} + \DeclareUnicodeCharacter{00BF}{\questiondown} + + \DeclareUnicodeCharacter{00C0}{\`A} + \DeclareUnicodeCharacter{00C1}{\'A} + \DeclareUnicodeCharacter{00C2}{\^A} + \DeclareUnicodeCharacter{00C3}{\~A} + \DeclareUnicodeCharacter{00C4}{\"A} + \DeclareUnicodeCharacter{00C5}{\AA} + \DeclareUnicodeCharacter{00C6}{\AE} + \DeclareUnicodeCharacter{00C7}{\cedilla{C}} + \DeclareUnicodeCharacter{00C8}{\`E} + \DeclareUnicodeCharacter{00C9}{\'E} + \DeclareUnicodeCharacter{00CA}{\^E} + \DeclareUnicodeCharacter{00CB}{\"E} + \DeclareUnicodeCharacter{00CC}{\`I} + \DeclareUnicodeCharacter{00CD}{\'I} + \DeclareUnicodeCharacter{00CE}{\^I} + \DeclareUnicodeCharacter{00CF}{\"I} + + \DeclareUnicodeCharacter{00D1}{\~N} + \DeclareUnicodeCharacter{00D2}{\`O} + \DeclareUnicodeCharacter{00D3}{\'O} + \DeclareUnicodeCharacter{00D4}{\^O} + \DeclareUnicodeCharacter{00D5}{\~O} + \DeclareUnicodeCharacter{00D6}{\"O} + \DeclareUnicodeCharacter{00D8}{\O} + \DeclareUnicodeCharacter{00D9}{\`U} + \DeclareUnicodeCharacter{00DA}{\'U} + \DeclareUnicodeCharacter{00DB}{\^U} + \DeclareUnicodeCharacter{00DC}{\"U} + \DeclareUnicodeCharacter{00DD}{\'Y} + \DeclareUnicodeCharacter{00DF}{\ss} + + \DeclareUnicodeCharacter{00E0}{\`a} + \DeclareUnicodeCharacter{00E1}{\'a} + \DeclareUnicodeCharacter{00E2}{\^a} + \DeclareUnicodeCharacter{00E3}{\~a} + \DeclareUnicodeCharacter{00E4}{\"a} + \DeclareUnicodeCharacter{00E5}{\aa} + \DeclareUnicodeCharacter{00E6}{\ae} + \DeclareUnicodeCharacter{00E7}{\cedilla{c}} + \DeclareUnicodeCharacter{00E8}{\`e} + \DeclareUnicodeCharacter{00E9}{\'e} + \DeclareUnicodeCharacter{00EA}{\^e} + \DeclareUnicodeCharacter{00EB}{\"e} + \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}} + \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}} + \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}} + \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}} + + \DeclareUnicodeCharacter{00F1}{\~n} + \DeclareUnicodeCharacter{00F2}{\`o} + \DeclareUnicodeCharacter{00F3}{\'o} + \DeclareUnicodeCharacter{00F4}{\^o} + \DeclareUnicodeCharacter{00F5}{\~o} + \DeclareUnicodeCharacter{00F6}{\"o} + \DeclareUnicodeCharacter{00F8}{\o} + \DeclareUnicodeCharacter{00F9}{\`u} + \DeclareUnicodeCharacter{00FA}{\'u} + \DeclareUnicodeCharacter{00FB}{\^u} + \DeclareUnicodeCharacter{00FC}{\"u} + \DeclareUnicodeCharacter{00FD}{\'y} + \DeclareUnicodeCharacter{00FF}{\"y} + + \DeclareUnicodeCharacter{0100}{\=A} + \DeclareUnicodeCharacter{0101}{\=a} + \DeclareUnicodeCharacter{0102}{\u{A}} + \DeclareUnicodeCharacter{0103}{\u{a}} + \DeclareUnicodeCharacter{0106}{\'C} + \DeclareUnicodeCharacter{0107}{\'c} + \DeclareUnicodeCharacter{0108}{\^C} + \DeclareUnicodeCharacter{0109}{\^c} + \DeclareUnicodeCharacter{010A}{\dotaccent{C}} + \DeclareUnicodeCharacter{010B}{\dotaccent{c}} + \DeclareUnicodeCharacter{010C}{\v{C}} + \DeclareUnicodeCharacter{010D}{\v{c}} + \DeclareUnicodeCharacter{010E}{\v{D}} + + \DeclareUnicodeCharacter{0112}{\=E} + \DeclareUnicodeCharacter{0113}{\=e} + \DeclareUnicodeCharacter{0114}{\u{E}} + \DeclareUnicodeCharacter{0115}{\u{e}} + \DeclareUnicodeCharacter{0116}{\dotaccent{E}} + \DeclareUnicodeCharacter{0117}{\dotaccent{e}} + \DeclareUnicodeCharacter{011A}{\v{E}} + \DeclareUnicodeCharacter{011B}{\v{e}} + \DeclareUnicodeCharacter{011C}{\^G} + \DeclareUnicodeCharacter{011D}{\^g} + \DeclareUnicodeCharacter{011E}{\u{G}} + \DeclareUnicodeCharacter{011F}{\u{g}} + + \DeclareUnicodeCharacter{0120}{\dotaccent{G}} + \DeclareUnicodeCharacter{0121}{\dotaccent{g}} + \DeclareUnicodeCharacter{0124}{\^H} + \DeclareUnicodeCharacter{0125}{\^h} + \DeclareUnicodeCharacter{0128}{\~I} + \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}} + \DeclareUnicodeCharacter{012A}{\=I} + \DeclareUnicodeCharacter{012B}{\={\dotless{i}}} + \DeclareUnicodeCharacter{012C}{\u{I}} + \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}} + + \DeclareUnicodeCharacter{0130}{\dotaccent{I}} + \DeclareUnicodeCharacter{0131}{\dotless{i}} + \DeclareUnicodeCharacter{0132}{IJ} + \DeclareUnicodeCharacter{0133}{ij} + \DeclareUnicodeCharacter{0134}{\^J} + \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}} + \DeclareUnicodeCharacter{0139}{\'L} + \DeclareUnicodeCharacter{013A}{\'l} + + \DeclareUnicodeCharacter{0141}{\L} + \DeclareUnicodeCharacter{0142}{\l} + \DeclareUnicodeCharacter{0143}{\'N} + \DeclareUnicodeCharacter{0144}{\'n} + \DeclareUnicodeCharacter{0147}{\v{N}} + \DeclareUnicodeCharacter{0148}{\v{n}} + \DeclareUnicodeCharacter{014C}{\=O} + \DeclareUnicodeCharacter{014D}{\=o} + \DeclareUnicodeCharacter{014E}{\u{O}} + \DeclareUnicodeCharacter{014F}{\u{o}} + + \DeclareUnicodeCharacter{0150}{\H{O}} + \DeclareUnicodeCharacter{0151}{\H{o}} + \DeclareUnicodeCharacter{0152}{\OE} + \DeclareUnicodeCharacter{0153}{\oe} + \DeclareUnicodeCharacter{0154}{\'R} + \DeclareUnicodeCharacter{0155}{\'r} + \DeclareUnicodeCharacter{0158}{\v{R}} + \DeclareUnicodeCharacter{0159}{\v{r}} + \DeclareUnicodeCharacter{015A}{\'S} + \DeclareUnicodeCharacter{015B}{\'s} + \DeclareUnicodeCharacter{015C}{\^S} + \DeclareUnicodeCharacter{015D}{\^s} + \DeclareUnicodeCharacter{015E}{\cedilla{S}} + \DeclareUnicodeCharacter{015F}{\cedilla{s}} + + \DeclareUnicodeCharacter{0160}{\v{S}} + \DeclareUnicodeCharacter{0161}{\v{s}} + \DeclareUnicodeCharacter{0162}{\cedilla{t}} + \DeclareUnicodeCharacter{0163}{\cedilla{T}} + \DeclareUnicodeCharacter{0164}{\v{T}} + + \DeclareUnicodeCharacter{0168}{\~U} + \DeclareUnicodeCharacter{0169}{\~u} + \DeclareUnicodeCharacter{016A}{\=U} + \DeclareUnicodeCharacter{016B}{\=u} + \DeclareUnicodeCharacter{016C}{\u{U}} + \DeclareUnicodeCharacter{016D}{\u{u}} + \DeclareUnicodeCharacter{016E}{\ringaccent{U}} + \DeclareUnicodeCharacter{016F}{\ringaccent{u}} + + \DeclareUnicodeCharacter{0170}{\H{U}} + \DeclareUnicodeCharacter{0171}{\H{u}} + \DeclareUnicodeCharacter{0174}{\^W} + \DeclareUnicodeCharacter{0175}{\^w} + \DeclareUnicodeCharacter{0176}{\^Y} + \DeclareUnicodeCharacter{0177}{\^y} + \DeclareUnicodeCharacter{0178}{\"Y} + \DeclareUnicodeCharacter{0179}{\'Z} + \DeclareUnicodeCharacter{017A}{\'z} + \DeclareUnicodeCharacter{017B}{\dotaccent{Z}} + \DeclareUnicodeCharacter{017C}{\dotaccent{z}} + \DeclareUnicodeCharacter{017D}{\v{Z}} + \DeclareUnicodeCharacter{017E}{\v{z}} + + \DeclareUnicodeCharacter{01C4}{D\v{Z}} + \DeclareUnicodeCharacter{01C5}{D\v{z}} + \DeclareUnicodeCharacter{01C6}{d\v{z}} + \DeclareUnicodeCharacter{01C7}{LJ} + \DeclareUnicodeCharacter{01C8}{Lj} + \DeclareUnicodeCharacter{01C9}{lj} + \DeclareUnicodeCharacter{01CA}{NJ} + \DeclareUnicodeCharacter{01CB}{Nj} + \DeclareUnicodeCharacter{01CC}{nj} + \DeclareUnicodeCharacter{01CD}{\v{A}} + \DeclareUnicodeCharacter{01CE}{\v{a}} + \DeclareUnicodeCharacter{01CF}{\v{I}} + + \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}} + \DeclareUnicodeCharacter{01D1}{\v{O}} + \DeclareUnicodeCharacter{01D2}{\v{o}} + \DeclareUnicodeCharacter{01D3}{\v{U}} + \DeclareUnicodeCharacter{01D4}{\v{u}} + + \DeclareUnicodeCharacter{01E2}{\={\AE}} + \DeclareUnicodeCharacter{01E3}{\={\ae}} + \DeclareUnicodeCharacter{01E6}{\v{G}} + \DeclareUnicodeCharacter{01E7}{\v{g}} + \DeclareUnicodeCharacter{01E8}{\v{K}} + \DeclareUnicodeCharacter{01E9}{\v{k}} + + \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}} + \DeclareUnicodeCharacter{01F1}{DZ} + \DeclareUnicodeCharacter{01F2}{Dz} + \DeclareUnicodeCharacter{01F3}{dz} + \DeclareUnicodeCharacter{01F4}{\'G} + \DeclareUnicodeCharacter{01F5}{\'g} + \DeclareUnicodeCharacter{01F8}{\`N} + \DeclareUnicodeCharacter{01F9}{\`n} + \DeclareUnicodeCharacter{01FC}{\'{\AE}} + \DeclareUnicodeCharacter{01FD}{\'{\ae}} + \DeclareUnicodeCharacter{01FE}{\'{\O}} + \DeclareUnicodeCharacter{01FF}{\'{\o}} + + \DeclareUnicodeCharacter{021E}{\v{H}} + \DeclareUnicodeCharacter{021F}{\v{h}} + + \DeclareUnicodeCharacter{0226}{\dotaccent{A}} + \DeclareUnicodeCharacter{0227}{\dotaccent{a}} + \DeclareUnicodeCharacter{0228}{\cedilla{E}} + \DeclareUnicodeCharacter{0229}{\cedilla{e}} + \DeclareUnicodeCharacter{022E}{\dotaccent{O}} + \DeclareUnicodeCharacter{022F}{\dotaccent{o}} + + \DeclareUnicodeCharacter{0232}{\=Y} + \DeclareUnicodeCharacter{0233}{\=y} + \DeclareUnicodeCharacter{0237}{\dotless{j}} + + \DeclareUnicodeCharacter{1E02}{\dotaccent{B}} + \DeclareUnicodeCharacter{1E03}{\dotaccent{b}} + \DeclareUnicodeCharacter{1E04}{\udotaccent{B}} + \DeclareUnicodeCharacter{1E05}{\udotaccent{b}} + \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}} + \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}} + \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}} + \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}} + \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}} + \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}} + \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}} + \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}} + + \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}} + \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}} + + \DeclareUnicodeCharacter{1E20}{\=G} + \DeclareUnicodeCharacter{1E21}{\=g} + \DeclareUnicodeCharacter{1E22}{\dotaccent{H}} + \DeclareUnicodeCharacter{1E23}{\dotaccent{h}} + \DeclareUnicodeCharacter{1E24}{\udotaccent{H}} + \DeclareUnicodeCharacter{1E25}{\udotaccent{h}} + \DeclareUnicodeCharacter{1E26}{\"H} + \DeclareUnicodeCharacter{1E27}{\"h} + + \DeclareUnicodeCharacter{1E30}{\'K} + \DeclareUnicodeCharacter{1E31}{\'k} + \DeclareUnicodeCharacter{1E32}{\udotaccent{K}} + \DeclareUnicodeCharacter{1E33}{\udotaccent{k}} + \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}} + \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}} + \DeclareUnicodeCharacter{1E36}{\udotaccent{L}} + \DeclareUnicodeCharacter{1E37}{\udotaccent{l}} + \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}} + \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}} + \DeclareUnicodeCharacter{1E3E}{\'M} + \DeclareUnicodeCharacter{1E3F}{\'m} + + \DeclareUnicodeCharacter{1E40}{\dotaccent{M}} + \DeclareUnicodeCharacter{1E41}{\dotaccent{m}} + \DeclareUnicodeCharacter{1E42}{\udotaccent{M}} + \DeclareUnicodeCharacter{1E43}{\udotaccent{m}} + \DeclareUnicodeCharacter{1E44}{\dotaccent{N}} + \DeclareUnicodeCharacter{1E45}{\dotaccent{n}} + \DeclareUnicodeCharacter{1E46}{\udotaccent{N}} + \DeclareUnicodeCharacter{1E47}{\udotaccent{n}} + \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}} + \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}} + + \DeclareUnicodeCharacter{1E54}{\'P} + \DeclareUnicodeCharacter{1E55}{\'p} + \DeclareUnicodeCharacter{1E56}{\dotaccent{P}} + \DeclareUnicodeCharacter{1E57}{\dotaccent{p}} + \DeclareUnicodeCharacter{1E58}{\dotaccent{R}} + \DeclareUnicodeCharacter{1E59}{\dotaccent{r}} + \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}} + \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}} + \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}} + \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}} + + \DeclareUnicodeCharacter{1E60}{\dotaccent{S}} + \DeclareUnicodeCharacter{1E61}{\dotaccent{s}} + \DeclareUnicodeCharacter{1E62}{\udotaccent{S}} + \DeclareUnicodeCharacter{1E63}{\udotaccent{s}} + \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}} + \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}} + \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}} + \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}} + \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}} + \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}} + + \DeclareUnicodeCharacter{1E7C}{\~V} + \DeclareUnicodeCharacter{1E7D}{\~v} + \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}} + \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}} + + \DeclareUnicodeCharacter{1E80}{\`W} + \DeclareUnicodeCharacter{1E81}{\`w} + \DeclareUnicodeCharacter{1E82}{\'W} + \DeclareUnicodeCharacter{1E83}{\'w} + \DeclareUnicodeCharacter{1E84}{\"W} + \DeclareUnicodeCharacter{1E85}{\"w} + \DeclareUnicodeCharacter{1E86}{\dotaccent{W}} + \DeclareUnicodeCharacter{1E87}{\dotaccent{w}} + \DeclareUnicodeCharacter{1E88}{\udotaccent{W}} + \DeclareUnicodeCharacter{1E89}{\udotaccent{w}} + \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}} + \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}} + \DeclareUnicodeCharacter{1E8C}{\"X} + \DeclareUnicodeCharacter{1E8D}{\"x} + \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}} + \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}} + + \DeclareUnicodeCharacter{1E90}{\^Z} + \DeclareUnicodeCharacter{1E91}{\^z} + \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}} + \DeclareUnicodeCharacter{1E93}{\udotaccent{z}} + \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}} + \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}} + \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}} + \DeclareUnicodeCharacter{1E97}{\"t} + \DeclareUnicodeCharacter{1E98}{\ringaccent{w}} + \DeclareUnicodeCharacter{1E99}{\ringaccent{y}} + + \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}} + \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}} + + \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}} + \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}} + \DeclareUnicodeCharacter{1EBC}{\~E} + \DeclareUnicodeCharacter{1EBD}{\~e} + + \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}} + \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}} + \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}} + \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}} + + \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}} + \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}} + + \DeclareUnicodeCharacter{1EF2}{\`Y} + \DeclareUnicodeCharacter{1EF3}{\`y} + \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}} + + \DeclareUnicodeCharacter{1EF8}{\~Y} + \DeclareUnicodeCharacter{1EF9}{\~y} + + \DeclareUnicodeCharacter{2013}{--} + \DeclareUnicodeCharacter{2014}{---} + \DeclareUnicodeCharacter{2018}{\quoteleft} + \DeclareUnicodeCharacter{2019}{\quoteright} + \DeclareUnicodeCharacter{201A}{\quotesinglbase} + \DeclareUnicodeCharacter{201C}{\quotedblleft} + \DeclareUnicodeCharacter{201D}{\quotedblright} + \DeclareUnicodeCharacter{201E}{\quotedblbase} + \DeclareUnicodeCharacter{2022}{\bullet} + \DeclareUnicodeCharacter{2026}{\dots} + \DeclareUnicodeCharacter{2039}{\guilsinglleft} + \DeclareUnicodeCharacter{203A}{\guilsinglright} + \DeclareUnicodeCharacter{20AC}{\euro} + + \DeclareUnicodeCharacter{2192}{\expansion} + \DeclareUnicodeCharacter{21D2}{\result} + + \DeclareUnicodeCharacter{2212}{\minus} + \DeclareUnicodeCharacter{2217}{\point} + \DeclareUnicodeCharacter{2261}{\equiv} +}% end of \utfeightchardefs + + +% US-ASCII character definitions. +\def\asciichardefs{% nothing need be done + \relax +} + +% Make non-ASCII characters printable again for compatibility with +% existing Texinfo documents that may use them, even without declaring a +% document encoding. +% +\setnonasciicharscatcode \other + + +\message{formatting,} + +\newdimen\defaultparindent \defaultparindent = 15pt + +\chapheadingskip = 15pt plus 4pt minus 2pt +\secheadingskip = 12pt plus 3pt minus 2pt +\subsecheadingskip = 9pt plus 2pt minus 2pt + +% Prevent underfull vbox error messages. +\vbadness = 10000 + +% Don't be so finicky about underfull hboxes, either. +\hbadness = 2000 + +% Following George Bush, get rid of widows and orphans. +\widowpenalty=10000 +\clubpenalty=10000 + +% Use TeX 3.0's \emergencystretch to help line breaking, but if we're +% using an old version of TeX, don't do anything. We want the amount of +% stretch added to depend on the line length, hence the dependence on +% \hsize. We call this whenever the paper size is set. +% +\def\setemergencystretch{% + \ifx\emergencystretch\thisisundefined + % Allow us to assign to \emergencystretch anyway. + \def\emergencystretch{\dimen0}% + \else + \emergencystretch = .15\hsize + \fi +} + +% Parameters in order: 1) textheight; 2) textwidth; +% 3) voffset; 4) hoffset; 5) binding offset; 6) topskip; +% 7) physical page height; 8) physical page width. +% +% We also call \setleading{\textleading}, so the caller should define +% \textleading. The caller should also set \parskip. +% +\def\internalpagesizes#1#2#3#4#5#6#7#8{% + \voffset = #3\relax + \topskip = #6\relax + \splittopskip = \topskip + % + \vsize = #1\relax + \advance\vsize by \topskip + \outervsize = \vsize + \advance\outervsize by 2\topandbottommargin + \pageheight = \vsize + % + \hsize = #2\relax + \outerhsize = \hsize + \advance\outerhsize by 0.5in + \pagewidth = \hsize + % + \normaloffset = #4\relax + \bindingoffset = #5\relax + % + \ifpdf + \pdfpageheight #7\relax + \pdfpagewidth #8\relax + % if we don't reset these, they will remain at "1 true in" of + % whatever layout pdftex was dumped with. + \pdfhorigin = 1 true in + \pdfvorigin = 1 true in + \fi + % + \setleading{\textleading} + % + \parindent = \defaultparindent + \setemergencystretch +} + +% @letterpaper (the default). +\def\letterpaper{{\globaldefs = 1 + \parskip = 3pt plus 2pt minus 1pt + \textleading = 13.2pt + % + % If page is nothing but text, make it come out even. + \internalpagesizes{607.2pt}{6in}% that's 46 lines + {\voffset}{.25in}% + {\bindingoffset}{36pt}% + {11in}{8.5in}% +}} + +% Use @smallbook to reset parameters for 7x9.25 trim size. +\def\smallbook{{\globaldefs = 1 + \parskip = 2pt plus 1pt + \textleading = 12pt + % + \internalpagesizes{7.5in}{5in}% + {-.2in}{0in}% + {\bindingoffset}{16pt}% + {9.25in}{7in}% + % + \lispnarrowing = 0.3in + \tolerance = 700 + \hfuzz = 1pt + \contentsrightmargin = 0pt + \defbodyindent = .5cm +}} + +% Use @smallerbook to reset parameters for 6x9 trim size. +% (Just testing, parameters still in flux.) +\def\smallerbook{{\globaldefs = 1 + \parskip = 1.5pt plus 1pt + \textleading = 12pt + % + \internalpagesizes{7.4in}{4.8in}% + {-.2in}{-.4in}% + {0pt}{14pt}% + {9in}{6in}% + % + \lispnarrowing = 0.25in + \tolerance = 700 + \hfuzz = 1pt + \contentsrightmargin = 0pt + \defbodyindent = .4cm +}} + +% Use @afourpaper to print on European A4 paper. +\def\afourpaper{{\globaldefs = 1 + \parskip = 3pt plus 2pt minus 1pt + \textleading = 13.2pt + % + % Double-side printing via postscript on Laserjet 4050 + % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm. + % To change the settings for a different printer or situation, adjust + % \normaloffset until the front-side and back-side texts align. Then + % do the same for \bindingoffset. You can set these for testing in + % your texinfo source file like this: + % @tex + % \global\normaloffset = -6mm + % \global\bindingoffset = 10mm + % @end tex + \internalpagesizes{673.2pt}{160mm}% that's 51 lines + {\voffset}{\hoffset}% + {\bindingoffset}{44pt}% + {297mm}{210mm}% + % + \tolerance = 700 + \hfuzz = 1pt + \contentsrightmargin = 0pt + \defbodyindent = 5mm +}} + +% Use @afivepaper to print on European A5 paper. +% From romildo@urano.iceb.ufop.br, 2 July 2000. +% He also recommends making @example and @lisp be small. +\def\afivepaper{{\globaldefs = 1 + \parskip = 2pt plus 1pt minus 0.1pt + \textleading = 12.5pt + % + \internalpagesizes{160mm}{120mm}% + {\voffset}{\hoffset}% + {\bindingoffset}{8pt}% + {210mm}{148mm}% + % + \lispnarrowing = 0.2in + \tolerance = 800 + \hfuzz = 1.2pt + \contentsrightmargin = 0pt + \defbodyindent = 2mm + \tableindent = 12mm +}} + +% A specific text layout, 24x15cm overall, intended for A4 paper. +\def\afourlatex{{\globaldefs = 1 + \afourpaper + \internalpagesizes{237mm}{150mm}% + {\voffset}{4.6mm}% + {\bindingoffset}{7mm}% + {297mm}{210mm}% + % + % Must explicitly reset to 0 because we call \afourpaper. + \globaldefs = 0 +}} + +% Use @afourwide to print on A4 paper in landscape format. +\def\afourwide{{\globaldefs = 1 + \afourpaper + \internalpagesizes{241mm}{165mm}% + {\voffset}{-2.95mm}% + {\bindingoffset}{7mm}% + {297mm}{210mm}% + \globaldefs = 0 +}} + +% @pagesizes TEXTHEIGHT[,TEXTWIDTH] +% Perhaps we should allow setting the margins, \topskip, \parskip, +% and/or leading, also. Or perhaps we should compute them somehow. +% +\parseargdef\pagesizes{\pagesizesyyy #1,,\finish} +\def\pagesizesyyy#1,#2,#3\finish{{% + \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi + \globaldefs = 1 + % + \parskip = 3pt plus 2pt minus 1pt + \setleading{\textleading}% + % + \dimen0 = #1\relax + \advance\dimen0 by \voffset + % + \dimen2 = \hsize + \advance\dimen2 by \normaloffset + % + \internalpagesizes{#1}{\hsize}% + {\voffset}{\normaloffset}% + {\bindingoffset}{44pt}% + {\dimen0}{\dimen2}% +}} + +% Set default to letter. +% +\letterpaper + + +\message{and turning on texinfo input format.} + +% Define macros to output various characters with catcode for normal text. +\catcode`\"=\other +\catcode`\~=\other +\catcode`\^=\other +\catcode`\_=\other +\catcode`\|=\other +\catcode`\<=\other +\catcode`\>=\other +\catcode`\+=\other +\catcode`\$=\other +\def\normaldoublequote{"} +\def\normaltilde{~} +\def\normalcaret{^} +\def\normalunderscore{_} +\def\normalverticalbar{|} +\def\normalless{<} +\def\normalgreater{>} +\def\normalplus{+} +\def\normaldollar{$}%$ font-lock fix + +% This macro is used to make a character print one way in \tt +% (where it can probably be output as-is), and another way in other fonts, +% where something hairier probably needs to be done. +% +% #1 is what to print if we are indeed using \tt; #2 is what to print +% otherwise. Since all the Computer Modern typewriter fonts have zero +% interword stretch (and shrink), and it is reasonable to expect all +% typewriter fonts to have this, we can check that font parameter. +% +\def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi} + +% Same as above, but check for italic font. Actually this also catches +% non-italic slanted fonts since it is impossible to distinguish them from +% italic fonts. But since this is only used by $ and it uses \sl anyway +% this is not a problem. +\def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi} + +% Turn off all special characters except @ +% (and those which the user can use as if they were ordinary). +% Most of these we simply print from the \tt font, but for some, we can +% use math or other variants that look better in normal text. + +\catcode`\"=\active +\def\activedoublequote{{\tt\char34}} +\let"=\activedoublequote +\catcode`\~=\active +\def~{{\tt\char126}} +\chardef\hat=`\^ +\catcode`\^=\active +\def^{{\tt \hat}} + +\catcode`\_=\active +\def_{\ifusingtt\normalunderscore\_} +\let\realunder=_ +% Subroutine for the previous macro. +\def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em } + +\catcode`\|=\active +\def|{{\tt\char124}} +\chardef \less=`\< +\catcode`\<=\active +\def<{{\tt \less}} +\chardef \gtr=`\> +\catcode`\>=\active +\def>{{\tt \gtr}} +\catcode`\+=\active +\def+{{\tt \char 43}} +\catcode`\$=\active +\def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix + +% If a .fmt file is being used, characters that might appear in a file +% name cannot be active until we have parsed the command line. +% So turn them off again, and have \everyjob (or @setfilename) turn them on. +% \otherifyactive is called near the end of this file. +\def\otherifyactive{\catcode`+=\other \catcode`\_=\other} + +% Used sometimes to turn off (effectively) the active characters even after +% parsing them. +\def\turnoffactive{% + \normalturnoffactive + \otherbackslash +} + +\catcode`\@=0 + +% \backslashcurfont outputs one backslash character in current font, +% as in \char`\\. +\global\chardef\backslashcurfont=`\\ +\global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work + +% \realbackslash is an actual character `\' with catcode other, and +% \doublebackslash is two of them (for the pdf outlines). +{\catcode`\\=\other @gdef@realbackslash{\} @gdef@doublebackslash{\\}} + +% In texinfo, backslash is an active character; it prints the backslash +% in fixed width font. +\catcode`\\=\active +@def@normalbackslash{{@tt@backslashcurfont}} +% On startup, @fixbackslash assigns: +% @let \ = @normalbackslash + +% \rawbackslash defines an active \ to do \backslashcurfont. +% \otherbackslash defines an active \ to be a literal `\' character with +% catcode other. +@gdef@rawbackslash{@let\=@backslashcurfont} +@gdef@otherbackslash{@let\=@realbackslash} + +% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of +% the literal character `\'. +% +@def@normalturnoffactive{% + @let\=@normalbackslash + @let"=@normaldoublequote + @let~=@normaltilde + @let^=@normalcaret + @let_=@normalunderscore + @let|=@normalverticalbar + @let<=@normalless + @let>=@normalgreater + @let+=@normalplus + @let$=@normaldollar %$ font-lock fix + @unsepspaces +} + +% Make _ and + \other characters, temporarily. +% This is canceled by @fixbackslash. +@otherifyactive + +% If a .fmt file is being used, we don't want the `\input texinfo' to show up. +% That is what \eatinput is for; after that, the `\' should revert to printing +% a backslash. +% +@gdef@eatinput input texinfo{@fixbackslash} +@global@let\ = @eatinput + +% On the other hand, perhaps the file did not have a `\input texinfo'. Then +% the first `\' in the file would cause an error. This macro tries to fix +% that, assuming it is called before the first `\' could plausibly occur. +% Also turn back on active characters that might appear in the input +% file name, in case not using a pre-dumped format. +% +@gdef@fixbackslash{% + @ifx\@eatinput @let\ = @normalbackslash @fi + @catcode`+=@active + @catcode`@_=@active +} + +% Say @foo, not \foo, in error messages. +@escapechar = `@@ + +% These look ok in all fonts, so just make them not special. +@catcode`@& = @other +@catcode`@# = @other +@catcode`@% = @other + + +@c Local variables: +@c eval: (add-hook 'write-file-hooks 'time-stamp) +@c page-delimiter: "^\\\\message" +@c time-stamp-start: "def\\\\texinfoversion{" +@c time-stamp-format: "%:y-%02m-%02d.%02H" +@c time-stamp-end: "}" +@c End: + +@c vim:sw=2: + +@ignore + arch-tag: e1b36e32-c96e-4135-a41a-0b2efa2ea115 +@end ignore diff -ruNp m4-1.4.10/cfg.mk m4-1.4.11/cfg.mk --- m4-1.4.10/cfg.mk 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/cfg.mk 2008-04-02 05:55:15.000000000 -0600 @@ -0,0 +1,38 @@ +# Customize maint.mk. -*- makefile -*- +# Copyright (C) 2003-2008 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/>. + +# Use alpha.gnu.org for alpha and beta releases. +# Use ftp.gnu.org for major releases. +gnu_ftp_host-alpha = alpha.gnu.org +gnu_ftp_host-beta = alpha.gnu.org +gnu_ftp_host-major = ftp.gnu.org +gnu_rel_host = $(gnu_ftp_host-$(RELEASE_TYPE)) + +url_dir_list = \ + ftp://$(gnu_rel_host)/gnu/m4 + +# The GnuPG ID of the key used to sign the tarballs. +gpg_key_ID = F4850180 + +# Tests not to run as part of "make distcheck". +# Exclude changelog-check here so that there's less churn in ChangeLog +# files -- otherwise, you'd need to have the upcoming version number +# at the top of the file for each `make distcheck' run. +local-checks-to-skip = changelog-check + +# The local directory containing the checked-out copy of gnulib used in this +# release. Used solely to get gnulib's SHA1 for the "announcement" target. +gnulib_dir = $(srcdir)/../gnulib diff -ruNp m4-1.4.10/checks/001.preprocess m4-1.4.11/checks/001.preprocess --- m4-1.4.10/checks/001.preprocess 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/001.preprocess 2008-03-29 20:51:21.000000000 -0600 @@ -1,4 +1,4 @@ -dnl @ ../doc/m4.texinfo:684: Origin of test +dnl @ ../doc/m4.texinfo:690: Origin of test dnl @ expected status: 0 dnl @ extra options: -s dnl @ Copyright (C) 2006, 2007 Free Software Foundation diff -ruNp m4-1.4.10/checks/002.command_li m4-1.4.11/checks/002.command_li --- m4-1.4.10/checks/002.command_li 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/002.command_li 2008-03-29 20:51:21.000000000 -0600 @@ -1,4 +1,4 @@ -dnl @ ../doc/m4.texinfo:888: Origin of test +dnl @ ../doc/m4.texinfo:894: Origin of test dnl @ expected status: 0 dnl @ extra options: -Dbar=hello foo -Dbar=world foo dnl @ Copyright (C) 2006, 2007 Free Software Foundation diff -ruNp m4-1.4.10/checks/003.comments m4-1.4.11/checks/003.comments --- m4-1.4.10/checks/003.comments 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/003.comments 2008-03-29 20:51:21.000000000 -0600 @@ -1,4 +1,4 @@ -dnl @ ../doc/m4.texinfo:983: Origin of test +dnl @ ../doc/m4.texinfo:989: Origin of test dnl @ expected status: 0 dnl @ extra options: dnl @ Copyright (C) 2006, 2007 Free Software Foundation diff -ruNp m4-1.4.10/checks/004.input_proc m4-1.4.11/checks/004.input_proc --- m4-1.4.10/checks/004.input_proc 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/004.input_proc 2008-03-29 20:51:21.000000000 -0600 @@ -1,4 +1,4 @@ -dnl @ ../doc/m4.texinfo:1069: Origin of test +dnl @ ../doc/m4.texinfo:1075: Origin of test dnl @ expected status: 0 dnl @ extra options: dnl @ Copyright (C) 2006, 2007 Free Software Foundation diff -ruNp m4-1.4.10/checks/005.input_proc m4-1.4.11/checks/005.input_proc --- m4-1.4.10/checks/005.input_proc 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/005.input_proc 2008-03-29 20:51:21.000000000 -0600 @@ -1,4 +1,4 @@ -dnl @ ../doc/m4.texinfo:1145: Origin of test +dnl @ ../doc/m4.texinfo:1151: Origin of test dnl @ expected status: 0 dnl @ extra options: dnl @ Copyright (C) 2006, 2007 Free Software Foundation diff -ruNp m4-1.4.10/checks/006.inhibiting m4-1.4.11/checks/006.inhibiting --- m4-1.4.10/checks/006.inhibiting 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/006.inhibiting 2008-03-29 20:51:21.000000000 -0600 @@ -1,4 +1,4 @@ -dnl @ ../doc/m4.texinfo:1270: Origin of test +dnl @ ../doc/m4.texinfo:1276: Origin of test dnl @ expected status: 0 dnl @ extra options: dnl @ Copyright (C) 2006, 2007 Free Software Foundation diff -ruNp m4-1.4.10/checks/007.inhibiting m4-1.4.11/checks/007.inhibiting --- m4-1.4.10/checks/007.inhibiting 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/007.inhibiting 2008-03-29 20:51:21.000000000 -0600 @@ -1,4 +1,4 @@ -dnl @ ../doc/m4.texinfo:1286: Origin of test +dnl @ ../doc/m4.texinfo:1292: Origin of test dnl @ expected status: 0 dnl @ extra options: -P dnl @ Copyright (C) 2006, 2007 Free Software Foundation diff -ruNp m4-1.4.10/checks/008.inhibiting m4-1.4.11/checks/008.inhibiting --- m4-1.4.10/checks/008.inhibiting 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/008.inhibiting 2008-03-29 20:51:21.000000000 -0600 @@ -1,4 +1,4 @@ -dnl @ ../doc/m4.texinfo:1317: Origin of test +dnl @ ../doc/m4.texinfo:1323: Origin of test dnl @ expected status: 0 dnl @ extra options: dnl @ Copyright (C) 2006, 2007 Free Software Foundation diff -ruNp m4-1.4.10/checks/009.inhibiting m4-1.4.11/checks/009.inhibiting --- m4-1.4.10/checks/009.inhibiting 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/009.inhibiting 2008-03-29 20:51:21.000000000 -0600 @@ -1,4 +1,4 @@ -dnl @ ../doc/m4.texinfo:1331: Origin of test +dnl @ ../doc/m4.texinfo:1337: Origin of test dnl @ expected status: 0 dnl @ extra options: dnl @ Copyright (C) 2006, 2007 Free Software Foundation diff -ruNp m4-1.4.10/checks/010.inhibiting m4-1.4.11/checks/010.inhibiting --- m4-1.4.10/checks/010.inhibiting 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/010.inhibiting 2008-03-29 20:51:21.000000000 -0600 @@ -1,4 +1,4 @@ -dnl @ ../doc/m4.texinfo:1347: Origin of test +dnl @ ../doc/m4.texinfo:1354: Origin of test dnl @ expected status: 0 dnl @ extra options: dnl @ Copyright (C) 2006, 2007 Free Software Foundation @@ -6,9 +6,11 @@ dnl @ This file is free software; the Fr dnl @ gives unlimited permission to copy and/or distribute it dnl @ with or without modifications, as long as this notice dnl @ is preserved. +define(`cde', `CDE') +dnl @result{} define(`x', `substr(ab') dnl @result{} -define(`y', `cde, `3', `2')') +define(`y', `cde, `1', `3')') dnl @result{} x`'y -dnl @result{}de +dnl @result{}bCD diff -ruNp m4-1.4.10/checks/011.inhibiting m4-1.4.11/checks/011.inhibiting --- m4-1.4.10/checks/011.inhibiting 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/011.inhibiting 2008-03-29 20:51:21.000000000 -0600 @@ -1,4 +1,4 @@ -dnl @ ../doc/m4.texinfo:1360: Origin of test +dnl @ ../doc/m4.texinfo:1368: Origin of test dnl @ expected status: 0 dnl @ extra options: dnl @ Copyright (C) 2006, 2007 Free Software Foundation @@ -6,9 +6,9 @@ dnl @ This file is free software; the Fr dnl @ gives unlimited permission to copy and/or distribute it dnl @ with or without modifications, as long as this notice dnl @ is preserved. -define(`macro', `m') +define(`x1', `len(`$1'') dnl @result{} -macro(`m')macro -dnl @result{}mmacro -macro(`m')`'macro -dnl @result{}mm +define(`y1', ``$1')') +dnl @result{} +x1(`01234567890123456789')y1(`98765432109876543210') +dnl @result{}40 diff -ruNp m4-1.4.10/checks/012.inhibiting m4-1.4.11/checks/012.inhibiting --- m4-1.4.10/checks/012.inhibiting 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/012.inhibiting 2008-03-29 20:51:21.000000000 -0600 @@ -1,4 +1,4 @@ -dnl @ ../doc/m4.texinfo:1372: Origin of test +dnl @ ../doc/m4.texinfo:1382: Origin of test dnl @ expected status: 0 dnl @ extra options: dnl @ Copyright (C) 2006, 2007 Free Software Foundation @@ -6,9 +6,9 @@ dnl @ This file is free software; the Fr dnl @ gives unlimited permission to copy and/or distribute it dnl @ with or without modifications, as long as this notice dnl @ is preserved. -define(`macro', `di$1') -dnl @result{} -macro(`v')`ert' -dnl @result{}divert -macro(`v')ert +define(`macro', `m') dnl @result{} +macro(`m')macro +dnl @result{}mmacro +macro(`m')`'macro +dnl @result{}mm diff -ruNp m4-1.4.10/checks/013.inhibiting m4-1.4.11/checks/013.inhibiting --- m4-1.4.10/checks/013.inhibiting 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/013.inhibiting 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:1394: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`macro', `di$1') +dnl @result{} +macro(`v')`ert' +dnl @result{}divert +macro(`v')ert +dnl @result{} diff -ruNp m4-1.4.10/checks/013.macro_argu m4-1.4.11/checks/013.macro_argu --- m4-1.4.10/checks/013.macro_argu 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/013.macro_argu 1969-12-31 17:00:00.000000000 -0700 @@ -1,25 +0,0 @@ -dnl @ ../doc/m4.texinfo:1404: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`macro', `$1') -dnl @result{} -macro( unquoted leading space lost) -dnl @result{}unquoted leading space lost -macro(` quoted leading space kept') -dnl @result{} quoted leading space kept -macro( - divert `unquoted space kept after expansion') -dnl @result{} unquoted space kept after expansion -macro(macro(` -')`whitespace from expansion kept') -dnl @result{} -dnl @result{}whitespace from expansion kept -macro(`unquoted trailing whitespace kept' -) -dnl @result{}unquoted trailing whitespace kept -dnl @result{} diff -ruNp m4-1.4.10/checks/014.macro_argu m4-1.4.11/checks/014.macro_argu --- m4-1.4.10/checks/014.macro_argu 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/014.macro_argu 2008-03-29 20:51:21.000000000 -0600 @@ -1,4 +1,4 @@ -dnl @ ../doc/m4.texinfo:1432: Origin of test +dnl @ ../doc/m4.texinfo:1426: Origin of test dnl @ expected status: 0 dnl @ extra options: dnl @ Copyright (C) 2006, 2007 Free Software Foundation @@ -6,11 +6,20 @@ dnl @ This file is free software; the Fr dnl @ gives unlimited permission to copy and/or distribute it dnl @ with or without modifications, as long as this notice dnl @ is preserved. -index(`abc') -dnl @error{}m4:stdin:1: Warning: too few arguments to builtin `index' -dnl @result{}0 -index(`abc',) -dnl @result{}0 -index(`abc', `b', `ignored') -dnl @error{}m4:stdin:3: Warning: excess arguments to builtin `index' ignored -dnl @result{}1 +define(`macro', `$1') +dnl @result{} +macro( unquoted leading space lost) +dnl @result{}unquoted leading space lost +macro(` quoted leading space kept') +dnl @result{} quoted leading space kept +macro( + divert `unquoted space kept after expansion') +dnl @result{} unquoted space kept after expansion +macro(macro(` +')`whitespace from expansion kept') +dnl @result{} +dnl @result{}whitespace from expansion kept +macro(`unquoted trailing whitespace kept' +) +dnl @result{}unquoted trailing whitespace kept +dnl @result{} diff -ruNp m4-1.4.10/checks/015.macro_argu m4-1.4.11/checks/015.macro_argu --- m4-1.4.10/checks/015.macro_argu 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/015.macro_argu 2008-03-29 20:51:21.000000000 -0600 @@ -1,14 +1,16 @@ -dnl @ ../doc/m4.texinfo:1445: Origin of test +dnl @ ../doc/m4.texinfo:1454: Origin of test dnl @ expected status: 0 -dnl @ extra options: -Q +dnl @ extra options: dnl @ Copyright (C) 2006, 2007 Free Software Foundation dnl @ This file is free software; the Free Software Foundation dnl @ gives unlimited permission to copy and/or distribute it dnl @ with or without modifications, as long as this notice dnl @ is preserved. index(`abc') +dnl @error{}m4:stdin:1: Warning: too few arguments to builtin `index' dnl @result{}0 index(`abc',) dnl @result{}0 index(`abc', `b', `ignored') +dnl @error{}m4:stdin:3: Warning: excess arguments to builtin `index' ignored dnl @result{}1 diff -ruNp m4-1.4.10/checks/016.macro_argu m4-1.4.11/checks/016.macro_argu --- m4-1.4.10/checks/016.macro_argu 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/016.macro_argu 2008-03-29 20:51:21.000000000 -0600 @@ -1,14 +1,14 @@ -dnl @ ../doc/m4.texinfo:1475: Origin of test +dnl @ ../doc/m4.texinfo:1467: Origin of test dnl @ expected status: 0 -dnl @ extra options: +dnl @ extra options: -Q dnl @ Copyright (C) 2006, 2007 Free Software Foundation dnl @ This file is free software; the Free Software Foundation dnl @ gives unlimited permission to copy and/or distribute it dnl @ with or without modifications, as long as this notice dnl @ is preserved. -define(`f', `1') -dnl @result{} -f(define(`f', `2')) +index(`abc') +dnl @result{}0 +index(`abc',) +dnl @result{}0 +index(`abc', `b', `ignored') dnl @result{}1 -f -dnl @result{}2 diff -ruNp m4-1.4.10/checks/017.macro_argu m4-1.4.11/checks/017.macro_argu --- m4-1.4.10/checks/017.macro_argu 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/017.macro_argu 2008-03-29 20:51:21.000000000 -0600 @@ -1,12 +1,14 @@ -dnl @ ../doc/m4.texinfo:1487: Origin of test -dnl @ expected status: 1 +dnl @ ../doc/m4.texinfo:1497: Origin of test +dnl @ expected status: 0 dnl @ extra options: dnl @ Copyright (C) 2006, 2007 Free Software Foundation dnl @ This file is free software; the Free Software Foundation dnl @ gives unlimited permission to copy and/or distribute it dnl @ with or without modifications, as long as this notice dnl @ is preserved. -hello world -dnl @result{}hello world -define( -dnl @error{}m4:stdin:2: ERROR: end of file in argument list +define(`f', `1') +dnl @result{} +f(define(`f', `2')) +dnl @result{}1 +f +dnl @result{}2 diff -ruNp m4-1.4.10/checks/018.macro_argu m4-1.4.11/checks/018.macro_argu --- m4-1.4.10/checks/018.macro_argu 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/018.macro_argu 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:1509: Origin of test +dnl @ expected status: 1 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +hello world +dnl @result{}hello world +define( +dnl @error{}m4:stdin:2: ERROR: end of file in argument list diff -ruNp m4-1.4.10/checks/018.quoting_ar m4-1.4.11/checks/018.quoting_ar --- m4-1.4.10/checks/018.quoting_ar 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/018.quoting_ar 1969-12-31 17:00:00.000000000 -0700 @@ -1,18 +0,0 @@ -dnl @ ../doc/m4.texinfo:1546: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`active', `ACT, IVE') -dnl @result{} -define(`show', `$1 $1') -dnl @result{} -show(active) -dnl @result{}ACT ACT -show(`active') -dnl @result{}ACT, IVE ACT, IVE -show(``active'') -dnl @result{}active active diff -ruNp m4-1.4.10/checks/019.macro_expa m4-1.4.11/checks/019.macro_expa --- m4-1.4.10/checks/019.macro_expa 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/019.macro_expa 1969-12-31 17:00:00.000000000 -0700 @@ -1,10 +0,0 @@ -dnl @ ../doc/m4.texinfo:1574: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -Dbar=Hello -Dfoo=bar -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -foo -dnl @result{}Hello diff -ruNp m4-1.4.10/checks/019.quoting_ar m4-1.4.11/checks/019.quoting_ar --- m4-1.4.10/checks/019.quoting_ar 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/019.quoting_ar 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:1568: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`active', `ACT, IVE') +dnl @result{} +define(`show', `$1 $1') +dnl @result{} +show(active) +dnl @result{}ACT ACT +show(`active') +dnl @result{}ACT, IVE ACT, IVE +show(``active'') +dnl @result{}active active diff -ruNp m4-1.4.10/checks/020.define m4-1.4.11/checks/020.define --- m4-1.4.10/checks/020.define 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/020.define 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -dnl @ ../doc/m4.texinfo:1622: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`foo', `Hello world.') -dnl @result{} -foo -dnl @result{}Hello world. diff -ruNp m4-1.4.10/checks/020.macro_expa m4-1.4.11/checks/020.macro_expa --- m4-1.4.10/checks/020.macro_expa 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/020.macro_expa 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,10 @@ +dnl @ ../doc/m4.texinfo:1596: Origin of test +dnl @ expected status: 0 +dnl @ extra options: -Dbar=Hello -Dfoo=bar +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +foo +dnl @result{}Hello diff -ruNp m4-1.4.10/checks/021.define m4-1.4.11/checks/021.define --- m4-1.4.10/checks/021.define 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/021.define 1969-12-31 17:00:00.000000000 -0700 @@ -1,14 +0,0 @@ -dnl @ ../doc/m4.texinfo:1639: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(foo, one) -dnl @result{} -define(foo, two) -dnl @result{} -one -dnl @result{}two diff -ruNp m4-1.4.10/checks/021.macro_expa m4-1.4.11/checks/021.macro_expa --- m4-1.4.10/checks/021.macro_expa 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/021.macro_expa 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:1611: Origin of test +dnl @ expected status: 0 +dnl @ extra options: -Dfoo -Decho=$@ +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +foo +dnl @result{} +foo(`silently ignored') +dnl @result{} +echo(`1', `2') +dnl @result{}1,2 diff -ruNp m4-1.4.10/checks/022.define m4-1.4.11/checks/022.define --- m4-1.4.10/checks/022.define 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/022.define 2008-03-29 20:51:21.000000000 -0600 @@ -1,4 +1,4 @@ -dnl @ ../doc/m4.texinfo:1673: Origin of test +dnl @ ../doc/m4.texinfo:1660: Origin of test dnl @ expected status: 0 dnl @ extra options: dnl @ Copyright (C) 2006, 2007 Free Software Foundation @@ -6,15 +6,7 @@ dnl @ This file is free software; the Fr dnl @ gives unlimited permission to copy and/or distribute it dnl @ with or without modifications, as long as this notice dnl @ is preserved. -define(`array', `defn(format(``array[%d]'', `$1'))') +define(`foo', `Hello world.') dnl @result{} -define(`array_set', `define(format(``array[%d]'', `$1'), `$2')') -dnl @result{} -array_set(`4', `array element no. 4') -dnl @result{} -array_set(`17', `array element no. 17') -dnl @result{} -array(`4') -dnl @result{}array element no. 4 -array(eval(`10 + 7')) -dnl @result{}array element no. 17 +foo +dnl @result{}Hello world. diff -ruNp m4-1.4.10/checks/023.arguments m4-1.4.11/checks/023.arguments --- m4-1.4.10/checks/023.arguments 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/023.arguments 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -dnl @ ../doc/m4.texinfo:1707: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`exch', `$2, $1') -dnl @result{} -exch(`arg1', `arg2') -dnl @result{}arg2, arg1 diff -ruNp m4-1.4.10/checks/023.define m4-1.4.11/checks/023.define --- m4-1.4.10/checks/023.define 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/023.define 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:1677: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(foo, one) +dnl @result{} +define(foo, two) +dnl @result{} +one +dnl @result{}two diff -ruNp m4-1.4.10/checks/024.arguments m4-1.4.11/checks/024.arguments --- m4-1.4.10/checks/024.arguments 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/024.arguments 1969-12-31 17:00:00.000000000 -0700 @@ -1,14 +0,0 @@ -dnl @ ../doc/m4.texinfo:1717: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`exch', `$2, $1') -dnl @result{} -define(exch(``expansion text'', ``macro'')) -dnl @result{} -macro -dnl @result{}expansion text diff -ruNp m4-1.4.10/checks/024.define m4-1.4.11/checks/024.define --- m4-1.4.10/checks/024.define 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/024.define 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,20 @@ +dnl @ ../doc/m4.texinfo:1711: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`array', `defn(format(``array[%d]'', `$1'))') +dnl @result{} +define(`array_set', `define(format(``array[%d]'', `$1'), `$2')') +dnl @result{} +array_set(`4', `array element no. 4') +dnl @result{} +array_set(`17', `array element no. 17') +dnl @result{} +array(`4') +dnl @result{}array element no. 4 +array(eval(`10 + 7')) +dnl @result{}array element no. 17 diff -ruNp m4-1.4.10/checks/025.arguments m4-1.4.11/checks/025.arguments --- m4-1.4.10/checks/025.arguments 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/025.arguments 2008-03-29 20:51:21.000000000 -0600 @@ -1,4 +1,4 @@ -dnl @ ../doc/m4.texinfo:1733: Origin of test +dnl @ ../doc/m4.texinfo:1745: Origin of test dnl @ expected status: 0 dnl @ extra options: dnl @ Copyright (C) 2006, 2007 Free Software Foundation @@ -6,7 +6,7 @@ dnl @ This file is free software; the Fr dnl @ gives unlimited permission to copy and/or distribute it dnl @ with or without modifications, as long as this notice dnl @ is preserved. -define(`test', ``Macro name: $0'') +define(`exch', `$2, $1') dnl @result{} -test -dnl @result{}Macro name: test +exch(`arg1', `arg2') +dnl @result{}arg2, arg1 diff -ruNp m4-1.4.10/checks/026.arguments m4-1.4.11/checks/026.arguments --- m4-1.4.10/checks/026.arguments 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/026.arguments 2008-03-29 20:51:21.000000000 -0600 @@ -1,4 +1,4 @@ -dnl @ ../doc/m4.texinfo:1743: Origin of test +dnl @ ../doc/m4.texinfo:1755: Origin of test dnl @ expected status: 0 dnl @ extra options: dnl @ Copyright (C) 2006, 2007 Free Software Foundation @@ -6,7 +6,9 @@ dnl @ This file is free software; the Fr dnl @ gives unlimited permission to copy and/or distribute it dnl @ with or without modifications, as long as this notice dnl @ is preserved. -define(`foo', `This is macro `foo'.') +define(`exch', `$2, $1') dnl @result{} -foo -dnl @result{}This is macro foo. +define(exch(``expansion text'', ``macro'')) +dnl @result{} +macro +dnl @result{}expansion text diff -ruNp m4-1.4.10/checks/027.arguments m4-1.4.11/checks/027.arguments --- m4-1.4.10/checks/027.arguments 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/027.arguments 2008-03-29 20:51:21.000000000 -0600 @@ -1,4 +1,4 @@ -dnl @ ../doc/m4.texinfo:1778: Origin of test +dnl @ ../doc/m4.texinfo:1771: Origin of test dnl @ expected status: 0 dnl @ extra options: dnl @ Copyright (C) 2006, 2007 Free Software Foundation @@ -6,11 +6,7 @@ dnl @ This file is free software; the Fr dnl @ gives unlimited permission to copy and/or distribute it dnl @ with or without modifications, as long as this notice dnl @ is preserved. -define(`foo', `single quoted $`'{1} output') +define(`test', ``Macro name: $0'') dnl @result{} -define(`bar', ``double quoted $'`{2} output'') -dnl @result{} -foo(`a', `b') -dnl @result{}single quoted ${1} output -bar(`a', `b') -dnl @result{}double quoted ${2} output +test +dnl @result{}Macro name: test diff -ruNp m4-1.4.10/checks/028.arguments m4-1.4.11/checks/028.arguments --- m4-1.4.10/checks/028.arguments 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/028.arguments 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:1781: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `This is macro `foo'.') +dnl @result{} +foo +dnl @result{}This is macro foo. diff -ruNp m4-1.4.10/checks/028.pseudo_arg m4-1.4.11/checks/028.pseudo_arg --- m4-1.4.10/checks/028.pseudo_arg 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/028.pseudo_arg 1969-12-31 17:00:00.000000000 -0700 @@ -1,23 +0,0 @@ -dnl @ ../doc/m4.texinfo:1826: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`nargs', `$#') -dnl @result{} -nargs -dnl @result{}0 -nargs() -dnl @result{}1 -nargs(`arg1', `arg2', `arg3') -dnl @result{}3 -nargs(`commas can be quoted, like this') -dnl @result{}1 -nargs(arg1#inside comments, commas do not separate arguments -still arg1) -dnl @result{}1 -nargs((unquoted parentheses, like this, group arguments)) -dnl @result{}1 diff -ruNp m4-1.4.10/checks/029.arguments m4-1.4.11/checks/029.arguments --- m4-1.4.10/checks/029.arguments 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/029.arguments 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:1816: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `single quoted $`'{1} output') +dnl @result{} +define(`bar', ``double quoted $'`{2} output'') +dnl @result{} +foo(`a', `b') +dnl @result{}single quoted ${1} output +bar(`a', `b') +dnl @result{}double quoted ${2} output diff -ruNp m4-1.4.10/checks/029.pseudo_arg m4-1.4.11/checks/029.pseudo_arg --- m4-1.4.10/checks/029.pseudo_arg 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/029.pseudo_arg 1969-12-31 17:00:00.000000000 -0700 @@ -1,15 +0,0 @@ -dnl @ ../doc/m4.texinfo:1848: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -dnl Attempt to define a macro to just `$#' -define(underquoted, $#) -oops) -dnl @result{} -underquoted -dnl @result{}0) -dnl @result{}oops diff -ruNp m4-1.4.10/checks/030.arguments m4-1.4.11/checks/030.arguments --- m4-1.4.10/checks/030.arguments 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/030.arguments 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:1838: Origin of test +dnl @ expected status: 0 +dnl @ extra options: --warn-macro-sequence +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `$001 ${1} $1') +dnl @error{}m4:stdin:1: Warning: definition of `foo' contains sequence `$001' +dnl @error{}m4:stdin:1: Warning: definition of `foo' contains sequence `${1}' +dnl @result{} +foo(`bar') +dnl @result{}bar ${1} bar diff -ruNp m4-1.4.10/checks/030.pseudo_arg m4-1.4.11/checks/030.pseudo_arg --- m4-1.4.10/checks/030.pseudo_arg 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/030.pseudo_arg 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -dnl @ ../doc/m4.texinfo:1861: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`echo', `$*') -dnl @result{} -echo(arg1, arg2, arg3 , arg4) -dnl @result{}arg1,arg2,arg3 ,arg4 diff -ruNp m4-1.4.10/checks/031.pseudo_arg m4-1.4.11/checks/031.pseudo_arg --- m4-1.4.10/checks/031.pseudo_arg 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/031.pseudo_arg 2008-03-29 20:51:21.000000000 -0600 @@ -1,4 +1,4 @@ -dnl @ ../doc/m4.texinfo:1872: Origin of test +dnl @ ../doc/m4.texinfo:1864: Origin of test dnl @ expected status: 0 dnl @ extra options: dnl @ Copyright (C) 2006, 2007 Free Software Foundation @@ -6,7 +6,18 @@ dnl @ This file is free software; the Fr dnl @ gives unlimited permission to copy and/or distribute it dnl @ with or without modifications, as long as this notice dnl @ is preserved. -define(`echo', `$@') +define(`nargs', `$#') dnl @result{} -echo(arg1, arg2, arg3 , arg4) -dnl @result{}arg1,arg2,arg3 ,arg4 +nargs +dnl @result{}0 +nargs() +dnl @result{}1 +nargs(`arg1', `arg2', `arg3') +dnl @result{}3 +nargs(`commas can be quoted, like this') +dnl @result{}1 +nargs(arg1#inside comments, commas do not separate arguments +still arg1) +dnl @result{}1 +nargs((unquoted parentheses, like this, group arguments)) +dnl @result{}1 diff -ruNp m4-1.4.10/checks/032.pseudo_arg m4-1.4.11/checks/032.pseudo_arg --- m4-1.4.10/checks/032.pseudo_arg 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/032.pseudo_arg 2008-03-29 20:51:21.000000000 -0600 @@ -1,4 +1,4 @@ -dnl @ ../doc/m4.texinfo:1882: Origin of test +dnl @ ../doc/m4.texinfo:1886: Origin of test dnl @ expected status: 0 dnl @ extra options: dnl @ Copyright (C) 2006, 2007 Free Software Foundation @@ -6,17 +6,10 @@ dnl @ This file is free software; the Fr dnl @ gives unlimited permission to copy and/or distribute it dnl @ with or without modifications, as long as this notice dnl @ is preserved. -define(`echo1', `$*') +dnl Attempt to define a macro to just `$#' +define(underquoted, $#) +oops) dnl @result{} -define(`echo2', `$@') -dnl @result{} -define(`foo', `This is macro `foo'.') -dnl @result{} -echo1(foo) -dnl @result{}This is macro This is macro foo.. -echo1(`foo') -dnl @result{}This is macro foo. -echo2(foo) -dnl @result{}This is macro foo. -echo2(`foo') -dnl @result{}foo +underquoted +dnl @result{}0) +dnl @result{}oops diff -ruNp m4-1.4.10/checks/033.pseudo_arg m4-1.4.11/checks/033.pseudo_arg --- m4-1.4.10/checks/033.pseudo_arg 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/033.pseudo_arg 2008-03-29 20:51:21.000000000 -0600 @@ -1,4 +1,4 @@ -dnl @ ../doc/m4.texinfo:1904: Origin of test +dnl @ ../doc/m4.texinfo:1899: Origin of test dnl @ expected status: 0 dnl @ extra options: dnl @ Copyright (C) 2006, 2007 Free Software Foundation @@ -6,17 +6,7 @@ dnl @ This file is free software; the Fr dnl @ gives unlimited permission to copy and/or distribute it dnl @ with or without modifications, as long as this notice dnl @ is preserved. -define(`echo1', `$*') +define(`echo', `$*') dnl @result{} -define(`echo2', `$@') -dnl @result{} -define(`foo', `bar') -dnl @result{} -echo1(#foo'foo -foo) -dnl @result{}#foo'foo -dnl @result{}bar -echo2(#foo'foo -foo) -dnl @result{}#foobar -dnl @result{}bar' +echo(arg1, arg2, arg3 , arg4) +dnl @result{}arg1,arg2,arg3 ,arg4 diff -ruNp m4-1.4.10/checks/034.pseudo_arg m4-1.4.11/checks/034.pseudo_arg --- m4-1.4.10/checks/034.pseudo_arg 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/034.pseudo_arg 2008-03-29 20:51:21.000000000 -0600 @@ -1,4 +1,4 @@ -dnl @ ../doc/m4.texinfo:1925: Origin of test +dnl @ ../doc/m4.texinfo:1910: Origin of test dnl @ expected status: 0 dnl @ extra options: dnl @ Copyright (C) 2006, 2007 Free Software Foundation @@ -6,7 +6,7 @@ dnl @ This file is free software; the Fr dnl @ gives unlimited permission to copy and/or distribute it dnl @ with or without modifications, as long as this notice dnl @ is preserved. -define(`foo', `$$$ hello $$$') +define(`echo', `$@') dnl @result{} -foo -dnl @result{}$$$ hello $$$ +echo(arg1, arg2, arg3 , arg4) +dnl @result{}arg1,arg2,arg3 ,arg4 diff -ruNp m4-1.4.10/checks/035.pseudo_arg m4-1.4.11/checks/035.pseudo_arg --- m4-1.4.10/checks/035.pseudo_arg 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/035.pseudo_arg 2008-03-29 20:51:21.000000000 -0600 @@ -1,4 +1,4 @@ -dnl @ ../doc/m4.texinfo:1941: Origin of test +dnl @ ../doc/m4.texinfo:1920: Origin of test dnl @ expected status: 0 dnl @ extra options: dnl @ Copyright (C) 2006, 2007 Free Software Foundation @@ -6,23 +6,17 @@ dnl @ This file is free software; the Fr dnl @ gives unlimited permission to copy and/or distribute it dnl @ with or without modifications, as long as this notice dnl @ is preserved. -define(`foo', `no nested quote: $1') +define(`echo1', `$*') dnl @result{} -foo(`arg') -dnl @result{}no nested quote: arg -define(`foo', `nested quote around $: `$'1') +define(`echo2', `$@') dnl @result{} -foo(`arg') -dnl @result{}nested quote around $: $1 -define(`foo', `nested empty quote after $: $`'1') +define(`foo', `This is macro `foo'.') dnl @result{} -foo(`arg') -dnl @result{}nested empty quote after $: $1 -define(`foo', `nested quote around next character: $`1'') -dnl @result{} -foo(`arg') -dnl @result{}nested quote around next character: $1 -define(`foo', `nested quote around both: `$1'') -dnl @result{} -foo(`arg') -dnl @result{}nested quote around both: arg +echo1(foo) +dnl @result{}This is macro This is macro foo.. +echo1(`foo') +dnl @result{}This is macro foo. +echo2(foo) +dnl @result{}This is macro foo. +echo2(`foo') +dnl @result{}foo diff -ruNp m4-1.4.10/checks/036.pseudo_arg m4-1.4.11/checks/036.pseudo_arg --- m4-1.4.10/checks/036.pseudo_arg 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/036.pseudo_arg 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,22 @@ +dnl @ ../doc/m4.texinfo:1942: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`echo1', `$*') +dnl @result{} +define(`echo2', `$@') +dnl @result{} +define(`foo', `bar') +dnl @result{} +echo1(#foo'foo +foo) +dnl @result{}#foo'foo +dnl @result{}bar +echo2(#foo'foo +foo) +dnl @result{}#foobar +dnl @result{}bar' diff -ruNp m4-1.4.10/checks/036.undefine m4-1.4.11/checks/036.undefine --- m4-1.4.10/checks/036.undefine 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/036.undefine 1969-12-31 17:00:00.000000000 -0700 @@ -1,22 +0,0 @@ -dnl @ ../doc/m4.texinfo:1980: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -foo bar blah -dnl @result{}foo bar blah -define(`foo', `some')define(`bar', `other')define(`blah', `text') -dnl @result{} -foo bar blah -dnl @result{}some other text -undefine(`foo') -dnl @result{} -foo bar blah -dnl @result{}foo other text -undefine(`bar', `blah') -dnl @result{} -foo bar blah -dnl @result{}foo bar blah diff -ruNp m4-1.4.10/checks/037.pseudo_arg m4-1.4.11/checks/037.pseudo_arg --- m4-1.4.10/checks/037.pseudo_arg 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/037.pseudo_arg 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,28 @@ +dnl @ ../doc/m4.texinfo:1964: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`echo', `$@')dnl +echo(echo(`01234567890123456789', `01234567890123456789') +echo(`98765432109876543210', `98765432109876543210')) +dnl @result{}01234567890123456789,01234567890123456789 +dnl @result{}98765432109876543210,98765432109876543210 +len((echo(`01234567890123456789', + `01234567890123456789')echo(`98765432109876543210', + `98765432109876543210'))) +dnl @result{}84 +indir(`echo', indir(`echo', `01234567890123456789', + `01234567890123456789') +indir(`echo', `98765432109876543210', `98765432109876543210')) +dnl @result{}01234567890123456789,01234567890123456789 +dnl @result{}98765432109876543210,98765432109876543210 +define(`argn', `$#')dnl +define(`echo1', `-$@-')define(`echo2', `,$@,')dnl +echo1(`1', `2', `3') argn(echo1(`1', `2', `3')) +dnl @result{}-1,2,3- 3 +echo2(`1', `2', `3') argn(echo2(`1', `2', `3')) +dnl @result{},1,2,3, 5 diff -ruNp m4-1.4.10/checks/037.undefine m4-1.4.11/checks/037.undefine --- m4-1.4.10/checks/037.undefine 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/037.undefine 1969-12-31 17:00:00.000000000 -0700 @@ -1,14 +0,0 @@ -dnl @ ../doc/m4.texinfo:2000: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`f', ``$0':$1') -dnl @result{} -f(f(f(undefine(`f')`hello world'))) -dnl @result{}f:f:f:hello world -f(`bye') -dnl @result{}f(bye) diff -ruNp m4-1.4.10/checks/038.defn m4-1.4.11/checks/038.defn --- m4-1.4.10/checks/038.defn 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/038.defn 1969-12-31 17:00:00.000000000 -0700 @@ -1,14 +0,0 @@ -dnl @ ../doc/m4.texinfo:2039: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`zap', defn(`undefine')) -dnl @result{} -zap(`undefine') -dnl @result{} -undefine(`zap') -dnl @result{}undefine(zap) diff -ruNp m4-1.4.10/checks/038.pseudo_arg m4-1.4.11/checks/038.pseudo_arg --- m4-1.4.10/checks/038.pseudo_arg 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/038.pseudo_arg 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:1992: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `$$$ hello $$$') +dnl @result{} +foo +dnl @result{}$$$ hello $$$ diff -ruNp m4-1.4.10/checks/039.defn m4-1.4.11/checks/039.defn --- m4-1.4.10/checks/039.defn 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/039.defn 1969-12-31 17:00:00.000000000 -0700 @@ -1,14 +0,0 @@ -dnl @ ../doc/m4.texinfo:2056: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`foo', `This is `$0'') -dnl @result{} -define(`bar', defn(`foo')) -dnl @result{} -bar -dnl @result{}This is bar diff -ruNp m4-1.4.10/checks/039.pseudo_arg m4-1.4.11/checks/039.pseudo_arg --- m4-1.4.10/checks/039.pseudo_arg 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/039.pseudo_arg 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,28 @@ +dnl @ ../doc/m4.texinfo:2008: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `no nested quote: $1') +dnl @result{} +foo(`arg') +dnl @result{}no nested quote: arg +define(`foo', `nested quote around $: `$'1') +dnl @result{} +foo(`arg') +dnl @result{}nested quote around $: $1 +define(`foo', `nested empty quote after $: $`'1') +dnl @result{} +foo(`arg') +dnl @result{}nested empty quote after $: $1 +define(`foo', `nested quote around next character: $`1'') +dnl @result{} +foo(`arg') +dnl @result{}nested quote around next character: $1 +define(`foo', `nested quote around both: `$1'') +dnl @result{} +foo(`arg') +dnl @result{}nested quote around both: arg diff -ruNp m4-1.4.10/checks/040.defn m4-1.4.11/checks/040.defn --- m4-1.4.10/checks/040.defn 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/040.defn 1969-12-31 17:00:00.000000000 -0700 @@ -1,16 +0,0 @@ -dnl @ ../doc/m4.texinfo:2068: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`string', `The macro dnl is very useful -') -dnl @result{} -string -dnl @result{}The macro -defn(`string') -dnl @result{}The macro dnl is very useful -dnl @result{} diff -ruNp m4-1.4.10/checks/040.undefine m4-1.4.11/checks/040.undefine --- m4-1.4.10/checks/040.undefine 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/040.undefine 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,22 @@ +dnl @ ../doc/m4.texinfo:2047: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +foo bar blah +dnl @result{}foo bar blah +define(`foo', `some')define(`bar', `other')define(`blah', `text') +dnl @result{} +foo bar blah +dnl @result{}some other text +undefine(`foo') +dnl @result{} +foo bar blah +dnl @result{}foo other text +undefine(`bar', `blah') +dnl @result{} +foo bar blah +dnl @result{}foo bar blah diff -ruNp m4-1.4.10/checks/041.defn m4-1.4.11/checks/041.defn --- m4-1.4.10/checks/041.defn 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/041.defn 1969-12-31 17:00:00.000000000 -0700 @@ -1,20 +0,0 @@ -dnl @ ../doc/m4.texinfo:2087: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`foo', a'a) -dnl @result{} -define(`a', `A') -dnl @result{} -define(`echo', `$@') -dnl @result{} -foo -dnl @result{}A'A -defn(`foo') -dnl @result{}aA' -echo(foo) -dnl @result{}AA' diff -ruNp m4-1.4.10/checks/041.undefine m4-1.4.11/checks/041.undefine --- m4-1.4.10/checks/041.undefine 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/041.undefine 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:2067: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`f', ``$0':$1') +dnl @result{} +f(f(f(undefine(`f')`hello world'))) +dnl @result{}f:f:f:hello world +f(`bye') +dnl @result{}f(bye) diff -ruNp m4-1.4.10/checks/042.defn m4-1.4.11/checks/042.defn --- m4-1.4.10/checks/042.defn 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/042.defn 2008-03-29 20:51:21.000000000 -0600 @@ -1,4 +1,4 @@ -dnl @ ../doc/m4.texinfo:2108: Origin of test +dnl @ ../doc/m4.texinfo:2110: Origin of test dnl @ expected status: 0 dnl @ extra options: dnl @ Copyright (C) 2006, 2007 Free Software Foundation @@ -6,10 +6,9 @@ dnl @ This file is free software; the Fr dnl @ gives unlimited permission to copy and/or distribute it dnl @ with or without modifications, as long as this notice dnl @ is preserved. -defn(`defn') +define(`zap', defn(`undefine')) dnl @result{} -define(defn(`divnum'), `cannot redefine a builtin token') -dnl @error{}m4:stdin:2: Warning: define: invalid macro name ignored +zap(`undefine') dnl @result{} -divnum -dnl @result{}0 +undefine(`zap') +dnl @result{}undefine(zap) diff -ruNp m4-1.4.10/checks/043.defn m4-1.4.11/checks/043.defn --- m4-1.4.10/checks/043.defn 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/043.defn 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:2127: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `This is `$0'') +dnl @result{} +define(`bar', defn(`foo')) +dnl @result{} +bar +dnl @result{}This is bar diff -ruNp m4-1.4.10/checks/043.pushdef m4-1.4.11/checks/043.pushdef --- m4-1.4.10/checks/043.pushdef 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/043.pushdef 1969-12-31 17:00:00.000000000 -0700 @@ -1,32 +0,0 @@ -dnl @ ../doc/m4.texinfo:2149: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`foo', `Expansion one.') -dnl @result{} -foo -dnl @result{}Expansion one. -pushdef(`foo', `Expansion two.') -dnl @result{} -foo -dnl @result{}Expansion two. -pushdef(`foo', `Expansion three.') -dnl @result{} -pushdef(`foo', `Expansion four.') -dnl @result{} -popdef(`foo') -dnl @result{} -foo -dnl @result{}Expansion three. -popdef(`foo', `foo') -dnl @result{} -foo -dnl @result{}Expansion one. -popdef(`foo') -dnl @result{} -foo -dnl @result{}foo diff -ruNp m4-1.4.10/checks/044.defn m4-1.4.11/checks/044.defn --- m4-1.4.10/checks/044.defn 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/044.defn 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:2139: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`string', `The macro dnl is very useful +') +dnl @result{} +string +dnl @result{}The macro +defn(`string') +dnl @result{}The macro dnl is very useful +dnl @result{} diff -ruNp m4-1.4.10/checks/044.pushdef m4-1.4.11/checks/044.pushdef --- m4-1.4.10/checks/044.pushdef 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/044.pushdef 1969-12-31 17:00:00.000000000 -0700 @@ -1,24 +0,0 @@ -dnl @ ../doc/m4.texinfo:2186: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`foo', `Expansion one.') -dnl @result{} -foo -dnl @result{}Expansion one. -pushdef(`foo', `Expansion two.') -dnl @result{} -foo -dnl @result{}Expansion two. -define(`foo', `Second expansion two.') -dnl @result{} -foo -dnl @result{}Second expansion two. -undefine(`foo') -dnl @result{} -foo -dnl @result{}foo diff -ruNp m4-1.4.10/checks/045.defn m4-1.4.11/checks/045.defn --- m4-1.4.10/checks/045.defn 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/045.defn 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,20 @@ +dnl @ ../doc/m4.texinfo:2158: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', a'a) +dnl @result{} +define(`a', `A') +dnl @result{} +define(`echo', `$@') +dnl @result{} +foo +dnl @result{}A'A +defn(`foo') +dnl @result{}aA' +echo(foo) +dnl @result{}AA' diff -ruNp m4-1.4.10/checks/045.indir m4-1.4.11/checks/045.indir --- m4-1.4.10/checks/045.indir 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/045.indir 1969-12-31 17:00:00.000000000 -0700 @@ -1,14 +0,0 @@ -dnl @ ../doc/m4.texinfo:2235: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`$$internal$macro', `Internal macro (name `$0')') -dnl @result{} -$$internal$macro -dnl @result{}$$internal$macro -indir(`$$internal$macro') -dnl @result{}Internal macro (name $$internal$macro) diff -ruNp m4-1.4.10/checks/046.defn m4-1.4.11/checks/046.defn --- m4-1.4.10/checks/046.defn 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/046.defn 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:2182: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`l', `<[>')define(`r', `<]>') +dnl @result{} +changequote(`[', `]') +dnl @result{} +defn([l])defn([r]) +]) +dnl @result{}<[>]defn([r]) +dnl @result{}) +defn([l], [r]) +dnl @result{}<[>][<]> diff -ruNp m4-1.4.10/checks/046.indir m4-1.4.11/checks/046.indir --- m4-1.4.10/checks/046.indir 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/046.indir 1969-12-31 17:00:00.000000000 -0700 @@ -1,17 +0,0 @@ -dnl @ ../doc/m4.texinfo:2255: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`f', `1') -dnl @result{} -f(define(`f', `2')) -dnl @result{}1 -indir(`f', define(`f', `3')) -dnl @result{}3 -indir(`f', undefine(`f')) -dnl @error{}m4:stdin:4: undefined macro `f' -dnl @result{} diff -ruNp m4-1.4.10/checks/047.defn m4-1.4.11/checks/047.defn --- m4-1.4.10/checks/047.defn 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/047.defn 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,17 @@ +dnl @ ../doc/m4.texinfo:2201: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +defn(`defn') +dnl @result{} +define(defn(`divnum'), `cannot redefine a builtin token') +dnl @error{}m4:stdin:2: Warning: define: invalid macro name ignored +dnl @result{} +divnum +dnl @result{}0 +len(defn(`divnum')) +dnl @result{}0 diff -ruNp m4-1.4.10/checks/047.indir m4-1.4.11/checks/047.indir --- m4-1.4.10/checks/047.indir 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/047.indir 1969-12-31 17:00:00.000000000 -0700 @@ -1,21 +0,0 @@ -dnl @ ../doc/m4.texinfo:2273: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -indir(defn(`defn'), `divnum') -dnl @error{}m4:stdin:1: Warning: indir: invalid macro name ignored -dnl @result{} -indir(`define', defn(`defn'), `divnum') -dnl @error{}m4:stdin:2: Warning: define: invalid macro name ignored -dnl @result{} -indir(`define', `foo', defn(`divnum')) -dnl @result{} -foo -dnl @result{}0 -indir(`divert', defn(`foo')) -dnl @error{}m4:stdin:5: empty string treated as 0 in builtin `divert' -dnl @result{} diff -ruNp m4-1.4.10/checks/048.builtin m4-1.4.11/checks/048.builtin --- m4-1.4.10/checks/048.builtin 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/048.builtin 1969-12-31 17:00:00.000000000 -0700 @@ -1,32 +0,0 @@ -dnl @ ../doc/m4.texinfo:2311: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -pushdef(`define', `hidden') -dnl @result{} -undefine(`undefine') -dnl @result{} -define(`foo', `bar') -dnl @result{}hidden -foo -dnl @result{}foo -builtin(`define', `foo', defn(`divnum')) -dnl @result{} -foo -dnl @result{}0 -builtin(`define', `foo', `BAR') -dnl @result{} -foo -dnl @result{}BAR -undefine(`foo') -dnl @result{}undefine(foo) -foo -dnl @result{}BAR -builtin(`undefine', `foo') -dnl @result{} -foo -dnl @result{}foo diff -ruNp m4-1.4.10/checks/048.defn m4-1.4.11/checks/048.defn --- m4-1.4.10/checks/048.defn 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/048.defn 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,24 @@ +dnl @ ../doc/m4.texinfo:2218: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`a', `A')define(`AA', `b') +dnl @result{} +traceon(`defn', `define') +dnl @result{} +defn(`a', `divnum', `a') +dnl @error{}m4:stdin:3: Warning: cannot concatenate builtin `divnum' +dnl @error{}m4trace: -1- defn(`a', `divnum', `a') -> ``A'`A'' +dnl @result{}AA +define(`mydivnum', defn(`divnum', `divnum'))mydivnum +dnl @error{}m4:stdin:4: Warning: cannot concatenate builtin `divnum' +dnl @error{}m4:stdin:4: Warning: cannot concatenate builtin `divnum' +dnl @error{}m4trace: -2- defn(`divnum', `divnum') +dnl @error{}m4trace: -1- define(`mydivnum', `') +dnl @result{} +traceoff(`defn', `define') +dnl @result{} diff -ruNp m4-1.4.10/checks/049.builtin m4-1.4.11/checks/049.builtin --- m4-1.4.10/checks/049.builtin 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/049.builtin 1969-12-31 17:00:00.000000000 -0700 @@ -1,18 +0,0 @@ -dnl @ ../doc/m4.texinfo:2344: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -P -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -m4_builtin(`divnum') -dnl @result{}0 -m4_builtin(`m4_divnum') -dnl @error{}m4:stdin:2: undefined builtin `m4_divnum' -dnl @result{} -m4_indir(`divnum') -dnl @error{}m4:stdin:3: undefined macro `divnum' -dnl @result{} -m4_indir(`m4_divnum') -dnl @result{}0 diff -ruNp m4-1.4.10/checks/049.pushdef m4-1.4.11/checks/049.pushdef --- m4-1.4.10/checks/049.pushdef 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/049.pushdef 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,32 @@ +dnl @ ../doc/m4.texinfo:2269: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `Expansion one.') +dnl @result{} +foo +dnl @result{}Expansion one. +pushdef(`foo', `Expansion two.') +dnl @result{} +foo +dnl @result{}Expansion two. +pushdef(`foo', `Expansion three.') +dnl @result{} +pushdef(`foo', `Expansion four.') +dnl @result{} +popdef(`foo') +dnl @result{} +foo +dnl @result{}Expansion three. +popdef(`foo', `foo') +dnl @result{} +foo +dnl @result{}Expansion one. +popdef(`foo') +dnl @result{} +foo +dnl @result{}foo diff -ruNp m4-1.4.10/checks/050.builtin m4-1.4.11/checks/050.builtin --- m4-1.4.10/checks/050.builtin 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/050.builtin 1969-12-31 17:00:00.000000000 -0700 @@ -1,19 +0,0 @@ -dnl @ ../doc/m4.texinfo:2362: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -builtin -dnl @result{}builtin -builtin() -dnl @error{}m4:stdin:2: undefined builtin `' -dnl @result{} -builtin(`builtin') -dnl @error{}m4:stdin:3: Warning: too few arguments to builtin `builtin' -dnl @result{} -builtin(`builtin',) -dnl @error{}m4:stdin:4: undefined builtin `' -dnl @result{} diff -ruNp m4-1.4.10/checks/050.pushdef m4-1.4.11/checks/050.pushdef --- m4-1.4.10/checks/050.pushdef 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/050.pushdef 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,24 @@ +dnl @ ../doc/m4.texinfo:2306: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `Expansion one.') +dnl @result{} +foo +dnl @result{}Expansion one. +pushdef(`foo', `Expansion two.') +dnl @result{} +foo +dnl @result{}Expansion two. +define(`foo', `Second expansion two.') +dnl @result{} +foo +dnl @result{}Second expansion two. +undefine(`foo') +dnl @result{} +foo +dnl @result{}foo diff -ruNp m4-1.4.10/checks/051.ifdef m4-1.4.11/checks/051.ifdef --- m4-1.4.10/checks/051.ifdef 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/051.ifdef 1969-12-31 17:00:00.000000000 -0700 @@ -1,17 +0,0 @@ -dnl @ ../doc/m4.texinfo:2409: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -ifdef(`foo', ``foo' is defined', ``foo' is not defined') -dnl @result{}foo is not defined -define(`foo', `') -dnl @result{} -ifdef(`foo', ``foo' is defined', ``foo' is not defined') -dnl @result{}foo is defined -ifdef(`no_such_macro', `yes', `no', `extra argument') -dnl @error{}m4:stdin:4: Warning: excess arguments to builtin `ifdef' ignored -dnl @result{}no diff -ruNp m4-1.4.10/checks/051.indir m4-1.4.11/checks/051.indir --- m4-1.4.10/checks/051.indir 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/051.indir 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:2355: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`$$internal$macro', `Internal macro (name `$0')') +dnl @result{} +$$internal$macro +dnl @result{}$$internal$macro +indir(`$$internal$macro') +dnl @result{}Internal macro (name $$internal$macro) diff -ruNp m4-1.4.10/checks/052.ifelse m4-1.4.11/checks/052.ifelse --- m4-1.4.10/checks/052.ifelse 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/052.ifelse 1969-12-31 17:00:00.000000000 -0700 @@ -1,13 +0,0 @@ -dnl @ ../doc/m4.texinfo:2457: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -ifelse(`some comments') -dnl @result{} -ifelse(`foo', `bar') -dnl @error{}m4:stdin:2: Warning: too few arguments to builtin `ifelse' -dnl @result{} diff -ruNp m4-1.4.10/checks/052.indir m4-1.4.11/checks/052.indir --- m4-1.4.10/checks/052.indir 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/052.indir 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,17 @@ +dnl @ ../doc/m4.texinfo:2375: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`f', `1') +dnl @result{} +f(define(`f', `2')) +dnl @result{}1 +indir(`f', define(`f', `3')) +dnl @result{}3 +indir(`f', undefine(`f')) +dnl @error{}m4:stdin:4: undefined macro `f' +dnl @result{} diff -ruNp m4-1.4.10/checks/053.ifelse m4-1.4.11/checks/053.ifelse --- m4-1.4.10/checks/053.ifelse 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/053.ifelse 1969-12-31 17:00:00.000000000 -0700 @@ -1,18 +0,0 @@ -dnl @ ../doc/m4.texinfo:2467: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -ifelse(`foo', `bar', `true') -dnl @result{} -ifelse(`foo', `foo', `true') -dnl @result{}true -define(`foo', `bar') -dnl @result{} -ifelse(foo, `bar', `true', `false') -dnl @result{}true -ifelse(foo, `foo', `true', `false') -dnl @result{}false diff -ruNp m4-1.4.10/checks/053.indir m4-1.4.11/checks/053.indir --- m4-1.4.10/checks/053.indir 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/053.indir 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,21 @@ +dnl @ ../doc/m4.texinfo:2393: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +indir(defn(`defn'), `divnum') +dnl @error{}m4:stdin:1: Warning: indir: invalid macro name ignored +dnl @result{} +indir(`define', defn(`defn'), `divnum') +dnl @error{}m4:stdin:2: Warning: define: invalid macro name ignored +dnl @result{} +indir(`define', `foo', defn(`divnum')) +dnl @result{} +foo +dnl @result{}0 +indir(`divert', defn(`foo')) +dnl @error{}m4:stdin:5: empty string treated as 0 in builtin `divert' +dnl @result{} diff -ruNp m4-1.4.10/checks/054.builtin m4-1.4.11/checks/054.builtin --- m4-1.4.10/checks/054.builtin 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/054.builtin 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,32 @@ +dnl @ ../doc/m4.texinfo:2431: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +pushdef(`define', `hidden') +dnl @result{} +undefine(`undefine') +dnl @result{} +define(`foo', `bar') +dnl @result{}hidden +foo +dnl @result{}foo +builtin(`define', `foo', defn(`divnum')) +dnl @result{} +foo +dnl @result{}0 +builtin(`define', `foo', `BAR') +dnl @result{} +foo +dnl @result{}BAR +undefine(`foo') +dnl @result{}undefine(foo) +foo +dnl @result{}BAR +builtin(`undefine', `foo') +dnl @result{} +foo +dnl @result{}foo diff -ruNp m4-1.4.10/checks/054.ifelse m4-1.4.11/checks/054.ifelse --- m4-1.4.10/checks/054.ifelse 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/054.ifelse 1969-12-31 17:00:00.000000000 -0700 @@ -1,16 +0,0 @@ -dnl @ ../doc/m4.texinfo:2487: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`foo', `ifelse(`$#', `0', ``$0'', `arguments:$#')') -dnl @result{} -foo -dnl @result{}foo -foo() -dnl @result{}arguments:1 -foo(`a', `b', `c') -dnl @result{}arguments:3 diff -ruNp m4-1.4.10/checks/055.builtin m4-1.4.11/checks/055.builtin --- m4-1.4.10/checks/055.builtin 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/055.builtin 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:2464: Origin of test +dnl @ expected status: 0 +dnl @ extra options: -P +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +m4_builtin(`divnum') +dnl @result{}0 +m4_builtin(`m4_divnum') +dnl @error{}m4:stdin:2: undefined builtin `m4_divnum' +dnl @result{} +m4_indir(`divnum') +dnl @error{}m4:stdin:3: undefined macro `divnum' +dnl @result{} +m4_indir(`m4_divnum') +dnl @result{}0 diff -ruNp m4-1.4.10/checks/055.ifelse m4-1.4.11/checks/055.ifelse --- m4-1.4.10/checks/055.ifelse 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/055.ifelse 1969-12-31 17:00:00.000000000 -0700 @@ -1,18 +0,0 @@ -dnl @ ../doc/m4.texinfo:2508: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -ifelse(`foo', `bar', `third', `gnu', `gnats') -dnl @error{}m4:stdin:1: Warning: excess arguments to builtin `ifelse' ignored -dnl @result{}gnu -ifelse(`foo', `bar', `third', `gnu', `gnats', `sixth') -dnl @result{} -ifelse(`foo', `bar', `third', `gnu', `gnats', `sixth', `seventh') -dnl @result{}seventh -ifelse(`foo', `bar', `3', `gnu', `gnats', `6', `7', `8') -dnl @error{}m4:stdin:4: Warning: excess arguments to builtin `ifelse' ignored -dnl @result{}7 diff -ruNp m4-1.4.10/checks/056.builtin m4-1.4.11/checks/056.builtin --- m4-1.4.10/checks/056.builtin 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/056.builtin 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,19 @@ +dnl @ ../doc/m4.texinfo:2482: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +builtin +dnl @result{}builtin +builtin() +dnl @error{}m4:stdin:2: undefined builtin `' +dnl @result{} +builtin(`builtin') +dnl @error{}m4:stdin:3: Warning: too few arguments to builtin `builtin' +dnl @result{} +builtin(`builtin',) +dnl @error{}m4:stdin:4: undefined builtin `' +dnl @result{} diff -ruNp m4-1.4.10/checks/056.shift m4-1.4.11/checks/056.shift --- m4-1.4.10/checks/056.shift 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/056.shift 1969-12-31 17:00:00.000000000 -0700 @@ -1,14 +0,0 @@ -dnl @ ../doc/m4.texinfo:2548: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -shift -dnl @result{}shift -shift(`bar') -dnl @result{} -shift(`foo', `bar', `baz') -dnl @result{}bar,baz diff -ruNp m4-1.4.10/checks/057.builtin m4-1.4.11/checks/057.builtin --- m4-1.4.10/checks/057.builtin 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/057.builtin 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,10 @@ +dnl @ ../doc/m4.texinfo:2501: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +builtin(`include', `foo')dnl +dnl @result{}bar diff -ruNp m4-1.4.10/checks/057.shift m4-1.4.11/checks/057.shift --- m4-1.4.10/checks/057.shift 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/057.shift 1969-12-31 17:00:00.000000000 -0700 @@ -1,17 +0,0 @@ -dnl @ ../doc/m4.texinfo:2565: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`reverse', `ifelse(`$#', `0', , `$#', `1', ``$1'', - `reverse(shift($@)), `$1'')') -dnl @result{} -reverse -dnl @result{} -reverse(`foo') -dnl @result{}foo -reverse(`foo', `bar', `gnats', `and gnus') -dnl @result{}and gnus, gnats, bar, foo diff -ruNp m4-1.4.10/checks/058.builtin m4-1.4.11/checks/058.builtin --- m4-1.4.10/checks/058.builtin 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/058.builtin 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,20 @@ +dnl @ ../doc/m4.texinfo:2508: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`s', `builtin(`shift', $@)')dnl +define(`loop', `ifelse(`$2', `', `-', `$1$2: $0(`$1', s(s($@)))')')dnl +loop(`1') +dnl @result{}- +loop(`1', `2') +dnl @result{}12: - +loop(`1', `2', `3') +dnl @result{}12: 13: - +loop(`1', `2', `3', `4') +dnl @result{}12: 13: 14: - +loop(`1', `2', `3', `4', `5') +dnl @result{}12: 13: 14: 15: - diff -ruNp m4-1.4.10/checks/058.shift m4-1.4.11/checks/058.shift --- m4-1.4.10/checks/058.shift 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/058.shift 1969-12-31 17:00:00.000000000 -0700 @@ -1,25 +0,0 @@ -dnl @ ../doc/m4.texinfo:2597: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -include(`quote.m4') -dnl @result{} --quote-dquote-dquote_elt- -dnl @result{}---- --quote()-dquote()-dquote_elt()- -dnl @result{}--`'-`'- --quote(`1')-dquote(`1')-dquote_elt(`1')- -dnl @result{}-1-`1'-`1'- --quote(`1', `2')-dquote(`1', `2')-dquote_elt(`1', `2')- -dnl @result{}-1,2-`1',`2'-`1',`2'- -define(`n', `$#')dnl --n(quote(`1', `2'))-n(dquote(`1', `2'))-n(dquote_elt(`1', `2'))- -dnl @result{}-1-1-2- -dquote(dquote_elt(`1', `2')) -dnl @result{}``1'',``2'' -dquote_elt(dquote(`1', `2')) -dnl @result{}``1',`2'' diff -ruNp m4-1.4.10/checks/059.ifdef m4-1.4.11/checks/059.ifdef --- m4-1.4.10/checks/059.ifdef 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/059.ifdef 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,17 @@ +dnl @ ../doc/m4.texinfo:2557: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +ifdef(`foo', ``foo' is defined', ``foo' is not defined') +dnl @result{}foo is not defined +define(`foo', `') +dnl @result{} +ifdef(`foo', ``foo' is defined', ``foo' is not defined') +dnl @result{}foo is defined +ifdef(`no_such_macro', `yes', `no', `extra argument') +dnl @error{}m4:stdin:4: Warning: excess arguments to builtin `ifdef' ignored +dnl @result{}no diff -ruNp m4-1.4.10/checks/059.shift m4-1.4.11/checks/059.shift --- m4-1.4.10/checks/059.shift 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/059.shift 1969-12-31 17:00:00.000000000 -0700 @@ -1,18 +0,0 @@ -dnl @ ../doc/m4.texinfo:2629: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -undivert(`quote.m4')dnl -dnl @result{}divert(`-1') -dnl @result{}# quote(args) - convert args to single-quoted string -dnl @result{}define(`quote', `ifelse(`$#', `0', `', ``$*'')') -dnl @result{}# dquote(args) - convert args to quoted list of quoted strings -dnl @result{}define(`dquote', ``$@'') -dnl @result{}# dquote_elt(args) - convert args to list of double-quoted strings -dnl @result{}define(`dquote_elt', `ifelse(`$#', `0', `', `$#', `1', ```$1''', -dnl @result{} ```$1'',$0(shift($@))')') -dnl @result{}divert`'dnl diff -ruNp m4-1.4.10/checks/060.ifelse m4-1.4.11/checks/060.ifelse --- m4-1.4.10/checks/060.ifelse 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/060.ifelse 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,13 @@ +dnl @ ../doc/m4.texinfo:2605: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +ifelse(`some comments') +dnl @result{} +ifelse(`foo', `bar') +dnl @error{}m4:stdin:2: Warning: too few arguments to builtin `ifelse' +dnl @result{} diff -ruNp m4-1.4.10/checks/060.shift m4-1.4.11/checks/060.shift --- m4-1.4.10/checks/060.shift 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/060.shift 1969-12-31 17:00:00.000000000 -0700 @@ -1,17 +0,0 @@ -dnl @ ../doc/m4.texinfo:2659: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`argn', `ifelse(`$1', 1, ``$2'', - `argn(decr(`$1'), shift(shift($@)))')') -dnl @result{} -argn(`1', `a') -dnl @result{}a -define(`foo', `argn(`11', $@)') -dnl @result{} -foo(`a', `b', `c', `d', `e', `f', `g', `h', `i', `j', `k', `l') -dnl @result{}k diff -ruNp m4-1.4.10/checks/061.forloop m4-1.4.11/checks/061.forloop --- m4-1.4.10/checks/061.forloop 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/061.forloop 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -dnl @ ../doc/m4.texinfo:2690: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -include(`forloop.m4') -dnl @result{} -forloop(`i', `1', `8', `i ') -dnl @result{}1 2 3 4 5 6 7 8 diff -ruNp m4-1.4.10/checks/061.ifelse m4-1.4.11/checks/061.ifelse --- m4-1.4.10/checks/061.ifelse 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/061.ifelse 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:2615: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +ifelse(`foo', `bar', `true') +dnl @result{} +ifelse(`foo', `foo', `true') +dnl @result{}true +define(`foo', `bar') +dnl @result{} +ifelse(foo, `bar', `true', `false') +dnl @result{}true +ifelse(foo, `foo', `true', `false') +dnl @result{}false diff -ruNp m4-1.4.10/checks/062.forloop m4-1.4.11/checks/062.forloop --- m4-1.4.10/checks/062.forloop 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/062.forloop 1969-12-31 17:00:00.000000000 -0700 @@ -1,17 +0,0 @@ -dnl @ ../doc/m4.texinfo:2700: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -include(`forloop.m4') -dnl @result{} -forloop(`i', `1', `4', `forloop(`j', `1', `8', ` (i, j)') -') -dnl @result{} (1, 1) (1, 2) (1, 3) (1, 4) (1, 5) (1, 6) (1, 7) (1, 8) -dnl @result{} (2, 1) (2, 2) (2, 3) (2, 4) (2, 5) (2, 6) (2, 7) (2, 8) -dnl @result{} (3, 1) (3, 2) (3, 3) (3, 4) (3, 5) (3, 6) (3, 7) (3, 8) -dnl @result{} (4, 1) (4, 2) (4, 3) (4, 4) (4, 5) (4, 6) (4, 7) (4, 8) -dnl @result{} diff -ruNp m4-1.4.10/checks/062.ifelse m4-1.4.11/checks/062.ifelse --- m4-1.4.10/checks/062.ifelse 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/062.ifelse 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:2635: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `ifelse(`$#', `0', ``$0'', `arguments:$#')') +dnl @result{} +foo +dnl @result{}foo +foo() +dnl @result{}arguments:1 +foo(`a', `b', `c') +dnl @result{}arguments:3 diff -ruNp m4-1.4.10/checks/063.forloop m4-1.4.11/checks/063.forloop --- m4-1.4.10/checks/063.forloop 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/063.forloop 1969-12-31 17:00:00.000000000 -0700 @@ -1,15 +0,0 @@ -dnl @ ../doc/m4.texinfo:2727: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -undivert(`forloop.m4')dnl -dnl @result{}divert(`-1') -dnl @result{}# forloop(var, from, to, stmt) - simple version -dnl @result{}define(`forloop', `pushdef(`$1', `$2')_forloop($@)popdef(`$1')') -dnl @result{}define(`_forloop', -dnl @result{} `$4`'ifelse($1, `$3', `', `define(`$1', incr($1))$0($@)')') -dnl @result{}divert`'dnl diff -ruNp m4-1.4.10/checks/063.ifelse m4-1.4.11/checks/063.ifelse --- m4-1.4.10/checks/063.ifelse 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/063.ifelse 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:2656: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +ifelse(`foo', `bar', `third', `gnu', `gnats') +dnl @error{}m4:stdin:1: Warning: excess arguments to builtin `ifelse' ignored +dnl @result{}gnu +ifelse(`foo', `bar', `third', `gnu', `gnats', `sixth') +dnl @result{} +ifelse(`foo', `bar', `third', `gnu', `gnats', `sixth', `seventh') +dnl @result{}seventh +ifelse(`foo', `bar', `3', `gnu', `gnats', `6', `7', `8') +dnl @error{}m4:stdin:4: Warning: excess arguments to builtin `ifelse' ignored +dnl @result{}7 diff -ruNp m4-1.4.10/checks/064.foreach m4-1.4.11/checks/064.foreach --- m4-1.4.10/checks/064.foreach 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/064.foreach 1969-12-31 17:00:00.000000000 -0700 @@ -1,22 +0,0 @@ -dnl @ ../doc/m4.texinfo:2773: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -include(`foreach.m4') -dnl @result{} -foreach(`x', (foo, bar, foobar), `Word was: x -')dnl -dnl @result{}Word was: foo -dnl @result{}Word was: bar -dnl @result{}Word was: foobar -include(`foreachq.m4') -dnl @result{} -foreachq(`x', `foo, bar, foobar', `Word was: x -')dnl -dnl @result{}Word was: foo -dnl @result{}Word was: bar -dnl @result{}Word was: foobar diff -ruNp m4-1.4.10/checks/064.ifelse m4-1.4.11/checks/064.ifelse --- m4-1.4.10/checks/064.ifelse 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/064.ifelse 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,58 @@ +dnl @ ../doc/m4.texinfo:2674: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`e', `$@')define(`long', `01234567890123456789') +dnl @result{} +ifelse(long, `01234567890123456789', `yes', `no') +dnl @result{}yes +ifelse(`01234567890123456789', long, `yes', `no') +dnl @result{}yes +ifelse(long, `01234567890123456789-', `yes', `no') +dnl @result{}no +ifelse(`01234567890123456789-', long, `yes', `no') +dnl @result{}no +ifelse(e(long), `01234567890123456789', `yes', `no') +dnl @result{}yes +ifelse(`01234567890123456789', e(long), `yes', `no') +dnl @result{}yes +ifelse(e(long), `01234567890123456789-', `yes', `no') +dnl @result{}no +ifelse(`01234567890123456789-', e(long), `yes', `no') +dnl @result{}no +ifelse(-e(long), `-01234567890123456789', `yes', `no') +dnl @result{}yes +ifelse(-`01234567890123456789', -e(long), `yes', `no') +dnl @result{}yes +ifelse(-e(long), `-01234567890123456789-', `yes', `no') +dnl @result{}no +ifelse(`-01234567890123456789-', -e(long), `yes', `no') +dnl @result{}no +ifelse(-e(long)-, `-01234567890123456789-', `yes', `no') +dnl @result{}yes +ifelse(-`01234567890123456789-', -e(long)-, `yes', `no') +dnl @result{}yes +ifelse(-e(long)-, `-01234567890123456789', `yes', `no') +dnl @result{}no +ifelse(`-01234567890123456789', -e(long)-, `yes', `no') +dnl @result{}no +ifelse(`-'e(long), `-01234567890123456789', `yes', `no') +dnl @result{}yes +ifelse(-`01234567890123456789', `-'e(long), `yes', `no') +dnl @result{}yes +ifelse(`-'e(long), `-01234567890123456789-', `yes', `no') +dnl @result{}no +ifelse(`-01234567890123456789-', `-'e(long), `yes', `no') +dnl @result{}no +ifelse(`-'e(long)`-', `-01234567890123456789-', `yes', `no') +dnl @result{}yes +ifelse(-`01234567890123456789-', `-'e(long)`-', `yes', `no') +dnl @result{}yes +ifelse(`-'e(long)`-', `-01234567890123456789', `yes', `no') +dnl @result{}no +ifelse(`-01234567890123456789', `-'e(long)`-', `yes', `no') +dnl @result{}no diff -ruNp m4-1.4.10/checks/065.foreach m4-1.4.11/checks/065.foreach --- m4-1.4.10/checks/065.foreach 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/065.foreach 1969-12-31 17:00:00.000000000 -0700 @@ -1,26 +0,0 @@ -dnl @ ../doc/m4.texinfo:2795: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -include(`foreach.m4') -dnl @result{} -define(`_case', ` $1) - $2=" $1";; -')dnl -define(`_cat', `$1$2')dnl -case $`'1 in -dnl @result{}case $1 in -foreach(`x', `(`(`a', `vara')', `(`b', `varb')', `(`c', `varc')')', - `_cat(`_case', x)')dnl -dnl @result{} a) -dnl @result{} vara=" a";; -dnl @result{} b) -dnl @result{} varb=" b";; -dnl @result{} c) -dnl @result{} varc=" c";; -esac -dnl @result{}esac diff -ruNp m4-1.4.10/checks/065.shift m4-1.4.11/checks/065.shift --- m4-1.4.10/checks/065.shift 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/065.shift 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:2755: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +shift +dnl @result{}shift +shift(`bar') +dnl @result{} +shift(`foo', `bar', `baz') +dnl @result{}bar,baz diff -ruNp m4-1.4.10/checks/066.foreach m4-1.4.11/checks/066.foreach --- m4-1.4.10/checks/066.foreach 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/066.foreach 1969-12-31 17:00:00.000000000 -0700 @@ -1,17 +0,0 @@ -dnl @ ../doc/m4.texinfo:2824: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -undivert(`foreach.m4')dnl -dnl @result{}divert(`-1') -dnl @result{}# foreach(x, (item_1, item_2, ..., item_n), stmt) -dnl @result{}# parenthesized list, simple version -dnl @result{}define(`foreach', `pushdef(`$1')_foreach($@)popdef(`$1')') -dnl @result{}define(`_arg1', `$1') -dnl @result{}define(`_foreach', `ifelse(`$2', `()', `', -dnl @result{} `define(`$1', _arg1$2)$3`'$0(`$1', (shift$2), `$3')')') -dnl @result{}divert`'dnl diff -ruNp m4-1.4.10/checks/066.shift m4-1.4.11/checks/066.shift --- m4-1.4.10/checks/066.shift 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/066.shift 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,17 @@ +dnl @ ../doc/m4.texinfo:2774: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`reverse', `ifelse(`$#', `0', , `$#', `1', ``$1'', + `reverse(shift($@)), `$1'')') +dnl @result{} +reverse +dnl @result{} +reverse(`foo') +dnl @result{}foo +reverse(`foo', `bar', `gnats', `and gnus') +dnl @result{}and gnus, gnats, bar, foo diff -ruNp m4-1.4.10/checks/067.foreach m4-1.4.11/checks/067.foreach --- m4-1.4.10/checks/067.foreach 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/067.foreach 1969-12-31 17:00:00.000000000 -0700 @@ -1,26 +0,0 @@ -dnl @ ../doc/m4.texinfo:2850: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`a', `1')define(`b', `2')define(`c', `3') -dnl @result{} -include(`foreach.m4') -dnl @result{} -include(`foreachq.m4') -dnl @result{} -foreach(`x', `(``a'', ``(b'', ``c)'')', `x -') -dnl @result{}1 -dnl @result{}(2)1 -dnl @result{} -dnl @result{}, x -dnl @result{}) -foreachq(`x', ```a'', ``(b'', ``c)''', `x -')dnl -dnl @result{}a -dnl @result{}(b -dnl @result{}c) diff -ruNp m4-1.4.10/checks/067.shift m4-1.4.11/checks/067.shift --- m4-1.4.10/checks/067.shift 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/067.shift 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,41 @@ +dnl @ ../doc/m4.texinfo:2809: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`cond', +`ifelse(`$#', `1', `$1', + `ifelse($1, `$2', `$3', + `$0(shift(shift(shift($@))))')')')dnl +define(`side', `define(`counter', incr(counter))$1')dnl +define(`example1', +`define(`counter', `0')dnl +ifelse(side(`$1'), `yes', `one comparison: ', + side(`$1'), `no', `two comparisons: ', + side(`$1'), `maybe', `three comparisons: ', + `side(`default answer: ')')counter')dnl +define(`example2', +`define(`counter', `0')dnl +cond(`side(`$1')', `yes', `one comparison: ', + `side(`$1')', `no', `two comparisons: ', + `side(`$1')', `maybe', `three comparisons: ', + `side(`default answer: ')')counter')dnl +example1(`yes') +dnl @result{}one comparison: 3 +example1(`no') +dnl @result{}two comparisons: 3 +example1(`maybe') +dnl @result{}three comparisons: 3 +example1(`feeling rather indecisive today') +dnl @result{}default answer: 4 +example2(`yes') +dnl @result{}one comparison: 1 +example2(`no') +dnl @result{}two comparisons: 2 +example2(`maybe') +dnl @result{}three comparisons: 3 +example2(`feeling rather indecisive today') +dnl @result{}default answer: 4 diff -ruNp m4-1.4.10/checks/068.foreach m4-1.4.11/checks/068.foreach --- m4-1.4.10/checks/068.foreach 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/068.foreach 1969-12-31 17:00:00.000000000 -0700 @@ -1,18 +0,0 @@ -dnl @ ../doc/m4.texinfo:2874: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -undivert(`foreachq.m4')dnl -dnl @result{}include(`quote.m4')dnl -dnl @result{}divert(`-1') -dnl @result{}# foreachq(x, `item_1, item_2, ..., item_n', stmt) -dnl @result{}# quoted list, simple version -dnl @result{}define(`foreachq', `pushdef(`$1')_foreachq($@)popdef(`$1')') -dnl @result{}define(`_arg1', `$1') -dnl @result{}define(`_foreachq', `ifelse(quote($2), `', `', -dnl @result{} `define(`$1', `_arg1($2)')$3`'$0(`$1', `shift($2)', `$3')')') -dnl @result{}divert`'dnl diff -ruNp m4-1.4.10/checks/068.shift m4-1.4.11/checks/068.shift --- m4-1.4.10/checks/068.shift 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/068.shift 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,29 @@ +dnl @ ../doc/m4.texinfo:2864: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +include(`join.m4') +dnl @result{} +join,join(`-'),join(`-', `'),join(`-', `', `') +dnl @result{},,, +joinall,joinall(`-'),joinall(`-', `'),joinall(`-', `', `') +dnl @result{},,,- +join(`-', `1') +dnl @result{}1 +join(`-', `1', `2', `3') +dnl @result{}1-2-3 +join(`', `1', `2', `3') +dnl @result{}123 +join(`-', `', `1', `', `', `2', `') +dnl @result{}1-2 +joinall(`-', `', `1', `', `', `2', `') +dnl @result{}-1---2- +join(`,', `1', `2', `3') +dnl @result{}1,2,3 +define(`nargs', `$#')dnl +nargs(join(`,', `1', `2', `3')) +dnl @result{}1 diff -ruNp m4-1.4.10/checks/069.dumpdef m4-1.4.11/checks/069.dumpdef --- m4-1.4.10/checks/069.dumpdef 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/069.dumpdef 1969-12-31 17:00:00.000000000 -0700 @@ -1,16 +0,0 @@ -dnl @ ../doc/m4.texinfo:2937: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`foo', `Hello world.') -dnl @result{} -dumpdef(`foo') -dnl @error{}foo: `Hello world.' -dnl @result{} -dumpdef(`define') -dnl @error{}define: <define> -dnl @result{} diff -ruNp m4-1.4.10/checks/069.shift m4-1.4.11/checks/069.shift --- m4-1.4.10/checks/069.shift 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/069.shift 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,24 @@ +dnl @ ../doc/m4.texinfo:2893: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +undivert(`join.m4')dnl +dnl @result{}divert(`-1') +dnl @result{}# join(sep, args) - join each non-empty ARG into a single +dnl @result{}# string, with each element separated by SEP +dnl @result{}define(`join', +dnl @result{}`ifelse(`$#', `2', ``$2'', +dnl @result{} `ifelse(`$2', `', `', ``$2'_')$0(`$1', shift(shift($@)))')') +dnl @result{}define(`_join', +dnl @result{}`ifelse(`$#$2', `2', `', +dnl @result{} `ifelse(`$2', `', `', ``$1$2'')$0(`$1', shift(shift($@)))')') +dnl @result{}# joinall(sep, args) - join each ARG, including empty ones, +dnl @result{}# into a single string, with each element separated by SEP +dnl @result{}define(`joinall', ``$2'_$0(`$1', shift($@))') +dnl @result{}define(`_joinall', +dnl @result{}`ifelse(`$#', `2', `', ``$1$3'$0(`$1', shift(shift($@)))')') +dnl @result{}divert`'dnl diff -ruNp m4-1.4.10/checks/070.dumpdef m4-1.4.11/checks/070.dumpdef --- m4-1.4.10/checks/070.dumpdef 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/070.dumpdef 1969-12-31 17:00:00.000000000 -0700 @@ -1,16 +0,0 @@ -dnl @ ../doc/m4.texinfo:2954: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -pushdef(`f', ``$0'1')pushdef(`f', ``$0'2') -dnl @result{} -f(popdef(`f')dumpdef(`f')) -dnl @error{}f: ``$0'1' -dnl @result{}f2 -f(popdef(`f')dumpdef(`f')) -dnl @error{}m4:stdin:3: undefined macro `f' -dnl @result{}f1 diff -ruNp m4-1.4.10/checks/070.shift m4-1.4.11/checks/070.shift --- m4-1.4.10/checks/070.shift 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/070.shift 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,25 @@ +dnl @ ../doc/m4.texinfo:2971: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +include(`quote.m4') +dnl @result{} +-quote-dquote-dquote_elt- +dnl @result{}---- +-quote()-dquote()-dquote_elt()- +dnl @result{}--`'-`'- +-quote(`1')-dquote(`1')-dquote_elt(`1')- +dnl @result{}-1-`1'-`1'- +-quote(`1', `2')-dquote(`1', `2')-dquote_elt(`1', `2')- +dnl @result{}-1,2-`1',`2'-`1',`2'- +define(`n', `$#')dnl +-n(quote(`1', `2'))-n(dquote(`1', `2'))-n(dquote_elt(`1', `2'))- +dnl @result{}-1-1-2- +dquote(dquote_elt(`1', `2')) +dnl @result{}``1'',``2'' +dquote_elt(dquote(`1', `2')) +dnl @result{}``1',`2'' diff -ruNp m4-1.4.10/checks/071.shift m4-1.4.11/checks/071.shift --- m4-1.4.10/checks/071.shift 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/071.shift 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:3004: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +undivert(`quote.m4')dnl +dnl @result{}divert(`-1') +dnl @result{}# quote(args) - convert args to single-quoted string +dnl @result{}define(`quote', `ifelse(`$#', `0', `', ``$*'')') +dnl @result{}# dquote(args) - convert args to quoted list of quoted strings +dnl @result{}define(`dquote', ``$@'') +dnl @result{}# dquote_elt(args) - convert args to list of double-quoted strings +dnl @result{}define(`dquote_elt', `ifelse(`$#', `0', `', `$#', `1', ```$1''', +dnl @result{} ```$1'',$0(shift($@))')') +dnl @result{}divert`'dnl diff -ruNp m4-1.4.10/checks/071.trace m4-1.4.11/checks/071.trace --- m4-1.4.10/checks/071.trace 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/071.trace 1969-12-31 17:00:00.000000000 -0700 @@ -1,20 +0,0 @@ -dnl @ ../doc/m4.texinfo:2997: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`foo', `Hello World.') -dnl @result{} -define(`echo', `$@') -dnl @result{} -traceon(`foo', `echo') -dnl @result{} -foo -dnl @error{}m4trace: -1- foo -> `Hello World.' -dnl @result{}Hello World. -echo(`gnus', `and gnats') -dnl @error{}m4trace: -1- echo(`gnus', `and gnats') -> ``gnus',`and gnats'' -dnl @result{}gnus,and gnats diff -ruNp m4-1.4.10/checks/072.shift m4-1.4.11/checks/072.shift --- m4-1.4.10/checks/072.shift 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/072.shift 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,17 @@ +dnl @ ../doc/m4.texinfo:3037: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`argn', `ifelse(`$1', 1, ``$2'', + `argn(decr(`$1'), shift(shift($@)))')') +dnl @result{} +argn(`1', `a') +dnl @result{}a +define(`foo', `argn(`11', $@)') +dnl @result{} +foo(`a', `b', `c', `d', `e', `f', `g', `h', `i', `j', `k', `l') +dnl @result{}k diff -ruNp m4-1.4.10/checks/072.trace m4-1.4.11/checks/072.trace --- m4-1.4.10/checks/072.trace 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/072.trace 1969-12-31 17:00:00.000000000 -0700 @@ -1,18 +0,0 @@ -dnl @ ../doc/m4.texinfo:3024: Origin of test -dnl @ expected status: 1 -dnl @ extra options: -dp -L3 -tifelse -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -ifelse(`one level') -dnl @error{}m4trace: -1- ifelse -dnl @result{} -ifelse(ifelse(ifelse(`three levels'))) -dnl @error{}m4trace: -3- ifelse -dnl @error{}m4trace: -2- ifelse -dnl @error{}m4trace: -1- ifelse -dnl @result{} -ifelse(ifelse(ifelse(ifelse(`four levels')))) -dnl @error{}m4:stdin:3: recursion limit of 3 exceeded, use -L<N> to change it diff -ruNp m4-1.4.10/checks/073.forloop m4-1.4.11/checks/073.forloop --- m4-1.4.10/checks/073.forloop 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/073.forloop 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:3069: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +include(`forloop.m4') +dnl @result{} +forloop(`i', `1', `8', `i ') +dnl @result{}1 2 3 4 5 6 7 8 diff -ruNp m4-1.4.10/checks/073.trace m4-1.4.11/checks/073.trace --- m4-1.4.10/checks/073.trace 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/073.trace 1969-12-31 17:00:00.000000000 -0700 @@ -1,35 +0,0 @@ -dnl @ ../doc/m4.texinfo:3042: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -traceoff(`foo') -dnl @result{} -traceon(`foo') -dnl @result{} -foo -dnl @result{}foo -define(`foo', `bar') -dnl @result{} -foo -dnl @error{}m4trace: -1- foo -> `bar' -dnl @result{}bar -undefine(`foo') -dnl @result{} -ifdef(`foo', `yes', `no') -dnl @result{}no -indir(`foo') -dnl @error{}m4:stdin:8: undefined macro `foo' -dnl @result{} -define(`foo', `blah') -dnl @result{} -foo -dnl @error{}m4trace: -1- foo -> `blah' -dnl @result{}blah -traceoff -dnl @result{} -foo -dnl @result{}blah diff -ruNp m4-1.4.10/checks/074.forloop m4-1.4.11/checks/074.forloop --- m4-1.4.10/checks/074.forloop 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/074.forloop 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,17 @@ +dnl @ ../doc/m4.texinfo:3080: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +include(`forloop.m4') +dnl @result{} +forloop(`i', `1', `4', `forloop(`j', `1', `8', ` (i, j)') +') +dnl @result{} (1, 1) (1, 2) (1, 3) (1, 4) (1, 5) (1, 6) (1, 7) (1, 8) +dnl @result{} (2, 1) (2, 2) (2, 3) (2, 4) (2, 5) (2, 6) (2, 7) (2, 8) +dnl @result{} (3, 1) (3, 2) (3, 3) (3, 4) (3, 5) (3, 6) (3, 7) (3, 8) +dnl @result{} (4, 1) (4, 2) (4, 3) (4, 4) (4, 5) (4, 6) (4, 7) (4, 8) +dnl @result{} diff -ruNp m4-1.4.10/checks/074.trace m4-1.4.11/checks/074.trace --- m4-1.4.10/checks/074.trace 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/074.trace 1969-12-31 17:00:00.000000000 -0700 @@ -1,20 +0,0 @@ -dnl @ ../doc/m4.texinfo:3076: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -traceon(`eval', `m4_divnum') -dnl @result{} -define(`m4_eval', defn(`eval')) -dnl @result{} -define(`m4_divnum', defn(`divnum')) -dnl @result{} -eval(divnum) -dnl @error{}m4trace: -1- eval(`0') -> `0' -dnl @result{}0 -m4_eval(m4_divnum) -dnl @error{}m4trace: -2- m4_divnum -> `0' -dnl @result{}0 diff -ruNp m4-1.4.10/checks/075.debug_leve m4-1.4.11/checks/075.debug_leve --- m4-1.4.10/checks/075.debug_leve 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/075.debug_leve 1969-12-31 17:00:00.000000000 -0700 @@ -1,27 +0,0 @@ -dnl @ ../doc/m4.texinfo:3185: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dp -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`foo', `FOO') -dnl @result{} -traceon(`foo') -dnl @result{} -debugmode() -dnl @result{} -foo -dnl @error{}m4trace: -1- foo -> `FOO' -dnl @result{}FOO -debugmode -dnl @result{} -foo -dnl @error{}m4trace: -1- foo -dnl @result{}FOO -debugmode(`+l') -dnl @result{} -foo -dnl @error{}m4trace:8: -1- foo -dnl @result{}FOO diff -ruNp m4-1.4.10/checks/075.forloop m4-1.4.11/checks/075.forloop --- m4-1.4.10/checks/075.forloop 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/075.forloop 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,15 @@ +dnl @ ../doc/m4.texinfo:3108: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +undivert(`forloop.m4')dnl +dnl @result{}divert(`-1') +dnl @result{}# forloop(var, from, to, stmt) - simple version +dnl @result{}define(`forloop', `pushdef(`$1', `$2')_forloop($@)popdef(`$1')') +dnl @result{}define(`_forloop', +dnl @result{} `$4`'ifelse($1, `$3', `', `define(`$1', incr($1))$0($@)')') +dnl @result{}divert`'dnl diff -ruNp m4-1.4.10/checks/076.debug_outp m4-1.4.11/checks/076.debug_outp --- m4-1.4.10/checks/076.debug_outp 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/076.debug_outp 1969-12-31 17:00:00.000000000 -0700 @@ -1,24 +0,0 @@ -dnl @ ../doc/m4.texinfo:3231: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -traceon(`divnum') -dnl @result{} -divnum(`extra') -dnl @error{}m4:stdin:2: Warning: excess arguments to builtin `divnum' ignored -dnl @error{}m4trace: -1- divnum(`extra') -> `0' -dnl @result{}0 -debugfile() -dnl @result{} -divnum(`extra') -dnl @error{}m4:stdin:4: Warning: excess arguments to builtin `divnum' ignored -dnl @result{}0 -debugfile -dnl @result{} -divnum -dnl @error{}m4trace: -1- divnum -> `0' -dnl @result{}0 diff -ruNp m4-1.4.10/checks/076.foreach m4-1.4.11/checks/076.foreach --- m4-1.4.10/checks/076.foreach 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/076.foreach 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,22 @@ +dnl @ ../doc/m4.texinfo:3155: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +include(`foreach.m4') +dnl @result{} +foreach(`x', (foo, bar, foobar), `Word was: x +')dnl +dnl @result{}Word was: foo +dnl @result{}Word was: bar +dnl @result{}Word was: foobar +include(`foreachq.m4') +dnl @result{} +foreachq(`x', `foo, bar, foobar', `Word was: x +')dnl +dnl @result{}Word was: foo +dnl @result{}Word was: bar +dnl @result{}Word was: foobar diff -ruNp m4-1.4.10/checks/077.dnl m4-1.4.11/checks/077.dnl --- m4-1.4.10/checks/077.dnl 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/077.dnl 1969-12-31 17:00:00.000000000 -0700 @@ -1,11 +0,0 @@ -dnl @ ../doc/m4.texinfo:3284: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`foo', `Macro `foo'.')dnl A very simple macro, indeed. -foo -dnl @result{}Macro foo. diff -ruNp m4-1.4.10/checks/077.foreach m4-1.4.11/checks/077.foreach --- m4-1.4.10/checks/077.foreach 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/077.foreach 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,26 @@ +dnl @ ../doc/m4.texinfo:3178: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +include(`foreach.m4') +dnl @result{} +define(`_case', ` $1) + $2=" $1";; +')dnl +define(`_cat', `$1$2')dnl +case $`'1 in +dnl @result{}case $1 in +foreach(`x', `(`(`a', `vara')', `(`b', `varb')', `(`c', `varc')')', + `_cat(`_case', x)')dnl +dnl @result{} a) +dnl @result{} vara=" a";; +dnl @result{} b) +dnl @result{} varb=" b";; +dnl @result{} c) +dnl @result{} varc=" c";; +esac +dnl @result{}esac diff -ruNp m4-1.4.10/checks/078.dnl m4-1.4.11/checks/078.dnl --- m4-1.4.10/checks/078.dnl 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/078.dnl 1969-12-31 17:00:00.000000000 -0700 @@ -1,13 +0,0 @@ -dnl @ ../doc/m4.texinfo:3302: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -dnl(`args are ignored, but side effects occur', -define(`foo', `like this')) while this text is ignored: undefine(`foo') -dnl @error{}m4:stdin:1: Warning: excess arguments to builtin `dnl' ignored -See how `foo' was defined, foo? -dnl @result{}See how foo was defined, like this? diff -ruNp m4-1.4.10/checks/078.foreach m4-1.4.11/checks/078.foreach --- m4-1.4.10/checks/078.foreach 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/078.foreach 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,17 @@ +dnl @ ../doc/m4.texinfo:3208: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +undivert(`foreach.m4')dnl +dnl @result{}divert(`-1') +dnl @result{}# foreach(x, (item_1, item_2, ..., item_n), stmt) +dnl @result{}# parenthesized list, simple version +dnl @result{}define(`foreach', `pushdef(`$1')_foreach($@)popdef(`$1')') +dnl @result{}define(`_arg1', `$1') +dnl @result{}define(`_foreach', `ifelse(`$2', `()', `', +dnl @result{} `define(`$1', _arg1$2)$3`'$0(`$1', (shift$2), `$3')')') +dnl @result{}divert`'dnl diff -ruNp m4-1.4.10/checks/079.dnl m4-1.4.11/checks/079.dnl --- m4-1.4.10/checks/079.dnl 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/079.dnl 1969-12-31 17:00:00.000000000 -0700 @@ -1,15 +0,0 @@ -dnl @ ../doc/m4.texinfo:3313: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -m4wrap(`m4wrap(`2 hi -')0 hi dnl 1 hi') -dnl @result{} -define(`hi', `HI') -dnl @result{} -dnl @error{}m4:stdin:1: Warning: end of file treated as newline -dnl @result{}0 HI 2 HI diff -ruNp m4-1.4.10/checks/079.foreach m4-1.4.11/checks/079.foreach --- m4-1.4.10/checks/079.foreach 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/079.foreach 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,26 @@ +dnl @ ../doc/m4.texinfo:3235: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`a', `1')define(`b', `2')define(`c', `3') +dnl @result{} +include(`foreach.m4') +dnl @result{} +include(`foreachq.m4') +dnl @result{} +foreach(`x', `(``a'', ``(b'', ``c)'')', `x +') +dnl @result{}1 +dnl @result{}(2)1 +dnl @result{} +dnl @result{}, x +dnl @result{}) +foreachq(`x', ```a'', ``(b'', ``c)''', `x +')dnl +dnl @result{}a +dnl @result{}(b +dnl @result{}c) diff -ruNp m4-1.4.10/checks/080.changequot m4-1.4.11/checks/080.changequot --- m4-1.4.10/checks/080.changequot 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/080.changequot 1969-12-31 17:00:00.000000000 -0700 @@ -1,14 +0,0 @@ -dnl @ ../doc/m4.texinfo:3344: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -changequote(`[', `]') -dnl @result{} -define([foo], [Macro [foo].]) -dnl @result{} -foo -dnl @result{}Macro foo. diff -ruNp m4-1.4.10/checks/080.foreach m4-1.4.11/checks/080.foreach --- m4-1.4.10/checks/080.foreach 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/080.foreach 2008-03-29 20:51:21.000000000 -0600 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:3260: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +undivert(`foreachq.m4')dnl +dnl @result{}include(`quote.m4')dnl +dnl @result{}divert(`-1') +dnl @result{}# foreachq(x, `item_1, item_2, ..., item_n', stmt) +dnl @result{}# quoted list, simple version +dnl @result{}define(`foreachq', `pushdef(`$1')_foreachq($@)popdef(`$1')') +dnl @result{}define(`_arg1', `$1') +dnl @result{}define(`_foreachq', `ifelse(quote($2), `', `', +dnl @result{} `define(`$1', `_arg1($2)')$3`'$0(`$1', `shift($2)', `$3')')') +dnl @result{}divert`'dnl diff -ruNp m4-1.4.10/checks/081.changequot m4-1.4.11/checks/081.changequot --- m4-1.4.10/checks/081.changequot 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/081.changequot 1969-12-31 17:00:00.000000000 -0700 @@ -1,16 +0,0 @@ -dnl @ ../doc/m4.texinfo:3359: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`a', `b') -dnl @result{} -«a» -dnl @result{}«b» -changequote(`«', `»') -dnl @result{} -«a» -dnl @result{}a diff -ruNp m4-1.4.10/checks/081.foreach m4-1.4.11/checks/081.foreach --- m4-1.4.10/checks/081.foreach 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/081.foreach 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:3287: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +include(`foreach.m4')include(`foreachq.m4') +dnl @result{} +foreach(`name', `(`a', `b')', ` defn(`name')') +dnl @result{} a b +foreachq(`name', ``a', `b'', ` defn(`name')') +dnl @result{} _arg1(`a', `b') _arg1(shift(`a', `b')) diff -ruNp m4-1.4.10/checks/082.changequot m4-1.4.11/checks/082.changequot --- m4-1.4.10/checks/082.changequot 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/082.changequot 1969-12-31 17:00:00.000000000 -0700 @@ -1,14 +0,0 @@ -dnl @ ../doc/m4.texinfo:3374: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -changequote(`[[[', `]]]') -dnl @result{} -define([[[foo]]], [[[Macro [[[[[foo]]]]].]]]) -dnl @result{} -foo -dnl @result{}Macro [[foo]]. diff -ruNp m4-1.4.10/checks/082.dumpdef m4-1.4.11/checks/082.dumpdef --- m4-1.4.10/checks/082.dumpdef 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/082.dumpdef 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:3338: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `Hello world.') +dnl @result{} +dumpdef(`foo') +dnl @error{}foo: `Hello world.' +dnl @result{} +dumpdef(`define') +dnl @error{}define: <define> +dnl @result{} diff -ruNp m4-1.4.10/checks/083.changequot m4-1.4.11/checks/083.changequot --- m4-1.4.10/checks/083.changequot 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/083.changequot 1969-12-31 17:00:00.000000000 -0700 @@ -1,20 +0,0 @@ -dnl @ ../doc/m4.texinfo:3396: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`foo', `Macro `FOO'.') -dnl @result{} -changequote(`', `') -dnl @result{} -foo -dnl @result{}Macro `FOO'. -`foo' -dnl @result{}`Macro `FOO'.' -changequote(`,) -dnl @result{} -foo -dnl @result{}Macro FOO. diff -ruNp m4-1.4.10/checks/083.dumpdef m4-1.4.11/checks/083.dumpdef --- m4-1.4.10/checks/083.dumpdef 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/083.dumpdef 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:3355: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +pushdef(`f', ``$0'1')pushdef(`f', ``$0'2') +dnl @result{} +f(popdef(`f')dumpdef(`f')) +dnl @error{}f: ``$0'1' +dnl @result{}f2 +f(popdef(`f')dumpdef(`f')) +dnl @error{}m4:stdin:3: undefined macro `f' +dnl @result{}f1 diff -ruNp m4-1.4.10/checks/084.changequot m4-1.4.11/checks/084.changequot --- m4-1.4.10/checks/084.changequot 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/084.changequot 1969-12-31 17:00:00.000000000 -0700 @@ -1,32 +0,0 @@ -dnl @ ../doc/m4.texinfo:3429: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`echo', `$@') -dnl @result{} -define(`hi', `HI') -dnl @result{} -changequote(`q', `Q') -dnl @result{} -q hi Q hi -dnl @result{}q HI Q HI -echo(hi) -dnl @result{}qHIQ -changequote -dnl @result{} -changequote(`-', `EOF') -dnl @result{} -- hi EOF hi -dnl @result{} hi HI -changequote -dnl @result{} -changequote(`1', `2') -dnl @result{} -hi1hi2 -dnl @result{}hi1hi2 -hi 1hi2 -dnl @result{}HI hi diff -ruNp m4-1.4.10/checks/084.trace m4-1.4.11/checks/084.trace --- m4-1.4.10/checks/084.trace 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/084.trace 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,20 @@ +dnl @ ../doc/m4.texinfo:3398: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `Hello World.') +dnl @result{} +define(`echo', `$@') +dnl @result{} +traceon(`foo', `echo') +dnl @result{} +foo +dnl @error{}m4trace: -1- foo -> `Hello World.' +dnl @result{}Hello World. +echo(`gnus', `and gnats') +dnl @error{}m4trace: -1- echo(`gnus', `and gnats') -> ``gnus',`and gnats'' +dnl @result{}gnus,and gnats diff -ruNp m4-1.4.10/checks/085.changequot m4-1.4.11/checks/085.changequot --- m4-1.4.10/checks/085.changequot 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/085.changequot 1969-12-31 17:00:00.000000000 -0700 @@ -1,30 +0,0 @@ -dnl @ ../doc/m4.texinfo:3462: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`echo', `$#:$@:') -dnl @result{} -define(`hi', `HI') -dnl @result{} -changequote(`(',`)') -dnl @result{} -echo(hi) -dnl @result{}0::hi -changequote -dnl @result{} -changequote(`((', `))') -dnl @result{} -echo(hi) -dnl @result{}1:HI: -echo((hi)) -dnl @result{}0::hi -changequote -dnl @result{} -changequote(`,', `)') -dnl @result{} -echo(hi,hi)bye) -dnl @result{}1:HIhibye: diff -ruNp m4-1.4.10/checks/085.trace m4-1.4.11/checks/085.trace --- m4-1.4.10/checks/085.trace 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/085.trace 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:3426: Origin of test +dnl @ expected status: 1 +dnl @ extra options: -dp -L3 -tifelse +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +ifelse(`one level') +dnl @error{}m4trace: -1- ifelse +dnl @result{} +ifelse(ifelse(ifelse(`three levels'))) +dnl @error{}m4trace: -3- ifelse +dnl @error{}m4trace: -2- ifelse +dnl @error{}m4trace: -1- ifelse +dnl @result{} +ifelse(ifelse(ifelse(ifelse(`four levels')))) +dnl @error{}m4:stdin:3: recursion limit of 3 exceeded, use -L<N> to change it diff -ruNp m4-1.4.10/checks/086.changequot m4-1.4.11/checks/086.changequot --- m4-1.4.10/checks/086.changequot 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/086.changequot 1969-12-31 17:00:00.000000000 -0700 @@ -1,26 +0,0 @@ -dnl @ ../doc/m4.texinfo:3494: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`hi', `HI') -dnl @result{} -changequote(`""', `"') -dnl @result{} -""hi"""hi" -dnl @result{}hihi -""hi" ""hi" -dnl @result{}hi hi -""hi"" "hi" -dnl @result{}hi" "HI" -changequote -dnl @result{} -`hi`hi'hi' -dnl @result{}hi`hi'hi -changequote(`"', `"') -dnl @result{} -"hi"hi"hi" -dnl @result{}hiHIhi diff -ruNp m4-1.4.10/checks/086.trace m4-1.4.11/checks/086.trace --- m4-1.4.10/checks/086.trace 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/086.trace 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,35 @@ +dnl @ ../doc/m4.texinfo:3444: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +traceoff(`foo') +dnl @result{} +traceon(`foo') +dnl @result{} +foo +dnl @result{}foo +define(`foo', `bar') +dnl @result{} +foo +dnl @error{}m4trace: -1- foo -> `bar' +dnl @result{}bar +undefine(`foo') +dnl @result{} +ifdef(`foo', `yes', `no') +dnl @result{}no +indir(`foo') +dnl @error{}m4:stdin:8: undefined macro `foo' +dnl @result{} +define(`foo', `blah') +dnl @result{} +foo +dnl @error{}m4trace: -1- foo -> `blah' +dnl @result{}blah +traceoff +dnl @result{} +foo +dnl @result{}blah diff -ruNp m4-1.4.10/checks/087.changequot m4-1.4.11/checks/087.changequot --- m4-1.4.10/checks/087.changequot 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/087.changequot 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -dnl @ ../doc/m4.texinfo:3518: Origin of test -dnl @ expected status: 1 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -`hello world' -dnl @result{}hello world -`dangling quote -dnl @error{}m4:stdin:2: ERROR: end of file in string diff -ruNp m4-1.4.10/checks/087.trace m4-1.4.11/checks/087.trace --- m4-1.4.10/checks/087.trace 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/087.trace 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,20 @@ +dnl @ ../doc/m4.texinfo:3478: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +traceon(`eval', `m4_divnum') +dnl @result{} +define(`m4_eval', defn(`eval')) +dnl @result{} +define(`m4_divnum', defn(`divnum')) +dnl @result{} +eval(divnum) +dnl @error{}m4trace: -1- eval(`0') -> `0' +dnl @result{}0 +m4_eval(m4_divnum) +dnl @error{}m4trace: -2- m4_divnum -> `0' +dnl @result{}0 diff -ruNp m4-1.4.10/checks/088.changecom m4-1.4.11/checks/088.changecom --- m4-1.4.10/checks/088.changecom 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/088.changecom 1969-12-31 17:00:00.000000000 -0700 @@ -1,18 +0,0 @@ -dnl @ ../doc/m4.texinfo:3545: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`comment', `COMMENT') -dnl @result{} -# A normal comment -dnl @result{}# A normal comment -changecom(`/*', `*/') -dnl @result{} -# Not a comment anymore -dnl @result{}# Not a COMMENT anymore -But: /* this is a comment now */ while this is not a comment -dnl @result{}But: /* this is a comment now */ while this is not a COMMENT diff -ruNp m4-1.4.10/checks/088.debug_leve m4-1.4.11/checks/088.debug_leve --- m4-1.4.10/checks/088.debug_leve 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/088.debug_leve 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,27 @@ +dnl @ ../doc/m4.texinfo:3588: Origin of test +dnl @ expected status: 0 +dnl @ extra options: -dp +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `FOO') +dnl @result{} +traceon(`foo') +dnl @result{} +debugmode() +dnl @result{} +foo +dnl @error{}m4trace: -1- foo -> `FOO' +dnl @result{}FOO +debugmode +dnl @result{} +foo +dnl @error{}m4trace: -1- foo +dnl @result{}FOO +debugmode(`+l') +dnl @result{} +foo +dnl @error{}m4trace:8: -1- foo +dnl @result{}FOO diff -ruNp m4-1.4.10/checks/089.changecom m4-1.4.11/checks/089.changecom --- m4-1.4.10/checks/089.changecom 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/089.changecom 1969-12-31 17:00:00.000000000 -0700 @@ -1,18 +0,0 @@ -dnl @ ../doc/m4.texinfo:3572: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`comment', `COMMENT') -dnl @result{} -changecom -dnl @result{} -# Not a comment anymore -dnl @result{}# Not a COMMENT anymore -changecom(`#', `') -dnl @result{} -# comment again -dnl @result{}# comment again diff -ruNp m4-1.4.10/checks/089.debug_outp m4-1.4.11/checks/089.debug_outp --- m4-1.4.10/checks/089.debug_outp 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/089.debug_outp 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,24 @@ +dnl @ ../doc/m4.texinfo:3634: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +traceon(`divnum') +dnl @result{} +divnum(`extra') +dnl @error{}m4:stdin:2: Warning: excess arguments to builtin `divnum' ignored +dnl @error{}m4trace: -1- divnum(`extra') -> `0' +dnl @result{}0 +debugfile() +dnl @result{} +divnum(`extra') +dnl @error{}m4:stdin:4: Warning: excess arguments to builtin `divnum' ignored +dnl @result{}0 +debugfile +dnl @result{} +divnum +dnl @error{}m4trace: -1- divnum -> `0' +dnl @result{}0 diff -ruNp m4-1.4.10/checks/090.changecom m4-1.4.11/checks/090.changecom --- m4-1.4.10/checks/090.changecom 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/090.changecom 1969-12-31 17:00:00.000000000 -0700 @@ -1,16 +0,0 @@ -dnl @ ../doc/m4.texinfo:3591: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`a', `b') -dnl @result{} -«a» -dnl @result{}«b» -changecom(`«', `»') -dnl @result{} -«a» -dnl @result{}«a» diff -ruNp m4-1.4.10/checks/090.dnl m4-1.4.11/checks/090.dnl --- m4-1.4.10/checks/090.dnl 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/090.dnl 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,11 @@ +dnl @ ../doc/m4.texinfo:3687: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `Macro `foo'.')dnl A very simple macro, indeed. +foo +dnl @result{}Macro foo. diff -ruNp m4-1.4.10/checks/091.changecom m4-1.4.11/checks/091.changecom --- m4-1.4.10/checks/091.changecom 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/091.changecom 1969-12-31 17:00:00.000000000 -0700 @@ -1,22 +0,0 @@ -dnl @ ../doc/m4.texinfo:3614: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`hi', `HI') -dnl @result{} -define(`hi1hi2', `hello') -dnl @result{} -changecom(`q', `Q') -dnl @result{} -q hi Q hi -dnl @result{}q hi Q HI -changecom(`1', `2') -dnl @result{} -hi1hi2 -dnl @result{}hello -hi 1hi2 -dnl @result{}HI 1hi2 diff -ruNp m4-1.4.10/checks/091.dnl m4-1.4.11/checks/091.dnl --- m4-1.4.10/checks/091.dnl 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/091.dnl 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,13 @@ +dnl @ ../doc/m4.texinfo:3705: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +dnl(`args are ignored, but side effects occur', +define(`foo', `like this')) while this text is ignored: undefine(`foo') +dnl @error{}m4:stdin:1: Warning: excess arguments to builtin `dnl' ignored +See how `foo' was defined, foo? +dnl @result{}See how foo was defined, like this? diff -ruNp m4-1.4.10/checks/092.changecom m4-1.4.11/checks/092.changecom --- m4-1.4.10/checks/092.changecom 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/092.changecom 1969-12-31 17:00:00.000000000 -0700 @@ -1,28 +0,0 @@ -dnl @ ../doc/m4.texinfo:3637: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`echo', `$#:$@:') -dnl @result{} -define(`hi', `HI') -dnl @result{} -changecom(`(',`)') -dnl @result{} -echo(hi) -dnl @result{}0::(hi) -changecom -dnl @result{} -changecom(`((', `))') -dnl @result{} -echo(hi) -dnl @result{}1:HI: -echo((hi)) -dnl @result{}0::((hi)) -changecom(`,', `)') -dnl @result{} -echo(hi,hi)bye) -dnl @result{}1:HI,hi)bye: diff -ruNp m4-1.4.10/checks/092.dnl m4-1.4.11/checks/092.dnl --- m4-1.4.10/checks/092.dnl 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/092.dnl 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,15 @@ +dnl @ ../doc/m4.texinfo:3716: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +m4wrap(`m4wrap(`2 hi +')0 hi dnl 1 hi') +dnl @result{} +define(`hi', `HI') +dnl @result{} +dnl @error{}m4:stdin:1: Warning: end of file treated as newline +dnl @result{}0 HI 2 HI diff -ruNp m4-1.4.10/checks/093.changecom m4-1.4.11/checks/093.changecom --- m4-1.4.10/checks/093.changecom 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/093.changecom 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -dnl @ ../doc/m4.texinfo:3663: Origin of test -dnl @ expected status: 1 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -changecom(`/*', `*/') -dnl @result{} -/*dangling comment -dnl @error{}m4:stdin:2: ERROR: end of file in comment diff -ruNp m4-1.4.10/checks/093.changequot m4-1.4.11/checks/093.changequot --- m4-1.4.10/checks/093.changequot 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/093.changequot 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:3747: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +changequote(`[', `]') +dnl @result{} +define([foo], [Macro [foo].]) +dnl @result{} +foo +dnl @result{}Macro foo. diff -ruNp m4-1.4.10/checks/094.changequot m4-1.4.11/checks/094.changequot --- m4-1.4.10/checks/094.changequot 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/094.changequot 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:3762: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`a', `b') +dnl @result{} +«a» +dnl @result{}«b» +changequote(`«', `»') +dnl @result{} +«a» +dnl @result{}a diff -ruNp m4-1.4.10/checks/094.changeword m4-1.4.11/checks/094.changeword --- m4-1.4.10/checks/094.changeword 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/094.changeword 1969-12-31 17:00:00.000000000 -0700 @@ -1,14 +0,0 @@ -dnl @ ../doc/m4.texinfo:3716: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -ifdef(`changeword', `', `errprint(` skipping: no changeword support -')m4exit(`77')')dnl -changeword(`[_a-zA-Z0-9]+') -dnl @result{} -define(`1', `0')1 -dnl @result{}0 diff -ruNp m4-1.4.10/checks/095.changequot m4-1.4.11/checks/095.changequot --- m4-1.4.10/checks/095.changequot 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/095.changequot 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:3777: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +changequote(`[[[', `]]]') +dnl @result{} +define([[[foo]]], [[[Macro [[[[[foo]]]]].]]]) +dnl @result{} +foo +dnl @result{}Macro [[foo]]. diff -ruNp m4-1.4.10/checks/095.changeword m4-1.4.11/checks/095.changeword --- m4-1.4.10/checks/095.changeword 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/095.changeword 1969-12-31 17:00:00.000000000 -0700 @@ -1,19 +0,0 @@ -dnl @ ../doc/m4.texinfo:3729: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -ifdef(`changeword', `', `errprint(` skipping: no changeword support -')m4exit(`77')')dnl -define(`_indir', defn(`indir')) -dnl @result{} -changeword(`_[_a-zA-Z0-9]*') -dnl @result{} -esyscmd(`foo') -dnl @result{}esyscmd(foo) -_indir(`esyscmd', `echo hi') -dnl @result{}hi -dnl @result{} diff -ruNp m4-1.4.10/checks/096.changequot m4-1.4.11/checks/096.changequot --- m4-1.4.10/checks/096.changequot 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/096.changequot 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,20 @@ +dnl @ ../doc/m4.texinfo:3799: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `Macro `FOO'.') +dnl @result{} +changequote(`', `') +dnl @result{} +foo +dnl @result{}Macro `FOO'. +`foo' +dnl @result{}`Macro `FOO'.' +changequote(`,) +dnl @result{} +foo +dnl @result{}Macro FOO. diff -ruNp m4-1.4.10/checks/096.changeword m4-1.4.11/checks/096.changeword --- m4-1.4.10/checks/096.changeword 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/096.changeword 1969-12-31 17:00:00.000000000 -0700 @@ -1,40 +0,0 @@ -dnl @ ../doc/m4.texinfo:3748: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -ifdef(`changeword', `', `errprint(` skipping: no changeword support -')m4exit(`77')')dnl -define(`foo -', `bar -') -dnl @result{} -dnl This example wants to recognize changeword, dnl, and `foo\n'. -dnl First, we check that our regexp will match. -regexp(`changeword', `[cd][a-z]*\|foo[ -]') -dnl @result{}0 -regexp(`foo -', `[cd][a-z]*\|foo[ -]') -dnl @result{}0 -regexp(`f', `[cd][a-z]*\|foo[ -]') -dnl @result{}-1 -foo -dnl @result{}foo -changeword(`[cd][a-z]*\|foo[ -]') -dnl @result{} -dnl Even though `foo\n' matches, we forgot to allow `f'. -foo -dnl @result{}foo -changeword(`[cd][a-z]*\|fo*[ -]?') -dnl @result{} -dnl Now we can call `foo\n'. -foo -dnl @result{}bar diff -ruNp m4-1.4.10/checks/097.changequot m4-1.4.11/checks/097.changequot --- m4-1.4.10/checks/097.changequot 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/097.changequot 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,32 @@ +dnl @ ../doc/m4.texinfo:3832: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`echo', `$@') +dnl @result{} +define(`hi', `HI') +dnl @result{} +changequote(`q', `Q') +dnl @result{} +q hi Q hi +dnl @result{}q HI Q HI +echo(hi) +dnl @result{}qHIQ +changequote +dnl @result{} +changequote(`-', `EOF') +dnl @result{} +- hi EOF hi +dnl @result{} hi HI +changequote +dnl @result{} +changequote(`1', `2') +dnl @result{} +hi1hi2 +dnl @result{}hi1hi2 +hi 1hi2 +dnl @result{}HI hi diff -ruNp m4-1.4.10/checks/097.changeword m4-1.4.11/checks/097.changeword --- m4-1.4.10/checks/097.changeword 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/097.changeword 1969-12-31 17:00:00.000000000 -0700 @@ -1,38 +0,0 @@ -dnl @ ../doc/m4.texinfo:3790: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -ifdef(`changeword', `', `errprint(` skipping: no changeword support -')m4exit(`77')')dnl -define(`bar -', defn(`dnl'))dnl -define(`baz', `dnl -include(`foo') ignored -dnl')dnl -changeword(`\([_a-zA-Z][_a-zA-Z0-9]*\|bar -\)') -dnl @result{} -__file__:__line__ -dnl @result{}stdin:10 -include(`foo') ignored -__file__:__line__ -dnl @result{}stdin:12 -baz ignored -__file__:__line__ -dnl @result{}stdin:14 -define(`bar -', defn(`__file__')) -dnl @result{} -include(`foo') -dnl @result{}../examples/foo -define(`bar -', defn(`__line__')) -dnl @result{} -include(`foo') -dnl @result{}1 -__file__:__line__ -dnl @result{}stdin:21 diff -ruNp m4-1.4.10/checks/098.changequot m4-1.4.11/checks/098.changequot --- m4-1.4.10/checks/098.changequot 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/098.changequot 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,30 @@ +dnl @ ../doc/m4.texinfo:3865: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`echo', `$#:$@:') +dnl @result{} +define(`hi', `HI') +dnl @result{} +changequote(`(',`)') +dnl @result{} +echo(hi) +dnl @result{}0::hi +changequote +dnl @result{} +changequote(`((', `))') +dnl @result{} +echo(hi) +dnl @result{}1:HI: +echo((hi)) +dnl @result{}0::hi +changequote +dnl @result{} +changequote(`,', `)') +dnl @result{} +echo(hi,hi)bye) +dnl @result{}1:HIhibye: diff -ruNp m4-1.4.10/checks/098.changeword m4-1.4.11/checks/098.changeword --- m4-1.4.10/checks/098.changeword 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/098.changeword 1969-12-31 17:00:00.000000000 -0700 @@ -1,20 +0,0 @@ -dnl @ ../doc/m4.texinfo:3828: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -ifdef(`changeword', `', `errprint(` skipping: no changeword support -')m4exit(`77')')dnl -ifdef(`__unix__', , - `errprint(` skipping: syscmd does not have unix semantics -')m4exit(`77')')dnl -changecom(`/*', `*/')dnl -define(`foo', `bar')dnl -changeword(`#\([_a-zA-Z0-9]*\)') -dnl @result{} -#esyscmd(`echo foo \#foo') -dnl @result{}foo bar -dnl @result{} diff -ruNp m4-1.4.10/checks/099.changequot m4-1.4.11/checks/099.changequot --- m4-1.4.10/checks/099.changequot 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/099.changequot 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,19 @@ +dnl @ ../doc/m4.texinfo:3904: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +changequote(`[', `]')dnl +define([a], [1, (b)])dnl +define([b], [2])dnl +define([quote], [[$*]])dnl +define([expand], [_$0(($1))])dnl +define([_expand], + [changequote([(], [)])$1changequote`'changequote(`[', `]')])dnl +expand([a, a, [a, a], [[a, a]]]) +dnl @result{}1, (2), 1, (2), a, a, [a, a] +quote(a, a, [a, a], [[a, a]]) +dnl @result{}1,(2),1,(2),a, a,[a, a] diff -ruNp m4-1.4.10/checks/099.changeword m4-1.4.11/checks/099.changeword --- m4-1.4.10/checks/099.changeword 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/099.changeword 1969-12-31 17:00:00.000000000 -0700 @@ -1,15 +0,0 @@ -dnl @ ../doc/m4.texinfo:3865: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -ifdef(`changeword', `', `errprint(` skipping: no changeword support -')m4exit(`77')')dnl -define(`a', `errprint(`Hello')')dnl -changeword(`@\([_a-zA-Z0-9]*\)') -dnl @result{} -@a -dnl @result{}errprint(Hello) diff -ruNp m4-1.4.10/checks/100.changequot m4-1.4.11/checks/100.changequot --- m4-1.4.10/checks/100.changequot 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/100.changequot 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,26 @@ +dnl @ ../doc/m4.texinfo:3925: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`hi', `HI') +dnl @result{} +changequote(`""', `"') +dnl @result{} +""hi"""hi" +dnl @result{}hihi +""hi" ""hi" +dnl @result{}hi hi +""hi"" "hi" +dnl @result{}hi" "HI" +changequote +dnl @result{} +`hi`hi'hi' +dnl @result{}hi`hi'hi +changequote(`"', `"') +dnl @result{} +"hi"hi"hi" +dnl @result{}hiHIhi diff -ruNp m4-1.4.10/checks/100.m4wrap m4-1.4.11/checks/100.m4wrap --- m4-1.4.10/checks/100.m4wrap 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/100.m4wrap 1969-12-31 17:00:00.000000000 -0700 @@ -1,16 +0,0 @@ -dnl @ ../doc/m4.texinfo:3918: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`cleanup', `This is the `cleanup' action. -') -dnl @result{} -m4wrap(`cleanup') -dnl @result{} -This is the first and last normal input line. -dnl @result{}This is the first and last normal input line. -dnl @result{}This is the cleanup action. diff -ruNp m4-1.4.10/checks/101.changequot m4-1.4.11/checks/101.changequot --- m4-1.4.10/checks/101.changequot 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/101.changequot 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:3948: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`aaaaaaaaaaaaaaaaaaaa', `A')define(`q', `"$@"') +dnl @result{} +changequote(`"', `"') +dnl @result{} +q(q("aaaaaaaaaaaaaaaaaaaa", "a")) +dnl @result{}A,a diff -ruNp m4-1.4.10/checks/101.m4wrap m4-1.4.11/checks/101.m4wrap --- m4-1.4.10/checks/101.m4wrap 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/101.m4wrap 1969-12-31 17:00:00.000000000 -0700 @@ -1,15 +0,0 @@ -dnl @ ../doc/m4.texinfo:3947: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`f', `ifelse(`$1', `0', `Answer: 0!=1 -', eval(`$1>1'), `0', `Answer: $2$1=eval(`$2$1') -', `m4wrap(`f(decr(`$1'), `$2$1*')')')') -dnl @result{} -f(`10') -dnl @result{} -dnl @result{}Answer: 10*9*8*7*6*5*4*3*2*1=3628800 diff -ruNp m4-1.4.10/checks/102.changequot m4-1.4.11/checks/102.changequot --- m4-1.4.10/checks/102.changequot 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/102.changequot 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:3961: Origin of test +dnl @ expected status: 1 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +`hello world' +dnl @result{}hello world +`dangling quote +dnl @error{}m4:stdin:2: ERROR: end of file in string diff -ruNp m4-1.4.10/checks/102.m4wrap m4-1.4.11/checks/102.m4wrap --- m4-1.4.10/checks/102.m4wrap 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/102.m4wrap 1969-12-31 17:00:00.000000000 -0700 @@ -1,14 +0,0 @@ -dnl @ ../doc/m4.texinfo:3961: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`aa', `AA -') -dnl @result{} -m4wrap(`a')m4wrap(`a') -dnl @result{} -dnl @result{}AA diff -ruNp m4-1.4.10/checks/103.changecom m4-1.4.11/checks/103.changecom --- m4-1.4.10/checks/103.changecom 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/103.changecom 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:3988: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`comment', `COMMENT') +dnl @result{} +# A normal comment +dnl @result{}# A normal comment +changecom(`/*', `*/') +dnl @result{} +# Not a comment anymore +dnl @result{}# Not a COMMENT anymore +But: /* this is a comment now */ while this is not a comment +dnl @result{}But: /* this is a comment now */ while this is not a COMMENT diff -ruNp m4-1.4.10/checks/103.m4wrap m4-1.4.11/checks/103.m4wrap --- m4-1.4.10/checks/103.m4wrap 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/103.m4wrap 1969-12-31 17:00:00.000000000 -0700 @@ -1,11 +0,0 @@ -dnl @ ../doc/m4.texinfo:3976: Origin of test -dnl @ expected status: 1 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -m4wrap(`m4wrap(`)')len(abc') -dnl @result{} -dnl @error{}m4:stdin:1: ERROR: end of file in argument list diff -ruNp m4-1.4.10/checks/104.changecom m4-1.4.11/checks/104.changecom --- m4-1.4.10/checks/104.changecom 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/104.changecom 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:4015: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`comment', `COMMENT') +dnl @result{} +changecom +dnl @result{} +# Not a comment anymore +dnl @result{}# Not a COMMENT anymore +changecom(`#', `') +dnl @result{} +# comment again +dnl @result{}# comment again diff -ruNp m4-1.4.10/checks/104.include m4-1.4.11/checks/104.include --- m4-1.4.10/checks/104.include 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/104.include 1969-12-31 17:00:00.000000000 -0700 @@ -1,18 +0,0 @@ -dnl @ ../doc/m4.texinfo:4018: Origin of test -dnl @ expected status: 1 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -include(`none') -dnl @error{}m4:stdin:1: cannot open `none': No such file or directory -dnl @result{} -include() -dnl @error{}m4:stdin:2: cannot open `': No such file or directory -dnl @result{} -sinclude(`none') -dnl @result{} -sinclude() -dnl @result{} diff -ruNp m4-1.4.10/checks/105.changecom m4-1.4.11/checks/105.changecom --- m4-1.4.10/checks/105.changecom 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/105.changecom 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:4034: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`a', `b') +dnl @result{} +«a» +dnl @result{}«b» +changecom(`«', `»') +dnl @result{} +«a» +dnl @result{}«a» diff -ruNp m4-1.4.10/checks/105.include m4-1.4.11/checks/105.include --- m4-1.4.10/checks/105.include 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/105.include 1969-12-31 17:00:00.000000000 -0700 @@ -1,15 +0,0 @@ -dnl @ ../doc/m4.texinfo:4050: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`foo', `FOO') -dnl @result{} -include(`incl.m4') -dnl @result{}Include file start -dnl @result{}FOO -dnl @result{}Include file end -dnl @result{} diff -ruNp m4-1.4.10/checks/106.changecom m4-1.4.11/checks/106.changecom --- m4-1.4.10/checks/106.changecom 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/106.changecom 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,22 @@ +dnl @ ../doc/m4.texinfo:4057: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`hi', `HI') +dnl @result{} +define(`hi1hi2', `hello') +dnl @result{} +changecom(`q', `Q') +dnl @result{} +q hi Q hi +dnl @result{}q hi Q HI +changecom(`1', `2') +dnl @result{} +hi1hi2 +dnl @result{}hello +hi 1hi2 +dnl @result{}HI 1hi2 diff -ruNp m4-1.4.10/checks/106.include m4-1.4.11/checks/106.include --- m4-1.4.10/checks/106.include 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/106.include 1969-12-31 17:00:00.000000000 -0700 @@ -1,15 +0,0 @@ -dnl @ ../doc/m4.texinfo:4066: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`bar', include(`incl.m4')) -dnl @result{} -This is `bar': >>bar<< -dnl @result{}This is bar: >>Include file start -dnl @result{}foo -dnl @result{}Include file end -dnl @result{}<< diff -ruNp m4-1.4.10/checks/107.changecom m4-1.4.11/checks/107.changecom --- m4-1.4.10/checks/107.changecom 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/107.changecom 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,34 @@ +dnl @ ../doc/m4.texinfo:4080: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`echo', `$#:$*:$@:') +dnl @result{} +define(`hi', `HI') +dnl @result{} +changecom(`(',`)') +dnl @result{} +echo(hi) +dnl @result{}0:::(hi) +changecom +dnl @result{} +changecom(`((', `))') +dnl @result{} +echo(hi) +dnl @result{}1:HI:HI: +echo((hi)) +dnl @result{}0:::((hi)) +changecom(`,', `)') +dnl @result{} +echo(hi,hi)bye) +dnl @result{}1:HI,hi)bye:HI,hi)bye: +changecom +dnl @result{} +echo(hi,`,`'hi',hi) +dnl @result{}3:HI,,HI,HI:HI,,`'hi,HI: +echo(hi,`,`'hi',hi`'changecom(`,,', `hi')) +dnl @result{}3:HI,,`'hi,HI:HI,,`'hi,HI: diff -ruNp m4-1.4.10/checks/107.diversions m4-1.4.11/checks/107.diversions --- m4-1.4.10/checks/107.diversions 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/107.diversions 1969-12-31 17:00:00.000000000 -0700 @@ -1,35 +0,0 @@ -dnl @ ../doc/m4.texinfo:4138: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -divert(`-1')define(`f', `.') -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -divert`'dnl -len(f) -dnl @result{}1048576 -divert(`1') -f -divert(`-1')undivert diff -ruNp m4-1.4.10/checks/108.changecom m4-1.4.11/checks/108.changecom --- m4-1.4.10/checks/108.changecom 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/108.changecom 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:4112: Origin of test +dnl @ expected status: 1 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +changecom(`/*', `*/') +dnl @result{} +/*dangling comment +dnl @error{}m4:stdin:2: ERROR: end of file in comment diff -ruNp m4-1.4.10/checks/108.diversions m4-1.4.11/checks/108.diversions --- m4-1.4.10/checks/108.diversions 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/108.diversions 1969-12-31 17:00:00.000000000 -0700 @@ -1,35 +0,0 @@ -dnl @ ../doc/m4.texinfo:4170: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -divert(`-1')define(`f', `.') -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -divert`'dnl -len(f) -dnl @result{}1048576 -divert(`1') -f -m4exit diff -ruNp m4-1.4.10/checks/109.changeword m4-1.4.11/checks/109.changeword --- m4-1.4.10/checks/109.changeword 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/109.changeword 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:4165: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +ifdef(`changeword', `', `errprint(` skipping: no changeword support +')m4exit(`77')')dnl +changeword(`[_a-zA-Z0-9]+') +dnl @result{} +define(`1', `0')1 +dnl @result{}0 diff -ruNp m4-1.4.10/checks/109.divert m4-1.4.11/checks/109.divert --- m4-1.4.10/checks/109.divert 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/109.divert 1969-12-31 17:00:00.000000000 -0700 @@ -1,16 +0,0 @@ -dnl @ ../doc/m4.texinfo:4235: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -divert(`1') -This text is diverted. -divert -dnl @result{} -This text is not diverted. -dnl @result{}This text is not diverted. -dnl @result{} -dnl @result{}This text is diverted. diff -ruNp m4-1.4.10/checks/110.changeword m4-1.4.11/checks/110.changeword --- m4-1.4.10/checks/110.changeword 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/110.changeword 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,19 @@ +dnl @ ../doc/m4.texinfo:4178: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +ifdef(`changeword', `', `errprint(` skipping: no changeword support +')m4exit(`77')')dnl +define(`_indir', defn(`indir')) +dnl @result{} +changeword(`_[_a-zA-Z0-9]*') +dnl @result{} +esyscmd(`foo') +dnl @result{}esyscmd(foo) +_indir(`esyscmd', `echo hi') +dnl @result{}hi +dnl @result{} diff -ruNp m4-1.4.10/checks/110.divert m4-1.4.11/checks/110.divert --- m4-1.4.10/checks/110.divert 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/110.divert 1969-12-31 17:00:00.000000000 -0700 @@ -1,16 +0,0 @@ -dnl @ ../doc/m4.texinfo:4251: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`text', `TEXT') -dnl @result{} -divert(`1')`diverted text.' -divert -dnl @result{} -m4wrap(`Wrapped text precedes ') -dnl @result{} -dnl @result{}Wrapped TEXT precedes diverted text. diff -ruNp m4-1.4.10/checks/111.changeword m4-1.4.11/checks/111.changeword --- m4-1.4.10/checks/111.changeword 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/111.changeword 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,40 @@ +dnl @ ../doc/m4.texinfo:4197: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +ifdef(`changeword', `', `errprint(` skipping: no changeword support +')m4exit(`77')')dnl +define(`foo +', `bar +') +dnl @result{} +dnl This example wants to recognize changeword, dnl, and `foo\n'. +dnl First, we check that our regexp will match. +regexp(`changeword', `[cd][a-z]*\|foo[ +]') +dnl @result{}0 +regexp(`foo +', `[cd][a-z]*\|foo[ +]') +dnl @result{}0 +regexp(`f', `[cd][a-z]*\|foo[ +]') +dnl @result{}-1 +foo +dnl @result{}foo +changeword(`[cd][a-z]*\|foo[ +]') +dnl @result{} +dnl Even though `foo\n' matches, we forgot to allow `f'. +foo +dnl @result{}foo +changeword(`[cd][a-z]*\|fo*[ +]?') +dnl @result{} +dnl Now we can call `foo\n'. +foo +dnl @result{}bar diff -ruNp m4-1.4.10/checks/111.divert m4-1.4.11/checks/111.divert --- m4-1.4.10/checks/111.divert 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/111.divert 1969-12-31 17:00:00.000000000 -0700 @@ -1,13 +0,0 @@ -dnl @ ../doc/m4.texinfo:4270: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -divert(`-1') -define(`foo', `Macro `foo'.') -define(`bar', `Macro `bar'.') -divert -dnl @result{} diff -ruNp m4-1.4.10/checks/112.changeword m4-1.4.11/checks/112.changeword --- m4-1.4.10/checks/112.changeword 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/112.changeword 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,38 @@ +dnl @ ../doc/m4.texinfo:4239: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +ifdef(`changeword', `', `errprint(` skipping: no changeword support +')m4exit(`77')')dnl +define(`bar +', defn(`dnl'))dnl +define(`baz', `dnl +include(`foo') ignored +dnl')dnl +changeword(`\([_a-zA-Z][_a-zA-Z0-9]*\|bar +\)') +dnl @result{} +__file__:__line__ +dnl @result{}stdin:10 +include(`foo') ignored +__file__:__line__ +dnl @result{}stdin:12 +baz ignored +__file__:__line__ +dnl @result{}stdin:14 +define(`bar +', defn(`__file__')) +dnl @result{} +include(`foo') +dnl @result{}../examples/foo +define(`bar +', defn(`__line__')) +dnl @result{} +include(`foo') +dnl @result{}1 +__file__:__line__ +dnl @result{}stdin:21 diff -ruNp m4-1.4.10/checks/112.divert m4-1.4.11/checks/112.divert --- m4-1.4.10/checks/112.divert 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/112.divert 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -dnl @ ../doc/m4.texinfo:4284: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -divert(eval(`1<<28'))world -divert(`2')hello -dnl @result{}hello -dnl @result{}world diff -ruNp m4-1.4.10/checks/113.changeword m4-1.4.11/checks/113.changeword --- m4-1.4.10/checks/113.changeword 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/113.changeword 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,20 @@ +dnl @ ../doc/m4.texinfo:4277: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +ifdef(`changeword', `', `errprint(` skipping: no changeword support +')m4exit(`77')')dnl +ifdef(`__unix__', , + `errprint(` skipping: syscmd does not have unix semantics +')m4exit(`77')')dnl +changecom(`/*', `*/')dnl +define(`foo', `bar')dnl +changeword(`#\([_a-zA-Z0-9]*\)') +dnl @result{} +#esyscmd(`echo foo \#foo') +dnl @result{}foo bar +dnl @result{} diff -ruNp m4-1.4.10/checks/113.divert m4-1.4.11/checks/113.divert --- m4-1.4.10/checks/113.divert 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/113.divert 1969-12-31 17:00:00.000000000 -0700 @@ -1,18 +0,0 @@ -dnl @ ../doc/m4.texinfo:4299: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -We decided to divert the stream for irrigation. -dnl @result{}We decided to the stream for irrigation. -define(`divert', `ifelse(`$#', `0', ``$0'', `builtin(`$0', $@)')') -dnl @result{} -divert(`-1') -Ignored text. -divert(`0') -dnl @result{} -We decided to divert the stream for irrigation. -dnl @result{}We decided to divert the stream for irrigation. diff -ruNp m4-1.4.10/checks/114.changeword m4-1.4.11/checks/114.changeword --- m4-1.4.10/checks/114.changeword 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/114.changeword 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,15 @@ +dnl @ ../doc/m4.texinfo:4314: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +ifdef(`changeword', `', `errprint(` skipping: no changeword support +')m4exit(`77')')dnl +define(`a', `errprint(`Hello')')dnl +changeword(`@\([_a-zA-Z0-9]*\)') +dnl @result{} +@a +dnl @result{}errprint(Hello) diff -ruNp m4-1.4.10/checks/114.undivert m4-1.4.11/checks/114.undivert --- m4-1.4.10/checks/114.undivert 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/114.undivert 1969-12-31 17:00:00.000000000 -0700 @@ -1,18 +0,0 @@ -dnl @ ../doc/m4.texinfo:4333: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -divert(`1') -This text is diverted. -divert -dnl @result{} -This text is not diverted. -dnl @result{}This text is not diverted. -undivert(`1') -dnl @result{} -dnl @result{}This text is diverted. -dnl @result{} diff -ruNp m4-1.4.10/checks/115.m4wrap m4-1.4.11/checks/115.m4wrap --- m4-1.4.10/checks/115.m4wrap 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/115.m4wrap 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:4367: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`cleanup', `This is the `cleanup' action. +') +dnl @result{} +m4wrap(`cleanup') +dnl @result{} +This is the first and last normal input line. +dnl @result{}This is the first and last normal input line. +dnl @result{}This is the cleanup action. diff -ruNp m4-1.4.10/checks/115.undivert m4-1.4.11/checks/115.undivert --- m4-1.4.10/checks/115.undivert 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/115.undivert 1969-12-31 17:00:00.000000000 -0700 @@ -1,18 +0,0 @@ -dnl @ ../doc/m4.texinfo:4356: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -divert(`1')diverted text -divert -dnl @result{} -undivert() -dnl @result{} -undivert(`0') -dnl @result{} -undivert -dnl @result{}diverted text -dnl @result{} diff -ruNp m4-1.4.10/checks/116.m4wrap m4-1.4.11/checks/116.m4wrap --- m4-1.4.10/checks/116.m4wrap 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/116.m4wrap 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,25 @@ +dnl @ ../doc/m4.texinfo:4399: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +undivert(`wrapfifo.m4')dnl +dnl @result{}dnl Redefine m4wrap to have FIFO semantics. +dnl @result{}define(`_m4wrap_level', `0')dnl +dnl @result{}define(`m4wrap', +dnl @result{}`ifdef(`m4wrap'_m4wrap_level, +dnl @result{} `define(`m4wrap'_m4wrap_level, +dnl @result{} defn(`m4wrap'_m4wrap_level)`$1')', +dnl @result{} `builtin(`m4wrap', `define(`_m4wrap_level', +dnl @result{} incr(_m4wrap_level))dnl +dnl @result{}m4wrap'_m4wrap_level)dnl +dnl @result{}define(`m4wrap'_m4wrap_level, `$1')')')dnl +include(`wrapfifo.m4') +dnl @result{} +m4wrap(`a`'m4wrap(`c +', `d')')m4wrap(`b') +dnl @result{} +dnl @result{}abc diff -ruNp m4-1.4.10/checks/116.undivert m4-1.4.11/checks/116.undivert --- m4-1.4.10/checks/116.undivert 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/116.undivert 1969-12-31 17:00:00.000000000 -0700 @@ -1,20 +0,0 @@ -dnl @ ../doc/m4.texinfo:4372: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -divert(`1') -This text is diverted first. -divert(`0')undivert(`1')dnl -dnl @result{} -dnl @result{}This text is diverted first. -undivert(`1') -dnl @result{} -divert(`1') -This text is also diverted but not appended. -divert(`0')undivert(`1')dnl -dnl @result{} -dnl @result{}This text is also diverted but not appended. diff -ruNp m4-1.4.10/checks/117.m4wrap m4-1.4.11/checks/117.m4wrap --- m4-1.4.10/checks/117.m4wrap 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/117.m4wrap 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,25 @@ +dnl @ ../doc/m4.texinfo:4429: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +undivert(`wraplifo.m4')dnl +dnl @result{}dnl Redefine m4wrap to have LIFO semantics. +dnl @result{}define(`_m4wrap_level', `0')dnl +dnl @result{}define(`_m4wrap', defn(`m4wrap'))dnl +dnl @result{}define(`m4wrap', +dnl @result{}`ifdef(`m4wrap'_m4wrap_level, +dnl @result{} `define(`m4wrap'_m4wrap_level, +dnl @result{} `$1'defn(`m4wrap'_m4wrap_level))', +dnl @result{} `_m4wrap(`define(`_m4wrap_level', incr(_m4wrap_level))dnl +dnl @result{}m4wrap'_m4wrap_level)dnl +dnl @result{}define(`m4wrap'_m4wrap_level, `$1')')')dnl +include(`wraplifo.m4') +dnl @result{} +m4wrap(`a`'m4wrap(`c +', `d')')m4wrap(`b') +dnl @result{} +dnl @result{}bac diff -ruNp m4-1.4.10/checks/117.undivert m4-1.4.11/checks/117.undivert --- m4-1.4.10/checks/117.undivert 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/117.undivert 1969-12-31 17:00:00.000000000 -0700 @@ -1,16 +0,0 @@ -dnl @ ../doc/m4.texinfo:4391: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -divert(`1')one -divert(`2')two -divert(`3')three -divert(`2')undivert`'dnl -divert`'undivert`'dnl -dnl @result{}two -dnl @result{}one -dnl @result{}three diff -ruNp m4-1.4.10/checks/118.m4wrap m4-1.4.11/checks/118.m4wrap --- m4-1.4.10/checks/118.m4wrap 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/118.m4wrap 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,15 @@ +dnl @ ../doc/m4.texinfo:4454: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`f', `ifelse(`$1', `0', `Answer: 0!=1 +', eval(`$1>1'), `0', `Answer: $2$1=eval(`$2$1') +', `m4wrap(`f(decr(`$1'), `$2$1*')')')') +dnl @result{} +f(`10') +dnl @result{} +dnl @result{}Answer: 10*9*8*7*6*5*4*3*2*1=3628800 diff -ruNp m4-1.4.10/checks/118.undivert m4-1.4.11/checks/118.undivert --- m4-1.4.10/checks/118.undivert 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/118.undivert 1969-12-31 17:00:00.000000000 -0700 @@ -1,16 +0,0 @@ -dnl @ ../doc/m4.texinfo:4420: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`bar', `BAR') -dnl @result{} -undivert(`foo') -dnl @result{}bar -dnl @result{} -include(`foo') -dnl @result{}BAR -dnl @result{} diff -ruNp m4-1.4.10/checks/119.m4wrap m4-1.4.11/checks/119.m4wrap --- m4-1.4.10/checks/119.m4wrap 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/119.m4wrap 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:4468: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`aa', `AA +') +dnl @result{} +m4wrap(`a')m4wrap(`a') +dnl @result{} +dnl @result{}AA diff -ruNp m4-1.4.10/checks/119.undivert m4-1.4.11/checks/119.undivert --- m4-1.4.10/checks/119.undivert 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/119.undivert 1969-12-31 17:00:00.000000000 -0700 @@ -1,17 +0,0 @@ -dnl @ ../doc/m4.texinfo:4435: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -divert(`1')diversion one -divert(`2')undivert(`foo')dnl -divert(`3')diversion three -divert`'dnl -undivert(`1', `2', `foo', `3')dnl -dnl @result{}diversion one -dnl @result{}bar -dnl @result{}bar -dnl @result{}diversion three diff -ruNp m4-1.4.10/checks/120.divnum m4-1.4.11/checks/120.divnum --- m4-1.4.10/checks/120.divnum 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/120.divnum 1969-12-31 17:00:00.000000000 -0700 @@ -1,18 +0,0 @@ -dnl @ ../doc/m4.texinfo:4457: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -Initial divnum -dnl @result{}Initial 0 -divert(`1') -Diversion one: divnum -divert(`2') -Diversion two: divnum -dnl @result{} -dnl @result{}Diversion one: 1 -dnl @result{} -dnl @result{}Diversion two: 2 diff -ruNp m4-1.4.10/checks/120.m4wrap m4-1.4.11/checks/120.m4wrap --- m4-1.4.10/checks/120.m4wrap 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/120.m4wrap 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,11 @@ +dnl @ ../doc/m4.texinfo:4483: Origin of test +dnl @ expected status: 1 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +m4wrap(`m4wrap(`)')len(abc') +dnl @result{} +dnl @error{}m4:stdin:1: ERROR: end of file in argument list diff -ruNp m4-1.4.10/checks/121.cleardiver m4-1.4.11/checks/121.cleardiver --- m4-1.4.10/checks/121.cleardiver 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/121.cleardiver 1969-12-31 17:00:00.000000000 -0700 @@ -1,14 +0,0 @@ -dnl @ ../doc/m4.texinfo:4483: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -divert(`1') -Diversion one: divnum -divert(`2') -Diversion two: divnum -divert(`-1') -undivert diff -ruNp m4-1.4.10/checks/121.include m4-1.4.11/checks/121.include --- m4-1.4.10/checks/121.include 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/121.include 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:4525: Origin of test +dnl @ expected status: 1 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +include(`none') +dnl @error{}m4:stdin:1: cannot open `none': No such file or directory +dnl @result{} +include() +dnl @error{}m4:stdin:2: cannot open `': No such file or directory +dnl @result{} +sinclude(`none') +dnl @result{} +sinclude() +dnl @result{} diff -ruNp m4-1.4.10/checks/122.cleardiver m4-1.4.11/checks/122.cleardiver --- m4-1.4.10/checks/122.cleardiver 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/122.cleardiver 1969-12-31 17:00:00.000000000 -0700 @@ -1,11 +0,0 @@ -dnl @ ../doc/m4.texinfo:4502: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`cleardivert', -`pushdef(`_n', divnum)divert(`-1')undivert($@)divert(_n)popdef(`_n')') -dnl @result{} diff -ruNp m4-1.4.10/checks/122.include m4-1.4.11/checks/122.include --- m4-1.4.10/checks/122.include 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/122.include 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,15 @@ +dnl @ ../doc/m4.texinfo:4558: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `FOO') +dnl @result{} +include(`incl.m4') +dnl @result{}Include file start +dnl @result{}FOO +dnl @result{}Include file end +dnl @result{} diff -ruNp m4-1.4.10/checks/123.include m4-1.4.11/checks/123.include --- m4-1.4.10/checks/123.include 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/123.include 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,15 @@ +dnl @ ../doc/m4.texinfo:4575: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`bar', include(`incl.m4')) +dnl @result{} +This is `bar': >>bar<< +dnl @result{}This is bar: >>Include file start +dnl @result{}foo +dnl @result{}Include file end +dnl @result{}<< diff -ruNp m4-1.4.10/checks/123.len m4-1.4.11/checks/123.len --- m4-1.4.10/checks/123.len 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/123.len 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -dnl @ ../doc/m4.texinfo:4542: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -len() -dnl @result{}0 -len(`abcdef') -dnl @result{}6 diff -ruNp m4-1.4.10/checks/124.diversions m4-1.4.11/checks/124.diversions --- m4-1.4.10/checks/124.diversions 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/124.diversions 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,35 @@ +dnl @ ../doc/m4.texinfo:4647: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +divert(`-1')define(`f', `.') +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +divert`'dnl +len(f) +dnl @result{}1048576 +divert(`1') +f +divert(`-1')undivert diff -ruNp m4-1.4.10/checks/124.index_macr m4-1.4.11/checks/124.index_macr --- m4-1.4.10/checks/124.index_macr 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/124.index_macr 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -dnl @ ../doc/m4.texinfo:4564: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -index(`gnus, gnats, and armadillos', `nat') -dnl @result{}7 -index(`gnus, gnats, and armadillos', `dag') -dnl @result{}-1 diff -ruNp m4-1.4.10/checks/125.diversions m4-1.4.11/checks/125.diversions --- m4-1.4.10/checks/125.diversions 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/125.diversions 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,35 @@ +dnl @ ../doc/m4.texinfo:4679: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +divert(`-1')define(`f', `.') +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +divert`'dnl +len(f) +dnl @result{}1048576 +divert(`1') +f +m4exit diff -ruNp m4-1.4.10/checks/125.index_macr m4-1.4.11/checks/125.index_macr --- m4-1.4.10/checks/125.index_macr 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/125.index_macr 1969-12-31 17:00:00.000000000 -0700 @@ -1,11 +0,0 @@ -dnl @ ../doc/m4.texinfo:4573: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -index(`abc') -dnl @error{}m4:stdin:1: Warning: too few arguments to builtin `index' -dnl @result{}0 diff -ruNp m4-1.4.10/checks/126.diversions m4-1.4.11/checks/126.diversions --- m4-1.4.10/checks/126.diversions 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/126.diversions 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,17 @@ +dnl @ ../doc/m4.texinfo:4711: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +ifdef(`__unix__', , + `errprint(` skipping: syscmd does not have unix semantics +')m4exit(`77')')dnl +changequote(`[', `]')dnl +syscmd([echo 'divert(1)hi +format(%1000000d, 1)' | m4 | sed 1q])dnl +dnl @result{}hi +sysval +dnl @result{}0 diff -ruNp m4-1.4.10/checks/126.regexp m4-1.4.11/checks/126.regexp --- m4-1.4.10/checks/126.regexp 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/126.regexp 1969-12-31 17:00:00.000000000 -0700 @@ -1,16 +0,0 @@ -dnl @ ../doc/m4.texinfo:4622: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -regexp(`GNUs not Unix', `\<[a-z]\w+') -dnl @result{}5 -regexp(`GNUs not Unix', `\<Q\w*') -dnl @result{}-1 -regexp(`GNUs not Unix', `\w\(\w+\)$', `*** \& *** \1 ***') -dnl @result{}*** Unix *** nix *** -regexp(`GNUs not Unix', `\<Q\w*', `*** \& *** \1 ***') -dnl @result{} diff -ruNp m4-1.4.10/checks/127.divert m4-1.4.11/checks/127.divert --- m4-1.4.10/checks/127.divert 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/127.divert 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:4758: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +divert(`1') +This text is diverted. +divert +dnl @result{} +This text is not diverted. +dnl @result{}This text is not diverted. +dnl @result{} +dnl @result{}This text is diverted. diff -ruNp m4-1.4.10/checks/127.regexp m4-1.4.11/checks/127.regexp --- m4-1.4.10/checks/127.regexp 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/127.regexp 1969-12-31 17:00:00.000000000 -0700 @@ -1,19 +0,0 @@ -dnl @ ../doc/m4.texinfo:4635: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -regexp(`abc', `\(b\)', `\\\10\a') -dnl @result{}\b0a -regexp(`abc', `b', `\1\') -dnl @error{}m4:stdin:2: Warning: sub-expression 1 not present -dnl @error{}m4:stdin:2: Warning: trailing \ ignored in replacement -dnl @result{} -regexp(`abc', `\(\(d\)?\)\(c\)', `\1\2\3\4\5\6') -dnl @error{}m4:stdin:3: Warning: sub-expression 4 not present -dnl @error{}m4:stdin:3: Warning: sub-expression 5 not present -dnl @error{}m4:stdin:3: Warning: sub-expression 6 not present -dnl @result{}c diff -ruNp m4-1.4.10/checks/128.divert m4-1.4.11/checks/128.divert --- m4-1.4.10/checks/128.divert 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/128.divert 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:4774: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`text', `TEXT') +dnl @result{} +divert(`1')`diverted text.' +divert +dnl @result{} +m4wrap(`Wrapped text precedes ') +dnl @result{} +dnl @result{}Wrapped TEXT precedes diverted text. diff -ruNp m4-1.4.10/checks/128.regexp m4-1.4.11/checks/128.regexp --- m4-1.4.10/checks/128.regexp 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/128.regexp 1969-12-31 17:00:00.000000000 -0700 @@ -1,11 +0,0 @@ -dnl @ ../doc/m4.texinfo:4651: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -regexp(`abc') -dnl @error{}m4:stdin:1: Warning: too few arguments to builtin `regexp' -dnl @result{}0 diff -ruNp m4-1.4.10/checks/129.divert m4-1.4.11/checks/129.divert --- m4-1.4.10/checks/129.divert 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/129.divert 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,13 @@ +dnl @ ../doc/m4.texinfo:4793: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +divert(`-1') +define(`foo', `Macro `foo'.') +define(`bar', `Macro `bar'.') +divert +dnl @result{} diff -ruNp m4-1.4.10/checks/129.substr m4-1.4.11/checks/129.substr --- m4-1.4.10/checks/129.substr 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/129.substr 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -dnl @ ../doc/m4.texinfo:4675: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -substr(`gnus, gnats, and armadillos', `6') -dnl @result{}gnats, and armadillos -substr(`gnus, gnats, and armadillos', `6', `5') -dnl @result{}gnats diff -ruNp m4-1.4.10/checks/130.divert m4-1.4.11/checks/130.divert --- m4-1.4.10/checks/130.divert 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/130.divert 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:4807: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +divert(eval(`1<<28'))world +divert(`2')hello +dnl @result{}hello +dnl @result{}world diff -ruNp m4-1.4.10/checks/130.substr m4-1.4.11/checks/130.substr --- m4-1.4.10/checks/130.substr 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/130.substr 1969-12-31 17:00:00.000000000 -0700 @@ -1,14 +0,0 @@ -dnl @ ../doc/m4.texinfo:4684: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -substr(`abc') -dnl @error{}m4:stdin:1: Warning: too few arguments to builtin `substr' -dnl @result{}abc -substr(`abc',) -dnl @error{}m4:stdin:2: empty string treated as 0 in builtin `substr' -dnl @result{}abc diff -ruNp m4-1.4.10/checks/131.divert m4-1.4.11/checks/131.divert --- m4-1.4.10/checks/131.divert 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/131.divert 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:4822: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +We decided to divert the stream for irrigation. +dnl @result{}We decided to the stream for irrigation. +define(`divert', `ifelse(`$#', `0', ``$0'', `builtin(`$0', $@)')') +dnl @result{} +divert(`-1') +Ignored text. +divert(`0') +dnl @result{} +We decided to divert the stream for irrigation. +dnl @result{}We decided to divert the stream for irrigation. diff -ruNp m4-1.4.10/checks/131.translit m4-1.4.11/checks/131.translit --- m4-1.4.10/checks/131.translit 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/131.translit 1969-12-31 17:00:00.000000000 -0700 @@ -1,18 +0,0 @@ -dnl @ ../doc/m4.texinfo:4729: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -translit(`GNUs not Unix', `A-Z') -dnl @result{}s not nix -translit(`GNUs not Unix', `a-z', `A-Z') -dnl @result{}GNUS NOT UNIX -translit(`GNUs not Unix', `A-Z', `z-a') -dnl @result{}tmfs not fnix -translit(`+,-12345', `+--1-5', `<;>a-c-a') -dnl @result{}<;>abcba -translit(`abcdef', `aabdef', `bcged') -dnl @result{}bgced diff -ruNp m4-1.4.10/checks/132.translit m4-1.4.11/checks/132.translit --- m4-1.4.10/checks/132.translit 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/132.translit 1969-12-31 17:00:00.000000000 -0700 @@ -1,10 +0,0 @@ -dnl @ ../doc/m4.texinfo:4756: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -translit(`«abc~', `~-»') -dnl @result{}abc diff -ruNp m4-1.4.10/checks/132.undivert m4-1.4.11/checks/132.undivert --- m4-1.4.10/checks/132.undivert 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/132.undivert 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:4856: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +divert(`1') +This text is diverted. +divert +dnl @result{} +This text is not diverted. +dnl @result{}This text is not diverted. +undivert(`1') +dnl @result{} +dnl @result{}This text is diverted. +dnl @result{} diff -ruNp m4-1.4.10/checks/133.translit m4-1.4.11/checks/133.translit --- m4-1.4.10/checks/133.translit 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/133.translit 1969-12-31 17:00:00.000000000 -0700 @@ -1,11 +0,0 @@ -dnl @ ../doc/m4.texinfo:4764: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -translit(`abc') -dnl @error{}m4:stdin:1: Warning: too few arguments to builtin `translit' -dnl @result{}abc diff -ruNp m4-1.4.10/checks/133.undivert m4-1.4.11/checks/133.undivert --- m4-1.4.10/checks/133.undivert 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/133.undivert 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:4879: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +divert(`1')diverted text +divert +dnl @result{} +undivert() +dnl @result{} +undivert(`0') +dnl @result{} +undivert +dnl @result{}diverted text +dnl @result{} diff -ruNp m4-1.4.10/checks/134.patsubst m4-1.4.11/checks/134.patsubst --- m4-1.4.10/checks/134.patsubst 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/134.patsubst 1969-12-31 17:00:00.000000000 -0700 @@ -1,21 +0,0 @@ -dnl @ ../doc/m4.texinfo:4808: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -patsubst(`GNUs not Unix', `^', `OBS: ') -dnl @result{}OBS: GNUs not Unix -patsubst(`GNUs not Unix', `\<', `OBS: ') -dnl @result{}OBS: GNUs OBS: not OBS: Unix -patsubst(`GNUs not Unix', `\w*', `(\&)') -dnl @result{}(GNUs)() (not)() (Unix)() -patsubst(`GNUs not Unix', `\w+', `(\&)') -dnl @result{}(GNUs) (not) (Unix) -patsubst(`GNUs not Unix', `[A-Z][a-z]+') -dnl @result{}GN not -patsubst(`GNUs not Unix', `not', `NOT\') -dnl @error{}m4:stdin:6: Warning: trailing \ ignored in replacement -dnl @result{}GNUs NOT Unix diff -ruNp m4-1.4.10/checks/134.undivert m4-1.4.11/checks/134.undivert --- m4-1.4.10/checks/134.undivert 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/134.undivert 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,20 @@ +dnl @ ../doc/m4.texinfo:4895: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +divert(`1') +This text is diverted first. +divert(`0')undivert(`1')dnl +dnl @result{} +dnl @result{}This text is diverted first. +undivert(`1') +dnl @result{} +divert(`1') +This text is also diverted but not appended. +divert(`0')undivert(`1')dnl +dnl @result{} +dnl @result{}This text is also diverted but not appended. diff -ruNp m4-1.4.10/checks/135.patsubst m4-1.4.11/checks/135.patsubst --- m4-1.4.10/checks/135.patsubst 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/135.patsubst 1969-12-31 17:00:00.000000000 -0700 @@ -1,17 +0,0 @@ -dnl @ ../doc/m4.texinfo:4837: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`upcase', `translit(`$*', `a-z', `A-Z')')dnl -define(`downcase', `translit(`$*', `A-Z', `a-z')')dnl -define(`capitalize1', - `regexp(`$1', `^\(\w\)\(\w*\)', - `upcase(`\1')`'downcase(`\2')')')dnl -define(`capitalize', - `patsubst(`$1', `\w+', `capitalize1(`\&')')')dnl -capitalize(`GNUs not Unix') -dnl @result{}Gnus Not Unix diff -ruNp m4-1.4.10/checks/135.undivert m4-1.4.11/checks/135.undivert --- m4-1.4.10/checks/135.undivert 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/135.undivert 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:4914: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +divert(`1')one +divert(`2')two +divert(`3')three +divert(`2')undivert`'dnl +divert`'undivert`'dnl +dnl @result{}two +dnl @result{}one +dnl @result{}three diff -ruNp m4-1.4.10/checks/136.patsubst m4-1.4.11/checks/136.patsubst --- m4-1.4.10/checks/136.patsubst 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/136.patsubst 1969-12-31 17:00:00.000000000 -0700 @@ -1,17 +0,0 @@ -dnl @ ../doc/m4.texinfo:4853: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`patreg', -`patsubst($@) -regexp($@)')dnl -patreg(`bar foo baz Foo', `foo\|Foo', `FOO') -dnl @result{}bar FOO baz FOO -dnl @result{}FOO -patreg(`aba abb 121', `\(.\)\(.\)\1', `\2\1\2') -dnl @result{}bab abb 212 -dnl @result{}bab diff -ruNp m4-1.4.10/checks/136.undivert m4-1.4.11/checks/136.undivert --- m4-1.4.10/checks/136.undivert 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/136.undivert 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:4943: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`bar', `BAR') +dnl @result{} +undivert(`foo') +dnl @result{}bar +dnl @result{} +include(`foo') +dnl @result{}BAR +dnl @result{} diff -ruNp m4-1.4.10/checks/137.patsubst m4-1.4.11/checks/137.patsubst --- m4-1.4.10/checks/137.patsubst 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/137.patsubst 1969-12-31 17:00:00.000000000 -0700 @@ -1,11 +0,0 @@ -dnl @ ../doc/m4.texinfo:4867: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -patsubst(`abc') -dnl @error{}m4:stdin:1: Warning: too few arguments to builtin `patsubst' -dnl @result{}abc diff -ruNp m4-1.4.10/checks/137.undivert m4-1.4.11/checks/137.undivert --- m4-1.4.10/checks/137.undivert 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/137.undivert 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,17 @@ +dnl @ ../doc/m4.texinfo:4958: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +divert(`1')diversion one +divert(`2')undivert(`foo')dnl +divert(`3')diversion three +divert`'dnl +undivert(`1', `2', `foo', `3')dnl +dnl @result{}diversion one +dnl @result{}bar +dnl @result{}bar +dnl @result{}diversion three diff -ruNp m4-1.4.10/checks/138.divnum m4-1.4.11/checks/138.divnum --- m4-1.4.10/checks/138.divnum 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/138.divnum 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:4980: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +Initial divnum +dnl @result{}Initial 0 +divert(`1') +Diversion one: divnum +divert(`2') +Diversion two: divnum +dnl @result{} +dnl @result{}Diversion one: 1 +dnl @result{} +dnl @result{}Diversion two: 2 diff -ruNp m4-1.4.10/checks/138.format m4-1.4.11/checks/138.format --- m4-1.4.10/checks/138.format 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/138.format 1969-12-31 17:00:00.000000000 -0700 @@ -1,26 +0,0 @@ -dnl @ ../doc/m4.texinfo:4894: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`foo', `The brown fox jumped over the lazy dog') -dnl @result{} -format(`The string "%s" uses %d characters', foo, len(foo)) -dnl @result{}The string "The brown fox jumped over the lazy dog" uses 38 characters -format(`%*.*d', `-1', `-1', `1') -dnl @result{}1 -format(`%.0f', `56789.9876') -dnl @result{}56790 -len(format(`%-*X', `5000', `1')) -dnl @result{}5000 -ifelse(format(`%010F', `infinity'), ` INF', `success', - format(`%010F', `infinity'), ` INFINITY', `success', - format(`%010F', `infinity')) -dnl @result{}success -ifelse(format(`%.1A', `1.999'), `0X1.0P+1', `success', - format(`%.1A', `1.999'), `0X2.0P+0', `success', - format(`%.1A', `1.999')) -dnl @result{}success diff -ruNp m4-1.4.10/checks/139.cleardiver m4-1.4.11/checks/139.cleardiver --- m4-1.4.10/checks/139.cleardiver 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/139.cleardiver 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:5006: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +divert(`1') +Diversion one: divnum +divert(`2') +Diversion two: divnum +divert(`-1') +undivert diff -ruNp m4-1.4.10/checks/139.format m4-1.4.11/checks/139.format --- m4-1.4.10/checks/139.format 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/139.format 1969-12-31 17:00:00.000000000 -0700 @@ -1,23 +0,0 @@ -dnl @ ../doc/m4.texinfo:4918: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -include(`forloop.m4') -dnl @result{} -forloop(`i', `1', `10', `format(`%6d squared is %10d -', i, eval(i**2))') -dnl @result{} 1 squared is 1 -dnl @result{} 2 squared is 4 -dnl @result{} 3 squared is 9 -dnl @result{} 4 squared is 16 -dnl @result{} 5 squared is 25 -dnl @result{} 6 squared is 36 -dnl @result{} 7 squared is 49 -dnl @result{} 8 squared is 64 -dnl @result{} 9 squared is 81 -dnl @result{} 10 squared is 100 -dnl @result{} diff -ruNp m4-1.4.10/checks/140.cleardiver m4-1.4.11/checks/140.cleardiver --- m4-1.4.10/checks/140.cleardiver 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/140.cleardiver 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,11 @@ +dnl @ ../doc/m4.texinfo:5025: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`cleardivert', +`pushdef(`_n', divnum)divert(`-1')undivert($@)divert(_n)popdef(`_n')') +dnl @result{} diff -ruNp m4-1.4.10/checks/140.format m4-1.4.11/checks/140.format --- m4-1.4.10/checks/140.format 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/140.format 1969-12-31 17:00:00.000000000 -0700 @@ -1,11 +0,0 @@ -dnl @ ../doc/m4.texinfo:4959: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -format(`%p', `0') -dnl @error{}m4:stdin:1: Warning: unrecognized specifier in `%p' -dnl @result{} diff -ruNp m4-1.4.10/checks/141.incr m4-1.4.11/checks/141.incr --- m4-1.4.10/checks/141.incr 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/141.incr 1969-12-31 17:00:00.000000000 -0700 @@ -1,18 +0,0 @@ -dnl @ ../doc/m4.texinfo:4997: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -incr(`4') -dnl @result{}5 -decr(`7') -dnl @result{}6 -incr() -dnl @error{}m4:stdin:3: empty string treated as 0 in builtin `incr' -dnl @result{}1 -decr() -dnl @error{}m4:stdin:4: empty string treated as 0 in builtin `decr' -dnl @result{}-1 diff -ruNp m4-1.4.10/checks/141.len m4-1.4.11/checks/141.len --- m4-1.4.10/checks/141.len 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/141.len 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:5065: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +len() +dnl @result{}0 +len(`abcdef') +dnl @result{}6 diff -ruNp m4-1.4.10/checks/142.eval m4-1.4.11/checks/142.eval --- m4-1.4.10/checks/142.eval 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/142.eval 1969-12-31 17:00:00.000000000 -0700 @@ -1,17 +0,0 @@ -dnl @ ../doc/m4.texinfo:5074: Origin of test -dnl @ expected status: 1 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -eval(`2 = 2') -dnl @error{}m4:stdin:1: Warning: recommend ==, not =, for equality operator -dnl @result{}1 -eval(`++0') -dnl @error{}m4:stdin:2: invalid operator in eval: ++0 -dnl @result{} -eval(`0 |= 1') -dnl @error{}m4:stdin:3: invalid operator in eval: 0 |= 1 -dnl @result{} diff -ruNp m4-1.4.10/checks/142.index_macr m4-1.4.11/checks/142.index_macr --- m4-1.4.10/checks/142.index_macr 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/142.index_macr 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:5087: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +index(`gnus, gnats, and armadillos', `nat') +dnl @result{}7 +index(`gnus, gnats, and armadillos', `dag') +dnl @result{}-1 diff -ruNp m4-1.4.10/checks/143.eval m4-1.4.11/checks/143.eval --- m4-1.4.10/checks/143.eval 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/143.eval 1969-12-31 17:00:00.000000000 -0700 @@ -1,32 +0,0 @@ -dnl @ ../doc/m4.texinfo:5107: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -eval(`1 == 2 > 0') -dnl @result{}1 -eval(`(1 == 2) > 0') -dnl @result{}0 -eval(`! 0 * 2') -dnl @result{}2 -eval(`! (0 * 2)') -dnl @result{}1 -eval(`1 | 1 ^ 1') -dnl @result{}1 -eval(`(1 | 1) ^ 1') -dnl @result{}0 -eval(`+ + - ~ ! ~ 0') -dnl @result{}1 -eval(`2 || 1 / 0') -dnl @result{}1 -eval(`0 || 1 / 0') -dnl @error{}m4:stdin:9: divide by zero in eval: 0 || 1 / 0 -dnl @result{} -eval(`0 && 1 % 0') -dnl @result{}0 -eval(`2 && 1 % 0') -dnl @error{}m4:stdin:11: modulo by zero in eval: 2 && 1 % 0 -dnl @result{} diff -ruNp m4-1.4.10/checks/143.index_macr m4-1.4.11/checks/143.index_macr --- m4-1.4.10/checks/143.index_macr 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/143.index_macr 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,15 @@ +dnl @ ../doc/m4.texinfo:5097: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +index(`abc') +dnl @error{}m4:stdin:1: Warning: too few arguments to builtin `index' +dnl @result{}0 +index(`abc', `') +dnl @result{}0 +index(`abc', `b') +dnl @result{}1 diff -ruNp m4-1.4.10/checks/144.eval m4-1.4.11/checks/144.eval --- m4-1.4.10/checks/144.eval 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/144.eval 1969-12-31 17:00:00.000000000 -0700 @@ -1,22 +0,0 @@ -dnl @ ../doc/m4.texinfo:5140: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -eval(`2 ** 3 ** 2') -dnl @result{}512 -eval(`(2 ** 3) ** 2') -dnl @result{}64 -eval(`0 ** 1') -dnl @result{}0 -eval(`2 ** 0') -dnl @result{}1 -eval(`0 ** 0') -dnl @result{} -dnl @error{}m4:stdin:5: divide by zero in eval: 0 ** 0 -eval(`4 ** -2') -dnl @error{}m4:stdin:6: negative exponent in eval: 4 ** -2 -dnl @result{} diff -ruNp m4-1.4.10/checks/144.regexp m4-1.4.11/checks/144.regexp --- m4-1.4.10/checks/144.regexp 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/144.regexp 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:5150: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +regexp(`GNUs not Unix', `\<[a-z]\w+') +dnl @result{}5 +regexp(`GNUs not Unix', `\<Q\w*') +dnl @result{}-1 +regexp(`GNUs not Unix', `\w\(\w+\)$', `*** \& *** \1 ***') +dnl @result{}*** Unix *** nix *** +regexp(`GNUs not Unix', `\<Q\w*', `*** \& *** \1 ***') +dnl @result{} diff -ruNp m4-1.4.10/checks/145.eval m4-1.4.11/checks/145.eval --- m4-1.4.10/checks/145.eval 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/145.eval 1969-12-31 17:00:00.000000000 -0700 @@ -1,33 +0,0 @@ -dnl @ ../doc/m4.texinfo:5176: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -eval(`-3 * 5') -dnl @result{}-15 -eval(`-99 / 10') -dnl @result{}-9 -eval(`-99 % 10') -dnl @result{}-9 -eval(`99 % -10') -dnl @result{}9 -eval(index(`Hello world', `llo') >= 0) -dnl @result{}1 -eval(`0r1:0111 + 0b100 + 0r3:12') -dnl @result{}12 -define(`square', `eval(`($1) ** 2')') -dnl @result{} -square(`9') -dnl @result{}81 -square(square(`5')` + 1') -dnl @result{}676 -define(`foo', `666') -dnl @result{} -eval(`foo / 6') -dnl @error{}m4:stdin:11: bad expression in eval: foo / 6 -dnl @result{} -eval(foo / 6) -dnl @result{}111 diff -ruNp m4-1.4.10/checks/145.regexp m4-1.4.11/checks/145.regexp --- m4-1.4.10/checks/145.regexp 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/145.regexp 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,19 @@ +dnl @ ../doc/m4.texinfo:5163: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +regexp(`abc', `\(b\)', `\\\10\a') +dnl @result{}\b0a +regexp(`abc', `b', `\1\') +dnl @error{}m4:stdin:2: Warning: sub-expression 1 not present +dnl @error{}m4:stdin:2: Warning: trailing \ ignored in replacement +dnl @result{} +regexp(`abc', `\(\(d\)?\)\(c\)', `\1\2\3\4\5\6') +dnl @error{}m4:stdin:3: Warning: sub-expression 4 not present +dnl @error{}m4:stdin:3: Warning: sub-expression 5 not present +dnl @error{}m4:stdin:3: Warning: sub-expression 6 not present +dnl @result{}c diff -ruNp m4-1.4.10/checks/146.eval m4-1.4.11/checks/146.eval --- m4-1.4.10/checks/146.eval 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/146.eval 1969-12-31 17:00:00.000000000 -0700 @@ -1,26 +0,0 @@ -dnl @ ../doc/m4.texinfo:5215: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`max_int', eval(`0x7fffffff')) -dnl @result{} -define(`min_int', incr(max_int)) -dnl @result{} -eval(min_int` < 0') -dnl @result{}1 -eval(max_int` > 0') -dnl @result{}1 -ifelse(eval(min_int` / -1'), min_int, `overflow occurred') -dnl @result{}overflow occurred -min_int -dnl @result{}-2147483648 -eval(`0x80000000 % -1') -dnl @result{}0 -eval(`-4 >> 1') -dnl @result{}-2 -eval(`-4 >> 33') -dnl @result{}-2 diff -ruNp m4-1.4.10/checks/146.regexp m4-1.4.11/checks/146.regexp --- m4-1.4.10/checks/146.regexp 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/146.regexp 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,15 @@ +dnl @ ../doc/m4.texinfo:5180: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +regexp(`abc') +dnl @error{}m4:stdin:1: Warning: too few arguments to builtin `regexp' +dnl @result{}0 +regexp(`abc', `') +dnl @result{}0 +regexp(`abc', `', `\\def') +dnl @result{}\def diff -ruNp m4-1.4.10/checks/147.eval m4-1.4.11/checks/147.eval --- m4-1.4.10/checks/147.eval 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/147.eval 1969-12-31 17:00:00.000000000 -0700 @@ -1,33 +0,0 @@ -dnl @ ../doc/m4.texinfo:5248: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -eval(`666', `10') -dnl @result{}666 -eval(`666', `11') -dnl @result{}556 -eval(`666', `6') -dnl @result{}3030 -eval(`666', `6', `10') -dnl @result{}0000003030 -eval(`-666', `6', `10') -dnl @result{}-0000003030 -eval(`10', `', `0') -dnl @result{}10 -`0r1:'eval(`10', `1', `11') -dnl @result{}0r1:01111111111 -eval(`10', `16') -dnl @result{}a -eval(`1', `37') -dnl @error{}m4:stdin:9: radix 37 in builtin `eval' out of range -dnl @result{} -eval(`1', , `-1') -dnl @error{}m4:stdin:10: negative width to builtin `eval' -dnl @result{} -eval() -dnl @error{}m4:stdin:11: empty string treated as 0 in builtin `eval' -dnl @result{}0 diff -ruNp m4-1.4.10/checks/147.substr m4-1.4.11/checks/147.substr --- m4-1.4.10/checks/147.substr 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/147.substr 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:5208: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +substr(`gnus, gnats, and armadillos', `6') +dnl @result{}gnats, and armadillos +substr(`gnus, gnats, and armadillos', `6', `5') +dnl @result{}gnats diff -ruNp m4-1.4.10/checks/148.platform_m m4-1.4.11/checks/148.platform_m --- m4-1.4.10/checks/148.platform_m 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/148.platform_m 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -dnl @ ../doc/m4.texinfo:5328: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -__gnu__ -dnl @result{} -ifdef(`__gnu__', `Extensions are active') -dnl @result{}Extensions are active diff -ruNp m4-1.4.10/checks/148.substr m4-1.4.11/checks/148.substr --- m4-1.4.10/checks/148.substr 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/148.substr 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:5217: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +substr(`abc') +dnl @error{}m4:stdin:1: Warning: too few arguments to builtin `substr' +dnl @result{}abc +substr(`abc',) +dnl @error{}m4:stdin:2: empty string treated as 0 in builtin `substr' +dnl @result{}abc diff -ruNp m4-1.4.10/checks/149.platform_m m4-1.4.11/checks/149.platform_m --- m4-1.4.10/checks/149.platform_m 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/149.platform_m 1969-12-31 17:00:00.000000000 -0700 @@ -1,18 +0,0 @@ -dnl @ ../doc/m4.texinfo:5348: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`provided', `0') -dnl @result{} -ifdef(`__unix__', `define(`provided', incr(provided))') -dnl @result{} -ifdef(`__windows__', `define(`provided', incr(provided))') -dnl @result{} -ifdef(`__os2__', `define(`provided', incr(provided))') -dnl @result{} -provided -dnl @result{}1 diff -ruNp m4-1.4.10/checks/149.translit m4-1.4.11/checks/149.translit --- m4-1.4.10/checks/149.translit 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/149.translit 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:5262: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +translit(`GNUs not Unix', `A-Z') +dnl @result{}s not nix +translit(`GNUs not Unix', `a-z', `A-Z') +dnl @result{}GNUS NOT UNIX +translit(`GNUs not Unix', `A-Z', `z-a') +dnl @result{}tmfs not fnix +translit(`+,-12345', `+--1-5', `<;>a-c-a') +dnl @result{}<;>abcba +translit(`abcdef', `aabdef', `bcged') +dnl @result{}bgced diff -ruNp m4-1.4.10/checks/150.syscmd m4-1.4.11/checks/150.syscmd --- m4-1.4.10/checks/150.syscmd 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/150.syscmd 1969-12-31 17:00:00.000000000 -0700 @@ -1,13 +0,0 @@ -dnl @ ../doc/m4.texinfo:5381: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`foo', `FOO') -dnl @result{} -syscmd(`echo foo') -dnl @result{}foo -dnl @result{} diff -ruNp m4-1.4.10/checks/150.translit m4-1.4.11/checks/150.translit --- m4-1.4.10/checks/150.translit 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/150.translit 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,10 @@ +dnl @ ../doc/m4.texinfo:5289: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +translit(`«abc~', `~-»') +dnl @result{}abc diff -ruNp m4-1.4.10/checks/151.syscmd m4-1.4.11/checks/151.syscmd --- m4-1.4.10/checks/151.syscmd 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/151.syscmd 1969-12-31 17:00:00.000000000 -0700 @@ -1,10 +0,0 @@ -dnl @ ../doc/m4.texinfo:5410: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -m4wrap(`syscmd(`cat')') -dnl @result{} diff -ruNp m4-1.4.10/checks/151.translit m4-1.4.11/checks/151.translit --- m4-1.4.10/checks/151.translit 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/151.translit 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,11 @@ +dnl @ ../doc/m4.texinfo:5297: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +translit(`abc') +dnl @error{}m4:stdin:1: Warning: too few arguments to builtin `translit' +dnl @result{}abc diff -ruNp m4-1.4.10/checks/152.esyscmd m4-1.4.11/checks/152.esyscmd --- m4-1.4.10/checks/152.esyscmd 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/152.esyscmd 1969-12-31 17:00:00.000000000 -0700 @@ -1,13 +0,0 @@ -dnl @ ../doc/m4.texinfo:5449: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`foo', `FOO') -dnl @result{} -esyscmd(`echo foo') -dnl @result{}FOO -dnl @result{} diff -ruNp m4-1.4.10/checks/152.patsubst m4-1.4.11/checks/152.patsubst --- m4-1.4.10/checks/152.patsubst 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/152.patsubst 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,21 @@ +dnl @ ../doc/m4.texinfo:5341: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +patsubst(`GNUs not Unix', `^', `OBS: ') +dnl @result{}OBS: GNUs not Unix +patsubst(`GNUs not Unix', `\<', `OBS: ') +dnl @result{}OBS: GNUs OBS: not OBS: Unix +patsubst(`GNUs not Unix', `\w*', `(\&)') +dnl @result{}(GNUs)() (not)() (Unix)() +patsubst(`GNUs not Unix', `\w+', `(\&)') +dnl @result{}(GNUs) (not) (Unix) +patsubst(`GNUs not Unix', `[A-Z][a-z]+') +dnl @result{}GN not +patsubst(`GNUs not Unix', `not', `NOT\') +dnl @error{}m4:stdin:6: Warning: trailing \ ignored in replacement +dnl @result{}GNUs NOT Unix diff -ruNp m4-1.4.10/checks/153.patsubst m4-1.4.11/checks/153.patsubst --- m4-1.4.10/checks/153.patsubst 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/153.patsubst 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:5374: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +include(`capitalize.m4') +dnl @result{} +upcase(`GNUs not Unix') +dnl @result{}GNUS NOT UNIX +downcase(`GNUs not Unix') +dnl @result{}gnus not unix +capitalize(`GNUs not Unix') +dnl @result{}Gnus Not Unix diff -ruNp m4-1.4.10/checks/153.sysval m4-1.4.11/checks/153.sysval --- m4-1.4.10/checks/153.sysval 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/153.sysval 1969-12-31 17:00:00.000000000 -0700 @@ -1,34 +0,0 @@ -dnl @ ../doc/m4.texinfo:5479: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -sysval -dnl @result{}0 -syscmd(`false') -dnl @result{} -ifelse(sysval, `0', `zero', `non-zero') -dnl @result{}non-zero -syscmd(`exit 2') -dnl @result{} -sysval -dnl @result{}2 -syscmd(`true') -dnl @result{} -sysval -dnl @result{}0 -esyscmd(`false') -dnl @result{} -ifelse(sysval, `0', `zero', `non-zero') -dnl @result{}non-zero -esyscmd(`exit 2') -dnl @result{} -sysval -dnl @result{}2 -esyscmd(`true') -dnl @result{} -sysval -dnl @result{}0 diff -ruNp m4-1.4.10/checks/154.patsubst m4-1.4.11/checks/154.patsubst --- m4-1.4.10/checks/154.patsubst 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/154.patsubst 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,21 @@ +dnl @ ../doc/m4.texinfo:5394: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +undivert(`capitalize.m4')dnl +dnl @result{}divert(`-1') +dnl @result{}# upcase(text) +dnl @result{}# downcase(text) +dnl @result{}# capitalize(text) +dnl @result{}# change case of text, simple version +dnl @result{}define(`upcase', `translit(`$*', `a-z', `A-Z')') +dnl @result{}define(`downcase', `translit(`$*', `A-Z', `a-z')') +dnl @result{}define(`_capitalize', +dnl @result{} `regexp(`$1', `^\(\w\)\(\w*\)', +dnl @result{} `upcase(`\1')`'downcase(`\2')')') +dnl @result{}define(`capitalize', `patsubst(`$1', `\w+', `_$0(`\&')')') +dnl @result{}divert`'dnl diff -ruNp m4-1.4.10/checks/154.sysval m4-1.4.11/checks/154.sysval --- m4-1.4.10/checks/154.sysval 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/154.sysval 1969-12-31 17:00:00.000000000 -0700 @@ -1,25 +0,0 @@ -dnl @ ../doc/m4.texinfo:5529: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -dnl This test assumes kill is a shell builtin, and that signals are -dnl recognizable. -ifdef(`__unix__', , - `errprint(` skipping: syscmd does not have unix semantics -')m4exit(`77')')dnl -syscmd(`kill -9 $$') -dnl @result{} -sysval -dnl @result{}2304 -syscmd() -dnl @result{} -sysval -dnl @result{}0 -esyscmd(`kill -9 $$') -dnl @result{} -sysval -dnl @result{}2304 diff -ruNp m4-1.4.10/checks/155.mkstemp m4-1.4.11/checks/155.mkstemp --- m4-1.4.10/checks/155.mkstemp 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/155.mkstemp 1969-12-31 17:00:00.000000000 -0700 @@ -1,27 +0,0 @@ -dnl @ ../doc/m4.texinfo:5615: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -syscmd(`echo foo??????')dnl -dnl @result{}foo?????? -define(`file1', maketemp(`fooXXXXXX'))dnl -ifelse(esyscmd(`echo foo??????'), `foo??????', `no file', `created') -dnl @result{}created -define(`file2', maketemp(`fooXX'))dnl -define(`file3', mkstemp(`fooXXXXXX'))dnl -ifelse(len(file1), len(file2), `same length', `different') -dnl @result{}same length -ifelse(file1, file2, `same', `different file') -dnl @result{}different file -ifelse(file2, file3, `same', `different file') -dnl @result{}different file -ifelse(file1, file3, `same', `different file') -dnl @result{}different file -syscmd(`rm 'file1 file2 file3) -dnl @result{} -sysval -dnl @result{}0 diff -ruNp m4-1.4.10/checks/155.patsubst m4-1.4.11/checks/155.patsubst --- m4-1.4.10/checks/155.patsubst 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/155.patsubst 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,17 @@ +dnl @ ../doc/m4.texinfo:5415: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`patreg', +`patsubst($@) +regexp($@)')dnl +patreg(`bar foo baz Foo', `foo\|Foo', `FOO') +dnl @result{}bar FOO baz FOO +dnl @result{}FOO +patreg(`aba abb 121', `\(.\)\(.\)\1', `\2\1\2') +dnl @result{}bab abb 212 +dnl @result{}bab diff -ruNp m4-1.4.10/checks/156.errprint m4-1.4.11/checks/156.errprint --- m4-1.4.10/checks/156.errprint 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/156.errprint 1969-12-31 17:00:00.000000000 -0700 @@ -1,16 +0,0 @@ -dnl @ ../doc/m4.texinfo:5668: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -errprint(`Invalid arguments to forloop -') -dnl @error{}Invalid arguments to forloop -dnl @result{} -errprint(`1')errprint(`2',`3 -') -dnl @error{}12 3 -dnl @result{} diff -ruNp m4-1.4.10/checks/156.patsubst m4-1.4.11/checks/156.patsubst --- m4-1.4.10/checks/156.patsubst 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/156.patsubst 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,15 @@ +dnl @ ../doc/m4.texinfo:5430: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +patsubst(`abc') +dnl @error{}m4:stdin:1: Warning: too few arguments to builtin `patsubst' +dnl @result{}abc +patsubst(`abc', `') +dnl @result{}abc +patsubst(`abc', `', `\\-') +dnl @result{}\-a\-b\-c\- diff -ruNp m4-1.4.10/checks/157.format m4-1.4.11/checks/157.format --- m4-1.4.10/checks/157.format 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/157.format 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,28 @@ +dnl @ ../doc/m4.texinfo:5461: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `The brown fox jumped over the lazy dog') +dnl @result{} +format(`The string "%s" uses %d characters', foo, len(foo)) +dnl @result{}The string "The brown fox jumped over the lazy dog" uses 38 characters +format(`%*.*d', `-1', `-1', `1') +dnl @result{}1 +format(`%.0f', `56789.9876') +dnl @result{}56790 +len(format(`%-*X', `5000', `1')) +dnl @result{}5000 +ifelse(format(`%010F', `infinity'), ` INF', `success', + format(`%010F', `infinity'), ` INFINITY', `success', + format(`%010F', `infinity')) +dnl @result{}success +ifelse(format(`%.1A', `1.999'), `0X1.0P+1', `success', + format(`%.1A', `1.999'), `0X2.0P+0', `success', + format(`%.1A', `1.999')) +dnl @result{}success +format(`%g', `0xa.P+1') +dnl @result{}20 diff -ruNp m4-1.4.10/checks/157.location m4-1.4.11/checks/157.location --- m4-1.4.10/checks/157.location 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/157.location 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -dnl @ ../doc/m4.texinfo:5704: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -errprint(__program__:__file__:__line__: `input error -') -dnl @error{}m4:stdin:1: input error -dnl @result{} diff -ruNp m4-1.4.10/checks/158.format m4-1.4.11/checks/158.format --- m4-1.4.10/checks/158.format 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/158.format 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,23 @@ +dnl @ ../doc/m4.texinfo:5488: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +include(`forloop.m4') +dnl @result{} +forloop(`i', `1', `10', `format(`%6d squared is %10d +', i, eval(i**2))') +dnl @result{} 1 squared is 1 +dnl @result{} 2 squared is 4 +dnl @result{} 3 squared is 9 +dnl @result{} 4 squared is 16 +dnl @result{} 5 squared is 25 +dnl @result{} 6 squared is 36 +dnl @result{} 7 squared is 49 +dnl @result{} 8 squared is 64 +dnl @result{} 9 squared is 81 +dnl @result{} 10 squared is 100 +dnl @result{} diff -ruNp m4-1.4.10/checks/158.location m4-1.4.11/checks/158.location --- m4-1.4.10/checks/158.location 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/158.location 1969-12-31 17:00:00.000000000 -0700 @@ -1,17 +0,0 @@ -dnl @ ../doc/m4.texinfo:5723: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`foo', ``$0' called at __file__:__line__') -dnl @result{} -foo -dnl @result{}foo called at stdin:2 -include(`incl.m4') -dnl @result{}Include file start -dnl @result{}foo called at ../examples/incl.m4:2 -dnl @result{}Include file end -dnl @result{} diff -ruNp m4-1.4.10/checks/159.format m4-1.4.11/checks/159.format --- m4-1.4.10/checks/159.format 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/159.format 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,11 @@ +dnl @ ../doc/m4.texinfo:5529: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +format(`%p', `0') +dnl @error{}m4:stdin:1: Warning: unrecognized specifier in `%p' +dnl @result{} diff -ruNp m4-1.4.10/checks/159.location m4-1.4.11/checks/159.location --- m4-1.4.10/checks/159.location 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/159.location 1969-12-31 17:00:00.000000000 -0700 @@ -1,31 +0,0 @@ -dnl @ ../doc/m4.texinfo:5744: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`echo', `$@') -dnl @result{} -define(`foo', `echo(__line__ -__line__)') -dnl @result{} -echo(__line__ -__line__) -dnl @result{}4 -dnl @result{}5 -m4wrap(`foo -') -dnl @result{} -foo(errprint(__line__ -__line__ -)) -dnl @error{}8 -dnl @error{}9 -dnl @result{}8 -dnl @result{}8 -__line__ -dnl @result{}11 -dnl @result{}6 -dnl @result{}6 diff -ruNp m4-1.4.10/checks/160.incr m4-1.4.11/checks/160.incr --- m4-1.4.10/checks/160.incr 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/160.incr 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:5567: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +incr(`4') +dnl @result{}5 +decr(`7') +dnl @result{}6 +incr() +dnl @error{}m4:stdin:3: empty string treated as 0 in builtin `incr' +dnl @result{}1 +decr() +dnl @error{}m4:stdin:4: empty string treated as 0 in builtin `decr' +dnl @result{}-1 diff -ruNp m4-1.4.10/checks/160.m4exit m4-1.4.11/checks/160.m4exit --- m4-1.4.10/checks/160.m4exit 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/160.m4exit 1969-12-31 17:00:00.000000000 -0700 @@ -1,14 +0,0 @@ -dnl @ ../doc/m4.texinfo:5797: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -m4wrap(`This text is lost due to `m4exit'.') -dnl @result{} -divert(`1') So is this. -divert -dnl @result{} -m4exit And this is never read. diff -ruNp m4-1.4.10/checks/161.eval m4-1.4.11/checks/161.eval --- m4-1.4.10/checks/161.eval 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/161.eval 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,17 @@ +dnl @ ../doc/m4.texinfo:5644: Origin of test +dnl @ expected status: 1 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +eval(`2 = 2') +dnl @error{}m4:stdin:1: Warning: recommend ==, not =, for equality operator +dnl @result{}1 +eval(`++0') +dnl @error{}m4:stdin:2: invalid operator in eval: ++0 +dnl @result{} +eval(`0 |= 1') +dnl @error{}m4:stdin:3: invalid operator in eval: 0 |= 1 +dnl @result{} diff -ruNp m4-1.4.10/checks/161.m4exit m4-1.4.11/checks/161.m4exit --- m4-1.4.10/checks/161.m4exit 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/161.m4exit 1969-12-31 17:00:00.000000000 -0700 @@ -1,14 +0,0 @@ -dnl @ ../doc/m4.texinfo:5815: Origin of test -dnl @ expected status: 1 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`fatal_error', - `errprint(__program__:__file__:__line__`: fatal error: $* -')m4exit(`1')') -dnl @result{} -fatal_error(`this is a BAD one, buster') -dnl @error{}m4:stdin:4: fatal error: this is a BAD one, buster diff -ruNp m4-1.4.10/checks/162.eval m4-1.4.11/checks/162.eval --- m4-1.4.10/checks/162.eval 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/162.eval 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,32 @@ +dnl @ ../doc/m4.texinfo:5677: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +eval(`1 == 2 > 0') +dnl @result{}1 +eval(`(1 == 2) > 0') +dnl @result{}0 +eval(`! 0 * 2') +dnl @result{}2 +eval(`! (0 * 2)') +dnl @result{}1 +eval(`1 | 1 ^ 1') +dnl @result{}1 +eval(`(1 | 1) ^ 1') +dnl @result{}0 +eval(`+ + - ~ ! ~ 0') +dnl @result{}1 +eval(`2 || 1 / 0') +dnl @result{}1 +eval(`0 || 1 / 0') +dnl @error{}m4:stdin:9: divide by zero in eval: 0 || 1 / 0 +dnl @result{} +eval(`0 && 1 % 0') +dnl @result{}0 +eval(`2 && 1 % 0') +dnl @error{}m4:stdin:11: modulo by zero in eval: 2 && 1 % 0 +dnl @result{} diff -ruNp m4-1.4.10/checks/162.extensions m4-1.4.11/checks/162.extensions --- m4-1.4.10/checks/162.extensions 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/162.extensions 1969-12-31 17:00:00.000000000 -0700 @@ -1,25 +0,0 @@ -dnl @ ../doc/m4.texinfo:6068: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`a1', `A1') -dnl @result{} -dnl First argument, concatenated with 1 -define(`_1', `$1')define(`first1', `_1($@)1') -dnl @result{} -dnl Eleventh argument, portable -define(`_9', `$9')define(`eleventh', `_9(shift(shift($@)))') -dnl @result{} -dnl Eleventh argument, GNU style -define(`Eleventh', `$11') -dnl @result{} -first1(`a', `b', `c', `d', `e', `f', `g', `h', `i', `j', `k') -dnl @result{}A1 -eleventh(`a', `b', `c', `d', `e', `f', `g', `h', `i', `j', `k') -dnl @result{}k -Eleventh(`a', `b', `c', `d', `e', `f', `g', `h', `i', `j', `k') -dnl @result{}k diff -ruNp m4-1.4.10/checks/163.eval m4-1.4.11/checks/163.eval --- m4-1.4.10/checks/163.eval 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/163.eval 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,22 @@ +dnl @ ../doc/m4.texinfo:5710: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +eval(`2 ** 3 ** 2') +dnl @result{}512 +eval(`(2 ** 3) ** 2') +dnl @result{}64 +eval(`0 ** 1') +dnl @result{}0 +eval(`2 ** 0') +dnl @result{}1 +eval(`0 ** 0') +dnl @result{} +dnl @error{}m4:stdin:5: divide by zero in eval: 0 ** 0 +eval(`4 ** -2') +dnl @error{}m4:stdin:6: negative exponent in eval: 4 ** -2 +dnl @result{} diff -ruNp m4-1.4.10/checks/163.incompatib m4-1.4.11/checks/163.incompatib --- m4-1.4.10/checks/163.incompatib 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/163.incompatib 1969-12-31 17:00:00.000000000 -0700 @@ -1,25 +0,0 @@ -dnl @ ../doc/m4.texinfo:6196: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -undivert(`wrapfifo.m4')dnl -dnl @result{}dnl Redefine m4wrap to have FIFO semantics. -dnl @result{}define(`_m4wrap_level', `0')dnl -dnl @result{}define(`m4wrap', -dnl @result{}`ifdef(`m4wrap'_m4wrap_level, -dnl @result{} `define(`m4wrap'_m4wrap_level, -dnl @result{} defn(`m4wrap'_m4wrap_level)`$1')', -dnl @result{} `builtin(`m4wrap', `define(`_m4wrap_level', -dnl @result{} incr(_m4wrap_level))dnl -dnl @result{}m4wrap'_m4wrap_level)dnl -dnl @result{}define(`m4wrap'_m4wrap_level, `$1')')')dnl -include(`wrapfifo.m4') -dnl @result{} -m4wrap(`a`'m4wrap(`c -', `d')')m4wrap(`b') -dnl @result{} -dnl @result{}abc diff -ruNp m4-1.4.10/checks/164.eval m4-1.4.11/checks/164.eval --- m4-1.4.10/checks/164.eval 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/164.eval 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,33 @@ +dnl @ ../doc/m4.texinfo:5746: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +eval(`-3 * 5') +dnl @result{}-15 +eval(`-99 / 10') +dnl @result{}-9 +eval(`-99 % 10') +dnl @result{}-9 +eval(`99 % -10') +dnl @result{}9 +eval(index(`Hello world', `llo') >= 0) +dnl @result{}1 +eval(`0r1:0111 + 0b100 + 0r3:12') +dnl @result{}12 +define(`square', `eval(`($1) ** 2')') +dnl @result{} +square(`9') +dnl @result{}81 +square(square(`5')` + 1') +dnl @result{}676 +define(`foo', `666') +dnl @result{} +eval(`foo / 6') +dnl @error{}m4:stdin:11: bad expression in eval: foo / 6 +dnl @result{} +eval(foo / 6) +dnl @result{}111 diff -ruNp m4-1.4.10/checks/164.other_inco m4-1.4.11/checks/164.other_inco --- m4-1.4.10/checks/164.other_inco 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/164.other_inco 1969-12-31 17:00:00.000000000 -0700 @@ -1,17 +0,0 @@ -dnl @ ../doc/m4.texinfo:6358: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -s -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -divert(2)2 -divert(1)1 -divert`'0 -dnl @result{}#line 3 "stdin" -dnl @result{}0 -dnl @result{}#line 2 "stdin" -dnl @result{}1 -dnl @result{}#line 1 "stdin" -dnl @result{}2 diff -ruNp m4-1.4.10/checks/165.eval m4-1.4.11/checks/165.eval --- m4-1.4.10/checks/165.eval 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/165.eval 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,26 @@ +dnl @ ../doc/m4.texinfo:5785: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`max_int', eval(`0x7fffffff')) +dnl @result{} +define(`min_int', incr(max_int)) +dnl @result{} +eval(min_int` < 0') +dnl @result{}1 +eval(max_int` > 0') +dnl @result{}1 +ifelse(eval(min_int` / -1'), min_int, `overflow occurred') +dnl @result{}overflow occurred +min_int +dnl @result{}-2147483648 +eval(`0x80000000 % -1') +dnl @result{}0 +eval(`-4 >> 1') +dnl @result{}-2 +eval(`-4 >> 33') +dnl @result{}-2 diff -ruNp m4-1.4.10/checks/165.other_inco m4-1.4.11/checks/165.other_inco --- m4-1.4.10/checks/165.other_inco 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/165.other_inco 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -dnl @ ../doc/m4.texinfo:6383: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`x', `x') -dnl @result{} -define(`x', `x ') -dnl @result{} diff -ruNp m4-1.4.10/checks/166.eval m4-1.4.11/checks/166.eval --- m4-1.4.10/checks/166.eval 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/166.eval 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,33 @@ +dnl @ ../doc/m4.texinfo:5818: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +eval(`666', `10') +dnl @result{}666 +eval(`666', `11') +dnl @result{}556 +eval(`666', `6') +dnl @result{}3030 +eval(`666', `6', `10') +dnl @result{}0000003030 +eval(`-666', `6', `10') +dnl @result{}-0000003030 +eval(`10', `', `0') +dnl @result{}10 +`0r1:'eval(`10', `1', `11') +dnl @result{}0r1:01111111111 +eval(`10', `16') +dnl @result{}a +eval(`1', `37') +dnl @error{}m4:stdin:9: radix 37 in builtin `eval' out of range +dnl @result{} +eval(`1', , `-1') +dnl @error{}m4:stdin:10: negative width to builtin `eval' +dnl @result{} +eval() +dnl @error{}m4:stdin:11: empty string treated as 0 in builtin `eval' +dnl @result{}0 diff -ruNp m4-1.4.10/checks/166.improved_e m4-1.4.11/checks/166.improved_e --- m4-1.4.10/checks/166.improved_e 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/166.improved_e 1969-12-31 17:00:00.000000000 -0700 @@ -1,14 +0,0 @@ -dnl @ ../doc/m4.texinfo:6434: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`exch', ``$2', `$1'') -dnl @result{} -define(exch(`expansion text', `macro')) -dnl @result{} -macro -dnl @result{}expansion text diff -ruNp m4-1.4.10/checks/167.improved_f m4-1.4.11/checks/167.improved_f --- m4-1.4.10/checks/167.improved_f 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/167.improved_f 1969-12-31 17:00:00.000000000 -0700 @@ -1,32 +0,0 @@ -dnl @ ../doc/m4.texinfo:6454: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -undivert(`forloop2.m4')dnl -dnl @result{}divert(`-1') -dnl @result{}# forloop(var, from, to, stmt) - improved version: -dnl @result{}# works even if VAR is not a strict macro name -dnl @result{}# performs sanity check that FROM is larger than TO -dnl @result{}# allows complex numerical expressions in TO and FROM -dnl @result{}define(`forloop', `ifelse(eval(`($3) >= ($2)'), `1', -dnl @result{} `pushdef(`$1', eval(`$2'))_forloop(`$1', -dnl @result{} eval(`$3'), `$4')popdef(`$1')')') -dnl @result{}define(`_forloop', -dnl @result{} `$3`'ifelse(indir(`$1'), `$2', `', -dnl @result{} `define(`$1', incr(indir(`$1')))$0($@)')') -dnl @result{}divert`'dnl -include(`forloop2.m4') -dnl @result{} -forloop(`i', `2', `1', `no iteration occurs') -dnl @result{} -forloop(`', `1', `2', ` odd iterator name') -dnl @result{} odd iterator name odd iterator name -forloop(`i', `5 + 5', `0xc', ` 0x`'eval(i, `16')') -dnl @result{} 0xa 0xb 0xc -forloop(`i', `a', `b', `non-numeric bounds') -dnl @error{}m4:stdin:6: bad expression in eval (bad input): (b) >= (a) -dnl @result{} diff -ruNp m4-1.4.10/checks/167.platform_m m4-1.4.11/checks/167.platform_m --- m4-1.4.10/checks/167.platform_m 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/167.platform_m 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:5899: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +__gnu__ +dnl @result{} +__gnu__(`ignored') +dnl @result{} +Extensions are ifdef(`__gnu__', `active', `inactive') +dnl @result{}Extensions are active diff -ruNp m4-1.4.10/checks/168.improved_f m4-1.4.11/checks/168.improved_f --- m4-1.4.10/checks/168.improved_f 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/168.improved_f 1969-12-31 17:00:00.000000000 -0700 @@ -1,34 +0,0 @@ -dnl @ ../doc/m4.texinfo:6494: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -include(`foreachq.m4') -dnl @result{} -traceon(`shift')debugmode(`aq') -dnl @result{} -foreachq(`x', ``1', `2', `3', `4'', `x -')dnl -dnl @result{}1 -dnl @error{}m4trace: -3- shift(`1', `2', `3', `4') -dnl @error{}m4trace: -2- shift(`1', `2', `3', `4') -dnl @result{}2 -dnl @error{}m4trace: -4- shift(`1', `2', `3', `4') -dnl @error{}m4trace: -3- shift(`2', `3', `4') -dnl @error{}m4trace: -3- shift(`1', `2', `3', `4') -dnl @error{}m4trace: -2- shift(`2', `3', `4') -dnl @result{}3 -dnl @error{}m4trace: -5- shift(`1', `2', `3', `4') -dnl @error{}m4trace: -4- shift(`2', `3', `4') -dnl @error{}m4trace: -3- shift(`3', `4') -dnl @error{}m4trace: -4- shift(`1', `2', `3', `4') -dnl @error{}m4trace: -3- shift(`2', `3', `4') -dnl @error{}m4trace: -2- shift(`3', `4') -dnl @result{}4 -dnl @error{}m4trace: -6- shift(`1', `2', `3', `4') -dnl @error{}m4trace: -5- shift(`2', `3', `4') -dnl @error{}m4trace: -4- shift(`3', `4') -dnl @error{}m4trace: -3- shift(`4') diff -ruNp m4-1.4.10/checks/168.platform_m m4-1.4.11/checks/168.platform_m --- m4-1.4.10/checks/168.platform_m 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/168.platform_m 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:5910: Origin of test +dnl @ expected status: 0 +dnl @ extra options: -G +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +__gnu__ +dnl @result{}__gnu__ +__gnu__(`ignored') +dnl @result{}__gnu__(ignored) +Extensions are ifdef(`__gnu__', `active', `inactive') +dnl @result{}Extensions are inactive diff -ruNp m4-1.4.10/checks/169.improved_f m4-1.4.11/checks/169.improved_f --- m4-1.4.10/checks/169.improved_f 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/169.improved_f 1969-12-31 17:00:00.000000000 -0700 @@ -1,32 +0,0 @@ -dnl @ ../doc/m4.texinfo:6535: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -include(`foreachq2.m4') -dnl @result{} -undivert(`foreachq2.m4')dnl -dnl @result{}include(`quote.m4')dnl -dnl @result{}divert(`-1') -dnl @result{}# foreachq(x, `item_1, item_2, ..., item_n', stmt) -dnl @result{}# quoted list, improved version -dnl @result{}define(`foreachq', `pushdef(`$1')_foreachq($@)popdef(`$1')') -dnl @result{}define(`_arg1q', ``$1'') -dnl @result{}define(`_rest', `ifelse(`$#', `1', `', `dquote(shift($@))')') -dnl @result{}define(`_foreachq', `ifelse(`$2', `', `', -dnl @result{} `define(`$1', _arg1q($2))$3`'$0(`$1', _rest($2), `$3')')') -dnl @result{}divert`'dnl -traceon(`shift')debugmode(`aq') -dnl @result{} -foreachq(`x', ``1', `2', `3', `4'', `x -')dnl -dnl @result{}1 -dnl @error{}m4trace: -3- shift(`1', `2', `3', `4') -dnl @result{}2 -dnl @error{}m4trace: -3- shift(`2', `3', `4') -dnl @result{}3 -dnl @error{}m4trace: -3- shift(`3', `4') -dnl @result{}4 diff -ruNp m4-1.4.10/checks/169.platform_m m4-1.4.11/checks/169.platform_m --- m4-1.4.10/checks/169.platform_m 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/169.platform_m 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:5933: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`provided', `0') +dnl @result{} +ifdef(`__unix__', `define(`provided', incr(provided))') +dnl @result{} +ifdef(`__windows__', `define(`provided', incr(provided))') +dnl @result{} +ifdef(`__os2__', `define(`provided', incr(provided))') +dnl @result{} +provided +dnl @result{}1 diff -ruNp m4-1.4.10/checks/170.improved_f m4-1.4.11/checks/170.improved_f --- m4-1.4.10/checks/170.improved_f 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/170.improved_f 1969-12-31 17:00:00.000000000 -0700 @@ -1,36 +0,0 @@ -dnl @ ../doc/m4.texinfo:6577: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -include(`foreach2.m4') -dnl @result{} -undivert(`foreach2.m4')dnl -dnl @result{}include(`quote.m4')dnl -dnl @result{}divert(`-1') -dnl @result{}# foreach(x, (item_1, item_2, ..., item_n), stmt) -dnl @result{}# parenthesized list, improved version -dnl @result{}define(`foreach', `pushdef(`$1')_foreach(`$1', -dnl @result{} (dquote(dquote_elt$2)), `$3')popdef(`$1')') -dnl @result{}define(`_arg1', `$1') -dnl @result{}define(`_foreach', `ifelse(`$2', `(`')', `', -dnl @result{} `define(`$1', _arg1$2)$3`'$0(`$1', (dquote(shift$2)), `$3')')') -dnl @result{}divert`'dnl -traceon(`shift')debugmode(`aq') -dnl @result{} -foreach(`x', `(`1', `2', `3', `4')', `x -')dnl -dnl @error{}m4trace: -4- shift(`1', `2', `3', `4') -dnl @error{}m4trace: -4- shift(`2', `3', `4') -dnl @error{}m4trace: -4- shift(`3', `4') -dnl @result{}1 -dnl @error{}m4trace: -3- shift(``1'', ``2'', ``3'', ``4'') -dnl @result{}2 -dnl @error{}m4trace: -3- shift(``2'', ``3'', ``4'') -dnl @result{}3 -dnl @error{}m4trace: -3- shift(``3'', ``4'') -dnl @result{}4 -dnl @error{}m4trace: -3- shift(``4'') diff -ruNp m4-1.4.10/checks/170.syscmd m4-1.4.11/checks/170.syscmd --- m4-1.4.10/checks/170.syscmd 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/170.syscmd 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,13 @@ +dnl @ ../doc/m4.texinfo:5966: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `FOO') +dnl @result{} +syscmd(`echo foo') +dnl @result{}foo +dnl @result{} diff -ruNp m4-1.4.10/checks/171.improved_f m4-1.4.11/checks/171.improved_f --- m4-1.4.10/checks/171.improved_f 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/171.improved_f 1969-12-31 17:00:00.000000000 -0700 @@ -1,72 +0,0 @@ -dnl @ ../doc/m4.texinfo:6622: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -include(`foreach2.m4') -dnl @result{} -include(`foreachq2.m4') -dnl @result{} -dnl 0-element list: -foreach(`x', `', `<x>') / foreachq(`x', `', `<x>') -dnl @result{} / -dnl 1-element list of empty element -foreach(`x', `()', `<x>') / foreachq(`x', ``'', `<x>') -dnl @result{}<> / <> -dnl 2-element list of empty elements -foreach(`x', `(`',`')', `<x>') / foreachq(`x', ``',`'', `<x>') -dnl @result{}<><> / <><> -dnl 1-element list of a comma -foreach(`x', `(`,')', `<x>') / foreachq(`x', ``,'', `<x>') -dnl @result{}<,> / <,> -dnl 2-element list of unbalanced parentheses -foreach(`x', `(`(', `)')', `<x>') / foreachq(`x', ``(', `)'', `<x>') -dnl @result{}<(><)> / <(><)> -define(`active', `ACT, IVE') -dnl @result{} -traceon(`active') -dnl @result{} -dnl list of unquoted macros; expansion occurs before recursion -foreach(`x', `(active, active)', `<x> -')dnl -dnl @error{}m4trace: -4- active -> `ACT, IVE' -dnl @error{}m4trace: -4- active -> `ACT, IVE' -dnl @result{}<ACT> -dnl @result{}<IVE> -dnl @result{}<ACT> -dnl @result{}<IVE> -foreachq(`x', `active, active', `<x> -')dnl -dnl @error{}m4trace: -3- active -> `ACT, IVE' -dnl @error{}m4trace: -3- active -> `ACT, IVE' -dnl @result{}<ACT> -dnl @error{}m4trace: -3- active -> `ACT, IVE' -dnl @error{}m4trace: -3- active -> `ACT, IVE' -dnl @result{}<IVE> -dnl @result{}<ACT> -dnl @result{}<IVE> -dnl list of quoted macros; expansion occurs during recursion -foreach(`x', `(`active', `active')', `<x> -')dnl -dnl @error{}m4trace: -1- active -> `ACT, IVE' -dnl @result{}<ACT, IVE> -dnl @error{}m4trace: -1- active -> `ACT, IVE' -dnl @result{}<ACT, IVE> -foreachq(`x', ``active', `active'', `<x> -')dnl -dnl @error{}m4trace: -1- active -> `ACT, IVE' -dnl @result{}<ACT, IVE> -dnl @error{}m4trace: -1- active -> `ACT, IVE' -dnl @result{}<ACT, IVE> -dnl list of double-quoted macro names; no expansion -foreach(`x', `(``active'', ``active'')', `<x> -')dnl -dnl @result{}<active> -dnl @result{}<active> -foreachq(`x', ```active'', ``active''', `<x> -')dnl -dnl @result{}<active> -dnl @result{}<active> diff -ruNp m4-1.4.10/checks/171.syscmd m4-1.4.11/checks/171.syscmd --- m4-1.4.10/checks/171.syscmd 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/171.syscmd 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,10 @@ +dnl @ ../doc/m4.texinfo:5995: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +m4wrap(`syscmd(`cat')') +dnl @result{} diff -ruNp m4-1.4.10/checks/172.esyscmd m4-1.4.11/checks/172.esyscmd --- m4-1.4.10/checks/172.esyscmd 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/172.esyscmd 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,13 @@ +dnl @ ../doc/m4.texinfo:6034: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `FOO') +dnl @result{} +esyscmd(`echo foo') +dnl @result{}FOO +dnl @result{} diff -ruNp m4-1.4.10/checks/172.improved_c m4-1.4.11/checks/172.improved_c --- m4-1.4.10/checks/172.improved_c 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/172.improved_c 1969-12-31 17:00:00.000000000 -0700 @@ -1,30 +0,0 @@ -dnl @ ../doc/m4.texinfo:6699: Origin of test -dnl @ expected status: 0 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`cleardivert', - `pushdef(`_n', divnum)divert(`-1')undivert($@)divert(_n)popdef(`_n')') -dnl @result{} -divert(`1')one -divert -dnl @result{} -cleardivert -dnl @result{} -undivert -dnl @result{}one -dnl @result{} -define(`cleardivert', - `pushdef(`_num', divnum)divert(`-1')ifelse(`$#', `0', - `undivert`'', `undivert($@)')divert(_num)popdef(`_num')') -dnl @result{} -divert(`2')two -divert -dnl @result{} -cleardivert -dnl @result{} -undivert -dnl @result{} diff -ruNp m4-1.4.10/checks/173.improved_f m4-1.4.11/checks/173.improved_f --- m4-1.4.10/checks/173.improved_f 2007-07-05 08:26:40.000000000 -0600 +++ m4-1.4.11/checks/173.improved_f 1969-12-31 17:00:00.000000000 -0700 @@ -1,20 +0,0 @@ -dnl @ ../doc/m4.texinfo:6737: Origin of test -dnl @ expected status: 1 -dnl @ extra options: -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`fatal_error', - `errprint(ifdef(`__program__', `__program__', ``m4'')'dnl -`:ifelse(__line__, `0', `', - `__file__:__line__:')` fatal error: $* -')m4exit(`1')') -dnl @result{} -m4wrap(`divnum(`demo of internal message') -fatal_error(`inside wrapped text')') -dnl @result{} -dnl @error{}m4:stdin:6: Warning: excess arguments to builtin `divnum' ignored -dnl @result{}0 -dnl @error{}m4:stdin:6: fatal error: inside wrapped text diff -ruNp m4-1.4.10/checks/173.sysval m4-1.4.11/checks/173.sysval --- m4-1.4.10/checks/173.sysval 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/173.sysval 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,34 @@ +dnl @ ../doc/m4.texinfo:6064: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +sysval +dnl @result{}0 +syscmd(`false') +dnl @result{} +ifelse(sysval, `0', `zero', `non-zero') +dnl @result{}non-zero +syscmd(`exit 2') +dnl @result{} +sysval +dnl @result{}2 +syscmd(`true') +dnl @result{} +sysval +dnl @result{}0 +esyscmd(`false') +dnl @result{} +ifelse(sysval, `0', `zero', `non-zero') +dnl @result{}non-zero +esyscmd(`exit 2') +dnl @result{} +sysval +dnl @result{}2 +esyscmd(`true') +dnl @result{} +sysval +dnl @result{}0 diff -ruNp m4-1.4.10/checks/174.sysval m4-1.4.11/checks/174.sysval --- m4-1.4.10/checks/174.sysval 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/174.sysval 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,25 @@ +dnl @ ../doc/m4.texinfo:6114: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +dnl This test assumes kill is a shell builtin, and that signals are +dnl recognizable. +ifdef(`__unix__', , + `errprint(` skipping: syscmd does not have unix semantics +')m4exit(`77')')dnl +syscmd(`kill -9 $$') +dnl @result{} +sysval +dnl @result{}2304 +syscmd() +dnl @result{} +sysval +dnl @result{}0 +esyscmd(`kill -9 $$') +dnl @result{} +sysval +dnl @result{}2304 diff -ruNp m4-1.4.10/checks/175.mkstemp m4-1.4.11/checks/175.mkstemp --- m4-1.4.10/checks/175.mkstemp 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/175.mkstemp 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,31 @@ +dnl @ ../doc/m4.texinfo:6208: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `errprint(`oops')') +dnl @result{} +syscmd(`rm -f foo-??????')sysval +dnl @result{}0 +define(`file1', maketemp(`foo-XXXXXX'))dnl +ifelse(esyscmd(`echo \` foo-?????? \''), ` foo-?????? ', + `no file', `created') +dnl @result{}created +define(`file2', maketemp(`foo-XX'))dnl +define(`file3', mkstemp(`foo-XXXXXX'))dnl +ifelse(len(defn(`file1')), len(defn(`file2')), + `same length', `different') +dnl @result{}same length +ifelse(defn(`file1'), defn(`file2'), `same', `different file') +dnl @result{}different file +ifelse(defn(`file2'), defn(`file3'), `same', `different file') +dnl @result{}different file +ifelse(defn(`file1'), defn(`file3'), `same', `different file') +dnl @result{}different file +syscmd(`rm 'defn(`file1') defn(`file2') defn(`file3')) +dnl @result{} +sysval +dnl @result{}0 diff -ruNp m4-1.4.10/checks/176.mkstemp m4-1.4.11/checks/176.mkstemp --- m4-1.4.10/checks/176.mkstemp 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/176.mkstemp 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:6239: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +syscmd(`rm -f foo??????')sysval +dnl @result{}0 +len(mkstemp(`fooXXXXX')) +dnl @result{}9 +syscmd(`rm foo??????')sysval +dnl @result{}0 diff -ruNp m4-1.4.10/checks/177.mkstemp m4-1.4.11/checks/177.mkstemp --- m4-1.4.10/checks/177.mkstemp 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/177.mkstemp 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,20 @@ +dnl @ ../doc/m4.texinfo:6252: Origin of test +dnl @ expected status: 0 +dnl @ extra options: -G +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +syscmd(`rm -f foo-*')sysval +dnl @result{}0 +len(maketemp(`foo-XXXXX')) +dnl @error{}m4:stdin:2: recommend using mkstemp instead +dnl @result{}9 +define(`abc', `def') +dnl @result{} +maketemp(`foo-abc') +dnl @result{}foo-def +dnl @error{}m4:stdin:4: recommend using mkstemp instead +syscmd(`test -f foo-*')sysval +dnl @result{}1 diff -ruNp m4-1.4.10/checks/178.errprint m4-1.4.11/checks/178.errprint --- m4-1.4.10/checks/178.errprint 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/178.errprint 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:6298: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +errprint(`Invalid arguments to forloop +') +dnl @error{}Invalid arguments to forloop +dnl @result{} +errprint(`1')errprint(`2',`3 +') +dnl @error{}12 3 +dnl @result{} diff -ruNp m4-1.4.10/checks/179.location m4-1.4.11/checks/179.location --- m4-1.4.10/checks/179.location 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/179.location 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:6335: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +errprint(__program__:__file__:__line__: `input error +') +dnl @error{}m4:stdin:1: input error +dnl @result{} diff -ruNp m4-1.4.10/checks/180.location m4-1.4.11/checks/180.location --- m4-1.4.10/checks/180.location 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/180.location 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,17 @@ +dnl @ ../doc/m4.texinfo:6355: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', ``$0' called at __file__:__line__') +dnl @result{} +foo +dnl @result{}foo called at stdin:2 +include(`incl.m4') +dnl @result{}Include file start +dnl @result{}foo called at ../examples/incl.m4:2 +dnl @result{}Include file end +dnl @result{} diff -ruNp m4-1.4.10/checks/181.location m4-1.4.11/checks/181.location --- m4-1.4.10/checks/181.location 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/181.location 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,35 @@ +dnl @ ../doc/m4.texinfo:6376: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`echo', `$@') +dnl @result{} +define(`foo', `echo(__line__ +__line__)') +dnl @result{} +echo(__line__ +__line__) +dnl @result{}4 +dnl @result{}5 +m4wrap(`foo +') +dnl @result{} +foo(errprint(__line__ +__line__ +)) +dnl @error{}8 +dnl @error{}9 +dnl @result{}8 +dnl @result{}8 +__line__ +dnl @result{}11 +m4wrap(`__line__ +') +dnl @result{} +dnl @result{}12 +dnl @result{}6 +dnl @result{}6 diff -ruNp m4-1.4.10/checks/182.m4exit m4-1.4.11/checks/182.m4exit --- m4-1.4.10/checks/182.m4exit 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/182.m4exit 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:6433: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +m4wrap(`This text is lost due to `m4exit'.') +dnl @result{} +divert(`1') So is this. +divert +dnl @result{} +m4exit And this is never read. diff -ruNp m4-1.4.10/checks/183.m4exit m4-1.4.11/checks/183.m4exit --- m4-1.4.10/checks/183.m4exit 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/183.m4exit 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:6451: Origin of test +dnl @ expected status: 1 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`fatal_error', + `errprint(__program__:__file__:__line__`: fatal error: $* +')m4exit(`1')') +dnl @result{} +fatal_error(`this is a BAD one, buster') +dnl @error{}m4:stdin:4: fatal error: this is a BAD one, buster diff -ruNp m4-1.4.10/checks/184.using_froz m4-1.4.11/checks/184.using_froz --- m4-1.4.10/checks/184.using_froz 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/184.using_froz 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:6587: Origin of test +dnl @ expected status: 0 +dnl @ extra options: -F /dev/null +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +ifdef(`__unix__', , + `errprint(` skipping: /dev/null not known to exist +')m4exit(`77')')dnl +traceon(`undefined')dnl diff -ruNp m4-1.4.10/checks/185.extensions m4-1.4.11/checks/185.extensions --- m4-1.4.10/checks/185.extensions 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/185.extensions 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,25 @@ +dnl @ ../doc/m4.texinfo:6724: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`a1', `A1') +dnl @result{} +dnl First argument, concatenated with 1 +define(`_1', `$1')define(`first1', `_1($@)1') +dnl @result{} +dnl Eleventh argument, portable +define(`_9', `$9')define(`eleventh', `_9(shift(shift($@)))') +dnl @result{} +dnl Eleventh argument, GNU style +define(`Eleventh', `$11') +dnl @result{} +first1(`a', `b', `c', `d', `e', `f', `g', `h', `i', `j', `k') +dnl @result{}A1 +eleventh(`a', `b', `c', `d', `e', `f', `g', `h', `i', `j', `k') +dnl @result{}k +Eleventh(`a', `b', `c', `d', `e', `f', `g', `h', `i', `j', `k') +dnl @result{}k diff -ruNp m4-1.4.10/checks/186.other_inco m4-1.4.11/checks/186.other_inco --- m4-1.4.10/checks/186.other_inco 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/186.other_inco 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,17 @@ +dnl @ ../doc/m4.texinfo:6995: Origin of test +dnl @ expected status: 0 +dnl @ extra options: -s +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +divert(2)2 +divert(1)1 +divert`'0 +dnl @result{}#line 3 "stdin" +dnl @result{}0 +dnl @result{}#line 2 "stdin" +dnl @result{}1 +dnl @result{}#line 1 "stdin" +dnl @result{}2 diff -ruNp m4-1.4.10/checks/187.other_inco m4-1.4.11/checks/187.other_inco --- m4-1.4.10/checks/187.other_inco 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/187.other_inco 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:7020: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`x', `x') +dnl @result{} +define(`x', `x ') +dnl @result{} diff -ruNp m4-1.4.10/checks/188.improved_e m4-1.4.11/checks/188.improved_e --- m4-1.4.10/checks/188.improved_e 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/188.improved_e 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:7073: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`exch', ``$2', `$1'') +dnl @result{} +define(exch(`expansion text', `macro')) +dnl @result{} +macro +dnl @result{}expansion text diff -ruNp m4-1.4.10/checks/189.improved_f m4-1.4.11/checks/189.improved_f --- m4-1.4.10/checks/189.improved_f 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/189.improved_f 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,32 @@ +dnl @ ../doc/m4.texinfo:7094: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +undivert(`forloop2.m4')dnl +dnl @result{}divert(`-1') +dnl @result{}# forloop(var, from, to, stmt) - improved version: +dnl @result{}# works even if VAR is not a strict macro name +dnl @result{}# performs sanity check that FROM is larger than TO +dnl @result{}# allows complex numerical expressions in TO and FROM +dnl @result{}define(`forloop', `ifelse(eval(`($3) >= ($2)'), `1', +dnl @result{} `pushdef(`$1', eval(`$2'))_$0(`$1', +dnl @result{} eval(`$3'), `$4')popdef(`$1')')') +dnl @result{}define(`_forloop', +dnl @result{} `$3`'ifelse(indir(`$1'), `$2', `', +dnl @result{} `define(`$1', incr(indir(`$1')))$0($@)')') +dnl @result{}divert`'dnl +include(`forloop2.m4') +dnl @result{} +forloop(`i', `2', `1', `no iteration occurs') +dnl @result{} +forloop(`', `1', `2', ` odd iterator name') +dnl @result{} odd iterator name odd iterator name +forloop(`i', `5 + 5', `0xc', ` 0x`'eval(i, `16')') +dnl @result{} 0xa 0xb 0xc +forloop(`i', `a', `b', `non-numeric bounds') +dnl @error{}m4:stdin:6: bad expression in eval (bad input): (b) >= (a) +dnl @result{} diff -ruNp m4-1.4.10/checks/190.improved_f m4-1.4.11/checks/190.improved_f --- m4-1.4.10/checks/190.improved_f 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/190.improved_f 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,33 @@ +dnl @ ../doc/m4.texinfo:7135: Origin of test +dnl @ expected status: 1 +dnl @ extra options: -L9 +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`arg1', `$1')include(`forloop2.m4')include(`quote.m4') +dnl @result{} +define(`double', `define(`$1'`2', + arg1(patsubst(dquote(defn(`$1')), `[`']', `\&\&')))') +dnl @result{} +double(`forloop')double(`_forloop')defn(`forloop2') +dnl @result{}ifelse(eval(``($3) >= ($2)''), ``1'', +dnl @result{} ``pushdef(``$1'', eval(``$2''))_$0(``$1'', +dnl @result{} eval(``$3''), ``$4'')popdef(``$1'')'') +forloop(i, 1, 5, `ifelse(')forloop(i, 1, 5, `)') +dnl @result{} +changequote(`[', `]')changequote([``], ['']) +dnl @result{} +forloop2(i, 1, 5, ``ifelse('')forloop2(i, 1, 5, ``)'') +dnl @result{} +changequote`'include(`forloop.m4') +dnl @result{} +double(`forloop')double(`_forloop')defn(`forloop2') +dnl @result{}pushdef(``$1'', ``$2'')_forloop($@)popdef(``$1'') +forloop(i, 1, 5, `ifelse(')forloop(i, 1, 5, `)') +dnl @result{} +changequote(`[', `]')changequote([``], ['']) +dnl @result{} +forloop2(i, 1, 5, ``ifelse('')forloop2(i, 1, 5, ``)'') +dnl @error{}m4:stdin:12: recursion limit of 9 exceeded, use -L<N> to change it diff -ruNp m4-1.4.10/checks/191.improved_f m4-1.4.11/checks/191.improved_f --- m4-1.4.10/checks/191.improved_f 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/191.improved_f 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,34 @@ +dnl @ ../doc/m4.texinfo:7177: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +include(`foreachq.m4') +dnl @result{} +traceon(`shift')debugmode(`aq') +dnl @result{} +foreachq(`x', ``1', `2', `3', `4'', `x +')dnl +dnl @result{}1 +dnl @error{}m4trace: -3- shift(`1', `2', `3', `4') +dnl @error{}m4trace: -2- shift(`1', `2', `3', `4') +dnl @result{}2 +dnl @error{}m4trace: -4- shift(`1', `2', `3', `4') +dnl @error{}m4trace: -3- shift(`2', `3', `4') +dnl @error{}m4trace: -3- shift(`1', `2', `3', `4') +dnl @error{}m4trace: -2- shift(`2', `3', `4') +dnl @result{}3 +dnl @error{}m4trace: -5- shift(`1', `2', `3', `4') +dnl @error{}m4trace: -4- shift(`2', `3', `4') +dnl @error{}m4trace: -3- shift(`3', `4') +dnl @error{}m4trace: -4- shift(`1', `2', `3', `4') +dnl @error{}m4trace: -3- shift(`2', `3', `4') +dnl @error{}m4trace: -2- shift(`3', `4') +dnl @result{}4 +dnl @error{}m4trace: -6- shift(`1', `2', `3', `4') +dnl @error{}m4trace: -5- shift(`2', `3', `4') +dnl @error{}m4trace: -4- shift(`3', `4') +dnl @error{}m4trace: -3- shift(`4') diff -ruNp m4-1.4.10/checks/192.improved_f m4-1.4.11/checks/192.improved_f --- m4-1.4.10/checks/192.improved_f 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/192.improved_f 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,32 @@ +dnl @ ../doc/m4.texinfo:7219: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +include(`foreachq2.m4') +dnl @result{} +undivert(`foreachq2.m4')dnl +dnl @result{}include(`quote.m4')dnl +dnl @result{}divert(`-1') +dnl @result{}# foreachq(x, `item_1, item_2, ..., item_n', stmt) +dnl @result{}# quoted list, improved version +dnl @result{}define(`foreachq', `pushdef(`$1')_$0($@)popdef(`$1')') +dnl @result{}define(`_arg1q', ``$1'') +dnl @result{}define(`_rest', `ifelse(`$#', `1', `', `dquote(shift($@))')') +dnl @result{}define(`_foreachq', `ifelse(`$2', `', `', +dnl @result{} `define(`$1', _arg1q($2))$3`'$0(`$1', _rest($2), `$3')')') +dnl @result{}divert`'dnl +traceon(`shift')debugmode(`aq') +dnl @result{} +foreachq(`x', ``1', `2', `3', `4'', `x +')dnl +dnl @result{}1 +dnl @error{}m4trace: -3- shift(`1', `2', `3', `4') +dnl @result{}2 +dnl @error{}m4trace: -3- shift(`2', `3', `4') +dnl @result{}3 +dnl @error{}m4trace: -3- shift(`3', `4') +dnl @result{}4 diff -ruNp m4-1.4.10/checks/193.improved_f m4-1.4.11/checks/193.improved_f --- m4-1.4.10/checks/193.improved_f 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/193.improved_f 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,44 @@ +dnl @ ../doc/m4.texinfo:7270: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +include(`foreachq3.m4') +dnl @result{} +undivert(`foreachq3.m4')dnl +dnl @result{}divert(`-1') +dnl @result{}# foreachq(x, `item_1, item_2, ..., item_n', stmt) +dnl @result{}# quoted list, alternate improved version +dnl @result{}define(`foreachq', +dnl @result{}`pushdef(`$1')_$0(`$1', `$3'ifelse(`$2', `', `', +dnl @result{} `, $2'))popdef(`$1')') +dnl @result{}define(`_foreachq', `ifelse(`$#', `2', `', +dnl @result{} `define(`$1', `$3')$2`'$0(`$1', `$2'ifelse(`$#', `3', `', +dnl @result{} `, shift(shift(shift($@)))'))')') +dnl @result{}divert`'dnl +traceon(`shift')debugmode(`aq') +dnl @result{} +foreachq(`x', ``1', `2', `3', `4'', `x +')dnl +dnl @result{}1 +dnl @error{}m4trace: -4- shift(`x', `x +dnl @error{}', `1', `2', `3', `4') +dnl @error{}m4trace: -3- shift(`x +dnl @error{}', `1', `2', `3', `4') +dnl @error{}m4trace: -2- shift(`1', `2', `3', `4') +dnl @result{}2 +dnl @error{}m4trace: -4- shift(`x', `x +dnl @error{}', `2', `3', `4') +dnl @error{}m4trace: -3- shift(`x +dnl @error{}', `2', `3', `4') +dnl @error{}m4trace: -2- shift(`2', `3', `4') +dnl @result{}3 +dnl @error{}m4trace: -4- shift(`x', `x +dnl @error{}', `3', `4') +dnl @error{}m4trace: -3- shift(`x +dnl @error{}', `3', `4') +dnl @error{}m4trace: -2- shift(`3', `4') +dnl @result{}4 diff -ruNp m4-1.4.10/checks/194.improved_f m4-1.4.11/checks/194.improved_f --- m4-1.4.10/checks/194.improved_f 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/194.improved_f 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,36 @@ +dnl @ ../doc/m4.texinfo:7318: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +include(`foreach2.m4') +dnl @result{} +undivert(`foreach2.m4')dnl +dnl @result{}include(`quote.m4')dnl +dnl @result{}divert(`-1') +dnl @result{}# foreach(x, (item_1, item_2, ..., item_n), stmt) +dnl @result{}# parenthesized list, improved version +dnl @result{}define(`foreach', `pushdef(`$1')_$0(`$1', +dnl @result{} (dquote(dquote_elt$2)), `$3')popdef(`$1')') +dnl @result{}define(`_arg1', `$1') +dnl @result{}define(`_foreach', `ifelse(`$2', `(`')', `', +dnl @result{} `define(`$1', _arg1$2)$3`'$0(`$1', (dquote(shift$2)), `$3')')') +dnl @result{}divert`'dnl +traceon(`shift')debugmode(`aq') +dnl @result{} +foreach(`x', `(`1', `2', `3', `4')', `x +')dnl +dnl @error{}m4trace: -4- shift(`1', `2', `3', `4') +dnl @error{}m4trace: -4- shift(`2', `3', `4') +dnl @error{}m4trace: -4- shift(`3', `4') +dnl @result{}1 +dnl @error{}m4trace: -3- shift(``1'', ``2'', ``3'', ``4'') +dnl @result{}2 +dnl @error{}m4trace: -3- shift(``2'', ``3'', ``4'') +dnl @result{}3 +dnl @error{}m4trace: -3- shift(``3'', ``4'') +dnl @result{}4 +dnl @error{}m4trace: -3- shift(``4'') diff -ruNp m4-1.4.10/checks/195.improved_f m4-1.4.11/checks/195.improved_f --- m4-1.4.10/checks/195.improved_f 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/195.improved_f 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,76 @@ +dnl @ ../doc/m4.texinfo:7366: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +include(`foreach2.m4') +dnl @result{} +include(`foreachq2.m4') +dnl @result{} +dnl 0-element list: +foreach(`x', `', `<x>') / foreachq(`x', `', `<x>') +dnl @result{} / +dnl 1-element list of empty element +foreach(`x', `()', `<x>') / foreachq(`x', ``'', `<x>') +dnl @result{}<> / <> +dnl 2-element list of empty elements +foreach(`x', `(`',`')', `<x>') / foreachq(`x', ``',`'', `<x>') +dnl @result{}<><> / <><> +dnl 1-element list of a comma +foreach(`x', `(`,')', `<x>') / foreachq(`x', ``,'', `<x>') +dnl @result{}<,> / <,> +dnl 2-element list of unbalanced parentheses +foreach(`x', `(`(', `)')', `<x>') / foreachq(`x', ``(', `)'', `<x>') +dnl @result{}<(><)> / <(><)> +define(`ab', `oops')dnl using defn(`iterator') +foreach(`x', `(`a', `b')', `defn(`x')') /dnl + foreachq(`x', ``a', `b'', `defn(`x')') +dnl @result{}ab / ab +define(`active', `ACT, IVE') +dnl @result{} +traceon(`active') +dnl @result{} +dnl list of unquoted macros; expansion occurs before recursion +foreach(`x', `(active, active)', `<x> +')dnl +dnl @error{}m4trace: -4- active -> `ACT, IVE' +dnl @error{}m4trace: -4- active -> `ACT, IVE' +dnl @result{}<ACT> +dnl @result{}<IVE> +dnl @result{}<ACT> +dnl @result{}<IVE> +foreachq(`x', `active, active', `<x> +')dnl +dnl @error{}m4trace: -3- active -> `ACT, IVE' +dnl @error{}m4trace: -3- active -> `ACT, IVE' +dnl @result{}<ACT> +dnl @error{}m4trace: -3- active -> `ACT, IVE' +dnl @error{}m4trace: -3- active -> `ACT, IVE' +dnl @result{}<IVE> +dnl @result{}<ACT> +dnl @result{}<IVE> +dnl list of quoted macros; expansion occurs during recursion +foreach(`x', `(`active', `active')', `<x> +')dnl +dnl @error{}m4trace: -1- active -> `ACT, IVE' +dnl @result{}<ACT, IVE> +dnl @error{}m4trace: -1- active -> `ACT, IVE' +dnl @result{}<ACT, IVE> +foreachq(`x', ``active', `active'', `<x> +')dnl +dnl @error{}m4trace: -1- active -> `ACT, IVE' +dnl @result{}<ACT, IVE> +dnl @error{}m4trace: -1- active -> `ACT, IVE' +dnl @result{}<ACT, IVE> +dnl list of double-quoted macro names; no expansion +foreach(`x', `(``active'', ``active'')', `<x> +')dnl +dnl @result{}<active> +dnl @result{}<active> +foreachq(`x', ```active'', ``active''', `<x> +')dnl +dnl @result{}<active> +dnl @result{}<active> diff -ruNp m4-1.4.10/checks/196.improved_m m4-1.4.11/checks/196.improved_m --- m4-1.4.10/checks/196.improved_m 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/196.improved_m 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:7449: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +include(`wraplifo.m4') +dnl @result{} +m4wrap(`define(`foo', ``$0:'-$1-$*-$#-')foo(`a', `b') +') +dnl @result{} +builtin(`m4wrap', ``'define(`bar', ``$0:'-$1-$*-$#-')bar(`a', `b') +') +dnl @result{} +dnl @result{}bar:-a-a,b-2- +dnl @result{}m4wrap0:---0- diff -ruNp m4-1.4.10/checks/197.improved_m m4-1.4.11/checks/197.improved_m --- m4-1.4.10/checks/197.improved_m 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/197.improved_m 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,30 @@ +dnl @ ../doc/m4.texinfo:7482: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +include(`wraplifo2.m4') +dnl @result{} +undivert(`wraplifo2.m4')dnl +dnl @result{}dnl Redefine m4wrap to have LIFO semantics, improved example. +dnl @result{}include(`join.m4')dnl +dnl @result{}define(`_m4wrap', defn(`m4wrap'))dnl +dnl @result{}define(`_arg1', `$1')dnl +dnl @result{}define(`m4wrap', +dnl @result{}`ifdef(`_$0_text', +dnl @result{} `define(`_$0_text', joinall(` ', $@)defn(`_$0_text'))', +dnl @result{} `_$0(`_arg1(defn(`_$0_text')undefine(`_$0_text'))')dnl +dnl @result{}define(`_$0_text', joinall(` ', $@))')')dnl +m4wrap(`define(`foo', ``$0:'-$1-$*-$#-')foo(`a', `b') +') +dnl @result{} +m4wrap(`lifo text +m4wrap(`nested', `', `$@ +')') +dnl @result{} +dnl @result{}lifo text +dnl @result{}foo:-a-a,b-2- +dnl @result{}nested $@ diff -ruNp m4-1.4.10/checks/198.improved_c m4-1.4.11/checks/198.improved_c --- m4-1.4.10/checks/198.improved_c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/198.improved_c 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,30 @@ +dnl @ ../doc/m4.texinfo:7518: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`cleardivert', + `pushdef(`_n', divnum)divert(`-1')undivert($@)divert(_n)popdef(`_n')') +dnl @result{} +divert(`1')one +divert +dnl @result{} +cleardivert +dnl @result{} +undivert +dnl @result{}one +dnl @result{} +define(`cleardivert', + `pushdef(`_num', divnum)divert(`-1')ifelse(`$#', `0', + `undivert`'', `undivert($@)')divert(_num)popdef(`_num')') +dnl @result{} +divert(`2')two +divert +dnl @result{} +cleardivert +dnl @result{} +undivert +dnl @result{} diff -ruNp m4-1.4.10/checks/199.improved_c m4-1.4.11/checks/199.improved_c --- m4-1.4.10/checks/199.improved_c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/199.improved_c 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,36 @@ +dnl @ ../doc/m4.texinfo:7554: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +include(`capitalize.m4')dnl +define(`active', `act1, ive')dnl +define(`Active', `Act2, Ive')dnl +define(`ACTIVE', `ACT3, IVE')dnl +upcase(active) +dnl @result{}ACT1,IVE +upcase(`active') +dnl @result{}ACT3, IVE +upcase(``active'') +dnl @result{}ACTIVE +downcase(ACTIVE) +dnl @result{}act3,ive +downcase(`ACTIVE') +dnl @result{}act1, ive +downcase(``ACTIVE'') +dnl @result{}active +capitalize(active) +dnl @result{}Act1 +capitalize(`active') +dnl @result{}Active +capitalize(``active'') +dnl @result{}_capitalize(`active') +define(`A', `OOPS') +dnl @result{} +capitalize(active) +dnl @result{}OOPSct1 +capitalize(`active') +dnl @result{}OOPSctive diff -ruNp m4-1.4.10/checks/200.improved_c m4-1.4.11/checks/200.improved_c --- m4-1.4.10/checks/200.improved_c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/200.improved_c 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,41 @@ +dnl @ ../doc/m4.texinfo:7631: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +include(`capitalize2.m4')dnl +define(`active', `act1, ive')dnl +define(`Active', `Act2, Ive')dnl +define(`ACTIVE', `ACT3, IVE')dnl +define(`A', `OOPS')dnl +capitalize(active) +dnl @result{}Act1,Ive +capitalize(`active') +dnl @result{}Act2, Ive +capitalize(``active'') +dnl @result{}Active +capitalize(```actIVE''') +dnl @result{}`Active' +undivert(`capitalize2.m4')dnl +dnl @result{}divert(`-1') +dnl @result{}# upcase(text) +dnl @result{}# downcase(text) +dnl @result{}# capitalize(text) +dnl @result{}# change case of text, improved version +dnl @result{}define(`upcase', `translit(`$*', `a-z', `A-Z')') +dnl @result{}define(`downcase', `translit(`$*', `A-Z', `a-z')') +dnl @result{}define(`_arg1', `$1') +dnl @result{}define(`_to_alt', `changequote(`<<[', `]>>')') +dnl @result{}define(`_from_alt', `changequote(<<[`]>>, <<[']>>)') +dnl @result{}define(`_upcase_alt', `translit(<<[$*]>>, <<[a-z]>>, <<[A-Z]>>)') +dnl @result{}define(`_downcase_alt', `translit(<<[$*]>>, <<[A-Z]>>, <<[a-z]>>)') +dnl @result{}define(`_capitalize_alt', +dnl @result{} `regexp(<<[$1]>>, <<[^\(\w\)\(\w*\)]>>, +dnl @result{} <<[_upcase_alt(<<[<<[\1]>>]>>)_downcase_alt(<<[<<[\2]>>]>>)]>>)') +dnl @result{}define(`capitalize', +dnl @result{} `_arg1(_to_alt()patsubst(<<[<<[$*]>>]>>, <<[\w+]>>, +dnl @result{} _from_alt()`]>>_$0_alt(<<[\&]>>)<<['_to_alt())_from_alt())') +dnl @result{}divert`'dnl diff -ruNp m4-1.4.10/checks/201.improved_f m4-1.4.11/checks/201.improved_f --- m4-1.4.10/checks/201.improved_f 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/checks/201.improved_f 2008-03-29 20:51:22.000000000 -0600 @@ -0,0 +1,20 @@ +dnl @ ../doc/m4.texinfo:7681: Origin of test +dnl @ expected status: 1 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`fatal_error', + `errprint(ifdef(`__program__', `__program__', ``m4'')'dnl +`:ifelse(__line__, `0', `', + `__file__:__line__:')` fatal error: $* +')m4exit(`1')') +dnl @result{} +m4wrap(`divnum(`demo of internal message') +fatal_error(`inside wrapped text')') +dnl @result{} +dnl @error{}m4:stdin:6: Warning: excess arguments to builtin `divnum' ignored +dnl @result{}0 +dnl @error{}m4:stdin:6: fatal error: inside wrapped text diff -ruNp m4-1.4.10/checks/Makefile.in m4-1.4.11/checks/Makefile.in --- m4-1.4.10/checks/Makefile.in 2007-07-04 21:56:03.000000000 -0600 +++ m4-1.4.11/checks/Makefile.in 2008-03-29 16:33:27.000000000 -0600 @@ -1,25 +1,28 @@ +## Makefile.in - template for building Makefile for M4 testsuite. ## -## Copyright (C) 1992, 1993, 1994, 2006, 2007 Free Software Foundation, Inc. +## Copyright (C) 1992, 1993, 1994, 2006, 2007, 2008 Free Software +## Foundation, Inc. ## -## This program is free software; you can redistribute it and/or modify +## This file is part of GNU M4. +## +## GNU M4 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 +## 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, +## GNU M4 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; See the file COPYING. if not, write to -## the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -## Boston, MA 02110-1301, USA. +## along with this program. If not, see <http://www.gnu.org/licenses/>. +@SET_MAKE@ PACKAGE = @PACKAGE@ VERSION = @VERSION@ -SHELL = /bin/sh +SHELL = @SHELL@ bindir = @bindir@ exec_prefix = @exec_prefix@ @@ -27,6 +30,7 @@ prefix = @prefix@ srcdir = @srcdir@ VPATH = @srcdir@ PATH_SEPARATOR = @PATH_SEPARATOR@ +program_transform_name = @program_transform_name@ # Should be GNU awk, for the get-them script. AWK = @AWK@ @@ -56,7 +60,8 @@ check: $(srcdir)/stamp-checks installcheck: $(srcdir)/stamp-checks PATH='$(bindir)'"$(PATH_SEPARATOR)"$$PATH; export PATH; \ - $(srcdir)/check-them -I $(srcdir)/../examples $(CHECKS) + $(srcdir)/check-them -I $(srcdir)/../examples \ + -m "`echo m4 | sed '$(program_transform_name)'`" $(CHECKS) tags: diff -ruNp m4-1.4.10/checks/check-them m4-1.4.11/checks/check-them --- m4-1.4.10/checks/check-them 2007-05-25 06:58:49.000000000 -0600 +++ m4-1.4.11/checks/check-them 2008-03-29 16:33:27.000000000 -0600 @@ -1,9 +1,6 @@ #!/bin/sh # Check GNU m4 against examples from the manual source. -# Copyright (C) 1992, 2006, 2007 Free Software Foundation, Inc. - -# Sanity check what we are testing -m4 --version +# Copyright (C) 1992, 2006, 2007, 2008 Free Software Foundation, Inc. # Clean up temp files on exit pwd=`pwd` @@ -27,14 +24,29 @@ xerr=$tmp/m4-xerr failed= skipped= strip_needed=false +diffopts=-c + +# Find out where the examples live. +examples=. +if test "x$1" = x-I ; then + examples="$2" + shift; shift +fi + +# Find out how to run m4. +m4=m4 +if test "x$1" = x-m ; then + m4="$2" + shift; shift +fi # Find out how the executable prints argv[0] -m4=`m4 --help | sed -e 's/Usage: \(.*\) \[OPTION.*/\1/' \ - -e 's/\\\\/\\\\\\\\/g' -e 1q` +m4name=`"$m4" --help | sed -e 's/Usage: \(.*\) \[OPTION.*/\1/' \ + -e 's/\\\\/\\\\\\\\/g' -e 1q` # Find out if we should strip \r in the output -m4 --version > $out -m4 --version | tr -d '\015' > $xout +"$m4" --version | tee $out +"$m4" --version | tr -d '\015' > $xout if cmp -s $out $xout; then : else @@ -42,11 +54,12 @@ else strip_needed=: fi -# Find out where the examples live. -examples=. -if test "x$1" = x-I ; then - examples="$2" - shift; shift +# Find out if diff supports useful options. +if diff -u /dev/null /dev/null 2>/dev/null ; then + diffopts="-u" +fi +if diff -a /dev/null /dev/null 2>/dev/null ; then + diffopts="$diffopts -a" fi # Run the tests. @@ -59,7 +72,7 @@ do echo "Checking $file" options=`sed -ne '3s/^dnl @ extra options: //p;3q' "$file"` sed -e '/^dnl @/d' -e '/^\^D$/q' "$file" \ - | LC_MESSAGES=C m4 -d -I "$examples" $options - >$out 2>$err + | LC_MESSAGES=C M4PATH=$examples "$m4" -d $options - >$out 2>$err stat=$? xstat=`sed -ne '2s/^dnl @ expected status: //p;2q' "$file"` @@ -77,9 +90,23 @@ do ;; esac - sed -e '/^dnl @result{}/!d' -e 's///' -e "s|\.\./examples|$examples|" \ - "$file" > $xout - sed -e '/^dnl @error{}/!d' -e 's///' -e "s|^m4:|$m4:|" "$file" > $xerr + xoutfile=`sed -n 's/^dnl @ expected output: //p' "$file"` + if test -z "$xoutfile" ; then + sed -e '/^dnl @result{}/!d' -e 's///' -e "s|\.\./examples|$examples|" \ + "$file" > $xout + else + cp "$examples/$xoutfile" $xout + fi + + xerrfile=`sed -n 's/^dnl @ expected error: //p' "$file"` + if test -z "$xerrfile" ; then + sed '/^dnl @error{}/!d + s///; '"s|^m4:|$m4name:|; s|\.\./examples|$examples|" \ + "$file" > $xerr + else + sed "s|^m4:|$m4name:|; s|\.\./examples|$examples|" \ + "$examples/$xerrfile" > $xerr + fi # For the benefit of mingw, normalize \r\n line endings if $strip_needed ; then @@ -99,7 +126,7 @@ do failed="$failed $file:out" echo `sed -e 's/^dnl //' -e 1q $file` echo "$file: stdout mismatch" - diff $xout $out + diff $diffopts $xout $out fi if cmp -s $err $xerr; then @@ -108,7 +135,7 @@ do failed="$failed $file:err" echo `sed -e 's/^dnl //' -e 1q $file` echo "$file: stderr mismatch" - diff $xerr $err + diff $diffopts $xerr $err fi done diff -ruNp m4-1.4.10/checks/get-them m4-1.4.11/checks/get-them --- m4-1.4.10/checks/get-them 2007-05-25 14:29:17.000000000 -0600 +++ m4-1.4.11/checks/get-them 2008-03-13 19:32:13.000000000 -0600 @@ -1,11 +1,13 @@ #!/bin/sh # -*- AWK -*- # Extract all examples from the manual source. -# Copyright (C) 1992, 2005, 2006, 2007 Free Software Foundation, Inc. +# Copyright (C) 1992, 2005, 2006, 2007, 2008 Free Software Foundation, +# Inc. # This script is for use with GNU awk. FILE=${1-/dev/null} +: ${AWK=awk} $AWK ' @@ -16,6 +18,8 @@ BEGIN { file = "NONE"; status = 0; options = ""; + xout = ""; + xerr = ""; } /^@node / { @@ -39,6 +43,8 @@ BEGIN { getline; status = 0; options = ""; + xout = ""; + xout = ""; next; } @@ -51,6 +57,16 @@ BEGIN { gsub ("@comment options:", "", options); } +/^@comment xout: / { + xout = $0; + gsub ("@comment xout: ", "", xout); +} + +/^@comment xerr: / { + xerr = $0; + gsub ("@comment xerr: ", "", xerr); +} + /^@example$/, /^@end example$/ { if (seq < 0) next; @@ -68,8 +84,14 @@ BEGIN { "dnl @ gives unlimited permission to copy and/or distribute it\n"\ "dnl @ with or without modifications, as long as this notice\n"\ "dnl @ is preserved.\n", FILENAME, NR, status, options) > file; + if (xout) + printf("dnl @ expected output: %s\n", xout) > file; + if (xerr) + printf("dnl @ expected error: %s\n", xerr) > file; status = 0; options = ""; + xout = ""; + xerr = ""; next; } if ($0 ~ /^@end example$/) { diff -ruNp m4-1.4.10/config.guess m4-1.4.11/config.guess --- m4-1.4.10/config.guess 2007-07-09 21:15:35.000000000 -0600 +++ m4-1.4.11/config.guess 2007-10-09 06:20:35.000000000 -0600 @@ -4,7 +4,7 @@ # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. -timestamp='2007-05-17' +timestamp='2007-07-22' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -330,7 +330,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:$ sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; - i86pc:SunOS:5.*:* | ix86xen:SunOS:5.*:*) + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) @@ -793,7 +793,7 @@ EOF exit ;; *:Interix*:[3456]*) case ${UNAME_MACHINE} in - x86) + x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; EM64T | authenticamd) diff -ruNp m4-1.4.10/configure m4-1.4.11/configure --- m4-1.4.10/configure 2007-07-09 21:15:12.000000000 -0600 +++ m4-1.4.11/configure 2008-04-02 06:45:03.000000000 -0600 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.61 for GNU M4 1.4.10. +# Generated by GNU Autoconf 2.61 for GNU M4 1.4.11. # # Report bugs to <bug-m4@gnu.org>. # @@ -574,8 +574,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='GNU M4' PACKAGE_TARNAME='m4' -PACKAGE_VERSION='1.4.10' -PACKAGE_STRING='GNU M4 1.4.10' +PACKAGE_VERSION='1.4.11' +PACKAGE_STRING='GNU M4 1.4.11' PACKAGE_BUGREPORT='bug-m4@gnu.org' ac_unique_file="src/m4.h" @@ -706,6 +706,7 @@ GREP EGREP GL_COND_LIBTOOL_TRUE GL_COND_LIBTOOL_FALSE +EOVERFLOW ALLOCA ALLOCA_H GNULIB_FPRINTF_POSIX @@ -717,11 +718,15 @@ GNULIB_VPRINTF_POSIX GNULIB_VSNPRINTF GNULIB_VSPRINTF_POSIX GNULIB_VASPRINTF +GNULIB_FOPEN +GNULIB_FREOPEN GNULIB_FSEEK GNULIB_FSEEKO GNULIB_FTELL GNULIB_FTELLO GNULIB_FFLUSH +GNULIB_GETDELIM +GNULIB_GETLINE REPLACE_FPRINTF REPLACE_VFPRINTF REPLACE_PRINTF @@ -734,6 +739,8 @@ REPLACE_SPRINTF REPLACE_VSPRINTF HAVE_VASPRINTF REPLACE_VASPRINTF +REPLACE_FOPEN +REPLACE_FREOPEN HAVE_FSEEKO REPLACE_FSEEKO REPLACE_FSEEK @@ -741,31 +748,55 @@ HAVE_FTELLO REPLACE_FTELLO REPLACE_FTELL REPLACE_FFLUSH +HAVE_DECL_GETDELIM +HAVE_DECL_GETLINE +REPLACE_GETLINE INCLUDE_NEXT NEXT_FLOAT_H FLOAT_H +GNULIB_CEILF +GNULIB_CEILL +GNULIB_FLOORF +GNULIB_FLOORL GNULIB_FREXP GNULIB_FREXPL +GNULIB_ISFINITE GNULIB_LDEXPL GNULIB_MATHL +GNULIB_ROUND +GNULIB_ROUNDF +GNULIB_ROUNDL GNULIB_SIGNBIT +GNULIB_TRUNC +GNULIB_TRUNCF +GNULIB_TRUNCL HAVE_DECL_ACOSL HAVE_DECL_ASINL HAVE_DECL_ATANL -HAVE_DECL_CEILL HAVE_DECL_COSL HAVE_DECL_EXPL -HAVE_DECL_FLOORL HAVE_DECL_FREXPL HAVE_DECL_LDEXPL HAVE_DECL_LOGL HAVE_DECL_SINL HAVE_DECL_SQRTL HAVE_DECL_TANL +HAVE_DECL_TRUNC +HAVE_DECL_TRUNCF +HAVE_DECL_TRUNCL +REPLACE_CEILF +REPLACE_CEILL +REPLACE_FLOORF +REPLACE_FLOORL REPLACE_FREXP REPLACE_FREXPL +REPLACE_ISFINITE REPLACE_LDEXPL +REPLACE_ROUND +REPLACE_ROUNDF +REPLACE_ROUNDL REPLACE_SIGNBIT +REPLACE_SIGNBIT_USING_GCC GETOPT_H LIBINTL LTLIBINTL @@ -775,37 +806,63 @@ HAVE_STRUCT_TIMEVAL REPLACE_GETTIMEOFDAY SYS_TIME_H GLIBC21 +LOCALCHARSET_TESTS_ENVIRONMENT GNULIB_CHOWN GNULIB_DUP2 +GNULIB_ENVIRON GNULIB_FCHDIR GNULIB_FTRUNCATE GNULIB_GETCWD GNULIB_GETLOGIN_R +GNULIB_GETPAGESIZE GNULIB_LCHOWN GNULIB_LSEEK GNULIB_READLINK GNULIB_SLEEP HAVE_DUP2 HAVE_FTRUNCATE +HAVE_GETPAGESIZE HAVE_READLINK HAVE_SLEEP +HAVE_DECL_ENVIRON HAVE_DECL_GETLOGIN_R +HAVE_OS_H +HAVE_SYS_PARAM_H REPLACE_CHOWN REPLACE_FCHDIR REPLACE_GETCWD +REPLACE_GETPAGESIZE REPLACE_LCHOWN REPLACE_LSEEK -NEXT_MATH_H +HAVE_MALLOC_POSIX +GNULIB_MALLOC_POSIX +GNULIB_REALLOC_POSIX +GNULIB_CALLOC_POSIX GNULIB_GETSUBOPT GNULIB_MKDTEMP GNULIB_MKSTEMP +GNULIB_PUTENV +GNULIB_SETENV +GNULIB_STRTOD +GNULIB_UNSETENV +HAVE_CALLOC_POSIX HAVE_GETSUBOPT HAVE_MKDTEMP +HAVE_REALLOC_POSIX +HAVE_SETENV +HAVE_STRTOD +HAVE_UNSETENV REPLACE_MKSTEMP +REPLACE_PUTENV +REPLACE_STRTOD +VOID_UNSETENV +NEXT_MATH_H GNULIB_SIGPROCMASK HAVE_POSIX_SIGNALBLOCKING HAVE_SIGSET_T NEXT_SIGNAL_H +STDARG_H +NEXT_STDARG_H STDBOOL_H HAVE__BOOL HAVE_LONG_LONG_INT @@ -832,6 +889,59 @@ WINT_T_SUFFIX STDINT_H NEXT_STDIO_H NEXT_STDLIB_H +GNULIB_MEMMEM +GNULIB_MEMPCPY +GNULIB_MEMRCHR +GNULIB_STPCPY +GNULIB_STPNCPY +GNULIB_STRCHRNUL +GNULIB_STRDUP +GNULIB_STRNDUP +GNULIB_STRNLEN +GNULIB_STRPBRK +GNULIB_STRSEP +GNULIB_STRSTR +GNULIB_STRCASESTR +GNULIB_STRTOK_R +GNULIB_MBSLEN +GNULIB_MBSNLEN +GNULIB_MBSCHR +GNULIB_MBSRCHR +GNULIB_MBSSTR +GNULIB_MBSCASECMP +GNULIB_MBSNCASECMP +GNULIB_MBSPCASECMP +GNULIB_MBSCASESTR +GNULIB_MBSCSPN +GNULIB_MBSPBRK +GNULIB_MBSSPN +GNULIB_MBSSEP +GNULIB_MBSTOK_R +GNULIB_STRERROR +GNULIB_STRSIGNAL +HAVE_DECL_MEMMEM +HAVE_MEMPCPY +HAVE_DECL_MEMRCHR +HAVE_STPCPY +HAVE_STPNCPY +HAVE_STRCHRNUL +HAVE_DECL_STRDUP +HAVE_STRNDUP +HAVE_DECL_STRNDUP +HAVE_DECL_STRNLEN +HAVE_STRPBRK +HAVE_STRSEP +HAVE_STRCASESTR +HAVE_DECL_STRTOK_R +HAVE_DECL_STRERROR +HAVE_DECL_STRSIGNAL +REPLACE_STRERROR +REPLACE_STRSIGNAL +REPLACE_MEMMEM +REPLACE_STRCASESTR +REPLACE_STRSTR +NEXT_STRING_H +POW_LIB HAVE_LSTAT HAVE_DECL_MKDIR HAVE_IO_H @@ -839,7 +949,6 @@ NEXT_SYS_STAT_H SYS_STAT_H NEXT_UNISTD_H HAVE_UNISTD_H -EOVERFLOW GNULIB_WCWIDTH HAVE_DECL_WCWIDTH REPLACE_WCWIDTH @@ -853,12 +962,15 @@ HAVE_WCTYPE_H WCTYPE_H LIBM4_LIBDEPS LIBM4_LTLIBDEPS +LIBTESTS_LIBDEPS STACKOVF_TRUE STACKOVF_FALSE LIBOBJS LTLIBOBJS M4_LIBOBJS -M4_LTLIBOBJS' +M4_LTLIBOBJS +M4tests_LIBOBJS +M4tests_LTLIBOBJS' ac_subst_files='' ac_precious_vars='build_alias host_alias @@ -1371,7 +1483,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures GNU M4 1.4.10 to adapt to many kinds of systems. +\`configure' configures GNU M4 1.4.11 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1441,7 +1553,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of GNU M4 1.4.10:";; + short | recursive ) echo "Configuration of GNU M4 1.4.11:";; esac cat <<\_ACEOF @@ -1541,7 +1653,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -GNU M4 configure 1.4.10 +GNU M4 configure 1.4.11 generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1555,7 +1667,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by GNU M4 $as_me 1.4.10, which was +It was created by GNU M4 $as_me 1.4.11, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ @@ -1840,6 +1952,7 @@ ac_header_list="$ac_header_list unistd.h ac_func_list="$ac_func_list raise" ac_header_list="$ac_header_list float.h" ac_header_list="$ac_header_list stdio_ext.h" +ac_func_list="$ac_func_list __fpending" ac_func_list="$ac_func_list fpurge" ac_func_list="$ac_func_list __fpurge" ac_func_list="$ac_func_list __freading" @@ -1856,10 +1969,12 @@ ac_func_list="$ac_func_list mbrtowc" ac_func_list="$ac_func_list wcrtomb" ac_func_list="$ac_func_list wcscoll" ac_header_list="$ac_header_list signal.h" +ac_header_list="$ac_header_list stdarg.h" ac_header_list="$ac_header_list stdint.h" ac_header_list="$ac_header_list wchar.h" ac_header_list="$ac_header_list stdio.h" ac_header_list="$ac_header_list stdlib.h" +ac_header_list="$ac_header_list string.h" ac_func_list="$ac_func_list lstat" ac_header_list="$ac_header_list sys/stat.h" ac_func_list="$ac_func_list pipe" @@ -1946,10 +2061,8 @@ ac_link='$CC -o conftest$ac_exeext $CFLA ac_compiler_gnu=$ac_cv_c_compiler_gnu -am__api_version='1.10' - ac_aux_dir= -for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do +for ac_dir in build-aux "$srcdir"/build-aux; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" @@ -1965,8 +2078,8 @@ for ac_dir in "$srcdir" "$srcdir/.." "$s fi done if test -z "$ac_aux_dir"; then - { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 -echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in build-aux \"$srcdir\"/build-aux" >&5 +echo "$as_me: error: cannot find install-sh or install.sh in build-aux \"$srcdir\"/build-aux" >&2;} { (exit 1); exit 1; }; } fi @@ -1979,6 +2092,9 @@ ac_config_sub="$SHELL $ac_aux_dir/config ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + +am__api_version='1.10' + # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: @@ -2283,7 +2399,7 @@ fi # Define the identity of the package. PACKAGE='m4' - VERSION='1.4.10' + VERSION='1.4.11' cat >>confdefs.h <<_ACEOF @@ -2429,8 +2545,6 @@ am__tar='${AMTAR} chof - "$$tardir"'; am -PACKAGE=$PACKAGE_TARNAME; -VERSION=$PACKAGE_VERSION; @@ -3707,12 +3821,6 @@ else fi -cat >>confdefs.h <<\_ACEOF -#define _GNU_SOURCE 1 -_ACEOF - - - ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -4106,35 +4214,6 @@ echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" - -{ echo "$as_me:$LINENO: checking for AIX" >&5 -echo $ECHO_N "checking for AIX... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef _AIX - yes -#endif - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "yes" >/dev/null 2>&1; then - { echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } -cat >>confdefs.h <<\_ACEOF -#define _ALL_SOURCE 1 -_ACEOF - -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi -rm -f conftest* - - { echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } if test "${ac_cv_header_stdc+set}" = set; then @@ -4378,7 +4457,8 @@ fi done -if test "${ac_cv_header_minix_config_h+set}" = set; then + + if test "${ac_cv_header_minix_config_h+set}" = set; then { echo "$as_me:$LINENO: checking for minix/config.h" >&5 echo $ECHO_N "checking for minix/config.h... $ECHO_C" >&6; } if test "${ac_cv_header_minix_config_h+set}" = set; then @@ -4515,7 +4595,7 @@ else fi -if test "$MINIX" = yes; then + if test "$MINIX" = yes; then cat >>confdefs.h <<\_ACEOF #define _POSIX_SOURCE 1 @@ -4531,15 +4611,7 @@ cat >>confdefs.h <<\_ACEOF #define _MINIX 1 _ACEOF -fi - - - - - - - - + fi @@ -4600,6 +4672,14 @@ echo "${ECHO_T}$ac_cv_safe_to_define___e _ACEOF cat >>confdefs.h <<\_ACEOF +#define _ALL_SOURCE 1 +_ACEOF + + cat >>confdefs.h <<\_ACEOF +#define _GNU_SOURCE 1 +_ACEOF + + cat >>confdefs.h <<\_ACEOF #define _POSIX_PTHREAD_SEMANTICS 1 _ACEOF @@ -5109,7 +5189,6 @@ esac - # Check whether --enable-largefile was given. if test "${enable_largefile+set}" = set; then enableval=$enable_largefile; @@ -6163,26 +6242,40 @@ if test "${ac_cv_type_long_long_int+set} echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ + + /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -long long int ll = 9223372036854775807ll; - long long int nll = -9223372036854775807LL; - typedef int a[((-9223372036854775807LL < 0 - && 0 < 9223372036854775807ll) - ? 1 : -1)]; - int i = 63; +/* For now, do not test the preprocessor; as of 2007 there are too many + implementations with broken preprocessors. Perhaps this can + be revisited in 2012. In the meantime, code should not expect + #if to work with literals wider than 32 bits. */ + /* Test literals. */ + long long int ll = 9223372036854775807ll; + long long int nll = -9223372036854775807LL; + unsigned long long int ull = 18446744073709551615ULL; + /* Test constant expressions. */ + typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll) + ? 1 : -1)]; + typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1 + ? 1 : -1)]; + int i = 63; int main () { -long long int llmax = 9223372036854775807ll; - return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i) - | (llmax / ll) | (llmax % ll)); +/* Test availability of runtime routines for shift and division. */ + long long int llmax = 9223372036854775807ll; + unsigned long long int ullmax = 18446744073709551615ull; + return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i) + | (llmax / ll) | (llmax % ll) + | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i) + | (ullmax / ull) | (ullmax % ull)); ; return 0; } + _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" @@ -6202,7 +6295,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then - if test "$cross_compiling" = yes; then + if test "$cross_compiling" = yes; then ac_cv_type_long_long_int=yes else cat >conftest.$ac_ext <<_ACEOF @@ -6295,24 +6388,40 @@ if test "${ac_cv_type_unsigned_long_long echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ + + /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -unsigned long long int ull = 18446744073709551615ULL; - typedef int a[(18446744073709551615ULL <= (unsigned long long int) -1 - ? 1 : -1)]; - int i = 63; +/* For now, do not test the preprocessor; as of 2007 there are too many + implementations with broken preprocessors. Perhaps this can + be revisited in 2012. In the meantime, code should not expect + #if to work with literals wider than 32 bits. */ + /* Test literals. */ + long long int ll = 9223372036854775807ll; + long long int nll = -9223372036854775807LL; + unsigned long long int ull = 18446744073709551615ULL; + /* Test constant expressions. */ + typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll) + ? 1 : -1)]; + typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1 + ? 1 : -1)]; + int i = 63; int main () { -unsigned long long int ullmax = 18446744073709551615ull; - return (ull << 63 | ull >> 63 | ull << i | ull >> i - | ullmax / ull | ullmax % ull); +/* Test availability of runtime routines for shift and division. */ + long long int llmax = 9223372036854775807ll; + unsigned long long int ullmax = 18446744073709551615ull; + return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i) + | (llmax / ll) | (llmax % ll) + | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i) + | (ullmax / ull) | (ullmax % ull)); ; return 0; } + _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" @@ -6510,6 +6619,10 @@ else # contain a buggy version. If you still want to use their alloca, # use ar to extract alloca.o from them instead of compiling alloca.c. + + + + ALLOCA=\${LIBOBJDIR}alloca.$ac_objext cat >>confdefs.h <<\_ACEOF @@ -7095,11 +7208,15 @@ fi GNULIB_VSNPRINTF=0; GNULIB_VSPRINTF_POSIX=0; GNULIB_VASPRINTF=0; + GNULIB_FOPEN=0; + GNULIB_FREOPEN=0; GNULIB_FSEEK=0; GNULIB_FSEEKO=0; GNULIB_FTELL=0; GNULIB_FTELLO=0; GNULIB_FFLUSH=0; + GNULIB_GETDELIM=0; + GNULIB_GETLINE=0; REPLACE_FPRINTF=0; REPLACE_VFPRINTF=0; REPLACE_PRINTF=0; @@ -7112,6 +7229,8 @@ fi REPLACE_VSPRINTF=0; HAVE_VASPRINTF=1; REPLACE_VASPRINTF=0; + REPLACE_FOPEN=0; + REPLACE_FREOPEN=0; HAVE_FSEEKO=1; REPLACE_FSEEKO=0; REPLACE_FSEEK=0; @@ -7119,6 +7238,9 @@ fi REPLACE_FTELLO=0; REPLACE_FTELL=0; REPLACE_FFLUSH=0; + HAVE_DECL_GETDELIM=1; + HAVE_DECL_GETLINE=1; + REPLACE_GETLINE=0; @@ -7127,34 +7249,57 @@ echo $ECHO_N "checking whether the prepr if test "${gl_cv_have_include_next+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF -#include_next <stddef.h> + rm -rf conftestd1 conftestd2 + mkdir conftestd1 conftestd2 + cat <<EOF > conftestd1/conftest.h +#define DEFINED_IN_CONFTESTD1 +#include_next <conftest.h> +#ifdef DEFINED_IN_CONFTESTD2 +int foo; +#else +#error "include_next doesn't work" +#endif +EOF + cat <<EOF > conftestd2/conftest.h +#ifndef DEFINED_IN_CONFTESTD1 +#error "include_next test doesn't work" +#endif +#define DEFINED_IN_CONFTESTD2 +EOF + save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS -Iconftestd1 -Iconftestd2" + cat >conftest.$ac_ext <<_ACEOF +#include <conftest.h> _ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || test ! -s conftest.err - }; then + } && test -s conftest.$ac_objext; then gl_cv_have_include_next=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - gl_cv_have_include_next=no + gl_cv_have_include_next=no fi -rm -f conftest.err conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CPPFLAGS="$save_CPPFLAGS" + rm -rf conftestd1 conftestd2 + fi { echo "$as_me:$LINENO: result: $gl_cv_have_include_next" >&5 echo "${ECHO_T}$gl_cv_have_include_next" >&6; } @@ -7183,28 +7328,51 @@ _ACEOF + + + GNULIB_CEILF=0; + GNULIB_CEILL=0; + GNULIB_FLOORF=0; + GNULIB_FLOORL=0; GNULIB_FREXP=0; GNULIB_FREXPL=0; + GNULIB_ISFINITE=0; GNULIB_LDEXPL=0; GNULIB_MATHL=0; + GNULIB_ROUND=0; + GNULIB_ROUNDF=0; + GNULIB_ROUNDL=0; GNULIB_SIGNBIT=0; + GNULIB_TRUNC=0; + GNULIB_TRUNCF=0; + GNULIB_TRUNCL=0; HAVE_DECL_ACOSL=1; HAVE_DECL_ASINL=1; HAVE_DECL_ATANL=1; - HAVE_DECL_CEILL=1; HAVE_DECL_COSL=1; HAVE_DECL_EXPL=1; - HAVE_DECL_FLOORL=1; HAVE_DECL_FREXPL=1; HAVE_DECL_LDEXPL=1; HAVE_DECL_LOGL=1; HAVE_DECL_SINL=1; HAVE_DECL_SQRTL=1; HAVE_DECL_TANL=1; + HAVE_DECL_TRUNC=1; + HAVE_DECL_TRUNCF=1; + HAVE_DECL_TRUNCL=1; + REPLACE_CEILF=0; + REPLACE_CEILL=0; + REPLACE_FLOORF=0; + REPLACE_FLOORL=0; REPLACE_FREXP=0; REPLACE_FREXPL=0; + REPLACE_ISFINITE=0; REPLACE_LDEXPL=0; + REPLACE_ROUND=0; + REPLACE_ROUNDF=0; + REPLACE_ROUNDL=0; REPLACE_SIGNBIT=0; + REPLACE_SIGNBIT_USING_GCC=0; { echo "$as_me:$LINENO: checking whether stdin defaults to large file offsets" >&5 @@ -7224,13 +7392,12 @@ main () { #if defined __SL64 && defined __SCLE /* cygwin */ /* Cygwin 1.5.24 and earlier fail to put stdin in 64-bit mode, making - fseeko/ftello needlessly fail. This bug was fixed at the same time - that cygwin started exporting asnprintf (cygwin 1.7.0), so we use - that as a link-time test for cross-compiles rather than building - a runtime test. */ - size_t s; - if (asnprintf (NULL, &s, "")) - return 0; + fseeko/ftello needlessly fail. This bug was fixed in 1.5.25, and + it is easier to do a version check than building a runtime test. */ +# include <cygwin/version.h> +# if CYGWIN_VERSION_DLL_COMBINED < CYGWIN_VERSION_DLL_MAKE_COMBINED (1005, 25) + choke me +# endif #endif ; return 0; @@ -7781,9 +7948,8 @@ if test "${ac_cv_c_restrict+set}" = set; echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_c_restrict=no - # Try the official restrict keyword, then gcc's __restrict, and - # the less common variants. - for ac_kw in restrict __restrict __restrict__ _Restrict; do + # The order here caters to the fact that C++ does not require restrict. + for ac_kw in __restrict __restrict__ _Restrict restrict; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -7791,16 +7957,16 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ typedef int * int_ptr; - int foo (int_ptr $ac_kw ip) { - return ip[0]; + int foo (int_ptr $ac_kw ip) { + return ip[0]; } int main () { int s[1]; - int * $ac_kw t = s; - t[0] = 0; - return foo(t) + int * $ac_kw t = s; + t[0] = 0; + return foo(t) ; return 0; } @@ -7837,10 +8003,11 @@ rm -f core conftest.err conftest.$ac_obj fi { echo "$as_me:$LINENO: result: $ac_cv_c_restrict" >&5 echo "${ECHO_T}$ac_cv_c_restrict" >&6; } + + case $ac_cv_c_restrict in restrict) ;; - no) -cat >>confdefs.h <<\_ACEOF + no) cat >>confdefs.h <<\_ACEOF #define restrict _ACEOF ;; @@ -8223,26 +8390,113 @@ echo "${ECHO_T}$ac_cv_gnu_library_2_1" > GNULIB_CHOWN=0; GNULIB_DUP2=0; + GNULIB_ENVIRON=0; GNULIB_FCHDIR=0; GNULIB_FTRUNCATE=0; GNULIB_GETCWD=0; GNULIB_GETLOGIN_R=0; + GNULIB_GETPAGESIZE=0; GNULIB_LCHOWN=0; GNULIB_LSEEK=0; GNULIB_READLINK=0; GNULIB_SLEEP=0; HAVE_DUP2=1; HAVE_FTRUNCATE=1; + HAVE_GETPAGESIZE=1; HAVE_READLINK=1; HAVE_SLEEP=1; + HAVE_DECL_ENVIRON=1; HAVE_DECL_GETLOGIN_R=1; + HAVE_OS_H=0; + HAVE_SYS_PARAM_H=0; REPLACE_CHOWN=0; REPLACE_FCHDIR=0; REPLACE_GETCWD=0; + REPLACE_GETPAGESIZE=0; REPLACE_LCHOWN=0; REPLACE_LSEEK=0; + { echo "$as_me:$LINENO: checking whether malloc, realloc, calloc are POSIX compliant" >&5 +echo $ECHO_N "checking whether malloc, realloc, calloc are POSIX compliant... $ECHO_C" >&6; } +if test "${gl_cv_func_malloc_posix+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ + choke me + #endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + gl_cv_func_malloc_posix=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gl_cv_func_malloc_posix=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ echo "$as_me:$LINENO: result: $gl_cv_func_malloc_posix" >&5 +echo "${ECHO_T}$gl_cv_func_malloc_posix" >&6; } + + + GNULIB_MALLOC_POSIX=0; + GNULIB_REALLOC_POSIX=0; + GNULIB_CALLOC_POSIX=0; + GNULIB_GETSUBOPT=0; + GNULIB_MKDTEMP=0; + GNULIB_MKSTEMP=0; + GNULIB_PUTENV=0; + GNULIB_SETENV=0; + GNULIB_STRTOD=0; + GNULIB_UNSETENV=0; + HAVE_CALLOC_POSIX=1; + HAVE_GETSUBOPT=1; + HAVE_MALLOC_POSIX=1; + HAVE_MKDTEMP=1; + HAVE_REALLOC_POSIX=1; + HAVE_SETENV=1; + HAVE_STRTOD=1; + HAVE_UNSETENV=1; + REPLACE_MKSTEMP=0; + REPLACE_PUTENV=0; + REPLACE_STRTOD=0; + VOID_UNSETENV=0; + + for ac_header in stdlib.h do @@ -8468,14 +8722,6 @@ _ACEOF - GNULIB_GETSUBOPT=0; - GNULIB_MKDTEMP=0; - GNULIB_MKSTEMP=0; - HAVE_GETSUBOPT=1; - HAVE_MKDTEMP=1; - REPLACE_MKSTEMP=0; - - @@ -8498,6 +8744,8 @@ _ACEOF + + { echo "$as_me:$LINENO: checking for stdbool.h that conforms to C99" >&5 echo $ECHO_N "checking for stdbool.h that conforms to C99... $ECHO_C" >&6; } if test "${ac_cv_header_stdbool_h+set}" = set; then @@ -8692,37 +8940,81 @@ _ACEOF + GNULIB_MEMMEM=0; + GNULIB_MEMPCPY=0; + GNULIB_MEMRCHR=0; + GNULIB_STPCPY=0; + GNULIB_STPNCPY=0; + GNULIB_STRCHRNUL=0; + GNULIB_STRDUP=0; + GNULIB_STRNDUP=0; + GNULIB_STRNLEN=0; + GNULIB_STRPBRK=0; + GNULIB_STRSEP=0; + GNULIB_STRSTR=0; + GNULIB_STRCASESTR=0; + GNULIB_STRTOK_R=0; + GNULIB_MBSLEN=0; + GNULIB_MBSNLEN=0; + GNULIB_MBSCHR=0; + GNULIB_MBSRCHR=0; + GNULIB_MBSSTR=0; + GNULIB_MBSCASECMP=0; + GNULIB_MBSNCASECMP=0; + GNULIB_MBSPCASECMP=0; + GNULIB_MBSCASESTR=0; + GNULIB_MBSCSPN=0; + GNULIB_MBSPBRK=0; + GNULIB_MBSSPN=0; + GNULIB_MBSSEP=0; + GNULIB_MBSTOK_R=0; + GNULIB_STRERROR=0; + GNULIB_STRSIGNAL=0; + HAVE_DECL_MEMMEM=1; + HAVE_MEMPCPY=1; + HAVE_DECL_MEMRCHR=1; + HAVE_STPCPY=1; + HAVE_STPNCPY=1; + HAVE_STRCHRNUL=1; + HAVE_DECL_STRDUP=1; + HAVE_STRNDUP=1; + HAVE_DECL_STRNDUP=1; + HAVE_DECL_STRNLEN=1; + HAVE_STRPBRK=1; + HAVE_STRSEP=1; + HAVE_STRCASESTR=1; + HAVE_DECL_STRTOK_R=1; + HAVE_DECL_STRERROR=1; + HAVE_DECL_STRSIGNAL=1; + REPLACE_STRERROR=0; + REPLACE_STRSIGNAL=0; + REPLACE_MEMMEM=0; + REPLACE_STRCASESTR=0; + REPLACE_STRSTR=0; -{ echo "$as_me:$LINENO: checking whether stat file-mode macros are broken" >&5 -echo $ECHO_N "checking whether stat file-mode macros are broken... $ECHO_C" >&6; } -if test "${ac_cv_header_stat_broken+set}" = set; then + + + { echo "$as_me:$LINENO: checking for working strerror function" >&5 +echo $ECHO_N "checking for working strerror function... $ECHO_C" >&6; } +if test "${gl_cv_func_working_strerror+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + if test "$cross_compiling" = yes; then + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <sys/types.h> -#include <sys/stat.h> - -#if defined S_ISBLK && defined S_IFDIR -extern char c1[S_ISBLK (S_IFDIR) ? -1 : 1]; -#endif - -#if defined S_ISBLK && defined S_IFCHR -extern char c2[S_ISBLK (S_IFCHR) ? -1 : 1]; -#endif - -#if defined S_ISLNK && defined S_IFREG -extern char c3[S_ISLNK (S_IFREG) ? -1 : 1]; -#endif - -#if defined S_ISSOCK && defined S_IFREG -extern char c4[S_ISSOCK (S_IFREG) ? -1 : 1]; -#endif +#include <string.h> +int +main () +{ +return !*strerror (-2); + ; + return 0; +} _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" @@ -8741,33 +9033,74 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_cv_header_stat_broken=no + gl_cv_func_working_strerror=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_header_stat_broken=yes + gl_cv_func_working_strerror=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_stat_broken" >&5 -echo "${ECHO_T}$ac_cv_header_stat_broken" >&6; } -if test $ac_cv_header_stat_broken = yes; then +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <string.h> -cat >>confdefs.h <<\_ACEOF -#define STAT_MACROS_BROKEN 1 +int +main () +{ +return !*strerror (-2); + ; + return 0; +} _ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gl_cv_func_working_strerror=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +( exit $ac_status ) +gl_cv_func_working_strerror=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi - - - -{ echo "$as_me:$LINENO: checking whether clearerr_unlocked is declared" >&5 -echo $ECHO_N "checking whether clearerr_unlocked is declared... $ECHO_C" >&6; } -if test "${ac_cv_have_decl_clearerr_unlocked+set}" = set; then +fi +{ echo "$as_me:$LINENO: result: $gl_cv_func_working_strerror" >&5 +echo "${ECHO_T}$gl_cv_func_working_strerror" >&6; } + if test $gl_cv_func_working_strerror = no ; then + REPLACE_STRERROR=1 + + { echo "$as_me:$LINENO: checking whether strerror is declared" >&5 +echo $ECHO_N "checking whether strerror is declared... $ECHO_C" >&6; } +if test "${ac_cv_have_decl_strerror+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -8780,8 +9113,8 @@ $ac_includes_default int main () { -#ifndef clearerr_unlocked - (void) clearerr_unlocked; +#ifndef strerror + (void) strerror; #endif ; @@ -8805,28 +9138,227 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_cv_have_decl_clearerr_unlocked=yes + ac_cv_have_decl_strerror=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_have_decl_clearerr_unlocked=no + ac_cv_have_decl_strerror=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_clearerr_unlocked" >&5 -echo "${ECHO_T}$ac_cv_have_decl_clearerr_unlocked" >&6; } -if test $ac_cv_have_decl_clearerr_unlocked = yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_strerror" >&5 +echo "${ECHO_T}$ac_cv_have_decl_strerror" >&6; } +if test $ac_cv_have_decl_strerror = yes; then cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_CLEARERR_UNLOCKED 1 +#define HAVE_DECL_STRERROR 1 _ACEOF else cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_CLEARERR_UNLOCKED 0 +#define HAVE_DECL_STRERROR 0 +_ACEOF + + +fi + + + + fi + + + + + + + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_string_h='<'string.h'>' + else + { echo "$as_me:$LINENO: checking absolute name of <string.h>" >&5 +echo $ECHO_N "checking absolute name of <string.h>... $ECHO_C" >&6; } +if test "${gl_cv_next_string_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + if test $ac_cv_header_string_h = yes; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <string.h> + +_ACEOF + gl_cv_next_string_h='"'`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | + sed -n '\#/string.h#{ + s#.*"\(.*/string.h\)".*#\1# + s#^/[^/]#//&# + p + q + }'`'"' + else + gl_cv_next_string_h='<'string.h'>' + fi + +fi +{ echo "$as_me:$LINENO: result: $gl_cv_next_string_h" >&5 +echo "${ECHO_T}$gl_cv_next_string_h" >&6; } + fi + NEXT_STRING_H=$gl_cv_next_string_h + + + + + + +{ echo "$as_me:$LINENO: checking whether stat file-mode macros are broken" >&5 +echo $ECHO_N "checking whether stat file-mode macros are broken... $ECHO_C" >&6; } +if test "${ac_cv_header_stat_broken+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <sys/types.h> +#include <sys/stat.h> + +#if defined S_ISBLK && defined S_IFDIR +extern char c1[S_ISBLK (S_IFDIR) ? -1 : 1]; +#endif + +#if defined S_ISBLK && defined S_IFCHR +extern char c2[S_ISBLK (S_IFCHR) ? -1 : 1]; +#endif + +#if defined S_ISLNK && defined S_IFREG +extern char c3[S_ISLNK (S_IFREG) ? -1 : 1]; +#endif + +#if defined S_ISSOCK && defined S_IFREG +extern char c4[S_ISSOCK (S_IFREG) ? -1 : 1]; +#endif + +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_header_stat_broken=no +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_header_stat_broken=yes +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_stat_broken" >&5 +echo "${ECHO_T}$ac_cv_header_stat_broken" >&6; } +if test $ac_cv_header_stat_broken = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STAT_MACROS_BROKEN 1 +_ACEOF + +fi + + + + + +{ echo "$as_me:$LINENO: checking whether clearerr_unlocked is declared" >&5 +echo $ECHO_N "checking whether clearerr_unlocked is declared... $ECHO_C" >&6; } +if test "${ac_cv_have_decl_clearerr_unlocked+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef clearerr_unlocked + (void) clearerr_unlocked; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl_clearerr_unlocked=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl_clearerr_unlocked=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_clearerr_unlocked" >&5 +echo "${ECHO_T}$ac_cv_have_decl_clearerr_unlocked" >&6; } +if test $ac_cv_have_decl_clearerr_unlocked = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_CLEARERR_UNLOCKED 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_CLEARERR_UNLOCKED 0 _ACEOF @@ -9583,75 +10115,23 @@ fi - { echo "$as_me:$LINENO: checking for EOVERFLOW" >&5 -echo $ECHO_N "checking for EOVERFLOW... $ECHO_C" >&6; } -if test "${ac_cv_decl_EOVERFLOW+set}" = set; then + + { echo "$as_me:$LINENO: checking for wchar_t" >&5 +echo $ECHO_N "checking for wchar_t... $ECHO_C" >&6; } +if test "${gt_cv_c_wchar_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include <errno.h> -#ifdef EOVERFLOW -yes -#endif - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "yes" >/dev/null 2>&1; then - have_eoverflow=1 -fi -rm -f conftest* - - if test -n "$have_eoverflow"; then - ac_cv_decl_EOVERFLOW=yes - else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#define _XOPEN_SOURCE_EXTENDED 1 -#include <errno.h> -#ifdef EOVERFLOW -yes -#endif - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "yes" >/dev/null 2>&1; then - have_eoverflow=1 -fi -rm -f conftest* - - if test -n "$have_eoverflow"; then - if test "$cross_compiling" = yes; then - # Depending upon the size, compute the lo and hi bounds. -cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - -#define _XOPEN_SOURCE_EXTENDED 1 -#include <errno.h> -/* The following two lines are a workaround against an autoconf-2.52 bug. */ -#include <stdio.h> -#include <stdlib.h> - +#include <stddef.h> + wchar_t foo = (wchar_t)'\0'; int main () { -static int test_array [1 - 2 * !((EOVERFLOW) >= 0)]; -test_array [0] = 0 ; return 0; @@ -9674,26 +10154,51 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_lo=0 ac_mid=0 - while :; do - cat >conftest.$ac_ext <<_ACEOF + gt_cv_c_wchar_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gt_cv_c_wchar_t=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $gt_cv_c_wchar_t" >&5 +echo "${ECHO_T}$gt_cv_c_wchar_t" >&6; } + if test $gt_cv_c_wchar_t = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_WCHAR_T 1 +_ACEOF + + fi + + + { echo "$as_me:$LINENO: checking for wint_t" >&5 +echo $ECHO_N "checking for wint_t... $ECHO_C" >&6; } +if test "${gt_cv_c_wint_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#define _XOPEN_SOURCE_EXTENDED 1 -#include <errno.h> -/* The following two lines are a workaround against an autoconf-2.52 bug. */ +/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before + <wchar.h>. + BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be included + before <wchar.h>. */ +#include <stddef.h> #include <stdio.h> -#include <stdlib.h> - +#include <time.h> +#include <wchar.h> + wint_t foo = (wchar_t)'\0'; int main () { -static int test_array [1 - 2 * !((EOVERFLOW) <= $ac_mid)]; -test_array [0] = 0 ; return 0; @@ -9716,44 +10221,44 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_hi=$ac_mid; break + gt_cv_c_wint_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_lo=`expr $ac_mid + 1` - if test $ac_lo -le $ac_mid; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid + 1` + gt_cv_c_wint_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +fi +{ echo "$as_me:$LINENO: result: $gt_cv_c_wint_t" >&5 +echo "${ECHO_T}$gt_cv_c_wint_t" >&6; } + if test $gt_cv_c_wint_t = yes; then - cat >conftest.$ac_ext <<_ACEOF +cat >>confdefs.h <<\_ACEOF +#define HAVE_WINT_T 1 +_ACEOF + + fi + + + { echo "$as_me:$LINENO: checking for inttypes.h" >&5 +echo $ECHO_N "checking for inttypes.h... $ECHO_C" >&6; } +if test "${gl_cv_header_inttypes_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - -#define _XOPEN_SOURCE_EXTENDED 1 -#include <errno.h> -/* The following two lines are a workaround against an autoconf-2.52 bug. */ -#include <stdio.h> -#include <stdlib.h> - +#include <sys/types.h> +#include <inttypes.h> int main () { -static int test_array [1 - 2 * !((EOVERFLOW) < 0)]; -test_array [0] = 0 - +uintmax_t i = (uintmax_t) -1; return !i; ; return 0; } @@ -9775,27 +10280,44 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_hi=-1 ac_mid=-1 - while :; do - cat >conftest.$ac_ext <<_ACEOF + gl_cv_header_inttypes_h=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gl_cv_header_inttypes_h=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $gl_cv_header_inttypes_h" >&5 +echo "${ECHO_T}$gl_cv_header_inttypes_h" >&6; } + if test $gl_cv_header_inttypes_h = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_INTTYPES_H_WITH_UINTMAX 1 +_ACEOF + + fi + + + { echo "$as_me:$LINENO: checking for stdint.h" >&5 +echo $ECHO_N "checking for stdint.h... $ECHO_C" >&6; } +if test "${gl_cv_header_stdint_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - -#define _XOPEN_SOURCE_EXTENDED 1 -#include <errno.h> -/* The following two lines are a workaround against an autoconf-2.52 bug. */ -#include <stdio.h> -#include <stdlib.h> - +#include <sys/types.h> +#include <stdint.h> int main () { -static int test_array [1 - 2 * !((EOVERFLOW) >= $ac_mid)]; -test_array [0] = 0 - +uintmax_t i = (uintmax_t) -1; return !i; ; return 0; } @@ -9817,35 +10339,34 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_lo=$ac_mid; break + gl_cv_header_stdint_h=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_hi=`expr '(' $ac_mid ')' - 1` - if test $ac_mid -le $ac_hi; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid` + gl_cv_header_stdint_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_lo= ac_hi= fi +{ echo "$as_me:$LINENO: result: $gl_cv_header_stdint_h" >&5 +echo "${ECHO_T}$gl_cv_header_stdint_h" >&6; } + if test $gl_cv_header_stdint_h = yes; then -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi +cat >>confdefs.h <<_ACEOF +#define HAVE_STDINT_H_WITH_UINTMAX 1 +_ACEOF -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -# Binary search between lo and hi bounds. -while test "x$ac_lo" != "x$ac_hi"; do - ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + fi + + + + + { echo "$as_me:$LINENO: checking for intmax_t" >&5 +echo $ECHO_N "checking for intmax_t... $ECHO_C" >&6; } +if test "${gt_cv_c_intmax_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -9853,18 +10374,19 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#define _XOPEN_SOURCE_EXTENDED 1 -#include <errno.h> -/* The following two lines are a workaround against an autoconf-2.52 bug. */ -#include <stdio.h> +#include <stddef.h> #include <stdlib.h> +#if HAVE_STDINT_H_WITH_UINTMAX +#include <stdint.h> +#endif +#if HAVE_INTTYPES_H_WITH_UINTMAX +#include <inttypes.h> +#endif int main () { -static int test_array [1 - 2 * !((EOVERFLOW) <= $ac_mid)]; -test_array [0] = 0 - +intmax_t x = -1; return !x; ; return 0; } @@ -9886,20 +10408,72 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_hi=$ac_mid + gt_cv_c_intmax_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_lo=`expr '(' $ac_mid ')' + 1` + gt_cv_c_intmax_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -done -case $ac_lo in -?*) ac_cv_decl_EOVERFLOW=$ac_lo;; -'') ;; -esac +fi +{ echo "$as_me:$LINENO: result: $gt_cv_c_intmax_t" >&5 +echo "${ECHO_T}$gt_cv_c_intmax_t" >&6; } + if test $gt_cv_c_intmax_t = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_INTMAX_T 1 +_ACEOF + + else + + test $ac_cv_type_long_long_int = yes \ + && ac_type='long long' \ + || ac_type='long' + +cat >>confdefs.h <<_ACEOF +#define intmax_t $ac_type +_ACEOF + + fi + + + + + + { echo "$as_me:$LINENO: checking whether printf supports size specifiers as in C99" >&5 +echo $ECHO_N "checking whether printf supports size specifiers as in C99... $ECHO_C" >&6; } +if test "${gl_cv_func_printf_sizes_c99+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + if test "$cross_compiling" = yes; then + + case "$host_os" in + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_printf_sizes_c99="guessing yes";; + # Guess yes on FreeBSD >= 5. + freebsd[1-4]*) gl_cv_func_printf_sizes_c99="guessing no";; + freebsd* | kfreebsd*) gl_cv_func_printf_sizes_c99="guessing yes";; + # Guess yes on MacOS X >= 10.3. + darwin[1-6].*) gl_cv_func_printf_sizes_c99="guessing no";; + darwin*) gl_cv_func_printf_sizes_c99="guessing yes";; + # Guess yes on OpenBSD >= 3.9. + openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*) + gl_cv_func_printf_sizes_c99="guessing no";; + openbsd*) gl_cv_func_printf_sizes_c99="guessing yes";; + # Guess yes on Solaris >= 2.10. + solaris2.[0-9]*) gl_cv_func_printf_sizes_c99="guessing no";; + solaris*) gl_cv_func_printf_sizes_c99="guessing yes";; + # Guess yes on NetBSD >= 3. + netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) + gl_cv_func_printf_sizes_c99="guessing no";; + netbsd*) gl_cv_func_printf_sizes_c99="guessing yes";; + # If we don't know, assume the worst. + *) gl_cv_func_printf_sizes_c99="guessing no";; + esac + else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -9908,40 +10482,37 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#define _XOPEN_SOURCE_EXTENDED 1 -#include <errno.h> -/* The following two lines are a workaround against an autoconf-2.52 bug. */ -#include <stdio.h> -#include <stdlib.h> - -static long int longval () { return EOVERFLOW; } -static unsigned long int ulongval () { return EOVERFLOW; } +#include <stddef.h> #include <stdio.h> -#include <stdlib.h> -int -main () +#include <string.h> +#include <sys/types.h> +#if HAVE_STDINT_H_WITH_UINTMAX +# include <stdint.h> +#endif +#if HAVE_INTTYPES_H_WITH_UINTMAX +# include <inttypes.h> +#endif +static char buf[100]; +int main () { - - FILE *f = fopen ("conftest.val", "w"); - if (! f) +#if HAVE_STDINT_H_WITH_UINTMAX || HAVE_INTTYPES_H_WITH_UINTMAX + buf[0] = '\0'; + if (sprintf (buf, "%ju %d", (uintmax_t) 12345671, 33, 44, 55) < 0 + || strcmp (buf, "12345671 33") != 0) + return 1; +#endif + buf[0] = '\0'; + if (sprintf (buf, "%zu %d", (size_t) 12345672, 33, 44, 55) < 0 + || strcmp (buf, "12345672 33") != 0) + return 1; + buf[0] = '\0'; + if (sprintf (buf, "%tu %d", (ptrdiff_t) 12345673, 33, 44, 55) < 0 + || strcmp (buf, "12345673 33") != 0) + return 1; + buf[0] = '\0'; + if (sprintf (buf, "%Lg %d", (long double) 1.5, 33, 44, 55) < 0 + || strcmp (buf, "1.5 33") != 0) return 1; - if ((EOVERFLOW) < 0) - { - long int i = longval (); - if (i != (EOVERFLOW)) - return 1; - fprintf (f, "%ld\n", i); - } - else - { - unsigned long int i = ulongval (); - if (i != (EOVERFLOW)) - return 1; - fprintf (f, "%lu\n", i); - } - return ferror (f) || fclose (f) != 0; - - ; return 0; } _ACEOF @@ -9965,41 +10536,40 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_decl_EOVERFLOW=`cat conftest.val` + gl_cv_func_printf_sizes_c99=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 +( exit $ac_status ) +gl_cv_func_printf_sizes_c99=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi -rm -f conftest.val - else - ac_cv_decl_EOVERFLOW=E2BIG - fi - fi -fi -{ echo "$as_me:$LINENO: result: $ac_cv_decl_EOVERFLOW" >&5 -echo "${ECHO_T}$ac_cv_decl_EOVERFLOW" >&6; } - if test "$ac_cv_decl_EOVERFLOW" != yes; then -cat >>confdefs.h <<_ACEOF -#define EOVERFLOW $ac_cv_decl_EOVERFLOW -_ACEOF - EOVERFLOW="$ac_cv_decl_EOVERFLOW" +fi +{ echo "$as_me:$LINENO: result: $gl_cv_func_printf_sizes_c99" >&5 +echo "${ECHO_T}$gl_cv_func_printf_sizes_c99" >&6; } - fi + { echo "$as_me:$LINENO: checking whether printf supports 'long double' arguments" >&5 +echo $ECHO_N "checking whether printf supports 'long double' arguments... $ECHO_C" >&6; } +if test "${gl_cv_func_printf_long_double+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + + case "$host_os" in + beos*) gl_cv_func_printf_long_double="guessing no";; + mingw* | pw*) gl_cv_func_printf_long_double="guessing no";; + *) gl_cv_func_printf_long_double="guessing yes";; + esac - { echo "$as_me:$LINENO: checking for inttypes.h" >&5 -echo $ECHO_N "checking for inttypes.h... $ECHO_C" >&6; } -if test "${gl_cv_header_inttypes_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -10007,130 +10577,97 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <sys/types.h> -#include <inttypes.h> -int -main () + +#include <stdio.h> +#include <string.h> +static char buf[10000]; +int main () { -uintmax_t i = (uintmax_t) -1; return !i; - ; + buf[0] = '\0'; + if (sprintf (buf, "%Lf %d", 1.75L, 33, 44, 55) < 0 + || strcmp (buf, "1.750000 33") != 0) + return 1; + buf[0] = '\0'; + if (sprintf (buf, "%Le %d", 1.75L, 33, 44, 55) < 0 + || strcmp (buf, "1.750000e+00 33") != 0) + return 1; + buf[0] = '\0'; + if (sprintf (buf, "%Lg %d", 1.75L, 33, 44, 55) < 0 + || strcmp (buf, "1.75 33") != 0) + return 1; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 + (eval "$ac_link") 2>&5 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - gl_cv_header_inttypes_h=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - gl_cv_header_inttypes_h=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $gl_cv_header_inttypes_h" >&5 -echo "${ECHO_T}$gl_cv_header_inttypes_h" >&6; } - if test $gl_cv_header_inttypes_h = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_INTTYPES_H_WITH_UINTMAX 1 -_ACEOF - - fi - - - { echo "$as_me:$LINENO: checking for stdint.h" >&5 -echo $ECHO_N "checking for stdint.h... $ECHO_C" >&6; } -if test "${gl_cv_header_stdint_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <sys/types.h> -#include <stdint.h> -int -main () -{ -uintmax_t i = (uintmax_t) -1; return !i; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 + (eval "$ac_try") 2>&5 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - gl_cv_header_stdint_h=yes + (exit $ac_status); }; }; then + gl_cv_func_printf_long_double=yes else - echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - gl_cv_header_stdint_h=no +( exit $ac_status ) +gl_cv_func_printf_long_double=no fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $gl_cv_header_stdint_h" >&5 -echo "${ECHO_T}$gl_cv_header_stdint_h" >&6; } - if test $gl_cv_header_stdint_h = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_STDINT_H_WITH_UINTMAX 1 -_ACEOF - - fi - ac_cv_type_long_long=$ac_cv_type_long_long_int - if test $ac_cv_type_long_long = yes; then +fi +{ echo "$as_me:$LINENO: result: $gl_cv_func_printf_long_double" >&5 +echo "${ECHO_T}$gl_cv_func_printf_long_double" >&6; } -cat >>confdefs.h <<\_ACEOF -#define HAVE_LONG_LONG 1 -_ACEOF - fi + { echo "$as_me:$LINENO: checking whether printf supports infinite 'double' arguments" >&5 +echo $ECHO_N "checking whether printf supports infinite 'double' arguments... $ECHO_C" >&6; } +if test "${gl_cv_func_printf_infinite+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + case "$host_os" in + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_printf_infinite="guessing yes";; + # Guess yes on FreeBSD >= 6. + freebsd[1-5]*) gl_cv_func_printf_infinite="guessing no";; + freebsd* | kfreebsd*) gl_cv_func_printf_infinite="guessing yes";; + # Guess yes on MacOS X >= 10.3. + darwin[1-6].*) gl_cv_func_printf_infinite="guessing no";; + darwin*) gl_cv_func_printf_infinite="guessing yes";; + # Guess yes on HP-UX >= 11. + hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite="guessing no";; + hpux*) gl_cv_func_printf_infinite="guessing yes";; + # Guess yes on NetBSD >= 3. + netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) + gl_cv_func_printf_infinite="guessing no";; + netbsd*) gl_cv_func_printf_infinite="guessing yes";; + # Guess yes on BeOS. + beos*) gl_cv_func_printf_infinite="guessing yes";; + # If we don't know, assume the worst. + *) gl_cv_func_printf_infinite="guessing no";; + esac - { echo "$as_me:$LINENO: checking for intmax_t" >&5 -echo $ECHO_N "checking for intmax_t... $ECHO_C" >&6; } -if test "${gt_cv_c_intmax_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -10139,144 +10676,56 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <stddef.h> -#include <stdlib.h> -#if HAVE_STDINT_H_WITH_UINTMAX -#include <stdint.h> -#endif -#if HAVE_INTTYPES_H_WITH_UINTMAX -#include <inttypes.h> -#endif - -int -main () +#include <stdio.h> +#include <string.h> +static int +strisnan (const char *string, size_t start_index, size_t end_index) { -intmax_t x = -1; return !x; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - gt_cv_c_intmax_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - gt_cv_c_intmax_t=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $gt_cv_c_intmax_t" >&5 -echo "${ECHO_T}$gt_cv_c_intmax_t" >&6; } - if test $gt_cv_c_intmax_t = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_INTMAX_T 1 -_ACEOF - - else - - test $ac_cv_type_long_long = yes \ - && ac_type='long long' \ - || ac_type='long' - -cat >>confdefs.h <<_ACEOF -#define intmax_t $ac_type -_ACEOF - - fi - - - - - - { echo "$as_me:$LINENO: checking whether printf supports size specifiers as in C99" >&5 -echo $ECHO_N "checking whether printf supports size specifiers as in C99... $ECHO_C" >&6; } -if test "${gl_cv_func_printf_sizes_c99+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - if test "$cross_compiling" = yes; then - - case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_printf_sizes_c99="guessing yes";; - # Guess yes on FreeBSD >= 5. - freebsd[1-4]*) gl_cv_func_printf_sizes_c99="guessing no";; - freebsd* | kfreebsd*) gl_cv_func_printf_sizes_c99="guessing yes";; - # Guess yes on MacOS X >= 10.3. - darwin[1-6].*) gl_cv_func_printf_sizes_c99="guessing no";; - darwin*) gl_cv_func_printf_sizes_c99="guessing yes";; - # Guess yes on OpenBSD >= 3.9. - openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*) - gl_cv_func_printf_sizes_c99="guessing no";; - openbsd*) gl_cv_func_printf_sizes_c99="guessing yes";; - # Guess yes on Solaris >= 2.10. - solaris2.[0-9]*) gl_cv_func_printf_sizes_c99="guessing no";; - solaris*) gl_cv_func_printf_sizes_c99="guessing yes";; - # Guess yes on NetBSD >= 3. - netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) - gl_cv_func_printf_sizes_c99="guessing no";; - netbsd*) gl_cv_func_printf_sizes_c99="guessing yes";; - # If we don't know, assume the worst. - *) gl_cv_func_printf_sizes_c99="guessing no";; - esac - -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include <stddef.h> -#include <stdio.h> -#include <string.h> -#include <sys/types.h> -#if HAVE_STDINT_H_WITH_UINTMAX -# include <stdint.h> -#endif -#if HAVE_INTTYPES_H_WITH_UINTMAX -# include <inttypes.h> -#endif -static char buf[100]; + if (start_index < end_index) + { + if (string[start_index] == '-') + start_index++; + if (start_index + 3 <= end_index + && memcmp (string + start_index, "nan", 3) == 0) + { + start_index += 3; + if (start_index == end_index + || (string[start_index] == '(' && string[end_index - 1] == ')')) + return 1; + } + } + return 0; +} +static char buf[10000]; +static double zero = 0.0; int main () { -#if HAVE_STDINT_H_WITH_UINTMAX || HAVE_INTTYPES_H_WITH_UINTMAX - buf[0] = '\0'; - if (sprintf (buf, "%ju %d", (uintmax_t) 12345671, 33, 44, 55) < 0 - || strcmp (buf, "12345671 33") != 0) + if (sprintf (buf, "%f", 1.0 / 0.0) < 0 + || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) return 1; -#endif - buf[0] = '\0'; - if (sprintf (buf, "%zu %d", (size_t) 12345672, 33, 44, 55) < 0 - || strcmp (buf, "12345672 33") != 0) + if (sprintf (buf, "%f", -1.0 / 0.0) < 0 + || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) return 1; - buf[0] = '\0'; - if (sprintf (buf, "%tu %d", (ptrdiff_t) 12345673, 33, 44, 55) < 0 - || strcmp (buf, "12345673 33") != 0) + if (sprintf (buf, "%f", zero / zero) < 0 + || !strisnan (buf, 0, strlen (buf))) return 1; - buf[0] = '\0'; - if (sprintf (buf, "%Lg %d", (long double) 1.5, 33, 44, 55) < 0 - || strcmp (buf, "1.5 33") != 0) + if (sprintf (buf, "%e", 1.0 / 0.0) < 0 + || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) + return 1; + if (sprintf (buf, "%e", -1.0 / 0.0) < 0 + || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) + return 1; + if (sprintf (buf, "%e", zero / zero) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%g", 1.0 / 0.0) < 0 + || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) + return 1; + if (sprintf (buf, "%g", -1.0 / 0.0) < 0 + || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) + return 1; + if (sprintf (buf, "%g", zero / zero) < 0 + || !strisnan (buf, 0, strlen (buf))) return 1; return 0; } @@ -10301,14 +10750,14 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - gl_cv_func_printf_sizes_c99=yes + gl_cv_func_printf_infinite=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -gl_cv_func_printf_sizes_c99=no +gl_cv_func_printf_infinite=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi @@ -10316,24 +10765,55 @@ fi fi -{ echo "$as_me:$LINENO: result: $gl_cv_func_printf_sizes_c99" >&5 -echo "${ECHO_T}$gl_cv_func_printf_sizes_c99" >&6; } +{ echo "$as_me:$LINENO: result: $gl_cv_func_printf_infinite" >&5 +echo "${ECHO_T}$gl_cv_func_printf_infinite" >&6; } - { echo "$as_me:$LINENO: checking whether printf supports 'long double' arguments" >&5 -echo $ECHO_N "checking whether printf supports 'long double' arguments... $ECHO_C" >&6; } -if test "${gl_cv_func_printf_long_double+set}" = set; then + + + if test -n "$gl_printf_safe"; then + +cat >>confdefs.h <<\_ACEOF +#define CHECK_PRINTF_SAFE 1 +_ACEOF + + fi + case "$gl_cv_func_printf_long_double" in + *yes) + { echo "$as_me:$LINENO: checking whether printf supports infinite 'long double' arguments" >&5 +echo $ECHO_N "checking whether printf supports infinite 'long double' arguments... $ECHO_C" >&6; } +if test "${gl_cv_func_printf_infinite_long_double+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test "$cross_compiling" = yes; then + if test "$cross_compiling" = yes; then - case "$host_os" in - beos*) gl_cv_func_printf_long_double="guessing no";; - mingw* | pw*) gl_cv_func_printf_long_double="guessing no";; - *) gl_cv_func_printf_long_double="guessing yes";; - esac + case "$host_cpu" in + # Guess no on ia64, x86_64, i386. + ia64 | x86_64 | i*86) gl_cv_func_printf_infinite_long_double="guessing no";; + *) + case "$host_os" in + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_printf_infinite_long_double="guessing yes";; + # Guess yes on FreeBSD >= 6. + freebsd[1-5]*) gl_cv_func_printf_infinite_long_double="guessing no";; + freebsd* | kfreebsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; + # Guess yes on MacOS X >= 10.3. + darwin[1-6].*) gl_cv_func_printf_infinite_long_double="guessing no";; + darwin*) gl_cv_func_printf_infinite_long_double="guessing yes";; + # Guess yes on HP-UX >= 11. + hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite_long_double="guessing no";; + hpux*) gl_cv_func_printf_infinite_long_double="guessing yes";; + # Guess yes on NetBSD >= 3. + netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) + gl_cv_func_printf_infinite_long_double="guessing no";; + netbsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; + # If we don't know, assume the worst. + *) gl_cv_func_printf_infinite_long_double="guessing no";; + esac + ;; + esac else cat >conftest.$ac_ext <<_ACEOF @@ -10343,23 +10823,250 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ + +#include <stdlib.h> +#if defined __MACH__ && defined __APPLE__ +/* Avoid a crash on MacOS X. */ +#include <mach/mach.h> +#include <mach/mach_error.h> +#include <mach/thread_status.h> +#include <mach/exception.h> +#include <mach/task.h> +#include <pthread.h> +/* The exception port on which our thread listens. */ +static mach_port_t our_exception_port; +/* The main function of the thread listening for exceptions of type + EXC_BAD_ACCESS. */ +static void * +mach_exception_thread (void *arg) +{ + /* Buffer for a message to be received. */ + struct { + mach_msg_header_t head; + mach_msg_body_t msgh_body; + char data[1024]; + } msg; + mach_msg_return_t retval; + /* Wait for a message on the exception port. */ + retval = mach_msg (&msg.head, MACH_RCV_MSG | MACH_RCV_LARGE, 0, sizeof (msg), + our_exception_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + if (retval != MACH_MSG_SUCCESS) + abort (); + exit (1); +} +static void +nocrash_init (void) +{ + mach_port_t self = mach_task_self (); + /* Allocate a port on which the thread shall listen for exceptions. */ + if (mach_port_allocate (self, MACH_PORT_RIGHT_RECEIVE, &our_exception_port) + == KERN_SUCCESS) { + /* See http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/mach_port_insert_right.html. */ + if (mach_port_insert_right (self, our_exception_port, our_exception_port, + MACH_MSG_TYPE_MAKE_SEND) + == KERN_SUCCESS) { + /* The exceptions we want to catch. Only EXC_BAD_ACCESS is interesting + for us. */ + exception_mask_t mask = EXC_MASK_BAD_ACCESS; + /* Create the thread listening on the exception port. */ + pthread_attr_t attr; + pthread_t thread; + if (pthread_attr_init (&attr) == 0 + && pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED) == 0 + && pthread_create (&thread, &attr, mach_exception_thread, NULL) == 0) { + pthread_attr_destroy (&attr); + /* Replace the exception port info for these exceptions with our own. + Note that we replace the exception port for the entire task, not only + for a particular thread. This has the effect that when our exception + port gets the message, the thread specific exception port has already + been asked, and we don't need to bother about it. + See http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/task_set_exception_ports.html. */ + task_set_exception_ports (self, mask, our_exception_port, + EXCEPTION_DEFAULT, MACHINE_THREAD_STATE); + } + } + } +} +#else +/* Avoid a crash on POSIX systems. */ +#include <signal.h> +/* A POSIX signal handler. */ +static void +exception_handler (int sig) +{ + exit (1); +} +static void +nocrash_init (void) +{ +#ifdef SIGSEGV + signal (SIGSEGV, exception_handler); +#endif +#ifdef SIGBUS + signal (SIGBUS, exception_handler); +#endif +} +#endif + +#include <float.h> #include <stdio.h> #include <string.h> -static char buf[100]; +static int +strisnan (const char *string, size_t start_index, size_t end_index) +{ + if (start_index < end_index) + { + if (string[start_index] == '-') + start_index++; + if (start_index + 3 <= end_index + && memcmp (string + start_index, "nan", 3) == 0) + { + start_index += 3; + if (start_index == end_index + || (string[start_index] == '(' && string[end_index - 1] == ')')) + return 1; + } + } + return 0; +} +static char buf[10000]; +static long double zeroL = 0.0L; int main () { - buf[0] = '\0'; - if (sprintf (buf, "%Lf %d", 1.75L, 33, 44, 55) < 0 - || strcmp (buf, "1.750000 33") != 0) - return 1; - buf[0] = '\0'; - if (sprintf (buf, "%Le %d", 1.75L, 33, 44, 55) < 0 - || strcmp (buf, "1.750000e+00 33") != 0) + nocrash_init(); + if (sprintf (buf, "%Lf", 1.0L / 0.0L) < 0 + || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) return 1; - buf[0] = '\0'; - if (sprintf (buf, "%Lg %d", 1.75L, 33, 44, 55) < 0 - || strcmp (buf, "1.75 33") != 0) + if (sprintf (buf, "%Lf", -1.0L / 0.0L) < 0 + || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) + return 1; + if (sprintf (buf, "%Lf", zeroL / zeroL) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%Le", 1.0L / 0.0L) < 0 + || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) return 1; + if (sprintf (buf, "%Le", -1.0L / 0.0L) < 0 + || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) + return 1; + if (sprintf (buf, "%Le", zeroL / zeroL) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%Lg", 1.0L / 0.0L) < 0 + || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) + return 1; + if (sprintf (buf, "%Lg", -1.0L / 0.0L) < 0 + || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) + return 1; + if (sprintf (buf, "%Lg", zeroL / zeroL) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; +#if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) +/* Representation of an 80-bit 'long double' as an initializer for a sequence + of 'unsigned int' words. */ +# ifdef WORDS_BIGENDIAN +# define LDBL80_WORDS(exponent,manthi,mantlo) \ + { ((unsigned int) (exponent) << 16) | ((unsigned int) (manthi) >> 16), \ + ((unsigned int) (manthi) << 16) | (unsigned int) (mantlo) >> 16), \ + (unsigned int) (mantlo) << 16 \ + } +# else +# define LDBL80_WORDS(exponent,manthi,mantlo) \ + { mantlo, manthi, exponent } +# endif + { /* Quiet NaN. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) }; + if (sprintf (buf, "%Lf", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%Le", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%Lg", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + } + { + /* Signalling NaN. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) }; + if (sprintf (buf, "%Lf", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%Le", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%Lg", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + } + { /* Pseudo-NaN. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) }; + if (sprintf (buf, "%Lf", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%Le", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%Lg", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + } + { /* Pseudo-Infinity. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) }; + if (sprintf (buf, "%Lf", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%Le", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%Lg", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + } + { /* Pseudo-Zero. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) }; + if (sprintf (buf, "%Lf", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%Le", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%Lg", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + } + { /* Unnormalized number. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) }; + if (sprintf (buf, "%Lf", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%Le", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%Lg", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + } + { /* Pseudo-Denormal. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) }; + if (sprintf (buf, "%Lf", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%Le", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%Lg", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + } +#endif return 0; } _ACEOF @@ -10383,14 +11090,14 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - gl_cv_func_printf_long_double=yes + gl_cv_func_printf_infinite_long_double=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -gl_cv_func_printf_long_double=no +gl_cv_func_printf_infinite_long_double=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi @@ -10398,39 +11105,53 @@ fi fi -{ echo "$as_me:$LINENO: result: $gl_cv_func_printf_long_double" >&5 -echo "${ECHO_T}$gl_cv_func_printf_long_double" >&6; } +{ echo "$as_me:$LINENO: result: $gl_cv_func_printf_infinite_long_double" >&5 +echo "${ECHO_T}$gl_cv_func_printf_infinite_long_double" >&6; } + ;; + *) + gl_cv_func_printf_infinite_long_double="irrelevant" + ;; + esac - { echo "$as_me:$LINENO: checking whether printf supports infinite 'double' arguments" >&5 -echo $ECHO_N "checking whether printf supports infinite 'double' arguments... $ECHO_C" >&6; } -if test "${gl_cv_func_printf_infinite+set}" = set; then + { echo "$as_me:$LINENO: checking whether printf supports the 'a' and 'A' directives" >&5 +echo $ECHO_N "checking whether printf supports the 'a' and 'A' directives... $ECHO_C" >&6; } +if test "${gl_cv_func_printf_directive_a+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_printf_infinite="guessing yes";; - # Guess yes on FreeBSD >= 6. - freebsd[1-5]*) gl_cv_func_printf_infinite="guessing no";; - freebsd* | kfreebsd*) gl_cv_func_printf_infinite="guessing yes";; - # Guess yes on MacOS X >= 10.3. - darwin[1-6].*) gl_cv_func_printf_infinite="guessing no";; - darwin*) gl_cv_func_printf_infinite="guessing yes";; - # Guess yes on HP-UX >= 11. - hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite="guessing no";; - hpux*) gl_cv_func_printf_infinite="guessing yes";; - # Guess yes on NetBSD >= 3. - netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) - gl_cv_func_printf_infinite="guessing no";; - netbsd*) gl_cv_func_printf_infinite="guessing yes";; - # Guess yes on BeOS. - beos*) gl_cv_func_printf_infinite="guessing yes";; + # Guess yes on glibc >= 2.5 systems. + *-gnu*) + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <features.h> + #ifdef __GNU_LIBRARY__ + #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 5) || (__GLIBC__ > 2) + BZ2908 + #endif + #endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "BZ2908" >/dev/null 2>&1; then + gl_cv_func_printf_directive_a="guessing yes" +else + gl_cv_func_printf_directive_a="guessing no" +fi +rm -f conftest* + + ;; # If we don't know, assume the worst. - *) gl_cv_func_printf_infinite="guessing no";; + *) gl_cv_func_printf_directive_a="guessing no";; esac else @@ -10443,54 +11164,47 @@ cat >>conftest.$ac_ext <<_ACEOF #include <stdio.h> #include <string.h> -static int -strisnan (const char *string, size_t start_index, size_t end_index) -{ - if (start_index < end_index) - { - if (string[start_index] == '-') - start_index++; - if (start_index + 3 <= end_index - && memcmp (string + start_index, "nan", 3) == 0) - { - start_index += 3; - if (start_index == end_index - || (string[start_index] == '(' && string[end_index - 1] == ')')) - return 1; - } - } - return 0; -} static char buf[100]; -static double zero = 0.0; int main () { - if (sprintf (buf, "%f", 1.0 / 0.0) < 0 - || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) + if (sprintf (buf, "%a %d", 3.1416015625, 33, 44, 55) < 0 + || (strcmp (buf, "0x1.922p+1 33") != 0 + && strcmp (buf, "0x3.244p+0 33") != 0 + && strcmp (buf, "0x6.488p-1 33") != 0 + && strcmp (buf, "0xc.91p-2 33") != 0)) return 1; - if (sprintf (buf, "%f", -1.0 / 0.0) < 0 - || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) + if (sprintf (buf, "%A %d", -3.1416015625, 33, 44, 55) < 0 + || (strcmp (buf, "-0X1.922P+1 33") != 0 + && strcmp (buf, "-0X3.244P+0 33") != 0 + && strcmp (buf, "-0X6.488P-1 33") != 0 + && strcmp (buf, "-0XC.91P-2 33") != 0)) return 1; - if (sprintf (buf, "%f", zero / zero) < 0 - || !strisnan (buf, 0, strlen (buf))) + /* This catches a FreeBSD 6.1 bug: it doesn't round. */ + if (sprintf (buf, "%.2a %d", 1.51, 33, 44, 55) < 0 + || (strcmp (buf, "0x1.83p+0 33") != 0 + && strcmp (buf, "0x3.05p-1 33") != 0 + && strcmp (buf, "0x6.0ap-2 33") != 0 + && strcmp (buf, "0xc.14p-3 33") != 0)) return 1; - if (sprintf (buf, "%e", 1.0 / 0.0) < 0 - || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) + /* This catches a FreeBSD 6.1 bug. See + <http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> */ + if (sprintf (buf, "%010a %d", 1.0 / 0.0, 33, 44, 55) < 0 + || buf[0] == '0') return 1; - if (sprintf (buf, "%e", -1.0 / 0.0) < 0 - || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) + /* This catches a MacOS X 10.3.9 (Darwin 7.9) bug. */ + if (sprintf (buf, "%.1a", 1.999) < 0 + || (strcmp (buf, "0x1.0p+1") != 0 + && strcmp (buf, "0x2.0p+0") != 0 + && strcmp (buf, "0x4.0p-1") != 0 + && strcmp (buf, "0x8.0p-2") != 0)) return 1; - if (sprintf (buf, "%e", zero / zero) < 0 - || !strisnan (buf, 0, strlen (buf))) - return 1; - if (sprintf (buf, "%g", 1.0 / 0.0) < 0 - || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) - return 1; - if (sprintf (buf, "%g", -1.0 / 0.0) < 0 - || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) - return 1; - if (sprintf (buf, "%g", zero / zero) < 0 - || !strisnan (buf, 0, strlen (buf))) + /* This catches the same MacOS X 10.3.9 (Darwin 7.9) bug and also a + glibc 2.4 bug <http://sourceware.org/bugzilla/show_bug.cgi?id=2908>. */ + if (sprintf (buf, "%.1La", 1.999L) < 0 + || (strcmp (buf, "0x1.0p+1") != 0 + && strcmp (buf, "0x2.0p+0") != 0 + && strcmp (buf, "0x4.0p-1") != 0 + && strcmp (buf, "0x8.0p-2") != 0)) return 1; return 0; } @@ -10515,14 +11229,14 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - gl_cv_func_printf_infinite=yes + gl_cv_func_printf_directive_a=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -gl_cv_func_printf_infinite=no +gl_cv_func_printf_directive_a=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi @@ -10530,55 +11244,34 @@ fi fi -{ echo "$as_me:$LINENO: result: $gl_cv_func_printf_infinite" >&5 -echo "${ECHO_T}$gl_cv_func_printf_infinite" >&6; } - - - - +{ echo "$as_me:$LINENO: result: $gl_cv_func_printf_directive_a" >&5 +echo "${ECHO_T}$gl_cv_func_printf_directive_a" >&6; } - if test -n "$gl_printf_safe"; then -cat >>confdefs.h <<\_ACEOF -#define CHECK_PRINTF_SAFE 1 -_ACEOF - fi - case "$gl_cv_func_printf_long_double" in - *yes) - { echo "$as_me:$LINENO: checking whether printf supports infinite 'long double' arguments" >&5 -echo $ECHO_N "checking whether printf supports infinite 'long double' arguments... $ECHO_C" >&6; } -if test "${gl_cv_func_printf_infinite_long_double+set}" = set; then + { echo "$as_me:$LINENO: checking whether printf supports the 'F' directive" >&5 +echo $ECHO_N "checking whether printf supports the 'F' directive... $ECHO_C" >&6; } +if test "${gl_cv_func_printf_directive_f+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test "$cross_compiling" = yes; then + if test "$cross_compiling" = yes; then - case "$host_cpu" in - # Guess no on ia64, x86_64, i386. - ia64 | x86_64 | i*86) gl_cv_func_printf_infinite_long_double="guessing no";; - *) - case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_printf_infinite_long_double="guessing yes";; - # Guess yes on FreeBSD >= 6. - freebsd[1-5]*) gl_cv_func_printf_infinite_long_double="guessing no";; - freebsd* | kfreebsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; - # Guess yes on MacOS X >= 10.3. - darwin[1-6].*) gl_cv_func_printf_infinite_long_double="guessing no";; - darwin*) gl_cv_func_printf_infinite_long_double="guessing yes";; - # Guess yes on HP-UX >= 11. - hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite_long_double="guessing no";; - hpux*) gl_cv_func_printf_infinite_long_double="guessing yes";; - # Guess yes on NetBSD >= 3. - netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) - gl_cv_func_printf_infinite_long_double="guessing no";; - netbsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; - # If we don't know, assume the worst. - *) gl_cv_func_printf_infinite_long_double="guessing no";; - esac - ;; - esac + case "$host_os" in + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_printf_directive_f="guessing yes";; + # Guess yes on FreeBSD >= 6. + freebsd[1-5]*) gl_cv_func_printf_directive_f="guessing no";; + freebsd* | kfreebsd*) gl_cv_func_printf_directive_f="guessing yes";; + # Guess yes on MacOS X >= 10.3. + darwin[1-6].*) gl_cv_func_printf_directive_f="guessing no";; + darwin*) gl_cv_func_printf_directive_f="guessing yes";; + # Guess yes on Solaris >= 2.10. + solaris2.[0-9]*) gl_cv_func_printf_directive_f="guessing no";; + solaris*) gl_cv_func_printf_directive_f="guessing yes";; + # If we don't know, assume the worst. + *) gl_cv_func_printf_directive_f="guessing no";; + esac else cat >conftest.$ac_ext <<_ACEOF @@ -10588,164 +11281,21 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <float.h> #include <stdio.h> #include <string.h> -static int -strisnan (const char *string, size_t start_index, size_t end_index) -{ - if (start_index < end_index) - { - if (string[start_index] == '-') - start_index++; - if (start_index + 3 <= end_index - && memcmp (string + start_index, "nan", 3) == 0) - { - start_index += 3; - if (start_index == end_index - || (string[start_index] == '(' && string[end_index - 1] == ')')) - return 1; - } - } - return 0; -} static char buf[100]; -static long double zeroL = 0.0L; int main () { - if (sprintf (buf, "%Lf", 1.0L / 0.0L) < 0 - || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) - return 1; - if (sprintf (buf, "%Lf", -1.0L / 0.0L) < 0 - || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) - return 1; - if (sprintf (buf, "%Lf", zeroL / zeroL) < 0 - || !strisnan (buf, 0, strlen (buf))) - return 1; - if (sprintf (buf, "%Le", 1.0L / 0.0L) < 0 - || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) - return 1; - if (sprintf (buf, "%Le", -1.0L / 0.0L) < 0 - || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) - return 1; - if (sprintf (buf, "%Le", zeroL / zeroL) < 0 - || !strisnan (buf, 0, strlen (buf))) - return 1; - if (sprintf (buf, "%Lg", 1.0L / 0.0L) < 0 - || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) + if (sprintf (buf, "%F %d", 1234567.0, 33, 44, 55) < 0 + || strcmp (buf, "1234567.000000 33") != 0) return 1; - if (sprintf (buf, "%Lg", -1.0L / 0.0L) < 0 - || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) + if (sprintf (buf, "%F", 1.0 / 0.0) < 0 + || (strcmp (buf, "INF") != 0 && strcmp (buf, "INFINITY") != 0)) return 1; - if (sprintf (buf, "%Lg", zeroL / zeroL) < 0 - || !strisnan (buf, 0, strlen (buf))) + /* This catches a Cygwin 2007 bug. */ + if (sprintf (buf, "%.F", 1234.0) < 0 + || strcmp (buf, "1234") != 0) return 1; -#if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) -/* Representation of an 80-bit 'long double' as an initializer for a sequence - of 'unsigned int' words. */ -# ifdef WORDS_BIGENDIAN -# define LDBL80_WORDS(exponent,manthi,mantlo) \ - { ((unsigned int) (exponent) << 16) | ((unsigned int) (manthi) >> 16), \ - ((unsigned int) (manthi) << 16) | (unsigned int) (mantlo) >> 16), \ - (unsigned int) (mantlo) << 16 \ - } -# else -# define LDBL80_WORDS(exponent,manthi,mantlo) \ - { mantlo, manthi, exponent } -# endif - { /* Quiet NaN. */ - static union { unsigned int word[4]; long double value; } x = - { LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) }; - if (sprintf (buf, "%Lf", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - return 1; - if (sprintf (buf, "%Le", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - return 1; - if (sprintf (buf, "%Lg", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - return 1; - } - { - /* Signalling NaN. */ - static union { unsigned int word[4]; long double value; } x = - { LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) }; - if (sprintf (buf, "%Lf", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - return 1; - if (sprintf (buf, "%Le", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - return 1; - if (sprintf (buf, "%Lg", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - return 1; - } - { /* Pseudo-NaN. */ - static union { unsigned int word[4]; long double value; } x = - { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) }; - if (sprintf (buf, "%Lf", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - return 1; - if (sprintf (buf, "%Le", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - return 1; - if (sprintf (buf, "%Lg", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - return 1; - } - { /* Pseudo-Infinity. */ - static union { unsigned int word[4]; long double value; } x = - { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) }; - if (sprintf (buf, "%Lf", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - return 1; - if (sprintf (buf, "%Le", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - return 1; - if (sprintf (buf, "%Lg", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - return 1; - } - { /* Pseudo-Zero. */ - static union { unsigned int word[4]; long double value; } x = - { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) }; - if (sprintf (buf, "%Lf", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - return 1; - if (sprintf (buf, "%Le", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - return 1; - if (sprintf (buf, "%Lg", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - return 1; - } - { /* Unnormalized number. */ - static union { unsigned int word[4]; long double value; } x = - { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) }; - if (sprintf (buf, "%Lf", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - return 1; - if (sprintf (buf, "%Le", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - return 1; - if (sprintf (buf, "%Lg", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - return 1; - } - { /* Pseudo-Denormal. */ - static union { unsigned int word[4]; long double value; } x = - { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) }; - if (sprintf (buf, "%Lf", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - return 1; - if (sprintf (buf, "%Le", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - return 1; - if (sprintf (buf, "%Lg", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - return 1; - } -#endif return 0; } _ACEOF @@ -10769,14 +11319,14 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - gl_cv_func_printf_infinite_long_double=yes + gl_cv_func_printf_directive_f=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -gl_cv_func_printf_infinite_long_double=no +gl_cv_func_printf_directive_f=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi @@ -10784,53 +11334,21 @@ fi fi -{ echo "$as_me:$LINENO: result: $gl_cv_func_printf_infinite_long_double" >&5 -echo "${ECHO_T}$gl_cv_func_printf_infinite_long_double" >&6; } - ;; - *) - gl_cv_func_printf_infinite_long_double="irrelevant" - ;; - esac +{ echo "$as_me:$LINENO: result: $gl_cv_func_printf_directive_f" >&5 +echo "${ECHO_T}$gl_cv_func_printf_directive_f" >&6; } - { echo "$as_me:$LINENO: checking whether printf supports the 'a' and 'A' directives" >&5 -echo $ECHO_N "checking whether printf supports the 'a' and 'A' directives... $ECHO_C" >&6; } -if test "${gl_cv_func_printf_directive_a+set}" = set; then + { echo "$as_me:$LINENO: checking whether printf supports the 'n' directive" >&5 +echo $ECHO_N "checking whether printf supports the 'n' directive... $ECHO_C" >&6; } +if test "${gl_cv_func_printf_directive_n+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then case "$host_os" in - # Guess yes on glibc >= 2.5 systems. - *-gnu*) - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - - #include <features.h> - #ifdef __GNU_LIBRARY__ - #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 5) || (__GLIBC__ > 2) - BZ2908 - #endif - #endif - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "BZ2908" >/dev/null 2>&1; then - gl_cv_func_printf_directive_a="guessing yes" -else - gl_cv_func_printf_directive_a="guessing no" -fi -rm -f conftest* - - ;; - # If we don't know, assume the worst. - *) gl_cv_func_printf_directive_a="guessing no";; + *) gl_cv_func_printf_directive_n="guessing yes";; esac else @@ -10843,47 +11361,18 @@ cat >>conftest.$ac_ext <<_ACEOF #include <stdio.h> #include <string.h> +static char fmtstring[10]; static char buf[100]; int main () { - if (sprintf (buf, "%a %d", 3.1416015625, 33, 44, 55) < 0 - || (strcmp (buf, "0x1.922p+1 33") != 0 - && strcmp (buf, "0x3.244p+0 33") != 0 - && strcmp (buf, "0x6.488p-1 33") != 0 - && strcmp (buf, "0xc.91p-2 33") != 0)) - return 1; - if (sprintf (buf, "%A %d", -3.1416015625, 33, 44, 55) < 0 - || (strcmp (buf, "-0X1.922P+1 33") != 0 - && strcmp (buf, "-0X3.244P+0 33") != 0 - && strcmp (buf, "-0X6.488P-1 33") != 0 - && strcmp (buf, "-0XC.91P-2 33") != 0)) - return 1; - /* This catches a FreeBSD 6.1 bug: it doesn't round. */ - if (sprintf (buf, "%.2a %d", 1.51, 33, 44, 55) < 0 - || (strcmp (buf, "0x1.83p+0 33") != 0 - && strcmp (buf, "0x3.05p-1 33") != 0 - && strcmp (buf, "0x6.0ap-2 33") != 0 - && strcmp (buf, "0xc.14p-3 33") != 0)) - return 1; - /* This catches a FreeBSD 6.1 bug. See - <http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> */ - if (sprintf (buf, "%010a %d", 1.0 / 0.0, 33, 44, 55) < 0 - || buf[0] == '0') - return 1; - /* This catches a MacOS X 10.3.9 (Darwin 7.9) bug. */ - if (sprintf (buf, "%.1a", 1.999) < 0 - || (strcmp (buf, "0x1.0p+1") != 0 - && strcmp (buf, "0x2.0p+0") != 0 - && strcmp (buf, "0x4.0p-1") != 0 - && strcmp (buf, "0x8.0p-2") != 0)) - return 1; - /* This catches the same MacOS X 10.3.9 (Darwin 7.9) bug and also a - glibc 2.4 bug <http://sourceware.org/bugzilla/show_bug.cgi?id=2908>. */ - if (sprintf (buf, "%.1La", 1.999L) < 0 - || (strcmp (buf, "0x1.0p+1") != 0 - && strcmp (buf, "0x2.0p+0") != 0 - && strcmp (buf, "0x4.0p-1") != 0 - && strcmp (buf, "0x8.0p-2") != 0)) + int count = -1; + /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2) + support %n in format strings in read-only memory but not in writable + memory. */ + strcpy (fmtstring, "%d %n"); + if (sprintf (buf, fmtstring, 123, &count, 33, 44, 55) < 0 + || strcmp (buf, "123 ") != 0 + || count != 4) return 1; return 0; } @@ -10908,14 +11397,14 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - gl_cv_func_printf_directive_a=yes + gl_cv_func_printf_directive_n=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -gl_cv_func_printf_directive_a=no +gl_cv_func_printf_directive_n=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi @@ -10923,33 +11412,25 @@ fi fi -{ echo "$as_me:$LINENO: result: $gl_cv_func_printf_directive_a" >&5 -echo "${ECHO_T}$gl_cv_func_printf_directive_a" >&6; } +{ echo "$as_me:$LINENO: result: $gl_cv_func_printf_directive_n" >&5 +echo "${ECHO_T}$gl_cv_func_printf_directive_n" >&6; } - { echo "$as_me:$LINENO: checking whether printf supports the 'F' directive" >&5 -echo $ECHO_N "checking whether printf supports the 'F' directive... $ECHO_C" >&6; } -if test "${gl_cv_func_printf_directive_f+set}" = set; then + { echo "$as_me:$LINENO: checking whether printf supports POSIX/XSI format strings with positions" >&5 +echo $ECHO_N "checking whether printf supports POSIX/XSI format strings with positions... $ECHO_C" >&6; } +if test "${gl_cv_func_printf_positions+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_printf_directive_f="guessing yes";; - # Guess yes on FreeBSD >= 6. - freebsd[1-5]*) gl_cv_func_printf_directive_f="guessing no";; - freebsd* | kfreebsd*) gl_cv_func_printf_directive_f="guessing yes";; - # Guess yes on MacOS X >= 10.3. - darwin[1-6].*) gl_cv_func_printf_directive_f="guessing no";; - darwin*) gl_cv_func_printf_directive_f="guessing yes";; - # Guess yes on Solaris >= 2.10. - solaris2.[0-9]*) gl_cv_func_printf_directive_f="guessing no";; - solaris*) gl_cv_func_printf_directive_f="guessing yes";; - # If we don't know, assume the worst. - *) gl_cv_func_printf_directive_f="guessing no";; + netbsd[1-3]* | netbsdelf[1-3]* | netbsdaout[1-3]* | netbsdcoff[1-3]*) + gl_cv_func_printf_positions="guessing no";; + beos*) gl_cv_func_printf_positions="guessing no";; + mingw* | pw*) gl_cv_func_printf_positions="guessing no";; + *) gl_cv_func_printf_positions="guessing yes";; esac else @@ -10962,20 +11443,14 @@ cat >>conftest.$ac_ext <<_ACEOF #include <stdio.h> #include <string.h> +/* The string "%2$d %1$d", with dollar characters protected from the shell's + dollar expansion (possibly an autoconf bug). */ +static char format[] = { '%', '2', '$', 'd', ' ', '%', '1', '$', 'd', '\0' }; static char buf[100]; int main () { - if (sprintf (buf, "%F %d", 1234567.0, 33, 44, 55) < 0 - || strcmp (buf, "1234567.000000 33") != 0) - return 1; - if (sprintf (buf, "%F", 1.0 / 0.0) < 0 - || (strcmp (buf, "INF") != 0 && strcmp (buf, "INFINITY") != 0)) - return 1; - /* This catches a Cygwin 2007 bug. */ - if (sprintf (buf, "%.F", 1234.0) < 0 - || strcmp (buf, "1234") != 0) - return 1; - return 0; + sprintf (buf, format, 33, 55); + return (strcmp (buf, "55 33") != 0); } _ACEOF rm -f conftest$ac_exeext @@ -10998,14 +11473,14 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - gl_cv_func_printf_directive_f=yes + gl_cv_func_printf_positions=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -gl_cv_func_printf_directive_f=no +gl_cv_func_printf_positions=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi @@ -11013,21 +11488,24 @@ fi fi -{ echo "$as_me:$LINENO: result: $gl_cv_func_printf_directive_f" >&5 -echo "${ECHO_T}$gl_cv_func_printf_directive_f" >&6; } +{ echo "$as_me:$LINENO: result: $gl_cv_func_printf_positions" >&5 +echo "${ECHO_T}$gl_cv_func_printf_positions" >&6; } - { echo "$as_me:$LINENO: checking whether printf supports the 'n' directive" >&5 -echo $ECHO_N "checking whether printf supports the 'n' directive... $ECHO_C" >&6; } -if test "${gl_cv_func_printf_directive_n+set}" = set; then + { echo "$as_me:$LINENO: checking whether printf supports the grouping flag" >&5 +echo $ECHO_N "checking whether printf supports the grouping flag... $ECHO_C" >&6; } +if test "${gl_cv_func_printf_flag_grouping+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then case "$host_os" in - *) gl_cv_func_printf_directive_n="guessing yes";; + cygwin*) gl_cv_func_printf_flag_grouping="guessing no";; + netbsd*) gl_cv_func_printf_flag_grouping="guessing no";; + mingw* | pw*) gl_cv_func_printf_flag_grouping="guessing no";; + *) gl_cv_func_printf_flag_grouping="guessing yes";; esac else @@ -11043,10 +11521,8 @@ cat >>conftest.$ac_ext <<_ACEOF static char buf[100]; int main () { - int count = -1; - if (sprintf (buf, "%d %n", 123, &count, 33, 44, 55) < 0 - || strcmp (buf, "123 ") != 0 - || count != 4) + if (sprintf (buf, "%'d %d", 1234567, 99) < 0 + || buf[strlen (buf) - 1] != '9') return 1; return 0; } @@ -11071,14 +11547,14 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - gl_cv_func_printf_directive_n=yes + gl_cv_func_printf_flag_grouping=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -gl_cv_func_printf_directive_n=no +gl_cv_func_printf_flag_grouping=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi @@ -11086,26 +11562,27 @@ fi fi -{ echo "$as_me:$LINENO: result: $gl_cv_func_printf_directive_n" >&5 -echo "${ECHO_T}$gl_cv_func_printf_directive_n" >&6; } +{ echo "$as_me:$LINENO: result: $gl_cv_func_printf_flag_grouping" >&5 +echo "${ECHO_T}$gl_cv_func_printf_flag_grouping" >&6; } - { echo "$as_me:$LINENO: checking whether printf supports POSIX/XSI format strings with positions" >&5 -echo $ECHO_N "checking whether printf supports POSIX/XSI format strings with positions... $ECHO_C" >&6; } -if test "${gl_cv_func_printf_positions+set}" = set; then + { echo "$as_me:$LINENO: checking whether printf supports the left-adjust flag correctly" >&5 +echo $ECHO_N "checking whether printf supports the left-adjust flag correctly... $ECHO_C" >&6; } +if test "${gl_cv_func_printf_flag_leftadjust+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then - case "$host_os" in - netbsd[1-3]* | netbsdelf[1-3]* | netbsdaout[1-3]* | netbsdcoff[1-3]*) - gl_cv_func_printf_positions="guessing no";; - beos*) gl_cv_func_printf_positions="guessing no";; - mingw* | pw*) gl_cv_func_printf_positions="guessing no";; - *) gl_cv_func_printf_positions="guessing yes";; - esac + case "$host_os" in + # Guess yes on HP-UX 11. + hpux11*) gl_cv_func_printf_flag_leftadjust="guessing yes";; + # Guess no on HP-UX 10 and older. + hpux*) gl_cv_func_printf_flag_leftadjust="guessing no";; + # Guess yes otherwise. + *) gl_cv_func_printf_flag_leftadjust="guessing yes";; + esac else cat >conftest.$ac_ext <<_ACEOF @@ -11117,14 +11594,14 @@ cat >>conftest.$ac_ext <<_ACEOF #include <stdio.h> #include <string.h> -/* The string "%2$d %1$d", with dollar characters protected from the shell's - dollar expansion (possibly an autoconf bug). */ -static char format[] = { '%', '2', '$', 'd', ' ', '%', '1', '$', 'd', '\0' }; static char buf[100]; int main () { - sprintf (buf, format, 33, 55); - return (strcmp (buf, "55 33") != 0); + /* Check that a '-' flag is not annihilated by a negative width. */ + if (sprintf (buf, "a%-*sc", -3, "b") < 0 + || strcmp (buf, "ab c") != 0) + return 1; + return 0; } _ACEOF rm -f conftest$ac_exeext @@ -11147,14 +11624,14 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - gl_cv_func_printf_positions=yes + gl_cv_func_printf_flag_leftadjust=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -gl_cv_func_printf_positions=no +gl_cv_func_printf_flag_leftadjust=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi @@ -11162,24 +11639,26 @@ fi fi -{ echo "$as_me:$LINENO: result: $gl_cv_func_printf_positions" >&5 -echo "${ECHO_T}$gl_cv_func_printf_positions" >&6; } +{ echo "$as_me:$LINENO: result: $gl_cv_func_printf_flag_leftadjust" >&5 +echo "${ECHO_T}$gl_cv_func_printf_flag_leftadjust" >&6; } - { echo "$as_me:$LINENO: checking whether printf supports the grouping flag" >&5 -echo $ECHO_N "checking whether printf supports the grouping flag... $ECHO_C" >&6; } -if test "${gl_cv_func_printf_flag_grouping+set}" = set; then + { echo "$as_me:$LINENO: checking whether printf supports the zero flag correctly" >&5 +echo $ECHO_N "checking whether printf supports the zero flag correctly... $ECHO_C" >&6; } +if test "${gl_cv_func_printf_flag_zero+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then case "$host_os" in - cygwin*) gl_cv_func_printf_flag_grouping="guessing no";; - netbsd*) gl_cv_func_printf_flag_grouping="guessing no";; - mingw* | pw*) gl_cv_func_printf_flag_grouping="guessing no";; - *) gl_cv_func_printf_flag_grouping="guessing yes";; + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_printf_flag_zero="guessing yes";; + # Guess yes on BeOS. + beos*) gl_cv_func_printf_flag_zero="guessing yes";; + # If we don't know, assume the worst. + *) gl_cv_func_printf_flag_zero="guessing no";; esac else @@ -11195,8 +11674,9 @@ cat >>conftest.$ac_ext <<_ACEOF static char buf[100]; int main () { - if (sprintf (buf, "%'d %d", 1234567, 99) < 0 - || buf[strlen (buf) - 1] != '9') + if (sprintf (buf, "%010f", 1.0 / 0.0, 33, 44, 55) < 0 + || (strcmp (buf, " inf") != 0 + && strcmp (buf, " infinity") != 0)) return 1; return 0; } @@ -11221,14 +11701,14 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - gl_cv_func_printf_flag_grouping=yes + gl_cv_func_printf_flag_zero=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -gl_cv_func_printf_flag_grouping=no +gl_cv_func_printf_flag_zero=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi @@ -11236,26 +11716,24 @@ fi fi -{ echo "$as_me:$LINENO: result: $gl_cv_func_printf_flag_grouping" >&5 -echo "${ECHO_T}$gl_cv_func_printf_flag_grouping" >&6; } +{ echo "$as_me:$LINENO: result: $gl_cv_func_printf_flag_zero" >&5 +echo "${ECHO_T}$gl_cv_func_printf_flag_zero" >&6; } - { echo "$as_me:$LINENO: checking whether printf supports the zero flag correctly" >&5 -echo $ECHO_N "checking whether printf supports the zero flag correctly... $ECHO_C" >&6; } -if test "${gl_cv_func_printf_flag_zero+set}" = set; then + { echo "$as_me:$LINENO: checking whether printf supports large precisions" >&5 +echo $ECHO_N "checking whether printf supports large precisions... $ECHO_C" >&6; } +if test "${gl_cv_func_printf_precision+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_printf_flag_zero="guessing yes";; - # Guess yes on BeOS. - beos*) gl_cv_func_printf_flag_zero="guessing yes";; - # If we don't know, assume the worst. - *) gl_cv_func_printf_flag_zero="guessing no";; + # Guess no only on native Win32 and BeOS systems. + mingw* | pw*) gl_cv_func_printf_precision="guessing no" ;; + beos*) gl_cv_func_printf_precision="guessing no" ;; + *) gl_cv_func_printf_precision="guessing yes" ;; esac else @@ -11268,12 +11746,14 @@ cat >>conftest.$ac_ext <<_ACEOF #include <stdio.h> #include <string.h> -static char buf[100]; +static char buf[5000]; int main () { - if (sprintf (buf, "%010f", 1.0 / 0.0, 33, 44, 55) < 0 - || (strcmp (buf, " inf") != 0 - && strcmp (buf, " infinity") != 0)) +#ifdef __BEOS__ + /* On BeOS, this would crash and show a dialog box. Avoid the crash. */ + return 1; +#endif + if (sprintf (buf, "%.4000d %d", 1, 33, 44) < 4000 + 3) return 1; return 0; } @@ -11298,14 +11778,14 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - gl_cv_func_printf_flag_zero=yes + gl_cv_func_printf_precision=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -gl_cv_func_printf_flag_zero=no +gl_cv_func_printf_precision=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi @@ -11313,152 +11793,218 @@ fi fi -{ echo "$as_me:$LINENO: result: $gl_cv_func_printf_flag_zero" >&5 -echo "${ECHO_T}$gl_cv_func_printf_flag_zero" >&6; } - - - GNULIB_WCWIDTH=0; - HAVE_DECL_WCWIDTH=1; - REPLACE_WCWIDTH=0; - WCHAR_H= - - +{ echo "$as_me:$LINENO: result: $gl_cv_func_printf_precision" >&5 +echo "${ECHO_T}$gl_cv_func_printf_precision" >&6; } - - - - - - if false; then - GL_COND_LIBTOOL_TRUE= - GL_COND_LIBTOOL_FALSE='#' + { echo "$as_me:$LINENO: checking whether printf survives out-of-memory conditions" >&5 +echo $ECHO_N "checking whether printf survives out-of-memory conditions... $ECHO_C" >&6; } +if test "${gl_cv_func_printf_enomem+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - GL_COND_LIBTOOL_TRUE='#' - GL_COND_LIBTOOL_FALSE= -fi - - gl_cond_libtool=false - gl_libdeps= - gl_ltlibdeps= - gl_source_base='lib' - - + if test "$cross_compiling" = no; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ - if test $ac_cv_func_alloca_works = no; then - : - fi - - # Define an additional variable used in the Makefile substitution. - if test $ac_cv_working_alloca_h = yes; then - { echo "$as_me:$LINENO: checking for alloca as a compiler built-in" >&5 -echo $ECHO_N "checking for alloca as a compiler built-in... $ECHO_C" >&6; } -if test "${gl_cv_rpl_alloca+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#if defined __GNUC__ || defined _AIX || defined _MSC_VER - Need own alloca +#include <stdlib.h> +#if defined __MACH__ && defined __APPLE__ +/* Avoid a crash on MacOS X. */ +#include <mach/mach.h> +#include <mach/mach_error.h> +#include <mach/thread_status.h> +#include <mach/exception.h> +#include <mach/task.h> +#include <pthread.h> +/* The exception port on which our thread listens. */ +static mach_port_t our_exception_port; +/* The main function of the thread listening for exceptions of type + EXC_BAD_ACCESS. */ +static void * +mach_exception_thread (void *arg) +{ + /* Buffer for a message to be received. */ + struct { + mach_msg_header_t head; + mach_msg_body_t msgh_body; + char data1024; + } msg; + mach_msg_return_t retval; + /* Wait for a message on the exception port. */ + retval = mach_msg (&msg.head, MACH_RCV_MSG | MACH_RCV_LARGE, 0, sizeof (msg), + our_exception_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + if (retval != MACH_MSG_SUCCESS) + abort (); + exit (1); +} +static void +nocrash_init (void) +{ + mach_port_t self = mach_task_self (); + /* Allocate a port on which the thread shall listen for exceptions. */ + if (mach_port_allocate (self, MACH_PORT_RIGHT_RECEIVE, &our_exception_port) + == KERN_SUCCESS) { + /* See http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/mach_port_insert_right.html. */ + if (mach_port_insert_right (self, our_exception_port, our_exception_port, + MACH_MSG_TYPE_MAKE_SEND) + == KERN_SUCCESS) { + /* The exceptions we want to catch. Only EXC_BAD_ACCESS is interesting + for us. */ + exception_mask_t mask = EXC_MASK_BAD_ACCESS; + /* Create the thread listening on the exception port. */ + pthread_attr_t attr; + pthread_t thread; + if (pthread_attr_init (&attr) == 0 + && pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED) == 0 + && pthread_create (&thread, &attr, mach_exception_thread, NULL) == 0) { + pthread_attr_destroy (&attr); + /* Replace the exception port info for these exceptions with our own. + Note that we replace the exception port for the entire task, not only + for a particular thread. This has the effect that when our exception + port gets the message, the thread specific exception port has already + been asked, and we don't need to bother about it. + See http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/task_set_exception_ports.html. */ + task_set_exception_ports (self, mask, our_exception_port, + EXCEPTION_DEFAULT, MACHINE_THREAD_STATE); + } + } + } +} +#else +/* Avoid a crash on POSIX systems. */ +#include <signal.h> +/* A POSIX signal handler. */ +static void +exception_handler (int sig) +{ + exit (1); +} +static void +nocrash_init (void) +{ +#ifdef SIGSEGV + signal (SIGSEGV, exception_handler); +#endif +#ifdef SIGBUS + signal (SIGBUS, exception_handler); +#endif +} #endif -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "Need own alloca" >/dev/null 2>&1; then - gl_cv_rpl_alloca=yes -else - gl_cv_rpl_alloca=no -fi -rm -f conftest* - - -fi -{ echo "$as_me:$LINENO: result: $gl_cv_rpl_alloca" >&5 -echo "${ECHO_T}$gl_cv_rpl_alloca" >&6; } - if test $gl_cv_rpl_alloca = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_ALLOCA 1 -_ACEOF - - ALLOCA_H=alloca.h - else - ALLOCA_H= - fi - else - ALLOCA_H=alloca.h - fi - - - -cat >>confdefs.h <<\_ACEOF -#define HAVE_ALLOCA_H 1 -_ACEOF - - - - { echo "$as_me:$LINENO: checking whether to enable assertions" >&5 -echo $ECHO_N "checking whether to enable assertions... $ECHO_C" >&6; } - # Check whether --enable-assert was given. -if test "${enable_assert+set}" = set; then - enableval=$enable_assert; { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } +#include <stdio.h> +#include <sys/types.h> +#include <sys/time.h> +#include <sys/resource.h> +#include <errno.h> +int main() +{ + struct rlimit limit; + int ret; + nocrash_init (); + /* Some printf implementations allocate temporary space with malloc. */ + /* On BSD systems, malloc() is limited by RLIMIT_DATA. */ +#ifdef RLIMIT_DATA + if (getrlimit (RLIMIT_DATA, &limit) < 0) + return 77; + if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000) + limit.rlim_max = 5000000; + limit.rlim_cur = limit.rlim_max; + if (setrlimit (RLIMIT_DATA, &limit) < 0) + return 77; +#endif + /* On Linux systems, malloc() is limited by RLIMIT_AS. */ +#ifdef RLIMIT_AS + if (getrlimit (RLIMIT_AS, &limit) < 0) + return 77; + if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000) + limit.rlim_max = 5000000; + limit.rlim_cur = limit.rlim_max; + if (setrlimit (RLIMIT_AS, &limit) < 0) + return 77; +#endif + /* Some printf implementations allocate temporary space on the stack. */ +#ifdef RLIMIT_STACK + if (getrlimit (RLIMIT_STACK, &limit) < 0) + return 77; + if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000) + limit.rlim_max = 5000000; + limit.rlim_cur = limit.rlim_max; + if (setrlimit (RLIMIT_STACK, &limit) < 0) + return 77; +#endif + ret = printf ("%.5000000f", 1.0); + return !(ret == 5000002 || (ret < 0 && errno == ENOMEM)); +} -cat >>confdefs.h <<\_ACEOF -#define NDEBUG 1 _ACEOF - -else - { echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s conftest$ac_exeext; then + (./conftest + result=$? + if test $result != 0 && test $result != 77; then result=1; fi + exit $result + ) >/dev/null 2>/dev/null + case $? in + 0) gl_cv_func_printf_enomem="yes" ;; + 77) gl_cv_func_printf_enomem="guessing no" ;; + *) gl_cv_func_printf_enomem="no" ;; + esac + else + gl_cv_func_printf_enomem="guessing no" + fi + rm -fr conftest* + else + case "$host_os" in + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_printf_enomem="guessing yes";; + # Guess yes on Solaris. + solaris*) gl_cv_func_printf_enomem="guessing yes";; + # Guess yes on AIX. + aix*) gl_cv_func_printf_enomem="guessing yes";; + # Guess yes on HP-UX/hppa. + hpux*) case "$host_cpu" in + hppa*) gl_cv_func_printf_enomem="guessing yes";; + *) gl_cv_func_printf_enomem="guessing no";; + esac + ;; + # Guess yes on IRIX. + irix*) gl_cv_func_printf_enomem="guessing yes";; + # Guess yes on OSF/1. + osf*) gl_cv_func_printf_enomem="guessing yes";; + # Guess yes on BeOS. + beos*) gl_cv_func_printf_enomem="guessing yes";; + # If we don't know, assume the worst. + *) gl_cv_func_printf_enomem="guessing no";; + esac + fi fi +{ echo "$as_me:$LINENO: result: $gl_cv_func_printf_enomem" >&5 +echo "${ECHO_T}$gl_cv_func_printf_enomem" >&6; } - -cat >>confdefs.h <<\_ACEOF -#define SIGNAL_SAFE_LIST 1 -_ACEOF - - - M4_LIBOBJS="$M4_LIBOBJS cloexec.$ac_objext" - - - M4_LIBOBJS="$M4_LIBOBJS close-stream.$ac_objext" - - : - - - -cat >>confdefs.h <<\_ACEOF -#define GNULIB_CLOSE_STREAM 1 -_ACEOF - - - - M4_LIBOBJS="$M4_LIBOBJS closein.$ac_objext" - - : + GNULIB_WCWIDTH=0; + HAVE_DECL_WCWIDTH=1; + REPLACE_WCWIDTH=0; + WCHAR_H= - M4_LIBOBJS="$M4_LIBOBJS closeout.$ac_objext" - : - { echo "$as_me:$LINENO: checking for error_at_line" >&5 -echo $ECHO_N "checking for error_at_line... $ECHO_C" >&6; } -if test "${ac_cv_lib_error_at_line+set}" = set; then +{ echo "$as_me:$LINENO: checking whether alarm is declared" >&5 +echo $ECHO_N "checking whether alarm is declared... $ECHO_C" >&6; } +if test "${ac_cv_have_decl_alarm+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -11467,23 +12013,26 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <error.h> +$ac_includes_default int main () { -error_at_line (0, 0, "", 0, "an error occurred"); +#ifndef alarm + (void) alarm; +#endif + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -11492,111 +12041,177 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_lib_error_at_line=yes + } && test -s conftest.$ac_objext; then + ac_cv_have_decl_alarm=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_lib_error_at_line=no + ac_cv_have_decl_alarm=no fi -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_error_at_line" >&5 -echo "${ECHO_T}$ac_cv_lib_error_at_line" >&6; } -if test $ac_cv_lib_error_at_line = no; then - M4_LIBOBJS="$M4_LIBOBJS error.$ac_objext" +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_alarm" >&5 +echo "${ECHO_T}$ac_cv_have_decl_alarm" >&6; } +if test $ac_cv_have_decl_alarm = yes; then +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_ALARM 1 +_ACEOF - : - - +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_ALARM 0 +_ACEOF - M4_LIBOBJS="$M4_LIBOBJS exitfail.$ac_objext" - : +fi + if false; then + GL_COND_LIBTOOL_TRUE= + GL_COND_LIBTOOL_FALSE='#' +else + GL_COND_LIBTOOL_TRUE='#' + GL_COND_LIBTOOL_FALSE= +fi + gl_cond_libtool=false + gl_libdeps= + gl_ltlibdeps= + gl_source_base='lib' + { echo "$as_me:$LINENO: checking for EOVERFLOW" >&5 +echo $ECHO_N "checking for EOVERFLOW... $ECHO_C" >&6; } +if test "${ac_cv_decl_EOVERFLOW+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <errno.h> +#ifdef EOVERFLOW +yes +#endif +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1; then + have_eoverflow=1 +fi +rm -f conftest* + if test -n "$have_eoverflow"; then + ac_cv_decl_EOVERFLOW=yes + else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#define _XOPEN_SOURCE_EXTENDED 1 +#include <errno.h> +#ifdef EOVERFLOW +yes +#endif +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1; then + have_eoverflow=1 +fi +rm -f conftest* -for ac_func in sigaction -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } -if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF + if test -n "$have_eoverflow"; then + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. - For example, HP-UX 11i <limits.h> declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer <limits.h> to <assert.h> if __STDC__ is defined, since - <limits.h> exists even on freestanding compilers. */ -#ifdef __STDC__ -# include <limits.h> -#else -# include <assert.h> -#endif +#define _XOPEN_SOURCE_EXTENDED 1 +#include <errno.h> +/* The following two lines are a workaround against an autoconf-2.52 bug. */ +#include <stdio.h> +#include <stdlib.h> -#undef $ac_func +int +main () +{ +static int test_array [1 - 2 * !((EOVERFLOW) >= 0)]; +test_array [0] = 0 -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$ac_func || defined __stub___$ac_func -choke me -#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#define _XOPEN_SOURCE_EXTENDED 1 +#include <errno.h> +/* The following two lines are a workaround against an autoconf-2.52 bug. */ +#include <stdio.h> +#include <stdlib.h> int main () { -return $ac_func (); +static int test_array [1 - 2 * !((EOVERFLOW) <= $ac_mid)]; +test_array [0] = 0 + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -11605,261 +12220,168 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - eval "$as_ac_var=yes" + } && test -s conftest.$ac_objext; then + ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - eval "$as_ac_var=no" -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -fi -ac_res=`eval echo '${'$as_ac_var'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - + ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` fi -done - - - { echo "$as_me:$LINENO: checking whether fflush works on input streams" >&5 -echo $ECHO_N "checking whether fflush works on input streams... $ECHO_C" >&6; } -if test "${gl_cv_func_fflush_stdin+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - echo hello world > conftest.txt - if test "$cross_compiling" = yes; then - gl_cv_func_fflush_stdin=no +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done else - cat >conftest.$ac_ext <<_ACEOF + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +#define _XOPEN_SOURCE_EXTENDED 1 +#include <errno.h> +/* The following two lines are a workaround against an autoconf-2.52 bug. */ #include <stdio.h> -#include <unistd.h> +#include <stdlib.h> int main () { -FILE *f = fopen ("conftest.txt", "r"); - char buffer[10]; - int fd = fileno (f); - if (!f || 0 > fd || fread (buffer, 1, 5, f) != 5) - return 2; - /* For deterministic results, ensure f read a bigger buffer. */ - if (lseek (fd, 0, SEEK_CUR) == 5) - return 3; - /* POSIX requires fflush-fseek to set file offset of fd. */ - if (fflush (f) != 0 || fseek (f, 0, SEEK_CUR) != 0) - return 4; - return !(lseek (fd, 0, SEEK_CUR) == 5); +static int test_array [1 - 2 * !((EOVERFLOW) < 0)]; +test_array [0] = 0 ; return 0; } _ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#define _XOPEN_SOURCE_EXTENDED 1 +#include <errno.h> +/* The following two lines are a workaround against an autoconf-2.52 bug. */ +#include <stdio.h> +#include <stdlib.h> + +int +main () +{ +static int test_array [1 - 2 * !((EOVERFLOW) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - gl_cv_func_fflush_stdin=yes + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_lo=$ac_mid; break else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -( exit $ac_status ) -gl_cv_func_fflush_stdin=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext + ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 - rm conftest.txt - + ac_lo= ac_hi= fi -{ echo "$as_me:$LINENO: result: $gl_cv_func_fflush_stdin" >&5 -echo "${ECHO_T}$gl_cv_func_fflush_stdin" >&6; } - if test $gl_cv_func_fflush_stdin = no; then - - M4_LIBOBJS="$M4_LIBOBJS fflush.$ac_objext" - M4_LIBOBJS="$M4_LIBOBJS fseeko.$ac_objext" - - REPLACE_FFLUSH=1 - REPLACE_FSEEKO=1 - - fi - - - - GNULIB_FFLUSH=1 - +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi - - FLOAT_H= - case "$host_os" in - beos*) - FLOAT_H=float.h - - - - - - - - - - - if test $gl_cv_have_include_next = yes; then - gl_cv_next_float_h='<'float.h'>' - else - { echo "$as_me:$LINENO: checking absolute name of <float.h>" >&5 -echo $ECHO_N "checking absolute name of <float.h>... $ECHO_C" >&6; } -if test "${gl_cv_next_float_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - if test $ac_cv_header_float_h = yes; then - cat >conftest.$ac_ext <<_ACEOF +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <float.h> +#define _XOPEN_SOURCE_EXTENDED 1 +#include <errno.h> +/* The following two lines are a workaround against an autoconf-2.52 bug. */ +#include <stdio.h> +#include <stdlib.h> + +int +main () +{ +static int test_array [1 - 2 * !((EOVERFLOW) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} _ACEOF - gl_cv_next_float_h='"'`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | - sed -n '\#/float.h#{ - s#.*"\(.*/float.h\)".*#\1# - s#^/[^/]#//&# - p - q - }'`'"' - else - gl_cv_next_float_h='<'float.h'>' - fi - -fi -{ echo "$as_me:$LINENO: result: $gl_cv_next_float_h" >&5 -echo "${ECHO_T}$gl_cv_next_float_h" >&6; } - fi - NEXT_FLOAT_H=$gl_cv_next_float_h - - - - ;; - esac - - - - M4_LIBOBJS="$M4_LIBOBJS fopen-safer.$ac_objext" - - - -cat >>confdefs.h <<\_ACEOF -#define GNULIB_FOPEN_SAFER 1 -_ACEOF - - - - - - - - - - -for ac_func in __fpending -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } -if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. - For example, HP-UX 11i <limits.h> declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer <limits.h> to <assert.h> if __STDC__ is defined, since - <limits.h> exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include <limits.h> -#else -# include <assert.h> -#endif - -#undef $ac_func - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$ac_func || defined __stub___$ac_func -choke me -#endif - -int -main () -{ -return $ac_func (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -11868,42 +12390,21 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - eval "$as_ac_var=yes" + } && test -s conftest.$ac_objext; then + ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - eval "$as_ac_var=no" -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext + ac_lo=`expr '(' $ac_mid ')' + 1` fi -ac_res=`eval echo '${'$as_ac_var'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF -else - M4_LIBOBJS="$M4_LIBOBJS $ac_func.$ac_objext" -fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done - - fp_headers=' -# include <stdio.h> -# if HAVE_STDIO_EXT_H -# include <stdio_ext.h> -# endif -' - { echo "$as_me:$LINENO: checking whether __fpending is declared" >&5 -echo $ECHO_N "checking whether __fpending is declared... $ECHO_C" >&6; } -if test "${ac_cv_have_decl___fpending+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +case $ac_lo in +?*) ac_cv_decl_EOVERFLOW=$ac_lo;; +'') ;; +esac else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -11911,159 +12412,172 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$fp_headers +#define _XOPEN_SOURCE_EXTENDED 1 +#include <errno.h> +/* The following two lines are a workaround against an autoconf-2.52 bug. */ +#include <stdio.h> +#include <stdlib.h> + +static long int longval () { return EOVERFLOW; } +static unsigned long int ulongval () { return EOVERFLOW; } +#include <stdio.h> +#include <stdlib.h> int main () { -#ifndef __fpending - (void) __fpending; -#endif + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + return 1; + if ((EOVERFLOW) < 0) + { + long int i = longval (); + if (i != (EOVERFLOW)) + return 1; + fprintf (f, "%ld\n", i); + } + else + { + unsigned long int i = ulongval (); + if (i != (EOVERFLOW)) + return 1; + fprintf (f, "%lu\n", i); + } + return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 + (eval "$ac_link") 2>&5 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_have_decl___fpending=yes + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_decl_EOVERFLOW=`cat conftest.val` else - echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_have_decl___fpending=no fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.val + else + ac_cv_decl_EOVERFLOW=E2BIG + fi + fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $ac_cv_have_decl___fpending" >&5 -echo "${ECHO_T}$ac_cv_have_decl___fpending" >&6; } -if test $ac_cv_have_decl___fpending = yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_decl_EOVERFLOW" >&5 +echo "${ECHO_T}$ac_cv_decl_EOVERFLOW" >&6; } + if test "$ac_cv_decl_EOVERFLOW" != yes; then cat >>confdefs.h <<_ACEOF -#define HAVE_DECL___FPENDING 1 +#define EOVERFLOW $ac_cv_decl_EOVERFLOW _ACEOF + EOVERFLOW="$ac_cv_decl_EOVERFLOW" -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL___FPENDING 0 -_ACEOF + fi -fi - if test $ac_cv_func___fpending = no; then - { echo "$as_me:$LINENO: checking how to determine the number of pending output bytes on a stream" >&5 -echo $ECHO_N "checking how to determine the number of pending output bytes on a stream... $ECHO_C" >&6; } -if test "${ac_cv_sys_pending_output_n_bytes+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - for ac_expr in \ - \ - '# glibc2' \ - 'fp->_IO_write_ptr - fp->_IO_write_base' \ - \ - '# traditional Unix' \ - 'fp->_ptr - fp->_base' \ - \ - '# BSD' \ - 'fp->_p - fp->_bf._base' \ - \ - '# SCO, Unixware' \ - '(fp->__ptr ? fp->__ptr - fp->__base : 0)' \ - \ - '# old glibc?' \ - 'fp->__bufp - fp->__buffer' \ - \ - '# old glibc iostream?' \ - 'fp->_pptr - fp->_pbase' \ - \ - '# VMS' \ - '(*fp)->_ptr - (*fp)->_base' \ - \ - '# e.g., DGUX R4.11; the info is not available' \ - 1 \ - ; do - # Skip each embedded comment. - case "$ac_expr" in '#'*) continue;; esac + if test $ac_cv_func_alloca_works = no; then + : + fi - cat >conftest.$ac_ext <<_ACEOF + # Define an additional variable used in the Makefile substitution. + if test $ac_cv_working_alloca_h = yes; then + { echo "$as_me:$LINENO: checking for alloca as a compiler built-in" >&5 +echo $ECHO_N "checking for alloca as a compiler built-in... $ECHO_C" >&6; } +if test "${gl_cv_rpl_alloca+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <stdio.h> -int -main () -{ -FILE *fp = stdin; (void) ($ac_expr); - ; - return 0; -} +#if defined __GNUC__ || defined _AIX || defined _MSC_VER + Need own alloca +#endif + _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - fp_done=yes - +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Need own alloca" >/dev/null 2>&1; then + gl_cv_rpl_alloca=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + gl_cv_rpl_alloca=no +fi +rm -f conftest* fi +{ echo "$as_me:$LINENO: result: $gl_cv_rpl_alloca" >&5 +echo "${ECHO_T}$gl_cv_rpl_alloca" >&6; } + if test $gl_cv_rpl_alloca = yes; then -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - test "$fp_done" = yes && break - done +cat >>confdefs.h <<\_ACEOF +#define HAVE_ALLOCA 1 +_ACEOF - ac_cv_sys_pending_output_n_bytes=$ac_expr + ALLOCA_H=alloca.h + else + ALLOCA_H= + fi + else + ALLOCA_H=alloca.h + fi + + + + { echo "$as_me:$LINENO: checking whether to enable assertions" >&5 +echo $ECHO_N "checking whether to enable assertions... $ECHO_C" >&6; } + # Check whether --enable-assert was given. +if test "${enable_assert+set}" = set; then + enableval=$enable_assert; { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define NDEBUG 1 +_ACEOF +else + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } fi -{ echo "$as_me:$LINENO: result: $ac_cv_sys_pending_output_n_bytes" >&5 -echo "${ECHO_T}$ac_cv_sys_pending_output_n_bytes" >&6; } -cat >>confdefs.h <<_ACEOF -#define PENDING_OUTPUT_N_BYTES $ac_cv_sys_pending_output_n_bytes + + +cat >>confdefs.h <<\_ACEOF +#define SIGNAL_SAFE_LIST 1 _ACEOF - fi @@ -12072,15 +12586,70 @@ _ACEOF + M4_LIBOBJS="$M4_LIBOBJS cloexec.$ac_objext" + - { echo "$as_me:$LINENO: checking whether fpurge is declared" >&5 -echo $ECHO_N "checking whether fpurge is declared... $ECHO_C" >&6; } -if test "${ac_cv_have_decl_fpurge+set}" = set; then + + + + M4_LIBOBJS="$M4_LIBOBJS close-stream.$ac_objext" + + + : + + + +cat >>confdefs.h <<\_ACEOF +#define GNULIB_CLOSE_STREAM 1 +_ACEOF + + + + + + + + + + + M4_LIBOBJS="$M4_LIBOBJS closein.$ac_objext" + + + : + + + + + + + + + + M4_LIBOBJS="$M4_LIBOBJS closeout.$ac_objext" + + + : + + + + + + + + + + + + + +{ echo "$as_me:$LINENO: checking for error_at_line" >&5 +echo $ECHO_N "checking for error_at_line... $ECHO_C" >&6; } +if test "${ac_cv_lib_error_at_line+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -12089,27 +12658,23 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <stdio.h> - +#include <error.h> int main () { -#ifndef fpurge - (void) fpurge; -#endif - +error_at_line (0, 0, "", 0, "an error occurred"); ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -12118,36 +12683,51 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_have_decl_fpurge=yes + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_lib_error_at_line=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_have_decl_fpurge=no + ac_cv_lib_error_at_line=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_fpurge" >&5 -echo "${ECHO_T}$ac_cv_have_decl_fpurge" >&6; } -if test $ac_cv_have_decl_fpurge = yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_error_at_line" >&5 +echo "${ECHO_T}$ac_cv_lib_error_at_line" >&6; } +if test $ac_cv_lib_error_at_line = no; then -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_FPURGE 1 -_ACEOF -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_FPURGE 0 -_ACEOF + + + M4_LIBOBJS="$M4_LIBOBJS error.$ac_objext" + fi + : + + + + + + + + + + + + M4_LIBOBJS="$M4_LIBOBJS exitfail.$ac_objext" + + + : @@ -12157,9 +12737,19 @@ fi - { echo "$as_me:$LINENO: checking whether free (NULL) is known to work" >&5 -echo $ECHO_N "checking whether free (NULL) is known to work... $ECHO_C" >&6; } -if test "${gl_cv_func_free+set}" = set; then + + + + + + + +for ac_func in sigaction +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -12168,27 +12758,53 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <unistd.h> +/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + int main () { -#if _POSIX_VERSION < 199009L && \ - (defined unix || defined _unix || defined _unix_ \ - || defined __unix || defined __unix__) - #error "'free (NULL)' is not known to work" - #endif +return $ac_func (); ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -12197,101 +12813,40 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest.$ac_objext; then - gl_cv_func_free=yes + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - gl_cv_func_free=no + eval "$as_ac_var=no" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $gl_cv_func_free" >&5 -echo "${ECHO_T}$gl_cv_func_free" >&6; } +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF - if test $gl_cv_func_free = no; then - M4_LIBOBJS="$M4_LIBOBJS free.$ac_objext" +fi +done -cat >>confdefs.h <<\_ACEOF -#define free rpl_free -_ACEOF - fi - - - - { echo "$as_me:$LINENO: checking whether frexpl() can be used without linking with libm" >&5 -echo $ECHO_N "checking whether frexpl() can be used without linking with libm... $ECHO_C" >&6; } -if test "${gl_cv_func_frexpl_no_libm+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <math.h> - long double x; -int -main () -{ -int e; return frexpl (x, &e) > 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - gl_cv_func_frexpl_no_libm=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - gl_cv_func_frexpl_no_libm=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext - -fi -{ echo "$as_me:$LINENO: result: $gl_cv_func_frexpl_no_libm" >&5 -echo "${ECHO_T}$gl_cv_func_frexpl_no_libm" >&6; } - if test $gl_cv_func_frexpl_no_libm = yes; then - - - { echo "$as_me:$LINENO: checking whether frexpl works" >&5 -echo $ECHO_N "checking whether frexpl works... $ECHO_C" >&6; } -if test "${gl_cv_func_frexpl_works+set}" = set; then + { echo "$as_me:$LINENO: checking whether fflush works on input streams" >&5 +echo $ECHO_N "checking whether fflush works on input streams... $ECHO_C" >&6; } +if test "${gl_cv_func_fflush_stdin+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - - if test "$cross_compiling" = yes; then - case "$host_os" in - aix* | beos* | darwin* | irix* | mingw* | pw*) - gl_cv_func_frexpl_works="guessing no";; - *) gl_cv_func_frexpl_works="guessing yes";; - esac - + echo hello world > conftest.txt + if test "$cross_compiling" = yes; then + gl_cv_func_fflush_stdin=no else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -12300,53 +12855,33 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <math.h> -extern long double frexpl (long double, int *); -int main() +#include <stdio.h> +#include <unistd.h> + +int +main () { - volatile long double x; - /* Test on finite numbers that fails on AIX 5.1. */ - x = 16.0L; - { - int exp = -9999; - frexpl (x, &exp); - if (exp != 5) - return 1; - } - /* Test on finite numbers that fails on MacOS X 10.4, because its frexpl - function returns an invalid (incorrectly normalized) value: it returns - y = { 0x3fe028f5, 0xc28f5c28, 0x3c9eb851, 0xeb851eb8 } - but the correct result is - 0.505L = { 0x3fe028f5, 0xc28f5c29, 0xbc547ae1, 0x47ae1480 } */ - x = 1.01L; - { - int exp = -9999; - long double y = frexpl (x, &exp); - if (!(exp == 1 && y == 0.505L)) - return 1; - } - /* Test on large finite numbers. This fails on BeOS at i = 16322, while - LDBL_MAX_EXP = 16384. - In the loop end test, we test x against Infinity, rather than comparing - i with LDBL_MAX_EXP, because BeOS <float.h> has a wrong LDBL_MAX_EXP. */ - { - int i; - for (i = 1, x = 1.0L; x != x + x; i++, x *= 2.0L) - { - int exp = -9999; - frexpl (x, &exp); - if (exp != i) - return 1; - } - } - /* Test on infinite numbers. */ - x = 1.0L / 0.0L; - { - int exp; - long double y = frexpl (x, &exp); - if (y != x) - return 1; - } +FILE *f = fopen ("conftest.txt", "r"); + char buffer[10]; + int fd; + if (f == NULL) + return 1; + fd = fileno (f); + if (fd < 0 || fread (buffer, 1, 5, f) != 5) + return 2; + /* For deterministic results, ensure f read a bigger buffer. */ + if (lseek (fd, 0, SEEK_CUR) == 5) + return 3; + /* POSIX requires fflush-fseek to set file offset of fd. */ + if (fflush (f) != 0 || fseek (f, 0, SEEK_CUR) != 0) + return 4; + if (lseek (fd, 0, SEEK_CUR) != 5) + return 5; + /* TODO: Verify behaviour of fflush after ungetc, see + <http://lists.gnu.org/archive/html/bug-gnulib/2008-03/msg00131.html>. */ + return 0; + + ; return 0; } _ACEOF @@ -12370,139 +12905,182 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - gl_cv_func_frexpl_works=yes + gl_cv_func_fflush_stdin=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -gl_cv_func_frexpl_works=no +gl_cv_func_fflush_stdin=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi + rm conftest.txt fi -{ echo "$as_me:$LINENO: result: $gl_cv_func_frexpl_works" >&5 -echo "${ECHO_T}$gl_cv_func_frexpl_works" >&6; } +{ echo "$as_me:$LINENO: result: $gl_cv_func_fflush_stdin" >&5 +echo "${ECHO_T}$gl_cv_func_fflush_stdin" >&6; } + if test $gl_cv_func_fflush_stdin = no; then - case "$gl_cv_func_frexpl_works" in - *yes) gl_func_frexpl_no_libm=yes ;; - *) gl_func_frexpl_no_libm=no; REPLACE_FREXPL=1 ;; - esac - else - gl_func_frexpl_no_libm=no - REPLACE_FREXPL=1 - fi - if test $gl_func_frexpl_no_libm = yes; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_FREXPL_IN_LIBC 1 -_ACEOF - { echo "$as_me:$LINENO: checking whether frexpl is declared" >&5 -echo $ECHO_N "checking whether frexpl is declared... $ECHO_C" >&6; } -if test "${ac_cv_have_decl_frexpl+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <math.h> -int -main () -{ -#ifndef frexpl - (void) frexpl; -#endif - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_have_decl_frexpl=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_have_decl_frexpl=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_frexpl" >&5 -echo "${ECHO_T}$ac_cv_have_decl_frexpl" >&6; } -if test $ac_cv_have_decl_frexpl = yes; then - : -else - HAVE_DECL_FREXPL=0 -fi - else - HAVE_DECL_FREXPL=0 - M4_LIBOBJS="$M4_LIBOBJS frexpl.$ac_objext" + M4_LIBOBJS="$M4_LIBOBJS fflush.$ac_objext" + + + + + + + + + M4_LIBOBJS="$M4_LIBOBJS fseeko.$ac_objext" + + + REPLACE_FFLUSH=1 + REPLACE_FSEEKO=1 + fi - GNULIB_FREXPL=1 + GNULIB_FFLUSH=1 + FLOAT_H= + case "$host_os" in + beos* | openbsd*) + FLOAT_H=float.h - { echo "$as_me:$LINENO: checking for fseeko" >&5 -echo $ECHO_N "checking for fseeko... $ECHO_C" >&6; } -if test "${gl_cv_func_fseeko+set}" = set; then + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_float_h='<'float.h'>' + else + { echo "$as_me:$LINENO: checking absolute name of <float.h>" >&5 +echo $ECHO_N "checking absolute name of <float.h>... $ECHO_C" >&6; } +if test "${gl_cv_next_float_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + if test $ac_cv_header_float_h = yes; then + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <stdio.h> +#include <float.h> + +_ACEOF + gl_cv_next_float_h='"'`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | + sed -n '\#/float.h#{ + s#.*"\(.*/float.h\)".*#\1# + s#^/[^/]#//&# + p + q + }'`'"' + else + gl_cv_next_float_h='<'float.h'>' + fi + +fi +{ echo "$as_me:$LINENO: result: $gl_cv_next_float_h" >&5 +echo "${ECHO_T}$gl_cv_next_float_h" >&6; } + fi + NEXT_FLOAT_H=$gl_cv_next_float_h + + + + ;; + esac + + + + + + + + + + + M4_LIBOBJS="$M4_LIBOBJS fopen-safer.$ac_objext" + + + + +cat >>confdefs.h <<\_ACEOF +#define GNULIB_FOPEN_SAFER 1 +_ACEOF + + + + + + + + + + + + + + + + fp_headers=' +# include <stdio.h> +# if HAVE_STDIO_EXT_H +# include <stdio_ext.h> +# endif +' + { echo "$as_me:$LINENO: checking whether __fpending is declared" >&5 +echo $ECHO_N "checking whether __fpending is declared... $ECHO_C" >&6; } +if test "${ac_cv_have_decl___fpending+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$fp_headers + int main () { -fseeko (stdin, 0, 0); +#ifndef __fpending + (void) __fpending; +#endif + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -12511,74 +13089,99 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - gl_cv_func_fseeko=yes + } && test -s conftest.$ac_objext; then + ac_cv_have_decl___fpending=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - gl_cv_func_fseeko=no + ac_cv_have_decl___fpending=no fi -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext - +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $gl_cv_func_fseeko" >&5 -echo "${ECHO_T}$gl_cv_func_fseeko" >&6; } - if test $gl_cv_func_fseeko = no; then - HAVE_FSEEKO=0 - - M4_LIBOBJS="$M4_LIBOBJS fseeko.$ac_objext" - - REPLACE_FSEEKO=1 - - elif test $gl_cv_var_stdin_large_offset = no; then - - M4_LIBOBJS="$M4_LIBOBJS fseeko.$ac_objext" - - REPLACE_FSEEKO=1 - - fi - +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl___fpending" >&5 +echo "${ECHO_T}$ac_cv_have_decl___fpending" >&6; } +if test $ac_cv_have_decl___fpending = yes; then +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL___FPENDING 1 +_ACEOF - GNULIB_FSEEKO=1 +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL___FPENDING 0 +_ACEOF +fi - { echo "$as_me:$LINENO: checking for ftello" >&5 -echo $ECHO_N "checking for ftello... $ECHO_C" >&6; } -if test "${gl_cv_func_ftello+set}" = set; then + if test $ac_cv_func___fpending = no; then + { echo "$as_me:$LINENO: checking how to determine the number of pending output bytes on a stream" >&5 +echo $ECHO_N "checking how to determine the number of pending output bytes on a stream... $ECHO_C" >&6; } +if test "${ac_cv_sys_pending_output_n_bytes+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + for ac_expr in \ + \ + '# glibc2' \ + 'fp->_IO_write_ptr - fp->_IO_write_base' \ + \ + '# traditional Unix' \ + 'fp->_ptr - fp->_base' \ + \ + '# BSD' \ + 'fp->_p - fp->_bf._base' \ + \ + '# SCO, Unixware' \ + '(fp->__ptr ? fp->__ptr - fp->__base : 0)' \ + \ + '# QNX' \ + '(fp->_Mode & 0x2000 /*_MWRITE*/ ? fp->_Next - fp->_Buf : 0)' \ + \ + '# old glibc?' \ + 'fp->__bufp - fp->__buffer' \ + \ + '# old glibc iostream?' \ + 'fp->_pptr - fp->_pbase' \ + \ + '# VMS' \ + '(*fp)->_ptr - (*fp)->_base' \ + \ + '# e.g., DGUX R4.11; the info is not available' \ + 1 \ + ; do + + # Skip each embedded comment. + case "$ac_expr" in '#'*) continue;; esac + + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <stdio.h> + int main () { -ftello (stdin); +FILE *fp = stdin; (void) ($ac_expr); ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -12587,52 +13190,29 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - gl_cv_func_ftello=yes + } && test -s conftest.$ac_objext; then + fp_done=yes + else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - gl_cv_func_ftello=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $gl_cv_func_ftello" >&5 -echo "${ECHO_T}$gl_cv_func_ftello" >&6; } - if test $gl_cv_func_ftello = no; then - HAVE_FTELLO=0 - - M4_LIBOBJS="$M4_LIBOBJS ftello.$ac_objext" - - REPLACE_FTELLO=1 - - elif test $gl_cv_var_stdin_large_offset = no; then - - M4_LIBOBJS="$M4_LIBOBJS ftello.$ac_objext" - - REPLACE_FTELLO=1 - - fi - - - - GNULIB_FTELLO=1 - +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test "$fp_done" = yes && break + done - if test -n "$GETOPT_H"; then + ac_cv_sys_pending_output_n_bytes=$ac_expr - M4_LIBOBJS="$M4_LIBOBJS getopt.$ac_objext" - M4_LIBOBJS="$M4_LIBOBJS getopt1.$ac_objext" - GETOPT_H=getopt.h +fi +{ echo "$as_me:$LINENO: result: $ac_cv_sys_pending_output_n_bytes" >&5 +echo "${ECHO_T}$ac_cv_sys_pending_output_n_bytes" >&6; } -cat >>confdefs.h <<\_ACEOF -#define __GETOPT_PREFIX rpl_ +cat >>confdefs.h <<_ACEOF +#define PENDING_OUTPUT_N_BYTES $ac_cv_sys_pending_output_n_bytes _ACEOF @@ -12642,9 +13222,9 @@ _ACEOF + M4_LIBOBJS="$M4_LIBOBJS fpending.$ac_objext" - -fi + fi @@ -12659,9 +13239,9 @@ fi - { echo "$as_me:$LINENO: checking for gettimeofday with POSIX signature" >&5 -echo $ECHO_N "checking for gettimeofday with POSIX signature... $ECHO_C" >&6; } -if test "${gl_cv_func_gettimeofday_posix_signature+set}" = set; then + { echo "$as_me:$LINENO: checking whether fpurge is declared" >&5 +echo $ECHO_N "checking whether fpurge is declared... $ECHO_C" >&6; } +if test "${ac_cv_have_decl_fpurge+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -12670,16 +13250,14 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <sys/time.h> - struct timeval c; +#include <stdio.h> int main () { - - int (*f) (struct timeval *restrict, void *restrict) = gettimeofday; - int x = f (&c, 0); - return !(x | c.tv_sec | c.tv_usec); +#ifndef fpurge + (void) fpurge; +#endif ; return 0; @@ -12702,58 +13280,151 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - gl_cv_func_gettimeofday_posix_signature=yes + ac_cv_have_decl_fpurge=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - gl_cv_func_gettimeofday_posix_signature=no + ac_cv_have_decl_fpurge=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $gl_cv_func_gettimeofday_posix_signature" >&5 -echo "${ECHO_T}$gl_cv_func_gettimeofday_posix_signature" >&6; } - +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_fpurge" >&5 +echo "${ECHO_T}$ac_cv_have_decl_fpurge" >&6; } +if test $ac_cv_have_decl_fpurge = yes; then +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FPURGE 1 +_ACEOF - { echo "$as_me:$LINENO: checking whether gettimeofday clobbers localtime buffer" >&5 -echo $ECHO_N "checking whether gettimeofday clobbers localtime buffer... $ECHO_C" >&6; } -if test "${gl_cv_func_gettimeofday_clobber+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test "$cross_compiling" = yes; then - gl_cv_func_gettimeofday_clobber=yes -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FPURGE 0 _ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <string.h> - #include <sys/time.h> - #include <time.h> - #include <stdlib.h> -int -main () -{ - time_t t = 0; - struct tm *lt; - struct tm saved_lt; - struct timeval tv; - lt = localtime (&t); - saved_lt = *lt; - gettimeofday (&tv, NULL); - return memcmp (lt, &saved_lt, sizeof (struct tm)) != 0; +fi + + + + + + + + + + + + + { echo "$as_me:$LINENO: checking whether frexp() can be used without linking with libm" >&5 +echo $ECHO_N "checking whether frexp() can be used without linking with libm... $ECHO_C" >&6; } +if test "${gl_cv_func_frexp_no_libm+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <math.h> + double x; +int +main () +{ +int e; return frexp (x, &e) > 0; ; return 0; } _ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + gl_cv_func_frexp_no_libm=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gl_cv_func_frexp_no_libm=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + +fi +{ echo "$as_me:$LINENO: result: $gl_cv_func_frexp_no_libm" >&5 +echo "${ECHO_T}$gl_cv_func_frexp_no_libm" >&6; } + if test $gl_cv_func_frexp_no_libm = yes; then + + + { echo "$as_me:$LINENO: checking whether frexp works" >&5 +echo $ECHO_N "checking whether frexp works... $ECHO_C" >&6; } +if test "${gl_cv_func_frexp_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + if test "$cross_compiling" = yes; then + case "$host_os" in + netbsd* | irix* | mingw*) gl_cv_func_frexp_works="guessing no";; + *) gl_cv_func_frexp_works="guessing yes";; + esac + +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include <float.h> +#include <math.h> +int main() +{ + int i; + volatile double x; + /* Test on denormalized numbers. */ + for (i = 1, x = 1.0; i >= DBL_MIN_EXP; i--, x *= 0.5) + ; + if (x > 0.0) + { + int exp; + double y = frexp (x, &exp); + /* On machines with IEEE754 arithmetic: x = 1.11254e-308, exp = -1022. + On NetBSD: y = 0.75. Correct: y = 0.5. */ + if (y != 0.5) + return 1; + } + /* Test on infinite numbers. */ + x = 1.0 / 0.0; + { + int exp; + double y = frexp (x, &exp); + if (y != x) + return 1; + } + return 0; +} +_ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in @@ -12774,63 +13445,86 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - gl_cv_func_gettimeofday_clobber=no + gl_cv_func_frexp_works=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -gl_cv_func_gettimeofday_clobber=yes +gl_cv_func_frexp_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi + fi -{ echo "$as_me:$LINENO: result: $gl_cv_func_gettimeofday_clobber" >&5 -echo "${ECHO_T}$gl_cv_func_gettimeofday_clobber" >&6; } +{ echo "$as_me:$LINENO: result: $gl_cv_func_frexp_works" >&5 +echo "${ECHO_T}$gl_cv_func_frexp_works" >&6; } - if test $gl_cv_func_gettimeofday_clobber = yes; then - REPLACE_GETTIMEOFDAY=1 - SYS_TIME_H=sys/time.h + case "$gl_cv_func_frexp_works" in + *yes) gl_func_frexp_no_libm=yes ;; + *) gl_func_frexp_no_libm=no; REPLACE_FREXP=1 ;; + esac + else + gl_func_frexp_no_libm=no + REPLACE_FREXP=1 + fi + if test $gl_func_frexp_no_libm = yes; then - M4_LIBOBJS="$M4_LIBOBJS gettimeofday.$ac_objext" +cat >>confdefs.h <<\_ACEOF +#define HAVE_FREXP_IN_LIBC 1 +_ACEOF + + else -for ac_header in sys/timeb.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - { echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + + + + + + M4_LIBOBJS="$M4_LIBOBJS frexp.$ac_objext" + + fi + + + + GNULIB_FREXP=1 + + + + { echo "$as_me:$LINENO: checking whether frexpl() can be used without linking with libm" >&5 +echo $ECHO_N "checking whether frexpl() can be used without linking with libm... $ECHO_C" >&6; } +if test "${gl_cv_func_frexpl_no_libm+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } else - # Is the header compilable? -{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF + + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> +#include <math.h> + long double x; +int +main () +{ +int e; return frexpl (x, &e) > 0; + ; + return 0; +} _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -12839,116 +13533,172 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + gl_cv_func_frexpl_no_libm=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_header_compiler=no + gl_cv_func_frexpl_no_libm=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext -# Is the header present? -{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF +fi +{ echo "$as_me:$LINENO: result: $gl_cv_func_frexpl_no_libm" >&5 +echo "${ECHO_T}$gl_cv_func_frexpl_no_libm" >&6; } + if test $gl_cv_func_frexpl_no_libm = yes; then + + + { echo "$as_me:$LINENO: checking whether frexpl works" >&5 +echo $ECHO_N "checking whether frexpl works... $ECHO_C" >&6; } +if test "${gl_cv_func_frexpl_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + if test "$cross_compiling" = yes; then + case "$host_os" in + aix* | beos* | darwin* | irix* | mingw* | pw*) + gl_cv_func_frexpl_works="guessing no";; + *) gl_cv_func_frexpl_works="guessing yes";; + esac + +else + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi - -rm -f conftest.err conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6; } -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( cat <<\_ASBOX -## ----------------------------- ## -## Report this to bug-m4@gnu.org ## -## ----------------------------- ## -_ASBOX - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; +#include <float.h> +#include <math.h> +/* Override the values of <float.h>, like done in float.in.h. */ +#if defined __i386__ && (defined __BEOS__ || defined __OpenBSD__) +# undef LDBL_MIN_EXP +# define LDBL_MIN_EXP (-16381) +#endif +extern long double frexpl (long double, int *); +int main() +{ + volatile long double x; + /* Test on finite numbers that fails on AIX 5.1. */ + x = 16.0L; + { + int exp = -9999; + frexpl (x, &exp); + if (exp != 5) + return 1; + } + /* Test on finite numbers that fails on MacOS X 10.4, because its frexpl + function returns an invalid (incorrectly normalized) value: it returns + y = { 0x3fe028f5, 0xc28f5c28, 0x3c9eb851, 0xeb851eb8 } + but the correct result is + 0.505L = { 0x3fe028f5, 0xc28f5c29, 0xbc547ae1, 0x47ae1480 } */ + x = 1.01L; + { + int exp = -9999; + long double y = frexpl (x, &exp); + if (!(exp == 1 && y == 0.505L)) + return 1; + } + /* Test on large finite numbers. This fails on BeOS at i = 16322, while + LDBL_MAX_EXP = 16384. + In the loop end test, we test x against Infinity, rather than comparing + i with LDBL_MAX_EXP, because BeOS <float.h> has a wrong LDBL_MAX_EXP. */ + { + int i; + for (i = 1, x = 1.0L; x != x + x; i++, x *= 2.0L) + { + int exp = -9999; + frexpl (x, &exp); + if (exp != i) + return 1; + } + } + /* Test on denormalized numbers. */ + { + int i; + for (i = 1, x = 1.0L; i >= LDBL_MIN_EXP; i--, x *= 0.5L) + ; + if (x > 0.0L) + { + int exp; + long double y = frexpl (x, &exp); + /* On machines with IEEE854 arithmetic: x = 1.68105e-4932, + exp = -16382, y = 0.5. On MacOS X 10.5: exp = -16384, y = 0.5. */ + if (exp != LDBL_MIN_EXP - 1) + return 1; + } + } + /* Test on infinite numbers. */ + x = 1.0L / 0.0L; + { + int exp; + long double y = frexpl (x, &exp); + if (y != x) + return 1; + } + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; esac -{ echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gl_cv_func_frexpl_works=yes else - eval "$as_ac_Header=\$ac_header_preproc" -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +( exit $ac_status ) +gl_cv_func_frexpl_works=no fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + fi +{ echo "$as_me:$LINENO: result: $gl_cv_func_frexpl_works" >&5 +echo "${ECHO_T}$gl_cv_func_frexpl_works" >&6; } -done + case "$gl_cv_func_frexpl_works" in + *yes) gl_func_frexpl_no_libm=yes ;; + *) gl_func_frexpl_no_libm=no; REPLACE_FREXPL=1 ;; + esac + else + gl_func_frexpl_no_libm=no + REPLACE_FREXPL=1 + fi + if test $gl_func_frexpl_no_libm = yes; then +cat >>confdefs.h <<\_ACEOF +#define HAVE_FREXPL_IN_LIBC 1 +_ACEOF -for ac_func in _ftime -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } -if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking whether frexpl is declared" >&5 +echo $ECHO_N "checking whether frexpl is declared... $ECHO_C" >&6; } +if test "${ac_cv_have_decl_frexpl+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -12957,53 +13707,27 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. - For example, HP-UX 11i <limits.h> declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer <limits.h> to <assert.h> if __STDC__ is defined, since - <limits.h> exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include <limits.h> -#else -# include <assert.h> -#endif - -#undef $ac_func - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$ac_func || defined __stub___$ac_func -choke me -#endif +#include <math.h> int main () { -return $ac_func (); +#ifndef frexpl + (void) frexpl; +#endif + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -13012,90 +13736,78 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - eval "$as_ac_var=yes" + } && test -s conftest.$ac_objext; then + ac_cv_have_decl_frexpl=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - eval "$as_ac_var=no" + ac_cv_have_decl_frexpl=no fi -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -ac_res=`eval echo '${'$as_ac_var'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_frexpl" >&5 +echo "${ECHO_T}$ac_cv_have_decl_frexpl" >&6; } +if test $ac_cv_have_decl_frexpl = yes; then + : +else + HAVE_DECL_FREXPL=0 fi -done + else + HAVE_DECL_FREXPL=0 -cat >>confdefs.h <<\_ACEOF -#define gmtime rpl_gmtime -_ACEOF -cat >>confdefs.h <<\_ACEOF -#define localtime rpl_localtime -_ACEOF -cat >>confdefs.h <<\_ACEOF -#define GETTIMEOFDAY_CLOBBERS_LOCALTIME 1 -_ACEOF + M4_LIBOBJS="$M4_LIBOBJS frexpl.$ac_objext" - fi + fi - if test $gl_cv_func_gettimeofday_posix_signature != yes; then - REPLACE_GETTIMEOFDAY=1 - SYS_TIME_H=sys/time.h - if test $gl_cv_func_gettimeofday_clobber != yes; then - M4_LIBOBJS="$M4_LIBOBJS gettimeofday.$ac_objext" + GNULIB_FREXPL=1 -for ac_header in sys/timeb.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - { echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + + + + + + + + { echo "$as_me:$LINENO: checking for fseeko" >&5 +echo $ECHO_N "checking for fseeko... $ECHO_C" >&6; } +if test "${gl_cv_func_fseeko+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } else - # Is the header compilable? -{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF + + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> +#include <stdio.h> +int +main () +{ +fseeko (stdin, 0, 0); + ; + return 0; +} _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -13104,159 +13816,81 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + gl_cv_func_fseeko=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_header_compiler=no + gl_cv_func_fseeko=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6; } - -# Is the header present? -{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext - ac_header_preproc=no fi +{ echo "$as_me:$LINENO: result: $gl_cv_func_fseeko" >&5 +echo "${ECHO_T}$gl_cv_func_fseeko" >&6; } + if test $gl_cv_func_fseeko = no; then + HAVE_FSEEKO=0 -rm -f conftest.err conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6; } -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( cat <<\_ASBOX -## ----------------------------- ## -## Report this to bug-m4@gnu.org ## -## ----------------------------- ## -_ASBOX - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -{ echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF -fi -done -for ac_func in _ftime -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } -if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + + M4_LIBOBJS="$M4_LIBOBJS fseeko.$ac_objext" + + + REPLACE_FSEEKO=1 + + elif test $gl_cv_var_stdin_large_offset = no; then + + + + + + + + + M4_LIBOBJS="$M4_LIBOBJS fseeko.$ac_objext" + + + REPLACE_FSEEKO=1 + + fi + + + + GNULIB_FSEEKO=1 + + + + + + + + + { echo "$as_me:$LINENO: checking for ftello" >&5 +echo $ECHO_N "checking for ftello... $ECHO_C" >&6; } +if test "${gl_cv_func_ftello+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. - For example, HP-UX 11i <limits.h> declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer <limits.h> to <assert.h> if __STDC__ is defined, since - <limits.h> exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include <limits.h> -#else -# include <assert.h> -#endif - -#undef $ac_func - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$ac_func || defined __stub___$ac_func -choke me -#endif - +#include <stdio.h> int main () { -return $ac_func (); +ftello (stdin); ; return 0; } @@ -13279,246 +13913,129 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then - eval "$as_ac_var=yes" + gl_cv_func_ftello=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - eval "$as_ac_var=no" + gl_cv_func_ftello=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext -fi -ac_res=`eval echo '${'$as_ac_var'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF fi -done +{ echo "$as_me:$LINENO: result: $gl_cv_func_ftello" >&5 +echo "${ECHO_T}$gl_cv_func_ftello" >&6; } + if test $gl_cv_func_ftello = no; then + HAVE_FTELLO=0 - fi - fi - { echo "$as_me:$LINENO: checking whether the compiler generally respects inline" >&5 -echo $ECHO_N "checking whether the compiler generally respects inline... $ECHO_C" >&6; } -if test "${gl_cv_c_inline_effective+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test $ac_cv_c_inline = no; then - gl_cv_c_inline_effective=no - else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -int -main () -{ -#ifdef __NO_INLINE__ - #error "inline is not effective" - #endif - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - gl_cv_c_inline_effective=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - gl_cv_c_inline_effective=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi + M4_LIBOBJS="$M4_LIBOBJS ftello.$ac_objext" -fi -{ echo "$as_me:$LINENO: result: $gl_cv_c_inline_effective" >&5 -echo "${ECHO_T}$gl_cv_c_inline_effective" >&6; } - if test $gl_cv_c_inline_effective = yes; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_INLINE 1 -_ACEOF + REPLACE_FTELLO=1 + + elif test $gl_cv_var_stdin_large_offset = no; then + + + + + + + + + M4_LIBOBJS="$M4_LIBOBJS ftello.$ac_objext" + + + REPLACE_FTELLO=1 fi - { echo "$as_me:$LINENO: checking whether isnan(double) can be used without linking with libm" >&5 -echo $ECHO_N "checking whether isnan(double) can be used without linking with libm... $ECHO_C" >&6; } -if test "${gl_cv_func_isnan_no_libm+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <math.h> - double x; -int -main () -{ -return isnan (x); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - gl_cv_func_isnan_no_libm=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + GNULIB_FTELLO=1 + + + + if test -n "$GETOPT_H"; then + + + + + + + + + M4_LIBOBJS="$M4_LIBOBJS getopt.$ac_objext" + + - gl_cv_func_isnan_no_libm=no -fi -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $gl_cv_func_isnan_no_libm" >&5 -echo "${ECHO_T}$gl_cv_func_isnan_no_libm" >&6; } - if test $gl_cv_func_isnan_no_libm = yes; then + + + + M4_LIBOBJS="$M4_LIBOBJS getopt1.$ac_objext" + + + GETOPT_H=getopt.h cat >>confdefs.h <<\_ACEOF -#define HAVE_ISNAN_IN_LIBC 1 +#define __GETOPT_PREFIX rpl_ _ACEOF - else - M4_LIBOBJS="$M4_LIBOBJS isnan.$ac_objext" - { echo "$as_me:$LINENO: checking where to find the exponent in a 'double'" >&5 -echo $ECHO_N "checking where to find the exponent in a 'double'... $ECHO_C" >&6; } -if test "${gl_cv_cc_double_expbit0+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#if defined arm || defined __arm || defined __arm__ - mixed_endianness -#endif -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "mixed_endianness" >/dev/null 2>&1; then - gl_cv_cc_double_expbit0="unknown" -else - : -if test "${ac_cv_c_bigendian+set}" = set; then + + + +fi + + + + + + + + + + + + + + + { echo "$as_me:$LINENO: checking for gettimeofday with POSIX signature" >&5 +echo $ECHO_N "checking for gettimeofday with POSIX signature... $ECHO_C" >&6; } +if test "${gl_cv_func_gettimeofday_posix_signature+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - # See if sys/param.h defines the BYTE_ORDER macro. -cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <sys/types.h> -#include <sys/param.h> +#include <sys/time.h> + struct timeval c; int main () { -#if ! (defined BYTE_ORDER && defined BIG_ENDIAN && defined LITTLE_ENDIAN \ - && BYTE_ORDER && BIG_ENDIAN && LITTLE_ENDIAN) - bogus endian macros -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - # It does; now see whether it defined to BIG_ENDIAN or not. -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <sys/types.h> -#include <sys/param.h> -int -main () -{ -#if BYTE_ORDER != BIG_ENDIAN - not big endian -#endif + int (*f) (struct timeval *restrict, void *restrict) = gettimeofday; + int x = f (&c, 0); + return !(x | c.tv_sec | c.tv_usec); ; return 0; @@ -13541,112 +14058,66 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_cv_c_bigendian=yes + gl_cv_func_gettimeofday_posix_signature=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_c_bigendian=no + gl_cv_func_gettimeofday_posix_signature=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +fi +{ echo "$as_me:$LINENO: result: $gl_cv_func_gettimeofday_posix_signature" >&5 +echo "${ECHO_T}$gl_cv_func_gettimeofday_posix_signature" >&6; } - # It does not; compile a test program. -if test "$cross_compiling" = yes; then - # try to guess the endianness by grepping values into an object file - ac_cv_c_bigendian=unknown + + + + { echo "$as_me:$LINENO: checking whether gettimeofday clobbers localtime buffer" >&5 +echo $ECHO_N "checking whether gettimeofday clobbers localtime buffer... $ECHO_C" >&6; } +if test "${gl_cv_func_gettimeofday_clobber+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + gl_cv_func_gettimeofday_clobber=yes +else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; -short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; -void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } -short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; -short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; -void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } +#include <string.h> + #include <sys/time.h> + #include <time.h> + #include <stdlib.h> + int main () { - _ascii (); _ebcdic (); + + time_t t = 0; + struct tm *lt; + struct tm saved_lt; + struct timeval tv; + lt = localtime (&t); + saved_lt = *lt; + gettimeofday (&tv, NULL); + return memcmp (lt, &saved_lt, sizeof (struct tm)) != 0; + ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then - ac_cv_c_bigendian=yes -fi -if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then - if test "$ac_cv_c_bigendian" = unknown; then - ac_cv_c_bigendian=no - else - # finding both strings is unlikely to happen, but who knows? - ac_cv_c_bigendian=unknown - fi -fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ - - /* Are we little or big endian? From Harbison&Steele. */ - union - { - long int l; - char c[sizeof (long int)]; - } u; - u.l = 1; - return u.c[sizeof (long int) - 1] == 1; - - ; - return 0; -} -_ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 + (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' @@ -13659,265 +14130,244 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_c_bigendian=no + gl_cv_func_gettimeofday_clobber=no else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -ac_cv_c_bigendian=yes +gl_cv_func_gettimeofday_clobber=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi +{ echo "$as_me:$LINENO: result: $gl_cv_func_gettimeofday_clobber" >&5 +echo "${ECHO_T}$gl_cv_func_gettimeofday_clobber" >&6; } + + if test $gl_cv_func_gettimeofday_clobber = yes; then + REPLACE_GETTIMEOFDAY=1 + SYS_TIME_H=sys/time.h -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -: -case $ac_cv_c_bigendian in - yes) - gl_cv_cc_double_expbit0="word 0 bit 20" ;; - no) - gl_cv_cc_double_expbit0="word 1 bit 20" ;; - *) - gl_cv_cc_double_expbit0="unknown" ;; -esac -fi -rm -f conftest* + + + + M4_LIBOBJS="$M4_LIBOBJS gettimeofday.$ac_objext" + + + +for ac_header in sys/timeb.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } else - cat >conftest.$ac_ext <<_ACEOF + # Is the header compilable? +{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - -#include <float.h> -#include <stddef.h> -#include <stdio.h> -#include <string.h> -#define NWORDS \ - ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) -typedef union { double value; unsigned int word[NWORDS]; } memory_double; -static unsigned int ored_words[NWORDS]; -static unsigned int anded_words[NWORDS]; -static void add_to_ored_words (double x) -{ - memory_double m; - size_t i; - /* Clear it first, in case sizeof (double) < sizeof (memory_double). */ - memset (&m, 0, sizeof (memory_double)); - m.value = x; - for (i = 0; i < NWORDS; i++) - { - ored_words[i] |= m.word[i]; - anded_words[i] &= m.word[i]; - } -} -int main () -{ - size_t j; - FILE *fp = fopen ("conftest.out", "w"); - if (fp == NULL) - return 1; - for (j = 0; j < NWORDS; j++) - anded_words[j] = ~ (unsigned int) 0; - add_to_ored_words (0.25); - add_to_ored_words (0.5); - add_to_ored_words (1.0); - add_to_ored_words (2.0); - add_to_ored_words (4.0); - /* Remove bits that are common (e.g. if representation of the first mantissa - bit is explicit). */ - for (j = 0; j < NWORDS; j++) - ored_words[j] &= ~anded_words[j]; - /* Now find the nonzero word. */ - for (j = 0; j < NWORDS; j++) - if (ored_words[j] != 0) - break; - if (j < NWORDS) - { - size_t i; - for (i = j + 1; i < NWORDS; i++) - if (ored_words[i] != 0) - { - fprintf (fp, "unknown"); - return (fclose (fp) != 0); - } - for (i = 0; ; i++) - if ((ored_words[j] >> i) & 1) - { - fprintf (fp, "word %d bit %d", (int) j, (int) i); - return (fclose (fp) != 0); - } - } - fprintf (fp, "unknown"); - return (fclose (fp) != 0); -} - +$ac_includes_default +#include <$ac_header> _ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - gl_cv_cc_double_expbit0=`cat conftest.out` + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -( exit $ac_status ) -gl_cv_cc_double_expbit0="unknown" -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - - - rm -f conftest.out - + ac_header_compiler=no fi -{ echo "$as_me:$LINENO: result: $gl_cv_cc_double_expbit0" >&5 -echo "${ECHO_T}$gl_cv_cc_double_expbit0" >&6; } - case "$gl_cv_cc_double_expbit0" in - word*bit*) - word=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word //' -e 's/ bit.*//'` - bit=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word.*bit //'` - -cat >>confdefs.h <<_ACEOF -#define DBL_EXPBIT0_WORD $word -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define DBL_EXPBIT0_BIT $bit -_ACEOF - - ;; - esac - - fi - - - { echo "$as_me:$LINENO: checking where to find the exponent in a 'double'" >&5 -echo $ECHO_N "checking where to find the exponent in a 'double'... $ECHO_C" >&6; } -if test "${gl_cv_cc_double_expbit0+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } - cat >conftest.$ac_ext <<_ACEOF +# Is the header present? +{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - -#if defined arm || defined __arm || defined __arm__ - mixed_endianness -#endif - +#include <$ac_header> _ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "mixed_endianness" >/dev/null 2>&1; then - gl_cv_cc_double_expbit0="unknown" -else - - : -if test "${ac_cv_c_bigendian+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # See if sys/param.h defines the BYTE_ORDER macro. -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <sys/types.h> -#include <sys/param.h> - -int -main () -{ -#if ! (defined BYTE_ORDER && defined BIG_ENDIAN && defined LITTLE_ENDIAN \ - && BYTE_ORDER && BIG_ENDIAN && LITTLE_ENDIAN) - bogus endian macros -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" +if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest.$ac_objext; then - # It does; now see whether it defined to BIG_ENDIAN or not. -cat >conftest.$ac_ext <<_ACEOF + }; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## ----------------------------- ## +## Report this to bug-m4@gnu.org ## +## ----------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_func in _ftime +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <sys/types.h> -#include <sys/param.h> +/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif int main () { -#if BYTE_ORDER != BIG_ENDIAN - not big endian -#endif - +return $ac_func (); ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -13926,43 +14376,89 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_c_bigendian=yes + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_c_bigendian=no + eval "$as_ac_var=no" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF - # It does not; compile a test program. -if test "$cross_compiling" = yes; then - # try to guess the endianness by grepping values into an object file - ac_cv_c_bigendian=unknown - cat >conftest.$ac_ext <<_ACEOF +fi +done + + + +cat >>confdefs.h <<\_ACEOF +#define gmtime rpl_gmtime +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define localtime rpl_localtime +_ACEOF + + + +cat >>confdefs.h <<\_ACEOF +#define GETTIMEOFDAY_CLOBBERS_LOCALTIME 1 +_ACEOF + + fi + + + if test $gl_cv_func_gettimeofday_posix_signature != yes; then + REPLACE_GETTIMEOFDAY=1 + SYS_TIME_H=sys/time.h + if test $gl_cv_func_gettimeofday_clobber != yes; then + + + + + + + + M4_LIBOBJS="$M4_LIBOBJS gettimeofday.$ac_objext" + + + +for ac_header in sys/timeb.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; -short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; -void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } -short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; -short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; -void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } -int -main () -{ - _ascii (); _ebcdic (); - ; - return 0; -} +$ac_includes_default +#include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" @@ -13981,102 +14477,116 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then - ac_cv_c_bigendian=yes -fi -if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then - if test "$ac_cv_c_bigendian" = unknown; then - ac_cv_c_bigendian=no - else - # finding both strings is unlikely to happen, but who knows? - ac_cv_c_bigendian=unknown - fi -fi + ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - + ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -else - cat >conftest.$ac_ext <<_ACEOF +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } + +# Is the header present? +{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default -int -main () -{ - - /* Are we little or big endian? From Harbison&Steele. */ - union - { - long int l; - char c[sizeof (long int)]; - } u; - u.l = 1; - return u.c[sizeof (long int) - 1] == 1; - - ; - return 0; -} +#include <$ac_header> _ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" +if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_c_bigendian=no + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -( exit $ac_status ) -ac_cv_c_bigendian=yes -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext + ac_header_preproc=no fi +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## ----------------------------- ## +## Report this to bug-m4@gnu.org ## +## ----------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -: -case $ac_cv_c_bigendian in - yes) - gl_cv_cc_double_expbit0="word 0 bit 20" ;; - no) - gl_cv_cc_double_expbit0="word 1 bit 20" ;; - *) - gl_cv_cc_double_expbit0="unknown" ;; -esac - +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF fi -rm -f conftest* + +done +for ac_func in _ftime +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -14084,131 +14594,166 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define $ac_func innocuous_$ac_func -#include <float.h> -#include <stddef.h> -#include <stdio.h> -#include <string.h> -#define NWORDS \ - ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) -typedef union { double value; unsigned int word[NWORDS]; } memory_double; -static unsigned int ored_words[NWORDS]; -static unsigned int anded_words[NWORDS]; -static void add_to_ored_words (double x) -{ - memory_double m; - size_t i; - /* Clear it first, in case sizeof (double) < sizeof (memory_double). */ - memset (&m, 0, sizeof (memory_double)); - m.value = x; - for (i = 0; i < NWORDS; i++) - { - ored_words[i] |= m.word[i]; - anded_words[i] &= m.word[i]; - } -} -int main () +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () { - size_t j; - FILE *fp = fopen ("conftest.out", "w"); - if (fp == NULL) - return 1; - for (j = 0; j < NWORDS; j++) - anded_words[j] = ~ (unsigned int) 0; - add_to_ored_words (0.25); - add_to_ored_words (0.5); - add_to_ored_words (1.0); - add_to_ored_words (2.0); - add_to_ored_words (4.0); - /* Remove bits that are common (e.g. if representation of the first mantissa - bit is explicit). */ - for (j = 0; j < NWORDS; j++) - ored_words[j] &= ~anded_words[j]; - /* Now find the nonzero word. */ - for (j = 0; j < NWORDS; j++) - if (ored_words[j] != 0) - break; - if (j < NWORDS) - { - size_t i; - for (i = j + 1; i < NWORDS; i++) - if (ored_words[i] != 0) - { - fprintf (fp, "unknown"); - return (fclose (fp) != 0); - } - for (i = 0; ; i++) - if ((ored_words[j] >> i) & 1) - { - fprintf (fp, "word %d bit %d", (int) j, (int) i); - return (fclose (fp) != 0); - } - } - fprintf (fp, "unknown"); - return (fclose (fp) != 0); +return $ac_func (); + ; + return 0; } - _ACEOF -rm -f conftest$ac_exeext +rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 + (eval "$ac_link") 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - gl_cv_cc_double_expbit0=`cat conftest.out` + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + eval "$as_ac_var=yes" else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -( exit $ac_status ) -gl_cv_cc_double_expbit0="unknown" + eval "$as_ac_var=no" fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext fi +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF +fi +done - rm -f conftest.out -fi -{ echo "$as_me:$LINENO: result: $gl_cv_cc_double_expbit0" >&5 -echo "${ECHO_T}$gl_cv_cc_double_expbit0" >&6; } - case "$gl_cv_cc_double_expbit0" in - word*bit*) - word=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word //' -e 's/ bit.*//'` - bit=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word.*bit //'` + fi + fi -cat >>confdefs.h <<_ACEOF -#define DBL_EXPBIT0_WORD $word -_ACEOF + # Autoconf 2.61a.99 and earlier don't support linking a file only + # in VPATH builds. But since GNUmakefile is for maintainer use + # only, it does not matter if we skip the link with older autoconf. + # Automake 1.10.1 and earlier try to remove GNUmakefile in non-VPATH + # builds, so use a shell variable to bypass this. + GNUmakefile=GNUmakefile -cat >>confdefs.h <<_ACEOF -#define DBL_EXPBIT0_BIT $bit + + { echo "$as_me:$LINENO: checking whether the compiler generally respects inline" >&5 +echo $ECHO_N "checking whether the compiler generally respects inline... $ECHO_C" >&6; } +if test "${gl_cv_c_inline_effective+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test $ac_cv_c_inline = no; then + gl_cv_c_inline_effective=no + else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ _ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ - ;; - esac +int +main () +{ +#ifdef __NO_INLINE__ + #error "inline is not effective" + #endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + gl_cv_c_inline_effective=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gl_cv_c_inline_effective=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi +fi +{ echo "$as_me:$LINENO: result: $gl_cv_c_inline_effective" >&5 +echo "${ECHO_T}$gl_cv_c_inline_effective" >&6; } + if test $gl_cv_c_inline_effective = yes; then +cat >>confdefs.h <<\_ACEOF +#define HAVE_INLINE 1 +_ACEOF - { echo "$as_me:$LINENO: checking whether isnan(float) can be used without linking with libm" >&5 -echo $ECHO_N "checking whether isnan(float) can be used without linking with libm... $ECHO_C" >&6; } -if test "${gl_cv_func_isnanf_no_libm+set}" = set; then + fi + + + { echo "$as_me:$LINENO: checking whether isnan(double) can be used without linking with libm" >&5 +echo $ECHO_N "checking whether isnan(double) can be used without linking with libm... $ECHO_C" >&6; } +if test "${gl_cv_func_isnand_no_libm+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -14219,15 +14764,18 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <math.h> - #ifdef isnan - # undef isnanf - # define isnanf(x) isnan ((float)(x)) + #if __GNUC__ >= 4 + # undef isnand + # define isnand(x) __builtin_isnan ((double)(x)) + #else + # undef isnand + # define isnand(x) isnan ((double)(x)) #endif - float x; + double x; int main () { -return isnanf (x); +return isnand (x); ; return 0; } @@ -14250,130 +14798,216 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then - gl_cv_func_isnanf_no_libm=yes + gl_cv_func_isnand_no_libm=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - gl_cv_func_isnanf_no_libm=no + gl_cv_func_isnand_no_libm=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $gl_cv_func_isnanf_no_libm" >&5 -echo "${ECHO_T}$gl_cv_func_isnanf_no_libm" >&6; } +{ echo "$as_me:$LINENO: result: $gl_cv_func_isnand_no_libm" >&5 +echo "${ECHO_T}$gl_cv_func_isnand_no_libm" >&6; } + if test $gl_cv_func_isnand_no_libm = yes; then - if test $gl_cv_func_isnanf_no_libm = yes; then +cat >>confdefs.h <<\_ACEOF +#define HAVE_ISNAND_IN_LIBC 1 +_ACEOF + else - { echo "$as_me:$LINENO: checking whether isnan(float) works" >&5 -echo $ECHO_N "checking whether isnan(float) works... $ECHO_C" >&6; } -if test "${gl_cv_func_isnanf_works+set}" = set; then + + + + + + + M4_LIBOBJS="$M4_LIBOBJS isnand.$ac_objext" + + + { echo "$as_me:$LINENO: checking where to find the exponent in a 'double'" >&5 +echo $ECHO_N "checking where to find the exponent in a 'double'... $ECHO_C" >&6; } +if test "${gl_cv_cc_double_expbit0+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then - case "$host_os" in - irix* | solaris*) gl_cv_func_isnanf_works="guessing no";; - *) gl_cv_func_isnanf_works="guessing yes";; - esac -else - cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <math.h> -#ifdef isnan -# undef isnanf -# define isnanf(x) isnan ((float)(x)) +#if defined arm || defined __arm || defined __arm__ + mixed_endianness #endif -/* The Compaq (ex-DEC) C 6.4 compiler chokes on the expression 0.0 / 0.0. */ -#ifdef __DECC -static float -NaN () + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "mixed_endianness" >/dev/null 2>&1; then + gl_cv_cc_double_expbit0="unknown" +else + + : +if test "${ac_cv_c_bigendian+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # See if sys/param.h defines the BYTE_ORDER macro. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <sys/types.h> +#include <sys/param.h> + +int +main () { - static float zero = 0.0f; - return zero / zero; -} -#else -# define NaN() (0.0f / 0.0f) +#if ! (defined BYTE_ORDER && defined BIG_ENDIAN && defined LITTLE_ENDIAN \ + && BYTE_ORDER && BIG_ENDIAN && LITTLE_ENDIAN) + bogus endian macros #endif -int main() -{ - if (!isnanf (NaN ())) - return 1; - if (isnanf (1.0f / 0.0f)) - return 1; + + ; return 0; } _ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + # It does; now see whether it defined to BIG_ENDIAN or not. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <sys/types.h> +#include <sys/param.h> + +int +main () +{ +#if BYTE_ORDER != BIG_ENDIAN + not big endian +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - gl_cv_func_isnanf_works=yes + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_c_bigendian=yes else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -( exit $ac_status ) -gl_cv_func_isnanf_works=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext + ac_cv_c_bigendian=no fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 - -fi -{ echo "$as_me:$LINENO: result: $gl_cv_func_isnanf_works" >&5 -echo "${ECHO_T}$gl_cv_func_isnanf_works" >&6; } - - fi - if test $gl_cv_func_isnanf_no_libm = yes \ - && { case "$gl_cv_func_isnanf_works" in - *yes) true;; - *) false;; - esac - }; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_ISNANF_IN_LIBC 1 + # It does not; compile a test program. +if test "$cross_compiling" = yes; then + # try to guess the endianness by grepping values into an object file + ac_cv_c_bigendian=unknown + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ _ACEOF - +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; +short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; +void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } +short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; +short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; +void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } +int +main () +{ + _ascii (); _ebcdic (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then + ac_cv_c_bigendian=yes +fi +if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then + if test "$ac_cv_c_bigendian" = unknown; then + ac_cv_c_bigendian=no else - M4_LIBOBJS="$M4_LIBOBJS isnanf.$ac_objext" - - { echo "$as_me:$LINENO: checking where to find the exponent in a 'float'" >&5 -echo $ECHO_N "checking where to find the exponent in a 'float'... $ECHO_C" >&6; } -if test "${gl_cv_cc_float_expbit0+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + # finding both strings is unlikely to happen, but who knows? + ac_cv_c_bigendian=unknown + fi +fi else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 - if test "$cross_compiling" = yes; then - gl_cv_cc_float_expbit0="word 0 bit 23" + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -14381,71 +15015,23 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - -#include <float.h> -#include <stddef.h> -#include <stdio.h> -#include <string.h> -#define NWORDS \ - ((sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) -typedef union { float value; unsigned int word[NWORDS]; } memory_float; -static unsigned int ored_words[NWORDS]; -static unsigned int anded_words[NWORDS]; -static void add_to_ored_words (float x) -{ - memory_float m; - size_t i; - /* Clear it first, in case - sizeof (float) < sizeof (memory_float). */ - memset (&m, 0, sizeof (memory_float)); - m.value = x; - for (i = 0; i < NWORDS; i++) - { - ored_words[i] |= m.word[i]; - anded_words[i] &= m.word[i]; - } -} -int main () +$ac_includes_default +int +main () { - size_t j; - FILE *fp = fopen ("conftest.out", "w"); - if (fp == NULL) - return 1; - for (j = 0; j < NWORDS; j++) - anded_words[j] = ~ (unsigned int) 0; - add_to_ored_words (0.25f); - add_to_ored_words (0.5f); - add_to_ored_words (1.0f); - add_to_ored_words (2.0f); - add_to_ored_words (4.0f); - /* Remove bits that are common (e.g. if representation of the first mantissa - bit is explicit). */ - for (j = 0; j < NWORDS; j++) - ored_words[j] &= ~anded_words[j]; - /* Now find the nonzero word. */ - for (j = 0; j < NWORDS; j++) - if (ored_words[j] != 0) - break; - if (j < NWORDS) - { - size_t i; - for (i = j + 1; i < NWORDS; i++) - if (ored_words[i] != 0) - { - fprintf (fp, "unknown"); - return (fclose (fp) != 0); - } - for (i = 0; ; i++) - if ((ored_words[j] >> i) & 1) - { - fprintf (fp, "word %d bit %d", (int) j, (int) i); - return (fclose (fp) != 0); - } - } - fprintf (fp, "unknown"); - return (fclose (fp) != 0); -} + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long int l; + char c[sizeof (long int)]; + } u; + u.l = 1; + return u.c[sizeof (long int) - 1] == 1; + + ; + return 0; +} _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" @@ -14467,52 +15053,38 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - gl_cv_cc_float_expbit0=`cat conftest.out` + ac_cv_c_bigendian=no else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -gl_cv_cc_float_expbit0="unknown" +ac_cv_c_bigendian=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi - rm -f conftest.out - fi -{ echo "$as_me:$LINENO: result: $gl_cv_cc_float_expbit0" >&5 -echo "${ECHO_T}$gl_cv_cc_float_expbit0" >&6; } - case "$gl_cv_cc_float_expbit0" in - word*bit*) - word=`echo "$gl_cv_cc_float_expbit0" | sed -e 's/word //' -e 's/ bit.*//'` - bit=`echo "$gl_cv_cc_float_expbit0" | sed -e 's/word.*bit //'` - -cat >>confdefs.h <<_ACEOF -#define FLT_EXPBIT0_WORD $word -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define FLT_EXPBIT0_BIT $bit -_ACEOF - ;; - esac +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +: +case $ac_cv_c_bigendian in + yes) + gl_cv_cc_double_expbit0="word 0 bit 20" ;; + no) + gl_cv_cc_double_expbit0="word 1 bit 20" ;; + *) + gl_cv_cc_double_expbit0="unknown" ;; +esac - fi +fi +rm -f conftest* - { echo "$as_me:$LINENO: checking where to find the exponent in a 'float'" >&5 -echo $ECHO_N "checking where to find the exponent in a 'float'... $ECHO_C" >&6; } -if test "${gl_cv_cc_float_expbit0+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then - gl_cv_cc_float_expbit0="word 0 bit 23" else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -14526,17 +15098,16 @@ cat >>conftest.$ac_ext <<_ACEOF #include <stdio.h> #include <string.h> #define NWORDS \ - ((sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) -typedef union { float value; unsigned int word[NWORDS]; } memory_float; + ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) +typedef union { double value; unsigned int word[NWORDS]; } memory_double; static unsigned int ored_words[NWORDS]; static unsigned int anded_words[NWORDS]; -static void add_to_ored_words (float x) +static void add_to_ored_words (double x) { - memory_float m; + memory_double m; size_t i; - /* Clear it first, in case - sizeof (float) < sizeof (memory_float). */ - memset (&m, 0, sizeof (memory_float)); + /* Clear it first, in case sizeof (double) < sizeof (memory_double). */ + memset (&m, 0, sizeof (memory_double)); m.value = x; for (i = 0; i < NWORDS; i++) { @@ -14552,11 +15123,11 @@ int main () return 1; for (j = 0; j < NWORDS; j++) anded_words[j] = ~ (unsigned int) 0; - add_to_ored_words (0.25f); - add_to_ored_words (0.5f); - add_to_ored_words (1.0f); - add_to_ored_words (2.0f); - add_to_ored_words (4.0f); + add_to_ored_words (0.25); + add_to_ored_words (0.5); + add_to_ored_words (1.0); + add_to_ored_words (2.0); + add_to_ored_words (4.0); /* Remove bits that are common (e.g. if representation of the first mantissa bit is explicit). */ for (j = 0; j < NWORDS; j++) @@ -14606,14 +15177,14 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - gl_cv_cc_float_expbit0=`cat conftest.out` + gl_cv_cc_double_expbit0=`cat conftest.out` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -gl_cv_cc_float_expbit0="unknown" +gl_cv_cc_double_expbit0="unknown" fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi @@ -14622,30 +15193,32 @@ fi rm -f conftest.out fi -{ echo "$as_me:$LINENO: result: $gl_cv_cc_float_expbit0" >&5 -echo "${ECHO_T}$gl_cv_cc_float_expbit0" >&6; } - case "$gl_cv_cc_float_expbit0" in +{ echo "$as_me:$LINENO: result: $gl_cv_cc_double_expbit0" >&5 +echo "${ECHO_T}$gl_cv_cc_double_expbit0" >&6; } + case "$gl_cv_cc_double_expbit0" in word*bit*) - word=`echo "$gl_cv_cc_float_expbit0" | sed -e 's/word //' -e 's/ bit.*//'` - bit=`echo "$gl_cv_cc_float_expbit0" | sed -e 's/word.*bit //'` + word=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word //' -e 's/ bit.*//'` + bit=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word.*bit //'` cat >>confdefs.h <<_ACEOF -#define FLT_EXPBIT0_WORD $word +#define DBL_EXPBIT0_WORD $word _ACEOF cat >>confdefs.h <<_ACEOF -#define FLT_EXPBIT0_BIT $bit +#define DBL_EXPBIT0_BIT $bit _ACEOF ;; esac + fi + - { echo "$as_me:$LINENO: checking whether isnan(long double) can be used without linking with libm" >&5 -echo $ECHO_N "checking whether isnan(long double) can be used without linking with libm... $ECHO_C" >&6; } -if test "${gl_cv_func_isnanl_no_libm+set}" = set; then + { echo "$as_me:$LINENO: checking whether isnan(float) can be used without linking with libm" >&5 +echo $ECHO_N "checking whether isnan(float) can be used without linking with libm... $ECHO_C" >&6; } +if test "${gl_cv_func_isnanf_no_libm+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -14656,15 +15229,18 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <math.h> - #ifdef isnan - # undef isnanl - # define isnanl(x) isnan ((long double)(x)) + #if __GNUC__ >= 4 + # undef isnanf + # define isnanf(x) __builtin_isnanf ((float)(x)) + #elif defined isnan + # undef isnanf + # define isnanf(x) isnan ((float)(x)) #endif - long double x; + float x; int main () { -return isnanl (x); +return isnanf (x); ; return 0; } @@ -14687,43 +15263,35 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then - gl_cv_func_isnanl_no_libm=yes + gl_cv_func_isnanf_no_libm=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - gl_cv_func_isnanl_no_libm=no + gl_cv_func_isnanf_no_libm=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $gl_cv_func_isnanl_no_libm" >&5 -echo "${ECHO_T}$gl_cv_func_isnanl_no_libm" >&6; } - - gl_func_isnanl_no_libm=$gl_cv_func_isnanl_no_libm - if test $gl_func_isnanl_no_libm = yes; then +{ echo "$as_me:$LINENO: result: $gl_cv_func_isnanf_no_libm" >&5 +echo "${ECHO_T}$gl_cv_func_isnanf_no_libm" >&6; } + if test $gl_cv_func_isnanf_no_libm = yes; then - { echo "$as_me:$LINENO: checking whether isnanl works" >&5 -echo $ECHO_N "checking whether isnanl works... $ECHO_C" >&6; } -if test "${gl_cv_func_isnanl_works+set}" = set; then + { echo "$as_me:$LINENO: checking whether isnan(float) works" >&5 +echo $ECHO_N "checking whether isnan(float) works... $ECHO_C" >&6; } +if test "${gl_cv_func_isnanf_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then - case "$host_cpu" in - # Guess no on ia64, x86_64, i386. - ia64 | x86_64 | i*86) gl_cv_func_isnanl_works="guessing no";; - *) - case "$host_os" in - netbsd*) gl_cv_func_isnanl_works="guessing no";; - *) gl_cv_func_isnanl_works="guessing yes";; - esac - ;; - esac + case "$host_os" in + irix* | solaris*) gl_cv_func_isnanf_works="guessing no";; + *) gl_cv_func_isnanf_works="guessing yes";; + esac else cat >conftest.$ac_ext <<_ACEOF @@ -14733,98 +15301,31 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <float.h> -#include <limits.h> #include <math.h> -#ifdef isnan -# undef isnanl -# define isnanl(x) isnan ((long double)(x)) +#if __GNUC__ >= 4 +# undef isnanf +# define isnanf(x) __builtin_isnanf ((float)(x)) +#elif defined isnan +# undef isnanf +# define isnanf(x) isnan ((float)(x)) #endif -#define NWORDS \ - ((sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) -typedef union { unsigned int word[NWORDS]; long double value; } - memory_long_double; -int main () +/* The Compaq (ex-DEC) C 6.4 compiler chokes on the expression 0.0 / 0.0. */ +#ifdef __DECC +static float +NaN () { - memory_long_double m; - unsigned int i; - - /* The isnanl function should be immune against changes in the sign bit and - in the mantissa bits. The xor operation twiddles a bit that can only be - a sign bit or a mantissa bit (since the exponent never extends to - bit 31). */ - m.value = 0.0L / 0.0L; - m.word[NWORDS / 2] ^= (unsigned int) 1 << (sizeof (unsigned int) * CHAR_BIT - 1); - for (i = 0; i < NWORDS; i++) - m.word[i] |= 1; - if (!isnanl (m.value)) - return 1; - -#if ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) -/* Representation of an 80-bit 'long double' as an initializer for a sequence - of 'unsigned int' words. */ -# ifdef WORDS_BIGENDIAN -# define LDBL80_WORDS(exponent,manthi,mantlo) \ - { ((unsigned int) (exponent) << 16) | ((unsigned int) (manthi) >> 16), \ - ((unsigned int) (manthi) << 16) | (unsigned int) (mantlo) >> 16), \ - (unsigned int) (mantlo) << 16 \ - } -# else -# define LDBL80_WORDS(exponent,manthi,mantlo) \ - { mantlo, manthi, exponent } -# endif - { /* Quiet NaN. */ - static memory_long_double x = - { LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) }; - if (!isnanl (x.value)) - return 1; - } - { - /* Signalling NaN. */ - static memory_long_double x = - { LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) }; - if (!isnanl (x.value)) - return 1; - } - /* The isnanl function should recognize Pseudo-NaNs, Pseudo-Infinities, - Pseudo-Zeroes, Unnormalized Numbers, and Pseudo-Denormals, as defined in - Intel IA-64 Architecture Software Developer's Manual, Volume 1: - Application Architecture. - Table 5-2 "Floating-Point Register Encodings" - Figure 5-6 "Memory to Floating-Point Register Data Translation" - */ - { /* Pseudo-NaN. */ - static memory_long_double x = - { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) }; - if (!isnanl (x.value)) - return 1; - } - { /* Pseudo-Infinity. */ - static memory_long_double x = - { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) }; - if (!isnanl (x.value)) - return 1; - } - { /* Pseudo-Zero. */ - static memory_long_double x = - { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) }; - if (!isnanl (x.value)) - return 1; - } - { /* Unnormalized number. */ - static memory_long_double x = - { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) }; - if (!isnanl (x.value)) - return 1; - } - { /* Pseudo-Denormal. */ - static memory_long_double x = - { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) }; - if (!isnanl (x.value)) - return 1; - } + static float zero = 0.0f; + return zero / zero; +} +#else +# define NaN() (0.0f / 0.0f) #endif - +int main() +{ + if (!isnanf (NaN ())) + return 1; + if (isnanf (1.0f / 0.0f)) + return 1; return 0; } _ACEOF @@ -14848,14 +15349,14 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - gl_cv_func_isnanl_works=yes + gl_cv_func_isnanf_works=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -gl_cv_func_isnanl_works=no +gl_cv_func_isnanf_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi @@ -14863,34 +15364,40 @@ fi fi -{ echo "$as_me:$LINENO: result: $gl_cv_func_isnanl_works" >&5 -echo "${ECHO_T}$gl_cv_func_isnanl_works" >&6; } +{ echo "$as_me:$LINENO: result: $gl_cv_func_isnanf_works" >&5 +echo "${ECHO_T}$gl_cv_func_isnanf_works" >&6; } - case "$gl_cv_func_isnanl_works" in - *yes) ;; - *) gl_func_isnanl_no_libm=no ;; - esac fi - if test $gl_func_isnanl_no_libm = yes; then + if test $gl_cv_func_isnanf_no_libm = yes \ + && { case "$gl_cv_func_isnanf_works" in + *yes) true;; + *) false;; + esac + }; then cat >>confdefs.h <<\_ACEOF -#define HAVE_ISNANL_IN_LIBC 1 +#define HAVE_ISNANF_IN_LIBC 1 _ACEOF else - M4_LIBOBJS="$M4_LIBOBJS isnanl.$ac_objext" - { echo "$as_me:$LINENO: checking where to find the exponent in a 'long double'" >&5 -echo $ECHO_N "checking where to find the exponent in a 'long double'... $ECHO_C" >&6; } -if test "${gl_cv_cc_long_double_expbit0+set}" = set; then + + + + + + M4_LIBOBJS="$M4_LIBOBJS isnanf.$ac_objext" + + + { echo "$as_me:$LINENO: checking where to find the exponent in a 'float'" >&5 +echo $ECHO_N "checking where to find the exponent in a 'float'... $ECHO_C" >&6; } +if test "${gl_cv_cc_float_expbit0+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then - - gl_cv_cc_long_double_expbit0="unknown" - + gl_cv_cc_float_expbit0="word 0 bit 23" else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -14904,18 +15411,17 @@ cat >>conftest.$ac_ext <<_ACEOF #include <stdio.h> #include <string.h> #define NWORDS \ - ((sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) -typedef union { long double value; unsigned int word[NWORDS]; } - memory_long_double; + ((sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) +typedef union { float value; unsigned int word[NWORDS]; } memory_float; static unsigned int ored_words[NWORDS]; static unsigned int anded_words[NWORDS]; -static void add_to_ored_words (long double x) +static void add_to_ored_words (float x) { - memory_long_double m; + memory_float m; size_t i; /* Clear it first, in case - sizeof (long double) < sizeof (memory_long_double). */ - memset (&m, 0, sizeof (memory_long_double)); + sizeof (float) < sizeof (memory_float). */ + memset (&m, 0, sizeof (memory_float)); m.value = x; for (i = 0; i < NWORDS; i++) { @@ -14931,11 +15437,11 @@ int main () return 1; for (j = 0; j < NWORDS; j++) anded_words[j] = ~ (unsigned int) 0; - add_to_ored_words (0.25L); - add_to_ored_words (0.5L); - add_to_ored_words (1.0L); - add_to_ored_words (2.0L); - add_to_ored_words (4.0L); + add_to_ored_words (0.25f); + add_to_ored_words (0.5f); + add_to_ored_words (1.0f); + add_to_ored_words (2.0f); + add_to_ored_words (4.0f); /* Remove bits that are common (e.g. if representation of the first mantissa bit is explicit). */ for (j = 0; j < NWORDS; j++) @@ -14985,14 +15491,14 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - gl_cv_cc_long_double_expbit0=`cat conftest.out` + gl_cv_cc_float_expbit0=`cat conftest.out` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -gl_cv_cc_long_double_expbit0="unknown" +gl_cv_cc_float_expbit0="unknown" fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi @@ -15001,20 +15507,20 @@ fi rm -f conftest.out fi -{ echo "$as_me:$LINENO: result: $gl_cv_cc_long_double_expbit0" >&5 -echo "${ECHO_T}$gl_cv_cc_long_double_expbit0" >&6; } - case "$gl_cv_cc_long_double_expbit0" in +{ echo "$as_me:$LINENO: result: $gl_cv_cc_float_expbit0" >&5 +echo "${ECHO_T}$gl_cv_cc_float_expbit0" >&6; } + case "$gl_cv_cc_float_expbit0" in word*bit*) - word=`echo "$gl_cv_cc_long_double_expbit0" | sed -e 's/word //' -e 's/ bit.*//'` - bit=`echo "$gl_cv_cc_long_double_expbit0" | sed -e 's/word.*bit //'` + word=`echo "$gl_cv_cc_float_expbit0" | sed -e 's/word //' -e 's/ bit.*//'` + bit=`echo "$gl_cv_cc_float_expbit0" | sed -e 's/word.*bit //'` cat >>confdefs.h <<_ACEOF -#define LDBL_EXPBIT0_WORD $word +#define FLT_EXPBIT0_WORD $word _ACEOF cat >>confdefs.h <<_ACEOF -#define LDBL_EXPBIT0_BIT $bit +#define FLT_EXPBIT0_BIT $bit _ACEOF ;; @@ -15024,89 +15530,196 @@ _ACEOF - { echo "$as_me:$LINENO: checking where to find the exponent in a 'long double'" >&5 -echo $ECHO_N "checking where to find the exponent in a 'long double'... $ECHO_C" >&6; } -if test "${gl_cv_cc_long_double_expbit0+set}" = set; then + { echo "$as_me:$LINENO: checking whether isnan(long double) can be used without linking with libm" >&5 +echo $ECHO_N "checking whether isnan(long double) can be used without linking with libm... $ECHO_C" >&6; } +if test "${gl_cv_func_isnanl_no_libm+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test "$cross_compiling" = yes; then - - gl_cv_cc_long_double_expbit0="unknown" - -else - cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - -#include <float.h> -#include <stddef.h> -#include <stdio.h> -#include <string.h> -#define NWORDS \ - ((sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) -typedef union { long double value; unsigned int word[NWORDS]; } - memory_long_double; -static unsigned int ored_words[NWORDS]; -static unsigned int anded_words[NWORDS]; -static void add_to_ored_words (long double x) +#include <math.h> + #if __GNUC__ >= 4 + # undef isnanl + # define isnanl(x) __builtin_isnanl ((long double)(x)) + #elif defined isnan + # undef isnanl + # define isnanl(x) isnan ((long double)(x)) + #endif + long double x; +int +main () { - memory_long_double m; - size_t i; - /* Clear it first, in case - sizeof (long double) < sizeof (memory_long_double). */ - memset (&m, 0, sizeof (memory_long_double)); - m.value = x; - for (i = 0; i < NWORDS; i++) - { - ored_words[i] |= m.word[i]; - anded_words[i] &= m.word[i]; - } +return isnanl (x); + ; + return 0; } -int main () +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + gl_cv_func_isnanl_no_libm=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gl_cv_func_isnanl_no_libm=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + +fi +{ echo "$as_me:$LINENO: result: $gl_cv_func_isnanl_no_libm" >&5 +echo "${ECHO_T}$gl_cv_func_isnanl_no_libm" >&6; } + + gl_func_isnanl_no_libm=$gl_cv_func_isnanl_no_libm + if test $gl_func_isnanl_no_libm = yes; then + + + + { echo "$as_me:$LINENO: checking whether isnanl works" >&5 +echo $ECHO_N "checking whether isnanl works... $ECHO_C" >&6; } +if test "${gl_cv_func_isnanl_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + if test "$cross_compiling" = yes; then + case "$host_cpu" in + # Guess no on ia64, x86_64, i386. + ia64 | x86_64 | i*86) gl_cv_func_isnanl_works="guessing no";; + *) + case "$host_os" in + netbsd*) gl_cv_func_isnanl_works="guessing no";; + *) gl_cv_func_isnanl_works="guessing yes";; + esac + ;; + esac + +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include <float.h> +#include <limits.h> +#include <math.h> +#if __GNUC__ >= 4 +# undef isnanl +# define isnanl(x) __builtin_isnanl ((long double)(x)) +#elif defined isnan +# undef isnanl +# define isnanl(x) isnan ((long double)(x)) +#endif +#define NWORDS \ + ((sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) +typedef union { unsigned int word[NWORDS]; long double value; } + memory_long_double; +int main () { - size_t j; - FILE *fp = fopen ("conftest.out", "w"); - if (fp == NULL) + memory_long_double m; + unsigned int i; + + /* The isnanl function should be immune against changes in the sign bit and + in the mantissa bits. The xor operation twiddles a bit that can only be + a sign bit or a mantissa bit (since the exponent never extends to + bit 31). */ + m.value = 0.0L / 0.0L; + m.word[NWORDS / 2] ^= (unsigned int) 1 << (sizeof (unsigned int) * CHAR_BIT - 1); + for (i = 0; i < NWORDS; i++) + m.word[i] |= 1; + if (!isnanl (m.value)) return 1; - for (j = 0; j < NWORDS; j++) - anded_words[j] = ~ (unsigned int) 0; - add_to_ored_words (0.25L); - add_to_ored_words (0.5L); - add_to_ored_words (1.0L); - add_to_ored_words (2.0L); - add_to_ored_words (4.0L); - /* Remove bits that are common (e.g. if representation of the first mantissa - bit is explicit). */ - for (j = 0; j < NWORDS; j++) - ored_words[j] &= ~anded_words[j]; - /* Now find the nonzero word. */ - for (j = 0; j < NWORDS; j++) - if (ored_words[j] != 0) - break; - if (j < NWORDS) - { - size_t i; - for (i = j + 1; i < NWORDS; i++) - if (ored_words[i] != 0) - { - fprintf (fp, "unknown"); - return (fclose (fp) != 0); - } - for (i = 0; ; i++) - if ((ored_words[j] >> i) & 1) - { - fprintf (fp, "word %d bit %d", (int) j, (int) i); - return (fclose (fp) != 0); - } - } - fprintf (fp, "unknown"); - return (fclose (fp) != 0); -} +#if ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) +/* Representation of an 80-bit 'long double' as an initializer for a sequence + of 'unsigned int' words. */ +# ifdef WORDS_BIGENDIAN +# define LDBL80_WORDS(exponent,manthi,mantlo) \ + { ((unsigned int) (exponent) << 16) | ((unsigned int) (manthi) >> 16), \ + ((unsigned int) (manthi) << 16) | (unsigned int) (mantlo) >> 16), \ + (unsigned int) (mantlo) << 16 \ + } +# else +# define LDBL80_WORDS(exponent,manthi,mantlo) \ + { mantlo, manthi, exponent } +# endif + { /* Quiet NaN. */ + static memory_long_double x = + { LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) }; + if (!isnanl (x.value)) + return 1; + } + { + /* Signalling NaN. */ + static memory_long_double x = + { LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) }; + if (!isnanl (x.value)) + return 1; + } + /* The isnanl function should recognize Pseudo-NaNs, Pseudo-Infinities, + Pseudo-Zeroes, Unnormalized Numbers, and Pseudo-Denormals, as defined in + Intel IA-64 Architecture Software Developer's Manual, Volume 1: + Application Architecture. + Table 5-2 "Floating-Point Register Encodings" + Figure 5-6 "Memory to Floating-Point Register Data Translation" + */ + { /* Pseudo-NaN. */ + static memory_long_double x = + { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) }; + if (!isnanl (x.value)) + return 1; + } + { /* Pseudo-Infinity. */ + static memory_long_double x = + { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) }; + if (!isnanl (x.value)) + return 1; + } + { /* Pseudo-Zero. */ + static memory_long_double x = + { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) }; + if (!isnanl (x.value)) + return 1; + } + { /* Unnormalized number. */ + static memory_long_double x = + { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) }; + if (!isnanl (x.value)) + return 1; + } + { /* Pseudo-Denormal. */ + static memory_long_double x = + { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) }; + if (!isnanl (x.value)) + return 1; + } +#endif + + return 0; +} _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" @@ -15128,44 +15741,36 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - gl_cv_cc_long_double_expbit0=`cat conftest.out` + gl_cv_func_isnanl_works=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -gl_cv_cc_long_double_expbit0="unknown" +gl_cv_func_isnanl_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi - rm -f conftest.out fi -{ echo "$as_me:$LINENO: result: $gl_cv_cc_long_double_expbit0" >&5 -echo "${ECHO_T}$gl_cv_cc_long_double_expbit0" >&6; } - case "$gl_cv_cc_long_double_expbit0" in - word*bit*) - word=`echo "$gl_cv_cc_long_double_expbit0" | sed -e 's/word //' -e 's/ bit.*//'` - bit=`echo "$gl_cv_cc_long_double_expbit0" | sed -e 's/word.*bit //'` - -cat >>confdefs.h <<_ACEOF -#define LDBL_EXPBIT0_WORD $word -_ACEOF +{ echo "$as_me:$LINENO: result: $gl_cv_func_isnanl_works" >&5 +echo "${ECHO_T}$gl_cv_func_isnanl_works" >&6; } + case "$gl_cv_func_isnanl_works" in + *yes) ;; + *) gl_func_isnanl_no_libm=no ;; + esac + fi + if test $gl_func_isnanl_no_libm = yes; then -cat >>confdefs.h <<_ACEOF -#define LDBL_EXPBIT0_BIT $bit +cat >>confdefs.h <<\_ACEOF +#define HAVE_ISNANL_IN_LIBC 1 _ACEOF - ;; - esac - - - - + else @@ -15173,34 +15778,191 @@ _ACEOF + M4_LIBOBJS="$M4_LIBOBJS isnanl.$ac_objext" + { echo "$as_me:$LINENO: checking where to find the exponent in a 'long double'" >&5 +echo $ECHO_N "checking where to find the exponent in a 'long double'... $ECHO_C" >&6; } +if test "${gl_cv_cc_long_double_expbit0+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + gl_cv_cc_long_double_expbit0="unknown" - { echo "$as_me:$LINENO: checking whether lseek detects pipes" >&5 -echo $ECHO_N "checking whether lseek detects pipes... $ECHO_C" >&6; } -if test "${gl_cv_func_lseek_pipe+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test $cross_compiling = no; then - cat >conftest.$ac_ext <<_ACEOF - -#include <sys/types.h> /* for off_t */ -#include <stdio.h> /* for SEEK_CUR */ -#include <unistd.h> -int main () -{ - /* Exit with success only if stdin is seekable. */ - return lseek (0, (off_t)0, SEEK_CUR) < 0; -} + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include <float.h> +#include <stddef.h> +#include <stdio.h> +#include <string.h> +#define NWORDS \ + ((sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) +typedef union { long double value; unsigned int word[NWORDS]; } + memory_long_double; +static unsigned int ored_words[NWORDS]; +static unsigned int anded_words[NWORDS]; +static void add_to_ored_words (long double x) +{ + memory_long_double m; + size_t i; + /* Clear it first, in case + sizeof (long double) < sizeof (memory_long_double). */ + memset (&m, 0, sizeof (memory_long_double)); + m.value = x; + for (i = 0; i < NWORDS; i++) + { + ored_words[i] |= m.word[i]; + anded_words[i] &= m.word[i]; + } +} +int main () +{ + size_t j; + FILE *fp = fopen ("conftest.out", "w"); + if (fp == NULL) + return 1; + for (j = 0; j < NWORDS; j++) + anded_words[j] = ~ (unsigned int) 0; + add_to_ored_words (0.25L); + add_to_ored_words (0.5L); + add_to_ored_words (1.0L); + add_to_ored_words (2.0L); + add_to_ored_words (4.0L); + /* Remove bits that are common (e.g. if representation of the first mantissa + bit is explicit). */ + for (j = 0; j < NWORDS; j++) + ored_words[j] &= ~anded_words[j]; + /* Now find the nonzero word. */ + for (j = 0; j < NWORDS; j++) + if (ored_words[j] != 0) + break; + if (j < NWORDS) + { + size_t i; + for (i = j + 1; i < NWORDS; i++) + if (ored_words[i] != 0) + { + fprintf (fp, "unknown"); + return (fclose (fp) != 0); + } + for (i = 0; ; i++) + if ((ored_words[j] >> i) & 1) + { + fprintf (fp, "word %d bit %d", (int) j, (int) i); + return (fclose (fp) != 0); + } + } + fprintf (fp, "unknown"); + return (fclose (fp) != 0); +} + +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gl_cv_cc_long_double_expbit0=`cat conftest.out` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +gl_cv_cc_long_double_expbit0="unknown" +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + + rm -f conftest.out + +fi +{ echo "$as_me:$LINENO: result: $gl_cv_cc_long_double_expbit0" >&5 +echo "${ECHO_T}$gl_cv_cc_long_double_expbit0" >&6; } + case "$gl_cv_cc_long_double_expbit0" in + word*bit*) + word=`echo "$gl_cv_cc_long_double_expbit0" | sed -e 's/word //' -e 's/ bit.*//'` + bit=`echo "$gl_cv_cc_long_double_expbit0" | sed -e 's/word.*bit //'` + +cat >>confdefs.h <<_ACEOF +#define LDBL_EXPBIT0_WORD $word +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define LDBL_EXPBIT0_BIT $bit +_ACEOF + + ;; + esac + + fi + + + + + + + + + + + + + + + LOCALCHARSET_TESTS_ENVIRONMENT="CHARSETALIASDIR=\"\$(top_builddir)/$gl_source_base\"" + + + + + { echo "$as_me:$LINENO: checking whether lseek detects pipes" >&5 +echo $ECHO_N "checking whether lseek detects pipes... $ECHO_C" >&6; } +if test "${gl_cv_func_lseek_pipe+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test $cross_compiling = no; then + cat >conftest.$ac_ext <<_ACEOF + +#include <sys/types.h> /* for off_t */ +#include <stdio.h> /* for SEEK_CUR */ +#include <unistd.h> +int main () +{ + /* Exit with success only if stdin is seekable. */ + return lseek (0, (off_t)0, SEEK_CUR) < 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 @@ -15233,8 +15995,8 @@ rm -f core conftest.err conftest.$ac_obj else cat >conftest.$ac_ext <<_ACEOF -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ -/* mingw mistakenly returns 0 when trying to seek on pipes. */ +#if ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) || defined __BEOS__ +/* mingw and BeOS mistakenly return 0 when trying to seek on pipes. */ Choke me. #endif _ACEOF @@ -15270,8 +16032,16 @@ fi echo "${ECHO_T}$gl_cv_func_lseek_pipe" >&6; } if test $gl_cv_func_lseek_pipe = no; then + + + + + + + M4_LIBOBJS="$M4_LIBOBJS lseek.$ac_objext" + REPLACE_LSEEK=1 cat >>confdefs.h <<\_ACEOF @@ -15505,7 +16275,15 @@ else #define HAVE_MALLOC 0 _ACEOF - M4_LIBOBJS="$M4_LIBOBJS malloc.$ac_objext" + + + + + + + + M4_LIBOBJS="$M4_LIBOBJS malloc.$ac_objext" + cat >>confdefs.h <<\_ACEOF #define malloc rpl_malloc @@ -15516,6 +16294,38 @@ fi +cat >>confdefs.h <<\_ACEOF +#define GNULIB_MALLOC_GNU 1 +_ACEOF + + + + if test $gl_cv_func_malloc_posix = yes; then + HAVE_MALLOC_POSIX=1 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_MALLOC_POSIX 1 +_ACEOF + + else + + + + + + + + M4_LIBOBJS="$M4_LIBOBJS malloc.$ac_objext" + + HAVE_MALLOC_POSIX=0 + fi + + + + + GNULIB_MALLOC_POSIX=1 + + @@ -15573,7 +16383,13 @@ echo "${ECHO_T}$gl_cv_next_math_h" >&6; -for ac_func in mkdtemp + + + + + + +for ac_func in memchr do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_func" >&5 @@ -15664,117 +16480,172 @@ if test `eval echo '${'$as_ac_var'}'` = _ACEOF else - M4_LIBOBJS="$M4_LIBOBJS $ac_func.$ac_objext" -fi -done - - if test $ac_cv_func_mkdtemp = no; then - HAVE_MKDTEMP=0 - : - - fi - + M4_LIBOBJS="$M4_LIBOBJS $ac_func.$ac_objext" - GNULIB_MKDTEMP=1 - +fi +done + if test $ac_cv_func_memchr = no; then - { echo "$as_me:$LINENO: checking for working mkstemp" >&5 -echo $ECHO_N "checking for working mkstemp... $ECHO_C" >&6; } -if test "${gl_cv_func_working_mkstemp+set}" = set; then +for ac_header in bp-sym.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } else - - mkdir conftest.mkstemp - if test "$cross_compiling" = yes; then - gl_cv_func_working_mkstemp=no -else - cat >conftest.$ac_ext <<_ACEOF + # Is the header compilable? +{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -int -main () -{ -int i; - off_t large = (off_t) 4294967295u; - if (large < 0) - large = 2147483647; - for (i = 0; i < 70; i++) - { - char templ[] = "conftest.mkstemp/coXXXXXX"; - int (*mkstemp_function) (char *) = mkstemp; - int fd = mkstemp_function (templ); - if (fd < 0 || lseek (fd, large, SEEK_SET) != large) - return 1; - close (fd); - } - return 0; - ; - return 0; -} +#include <$ac_header> _ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } + +# Is the header present? +{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - gl_cv_func_working_mkstemp=yes + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -( exit $ac_status ) -gl_cv_func_working_mkstemp=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext + ac_header_preproc=no fi +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } - rm -rf conftest.mkstemp - +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## ----------------------------- ## +## Report this to bug-m4@gnu.org ## +## ----------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" fi -{ echo "$as_me:$LINENO: result: $gl_cv_func_working_mkstemp" >&5 -echo "${ECHO_T}$gl_cv_func_working_mkstemp" >&6; } +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } - if test $gl_cv_func_working_mkstemp != yes; then - REPLACE_MKSTEMP=1 - M4_LIBOBJS="$M4_LIBOBJS mkstemp.$ac_objext" +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF +fi - fi +done + fi - GNULIB_MKSTEMP=1 - { echo "$as_me:$LINENO: checking for obstacks" >&5 -echo $ECHO_N "checking for obstacks... $ECHO_C" >&6; } -if test "${ac_cv_func_obstack+set}" = set; then + { echo "$as_me:$LINENO: checking for working memcmp" >&5 +echo $ECHO_N "checking for working memcmp... $ECHO_C" >&6; } +if test "${ac_cv_func_memcmp_working+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else + if test "$cross_compiling" = yes; then + ac_cv_func_memcmp_working=no +else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -15782,91 +16653,152 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default - #include "obstack.h" int main () { -struct obstack mem; - #define obstack_chunk_alloc malloc - #define obstack_chunk_free free - obstack_init (&mem); - obstack_free (&mem, 0); + + /* Some versions of memcmp are not 8-bit clean. */ + char c0 = '\100', c1 = '\200', c2 = '\201'; + if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0) + return 1; + + /* The Next x86 OpenStep bug shows up only when comparing 16 bytes + or more and with at least one buffer not starting on a 4-byte boundary. + William Lewis provided this test program. */ + { + char foo[21]; + char bar[21]; + int i; + for (i = 0; i < 4; i++) + { + char *a = foo + i; + char *b = bar + i; + strcpy (a, "--------01111111"); + strcpy (b, "--------10000000"); + if (memcmp (a, b, 16) >= 0) + return 1; + } + return 0; + } + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext +rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 + (eval "$ac_link") 2>&5 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_func_obstack=yes + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_memcmp_working=yes else - echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_func_obstack=no +( exit $ac_status ) +ac_cv_func_memcmp_working=no fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $ac_cv_func_obstack" >&5 -echo "${ECHO_T}$ac_cv_func_obstack" >&6; } -if test $ac_cv_func_obstack = yes; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_OBSTACK 1 -_ACEOF -else - M4_LIBOBJS="$M4_LIBOBJS obstack.$ac_objext" fi +{ echo "$as_me:$LINENO: result: $ac_cv_func_memcmp_working" >&5 +echo "${ECHO_T}$ac_cv_func_memcmp_working" >&6; } +test $ac_cv_func_memcmp_working = no && + M4_LIBOBJS="$M4_LIBOBJS memcmp.$ac_objext" + if test $ac_cv_func_memcmp_working = no; then +cat >>confdefs.h <<\_ACEOF +#define memcmp rpl_memcmp +_ACEOF + : + fi - { echo "$as_me:$LINENO: checking whether frexp can be used without linking with libm" >&5 -echo $ECHO_N "checking whether frexp can be used without linking with libm... $ECHO_C" >&6; } -if test "${gl_cv_func_frexp_no_libm+set}" = set; then + + + + + + + + +for ac_func in mkdtemp +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - - cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <math.h> - double x; - int y; +/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + int main () { -return frexp (x, &y) < 1; +return $ac_func (); ; return 0; } @@ -15889,35 +16821,56 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then - gl_cv_func_frexp_no_libm=yes + eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - gl_cv_func_frexp_no_libm=no + eval "$as_ac_var=no" fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +else + + M4_LIBOBJS="$M4_LIBOBJS $ac_func.$ac_objext" fi -{ echo "$as_me:$LINENO: result: $gl_cv_func_frexp_no_libm" >&5 -echo "${ECHO_T}$gl_cv_func_frexp_no_libm" >&6; } - if test $gl_cv_func_frexp_no_libm = yes; then +done - { echo "$as_me:$LINENO: checking whether frexp works" >&5 -echo $ECHO_N "checking whether frexp works... $ECHO_C" >&6; } -if test "${gl_cv_func_frexp_works+set}" = set; then + if test $ac_cv_func_mkdtemp = no; then + HAVE_MKDTEMP=0 + : + + fi + + + + GNULIB_MKDTEMP=1 + + + + + + { echo "$as_me:$LINENO: checking for working mkstemp" >&5 +echo $ECHO_N "checking for working mkstemp... $ECHO_C" >&6; } +if test "${gl_cv_func_working_mkstemp+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else + mkdir conftest.mkstemp if test "$cross_compiling" = yes; then - case "$host_os" in - netbsd* | irix*) gl_cv_func_frexp_works="guessing no";; - *) gl_cv_func_frexp_works="guessing yes";; - esac - + gl_cv_func_working_mkstemp=no else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -15925,33 +16878,25 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - -#include <float.h> -#include <math.h> -int main() +$ac_includes_default +int +main () { - int i; - volatile double x; - /* Test on denormalized numbers. */ - for (i = 1, x = 1.0; i >= DBL_MIN_EXP; i--, x *= 0.5) - ; - if (x > 0.0) - { - int exp; - double y = frexp (x, &exp); - /* On machines with IEEE754 arithmetic: x = 1.11254e-308, exp = -1022. - On NetBSD: y = 0.75. Correct: y = 0.5. */ - if (y != 0.5) - return 1; - } - /* Test on infinite numbers. */ - x = 1.0 / 0.0; - { - int exp; - double y = frexp (x, &exp); - if (y != x) - return 1; - } +int i; + off_t large = (off_t) 4294967295u; + if (large < 0) + large = 2147483647; + for (i = 0; i < 70; i++) + { + char templ[] = "conftest.mkstemp/coXXXXXX"; + int (*mkstemp_function) (char *) = mkstemp; + int fd = mkstemp_function (templ); + if (fd < 0 || lseek (fd, large, SEEK_SET) != large) + return 1; + close (fd); + } + return 0; + ; return 0; } _ACEOF @@ -15975,54 +16920,75 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - gl_cv_func_frexp_works=yes + gl_cv_func_working_mkstemp=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -gl_cv_func_frexp_works=no +gl_cv_func_working_mkstemp=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi + rm -rf conftest.mkstemp fi -{ echo "$as_me:$LINENO: result: $gl_cv_func_frexp_works" >&5 -echo "${ECHO_T}$gl_cv_func_frexp_works" >&6; } +{ echo "$as_me:$LINENO: result: $gl_cv_func_working_mkstemp" >&5 +echo "${ECHO_T}$gl_cv_func_working_mkstemp" >&6; } + + if test $gl_cv_func_working_mkstemp != yes; then + REPLACE_MKSTEMP=1 + + + + + + + + M4_LIBOBJS="$M4_LIBOBJS mkstemp.$ac_objext" - case "$gl_cv_func_frexp_works" in - *yes) -cat >>confdefs.h <<\_ACEOF -#define HAVE_FREXP_IN_LIBC 1 -_ACEOF - ;; - esac fi - { echo "$as_me:$LINENO: checking whether ldexp can be used without linking with libm" >&5 -echo $ECHO_N "checking whether ldexp can be used without linking with libm... $ECHO_C" >&6; } -if test "${gl_cv_func_ldexp_no_libm+set}" = set; then + + + GNULIB_MKSTEMP=1 + + + + + + + + + + + +{ echo "$as_me:$LINENO: checking for obstacks" >&5 +echo $ECHO_N "checking for obstacks... $ECHO_C" >&6; } +if test "${ac_cv_func_obstack+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - - cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <math.h> - double x; - int y; +$ac_includes_default + #include "obstack.h" int main () { -return ldexp (x, y) < 1; +struct obstack mem; + #define obstack_chunk_alloc malloc + #define obstack_chunk_free free + obstack_init (&mem); + obstack_free (&mem, 0); ; return 0; } @@ -16045,33 +17011,52 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then - gl_cv_func_ldexp_no_libm=yes + ac_cv_func_obstack=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - gl_cv_func_ldexp_no_libm=no + ac_cv_func_obstack=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext - fi -{ echo "$as_me:$LINENO: result: $gl_cv_func_ldexp_no_libm" >&5 -echo "${ECHO_T}$gl_cv_func_ldexp_no_libm" >&6; } - if test $gl_cv_func_ldexp_no_libm = yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_func_obstack" >&5 +echo "${ECHO_T}$ac_cv_func_obstack" >&6; } +if test $ac_cv_func_obstack = yes; then cat >>confdefs.h <<\_ACEOF -#define HAVE_LDEXP_IN_LIBC 1 +#define HAVE_OBSTACK 1 _ACEOF - fi +else - { echo "$as_me:$LINENO: checking whether frexpl can be used without linking with libm" >&5 -echo $ECHO_N "checking whether frexpl can be used without linking with libm... $ECHO_C" >&6; } -if test "${gl_cv_func_frexpl_no_libm+set}" = set; then + + + + + M4_LIBOBJS="$M4_LIBOBJS obstack.$ac_objext" + +fi + + + + + + + + + + + + + + { echo "$as_me:$LINENO: checking whether frexp can be used without linking with libm" >&5 +echo $ECHO_N "checking whether frexp can be used without linking with libm... $ECHO_C" >&6; } +if test "${gl_cv_func_frexp_no_libm+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -16082,12 +17067,12 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <math.h> - long double x; + double x; int y; int main () { -return frexpl (x, &y) < 1; +return frexp (x, &y) < 1; ; return 0; } @@ -16110,34 +17095,33 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then - gl_cv_func_frexpl_no_libm=yes + gl_cv_func_frexp_no_libm=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - gl_cv_func_frexpl_no_libm=no + gl_cv_func_frexp_no_libm=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $gl_cv_func_frexpl_no_libm" >&5 -echo "${ECHO_T}$gl_cv_func_frexpl_no_libm" >&6; } - if test $gl_cv_func_frexpl_no_libm = yes; then +{ echo "$as_me:$LINENO: result: $gl_cv_func_frexp_no_libm" >&5 +echo "${ECHO_T}$gl_cv_func_frexp_no_libm" >&6; } + if test $gl_cv_func_frexp_no_libm = yes; then - { echo "$as_me:$LINENO: checking whether frexpl works" >&5 -echo $ECHO_N "checking whether frexpl works... $ECHO_C" >&6; } -if test "${gl_cv_func_frexpl_works+set}" = set; then + { echo "$as_me:$LINENO: checking whether frexp works" >&5 +echo $ECHO_N "checking whether frexp works... $ECHO_C" >&6; } +if test "${gl_cv_func_frexp_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then case "$host_os" in - aix* | beos* | darwin* | irix* | mingw* | pw*) - gl_cv_func_frexpl_works="guessing no";; - *) gl_cv_func_frexpl_works="guessing yes";; + netbsd* | irix* | mingw*) gl_cv_func_frexp_works="guessing no";; + *) gl_cv_func_frexp_works="guessing yes";; esac else @@ -16148,45 +17132,288 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +#include <float.h> #include <math.h> -extern long double frexpl (long double, int *); int main() { - volatile long double x; - /* Test on finite numbers that fails on AIX 5.1. */ - x = 16.0L; - { - int exp = -9999; - frexpl (x, &exp); - if (exp != 5) - return 1; - } - /* Test on finite numbers that fails on MacOS X 10.4, because its frexpl - function returns an invalid (incorrectly normalized) value: it returns - y = { 0x3fe028f5, 0xc28f5c28, 0x3c9eb851, 0xeb851eb8 } - but the correct result is - 0.505L = { 0x3fe028f5, 0xc28f5c29, 0xbc547ae1, 0x47ae1480 } */ - x = 1.01L; + int i; + volatile double x; + /* Test on denormalized numbers. */ + for (i = 1, x = 1.0; i >= DBL_MIN_EXP; i--, x *= 0.5) + ; + if (x > 0.0) + { + int exp; + double y = frexp (x, &exp); + /* On machines with IEEE754 arithmetic: x = 1.11254e-308, exp = -1022. + On NetBSD: y = 0.75. Correct: y = 0.5. */ + if (y != 0.5) + return 1; + } + /* Test on infinite numbers. */ + x = 1.0 / 0.0; { - int exp = -9999; - long double y = frexpl (x, &exp); - if (!(exp == 1 && y == 0.505L)) + int exp; + double y = frexp (x, &exp); + if (y != x) return 1; } - /* Test on large finite numbers. This fails on BeOS at i = 16322, while - LDBL_MAX_EXP = 16384. - In the loop end test, we test x against Infinity, rather than comparing - i with LDBL_MAX_EXP, because BeOS <float.h> has a wrong LDBL_MAX_EXP. */ - { - int i; - for (i = 1, x = 1.0L; x != x + x; i++, x *= 2.0L) - { + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gl_cv_func_frexp_works=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +gl_cv_func_frexp_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + + +fi +{ echo "$as_me:$LINENO: result: $gl_cv_func_frexp_works" >&5 +echo "${ECHO_T}$gl_cv_func_frexp_works" >&6; } + + case "$gl_cv_func_frexp_works" in + *yes) + +cat >>confdefs.h <<\_ACEOF +#define HAVE_FREXP_IN_LIBC 1 +_ACEOF + + ;; + esac + fi + + { echo "$as_me:$LINENO: checking whether ldexp can be used without linking with libm" >&5 +echo $ECHO_N "checking whether ldexp can be used without linking with libm... $ECHO_C" >&6; } +if test "${gl_cv_func_ldexp_no_libm+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <math.h> + double x; + int y; +int +main () +{ +return ldexp (x, y) < 1; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + gl_cv_func_ldexp_no_libm=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gl_cv_func_ldexp_no_libm=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + +fi +{ echo "$as_me:$LINENO: result: $gl_cv_func_ldexp_no_libm" >&5 +echo "${ECHO_T}$gl_cv_func_ldexp_no_libm" >&6; } + if test $gl_cv_func_ldexp_no_libm = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_LDEXP_IN_LIBC 1 +_ACEOF + + fi + + + + { echo "$as_me:$LINENO: checking whether frexpl can be used without linking with libm" >&5 +echo $ECHO_N "checking whether frexpl can be used without linking with libm... $ECHO_C" >&6; } +if test "${gl_cv_func_frexpl_no_libm+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <math.h> + long double x; + int y; +int +main () +{ +return frexpl (x, &y) < 1; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + gl_cv_func_frexpl_no_libm=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gl_cv_func_frexpl_no_libm=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + +fi +{ echo "$as_me:$LINENO: result: $gl_cv_func_frexpl_no_libm" >&5 +echo "${ECHO_T}$gl_cv_func_frexpl_no_libm" >&6; } + if test $gl_cv_func_frexpl_no_libm = yes; then + + + { echo "$as_me:$LINENO: checking whether frexpl works" >&5 +echo $ECHO_N "checking whether frexpl works... $ECHO_C" >&6; } +if test "${gl_cv_func_frexpl_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + if test "$cross_compiling" = yes; then + case "$host_os" in + aix* | beos* | darwin* | irix* | mingw* | pw*) + gl_cv_func_frexpl_works="guessing no";; + *) gl_cv_func_frexpl_works="guessing yes";; + esac + +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include <float.h> +#include <math.h> +/* Override the values of <float.h>, like done in float.in.h. */ +#if defined __i386__ && (defined __BEOS__ || defined __OpenBSD__) +# undef LDBL_MIN_EXP +# define LDBL_MIN_EXP (-16381) +#endif +extern long double frexpl (long double, int *); +int main() +{ + volatile long double x; + /* Test on finite numbers that fails on AIX 5.1. */ + x = 16.0L; + { + int exp = -9999; + frexpl (x, &exp); + if (exp != 5) + return 1; + } + /* Test on finite numbers that fails on MacOS X 10.4, because its frexpl + function returns an invalid (incorrectly normalized) value: it returns + y = { 0x3fe028f5, 0xc28f5c28, 0x3c9eb851, 0xeb851eb8 } + but the correct result is + 0.505L = { 0x3fe028f5, 0xc28f5c29, 0xbc547ae1, 0x47ae1480 } */ + x = 1.01L; + { + int exp = -9999; + long double y = frexpl (x, &exp); + if (!(exp == 1 && y == 0.505L)) + return 1; + } + /* Test on large finite numbers. This fails on BeOS at i = 16322, while + LDBL_MAX_EXP = 16384. + In the loop end test, we test x against Infinity, rather than comparing + i with LDBL_MAX_EXP, because BeOS <float.h> has a wrong LDBL_MAX_EXP. */ + { + int i; + for (i = 1, x = 1.0L; x != x + x; i++, x *= 2.0L) + { int exp = -9999; frexpl (x, &exp); if (exp != i) return 1; } } + /* Test on denormalized numbers. */ + { + int i; + for (i = 1, x = 1.0L; i >= LDBL_MIN_EXP; i--, x *= 0.5L) + ; + if (x > 0.0L) + { + int exp; + long double y = frexpl (x, &exp); + /* On machines with IEEE854 arithmetic: x = 1.68105e-4932, + exp = -16382, y = 0.5. On MacOS X 10.5: exp = -16384, y = 0.5. */ + if (exp != LDBL_MIN_EXP - 1) + return 1; + } + } /* Test on infinite numbers. */ x = 1.0L / 0.0L; { @@ -16508,6 +17735,13 @@ fi + + + + + + + M4_LIBOBJS="$M4_LIBOBJS quotearg.$ac_objext" @@ -16516,6 +17750,7 @@ fi + { echo "$as_me:$LINENO: checking for mbstate_t" >&5 echo $ECHO_N "checking for mbstate_t... $ECHO_C" >&6; } if test "${ac_cv_type_mbstate_t+set}" = set; then @@ -16940,7 +18175,16 @@ cat >>confdefs.h <<\_ACEOF #define regfree rpl_regfree _ACEOF - M4_LIBOBJS="$M4_LIBOBJS regex.$ac_objext" + + + + + + + + M4_LIBOBJS="$M4_LIBOBJS regex.$ac_objext" + + @@ -17100,7 +18344,18 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <math.h> +/* If signbit is defined as a function, don't use it, since calling it for + 'float' or 'long double' arguments would involve conversions. + If signbit is not declared at all but exists as a library function, don't + use it, since the prototype may not match. + If signbit is not declared at all but exists as a compiler built-in, don't + use it, since it's preferable to use __builtin_signbit* (no warnings, + no conversions). */ +#ifndef signbit +# error "signbit should be a macro" +#endif #include <string.h> + float p0f = 0.0f; float m0f = -0.0f; double p0d = 0.0; @@ -17144,6 +18399,8 @@ int main () } return 0; } + + _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" @@ -17182,11 +18439,147 @@ fi fi { echo "$as_me:$LINENO: result: $gl_cv_func_signbit" >&5 echo "${ECHO_T}$gl_cv_func_signbit" >&6; } - if test "$gl_cv_func_signbit" != yes; then - REPLACE_SIGNBIT=1 - M4_LIBOBJS="$M4_LIBOBJS signbitf.$ac_objext" - M4_LIBOBJS="$M4_LIBOBJS signbitd.$ac_objext" - M4_LIBOBJS="$M4_LIBOBJS signbitl.$ac_objext" + { echo "$as_me:$LINENO: checking for signbit compiler built-ins" >&5 +echo $ECHO_N "checking for signbit compiler built-ins... $ECHO_C" >&6; } +if test "${gl_cv_func_signbit_gcc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + if test "$cross_compiling" = yes; then + gl_cv_func_signbit_gcc="guessing no" +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#if __GNUC__ >= 4 +# define signbit(x) \ + (sizeof (x) == sizeof (long double) ? __builtin_signbitl (x) : \ + sizeof (x) == sizeof (double) ? __builtin_signbit (x) : \ + __builtin_signbitf (x)) +#else +# error "signbit should be three compiler built-ins" +#endif +#include <string.h> + +float p0f = 0.0f; +float m0f = -0.0f; +double p0d = 0.0; +double m0d = -0.0; +long double p0l = 0.0L; +long double m0l = -0.0L; +int main () +{ + { + float plus_inf = 1.0f / p0f; + float minus_inf = -1.0f / p0f; + if (!(!signbit (255.0f) + && signbit (-255.0f) + && !signbit (p0f) + && (memcmp (&m0f, &p0f, sizeof (float)) == 0 || signbit (m0f)) + && !signbit (plus_inf) + && signbit (minus_inf))) + return 1; + } + { + double plus_inf = 1.0 / p0d; + double minus_inf = -1.0 / p0d; + if (!(!signbit (255.0) + && signbit (-255.0) + && !signbit (p0d) + && (memcmp (&m0d, &p0d, sizeof (double)) == 0 || signbit (m0d)) + && !signbit (plus_inf) + && signbit (minus_inf))) + return 1; + } + { + long double plus_inf = 1.0L / p0l; + long double minus_inf = -1.0L / p0l; + if (!(!signbit (255.0L) + && signbit (-255.0L) + && !signbit (p0l) + && (memcmp (&m0l, &p0l, sizeof (long double)) == 0 || signbit (m0l)) + && !signbit (plus_inf) + && signbit (minus_inf))) + return 1; + } + return 0; +} + + +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gl_cv_func_signbit_gcc=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +gl_cv_func_signbit_gcc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + + +fi +{ echo "$as_me:$LINENO: result: $gl_cv_func_signbit_gcc" >&5 +echo "${ECHO_T}$gl_cv_func_signbit_gcc" >&6; } + if test "$gl_cv_func_signbit_gcc" = yes; then + REPLACE_SIGNBIT_USING_GCC=1 + else + if test "$gl_cv_func_signbit" != yes; then + REPLACE_SIGNBIT=1 + + + + + + + + M4_LIBOBJS="$M4_LIBOBJS signbitf.$ac_objext" + + + + + + + + + M4_LIBOBJS="$M4_LIBOBJS signbitd.$ac_objext" + + + + + + + + + M4_LIBOBJS="$M4_LIBOBJS signbitl.$ac_objext" + { echo "$as_me:$LINENO: checking where to find the sign bit in a 'float'" >&5 @@ -17577,8 +18970,8 @@ _ACEOF esac - if test "$gl_cv_cc_float_signbit" = unknown; then - { echo "$as_me:$LINENO: checking whether copysignf is declared" >&5 + if test "$gl_cv_cc_float_signbit" = unknown; then + { echo "$as_me:$LINENO: checking whether copysignf is declared" >&5 echo $ECHO_N "checking whether copysignf is declared... $ECHO_C" >&6; } if test "${ac_cv_have_decl_copysignf+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -17647,21 +19040,21 @@ _ACEOF fi - if test "$ac_cv_have_decl_copysignf" = yes; then - { echo "$as_me:$LINENO: checking whether copysignf can be used without linking with libm" >&5 + if test "$ac_cv_have_decl_copysignf" = yes; then + { echo "$as_me:$LINENO: checking whether copysignf can be used without linking with libm" >&5 echo $ECHO_N "checking whether copysignf can be used without linking with libm... $ECHO_C" >&6; } if test "${gl_cv_func_copysignf_no_libm+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <math.h> - float x, y; + float x, y; int main () { @@ -17702,17 +19095,17 @@ rm -f core conftest.err conftest.$ac_obj fi { echo "$as_me:$LINENO: result: $gl_cv_func_copysignf_no_libm" >&5 echo "${ECHO_T}$gl_cv_func_copysignf_no_libm" >&6; } - if test $gl_cv_func_copysignf_no_libm = yes; then + if test $gl_cv_func_copysignf_no_libm = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_COPYSIGNF_IN_LIBC 1 _ACEOF + fi fi fi - fi - if test "$gl_cv_cc_double_signbit" = unknown; then - { echo "$as_me:$LINENO: checking whether copysign is declared" >&5 + if test "$gl_cv_cc_double_signbit" = unknown; then + { echo "$as_me:$LINENO: checking whether copysign is declared" >&5 echo $ECHO_N "checking whether copysign is declared... $ECHO_C" >&6; } if test "${ac_cv_have_decl_copysign+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -17781,21 +19174,21 @@ _ACEOF fi - if test "$ac_cv_have_decl_copysign" = yes; then - { echo "$as_me:$LINENO: checking whether copysign can be used without linking with libm" >&5 + if test "$ac_cv_have_decl_copysign" = yes; then + { echo "$as_me:$LINENO: checking whether copysign can be used without linking with libm" >&5 echo $ECHO_N "checking whether copysign can be used without linking with libm... $ECHO_C" >&6; } if test "${gl_cv_func_copysign_no_libm+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <math.h> - double x, y; + double x, y; int main () { @@ -17836,17 +19229,17 @@ rm -f core conftest.err conftest.$ac_obj fi { echo "$as_me:$LINENO: result: $gl_cv_func_copysign_no_libm" >&5 echo "${ECHO_T}$gl_cv_func_copysign_no_libm" >&6; } - if test $gl_cv_func_copysign_no_libm = yes; then + if test $gl_cv_func_copysign_no_libm = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_COPYSIGN_IN_LIBC 1 _ACEOF + fi fi fi - fi - if test "$gl_cv_cc_long_double_signbit" = unknown; then - { echo "$as_me:$LINENO: checking whether copysignl is declared" >&5 + if test "$gl_cv_cc_long_double_signbit" = unknown; then + { echo "$as_me:$LINENO: checking whether copysignl is declared" >&5 echo $ECHO_N "checking whether copysignl is declared... $ECHO_C" >&6; } if test "${ac_cv_have_decl_copysignl+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -17915,21 +19308,21 @@ _ACEOF fi - if test "$ac_cv_have_decl_copysignl" = yes; then - { echo "$as_me:$LINENO: checking whether copysignl can be used without linking with libm" >&5 + if test "$ac_cv_have_decl_copysignl" = yes; then + { echo "$as_me:$LINENO: checking whether copysignl can be used without linking with libm" >&5 echo $ECHO_N "checking whether copysignl can be used without linking with libm... $ECHO_C" >&6; } if test "${gl_cv_func_copysignl_no_libm+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <math.h> - long double x, y; + long double x, y; int main () { @@ -17970,12 +19363,13 @@ rm -f core conftest.err conftest.$ac_obj fi { echo "$as_me:$LINENO: result: $gl_cv_func_copysignl_no_libm" >&5 echo "${ECHO_T}$gl_cv_func_copysignl_no_libm" >&6; } - if test $gl_cv_func_copysignl_no_libm = yes; then + if test $gl_cv_func_copysignl_no_libm = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_COPYSIGNL_IN_LIBC 1 _ACEOF + fi fi fi fi @@ -17987,9 +19381,6 @@ _ACEOF - - - signals_not_posix= cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -18097,7 +19488,15 @@ fi fi if test -z "$gl_cv_func_sigprocmask"; then HAVE_POSIX_SIGNALBLOCKING=0 - M4_LIBOBJS="$M4_LIBOBJS sigprocmask.$ac_objext" + + + + + + + + M4_LIBOBJS="$M4_LIBOBJS sigprocmask.$ac_objext" + { echo "$as_me:$LINENO: checking for sigset_t" >&5 @@ -19113,6 +20512,8 @@ _ACEOF fi + STDARG_H=''; + NEXT_STDARG_H='<stdarg.h>'; { echo "$as_me:$LINENO: checking for va_copy" >&5 echo $ECHO_N "checking for va_copy... $ECHO_C" >&6; } if test "${gl_cv_func_va_copy+set}" = set; then @@ -19169,12 +20570,85 @@ fi { echo "$as_me:$LINENO: result: $gl_cv_func_va_copy" >&5 echo "${ECHO_T}$gl_cv_func_va_copy" >&6; } if test $gl_cv_func_va_copy = no; then - # Provide a substitute, either __va_copy or as a simple assignment. - if test "${gl_cv_func___va_copy+set}" = set; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#if defined _AIX && !defined __GNUC__ + AIX vaccine + #endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "vaccine" >/dev/null 2>&1; then + gl_aixcc=yes +else + gl_aixcc=no +fi +rm -f conftest* + + if test $gl_aixcc = yes; then + STDARG_H=stdarg.h + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_stdarg_h='<'stdarg.h'>' + else + { echo "$as_me:$LINENO: checking absolute name of <stdarg.h>" >&5 +echo $ECHO_N "checking absolute name of <stdarg.h>... $ECHO_C" >&6; } +if test "${gl_cv_next_stdarg_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + if test $ac_cv_header_stdarg_h = yes; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <stdarg.h> + +_ACEOF + gl_cv_next_stdarg_h='"'`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | + sed -n '\#/stdarg.h#{ + s#.*"\(.*/stdarg.h\)".*#\1# + s#^/[^/]#//&# + p + q + }'`'"' + else + gl_cv_next_stdarg_h='<'stdarg.h'>' + fi + +fi +{ echo "$as_me:$LINENO: result: $gl_cv_next_stdarg_h" >&5 +echo "${ECHO_T}$gl_cv_next_stdarg_h" >&6; } + fi + NEXT_STDARG_H=$gl_cv_next_stdarg_h + + + + if test "$gl_cv_next_stdarg_h" = '""'; then + gl_cv_next_stdarg_h='"///usr/include/stdarg.h"' + NEXT_STDARG_H="$gl_cv_next_stdarg_h" + fi + else + if test "${gl_cv_func___va_copy+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -19221,13 +20695,13 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi - if test $gl_cv_func___va_copy = yes; then + if test $gl_cv_func___va_copy = yes; then cat >>confdefs.h <<\_ACEOF #define va_copy __va_copy _ACEOF - else + else @@ -19235,6 +20709,7 @@ cat >>confdefs.h <<\_ACEOF #define va_copy gl_va_copy _ACEOF + fi fi fi @@ -19358,6 +20833,16 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */ +#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */ +#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ +#include <stdint.h> +/* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in <wchar.h>. */ +#if !(defined WCHAR_MIN && defined WCHAR_MAX) +#error "WCHAR_MIN, WCHAR_MAX not defined in <stdint.h>" +#endif + + /* BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be included before <wchar.h>. */ #include <stddef.h> @@ -19369,10 +20854,6 @@ cat >>conftest.$ac_ext <<_ACEOF #endif -#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */ -#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */ -#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ -#include <stdint.h> #ifdef INT8_MAX int8_t a1 = INT8_MAX; int8_t a1min = INT8_MIN; @@ -20311,160 +21792,34 @@ _ACEOF - { echo "$as_me:$LINENO: checking for wchar_t" >&5 -echo $ECHO_N "checking for wchar_t... $ECHO_C" >&6; } -if test "${gt_cv_c_wchar_t+set}" = set; then + + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_stdio_h='<'stdio.h'>' + else + { echo "$as_me:$LINENO: checking absolute name of <stdio.h>" >&5 +echo $ECHO_N "checking absolute name of <stdio.h>... $ECHO_C" >&6; } +if test "${gl_cv_next_stdio_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + + if test $ac_cv_header_stdio_h = yes; then + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <stddef.h> - wchar_t foo = (wchar_t)'\0'; -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - gt_cv_c_wchar_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - gt_cv_c_wchar_t=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $gt_cv_c_wchar_t" >&5 -echo "${ECHO_T}$gt_cv_c_wchar_t" >&6; } - if test $gt_cv_c_wchar_t = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_WCHAR_T 1 -_ACEOF - - fi - - - { echo "$as_me:$LINENO: checking for wint_t" >&5 -echo $ECHO_N "checking for wint_t... $ECHO_C" >&6; } -if test "${gt_cv_c_wint_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before - <wchar.h>. - BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be included - before <wchar.h>. */ -#include <stddef.h> -#include <stdio.h> -#include <time.h> -#include <wchar.h> - wint_t foo = (wchar_t)'\0'; -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - gt_cv_c_wint_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - gt_cv_c_wint_t=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $gt_cv_c_wint_t" >&5 -echo "${ECHO_T}$gt_cv_c_wint_t" >&6; } - if test $gt_cv_c_wint_t = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_WINT_T 1 -_ACEOF - - fi - - - - - - - - - - - - - - if test $gl_cv_have_include_next = yes; then - gl_cv_next_stdio_h='<'stdio.h'>' - else - { echo "$as_me:$LINENO: checking absolute name of <stdio.h>" >&5 -echo $ECHO_N "checking absolute name of <stdio.h>... $ECHO_C" >&6; } -if test "${gl_cv_next_stdio_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - if test $ac_cv_header_stdio_h = yes; then - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <stdio.h> +#include <stdio.h> _ACEOF gl_cv_next_stdio_h='"'`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | @@ -20539,105 +21894,127 @@ echo "${ECHO_T}$gl_cv_next_stdlib_h" >&6 + + + + + + + M4_LIBOBJS="$M4_LIBOBJS mkstemp-safer.$ac_objext" -for ac_func in strtol -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } -if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + + if test $gl_cv_func_working_strerror = no; then + + + + + + + + M4_LIBOBJS="$M4_LIBOBJS strerror.$ac_objext" + + +cat >>confdefs.h <<_ACEOF +#define REPLACE_STRERROR $REPLACE_STRERROR +_ACEOF + + fi + + + + GNULIB_STRERROR=1 + + + + + + + { echo "$as_me:$LINENO: checking whether strstr works in linear time" >&5 +echo $ECHO_N "checking whether strstr works in linear time... $ECHO_C" >&6; } +if test "${gl_cv_func_strstr_linear+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else + if test "$cross_compiling" = yes; then + gl_cv_func_strstr_linear="guessing no" +else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. - For example, HP-UX 11i <limits.h> declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer <limits.h> to <assert.h> if __STDC__ is defined, since - <limits.h> exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include <limits.h> -#else -# include <assert.h> -#endif - -#undef $ac_func -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$ac_func || defined __stub___$ac_func -choke me -#endif +#include <string.h> /* for memmem */ +#include <stdlib.h> /* for malloc */ +#include <unistd.h> /* for alarm */ int main () { -return $ac_func (); +size_t m = 1000000; + char *haystack = (char *) malloc (2 * m + 2); + char *needle = (char *) malloc (m + 2); + void *result = 0; + /* Failure to compile this test due to missing alarm is okay, + since all such platforms (mingw) also have quadratic strstr. */ + alarm (5); + /* Check for quadratic performance. */ + if (haystack && needle) + { + memset (haystack, 'A', 2 * m); + haystack[2 * m] = 'B'; + haystack[2 * m + 1] = 0; + memset (needle, 'A', m); + needle[m] = 'B'; + needle[m + 1] = 0; + result = strstr (haystack, needle); + } + return !result; ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext +rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 + (eval "$ac_link") 2>&5 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - eval "$as_ac_var=yes" + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gl_cv_func_strstr_linear=yes else - echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - eval "$as_ac_var=no" +( exit $ac_status ) +gl_cv_func_strstr_linear=no fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi -ac_res=`eval echo '${'$as_ac_var'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF -else - M4_LIBOBJS="$M4_LIBOBJS $ac_func.$ac_objext" -fi -done +fi +{ echo "$as_me:$LINENO: result: $gl_cv_func_strstr_linear" >&5 +echo "${ECHO_T}$gl_cv_func_strstr_linear" >&6; } + if test "$gl_cv_func_strstr_linear" != yes; then + REPLACE_STRSTR=1 @@ -20645,113 +22022,165 @@ done + M4_LIBOBJS="$M4_LIBOBJS strstr.$ac_objext" - if test $ac_cv_func_lstat = yes; then - HAVE_LSTAT=1 - else - HAVE_LSTAT=0 fi - { echo "$as_me:$LINENO: checking whether mkdir is declared" >&5 -echo $ECHO_N "checking whether mkdir is declared... $ECHO_C" >&6; } -if test "${ac_cv_have_decl_mkdir+set}" = set; then + + GNULIB_STRSTR=1 + + + + { echo "$as_me:$LINENO: checking for working strtod" >&5 +echo $ECHO_N "checking for working strtod... $ECHO_C" >&6; } +if test "${ac_cv_func_strtod+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else + if test "$cross_compiling" = yes; then + ac_cv_func_strtod=no +else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <sys/stat.h> +$ac_includes_default +#ifndef strtod +double strtod (); +#endif int -main () +main() { -#ifndef mkdir - (void) mkdir; -#endif + { + /* Some versions of Linux strtod mis-parse strings with leading '+'. */ + char *string = " +69"; + char *term; + double value; + value = strtod (string, &term); + if (value != 69 || term != (string + 4)) + return 1; + } - ; + { + /* Under Solaris 2.4, strtod returns the wrong value for the + terminating character under some conditions. */ + char *string = "NaN"; + char *term; + strtod (string, &term); + if (term != string && *(term - 1) == 0) + return 1; + } return 0; } + _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 + (eval "$ac_link") 2>&5 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_have_decl_mkdir=yes + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_strtod=yes else - echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_have_decl_mkdir=no +( exit $ac_status ) +ac_cv_func_strtod=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi -{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_mkdir" >&5 -echo "${ECHO_T}$ac_cv_have_decl_mkdir" >&6; } -if test $ac_cv_have_decl_mkdir = yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_func_strtod" >&5 +echo "${ECHO_T}$ac_cv_func_strtod" >&6; } +if test $ac_cv_func_strtod = no; then -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_MKDIR 1 -_ACEOF -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_MKDIR 0 -_ACEOF -for ac_header in io.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - { echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + + + M4_LIBOBJS="$M4_LIBOBJS strtod.$ac_objext" + +{ echo "$as_me:$LINENO: checking for pow" >&5 +echo $ECHO_N "checking for pow... $ECHO_C" >&6; } +if test "${ac_cv_func_pow+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } else - # Is the header compilable? -{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> +/* Define pow to an innocuous variant, in case <limits.h> declares pow. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define pow innocuous_pow + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char pow (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + +#undef pow + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char pow (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_pow || defined __stub___pow +choke me +#endif + +int +main () +{ +return pow (); + ; + return 0; +} _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -20760,277 +22189,361 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_func_pow=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_header_compiler=no + ac_cv_func_pow=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_func_pow" >&5 +echo "${ECHO_T}$ac_cv_func_pow" >&6; } -# Is the header present? -{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } +if test $ac_cv_func_pow = no; then + { echo "$as_me:$LINENO: checking for pow in -lm" >&5 +echo $ECHO_N "checking for pow in -lm... $ECHO_C" >&6; } +if test "${ac_cv_lib_m_pow+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lm $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <$ac_header> + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char pow (); +int +main () +{ +return pow (); + ; + return 0; +} _ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || test ! -s conftest.err - }; then - ac_header_preproc=yes + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_lib_m_pow=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_header_preproc=no + ac_cv_lib_m_pow=no fi -rm -f conftest.err conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( cat <<\_ASBOX -## ----------------------------- ## -## Report this to bug-m4@gnu.org ## -## ----------------------------- ## -_ASBOX - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -{ echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } - +{ echo "$as_me:$LINENO: result: $ac_cv_lib_m_pow" >&5 +echo "${ECHO_T}$ac_cv_lib_m_pow" >&6; } +if test $ac_cv_lib_m_pow = yes; then + POW_LIB=-lm +else + { echo "$as_me:$LINENO: WARNING: cannot find library containing definition of pow" >&5 +echo "$as_me: WARNING: cannot find library containing definition of pow" >&2;} fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF fi -done - fi - - if test $ac_cv_have_decl_mkdir = yes; then - HAVE_DECL_MKDIR=1 - else - HAVE_DECL_MKDIR=0 - fi - - if test "$ac_cv_header_io_h" = yes; then - HAVE_IO_H=1 + if test $ac_cv_func_strtod = no; then + HAVE_STRTOD=0 + REPLACE_STRTOD=1 + : else - HAVE_IO_H=0 - fi - - - - - - - - - - - - - - - - if test $gl_cv_have_include_next = yes; then - gl_cv_next_sys_stat_h='<'sys/stat.h'>' - else - { echo "$as_me:$LINENO: checking absolute name of <sys/stat.h>" >&5 -echo $ECHO_N "checking absolute name of <sys/stat.h>... $ECHO_C" >&6; } -if test "${gl_cv_next_sys_stat_h+set}" = set; then + { echo "$as_me:$LINENO: checking whether strtod obeys C99" >&5 +echo $ECHO_N "checking whether strtod obeys C99... $ECHO_C" >&6; } +if test "${gl_cv_func_strtod_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - - if test $ac_cv_header_sys_stat_h = yes; then - cat >conftest.$ac_ext <<_ACEOF + if test "$cross_compiling" = yes; then + gl_cv_func_strtod_works="guessing no" +else + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <sys/stat.h> - -_ACEOF - gl_cv_next_sys_stat_h='"'`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | - sed -n '\#/sys/stat.h#{ - s#.*"\(.*/sys/stat.h\)".*#\1# - s#^/[^/]#//&# - p - q - }'`'"' - else - gl_cv_next_sys_stat_h='<'sys/stat.h'>' - fi - -fi -{ echo "$as_me:$LINENO: result: $gl_cv_next_sys_stat_h" >&5 -echo "${ECHO_T}$gl_cv_next_sys_stat_h" >&6; } - fi - NEXT_SYS_STAT_H=$gl_cv_next_sys_stat_h +#include <stdlib.h> +#include <math.h> +int +main () +{ - SYS_STAT_H='sys/stat.h' + { + /* Older glibc and Cygwin mis-parse "-0x". */ + char *string = "-0x"; + char *term; + double value = strtod (string, &term); + if (1 / value != -HUGE_VAL || term != (string + 2)) + return 1; + } + { + /* Many platforms do not parse infinities. */ + char *string = "inf"; + char *term; + double value = strtod (string, &term); + if (value != HUGE_VAL || term != (string + 3)) + return 1; + } + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gl_cv_func_strtod_works=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +gl_cv_func_strtod_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi - { echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5 -echo $ECHO_N "checking for a thread-safe mkdir -p... $ECHO_C" >&6; } -if test -z "$MKDIR_P"; then - if test "${ac_cv_path_mkdir+set}" = set; then +fi +{ echo "$as_me:$LINENO: result: $gl_cv_func_strtod_works" >&5 +echo "${ECHO_T}$gl_cv_func_strtod_works" >&6; } + if test "$gl_cv_func_strtod_works" != yes; then + REPLACE_STRTOD=1 + : + + + + + + + + M4_LIBOBJS="$M4_LIBOBJS strtod.$ac_objext" + +{ echo "$as_me:$LINENO: checking for pow" >&5 +echo $ECHO_N "checking for pow... $ECHO_C" >&6; } +if test "${ac_cv_func_pow+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in mkdir gmkdir; do - for ac_exec_ext in '' $ac_executable_extensions; do - { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue - case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( - 'mkdir (GNU coreutils) '* | \ - 'mkdir (coreutils) '* | \ - 'mkdir (fileutils) '4.1*) - ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext - break 3;; - esac - done - done -done -IFS=$as_save_IFS + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define pow to an innocuous variant, in case <limits.h> declares pow. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define pow innocuous_pow + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char pow (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + +#undef pow + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char pow (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_pow || defined __stub___pow +choke me +#endif + +int +main () +{ +return pow (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_func_pow=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_func_pow=no fi - if test "${ac_cv_path_mkdir+set}" = set; then - MKDIR_P="$ac_cv_path_mkdir -p" - else - # As a last resort, use the slow shell script. Don't cache a - # value for MKDIR_P within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - test -d ./--version && rmdir ./--version - MKDIR_P="$ac_install_sh -d" - fi +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $MKDIR_P" >&5 -echo "${ECHO_T}$MKDIR_P" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_func_pow" >&5 +echo "${ECHO_T}$ac_cv_func_pow" >&6; } +if test $ac_cv_func_pow = no; then + { echo "$as_me:$LINENO: checking for pow in -lm" >&5 +echo $ECHO_N "checking for pow in -lm... $ECHO_C" >&6; } +if test "${ac_cv_lib_m_pow+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lm $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char pow (); +int +main () +{ +return pow (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_lib_m_pow=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_lib_m_pow=no +fi - { echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5 -echo $ECHO_N "checking for a thread-safe mkdir -p... $ECHO_C" >&6; } -if test -z "$MKDIR_P"; then - if test "${ac_cv_path_mkdir+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_m_pow" >&5 +echo "${ECHO_T}$ac_cv_lib_m_pow" >&6; } +if test $ac_cv_lib_m_pow = yes; then + POW_LIB=-lm else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in mkdir gmkdir; do - for ac_exec_ext in '' $ac_executable_extensions; do - { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue - case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( - 'mkdir (GNU coreutils) '* | \ - 'mkdir (coreutils) '* | \ - 'mkdir (fileutils) '4.1*) - ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext - break 3;; - esac - done - done -done -IFS=$as_save_IFS + { echo "$as_me:$LINENO: WARNING: cannot find library containing definition of pow" >&5 +echo "$as_me: WARNING: cannot find library containing definition of pow" >&2;} +fi fi - if test "${ac_cv_path_mkdir+set}" = set; then - MKDIR_P="$ac_cv_path_mkdir -p" - else - # As a last resort, use the slow shell script. Don't cache a - # value for MKDIR_P within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - test -d ./--version && rmdir ./--version - MKDIR_P="$ac_install_sh -d" + fi fi -fi -{ echo "$as_me:$LINENO: result: $MKDIR_P" >&5 -echo "${ECHO_T}$MKDIR_P" >&6; } + GNULIB_STRTOD=1 - M4_LIBOBJS="$M4_LIBOBJS tempname.$ac_objext" - : -for ac_func in __secure_getenv + + + + +for ac_func in strtol do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_func" >&5 @@ -21120,11 +22633,12 @@ if test `eval echo '${'$as_ac_var'}'` = #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF -fi -done - +else + M4_LIBOBJS="$M4_LIBOBJS $ac_func.$ac_objext" +fi +done @@ -21135,193 +22649,103 @@ done + if test $ac_cv_func_lstat = yes; then + HAVE_LSTAT=1 + else + HAVE_LSTAT=0 + fi - if test $gl_cv_have_include_next = yes; then - gl_cv_next_unistd_h='<'unistd.h'>' - else - { echo "$as_me:$LINENO: checking absolute name of <unistd.h>" >&5 -echo $ECHO_N "checking absolute name of <unistd.h>... $ECHO_C" >&6; } -if test "${gl_cv_next_unistd_h+set}" = set; then + { echo "$as_me:$LINENO: checking whether mkdir is declared" >&5 +echo $ECHO_N "checking whether mkdir is declared... $ECHO_C" >&6; } +if test "${ac_cv_have_decl_mkdir+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - - if test $ac_cv_header_unistd_h = yes; then - cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <unistd.h> +#include <sys/stat.h> + +int +main () +{ +#ifndef mkdir + (void) mkdir; +#endif + ; + return 0; +} _ACEOF - gl_cv_next_unistd_h='"'`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | - sed -n '\#/unistd.h#{ - s#.*"\(.*/unistd.h\)".*#\1# - s#^/[^/]#//&# - p - q - }'`'"' - else - gl_cv_next_unistd_h='<'unistd.h'>' - fi +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl_mkdir=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_have_decl_mkdir=no fi -{ echo "$as_me:$LINENO: result: $gl_cv_next_unistd_h" >&5 -echo "${ECHO_T}$gl_cv_next_unistd_h" >&6; } - fi - NEXT_UNISTD_H=$gl_cv_next_unistd_h - - - - - - - - - - - if test $ac_cv_header_unistd_h = yes; then - HAVE_UNISTD_H=1 - else - HAVE_UNISTD_H=0 - fi - - - - - - - - - - M4_LIBOBJS="$M4_LIBOBJS dup-safer.$ac_objext" - M4_LIBOBJS="$M4_LIBOBJS fd-safer.$ac_objext" - M4_LIBOBJS="$M4_LIBOBJS pipe-safer.$ac_objext" - +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_mkdir" >&5 +echo "${ECHO_T}$ac_cv_have_decl_mkdir" >&6; } +if test $ac_cv_have_decl_mkdir = yes; then -cat >>confdefs.h <<\_ACEOF -#define USE_UNLOCKED_IO 1 +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_MKDIR 1 _ACEOF - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if test $ac_cv_func_vasnprintf = no; then - - - - - - - - M4_LIBOBJS="$M4_LIBOBJS vasnprintf.$ac_objext" - M4_LIBOBJS="$M4_LIBOBJS printf-args.$ac_objext" - M4_LIBOBJS="$M4_LIBOBJS printf-parse.$ac_objext" - M4_LIBOBJS="$M4_LIBOBJS asnprintf.$ac_objext" - if test $ac_cv_func_vasnprintf = yes; then - -cat >>confdefs.h <<\_ACEOF -#define REPLACE_VASNPRINTF 1 +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_MKDIR 0 _ACEOF - fi - - - - - - - - - - { echo "$as_me:$LINENO: checking for ptrdiff_t" >&5 -echo $ECHO_N "checking for ptrdiff_t... $ECHO_C" >&6; } -if test "${ac_cv_type_ptrdiff_t+set}" = set; then +for ac_header in io.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } else - cat >conftest.$ac_ext <<_ACEOF + # Is the header compilable? +{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -typedef ptrdiff_t ac__type_new_; -int -main () -{ -if ((ac__type_new_ *) 0) - return 0; -if (sizeof (ac__type_new_)) - return 0; - ; - return 0; -} +#include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" @@ -21340,322 +22764,267 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_cv_type_ptrdiff_t=yes + ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_type_ptrdiff_t=no + ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_type_ptrdiff_t" >&5 -echo "${ECHO_T}$ac_cv_type_ptrdiff_t" >&6; } -if test $ac_cv_type_ptrdiff_t = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_PTRDIFF_T 1 -_ACEOF - - -fi - - - - - - - - - +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } -for ac_func in snprintf wcslen -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } -if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF +# Is the header present? +{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. - For example, HP-UX 11i <limits.h> declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer <limits.h> to <assert.h> if __STDC__ is defined, since - <limits.h> exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include <limits.h> -#else -# include <assert.h> -#endif - -#undef $ac_func - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$ac_func || defined __stub___$ac_func -choke me -#endif - -int -main () -{ -return $ac_func (); - ; - return 0; -} +#include <$ac_header> _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" +if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - eval "$as_ac_var=yes" + }; then + ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - eval "$as_ac_var=no" + ac_header_preproc=no fi -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## ----------------------------- ## +## Report this to bug-m4@gnu.org ## +## ----------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" fi -ac_res=`eval echo '${'$as_ac_var'}'` +ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } -if test `eval echo '${'$as_ac_var'}'` = yes; then + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi + done - { echo "$as_me:$LINENO: checking whether _snprintf is declared" >&5 -echo $ECHO_N "checking whether _snprintf is declared... $ECHO_C" >&6; } -if test "${ac_cv_have_decl__snprintf+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <stdio.h> +fi -int -main () -{ -#ifndef _snprintf - (void) _snprintf; -#endif - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_have_decl__snprintf=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + if test $ac_cv_have_decl_mkdir = yes; then + HAVE_DECL_MKDIR=1 + else + HAVE_DECL_MKDIR=0 + fi - ac_cv_have_decl__snprintf=no -fi + if test "$ac_cv_header_io_h" = yes; then + HAVE_IO_H=1 + else + HAVE_IO_H=0 + fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_have_decl__snprintf" >&5 -echo "${ECHO_T}$ac_cv_have_decl__snprintf" >&6; } -if test $ac_cv_have_decl__snprintf = yes; then -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL__SNPRINTF 1 -_ACEOF -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL__SNPRINTF 0 -_ACEOF -fi - fi -for ac_func in vasprintf -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } -if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + if test $gl_cv_have_include_next = yes; then + gl_cv_next_sys_stat_h='<'sys/stat.h'>' + else + { echo "$as_me:$LINENO: checking absolute name of <sys/stat.h>" >&5 +echo $ECHO_N "checking absolute name of <sys/stat.h>... $ECHO_C" >&6; } +if test "${gl_cv_next_sys_stat_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + + if test $ac_cv_header_sys_stat_h = yes; then + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. - For example, HP-UX 11i <limits.h> declares gettimeofday. */ -#define $ac_func innocuous_$ac_func +#include <sys/stat.h> -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer <limits.h> to <assert.h> if __STDC__ is defined, since - <limits.h> exists even on freestanding compilers. */ +_ACEOF + gl_cv_next_sys_stat_h='"'`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | + sed -n '\#/sys/stat.h#{ + s#.*"\(.*/sys/stat.h\)".*#\1# + s#^/[^/]#//&# + p + q + }'`'"' + else + gl_cv_next_sys_stat_h='<'sys/stat.h'>' + fi -#ifdef __STDC__ -# include <limits.h> -#else -# include <assert.h> -#endif +fi +{ echo "$as_me:$LINENO: result: $gl_cv_next_sys_stat_h" >&5 +echo "${ECHO_T}$gl_cv_next_sys_stat_h" >&6; } + fi + NEXT_SYS_STAT_H=$gl_cv_next_sys_stat_h -#undef $ac_func -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$ac_func || defined __stub___$ac_func -choke me -#endif -int -main () -{ -return $ac_func (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - eval "$as_ac_var=no" -fi + SYS_STAT_H='sys/stat.h' -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -fi -ac_res=`eval echo '${'$as_ac_var'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF -fi + { echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5 +echo $ECHO_N "checking for a thread-safe mkdir -p... $ECHO_C" >&6; } +if test -z "$MKDIR_P"; then + if test "${ac_cv_path_mkdir+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in mkdir gmkdir; do + for ac_exec_ext in '' $ac_executable_extensions; do + { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue + case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir (GNU coreutils) '* | \ + 'mkdir (coreutils) '* | \ + 'mkdir (fileutils) '4.1*) + ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext + break 3;; + esac + done + done done +IFS=$as_save_IFS - if test $ac_cv_func_vasprintf = no; then - - M4_LIBOBJS="$M4_LIBOBJS vasprintf.$ac_objext" - M4_LIBOBJS="$M4_LIBOBJS asprintf.$ac_objext" +fi - if test $ac_cv_func_vasprintf = yes; then - REPLACE_VASPRINTF=1 + if test "${ac_cv_path_mkdir+set}" = set; then + MKDIR_P="$ac_cv_path_mkdir -p" else - HAVE_VASPRINTF=0 + # As a last resort, use the slow shell script. Don't cache a + # value for MKDIR_P within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + test -d ./--version && rmdir ./--version + MKDIR_P="$ac_install_sh -d" fi +fi +{ echo "$as_me:$LINENO: result: $MKDIR_P" >&5 +echo "${ECHO_T}$MKDIR_P" >&6; } + { echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5 +echo $ECHO_N "checking for a thread-safe mkdir -p... $ECHO_C" >&6; } +if test -z "$MKDIR_P"; then + if test "${ac_cv_path_mkdir+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in mkdir gmkdir; do + for ac_exec_ext in '' $ac_executable_extensions; do + { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue + case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir (GNU coreutils) '* | \ + 'mkdir (coreutils) '* | \ + 'mkdir (fileutils) '4.1*) + ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext + break 3;; + esac + done + done +done +IFS=$as_save_IFS +fi - - + if test "${ac_cv_path_mkdir+set}" = set; then + MKDIR_P="$ac_cv_path_mkdir -p" + else + # As a last resort, use the slow shell script. Don't cache a + # value for MKDIR_P within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + test -d ./--version && rmdir ./--version + MKDIR_P="$ac_install_sh -d" fi +fi +{ echo "$as_me:$LINENO: result: $MKDIR_P" >&5 +echo "${ECHO_T}$MKDIR_P" >&6; } - GNULIB_VASPRINTF=1 @@ -21664,14 +23033,15 @@ done + M4_LIBOBJS="$M4_LIBOBJS tempname.$ac_objext" + : - gl_cv_func_vasprintf_posix=no -for ac_func in vasprintf +for ac_func in __secure_getenv do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_func" >&5 @@ -21764,248 +23134,183 @@ _ACEOF fi done - case "$gl_cv_func_printf_sizes_c99" in - *yes) - case "$gl_cv_func_printf_long_double" in - *yes) - case "$gl_cv_func_printf_infinite" in - *yes) - case "$gl_cv_func_printf_infinite_long_double" in - *yes) - case "$gl_cv_func_printf_directive_a" in - *yes) - case "$gl_cv_func_printf_directive_f" in - *yes) - case "$gl_cv_func_printf_directive_n" in - *yes) - case "$gl_cv_func_printf_positions" in - *yes) - case "$gl_cv_func_printf_flag_grouping" in - *yes) - case "$gl_cv_func_printf_flag_zero" in - *yes) - if test $ac_cv_func_vasprintf = yes; then - # vasprintf exists and is already - # POSIX compliant. - gl_cv_func_vasprintf_posix=yes - fi - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - ;; - esac - if test $gl_cv_func_vasprintf_posix = no; then - - - case "$gl_cv_func_printf_long_double" in - *yes) - ;; - *) - -cat >>confdefs.h <<\_ACEOF -#define NEED_PRINTF_LONG_DOUBLE 1 -_ACEOF - - ;; - esac - - - - case "$gl_cv_func_printf_infinite" in - *yes) - ;; - *) -cat >>confdefs.h <<\_ACEOF -#define NEED_PRINTF_INFINITE_DOUBLE 1 -_ACEOF - ;; - esac - case "$gl_cv_func_printf_long_double" in - *yes) - case "$gl_cv_func_printf_infinite_long_double" in - *yes) - ;; - *) -cat >>confdefs.h <<\_ACEOF -#define NEED_PRINTF_INFINITE_LONG_DOUBLE 1 -_ACEOF - ;; - esac - ;; - esac - case "$gl_cv_func_printf_directive_a" in - *yes) - ;; - *) -cat >>confdefs.h <<\_ACEOF -#define NEED_PRINTF_DIRECTIVE_A 1 -_ACEOF -for ac_func in nl_langinfo -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } -if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + if test $gl_cv_have_include_next = yes; then + gl_cv_next_unistd_h='<'unistd.h'>' + else + { echo "$as_me:$LINENO: checking absolute name of <unistd.h>" >&5 +echo $ECHO_N "checking absolute name of <unistd.h>... $ECHO_C" >&6; } +if test "${gl_cv_next_unistd_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + + if test $ac_cv_header_unistd_h = yes; then + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. - For example, HP-UX 11i <limits.h> declares gettimeofday. */ -#define $ac_func innocuous_$ac_func +#include <unistd.h> -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer <limits.h> to <assert.h> if __STDC__ is defined, since - <limits.h> exists even on freestanding compilers. */ +_ACEOF + gl_cv_next_unistd_h='"'`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | + sed -n '\#/unistd.h#{ + s#.*"\(.*/unistd.h\)".*#\1# + s#^/[^/]#//&# + p + q + }'`'"' + else + gl_cv_next_unistd_h='<'unistd.h'>' + fi -#ifdef __STDC__ -# include <limits.h> -#else -# include <assert.h> -#endif +fi +{ echo "$as_me:$LINENO: result: $gl_cv_next_unistd_h" >&5 +echo "${ECHO_T}$gl_cv_next_unistd_h" >&6; } + fi + NEXT_UNISTD_H=$gl_cv_next_unistd_h -#undef $ac_func -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$ac_func || defined __stub___$ac_func -choke me -#endif -int -main () -{ -return $ac_func (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - eval "$as_ac_var=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -fi -ac_res=`eval echo '${'$as_ac_var'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF -fi -done - ;; - esac - case "$gl_cv_func_printf_directive_f" in - *yes) - ;; - *) + if test $ac_cv_header_unistd_h = yes; then + HAVE_UNISTD_H=1 + else + HAVE_UNISTD_H=0 + fi -cat >>confdefs.h <<\_ACEOF -#define NEED_PRINTF_DIRECTIVE_F 1 -_ACEOF - ;; - esac - case "$gl_cv_func_printf_flag_grouping" in - *yes) - ;; - *) -cat >>confdefs.h <<\_ACEOF -#define NEED_PRINTF_FLAG_GROUPING 1 -_ACEOF - ;; - esac - case "$gl_cv_func_printf_flag_zero" in - *yes) - ;; - *) + + + + + + + M4_LIBOBJS="$M4_LIBOBJS dup-safer.$ac_objext" + + + + + + + + + M4_LIBOBJS="$M4_LIBOBJS fd-safer.$ac_objext" + + + + + + + + + M4_LIBOBJS="$M4_LIBOBJS pipe-safer.$ac_objext" + + + cat >>confdefs.h <<\_ACEOF -#define NEED_PRINTF_FLAG_ZERO 1 +#define USE_UNLOCKED_IO 1 _ACEOF - ;; - esac + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + if test $ac_cv_func_vasnprintf = no; then + + + + + + @@ -22015,9 +23320,34 @@ _ACEOF M4_LIBOBJS="$M4_LIBOBJS vasnprintf.$ac_objext" + + + + + + + + M4_LIBOBJS="$M4_LIBOBJS printf-args.$ac_objext" + + + + + + + + M4_LIBOBJS="$M4_LIBOBJS printf-parse.$ac_objext" + + + + + + + + M4_LIBOBJS="$M4_LIBOBJS asnprintf.$ac_objext" + if test $ac_cv_func_vasnprintf = yes; then cat >>confdefs.h <<\_ACEOF @@ -22089,9 +23419,11 @@ fi { echo "$as_me:$LINENO: result: $ac_cv_type_ptrdiff_t" >&5 echo "${ECHO_T}$ac_cv_type_ptrdiff_t" >&6; } if test $ac_cv_type_ptrdiff_t = yes; then + : +else -cat >>confdefs.h <<_ACEOF -#define HAVE_PTRDIFF_T 1 +cat >>confdefs.h <<\_ACEOF +#define ptrdiff_t long _ACEOF @@ -22272,44 +23604,71 @@ fi - - M4_LIBOBJS="$M4_LIBOBJS vasprintf.$ac_objext" - M4_LIBOBJS="$M4_LIBOBJS asprintf.$ac_objext" - - if test $ac_cv_func_vasprintf = yes; then - REPLACE_VASPRINTF=1 - else - HAVE_VASPRINTF=0 fi +for ac_func in vasprintf +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define $ac_func innocuous_$ac_func +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif +#undef $ac_func +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif - fi - - - - { echo "$as_me:$LINENO: checking whether <wchar.h> is standalone" >&5 -echo $ECHO_N "checking whether <wchar.h> is standalone... $ECHO_C" >&6; } -if test "${gl_cv_header_wchar_h_standalone+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#include <wchar.h> -wchar_t w; +int +main () +{ +return $ac_func (); + ; + return 0; +} _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -22318,34 +23677,32 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest.$ac_objext; then - gl_cv_header_wchar_h_standalone=yes + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - gl_cv_header_wchar_h_standalone=no + eval "$as_ac_var=no" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $gl_cv_header_wchar_h_standalone" >&5 -echo "${ECHO_T}$gl_cv_header_wchar_h_standalone" >&6; } - if test $gl_cv_header_wchar_h_standalone != yes; then - WCHAR_H=wchar.h - fi - - - - +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF +fi +done + if test $ac_cv_func_vasprintf = no; then - if test $ac_cv_header_wchar_h = yes; then - HAVE_WCHAR_H=1 - else - HAVE_WCHAR_H=0 - fi @@ -22353,48 +23710,23 @@ echo "${ECHO_T}$gl_cv_header_wchar_h_sta + M4_LIBOBJS="$M4_LIBOBJS vasprintf.$ac_objext" - if test $gl_cv_have_include_next = yes; then - gl_cv_next_wchar_h='<'wchar.h'>' - else - { echo "$as_me:$LINENO: checking absolute name of <wchar.h>" >&5 -echo $ECHO_N "checking absolute name of <wchar.h>... $ECHO_C" >&6; } -if test "${gl_cv_next_wchar_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test $ac_cv_header_wchar_h = yes; then - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <wchar.h> -_ACEOF - gl_cv_next_wchar_h='"'`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | - sed -n '\#/wchar.h#{ - s#.*"\(.*/wchar.h\)".*#\1# - s#^/[^/]#//&# - p - q - }'`'"' - else - gl_cv_next_wchar_h='<'wchar.h'>' - fi -fi -{ echo "$as_me:$LINENO: result: $gl_cv_next_wchar_h" >&5 -echo "${ECHO_T}$gl_cv_next_wchar_h" >&6; } - fi - NEXT_WCHAR_H=$gl_cv_next_wchar_h + M4_LIBOBJS="$M4_LIBOBJS asprintf.$ac_objext" + if test $ac_cv_func_vasprintf = yes; then + REPLACE_VASPRINTF=1 + else + HAVE_VASPRINTF=0 + fi @@ -22403,14 +23735,11 @@ echo "${ECHO_T}$gl_cv_next_wchar_h" >&6; - if test $ac_cv_func_iswcntrl = yes; then - HAVE_ISWCNTRL=1 - else - HAVE_ISWCNTRL=0 fi + GNULIB_VASPRINTF=1 @@ -22418,18 +23747,6 @@ echo "${ECHO_T}$gl_cv_next_wchar_h" >&6; - if test $gt_cv_c_wint_t = yes; then - HAVE_WINT_T=1 - else - HAVE_WINT_T=0 - fi - - - WCTYPE_H=wctype.h - if test $ac_cv_header_wctype_h = yes; then - if test $ac_cv_func_iswcntrl = yes; then - WCTYPE_H= - fi @@ -22439,91 +23756,1816 @@ echo "${ECHO_T}$gl_cv_next_wchar_h" >&6; + gl_cv_func_vasprintf_posix=no - if test $gl_cv_have_include_next = yes; then - gl_cv_next_wctype_h='<'wctype.h'>' - else - { echo "$as_me:$LINENO: checking absolute name of <wctype.h>" >&5 -echo $ECHO_N "checking absolute name of <wctype.h>... $ECHO_C" >&6; } -if test "${gl_cv_next_wctype_h+set}" = set; then +for ac_func in vasprintf +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - - if test $ac_cv_header_wctype_h = yes; then - cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <wctype.h> - -_ACEOF - gl_cv_next_wctype_h='"'`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | - sed -n '\#/wctype.h#{ - s#.*"\(.*/wctype.h\)".*#\1# - s#^/[^/]#//&# - p - q - }'`'"' - else - gl_cv_next_wctype_h='<'wctype.h'>' - fi - -fi -{ echo "$as_me:$LINENO: result: $gl_cv_next_wctype_h" >&5 -echo "${ECHO_T}$gl_cv_next_wctype_h" >&6; } - fi - NEXT_WCTYPE_H=$gl_cv_next_wctype_h - +/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define $ac_func innocuous_$ac_func +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ - HAVE_WCTYPE_H=1 - else - HAVE_WCTYPE_H=0 - fi +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif +#undef $ac_func +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 - M4_LIBOBJS="$M4_LIBOBJS xmalloc.$ac_objext" + eval "$as_ac_var=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF +fi +done - : + case "$gl_cv_func_printf_sizes_c99" in + *yes) + case "$gl_cv_func_printf_long_double" in + *yes) + case "$gl_cv_func_printf_infinite" in + *yes) + case "$gl_cv_func_printf_infinite_long_double" in + *yes) + case "$gl_cv_func_printf_directive_a" in + *yes) + case "$gl_cv_func_printf_directive_f" in + *yes) + case "$gl_cv_func_printf_directive_n" in + *yes) + case "$gl_cv_func_printf_positions" in + *yes) + case "$gl_cv_func_printf_flag_grouping" in + *yes) + case "$gl_cv_func_printf_flag_leftadjust" in + *yes) + case "$gl_cv_func_printf_flag_zero" in + *yes) + case "$gl_cv_func_printf_precision" in + *yes) + case "$gl_cv_func_printf_enomem" in + *yes) + if test $ac_cv_func_vasprintf = yes; then + # vasprintf exists and is + # already POSIX compliant. + gl_cv_func_vasprintf_posix=yes + fi + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + if test $gl_cv_func_vasprintf_posix = no; then + + + case "$gl_cv_func_printf_long_double" in + *yes) + ;; + *) + +cat >>confdefs.h <<\_ACEOF +#define NEED_PRINTF_LONG_DOUBLE 1 +_ACEOF + + ;; + esac + + + + case "$gl_cv_func_printf_infinite" in + *yes) + ;; + *) + +cat >>confdefs.h <<\_ACEOF +#define NEED_PRINTF_INFINITE_DOUBLE 1 +_ACEOF + + ;; + esac + + + + + case "$gl_cv_func_printf_long_double" in + *yes) + case "$gl_cv_func_printf_infinite_long_double" in + *yes) + ;; + *) + +cat >>confdefs.h <<\_ACEOF +#define NEED_PRINTF_INFINITE_LONG_DOUBLE 1 +_ACEOF + + ;; + esac + ;; + esac + + + + case "$gl_cv_func_printf_directive_a" in + *yes) + ;; + *) + +cat >>confdefs.h <<\_ACEOF +#define NEED_PRINTF_DIRECTIVE_A 1 +_ACEOF + + +for ac_func in nl_langinfo +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + ;; + esac + + + + case "$gl_cv_func_printf_directive_f" in + *yes) + ;; + *) + +cat >>confdefs.h <<\_ACEOF +#define NEED_PRINTF_DIRECTIVE_F 1 +_ACEOF + + ;; + esac + + + + case "$gl_cv_func_printf_flag_grouping" in + *yes) + ;; + *) + +cat >>confdefs.h <<\_ACEOF +#define NEED_PRINTF_FLAG_GROUPING 1 +_ACEOF + + ;; + esac + + + + case "$gl_cv_func_printf_flag_leftadjust" in + *yes) + ;; + *) + +cat >>confdefs.h <<\_ACEOF +#define NEED_PRINTF_FLAG_LEFTADJUST 1 +_ACEOF + + ;; + esac + + + + case "$gl_cv_func_printf_flag_zero" in + *yes) + ;; + *) + +cat >>confdefs.h <<\_ACEOF +#define NEED_PRINTF_FLAG_ZERO 1 +_ACEOF + + ;; + esac + + + + case "$gl_cv_func_printf_precision" in + *yes) + ;; + *) + +cat >>confdefs.h <<\_ACEOF +#define NEED_PRINTF_UNBOUNDED_PRECISION 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define NEED_PRINTF_DOUBLE 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define NEED_PRINTF_LONG_DOUBLE 1 +_ACEOF + + ;; + esac + + + + case "$gl_cv_func_printf_enomem" in + *yes) + ;; + *) + +cat >>confdefs.h <<\_ACEOF +#define NEED_PRINTF_ENOMEM 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define NEED_PRINTF_DOUBLE 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define NEED_PRINTF_LONG_DOUBLE 1 +_ACEOF + + ;; + esac + + + + + + + + + + + + + + + + M4_LIBOBJS="$M4_LIBOBJS vasnprintf.$ac_objext" + + + + + + + + + M4_LIBOBJS="$M4_LIBOBJS printf-args.$ac_objext" + + + + + + + + + M4_LIBOBJS="$M4_LIBOBJS printf-parse.$ac_objext" + + + + + + + + + M4_LIBOBJS="$M4_LIBOBJS asnprintf.$ac_objext" + + if test $ac_cv_func_vasnprintf = yes; then + +cat >>confdefs.h <<\_ACEOF +#define REPLACE_VASNPRINTF 1 +_ACEOF + + fi + + + + + + + + + + + { echo "$as_me:$LINENO: checking for ptrdiff_t" >&5 +echo $ECHO_N "checking for ptrdiff_t... $ECHO_C" >&6; } +if test "${ac_cv_type_ptrdiff_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +typedef ptrdiff_t ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_ptrdiff_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_ptrdiff_t=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_ptrdiff_t" >&5 +echo "${ECHO_T}$ac_cv_type_ptrdiff_t" >&6; } +if test $ac_cv_type_ptrdiff_t = yes; then + : +else + +cat >>confdefs.h <<\_ACEOF +#define ptrdiff_t long +_ACEOF + + +fi + + + + + + + + + + +for ac_func in snprintf wcslen +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + { echo "$as_me:$LINENO: checking whether _snprintf is declared" >&5 +echo $ECHO_N "checking whether _snprintf is declared... $ECHO_C" >&6; } +if test "${ac_cv_have_decl__snprintf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <stdio.h> + +int +main () +{ +#ifndef _snprintf + (void) _snprintf; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl__snprintf=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl__snprintf=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl__snprintf" >&5 +echo "${ECHO_T}$ac_cv_have_decl__snprintf" >&6; } +if test $ac_cv_have_decl__snprintf = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL__SNPRINTF 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL__SNPRINTF 0 +_ACEOF + + +fi + + + + + + + + + + + + + + + M4_LIBOBJS="$M4_LIBOBJS vasprintf.$ac_objext" + + + + + + + + + M4_LIBOBJS="$M4_LIBOBJS asprintf.$ac_objext" + + + if test $ac_cv_func_vasprintf = yes; then + REPLACE_VASPRINTF=1 + else + HAVE_VASPRINTF=0 + fi + + + + + + + + + fi + + + + + { echo "$as_me:$LINENO: checking whether <wchar.h> is standalone" >&5 +echo $ECHO_N "checking whether <wchar.h> is standalone... $ECHO_C" >&6; } +if test "${gl_cv_header_wchar_h_standalone+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#include <wchar.h> +wchar_t w; +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + gl_cv_header_wchar_h_standalone=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gl_cv_header_wchar_h_standalone=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $gl_cv_header_wchar_h_standalone" >&5 +echo "${ECHO_T}$gl_cv_header_wchar_h_standalone" >&6; } + if test $gl_cv_header_wchar_h_standalone != yes; then + WCHAR_H=wchar.h + fi + + + + + + + + if test $ac_cv_header_wchar_h = yes; then + HAVE_WCHAR_H=1 + else + HAVE_WCHAR_H=0 + fi + + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_wchar_h='<'wchar.h'>' + else + { echo "$as_me:$LINENO: checking absolute name of <wchar.h>" >&5 +echo $ECHO_N "checking absolute name of <wchar.h>... $ECHO_C" >&6; } +if test "${gl_cv_next_wchar_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + if test $ac_cv_header_wchar_h = yes; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <wchar.h> + +_ACEOF + gl_cv_next_wchar_h='"'`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | + sed -n '\#/wchar.h#{ + s#.*"\(.*/wchar.h\)".*#\1# + s#^/[^/]#//&# + p + q + }'`'"' + else + gl_cv_next_wchar_h='<'wchar.h'>' + fi + +fi +{ echo "$as_me:$LINENO: result: $gl_cv_next_wchar_h" >&5 +echo "${ECHO_T}$gl_cv_next_wchar_h" >&6; } + fi + NEXT_WCHAR_H=$gl_cv_next_wchar_h + + + + + + + + + + + + if test $ac_cv_func_iswcntrl = yes; then + HAVE_ISWCNTRL=1 + else + HAVE_ISWCNTRL=0 + fi + + + + + + + + + + + if test $gt_cv_c_wint_t = yes; then + HAVE_WINT_T=1 + else + HAVE_WINT_T=0 + fi + + + WCTYPE_H=wctype.h + if test $ac_cv_header_wctype_h = yes; then + if test $ac_cv_func_iswcntrl = yes; then + WCTYPE_H= + fi + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_wctype_h='<'wctype.h'>' + else + { echo "$as_me:$LINENO: checking absolute name of <wctype.h>" >&5 +echo $ECHO_N "checking absolute name of <wctype.h>... $ECHO_C" >&6; } +if test "${gl_cv_next_wctype_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + if test $ac_cv_header_wctype_h = yes; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <wctype.h> + +_ACEOF + gl_cv_next_wctype_h='"'`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | + sed -n '\#/wctype.h#{ + s#.*"\(.*/wctype.h\)".*#\1# + s#^/[^/]#//&# + p + q + }'`'"' + else + gl_cv_next_wctype_h='<'wctype.h'>' + fi + +fi +{ echo "$as_me:$LINENO: result: $gl_cv_next_wctype_h" >&5 +echo "${ECHO_T}$gl_cv_next_wctype_h" >&6; } + fi + NEXT_WCTYPE_H=$gl_cv_next_wctype_h + + + + HAVE_WCTYPE_H=1 + else + HAVE_WCTYPE_H=0 + fi + + + + + + + + + + + + M4_LIBOBJS="$M4_LIBOBJS xmalloc.$ac_objext" + + + + + : + + + : + + + + + + + +for ac_header in stdint.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } + +# Is the header present? +{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## ----------------------------- ## +## Report this to bug-m4@gnu.org ## +## ----------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + + + + + + + + gltests_libdeps= + gltests_ltlibdeps= + + + + gl_source_base='tests' + + { echo "$as_me:$LINENO: checking where to find the exponent in a 'double'" >&5 +echo $ECHO_N "checking where to find the exponent in a 'double'... $ECHO_C" >&6; } +if test "${gl_cv_cc_double_expbit0+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + if test "$cross_compiling" = yes; then + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#if defined arm || defined __arm || defined __arm__ + mixed_endianness +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "mixed_endianness" >/dev/null 2>&1; then + gl_cv_cc_double_expbit0="unknown" +else + + : +if test "${ac_cv_c_bigendian+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # See if sys/param.h defines the BYTE_ORDER macro. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <sys/types.h> +#include <sys/param.h> + +int +main () +{ +#if ! (defined BYTE_ORDER && defined BIG_ENDIAN && defined LITTLE_ENDIAN \ + && BYTE_ORDER && BIG_ENDIAN && LITTLE_ENDIAN) + bogus endian macros +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + # It does; now see whether it defined to BIG_ENDIAN or not. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <sys/types.h> +#include <sys/param.h> + +int +main () +{ +#if BYTE_ORDER != BIG_ENDIAN + not big endian +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_c_bigendian=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_c_bigendian=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # It does not; compile a test program. +if test "$cross_compiling" = yes; then + # try to guess the endianness by grepping values into an object file + ac_cv_c_bigendian=unknown + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; +short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; +void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } +short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; +short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; +void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } +int +main () +{ + _ascii (); _ebcdic (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then + ac_cv_c_bigendian=yes +fi +if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then + if test "$ac_cv_c_bigendian" = unknown; then + ac_cv_c_bigendian=no + else + # finding both strings is unlikely to happen, but who knows? + ac_cv_c_bigendian=unknown + fi +fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ + + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long int l; + char c[sizeof (long int)]; + } u; + u.l = 1; + return u.c[sizeof (long int) - 1] == 1; + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_bigendian=no +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_c_bigendian=yes +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +: +case $ac_cv_c_bigendian in + yes) + gl_cv_cc_double_expbit0="word 0 bit 20" ;; + no) + gl_cv_cc_double_expbit0="word 1 bit 20" ;; + *) + gl_cv_cc_double_expbit0="unknown" ;; +esac + + +fi +rm -f conftest* + + +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include <float.h> +#include <stddef.h> +#include <stdio.h> +#include <string.h> +#define NWORDS \ + ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) +typedef union { double value; unsigned int word[NWORDS]; } memory_double; +static unsigned int ored_words[NWORDS]; +static unsigned int anded_words[NWORDS]; +static void add_to_ored_words (double x) +{ + memory_double m; + size_t i; + /* Clear it first, in case sizeof (double) < sizeof (memory_double). */ + memset (&m, 0, sizeof (memory_double)); + m.value = x; + for (i = 0; i < NWORDS; i++) + { + ored_words[i] |= m.word[i]; + anded_words[i] &= m.word[i]; + } +} +int main () +{ + size_t j; + FILE *fp = fopen ("conftest.out", "w"); + if (fp == NULL) + return 1; + for (j = 0; j < NWORDS; j++) + anded_words[j] = ~ (unsigned int) 0; + add_to_ored_words (0.25); + add_to_ored_words (0.5); + add_to_ored_words (1.0); + add_to_ored_words (2.0); + add_to_ored_words (4.0); + /* Remove bits that are common (e.g. if representation of the first mantissa + bit is explicit). */ + for (j = 0; j < NWORDS; j++) + ored_words[j] &= ~anded_words[j]; + /* Now find the nonzero word. */ + for (j = 0; j < NWORDS; j++) + if (ored_words[j] != 0) + break; + if (j < NWORDS) + { + size_t i; + for (i = j + 1; i < NWORDS; i++) + if (ored_words[i] != 0) + { + fprintf (fp, "unknown"); + return (fclose (fp) != 0); + } + for (i = 0; ; i++) + if ((ored_words[j] >> i) & 1) + { + fprintf (fp, "word %d bit %d", (int) j, (int) i); + return (fclose (fp) != 0); + } + } + fprintf (fp, "unknown"); + return (fclose (fp) != 0); +} + +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gl_cv_cc_double_expbit0=`cat conftest.out` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +gl_cv_cc_double_expbit0="unknown" +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + + rm -f conftest.out + +fi +{ echo "$as_me:$LINENO: result: $gl_cv_cc_double_expbit0" >&5 +echo "${ECHO_T}$gl_cv_cc_double_expbit0" >&6; } + case "$gl_cv_cc_double_expbit0" in + word*bit*) + word=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word //' -e 's/ bit.*//'` + bit=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word.*bit //'` + +cat >>confdefs.h <<_ACEOF +#define DBL_EXPBIT0_WORD $word +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define DBL_EXPBIT0_BIT $bit +_ACEOF + + ;; + esac + + + { echo "$as_me:$LINENO: checking where to find the exponent in a 'float'" >&5 +echo $ECHO_N "checking where to find the exponent in a 'float'... $ECHO_C" >&6; } +if test "${gl_cv_cc_float_expbit0+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + if test "$cross_compiling" = yes; then + gl_cv_cc_float_expbit0="word 0 bit 23" +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include <float.h> +#include <stddef.h> +#include <stdio.h> +#include <string.h> +#define NWORDS \ + ((sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) +typedef union { float value; unsigned int word[NWORDS]; } memory_float; +static unsigned int ored_words[NWORDS]; +static unsigned int anded_words[NWORDS]; +static void add_to_ored_words (float x) +{ + memory_float m; + size_t i; + /* Clear it first, in case + sizeof (float) < sizeof (memory_float). */ + memset (&m, 0, sizeof (memory_float)); + m.value = x; + for (i = 0; i < NWORDS; i++) + { + ored_words[i] |= m.word[i]; + anded_words[i] &= m.word[i]; + } +} +int main () +{ + size_t j; + FILE *fp = fopen ("conftest.out", "w"); + if (fp == NULL) + return 1; + for (j = 0; j < NWORDS; j++) + anded_words[j] = ~ (unsigned int) 0; + add_to_ored_words (0.25f); + add_to_ored_words (0.5f); + add_to_ored_words (1.0f); + add_to_ored_words (2.0f); + add_to_ored_words (4.0f); + /* Remove bits that are common (e.g. if representation of the first mantissa + bit is explicit). */ + for (j = 0; j < NWORDS; j++) + ored_words[j] &= ~anded_words[j]; + /* Now find the nonzero word. */ + for (j = 0; j < NWORDS; j++) + if (ored_words[j] != 0) + break; + if (j < NWORDS) + { + size_t i; + for (i = j + 1; i < NWORDS; i++) + if (ored_words[i] != 0) + { + fprintf (fp, "unknown"); + return (fclose (fp) != 0); + } + for (i = 0; ; i++) + if ((ored_words[j] >> i) & 1) + { + fprintf (fp, "word %d bit %d", (int) j, (int) i); + return (fclose (fp) != 0); + } + } + fprintf (fp, "unknown"); + return (fclose (fp) != 0); +} + +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gl_cv_cc_float_expbit0=`cat conftest.out` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +gl_cv_cc_float_expbit0="unknown" +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + + rm -f conftest.out + +fi +{ echo "$as_me:$LINENO: result: $gl_cv_cc_float_expbit0" >&5 +echo "${ECHO_T}$gl_cv_cc_float_expbit0" >&6; } + case "$gl_cv_cc_float_expbit0" in + word*bit*) + word=`echo "$gl_cv_cc_float_expbit0" | sed -e 's/word //' -e 's/ bit.*//'` + bit=`echo "$gl_cv_cc_float_expbit0" | sed -e 's/word.*bit //'` + +cat >>confdefs.h <<_ACEOF +#define FLT_EXPBIT0_WORD $word +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define FLT_EXPBIT0_BIT $bit +_ACEOF + + ;; + esac + + + + { echo "$as_me:$LINENO: checking where to find the exponent in a 'long double'" >&5 +echo $ECHO_N "checking where to find the exponent in a 'long double'... $ECHO_C" >&6; } +if test "${gl_cv_cc_long_double_expbit0+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + if test "$cross_compiling" = yes; then + + gl_cv_cc_long_double_expbit0="unknown" + +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include <float.h> +#include <stddef.h> +#include <stdio.h> +#include <string.h> +#define NWORDS \ + ((sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) +typedef union { long double value; unsigned int word[NWORDS]; } + memory_long_double; +static unsigned int ored_words[NWORDS]; +static unsigned int anded_words[NWORDS]; +static void add_to_ored_words (long double x) +{ + memory_long_double m; + size_t i; + /* Clear it first, in case + sizeof (long double) < sizeof (memory_long_double). */ + memset (&m, 0, sizeof (memory_long_double)); + m.value = x; + for (i = 0; i < NWORDS; i++) + { + ored_words[i] |= m.word[i]; + anded_words[i] &= m.word[i]; + } +} +int main () +{ + size_t j; + FILE *fp = fopen ("conftest.out", "w"); + if (fp == NULL) + return 1; + for (j = 0; j < NWORDS; j++) + anded_words[j] = ~ (unsigned int) 0; + add_to_ored_words (0.25L); + add_to_ored_words (0.5L); + add_to_ored_words (1.0L); + add_to_ored_words (2.0L); + add_to_ored_words (4.0L); + /* Remove bits that are common (e.g. if representation of the first mantissa + bit is explicit). */ + for (j = 0; j < NWORDS; j++) + ored_words[j] &= ~anded_words[j]; + /* Now find the nonzero word. */ + for (j = 0; j < NWORDS; j++) + if (ored_words[j] != 0) + break; + if (j < NWORDS) + { + size_t i; + for (i = j + 1; i < NWORDS; i++) + if (ored_words[i] != 0) + { + fprintf (fp, "unknown"); + return (fclose (fp) != 0); + } + for (i = 0; ; i++) + if ((ored_words[j] >> i) & 1) + { + fprintf (fp, "word %d bit %d", (int) j, (int) i); + return (fclose (fp) != 0); + } + } + fprintf (fp, "unknown"); + return (fclose (fp) != 0); +} + +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gl_cv_cc_long_double_expbit0=`cat conftest.out` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +gl_cv_cc_long_double_expbit0="unknown" +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + + rm -f conftest.out + +fi +{ echo "$as_me:$LINENO: result: $gl_cv_cc_long_double_expbit0" >&5 +echo "${ECHO_T}$gl_cv_cc_long_double_expbit0" >&6; } + case "$gl_cv_cc_long_double_expbit0" in + word*bit*) + word=`echo "$gl_cv_cc_long_double_expbit0" | sed -e 's/word //' -e 's/ bit.*//'` + bit=`echo "$gl_cv_cc_long_double_expbit0" | sed -e 's/word.*bit //'` + +cat >>confdefs.h <<_ACEOF +#define LDBL_EXPBIT0_WORD $word +_ACEOF - : +cat >>confdefs.h <<_ACEOF +#define LDBL_EXPBIT0_BIT $bit +_ACEOF + ;; + esac -for ac_header in stdint.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - { echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for wchar_t" >&5 +echo $ECHO_N "checking for wchar_t... $ECHO_C" >&6; } +if test "${gt_cv_c_wchar_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } else - # Is the header compilable? -{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> +#include <stddef.h> + wchar_t foo = (wchar_t)'\0'; +int +main () +{ + + ; + return 0; +} _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" @@ -22542,119 +25584,106 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_header_compiler=yes + gt_cv_c_wchar_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_header_compiler=no + gt_cv_c_wchar_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6; } +fi +{ echo "$as_me:$LINENO: result: $gt_cv_c_wchar_t" >&5 +echo "${ECHO_T}$gt_cv_c_wchar_t" >&6; } + if test $gt_cv_c_wchar_t = yes; then -# Is the header present? -{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF +cat >>confdefs.h <<\_ACEOF +#define HAVE_WCHAR_T 1 +_ACEOF + + fi + + + { echo "$as_me:$LINENO: checking for wint_t" >&5 +echo $ECHO_N "checking for wint_t... $ECHO_C" >&6; } +if test "${gt_cv_c_wint_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <$ac_header> + +/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before + <wchar.h>. + BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be included + before <wchar.h>. */ +#include <stddef.h> +#include <stdio.h> +#include <time.h> +#include <wchar.h> + wint_t foo = (wchar_t)'\0'; +int +main () +{ + + ; + return 0; +} _ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || test ! -s conftest.err - }; then - ac_header_preproc=yes + } && test -s conftest.$ac_objext; then + gt_cv_c_wint_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_header_preproc=no + gt_cv_c_wint_t=no fi -rm -f conftest.err conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( cat <<\_ASBOX -## ----------------------------- ## -## Report this to bug-m4@gnu.org ## -## ----------------------------- ## -_ASBOX - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -{ echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } +{ echo "$as_me:$LINENO: result: $gt_cv_c_wint_t" >&5 +echo "${ECHO_T}$gt_cv_c_wint_t" >&6; } + if test $gt_cv_c_wint_t = yes; then -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +cat >>confdefs.h <<\_ACEOF +#define HAVE_WINT_T 1 _ACEOF -fi + fi -done - LIBM4_LIBDEPS="$gl_libdeps" - LIBM4_LTLIBDEPS="$gl_ltlibdeps" + LIBM4_LIBDEPS="$gl_libdeps" + LIBM4_LTLIBDEPS="$gl_ltlibdeps" + LIBTESTS_LIBDEPS="$gltests_libdeps" @@ -23253,6 +26282,22 @@ test "X$DEFS" = X-DHAVE_CONFIG_H && DEFS M4_LTLIBOBJS=$M4_ltlibobjs + + M4tests_libobjs= + M4tests_ltlibobjs= + if test -n "$M4tests_LIBOBJS"; then + # Remove the extension. + sed_drop_objext='s/\.o$//;s/\.obj$//' + for i in `for i in $M4tests_LIBOBJS; do echo "$i"; done | sed "$sed_drop_objext" | sort | uniq`; do + M4tests_libobjs="$M4tests_libobjs $i.$ac_objext" + M4tests_ltlibobjs="$M4tests_ltlibobjs $i.lo" + done + fi + M4tests_LIBOBJS=$M4tests_libobjs + + M4tests_LTLIBOBJS=$M4tests_ltlibobjs + + if test -z "${STACKOVF_TRUE}" && test -z "${STACKOVF_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"STACKOVF\" was never defined. Usually this means the macro was only invoked conditionally." >&5 @@ -23560,7 +26605,7 @@ exec 6>&1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by GNU M4 $as_me 1.4.10, which was +This file was extended by GNU M4 $as_me 1.4.11, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -23613,7 +26658,7 @@ Report bugs to <bug-autoconf@gnu.org>." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -GNU M4 config.status 1.4.10 +GNU M4 config.status 1.4.11 configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" @@ -23888,6 +26933,7 @@ GREP!$GREP$ac_delim EGREP!$EGREP$ac_delim GL_COND_LIBTOOL_TRUE!$GL_COND_LIBTOOL_TRUE$ac_delim GL_COND_LIBTOOL_FALSE!$GL_COND_LIBTOOL_FALSE$ac_delim +EOVERFLOW!$EOVERFLOW$ac_delim ALLOCA!$ALLOCA$ac_delim ALLOCA_H!$ALLOCA_H$ac_delim GNULIB_FPRINTF_POSIX!$GNULIB_FPRINTF_POSIX$ac_delim @@ -23895,7 +26941,6 @@ GNULIB_PRINTF_POSIX!$GNULIB_PRINTF_POSIX GNULIB_SNPRINTF!$GNULIB_SNPRINTF$ac_delim GNULIB_SPRINTF_POSIX!$GNULIB_SPRINTF_POSIX$ac_delim GNULIB_VFPRINTF_POSIX!$GNULIB_VFPRINTF_POSIX$ac_delim -GNULIB_VPRINTF_POSIX!$GNULIB_VPRINTF_POSIX$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then @@ -23937,14 +26982,19 @@ _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF +GNULIB_VPRINTF_POSIX!$GNULIB_VPRINTF_POSIX$ac_delim GNULIB_VSNPRINTF!$GNULIB_VSNPRINTF$ac_delim GNULIB_VSPRINTF_POSIX!$GNULIB_VSPRINTF_POSIX$ac_delim GNULIB_VASPRINTF!$GNULIB_VASPRINTF$ac_delim +GNULIB_FOPEN!$GNULIB_FOPEN$ac_delim +GNULIB_FREOPEN!$GNULIB_FREOPEN$ac_delim GNULIB_FSEEK!$GNULIB_FSEEK$ac_delim GNULIB_FSEEKO!$GNULIB_FSEEKO$ac_delim GNULIB_FTELL!$GNULIB_FTELL$ac_delim GNULIB_FTELLO!$GNULIB_FTELLO$ac_delim GNULIB_FFLUSH!$GNULIB_FFLUSH$ac_delim +GNULIB_GETDELIM!$GNULIB_GETDELIM$ac_delim +GNULIB_GETLINE!$GNULIB_GETLINE$ac_delim REPLACE_FPRINTF!$REPLACE_FPRINTF$ac_delim REPLACE_VFPRINTF!$REPLACE_VFPRINTF$ac_delim REPLACE_PRINTF!$REPLACE_PRINTF$ac_delim @@ -23957,6 +27007,8 @@ REPLACE_SPRINTF!$REPLACE_SPRINTF$ac_deli REPLACE_VSPRINTF!$REPLACE_VSPRINTF$ac_delim HAVE_VASPRINTF!$HAVE_VASPRINTF$ac_delim REPLACE_VASPRINTF!$REPLACE_VASPRINTF$ac_delim +REPLACE_FOPEN!$REPLACE_FOPEN$ac_delim +REPLACE_FREOPEN!$REPLACE_FREOPEN$ac_delim HAVE_FSEEKO!$HAVE_FSEEKO$ac_delim REPLACE_FSEEKO!$REPLACE_FSEEKO$ac_delim REPLACE_FSEEK!$REPLACE_FSEEK$ac_delim @@ -23964,31 +27016,55 @@ HAVE_FTELLO!$HAVE_FTELLO$ac_delim REPLACE_FTELLO!$REPLACE_FTELLO$ac_delim REPLACE_FTELL!$REPLACE_FTELL$ac_delim REPLACE_FFLUSH!$REPLACE_FFLUSH$ac_delim +HAVE_DECL_GETDELIM!$HAVE_DECL_GETDELIM$ac_delim +HAVE_DECL_GETLINE!$HAVE_DECL_GETLINE$ac_delim +REPLACE_GETLINE!$REPLACE_GETLINE$ac_delim INCLUDE_NEXT!$INCLUDE_NEXT$ac_delim NEXT_FLOAT_H!$NEXT_FLOAT_H$ac_delim FLOAT_H!$FLOAT_H$ac_delim +GNULIB_CEILF!$GNULIB_CEILF$ac_delim +GNULIB_CEILL!$GNULIB_CEILL$ac_delim +GNULIB_FLOORF!$GNULIB_FLOORF$ac_delim +GNULIB_FLOORL!$GNULIB_FLOORL$ac_delim GNULIB_FREXP!$GNULIB_FREXP$ac_delim GNULIB_FREXPL!$GNULIB_FREXPL$ac_delim +GNULIB_ISFINITE!$GNULIB_ISFINITE$ac_delim GNULIB_LDEXPL!$GNULIB_LDEXPL$ac_delim GNULIB_MATHL!$GNULIB_MATHL$ac_delim +GNULIB_ROUND!$GNULIB_ROUND$ac_delim +GNULIB_ROUNDF!$GNULIB_ROUNDF$ac_delim +GNULIB_ROUNDL!$GNULIB_ROUNDL$ac_delim GNULIB_SIGNBIT!$GNULIB_SIGNBIT$ac_delim +GNULIB_TRUNC!$GNULIB_TRUNC$ac_delim +GNULIB_TRUNCF!$GNULIB_TRUNCF$ac_delim +GNULIB_TRUNCL!$GNULIB_TRUNCL$ac_delim HAVE_DECL_ACOSL!$HAVE_DECL_ACOSL$ac_delim HAVE_DECL_ASINL!$HAVE_DECL_ASINL$ac_delim HAVE_DECL_ATANL!$HAVE_DECL_ATANL$ac_delim -HAVE_DECL_CEILL!$HAVE_DECL_CEILL$ac_delim HAVE_DECL_COSL!$HAVE_DECL_COSL$ac_delim HAVE_DECL_EXPL!$HAVE_DECL_EXPL$ac_delim -HAVE_DECL_FLOORL!$HAVE_DECL_FLOORL$ac_delim HAVE_DECL_FREXPL!$HAVE_DECL_FREXPL$ac_delim HAVE_DECL_LDEXPL!$HAVE_DECL_LDEXPL$ac_delim HAVE_DECL_LOGL!$HAVE_DECL_LOGL$ac_delim HAVE_DECL_SINL!$HAVE_DECL_SINL$ac_delim HAVE_DECL_SQRTL!$HAVE_DECL_SQRTL$ac_delim HAVE_DECL_TANL!$HAVE_DECL_TANL$ac_delim +HAVE_DECL_TRUNC!$HAVE_DECL_TRUNC$ac_delim +HAVE_DECL_TRUNCF!$HAVE_DECL_TRUNCF$ac_delim +HAVE_DECL_TRUNCL!$HAVE_DECL_TRUNCL$ac_delim +REPLACE_CEILF!$REPLACE_CEILF$ac_delim +REPLACE_CEILL!$REPLACE_CEILL$ac_delim +REPLACE_FLOORF!$REPLACE_FLOORF$ac_delim +REPLACE_FLOORL!$REPLACE_FLOORL$ac_delim REPLACE_FREXP!$REPLACE_FREXP$ac_delim REPLACE_FREXPL!$REPLACE_FREXPL$ac_delim +REPLACE_ISFINITE!$REPLACE_ISFINITE$ac_delim REPLACE_LDEXPL!$REPLACE_LDEXPL$ac_delim +REPLACE_ROUND!$REPLACE_ROUND$ac_delim +REPLACE_ROUNDF!$REPLACE_ROUNDF$ac_delim +REPLACE_ROUNDL!$REPLACE_ROUNDL$ac_delim REPLACE_SIGNBIT!$REPLACE_SIGNBIT$ac_delim +REPLACE_SIGNBIT_USING_GCC!$REPLACE_SIGNBIT_USING_GCC$ac_delim GETOPT_H!$GETOPT_H$ac_delim LIBINTL!$LIBINTL$ac_delim LTLIBINTL!$LTLIBINTL$ac_delim @@ -23998,42 +27074,149 @@ HAVE_STRUCT_TIMEVAL!$HAVE_STRUCT_TIMEVAL REPLACE_GETTIMEOFDAY!$REPLACE_GETTIMEOFDAY$ac_delim SYS_TIME_H!$SYS_TIME_H$ac_delim GLIBC21!$GLIBC21$ac_delim +LOCALCHARSET_TESTS_ENVIRONMENT!$LOCALCHARSET_TESTS_ENVIRONMENT$ac_delim GNULIB_CHOWN!$GNULIB_CHOWN$ac_delim GNULIB_DUP2!$GNULIB_DUP2$ac_delim +GNULIB_ENVIRON!$GNULIB_ENVIRON$ac_delim GNULIB_FCHDIR!$GNULIB_FCHDIR$ac_delim +_ACEOF + + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then + break + elif $ac_last_try; then + { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` +if test -n "$ac_eof"; then + ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` + ac_eof=`expr $ac_eof + 1` +fi + +cat >>$CONFIG_STATUS <<_ACEOF +cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +_ACEOF +sed ' +s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g +s/^/s,@/; s/!/@,|#_!!_#|/ +:n +t n +s/'"$ac_delim"'$/,g/; t +s/$/\\/; p +N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n +' >>$CONFIG_STATUS <conf$$subs.sed +rm -f conf$$subs.sed +cat >>$CONFIG_STATUS <<_ACEOF +CEOF$ac_eof +_ACEOF + + +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + cat >conf$$subs.sed <<_ACEOF GNULIB_FTRUNCATE!$GNULIB_FTRUNCATE$ac_delim GNULIB_GETCWD!$GNULIB_GETCWD$ac_delim GNULIB_GETLOGIN_R!$GNULIB_GETLOGIN_R$ac_delim +GNULIB_GETPAGESIZE!$GNULIB_GETPAGESIZE$ac_delim GNULIB_LCHOWN!$GNULIB_LCHOWN$ac_delim GNULIB_LSEEK!$GNULIB_LSEEK$ac_delim GNULIB_READLINK!$GNULIB_READLINK$ac_delim GNULIB_SLEEP!$GNULIB_SLEEP$ac_delim HAVE_DUP2!$HAVE_DUP2$ac_delim HAVE_FTRUNCATE!$HAVE_FTRUNCATE$ac_delim +HAVE_GETPAGESIZE!$HAVE_GETPAGESIZE$ac_delim HAVE_READLINK!$HAVE_READLINK$ac_delim HAVE_SLEEP!$HAVE_SLEEP$ac_delim +HAVE_DECL_ENVIRON!$HAVE_DECL_ENVIRON$ac_delim HAVE_DECL_GETLOGIN_R!$HAVE_DECL_GETLOGIN_R$ac_delim +HAVE_OS_H!$HAVE_OS_H$ac_delim +HAVE_SYS_PARAM_H!$HAVE_SYS_PARAM_H$ac_delim REPLACE_CHOWN!$REPLACE_CHOWN$ac_delim REPLACE_FCHDIR!$REPLACE_FCHDIR$ac_delim REPLACE_GETCWD!$REPLACE_GETCWD$ac_delim +REPLACE_GETPAGESIZE!$REPLACE_GETPAGESIZE$ac_delim REPLACE_LCHOWN!$REPLACE_LCHOWN$ac_delim REPLACE_LSEEK!$REPLACE_LSEEK$ac_delim -NEXT_MATH_H!$NEXT_MATH_H$ac_delim +HAVE_MALLOC_POSIX!$HAVE_MALLOC_POSIX$ac_delim +GNULIB_MALLOC_POSIX!$GNULIB_MALLOC_POSIX$ac_delim +GNULIB_REALLOC_POSIX!$GNULIB_REALLOC_POSIX$ac_delim +GNULIB_CALLOC_POSIX!$GNULIB_CALLOC_POSIX$ac_delim GNULIB_GETSUBOPT!$GNULIB_GETSUBOPT$ac_delim GNULIB_MKDTEMP!$GNULIB_MKDTEMP$ac_delim GNULIB_MKSTEMP!$GNULIB_MKSTEMP$ac_delim +GNULIB_PUTENV!$GNULIB_PUTENV$ac_delim +GNULIB_SETENV!$GNULIB_SETENV$ac_delim +GNULIB_STRTOD!$GNULIB_STRTOD$ac_delim +GNULIB_UNSETENV!$GNULIB_UNSETENV$ac_delim +HAVE_CALLOC_POSIX!$HAVE_CALLOC_POSIX$ac_delim HAVE_GETSUBOPT!$HAVE_GETSUBOPT$ac_delim HAVE_MKDTEMP!$HAVE_MKDTEMP$ac_delim +HAVE_REALLOC_POSIX!$HAVE_REALLOC_POSIX$ac_delim +HAVE_SETENV!$HAVE_SETENV$ac_delim +HAVE_STRTOD!$HAVE_STRTOD$ac_delim +HAVE_UNSETENV!$HAVE_UNSETENV$ac_delim REPLACE_MKSTEMP!$REPLACE_MKSTEMP$ac_delim +REPLACE_PUTENV!$REPLACE_PUTENV$ac_delim +REPLACE_STRTOD!$REPLACE_STRTOD$ac_delim +VOID_UNSETENV!$VOID_UNSETENV$ac_delim +NEXT_MATH_H!$NEXT_MATH_H$ac_delim GNULIB_SIGPROCMASK!$GNULIB_SIGPROCMASK$ac_delim HAVE_POSIX_SIGNALBLOCKING!$HAVE_POSIX_SIGNALBLOCKING$ac_delim HAVE_SIGSET_T!$HAVE_SIGSET_T$ac_delim NEXT_SIGNAL_H!$NEXT_SIGNAL_H$ac_delim +STDARG_H!$STDARG_H$ac_delim +NEXT_STDARG_H!$NEXT_STDARG_H$ac_delim STDBOOL_H!$STDBOOL_H$ac_delim HAVE__BOOL!$HAVE__BOOL$ac_delim HAVE_LONG_LONG_INT!$HAVE_LONG_LONG_INT$ac_delim HAVE_UNSIGNED_LONG_LONG_INT!$HAVE_UNSIGNED_LONG_LONG_INT$ac_delim HAVE_INTTYPES_H!$HAVE_INTTYPES_H$ac_delim +HAVE_SYS_TYPES_H!$HAVE_SYS_TYPES_H$ac_delim +NEXT_STDINT_H!$NEXT_STDINT_H$ac_delim +HAVE_STDINT_H!$HAVE_STDINT_H$ac_delim +HAVE_SYS_INTTYPES_H!$HAVE_SYS_INTTYPES_H$ac_delim +HAVE_SYS_BITYPES_H!$HAVE_SYS_BITYPES_H$ac_delim +BITSIZEOF_PTRDIFF_T!$BITSIZEOF_PTRDIFF_T$ac_delim +BITSIZEOF_SIG_ATOMIC_T!$BITSIZEOF_SIG_ATOMIC_T$ac_delim +BITSIZEOF_SIZE_T!$BITSIZEOF_SIZE_T$ac_delim +BITSIZEOF_WCHAR_T!$BITSIZEOF_WCHAR_T$ac_delim +BITSIZEOF_WINT_T!$BITSIZEOF_WINT_T$ac_delim +HAVE_SIGNED_SIG_ATOMIC_T!$HAVE_SIGNED_SIG_ATOMIC_T$ac_delim +HAVE_SIGNED_WCHAR_T!$HAVE_SIGNED_WCHAR_T$ac_delim +HAVE_SIGNED_WINT_T!$HAVE_SIGNED_WINT_T$ac_delim +PTRDIFF_T_SUFFIX!$PTRDIFF_T_SUFFIX$ac_delim +SIG_ATOMIC_T_SUFFIX!$SIG_ATOMIC_T_SUFFIX$ac_delim +SIZE_T_SUFFIX!$SIZE_T_SUFFIX$ac_delim +WCHAR_T_SUFFIX!$WCHAR_T_SUFFIX$ac_delim +WINT_T_SUFFIX!$WINT_T_SUFFIX$ac_delim +STDINT_H!$STDINT_H$ac_delim +NEXT_STDIO_H!$NEXT_STDIO_H$ac_delim +NEXT_STDLIB_H!$NEXT_STDLIB_H$ac_delim +GNULIB_MEMMEM!$GNULIB_MEMMEM$ac_delim +GNULIB_MEMPCPY!$GNULIB_MEMPCPY$ac_delim +GNULIB_MEMRCHR!$GNULIB_MEMRCHR$ac_delim +GNULIB_STPCPY!$GNULIB_STPCPY$ac_delim +GNULIB_STPNCPY!$GNULIB_STPNCPY$ac_delim +GNULIB_STRCHRNUL!$GNULIB_STRCHRNUL$ac_delim +GNULIB_STRDUP!$GNULIB_STRDUP$ac_delim +GNULIB_STRNDUP!$GNULIB_STRNDUP$ac_delim +GNULIB_STRNLEN!$GNULIB_STRNLEN$ac_delim +GNULIB_STRPBRK!$GNULIB_STRPBRK$ac_delim +GNULIB_STRSEP!$GNULIB_STRSEP$ac_delim +GNULIB_STRSTR!$GNULIB_STRSTR$ac_delim +GNULIB_STRCASESTR!$GNULIB_STRCASESTR$ac_delim +GNULIB_STRTOK_R!$GNULIB_STRTOK_R$ac_delim +GNULIB_MBSLEN!$GNULIB_MBSLEN$ac_delim +GNULIB_MBSNLEN!$GNULIB_MBSNLEN$ac_delim +GNULIB_MBSCHR!$GNULIB_MBSCHR$ac_delim +GNULIB_MBSRCHR!$GNULIB_MBSRCHR$ac_delim +GNULIB_MBSSTR!$GNULIB_MBSSTR$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then @@ -24054,7 +27237,7 @@ if test -n "$ac_eof"; then fi cat >>$CONFIG_STATUS <<_ACEOF -cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof +cat >"\$tmp/subs-3.sed" <<\CEOF$ac_eof /@[a-zA-Z_][a-zA-Z_0-9]*@/!b _ACEOF sed ' @@ -24075,27 +27258,40 @@ _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF -HAVE_SYS_TYPES_H!$HAVE_SYS_TYPES_H$ac_delim -NEXT_STDINT_H!$NEXT_STDINT_H$ac_delim -HAVE_STDINT_H!$HAVE_STDINT_H$ac_delim -HAVE_SYS_INTTYPES_H!$HAVE_SYS_INTTYPES_H$ac_delim -HAVE_SYS_BITYPES_H!$HAVE_SYS_BITYPES_H$ac_delim -BITSIZEOF_PTRDIFF_T!$BITSIZEOF_PTRDIFF_T$ac_delim -BITSIZEOF_SIG_ATOMIC_T!$BITSIZEOF_SIG_ATOMIC_T$ac_delim -BITSIZEOF_SIZE_T!$BITSIZEOF_SIZE_T$ac_delim -BITSIZEOF_WCHAR_T!$BITSIZEOF_WCHAR_T$ac_delim -BITSIZEOF_WINT_T!$BITSIZEOF_WINT_T$ac_delim -HAVE_SIGNED_SIG_ATOMIC_T!$HAVE_SIGNED_SIG_ATOMIC_T$ac_delim -HAVE_SIGNED_WCHAR_T!$HAVE_SIGNED_WCHAR_T$ac_delim -HAVE_SIGNED_WINT_T!$HAVE_SIGNED_WINT_T$ac_delim -PTRDIFF_T_SUFFIX!$PTRDIFF_T_SUFFIX$ac_delim -SIG_ATOMIC_T_SUFFIX!$SIG_ATOMIC_T_SUFFIX$ac_delim -SIZE_T_SUFFIX!$SIZE_T_SUFFIX$ac_delim -WCHAR_T_SUFFIX!$WCHAR_T_SUFFIX$ac_delim -WINT_T_SUFFIX!$WINT_T_SUFFIX$ac_delim -STDINT_H!$STDINT_H$ac_delim -NEXT_STDIO_H!$NEXT_STDIO_H$ac_delim -NEXT_STDLIB_H!$NEXT_STDLIB_H$ac_delim +GNULIB_MBSCASECMP!$GNULIB_MBSCASECMP$ac_delim +GNULIB_MBSNCASECMP!$GNULIB_MBSNCASECMP$ac_delim +GNULIB_MBSPCASECMP!$GNULIB_MBSPCASECMP$ac_delim +GNULIB_MBSCASESTR!$GNULIB_MBSCASESTR$ac_delim +GNULIB_MBSCSPN!$GNULIB_MBSCSPN$ac_delim +GNULIB_MBSPBRK!$GNULIB_MBSPBRK$ac_delim +GNULIB_MBSSPN!$GNULIB_MBSSPN$ac_delim +GNULIB_MBSSEP!$GNULIB_MBSSEP$ac_delim +GNULIB_MBSTOK_R!$GNULIB_MBSTOK_R$ac_delim +GNULIB_STRERROR!$GNULIB_STRERROR$ac_delim +GNULIB_STRSIGNAL!$GNULIB_STRSIGNAL$ac_delim +HAVE_DECL_MEMMEM!$HAVE_DECL_MEMMEM$ac_delim +HAVE_MEMPCPY!$HAVE_MEMPCPY$ac_delim +HAVE_DECL_MEMRCHR!$HAVE_DECL_MEMRCHR$ac_delim +HAVE_STPCPY!$HAVE_STPCPY$ac_delim +HAVE_STPNCPY!$HAVE_STPNCPY$ac_delim +HAVE_STRCHRNUL!$HAVE_STRCHRNUL$ac_delim +HAVE_DECL_STRDUP!$HAVE_DECL_STRDUP$ac_delim +HAVE_STRNDUP!$HAVE_STRNDUP$ac_delim +HAVE_DECL_STRNDUP!$HAVE_DECL_STRNDUP$ac_delim +HAVE_DECL_STRNLEN!$HAVE_DECL_STRNLEN$ac_delim +HAVE_STRPBRK!$HAVE_STRPBRK$ac_delim +HAVE_STRSEP!$HAVE_STRSEP$ac_delim +HAVE_STRCASESTR!$HAVE_STRCASESTR$ac_delim +HAVE_DECL_STRTOK_R!$HAVE_DECL_STRTOK_R$ac_delim +HAVE_DECL_STRERROR!$HAVE_DECL_STRERROR$ac_delim +HAVE_DECL_STRSIGNAL!$HAVE_DECL_STRSIGNAL$ac_delim +REPLACE_STRERROR!$REPLACE_STRERROR$ac_delim +REPLACE_STRSIGNAL!$REPLACE_STRSIGNAL$ac_delim +REPLACE_MEMMEM!$REPLACE_MEMMEM$ac_delim +REPLACE_STRCASESTR!$REPLACE_STRCASESTR$ac_delim +REPLACE_STRSTR!$REPLACE_STRSTR$ac_delim +NEXT_STRING_H!$NEXT_STRING_H$ac_delim +POW_LIB!$POW_LIB$ac_delim HAVE_LSTAT!$HAVE_LSTAT$ac_delim HAVE_DECL_MKDIR!$HAVE_DECL_MKDIR$ac_delim HAVE_IO_H!$HAVE_IO_H$ac_delim @@ -24103,7 +27299,6 @@ NEXT_SYS_STAT_H!$NEXT_SYS_STAT_H$ac_deli SYS_STAT_H!$SYS_STAT_H$ac_delim NEXT_UNISTD_H!$NEXT_UNISTD_H$ac_delim HAVE_UNISTD_H!$HAVE_UNISTD_H$ac_delim -EOVERFLOW!$EOVERFLOW$ac_delim GNULIB_WCWIDTH!$GNULIB_WCWIDTH$ac_delim HAVE_DECL_WCWIDTH!$HAVE_DECL_WCWIDTH$ac_delim REPLACE_WCWIDTH!$REPLACE_WCWIDTH$ac_delim @@ -24117,15 +27312,18 @@ HAVE_WCTYPE_H!$HAVE_WCTYPE_H$ac_delim WCTYPE_H!$WCTYPE_H$ac_delim LIBM4_LIBDEPS!$LIBM4_LIBDEPS$ac_delim LIBM4_LTLIBDEPS!$LIBM4_LTLIBDEPS$ac_delim +LIBTESTS_LIBDEPS!$LIBTESTS_LIBDEPS$ac_delim STACKOVF_TRUE!$STACKOVF_TRUE$ac_delim STACKOVF_FALSE!$STACKOVF_FALSE$ac_delim LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim M4_LIBOBJS!$M4_LIBOBJS$ac_delim M4_LTLIBOBJS!$M4_LTLIBOBJS$ac_delim +M4tests_LIBOBJS!$M4tests_LIBOBJS$ac_delim +M4tests_LTLIBOBJS!$M4tests_LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 48; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 63; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 @@ -24143,7 +27341,7 @@ if test -n "$ac_eof"; then fi cat >>$CONFIG_STATUS <<_ACEOF -cat >"\$tmp/subs-3.sed" <<\CEOF$ac_eof +cat >"\$tmp/subs-4.sed" <<\CEOF$ac_eof /@[a-zA-Z_][a-zA-Z_0-9]*@/!b end _ACEOF sed ' @@ -24412,7 +27610,7 @@ s&@abs_top_builddir@&$ac_abs_top_builddi s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack -" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" | sed -f "$tmp/subs-3.sed" >$tmp/out +" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" | sed -f "$tmp/subs-3.sed" | sed -f "$tmp/subs-4.sed" >$tmp/out test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && @@ -24526,21 +27724,22 @@ echo "$as_me: $ac_file is unchanged" >&6 fi rm -f "$tmp/out12" # Compute $ac_file's index in $config_headers. +_am_arg=$ac_file _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in - $ac_file | $ac_file:* ) + $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done -echo "timestamp for $ac_file" >`$as_dirname -- $ac_file || -$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X$ac_file : 'X\(//\)[^/]' \| \ - X$ac_file : 'X\(//\)$' \| \ - X$ac_file : 'X\(/\)' \| . 2>/dev/null || -echo X$ac_file | +echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || +$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$_am_arg" : 'X\(//\)[^/]' \| \ + X"$_am_arg" : 'X\(//\)$' \| \ + X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || +echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -24577,7 +27776,7 @@ echo "$as_me: executing $ac_file command # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. - if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ diff -ruNp m4-1.4.10/configure.ac m4-1.4.11/configure.ac --- m4-1.4.10/configure.ac 2007-07-09 21:09:35.000000000 -0600 +++ m4-1.4.11/configure.ac 2008-03-29 16:33:27.000000000 -0600 @@ -1,27 +1,28 @@ # Configure template for GNU M4. -*-Autoconf-*- -# Copyright (C) 1991, 1993, 1994, 2004, 2005, 2006, 2007 Free Software -# Foundation, Inc. +# Copyright (C) 1991, 1993, 1994, 2004, 2005, 2006, 2007, 2008 Free +# Software Foundation, Inc. # -# This program is free software; you can redistribute it and/or modify +# This file is part of GNU M4. +# +# GNU M4 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 +# 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, +# GNU M4 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, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -# 02110-1301 USA +# along with this program. If not, see <http://www.gnu.org/licenses/>. AC_PREREQ([2.60]) -AC_INIT([GNU M4], [1.4.10], [bug-m4@gnu.org]) -AM_INIT_AUTOMAKE([1.9.6 dist-bzip2 gnu]) -PACKAGE=$PACKAGE_TARNAME; AC_SUBST([PACKAGE]) -VERSION=$PACKAGE_VERSION; AC_SUBST([VERSION]) +AC_INIT([GNU M4], m4_esyscmd([build-aux/git-version-gen .tarball-version]), + [bug-m4@gnu.org]) +AC_CONFIG_AUX_DIR([build-aux]) + +AM_INIT_AUTOMAKE([1.10.1 dist-bzip2 dist-lzma gnu]) m4_pattern_forbid([^M4_[A-Z]]) diff -ruNp m4-1.4.10/doc/Makefile.am m4-1.4.11/doc/Makefile.am --- m4-1.4.10/doc/Makefile.am 2007-07-09 21:27:07.000000000 -0600 +++ m4-1.4.11/doc/Makefile.am 2008-04-01 21:45:07.000000000 -0600 @@ -1,42 +1,42 @@ -## This file is part of GNU M4. +## Makefile.am - template for generating Makefile via Automake +## +## Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc. ## -## Copyright (C) 2006, 2007 Free Software Foundation, Inc. +## This file is part of GNU M4. ## -## This program is free software; you can redistribute it and/or modify +## GNU M4 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 +## 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, +## GNU M4 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; see the file COPYING. If not, write to -## the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -## Boston, MA 02110-1301, USA. +## along with this program. If not, see <http://www.gnu.org/licenses/>. ## ## This file written by Eric Blake <ebb9@byu.net> info_TEXINFOS = m4.texinfo m4_TEXINFOS = fdl.texi gpl-3.0.texi -man_MANS = m4.1 +man_MANS = $(srcdir)/m4.1 EXTRA_DIST = $(man_MANS) gendocs_template MAINTAINERCLEANFILES = $(man_MANS) gendocs_template SUFFIXES = .1 +HELP2MAN = $(SHELL) $(top_srcdir)/build-aux/missing --run help2man -# Depend on configure.ac for version, m4.c for usage text. Do not depend on +# Depend on ../.version for version, m4.c for usage text. Do not depend on # built m4 executable, since not everyone has help2man or perl. # Build the man page once in the srcdir, rather than in every VPATH build # dir, to match how automake builds info pages. This is safe for 'make # distcheck' since it is distributed pre-built. -$(srcdir)/m4.1: $(top_srcdir)/configure.ac $(top_srcdir)/src/m4.c +$(srcdir)/m4.1: $(top_srcdir)/.version $(top_srcdir)/src/m4.c @if test -x ../src/m4$(EXEEXT) ; then \ echo "Updating man page m4.1" ; \ - $(SHELL) $(top_srcdir)/missing --run \ - help2man --name="macro processor" --source=FSF \ - --info-page=m4 --output=$@ ../src/m4$(EXEEXT) ; \ + $(HELP2MAN) --name="macro processor" --source='$(PACKAGE_STRING)' \ + --info-page=m4 --output=$@ ../src/m4$(EXEEXT) ; \ else \ echo "WARNING: The \`man' page \`$@' cannot be updated yet."; \ echo " Retry once the program executable is ready."; \ diff -ruNp m4-1.4.10/doc/Makefile.in m4-1.4.11/doc/Makefile.in --- m4-1.4.10/doc/Makefile.in 2007-07-09 21:30:30.000000000 -0600 +++ m4-1.4.11/doc/Makefile.in 2008-04-02 06:45:28.000000000 -0600 @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.10 from Makefile.am. +# Makefile.in generated by automake 1.10.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -46,22 +46,23 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/a $(top_srcdir)/m4/fatal-signal.m4 $(top_srcdir)/m4/fflush.m4 \ $(top_srcdir)/m4/float_h.m4 $(top_srcdir)/m4/fpending.m4 \ $(top_srcdir)/m4/fpieee.m4 $(top_srcdir)/m4/fpurge.m4 \ - $(top_srcdir)/m4/freading.m4 $(top_srcdir)/m4/free.m4 \ - $(top_srcdir)/m4/frexp.m4 $(top_srcdir)/m4/frexpl.m4 \ - $(top_srcdir)/m4/fseeko.m4 $(top_srcdir)/m4/ftello.m4 \ - $(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gettimeofday.m4 \ - $(top_srcdir)/m4/gl_list.m4 $(top_srcdir)/m4/glibc21.m4 \ - $(top_srcdir)/m4/gnulib-common.m4 \ + $(top_srcdir)/m4/freading.m4 $(top_srcdir)/m4/frexp.m4 \ + $(top_srcdir)/m4/frexpl.m4 $(top_srcdir)/m4/fseeko.m4 \ + $(top_srcdir)/m4/ftello.m4 $(top_srcdir)/m4/getopt.m4 \ + $(top_srcdir)/m4/gettimeofday.m4 $(top_srcdir)/m4/gl_list.m4 \ + $(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/gnulib-common.m4 \ $(top_srcdir)/m4/gnulib-comp.m4 \ $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/inline.m4 \ $(top_srcdir)/m4/intmax_t.m4 $(top_srcdir)/m4/inttypes_h.m4 \ - $(top_srcdir)/m4/isnan.m4 $(top_srcdir)/m4/isnanf.m4 \ + $(top_srcdir)/m4/isnand.m4 $(top_srcdir)/m4/isnanf.m4 \ $(top_srcdir)/m4/isnanl.m4 $(top_srcdir)/m4/ldexpl.m4 \ $(top_srcdir)/m4/localcharset.m4 $(top_srcdir)/m4/longlong.m4 \ - $(top_srcdir)/m4/lseek.m4 $(top_srcdir)/m4/malloca.m4 \ - $(top_srcdir)/m4/math_h.m4 $(top_srcdir)/m4/mbrtowc.m4 \ - $(top_srcdir)/m4/mbstate_t.m4 $(top_srcdir)/m4/mkdtemp.m4 \ - $(top_srcdir)/m4/mkstemp.m4 $(top_srcdir)/m4/pathmax.m4 \ + $(top_srcdir)/m4/lseek.m4 $(top_srcdir)/m4/malloc.m4 \ + $(top_srcdir)/m4/malloca.m4 $(top_srcdir)/m4/math_h.m4 \ + $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbstate_t.m4 \ + $(top_srcdir)/m4/memchr.m4 $(top_srcdir)/m4/memcmp.m4 \ + $(top_srcdir)/m4/mkdtemp.m4 $(top_srcdir)/m4/mkstemp.m4 \ + $(top_srcdir)/m4/nocrash.m4 $(top_srcdir)/m4/pathmax.m4 \ $(top_srcdir)/m4/printf-frexp.m4 \ $(top_srcdir)/m4/printf-frexpl.m4 $(top_srcdir)/m4/printf.m4 \ $(top_srcdir)/m4/quotearg.m4 $(top_srcdir)/m4/regex.m4 \ @@ -72,11 +73,13 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/a $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdint_h.m4 \ $(top_srcdir)/m4/stdio-safer.m4 $(top_srcdir)/m4/stdio_h.m4 \ $(top_srcdir)/m4/stdlib-safer.m4 $(top_srcdir)/m4/stdlib_h.m4 \ + $(top_srcdir)/m4/strerror.m4 $(top_srcdir)/m4/string_h.m4 \ + $(top_srcdir)/m4/strstr.m4 $(top_srcdir)/m4/strtod.m4 \ $(top_srcdir)/m4/strtol.m4 $(top_srcdir)/m4/sys_stat_h.m4 \ $(top_srcdir)/m4/sys_time_h.m4 $(top_srcdir)/m4/tempname.m4 \ - $(top_srcdir)/m4/tmpdir.m4 $(top_srcdir)/m4/ulonglong.m4 \ - $(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/unistd_h.m4 \ - $(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/vasnprintf.m4 \ + $(top_srcdir)/m4/tmpdir.m4 $(top_srcdir)/m4/unistd-safer.m4 \ + $(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/unlocked-io.m4 \ + $(top_srcdir)/m4/vasnprintf.m4 \ $(top_srcdir)/m4/vasprintf-posix.m4 \ $(top_srcdir)/m4/vasprintf.m4 $(top_srcdir)/m4/wchar.m4 \ $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wctype.m4 \ @@ -91,7 +94,8 @@ CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = INFO_DEPS = $(srcdir)/m4.info -am__TEXINFO_TEX_DIR = $(srcdir) +TEXINFO_TEX = $(top_srcdir)/build-aux/texinfo.tex +am__TEXINFO_TEX_DIR = $(top_srcdir)/build-aux DVIS = m4.dvi PDFS = m4.pdf PSS = m4.ps @@ -143,11 +147,19 @@ EXEEXT = @EXEEXT@ FLOAT_H = @FLOAT_H@ GETOPT_H = @GETOPT_H@ GLIBC21 = @GLIBC21@ +GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@ +GNULIB_CEILF = @GNULIB_CEILF@ +GNULIB_CEILL = @GNULIB_CEILL@ GNULIB_CHOWN = @GNULIB_CHOWN@ GNULIB_DUP2 = @GNULIB_DUP2@ +GNULIB_ENVIRON = @GNULIB_ENVIRON@ GNULIB_FCHDIR = @GNULIB_FCHDIR@ GNULIB_FFLUSH = @GNULIB_FFLUSH@ +GNULIB_FLOORF = @GNULIB_FLOORF@ +GNULIB_FLOORL = @GNULIB_FLOORL@ +GNULIB_FOPEN = @GNULIB_FOPEN@ GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@ +GNULIB_FREOPEN = @GNULIB_FREOPEN@ GNULIB_FREXP = @GNULIB_FREXP@ GNULIB_FREXPL = @GNULIB_FREXPL@ GNULIB_FSEEK = @GNULIB_FSEEK@ @@ -156,21 +168,67 @@ GNULIB_FTELL = @GNULIB_FTELL@ GNULIB_FTELLO = @GNULIB_FTELLO@ GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@ GNULIB_GETCWD = @GNULIB_GETCWD@ +GNULIB_GETDELIM = @GNULIB_GETDELIM@ +GNULIB_GETLINE = @GNULIB_GETLINE@ GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@ +GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@ GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@ +GNULIB_ISFINITE = @GNULIB_ISFINITE@ GNULIB_LCHOWN = @GNULIB_LCHOWN@ GNULIB_LDEXPL = @GNULIB_LDEXPL@ GNULIB_LSEEK = @GNULIB_LSEEK@ +GNULIB_MALLOC_POSIX = @GNULIB_MALLOC_POSIX@ GNULIB_MATHL = @GNULIB_MATHL@ +GNULIB_MBSCASECMP = @GNULIB_MBSCASECMP@ +GNULIB_MBSCASESTR = @GNULIB_MBSCASESTR@ +GNULIB_MBSCHR = @GNULIB_MBSCHR@ +GNULIB_MBSCSPN = @GNULIB_MBSCSPN@ +GNULIB_MBSLEN = @GNULIB_MBSLEN@ +GNULIB_MBSNCASECMP = @GNULIB_MBSNCASECMP@ +GNULIB_MBSNLEN = @GNULIB_MBSNLEN@ +GNULIB_MBSPBRK = @GNULIB_MBSPBRK@ +GNULIB_MBSPCASECMP = @GNULIB_MBSPCASECMP@ +GNULIB_MBSRCHR = @GNULIB_MBSRCHR@ +GNULIB_MBSSEP = @GNULIB_MBSSEP@ +GNULIB_MBSSPN = @GNULIB_MBSSPN@ +GNULIB_MBSSTR = @GNULIB_MBSSTR@ +GNULIB_MBSTOK_R = @GNULIB_MBSTOK_R@ +GNULIB_MEMMEM = @GNULIB_MEMMEM@ +GNULIB_MEMPCPY = @GNULIB_MEMPCPY@ +GNULIB_MEMRCHR = @GNULIB_MEMRCHR@ GNULIB_MKDTEMP = @GNULIB_MKDTEMP@ GNULIB_MKSTEMP = @GNULIB_MKSTEMP@ GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@ +GNULIB_PUTENV = @GNULIB_PUTENV@ GNULIB_READLINK = @GNULIB_READLINK@ +GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@ +GNULIB_ROUND = @GNULIB_ROUND@ +GNULIB_ROUNDF = @GNULIB_ROUNDF@ +GNULIB_ROUNDL = @GNULIB_ROUNDL@ +GNULIB_SETENV = @GNULIB_SETENV@ GNULIB_SIGNBIT = @GNULIB_SIGNBIT@ GNULIB_SIGPROCMASK = @GNULIB_SIGPROCMASK@ GNULIB_SLEEP = @GNULIB_SLEEP@ GNULIB_SNPRINTF = @GNULIB_SNPRINTF@ GNULIB_SPRINTF_POSIX = @GNULIB_SPRINTF_POSIX@ +GNULIB_STPCPY = @GNULIB_STPCPY@ +GNULIB_STPNCPY = @GNULIB_STPNCPY@ +GNULIB_STRCASESTR = @GNULIB_STRCASESTR@ +GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@ +GNULIB_STRDUP = @GNULIB_STRDUP@ +GNULIB_STRERROR = @GNULIB_STRERROR@ +GNULIB_STRNDUP = @GNULIB_STRNDUP@ +GNULIB_STRNLEN = @GNULIB_STRNLEN@ +GNULIB_STRPBRK = @GNULIB_STRPBRK@ +GNULIB_STRSEP = @GNULIB_STRSEP@ +GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@ +GNULIB_STRSTR = @GNULIB_STRSTR@ +GNULIB_STRTOD = @GNULIB_STRTOD@ +GNULIB_STRTOK_R = @GNULIB_STRTOK_R@ +GNULIB_TRUNC = @GNULIB_TRUNC@ +GNULIB_TRUNCF = @GNULIB_TRUNCF@ +GNULIB_TRUNCL = @GNULIB_TRUNCL@ +GNULIB_UNSETENV = @GNULIB_UNSETENV@ GNULIB_VASPRINTF = @GNULIB_VASPRINTF@ GNULIB_VFPRINTF_POSIX = @GNULIB_VFPRINTF_POSIX@ GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@ @@ -178,49 +236,78 @@ GNULIB_VSNPRINTF = @GNULIB_VSNPRINTF@ GNULIB_VSPRINTF_POSIX = @GNULIB_VSPRINTF_POSIX@ GNULIB_WCWIDTH = @GNULIB_WCWIDTH@ GREP = @GREP@ +HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@ HAVE_DECL_ACOSL = @HAVE_DECL_ACOSL@ HAVE_DECL_ASINL = @HAVE_DECL_ASINL@ HAVE_DECL_ATANL = @HAVE_DECL_ATANL@ -HAVE_DECL_CEILL = @HAVE_DECL_CEILL@ HAVE_DECL_COSL = @HAVE_DECL_COSL@ +HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@ HAVE_DECL_EXPL = @HAVE_DECL_EXPL@ -HAVE_DECL_FLOORL = @HAVE_DECL_FLOORL@ HAVE_DECL_FREXPL = @HAVE_DECL_FREXPL@ +HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@ +HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@ HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ HAVE_DECL_LDEXPL = @HAVE_DECL_LDEXPL@ HAVE_DECL_LOGL = @HAVE_DECL_LOGL@ +HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@ +HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@ HAVE_DECL_MKDIR = @HAVE_DECL_MKDIR@ HAVE_DECL_SINL = @HAVE_DECL_SINL@ HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@ HAVE_DECL_SQRTL = @HAVE_DECL_SQRTL@ +HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@ +HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@ +HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@ +HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@ +HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@ +HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@ HAVE_DECL_TANL = @HAVE_DECL_TANL@ +HAVE_DECL_TRUNC = @HAVE_DECL_TRUNC@ +HAVE_DECL_TRUNCF = @HAVE_DECL_TRUNCF@ +HAVE_DECL_TRUNCL = @HAVE_DECL_TRUNCL@ HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@ HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@ HAVE_DUP2 = @HAVE_DUP2@ HAVE_FSEEKO = @HAVE_FSEEKO@ HAVE_FTELLO = @HAVE_FTELLO@ HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ +HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@ HAVE_GETSUBOPT = @HAVE_GETSUBOPT@ HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ HAVE_IO_H = @HAVE_IO_H@ HAVE_ISWCNTRL = @HAVE_ISWCNTRL@ HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ HAVE_LSTAT = @HAVE_LSTAT@ +HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@ +HAVE_MEMPCPY = @HAVE_MEMPCPY@ HAVE_MKDTEMP = @HAVE_MKDTEMP@ +HAVE_OS_H = @HAVE_OS_H@ HAVE_POSIX_SIGNALBLOCKING = @HAVE_POSIX_SIGNALBLOCKING@ HAVE_READLINK = @HAVE_READLINK@ +HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@ +HAVE_SETENV = @HAVE_SETENV@ HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@ HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@ HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@ HAVE_SIGSET_T = @HAVE_SIGSET_T@ HAVE_SLEEP = @HAVE_SLEEP@ HAVE_STDINT_H = @HAVE_STDINT_H@ +HAVE_STPCPY = @HAVE_STPCPY@ +HAVE_STPNCPY = @HAVE_STPNCPY@ +HAVE_STRCASESTR = @HAVE_STRCASESTR@ +HAVE_STRCHRNUL = @HAVE_STRCHRNUL@ +HAVE_STRNDUP = @HAVE_STRNDUP@ +HAVE_STRPBRK = @HAVE_STRPBRK@ +HAVE_STRSEP = @HAVE_STRSEP@ +HAVE_STRTOD = @HAVE_STRTOD@ HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@ HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@ HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@ +HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ HAVE_UNISTD_H = @HAVE_UNISTD_H@ +HAVE_UNSETENV = @HAVE_UNSETENV@ HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@ HAVE_VASPRINTF = @HAVE_VASPRINTF@ HAVE_WCHAR_H = @HAVE_WCHAR_H@ @@ -239,18 +326,24 @@ LIBM4_LIBDEPS = @LIBM4_LIBDEPS@ LIBM4_LTLIBDEPS = @LIBM4_LTLIBDEPS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ +LIBTESTS_LIBDEPS = @LIBTESTS_LIBDEPS@ +LOCALCHARSET_TESTS_ENVIRONMENT = @LOCALCHARSET_TESTS_ENVIRONMENT@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ M4_LIBOBJS = @M4_LIBOBJS@ M4_LTLIBOBJS = @M4_LTLIBOBJS@ +M4tests_LIBOBJS = @M4tests_LIBOBJS@ +M4tests_LTLIBOBJS = @M4tests_LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ NEXT_FLOAT_H = @NEXT_FLOAT_H@ NEXT_MATH_H = @NEXT_MATH_H@ NEXT_SIGNAL_H = @NEXT_SIGNAL_H@ +NEXT_STDARG_H = @NEXT_STDARG_H@ NEXT_STDINT_H = @NEXT_STDINT_H@ NEXT_STDIO_H = @NEXT_STDIO_H@ NEXT_STDLIB_H = @NEXT_STDLIB_H@ +NEXT_STRING_H = @NEXT_STRING_H@ NEXT_SYS_STAT_H = @NEXT_SYS_STAT_H@ NEXT_SYS_TIME_H = @NEXT_SYS_TIME_H@ NEXT_UNISTD_H = @NEXT_UNISTD_H@ @@ -264,12 +357,19 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +POW_LIB = @POW_LIB@ PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@ RANLIB = @RANLIB@ +REPLACE_CEILF = @REPLACE_CEILF@ +REPLACE_CEILL = @REPLACE_CEILL@ REPLACE_CHOWN = @REPLACE_CHOWN@ REPLACE_FCHDIR = @REPLACE_FCHDIR@ REPLACE_FFLUSH = @REPLACE_FFLUSH@ +REPLACE_FLOORF = @REPLACE_FLOORF@ +REPLACE_FLOORL = @REPLACE_FLOORL@ +REPLACE_FOPEN = @REPLACE_FOPEN@ REPLACE_FPRINTF = @REPLACE_FPRINTF@ +REPLACE_FREOPEN = @REPLACE_FREOPEN@ REPLACE_FREXP = @REPLACE_FREXP@ REPLACE_FREXPL = @REPLACE_FREXPL@ REPLACE_FSEEK = @REPLACE_FSEEK@ @@ -277,15 +377,29 @@ REPLACE_FSEEKO = @REPLACE_FSEEKO@ REPLACE_FTELL = @REPLACE_FTELL@ REPLACE_FTELLO = @REPLACE_FTELLO@ REPLACE_GETCWD = @REPLACE_GETCWD@ +REPLACE_GETLINE = @REPLACE_GETLINE@ +REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@ REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@ +REPLACE_ISFINITE = @REPLACE_ISFINITE@ REPLACE_LCHOWN = @REPLACE_LCHOWN@ REPLACE_LDEXPL = @REPLACE_LDEXPL@ REPLACE_LSEEK = @REPLACE_LSEEK@ +REPLACE_MEMMEM = @REPLACE_MEMMEM@ REPLACE_MKSTEMP = @REPLACE_MKSTEMP@ REPLACE_PRINTF = @REPLACE_PRINTF@ +REPLACE_PUTENV = @REPLACE_PUTENV@ +REPLACE_ROUND = @REPLACE_ROUND@ +REPLACE_ROUNDF = @REPLACE_ROUNDF@ +REPLACE_ROUNDL = @REPLACE_ROUNDL@ REPLACE_SIGNBIT = @REPLACE_SIGNBIT@ +REPLACE_SIGNBIT_USING_GCC = @REPLACE_SIGNBIT_USING_GCC@ REPLACE_SNPRINTF = @REPLACE_SNPRINTF@ REPLACE_SPRINTF = @REPLACE_SPRINTF@ +REPLACE_STRCASESTR = @REPLACE_STRCASESTR@ +REPLACE_STRERROR = @REPLACE_STRERROR@ +REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@ +REPLACE_STRSTR = @REPLACE_STRSTR@ +REPLACE_STRTOD = @REPLACE_STRTOD@ REPLACE_VASPRINTF = @REPLACE_VASPRINTF@ REPLACE_VFPRINTF = @REPLACE_VFPRINTF@ REPLACE_VPRINTF = @REPLACE_VPRINTF@ @@ -296,12 +410,14 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@ SIZE_T_SUFFIX = @SIZE_T_SUFFIX@ +STDARG_H = @STDARG_H@ STDBOOL_H = @STDBOOL_H@ STDINT_H = @STDINT_H@ STRIP = @STRIP@ SYS_STAT_H = @SYS_STAT_H@ SYS_TIME_H = @SYS_TIME_H@ VERSION = @VERSION@ +VOID_UNSETENV = @VOID_UNSETENV@ WCHAR_H = @WCHAR_H@ WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ WCTYPE_H = @WCTYPE_H@ @@ -357,10 +473,11 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ info_TEXINFOS = m4.texinfo m4_TEXINFOS = fdl.texi gpl-3.0.texi -man_MANS = m4.1 +man_MANS = $(srcdir)/m4.1 EXTRA_DIST = $(man_MANS) gendocs_template MAINTAINERCLEANFILES = $(man_MANS) gendocs_template SUFFIXES = .1 +HELP2MAN = $(SHELL) $(top_srcdir)/build-aux/missing --run help2man all: all-am .SUFFIXES: @@ -447,7 +564,7 @@ m4.html: m4.texinfo $(srcdir)/version.te $(srcdir)/version.texi: $(srcdir)/stamp-vti $(srcdir)/stamp-vti: m4.texinfo $(top_srcdir)/configure @(dir=.; test -f ./m4.texinfo || dir=$(srcdir); \ - set `$(SHELL) $(srcdir)/mdate-sh $$dir/m4.texinfo`; \ + set `$(SHELL) $(top_srcdir)/build-aux/mdate-sh $$dir/m4.texinfo`; \ echo "@set UPDATED $$1 $$2 $$3"; \ echo "@set UPDATED-MONTH $$2 $$3"; \ echo "@set EDITION $(VERSION)"; \ @@ -814,17 +931,16 @@ uninstall-man: uninstall-man1 uninstall-man1 uninstall-pdf-am uninstall-ps-am -# Depend on configure.ac for version, m4.c for usage text. Do not depend on +# Depend on ../.version for version, m4.c for usage text. Do not depend on # built m4 executable, since not everyone has help2man or perl. # Build the man page once in the srcdir, rather than in every VPATH build # dir, to match how automake builds info pages. This is safe for 'make # distcheck' since it is distributed pre-built. -$(srcdir)/m4.1: $(top_srcdir)/configure.ac $(top_srcdir)/src/m4.c +$(srcdir)/m4.1: $(top_srcdir)/.version $(top_srcdir)/src/m4.c @if test -x ../src/m4$(EXEEXT) ; then \ echo "Updating man page m4.1" ; \ - $(SHELL) $(top_srcdir)/missing --run \ - help2man --name="macro processor" --source=FSF \ - --info-page=m4 --output=$@ ../src/m4$(EXEEXT) ; \ + $(HELP2MAN) --name="macro processor" --source='$(PACKAGE_STRING)' \ + --info-page=m4 --output=$@ ../src/m4$(EXEEXT) ; \ else \ echo "WARNING: The \`man' page \`$@' cannot be updated yet."; \ echo " Retry once the program executable is ready."; \ diff -ruNp m4-1.4.10/doc/fdl.texi m4-1.4.11/doc/fdl.texi --- m4-1.4.10/doc/fdl.texi 2007-05-30 19:30:13.000000000 -0600 +++ m4-1.4.11/doc/fdl.texi 2007-12-01 11:58:04.000000000 -0700 @@ -1,10 +1,9 @@ - -@node GNU Free Documentation License -@appendixsec GNU Free Documentation License - -@cindex FDL, GNU Free Documentation License +@c The GNU Free Documentation License. @center Version 1.2, November 2002 +@c This file is intended to be included within another document, +@c hence no sectioning command or @node. + @display Copyright @copyright{} 2000,2001,2002 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA @@ -427,7 +426,7 @@ license notices just after the title pag @end smallexample If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, -replace the ``with...Texts.'' line with this: +replace the ``with@dots{}Texts.'' line with this: @smallexample @group diff -ruNp m4-1.4.10/doc/gendocs_template m4-1.4.11/doc/gendocs_template --- m4-1.4.10/doc/gendocs_template 2007-07-05 05:47:49.000000000 -0600 +++ m4-1.4.11/doc/gendocs_template 2007-12-01 11:58:04.000000000 -0700 @@ -19,12 +19,30 @@ (%%HTML_MONO_SIZE%%K bytes)</a> - entirely on one web page.</li> <li><a href="html_node/index.html">HTML</a> - with one web page per node.</li> +%%IF HTML_SECTION%% +<li><a href="html_section/index.html">HTML</a> - with one web page per + section.</li> +%%ENDIF HTML_SECTION%% +%%IF HTML_CHAPTER%% +<li><a href="html_chapter/index.html">HTML</a> - with one web page per + chapter.</li> +%%ENDIF HTML_CHAPTER%% <li><a href="%%PACKAGE%%.html.gz">HTML compressed - (%%HTML_MONO_GZ_SIZE%%K bytes gzipped)</a> - entirely on + (%%HTML_MONO_GZ_SIZE%%K gzipped characters)</a> - entirely on one web page.</li> <li><a href="%%PACKAGE%%.html_node.tar.gz">HTML compressed (%%HTML_NODE_TGZ_SIZE%%K gzipped tar file)</a> - with one web page per node.</li> +%%IF HTML_SECTION%% +<li><a href="%%PACKAGE%%.html_section.tar.gz">HTML compressed + (%%HTML_SECTION_TGZ_SIZE%%K gzipped tar file)</a> - + with one web page per section.</li> +%%ENDIF HTML_SECTION%% +%%IF HTML_CHAPTER%% +<li><a href="%%PACKAGE%%.html_chapter.tar.gz">HTML compressed + (%%HTML_CHAPTER_TGZ_SIZE%%K gzipped tar file)</a> - + with one web page per chapter.</li> +%%ENDIF HTML_CHAPTER%% <li><a href="%%PACKAGE%%.info.tar.gz">Info document (%%INFO_TGZ_SIZE%%K bytes gzipped tar file)</a>.</li> <li><a href="%%PACKAGE%%.txt">ASCII text diff -ruNp m4-1.4.10/doc/gpl-3.0.texi m4-1.4.11/doc/gpl-3.0.texi --- m4-1.4.10/doc/gpl-3.0.texi 2007-07-05 05:47:50.000000000 -0600 +++ m4-1.4.11/doc/gpl-3.0.texi 2007-12-01 11:58:04.000000000 -0700 @@ -1,8 +1,8 @@ -@node Copying -@appendixsec GNU General Public License +@c The GNU General Public License. @center Version 3, 29 June 2007 -@c This file is intended to be included in another file. +@c This file is intended to be included within another document, +@c hence no sectioning command or @node. @display Copyright @copyright{} 2007 Free Software Foundation, Inc. @url{http://fsf.org/} @@ -19,7 +19,7 @@ software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom -to share and change all versions of a program--to make sure it remains +to share and change all versions of a program---to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You diff -ruNp m4-1.4.10/doc/m4.1 m4-1.4.11/doc/m4.1 --- m4-1.4.10/doc/m4.1 2007-07-09 21:20:51.000000000 -0600 +++ m4-1.4.11/doc/m4.1 2008-04-01 21:48:47.000000000 -0600 @@ -1,5 +1,5 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.35. -.TH M4 "1" "July 2007" "FSF" "User Commands" +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. +.TH M4 "1" "April 2008" "GNU M4 1.4.11" "User Commands" .SH NAME m4 \- macro processor .SH SYNOPSIS @@ -35,6 +35,9 @@ suppress some warnings for builtins \fB\-\-warn\-macro\-sequence\fR[=\fIREGEXP\fR] warn if macro definition matches REGEXP, default \e$\e({[^}]*}\e|[0\-9][0\-9]+\e) +.TP +\fB\-W\fR, \fB\-\-word\-regexp\fR=\fIREGEXP\fR +use REGEXP for macro name syntax .SS "Preprocessor features:" .TP \fB\-D\fR, \fB\-\-define=NAME\fR[=\fIVALUE\fR] @@ -123,7 +126,7 @@ Written by Rene' Seindal. .SH "REPORTING BUGS" Report bugs to <bug\-m4@gnu.org>. .SH COPYRIGHT -Copyright \(co 2007 Free Software Foundation, Inc. +Copyright \(co 2008 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> .br This is free software: you are free to change and redistribute it. diff -ruNp m4-1.4.10/doc/m4.info m4-1.4.11/doc/m4.info --- m4-1.4.10/doc/m4.info 2007-07-09 21:20:52.000000000 -0600 +++ m4-1.4.11/doc/m4.info 2008-04-01 21:34:34.000000000 -0600 @@ -1,10 +1,11 @@ -This is m4.info, produced by makeinfo version 4.8 from m4.texinfo. +This is ../../doc/m4.info, produced by makeinfo version 4.8 from +../../doc/m4.texinfo. - This manual is for GNU M4 (version 1.4.10, 4 July 2007), a package + This manual is for GNU M4 (version 1.4.11, 29 March 2008), a package containing an implementation of the m4 macro language. Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 2004, 2005, 2006, -2007 Free Software Foundation, Inc. +2007, 2008 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, @@ -19,7533 +20,114 @@ START-INFO-DIR-ENTRY END-INFO-DIR-ENTRY  -File: m4.info, Node: Top, Next: Preliminaries, Up: (dir) - -GNU M4 -****** - -This manual is for GNU M4 (version 1.4.10, 4 July 2007), a package -containing an implementation of the m4 macro language. - - Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 2004, 2005, 2006, -2007 Free Software Foundation, Inc. - - Permission is granted to copy, distribute and/or modify this - document under the terms of the GNU Free Documentation License, - Version 1.2 or any later version published by the Free Software - Foundation; with no Invariant Sections, no Front-Cover Texts, and - no Back-Cover Texts. A copy of the license is included in the - section entitled "GNU Free Documentation License." - - GNU `m4' is an implementation of the traditional UNIX macro -processor. It is mostly SVR4 compatible, although it has some -extensions (for example, handling more than 9 positional parameters to -macros). `m4' also has builtin functions for including files, running -shell commands, doing arithmetic, etc. Autoconf needs GNU `m4' for -generating `configure' scripts, but not for running them. - - GNU `m4' was originally written by Rene' Seindal, with subsequent -changes by Franc,ois Pinard and other volunteers on the Internet. All -names and email addresses can be found in the files `m4-1.4.10/AUTHORS' -and `m4-1.4.10/THANKS' from the GNU M4 distribution. - - This is release 1.4.10. It is now considered stable: future -releases in the 1.4.x series are only meant to fix bugs, increase speed, -or improve documentation. However... - - An experimental feature, which would improve `m4' usefulness, allows -for changing the syntax for what is a "word" in `m4'. You should use: - ./configure --enable-changeword - if you want this feature compiled in. The current implementation -slows down `m4' considerably and is hardly acceptable. In the future, -`m4' 2.0 will come with a different set of new features that provide -similar capabilities, but without the inefficiencies, so changeword -will go away and _you should not count on it_. - -* Menu: - -* Preliminaries:: Introduction and preliminaries -* Invoking m4:: Invoking `m4' -* Syntax:: Lexical and syntactic conventions - -* Macros:: How to invoke macros -* Definitions:: How to define new macros -* Conditionals:: Conditionals, loops, and recursion - -* Debugging:: How to debug macros and input - -* Input Control:: Input control -* File Inclusion:: File inclusion -* Diversions:: Diverting and undiverting output - -* Text handling:: Macros for text handling -* Arithmetic:: Macros for doing arithmetic -* Shell commands:: Macros for running shell commands -* Miscellaneous:: Miscellaneous builtin macros -* Frozen files:: Fast loading of frozen state - -* Compatibility:: Compatibility with other versions of `m4' -* Answers:: Correct version of some examples -* Copying This Package:: How to make copies of the overall M4 package -* Copying This Manual:: How to make copies of this manual -* Indices:: Indices of concepts and macros - - --- The Detailed Node Listing --- - -Introduction and preliminaries - -* Intro:: Introduction to `m4' -* History:: Historical references -* Bugs:: Problems and bugs -* Manual:: Using this manual - -Invoking `m4' - -* Operation modes:: Command line options for operation modes -* Preprocessor features:: Command line options for preprocessor features -* Limits control:: Command line options for limits control -* Frozen state:: Command line options for frozen state -* Debugging options:: Command line options for debugging -* Command line files:: Specifying input files on the command line - -Lexical and syntactic conventions - -* Names:: Macro names -* Quoted strings:: Quoting input to `m4' -* Comments:: Comments in `m4' input -* Other tokens:: Other kinds of input tokens -* Input processing:: How `m4' copies input to output - -How to invoke macros - -* Invocation:: Macro invocation -* Inhibiting Invocation:: Preventing macro invocation -* Macro Arguments:: Macro arguments -* Quoting Arguments:: On Quoting Arguments to macros -* Macro expansion:: Expanding macros - -How to define new macros - -* Define:: Defining a new macro -* Arguments:: Arguments to macros -* Pseudo Arguments:: Special arguments to macros -* Undefine:: Deleting a macro -* Defn:: Renaming macros -* Pushdef:: Temporarily redefining macros - -* Indir:: Indirect call of macros -* Builtin:: Indirect call of builtins - -Conditionals, loops, and recursion - -* Ifdef:: Testing if a macro is defined -* Ifelse:: If-else construct, or multibranch -* Shift:: Recursion in `m4' -* Forloop:: Iteration by counting -* Foreach:: Iteration by list contents - -How to debug macros and input - -* Dumpdef:: Displaying macro definitions -* Trace:: Tracing macro calls -* Debug Levels:: Controlling debugging output -* Debug Output:: Saving debugging output - -Input control - -* Dnl:: Deleting whitespace in input -* Changequote:: Changing the quote characters -* Changecom:: Changing the comment delimiters -* Changeword:: Changing the lexical structure of words -* M4wrap:: Saving text until end of input - -File inclusion - -* Include:: Including named files -* Search Path:: Searching for include files - -Diverting and undiverting output - -* Divert:: Diverting output -* Undivert:: Undiverting output -* Divnum:: Diversion numbers -* Cleardivert:: Discarding diverted text - -Macros for text handling - -* Len:: Calculating length of strings -* Index macro:: Searching for substrings -* Regexp:: Searching for regular expressions -* Substr:: Extracting substrings -* Translit:: Translating characters -* Patsubst:: Substituting text by regular expression -* Format:: Formatting strings (printf-like) - -Macros for doing arithmetic - -* Incr:: Decrement and increment operators -* Eval:: Evaluating integer expressions - -Macros for running shell commands - -* Platform macros:: Determining the platform -* Syscmd:: Executing simple commands -* Esyscmd:: Reading the output of commands -* Sysval:: Exit status -* Mkstemp:: Making temporary files - -Miscellaneous builtin macros - -* Errprint:: Printing error messages -* Location:: Printing current location -* M4exit:: Exiting from `m4' - -Fast loading of frozen state - -* Using frozen files:: Using frozen files -* Frozen file format:: Frozen file format - -Compatibility with other versions of `m4' - -* Extensions:: Extensions in GNU M4 -* Incompatibilities:: Facilities in System V m4 not in GNU M4 -* Other Incompatibilities:: Other incompatibilities - -Correct version of some examples - -* Improved exch:: Solution for `exch' -* Improved forloop:: Solution for `forloop' -* Improved foreach:: Solution for `foreach' -* Improved cleardivert:: Solution for `cleardivert' -* Improved fatal_error:: Solution for `fatal_error' - -How to make copies of this package or manual - -* Copying:: GNU General Public License -* GNU Free Documentation License:: License for copying this manual - -Indices of concepts and macros - -* Macro index:: Index for all `m4' macros -* Concept index:: Index for many concepts - - -File: m4.info, Node: Preliminaries, Next: Invoking m4, Prev: Top, Up: Top - -1 Introduction and preliminaries -******************************** - -This first chapter explains what GNU `m4' is, where `m4' comes from, -how to read and use this documentation, how to call the `m4' program, -and how to report bugs about it. It concludes by giving tips for -reading the remainder of the manual. - - The following chapters then detail all the features of the `m4' -language. - -* Menu: - -* Intro:: Introduction to `m4' -* History:: Historical references -* Bugs:: Problems and bugs -* Manual:: Using this manual - - -File: m4.info, Node: Intro, Next: History, Up: Preliminaries - -1.1 Introduction to `m4' -======================== - -`m4' is a macro processor, in the sense that it copies its input to the -output, expanding macros as it goes. Macros are either builtin or -user-defined, and can take any number of arguments. Besides just doing -macro expansion, `m4' has builtin functions for including named files, -running shell commands, doing integer arithmetic, manipulating text in -various ways, performing recursion, etc.... `m4' can be used either as -a front-end to a compiler, or as a macro processor in its own right. - - The `m4' macro processor is widely available on all UNIXes, and has -been standardized by POSIX. Usually, only a small percentage of users -are aware of its existence. However, those who find it often become -committed users. The popularity of GNU Autoconf, which requires GNU -`m4' for _generating_ `configure' scripts, is an incentive for many to -install it, while these people will not themselves program in `m4'. -GNU `m4' is mostly compatible with the System V, Release 3 version, -except for some minor differences. *Note Compatibility::, for more -details. - - Some people find `m4' to be fairly addictive. They first use `m4' -for simple problems, then take bigger and bigger challenges, learning -how to write complex sets of `m4' macros along the way. Once really -addicted, users pursue writing of sophisticated `m4' applications even -to solve simple problems, devoting more time debugging their `m4' -scripts than doing real work. Beware that `m4' may be dangerous for -the health of compulsive programmers. - - -File: m4.info, Node: History, Next: Bugs, Prev: Intro, Up: Preliminaries - -1.2 Historical references -========================= - -`GPM' was an important ancestor of `m4'. See C. Stratchey: "A General -Purpose Macro generator", Computer Journal 8,3 (1965), pp. 225 ff. -`GPM' is also succinctly described into David Gries classic "Compiler -Construction for Digital Computers". - - The classic B. Kernighan and P.J. Plauger: "Software Tools", -Addison-Wesley, Inc. (1976) describes and implements a Unix -macro-processor language, which inspired Dennis Ritchie to write `m3', -a macro processor for the AP-3 minicomputer. - - Kernighan and Ritchie then joined forces to develop the original -`m4', as described in "The M4 Macro Processor", Bell Laboratories -(1977). It had only 21 builtin macros. - - While `GPM' was more _pure_, `m4' is meant to deal with the true -intricacies of real life: macros can be recognized without being -pre-announced, skipping whitespace or end-of-lines is easier, more -constructs are builtin instead of derived, etc. - - Originally, the Kernighan and Plauger macro-processor, and then -`m3', formed the engine for the Rational FORTRAN preprocessor, that is, -the `Ratfor' equivalent of `cpp'. Later, `m4' was used as a front-end -for `Ratfor', `C' and `Cobol'. - - Rene' Seindal released his implementation of `m4', GNU `m4', in -1990, with the aim of removing the artificial limitations in many of -the traditional `m4' implementations, such as maximum line length, -macro size, or number of macros. - - The late Professor A. Dain Samples described and implemented a -further evolution in the form of `M5': "User's Guide to the M5 Macro -Language: 2nd edition", Electronic Announcement on comp.compilers -newsgroup (1992). - - Franc,ois Pinard took over maintenance of GNU `m4' in 1992, until -1994 when he released GNU `m4' 1.4, which was the stable release for 10 -years. It was at this time that GNU Autoconf decided to require GNU -`m4' as its underlying engine, since all other implementations of `m4' -had too many limitations. - - More recently, in 2004, Paul Eggert released 1.4.1 and 1.4.2 which -addressed some long standing bugs in the venerable 1.4 release. Then in -2005, Gary V. Vaughan collected together the many patches to GNU `m4' -1.4 that were floating around the net and released 1.4.3 and 1.4.4. -And in 2006, Eric Blake joined the team and prepared patches for the -release of 1.4.5, 1.4.6, 1.4.7, and 1.4.8. The 1.4.x series remains -open for bug fixes, including release 1.4.9 and 1.4.10 in 2007. - - Meanwhile, development has continued on new features for `m4', such -as dynamic module loading and additional builtins. When complete, GNU -`m4' 2.0 will start a new series of releases. - - -File: m4.info, Node: Bugs, Next: Manual, Prev: History, Up: Preliminaries - -1.3 Problems and bugs -===================== - -If you have problems with GNU M4 or think you've found a bug, please -report it. Before reporting a bug, make sure you've actually found a -real bug. Carefully reread the documentation and see if it really says -you can do what you're trying to do. If it's not clear whether you -should be able to do something or not, report that too; it's a bug in -the documentation! - - Before reporting a bug or trying to fix it yourself, try to isolate -it to the smallest possible input file that reproduces the problem. -Then send us the input file and the exact results `m4' gave you. Also -say what you expected to occur; this will help us decide whether the -problem was really in the documentation. - - Once you've got a precise problem, send e-mail to <bug-m4@gnu.org>. -Please include the version number of `m4' you are using. You can get -this information with the command `m4 --version'. Also provide details -about the platform you are executing on. - - Non-bug suggestions are always welcome as well. If you have -questions about things that are unclear in the documentation or are -just obscure features, please report them too. - - -File: m4.info, Node: Manual, Prev: Bugs, Up: Preliminaries - -1.4 Using this manual -===================== - -This manual contains a number of examples of `m4' input and output, and -a simple notation is used to distinguish input, output and error -messages from `m4'. Examples are set out from the normal text, and -shown in a fixed width font, like this - - This is an example of an example! - - To distinguish input from output, all output from `m4' is prefixed -by the string `=>', and all error messages by the string `error-->'. -When showing how command line options affect matters, the command line -is shown with a prompt `$ like this', otherwise, you can assume that a -simple `m4' invocation will work. Thus: - - $ command line to invoke m4 - Example of input line - =>Output line from m4 - error-->and an error message - - The sequence `^D' in an example indicates the end of the input file. -The sequence `<NL>' refers to the newline character. The majority of -these examples are self-contained, and you can run them with similar -results by invoking `m4 -d'. In fact, the testsuite that is bundled in -the GNU M4 package consists of the examples in this document! Some of -the examples assume that your current directory is located where you -unpacked the installation, so if you plan on following along, you may -find it helpful to do this now: - - $ cd m4-1.4.10 - - As each of the predefined macros in `m4' is described, a prototype -call of the macro will be shown, giving descriptive names to the -arguments, e.g., - - -- Composite: example (STRING, [COUNT = `1'], [ARGUMENT]...) - This is a sample prototype. There is not really a macro named - `example', but this documents that if there were, it would be a - Composite macro, rather than a Builtin. It requires at least one - argument, STRING. Remember that in `m4', there must not be a - space between the macro name and the opening parenthesis, unless - it was intended to call the macro without any arguments. The - brackets around COUNT and ARGUMENT show that these arguments are - optional. If COUNT is omitted, the macro behaves as if count were - `1', whereas if ARGUMENT is omitted, the macro behaves as if it - were the empty string. A blank argument is not the same as an - omitted argument. For example, `example(`a')', `example(`a',`1')', - and `example(`a',`1',)' would behave identically with COUNT set to - `1'; while `example(`a',)' and `example(`a',`')' would explicitly - pass the empty string for COUNT. The ellipses (`...') show that - the macro processes additional arguments after ARGUMENT, rather - than ignoring them. - - All macro arguments in `m4' are strings, but some are given special -interpretation, e.g., as numbers, file names, regular expressions, etc. -The documentation for each macro will state how the parameters are -interpreted, and what happens if the argument cannot be parsed -according to the desired interpretation. Unless specified otherwise, a -parameter specified to be a number is parsed as a decimal, even if the -argument has leading zeros; and parsing the empty string as a number -results in 0 rather than an error, although a warning will be issued. - - This document consistently writes and uses "builtin", without a -hyphen, as if it were an English word. This is how the `builtin' -primitive is spelled within `m4'. - - -File: m4.info, Node: Invoking m4, Next: Syntax, Prev: Preliminaries, Up: Top - -2 Invoking `m4' -*************** - -The format of the `m4' command is: - - `m4' [OPTION...] [FILE...] - - All options begin with `-', or if long option names are used, with -`--'. A long option name need not be written completely, any -unambiguous prefix is sufficient. POSIX requires `m4' to recognize -arguments intermixed with files, even when `POSIXLY_CORRECT' is set in -the environment. Most options take effect at startup regardless of -their position, but some are documented below as taking effect after -any files that occurred earlier in the command line. The argument `--' -is a marker to denote the end of options. - - With short options, options that do not take arguments may be -combined into a single command line argument with subsequent options, -options with mandatory arguments may be provided either as a single -command line argument or as two arguments, and options with optional -arguments must be provided as a single argument. In other words, `m4 --QPDfoo -d a -d+f' is equivalent to `m4 -Q -P -D foo -d -d+f -- ./a', -although the latter form is considered canonical. - - With long options, options with mandatory arguments may be provided -with an equal sign (`=') in a single argument, or as two arguments, and -options with optional arguments must be provided as a single argument. -In other words, `m4 --def foo --debug a' is equivalent to `m4 ---define=foo --debug= -- ./a', although the latter form is considered -canonical (not to mention more robust, in case a future version of `m4' -introduces an option named `--default'). - - `m4' understands the following options, grouped by functionality. - -* Menu: - -* Operation modes:: Command line options for operation modes -* Preprocessor features:: Command line options for preprocessor features -* Limits control:: Command line options for limits control -* Frozen state:: Command line options for frozen state -* Debugging options:: Command line options for debugging -* Command line files:: Specifying input files on the command line - - -File: m4.info, Node: Operation modes, Next: Preprocessor features, Up: Invoking m4 - -2.1 Command line options for operation modes -============================================ - -Several options control the overall operation of `m4': - -`--help' - Print a help summary on standard output, then immediately exit - `m4' without reading any input files or performing any other - actions. - -`--version' - Print the version number of the program on standard output, then - immediately exit `m4' without reading any input files or - performing any other actions. - -`-E' -`--fatal-warnings' - Controls the effect of warnings. If unspecified, then execution - continues and exit status is unaffected when a warning is printed. - If specified exactly once, warnings become fatal; when one is - issued, execution continues, but the exit status will be non-zero. - If specified multiple times, then execution halts with non-zero - status the first time a warning is issued. The introduction of - behavior levels is new to M4 1.4.9; for behavior consistent with - earlier versions, you should specify `-E' twice. - -`-i' -`--interactive' -`-e' - Makes this invocation of `m4' interactive. This means that all - output will be unbuffered, and interrupts will be ignored. The - spelling `-e' exists for compatibility with other `m4' - implementations, and issues a warning because it may be withdrawn - in a future version of GNU M4. - -`-P' -`--prefix-builtins' - Internally modify _all_ builtin macro names so they all start with - the prefix `m4_'. For example, using this option, one should write - `m4_define' instead of `define', and `m4___file__' instead of - `__file__'. This option has no effect if `-R' is also specified. - -`-Q' -`--quiet' -`--silent' - Suppress warnings, such as missing or superfluous arguments in - macro calls, or treating the empty string as zero. - -`--warn-macro-sequence[=REGEXP]' - Issue a warning if the regular expression REGEXP has a non-empty - match in any macro definition (either by `define' or `pushdef'). - Empty matches are ignored; therefore, supplying the empty string - as REGEXP disables any warning. If the optional REGEXP is not - supplied, then the default regular expression is - `\$\({[^}]*}\|[0-9][0-9]+\)' (a literal `$' followed by multiple - digits or by an open brace), since these sequences will change - semantics in the default operation of GNU M4 2.0 (due to a change - in how more than 9 arguments in a macro definition will be - handled, *note Arguments::). Providing an alternate regular - expression can provide a useful reverse lookup feature of finding - where a macro is defined to have a given definition. - -`-W REGEXP' -`--word-regexp=REGEXP' - Use REGEXP as an alternative syntax for macro names. This - experimental option will not be present in all GNU `m4' - implementations (*note Changeword::). - - -File: m4.info, Node: Preprocessor features, Next: Limits control, Prev: Operation modes, Up: Invoking m4 - -2.2 Command line options for preprocessor features -================================================== - -Several options allow `m4' to behave more like a preprocessor. Macro -definitions and deletions can be made on the command line, the search -path can be altered, and the output file can track where the input came -from. These features occur with the following options: - -`-D NAME[=VALUE]' -`--define=NAME[=VALUE]' - This enters NAME into the symbol table. If `=VALUE' is missing, - the value is taken to be the empty string. The VALUE can be any - string, and the macro can be defined to take arguments, just as if - it was defined from within the input. This option may be given - more than once; order with respect to file names is significant, - and redefining the same NAME loses the previous value. - -`-I DIRECTORY' -`--include=DIRECTORY' - Make `m4' search DIRECTORY for included files that are not found - in the current working directory. *Note Search Path::, for more - details. This option may be given more than once. - -`-s' -`--synclines' - Generate synchronization lines, for use by the C preprocessor or - other similar tools. Order is significant with respect to file - names. This option is useful, for example, when `m4' is used as a - front end to a compiler. Source file name and line number - information is conveyed by directives of the form `#line LINENUM - "FILE"', which are inserted as needed into the middle of the - output. Such directives mean that the following line originated - or was expanded from the contents of input file FILE at line - LINENUM. The `"FILE"' part is often omitted when the file name - did not change from the previous directive. - - Synchronization directives are always given on complete lines by - themselves. When a synchronization discrepancy occurs in the - middle of an output line, the associated synchronization directive - is delayed until the next newline that does not occur in the - middle of a quoted string or comment. - - define(`twoline', `1 - 2') - =>#line 2 "stdin" - => - changecom(`/*', `*/') - => - define(`comment', `/*1 - 2*/') - =>#line 5 - => - dnl no line - hello - =>#line 7 - =>hello - twoline - =>1 - =>#line 8 - =>2 - comment - =>/*1 - =>2*/ - one comment `two - three' - =>#line 10 - =>one /*1 - =>2*/ two - =>three - goodbye - =>#line 12 - =>goodbye - -`-U NAME' -`--undefine=NAME' - This deletes any predefined meaning NAME might have. Obviously, - only predefined macros can be deleted in this way. This option - may be given more than once; undefining a NAME that does not have a - definition is silently ignored. Order is significant with respect - to file names. - - -File: m4.info, Node: Limits control, Next: Frozen state, Prev: Preprocessor features, Up: Invoking m4 - -2.3 Command line options for limits control -=========================================== - -There are some limits within `m4' that can be tuned. For -compatibility, `m4' also accepts some options that control limits in -other implementations, but which are automatically unbounded (limited -only by your hardware and operating system constraints) in GNU `m4'. - -`-G' -`--traditional' - Suppress all the extensions made in this implementation, compared - to the System V version. *Note Compatibility::, for a list of - these. - -`-H NUM' -`--hashsize=NUM' - Make the internal hash table for symbol lookup be NUM entries big. - For better performance, the number should be prime, but this is not - checked. The default is 509 entries. It should not be necessary - to increase this value, unless you define an excessive number of - macros. - -`-L NUM' -`--nesting-limit=NUM' - Artificially limit the nesting of macro calls to NUM levels, - stopping program execution if this limit is ever exceeded. When - not specified, nesting is limited to 1024 levels. A value of zero - means unlimited; but then heavily nested code could potentially - cause a stack overflow. - - The precise effect of this option might be more correctly - associated with textual nesting than dynamic recursion. It has - been useful when some complex `m4' input was generated by - mechanical means. Most users would never need this option. If - shown to be obtrusive, this option (which is still experimental) - might well disappear. - - This option does _not_ have the ability to break endless - rescanning loops, since these do not necessarily consume much - memory or stack space. Through clever usage of rescanning loops, - one can request complex, time-consuming computations from `m4' - with useful results. Putting limitations in this area would break - `m4' power. There are many pathological cases: - `define(`a', `a')a' is only the simplest example (but *note - Compatibility::). Expecting GNU `m4' to detect these would be a - little like expecting a compiler system to detect and diagnose - endless loops: it is a quite _hard_ problem in general, if not - undecidable! - -`-B NUM' -`-S NUM' -`-T NUM' - These options are present for compatibility with System V `m4', but - do nothing in this implementation. They may disappear in future - releases, and issue a warning to that effect. - -`-N NUM' -`--diversions=NUM' - These options are present only for compatibility with previous - versions of GNU `m4', and were controlling the number of possible - diversions which could be used at the same time. They do nothing, - because there is no fixed limit anymore. They may disappear in - future releases, and issue a warning to that effect. - - -File: m4.info, Node: Frozen state, Next: Debugging options, Prev: Limits control, Up: Invoking m4 - -2.4 Command line options for frozen state -========================================= - -GNU `m4' comes with a feature of freezing internal state (*note Frozen -files::). This can be used to speed up `m4' execution when reusing a -common initialization script. - -`-F FILE' -`--freeze-state=FILE' - Once execution is finished, write out the frozen state on the - specified FILE. It is conventional, but not required, for FILE to - end in `.m4f'. - -`-R FILE' -`--reload-state=FILE' - Before execution starts, recover the internal state from the - specified frozen FILE. The options `-D', `-U', and `-t' take - effect after state is reloaded, but before the input files are - read. - - -File: m4.info, Node: Debugging options, Next: Command line files, Prev: Frozen state, Up: Invoking m4 - -2.5 Command line options for debugging -====================================== - -Finally, there are several options for aiding in debugging `m4' scripts. - -`-d[FLAGS]' -`--debug[=FLAGS]' - Set the debug-level according to the flags FLAGS. The debug-level - controls the format and amount of information presented by the - debugging functions. *Note Debug Levels::, for more details on - the format and meaning of FLAGS. If omitted, FLAGS defaults to - `aeq'. - -`--debugfile=FILE' -`-o FILE' -`--error-output=FILE' - Redirect `dumpdef' output, debug messages, and trace output to the - named FILE. Warnings, error messages, and `errprint' output are - still printed to standard error. If unspecified, debug output goes - to standard error; if empty, debug output is discarded. *Note - Debug Output::, for more details. The spellings `-o' and - `--error-output' are misleading and inconsistent with other GNU - tools; for now they are silently accepted as synonyms of - `--debugfile', but in a future version of M4, using them will - cause a warning to be issued. - -`-l NUM' -`--arglength=NUM' - Restrict the size of the output generated by macro tracing to NUM - characters per trace line. If unspecified or zero, output is - unlimited. *Note Debug Levels::, for more details. - -`-t NAME' -`--trace=NAME' - This enables tracing for the macro NAME, at any point where it is - defined. NAME need not be defined when this option is given. - This option may be given more than once, and order is significant - with respect to file names. *Note Trace::, for more details. - - -File: m4.info, Node: Command line files, Prev: Debugging options, Up: Invoking m4 - -2.6 Specifying input files on the command line -============================================== - -The remaining arguments on the command line are taken to be input file -names. If no names are present, standard input is read. A file name -of `-' is taken to mean standard input. It is conventional, but not -required, for input files to end in `.m4'. - - The input files are read in the sequence given. Standard input can -be read more than once, so the file name `-' may appear multiple times -on the command line; this makes a difference when input is from a -terminal or other special file type. It is an error if an input file -ends in the middle of argument collection, a comment, or a quoted -string. - - The options `--define' (`-D'), `--undefine' (`-U'), `--synclines' -(`-s'), and `--trace' (`-t') only take effect after processing input -from any file names that occur earlier on the command line. For -example, assume the file `foo' contains: - - $ cat foo - bar - - The text `bar' can then be redefined over multiple uses of `foo': - - $ m4 -Dbar=hello foo -Dbar=world foo - =>hello - =>world - - If none of the input files invoked `m4exit' (*note M4exit::), the -exit status of `m4' will be 0 for success, 1 for general failure (such -as problems with reading an input file), and 63 for version mismatch -(*note Using frozen files::). - - If you need to read a file whose name starts with a `-', you can -specify it as `./-file', or use `--' to mark the end of options. - - -File: m4.info, Node: Syntax, Next: Macros, Prev: Invoking m4, Up: Top - -3 Lexical and syntactic conventions -*********************************** - -As `m4' reads its input, it separates it into "tokens". A token is -either a name, a quoted string, or any single character, that is not a -part of either a name or a string. Input to `m4' can also contain -comments. GNU `m4' does not yet understand multibyte locales; all -operations are byte-oriented rather than character-oriented (although -if your locale uses a single byte encoding, such as ISO-8859-1, you -will not notice a difference). However, `m4' is eight-bit clean, so -you can use non-ASCII characters in quoted strings (*note -Changequote::), comments (*note Changecom::), and macro names (*note -Indir::), with the exception of the NUL character (the zero byte -`'\0''). - -* Menu: - -* Names:: Macro names -* Quoted strings:: Quoting input to `m4' -* Comments:: Comments in `m4' input -* Other tokens:: Other kinds of input tokens -* Input processing:: How `m4' copies input to output - - -File: m4.info, Node: Names, Next: Quoted strings, Up: Syntax - -3.1 Macro names -=============== - -A name is any sequence of letters, digits, and the character `_' -(underscore), where the first character is not a digit. `m4' will use -the longest such sequence found in the input. If a name has a macro -definition, it will be subject to macro expansion (*note Macros::). -Names are case-sensitive. - - Examples of legal names are: `foo', `_tmp', and `name01'. - - -File: m4.info, Node: Quoted strings, Next: Comments, Prev: Names, Up: Syntax - -3.2 Quoting input to `m4' -========================= - -A quoted string is a sequence of characters surrounded by quote -strings, defaulting to ``' and `'', where the nested begin and end -quotes within the string are balanced. The value of a string token is -the text, with one level of quotes stripped off. Thus - - `' - => - -is the empty string, and double-quoting turns into single-quoting. - - ``quoted'' - =>`quoted' - - The quote characters can be changed at any time, using the builtin -macro `changequote'. *Note Changequote::, for more information. - - -File: m4.info, Node: Comments, Next: Other tokens, Prev: Quoted strings, Up: Syntax - -3.3 Comments in `m4' input -========================== - -Comments in `m4' are normally delimited by the characters `#' and -newline. All characters between the comment delimiters are ignored, -but the entire comment (including the delimiters) is passed through to -the output--comments are _not_ discarded by `m4'. - - Comments cannot be nested, so the first newline after a `#' ends the -comment. The commenting effect of the begin-comment string can be -inhibited by quoting it. - - $ m4 - `quoted text' # `commented text' - =>quoted text # `commented text' - `quoting inhibits' `#' `comments' - =>quoting inhibits # comments - - The comment delimiters can be changed to any string at any time, -using the builtin macro `changecom'. *Note Changecom::, for more -information. - - -File: m4.info, Node: Other tokens, Next: Input processing, Prev: Comments, Up: Syntax - -3.4 Other kinds of input tokens -=============================== - -Any character, that is neither a part of a name, nor of a quoted string, -nor a comment, is a token by itself. When not in the context of macro -expansion, all of these tokens are just copied to output. However, -during macro expansion, whitespace characters (space, tab, newline, -formfeed, carriage return, vertical tab), parentheses (`(' and `)'), -comma (`,'), and dollar (`$') have additional roles, explained later. - - -File: m4.info, Node: Input processing, Prev: Other tokens, Up: Syntax - -3.5 How `m4' copies input to output -=================================== - -As `m4' reads the input token by token, it will copy each token -directly to the output immediately. - - The exception is when it finds a word with a macro definition. In -that case `m4' will calculate the macro's expansion, possibly reading -more input to get the arguments. It then inserts the expansion in front -of the remaining input. In other words, the resulting text from a macro -call will be read and parsed into tokens again. - - `m4' expands a macro as soon as possible. If it finds a macro call -when collecting the arguments to another, it will expand the second call -first. This process continues until there are no more macro calls to -expand and all the input has been consumed. - - For a running example, examine how `m4' handles this input: - - format(`Result is %d', eval(`2**15')) - -First, `m4' sees that the token `format' is a macro name, so it -collects the tokens `(', ``Result is %d'', `,', and ` ', before -encountering another potential macro. Sure enough, `eval' is a macro -name, so the nested argument collection picks up `(', ``2**15'', and -`)', invoking the eval macro with the lone argument of `2**15'. The -expansion of `eval(2**15)' is `32768', which is then rescanned as the -five tokens `3', `2', `7', `6', and `8'; and combined with the next -`)', the format macro now has all its arguments, as if the user had -typed: - - format(`Result is %d', 32768) - -The format macro expands to `Result is 32768', and we have another -round of scanning for the tokens `Result', ` ', `is', ` ', `3', `2', -`7', `6', and `8'. None of these are macros, so the final output is - - =>Result is 32768 - - As a more complicated example, we will contrast an actual code -example from the Gnulib project(1), showing both a buggy approach and -the desired results. The user desires to output a shell assignment -statement that takes its argument and turns it into a shell variable by -converting it to uppercase and prepending a prefix. The original -attempt looks like this: - - changequote([,])dnl - define([gl_STRING_MODULE_INDICATOR], - [ - dnl comment - GNULIB_]translit([$1],[a-z],[A-Z])[=1 - ])dnl - gl_STRING_MODULE_INDICATOR([strcase]) - => - => GNULIB_strcase=1 - => - - Oops - the argument did not get capitalized. And although the manual -is not able to easily show it, both lines that appear empty actually -contain two trailing spaces. By stepping through the parse, it is easy -to see what happened. First, `m4' sees the token `changequote', which -it recognizes as a macro, followed by `(', `[', `,', `]', and `)' to -form the argument list. The macro expands to the empty string, but -changes the quoting characters to something more useful for generating -shell code (unbalanced ``' and `'' appear all the time in shell scripts, -but unbalanced `[]' tend to be rare). Also in the first line, `m4' -sees the token `dnl', which it recognizes as a builtin macro that -consumes the rest of the line, resulting in no output for that line. - - The second line starts a macro definition. `m4' sees the token -`define', which it recognizes as a macro, followed by a `(', -`[gl_STRING_MODULE_INDICATOR]', and `,'. Because an unquoted comma was -encountered, the first argument is known to be the expansion of the -single-quoted string token, or `gl_STRING_MODULE_INDICATOR'. Next, -`m4' sees `<NL>', ` ', and ` ', but this whitespace is discarded as -part of argument collection. Then comes a rather lengthy single-quoted -string token, `[<NL> dnl comment<NL> GNULIB_]'. This is followed -by the token `translit', which `m4' recognizes as a macro name, so a -nested macro expansion has started. - - The arguments to the `translit' are found by the tokens `(', `[$1]', -`,', `[a-z]', `,', `[A-Z]', and finally `)'. All three string -arguments are expanded (or in other words, the quotes are stripped), -and since neither `$' nor `1' need capitalization, the result of the -macro is `$1'. This expansion is rescanned, resulting in the two -literal characters `$' and `1'. - - Scanning of the outer macro resumes, and picks up with `[=1<NL> ]', -and finally `)'. The collected pieces of expanded text are -concatenated, with the end result that the macro -`gl_STRING_MODULE_INDICATOR' is now defined to be the sequence `<NL> -dnl comment<NL> GNULIB_$1=1<NL> '. Once again, `dnl' is recognized -and avoids a newline in the output. - - The final line is then parsed, beginning with ` ' and ` ' that are -output literally. Then `gl_STRING_MODULE_INDICATOR' is recognized as a -macro name, with an argument list of `(', `[strcase]', and `)'. Since -the definition of the macro contains the sequence `$1', that sequence -is replaced with the argument `strcase' prior to starting the rescan. -The rescan sees `<NL>' and four spaces, which are output literally, then -`dnl', which discards the text ` comment<NL>'. Next comes four more -spaces, also output literally, and the token `GNULIB_strcase', which -resulted from the earlier parameter substitution. Since that is not a -macro name, it is output literally, followed by the literal tokens `=', -`1', `<NL>', and two more spaces. Finally, the original `<NL>' seen -after the macro invocation is scanned and output literally. - - Now for a corrected approach. This rearranges the use of newlines -and whitespace so that less whitespace is output (which, although -harmless to shell scripts, can be visually unappealing), and fixes the -quoting issues so that the capitalization occurs when the macro -`gl_STRING_MODULE_INDICATOR' is invoked, rather then when it is defined. - - changequote([,])dnl - define([gl_STRING_MODULE_INDICATOR], - [dnl comment - GNULIB_[]translit([$1], [a-z], [A-Z])=1dnl - ])dnl - gl_STRING_MODULE_INDICATOR([strcase]) - => GNULIB_STRCASE=1 - - The parsing of the first line is unchanged. The second line sees the -name of the macro to define, then sees the discarded `<NL>' and two -spaces, as before. But this time, the next token is `[dnl comment<NL> -GNULIB_[]translit([$1], [a-z], [A-Z])=1dnl<NL>]', which includes nested -quotes, followed by `)' to end the macro definition and `dnl' to skip -the newline. No early expansion of `translit' occurs, so the entire -string becomes the definition of the macro. - - The final line is then parsed, beginning with two spaces that are -output literally, and an invocation of `gl_STRING_MODULE_INDICATOR' -with the argument `strcase'. Again, the `$1' in the macro definition -is substituted prior to rescanning. Rescanning first encounters `dnl', -and discards ` comment<NL>'. Then two spaces are output literally. -Next comes the token `GNULIB_', but that is not a macro, so it is -output literally. The token `[]' is an empty string, so it does not -affect output. Then the token `translit' is encountered. - - This time, the arguments to `translit' are parsed as `(', -`[strcase]', `,', ` ', `[a-z]', `,', ` ', `[A-Z]', and `)'. The two -spaces are discarded, and the translit results in the desired result -`STRCASE'. This is rescanned, but since it is not a macro name, it is -output literally. Then the scanner sees `=' and `1', which are output -literally, followed by `dnl' which discards the rest of the definition -of `gl_STRING_MODULE_INDICATOR'. The newline at the end of output is -the literal `<NL>' that appeared after the invocation of the macro. - - The order in which `m4' expands the macros can be further explored -using the trace facilities of GNU `m4' (*note Trace::). - - ---------- Footnotes ---------- - - (1) Derived from a patch in -`http://lists.gnu.org/archive/html/bug-gnulib/2007-01/msg00389.html', -and a followup patch in -`http://lists.gnu.org/archive/html/bug-gnulib/2007-02/msg00000.html' - - -File: m4.info, Node: Macros, Next: Definitions, Prev: Syntax, Up: Top - -4 How to invoke macros -********************** - -This chapter covers macro invocation, macro arguments and how macro -expansion is treated. - -* Menu: - -* Invocation:: Macro invocation -* Inhibiting Invocation:: Preventing macro invocation -* Macro Arguments:: Macro arguments -* Quoting Arguments:: On Quoting Arguments to macros -* Macro expansion:: Expanding macros - - -File: m4.info, Node: Invocation, Next: Inhibiting Invocation, Up: Macros - -4.1 Macro invocation -==================== - -Macro invocations has one of the forms - - name - -which is a macro invocation without any arguments, or - - name(arg1, arg2, ..., argN) - -which is a macro invocation with N arguments. Macros can have any -number of arguments. All arguments are strings, but different macros -might interpret the arguments in different ways. - - The opening parenthesis _must_ follow the NAME directly, with no -spaces in between. If it does not, the macro is called with no -arguments at all. - - For a macro call to have no arguments, the parentheses _must_ be -left out. The macro call - - name() - -is a macro call with one argument, which is the empty string, not a call -with no arguments. - - -File: m4.info, Node: Inhibiting Invocation, Next: Macro Arguments, Prev: Invocation, Up: Macros - -4.2 Preventing macro invocation -=============================== - -An innovation of the `m4' language, compared to some of its -predecessors (like Stratchey's `GPM', for example), is the ability to -recognize macro calls without resorting to any special, prefixed -invocation character. While generally useful, this feature might -sometimes be the source of spurious, unwanted macro calls. So, GNU -`m4' offers several mechanisms or techniques for inhibiting the -recognition of names as macro calls. - - First of all, many builtin macros cannot meaningfully be called -without arguments. As a GNU extension, for any of these macros, -whenever an opening parenthesis does not immediately follow their name, -the builtin macro call is not triggered. This solves the most usual -cases, like for `include' or `eval'. Later in this document, the -sentence "This macro is recognized only with parameters" refers to this -specific provision of GNU M4, also known as a blind builtin macro. For -the builtins defined by POSIX that bear this disclaimer, POSIX -specifically states that invoking those builtins without arguments is -unspecified, because many other implementations simply invoke the -builtin as though it were given one empty argument instead. - - $ m4 - eval - =>eval - eval(`1') - =>1 - - There is also a command line option (`--prefix-builtins', or `-P', -*note Invoking m4: Operation modes.) that renames all builtin macros -with a prefix of `m4_' at startup. The option has no effect whatsoever -on user defined macros. For example, with this option, one has to -write `m4_dnl' and even `m4_m4exit'. It also has no effect on whether -a macro requires parameters. - - $ m4 -P - eval - =>eval - eval(`1') - =>eval(1) - m4_eval - =>m4_eval - m4_eval(`1') - =>1 - - Another alternative is to redefine problematic macros to a name less -likely to cause conflicts, *Note Definitions::. - - If your version of GNU `m4' has the `changeword' feature compiled -in, it offers far more flexibility in specifying the syntax of macro -names, both builtin or user-defined. *Note Changeword::, for more -information on this experimental feature. - - Of course, the simplest way to prevent a name from being interpreted -as a call to an existing macro is to quote it. The remainder of this -section studies a little more deeply how quoting affects macro -invocation, and how quoting can be used to inhibit macro invocation. - - Even if quoting is usually done over the whole macro name, it can -also be done over only a few characters of this name (provided, of -course, that the unquoted portions are not also a macro). It is also -possible to quote the empty string, but this works only _inside_ the -name. For example: - - `divert' - =>divert - `d'ivert - =>divert - di`ver't - =>divert - div`'ert - =>divert - -all yield the string `divert'. While in both: - - `'divert - => - divert`' - => - -the `divert' builtin macro will be called, which expands to the empty -string. - - The output of macro evaluations is always rescanned. The following -example would yield the string `de', exactly as if `m4' has been given -`substr(`abcde', `3', `2')' as input: - - define(`x', `substr(ab') - => - define(`y', `cde, `3', `2')') - => - x`'y - =>de - - Unquoted strings on either side of a quoted string are subject to -being recognized as macro names. In the following example, quoting the -empty string allows for the second `macro' to be recognized as such: - - define(`macro', `m') - => - macro(`m')macro - =>mmacro - macro(`m')`'macro - =>mm - - Quoting may prevent recognizing as a macro name the concatenation of -a macro expansion with the surrounding characters. In this example: - - define(`macro', `di$1') - => - macro(`v')`ert' - =>divert - macro(`v')ert - => - -the input will produce the string `divert'. When the quotes were -removed, the `divert' builtin was called instead. - - -File: m4.info, Node: Macro Arguments, Next: Quoting Arguments, Prev: Inhibiting Invocation, Up: Macros - -4.3 Macro arguments -=================== - -When a name is seen, and it has a macro definition, it will be expanded -as a macro. - - If the name is followed by an opening parenthesis, the arguments -will be collected before the macro is called. If too few arguments are -supplied, the missing arguments are taken to be the empty string. -However, some builtins are documented to behave differently for a -missing optional argument than for an explicit empty string. If there -are too many arguments, the excess arguments are ignored. Unquoted -leading whitespace is stripped off all arguments, but whitespace -generated by a macro expansion or occurring after a macro that expanded -to an empty string remains intact. Whitespace includes space, tab, -newline, carriage return, vertical tab, and formfeed. - - define(`macro', `$1') - => - macro( unquoted leading space lost) - =>unquoted leading space lost - macro(` quoted leading space kept') - => quoted leading space kept - macro( - divert `unquoted space kept after expansion') - => unquoted space kept after expansion - macro(macro(` - ')`whitespace from expansion kept') - => - =>whitespace from expansion kept - macro(`unquoted trailing whitespace kept' - ) - =>unquoted trailing whitespace kept - => - - Normally `m4' will issue warnings if a builtin macro is called with -an inappropriate number of arguments, but it can be suppressed with the -`--quiet' command line option (or `--silent', or `-Q', *note Invoking -m4: Operation modes.). For user defined macros, there is no check of -the number of arguments given. - - $ m4 - index(`abc') - error-->m4:stdin:1: Warning: too few arguments to builtin `index' - =>0 - index(`abc',) - =>0 - index(`abc', `b', `ignored') - error-->m4:stdin:3: Warning: excess arguments to builtin `index' ignored - =>1 - - $ m4 -Q - index(`abc') - =>0 - index(`abc',) - =>0 - index(`abc', `b', `ignored') - =>1 - - Macros are expanded normally during argument collection, and whatever -commas, quotes and parentheses that might show up in the resulting -expanded text will serve to define the arguments as well. Thus, if FOO -expands to `, b, c', the macro call - - bar(a foo, d) - -is a macro call with four arguments, which are `a ', `b', `c' and `d'. -To understand why the first argument contains whitespace, remember that -unquoted leading whitespace is never part of an argument, but trailing -whitespace always is. - - It is possible for a macro's definition to change during argument -collection, in which case the expansion uses the definition that was in -effect at the time the opening `(' was seen. - - define(`f', `1') - => - f(define(`f', `2')) - =>1 - f - =>2 - - It is an error if the end of file occurs while collecting arguments. - - hello world - =>hello world - define( - ^D - error-->m4:stdin:2: ERROR: end of file in argument list - - -File: m4.info, Node: Quoting Arguments, Next: Macro expansion, Prev: Macro Arguments, Up: Macros - -4.4 On Quoting Arguments to macros -================================== - -Each argument has unquoted leading whitespace removed. Within each -argument, all unquoted parentheses must match. For example, if FOO is -a macro, - - foo(() (`(') `(') - -is a macro call, with one argument, whose value is `() (() ('. Commas -separate arguments, except when they occur inside quotes, comments, or -unquoted parentheses. *Note Pseudo Arguments::, for examples. - - It is common practice to quote all arguments to macros, unless you -are sure you want the arguments expanded. Thus, in the above example -with the parentheses, the `right' way to do it is like this: - - foo(`() (() (') - - It is, however, in certain cases necessary (because nested expansion -must occur to create the arguments for the outer macro) or convenient -(because it uses fewer characters) to leave out quotes for some -arguments, and there is nothing wrong in doing it. It just makes life a -bit harder, if you are not careful to follow a consistent quoting style. -For consistency, this manual follows the rule of thumb that each layer -of parentheses introduces another layer of single quoting, except when -showing the consequences of quoting rules. This is done even when the -quoted string cannot be a macro, such as with integers when you have not -changed the syntax via `changeword' (*note Changeword::). - - The quoting rule of thumb of one level of quoting per parentheses -has a nice property: when a macro name appears inside parentheses, you -can determine when it will be expanded. If it is not quoted, it will be -expanded prior to the outer macro, so that its expansion becomes the -argument. If it is single-quoted, it will be expanded after the outer -macro. And if it is double-quoted, it will be used as literal text -instead of a macro name. - - define(`active', `ACT, IVE') - => - define(`show', `$1 $1') - => - show(active) - =>ACT ACT - show(`active') - =>ACT, IVE ACT, IVE - show(``active'') - =>active active - - -File: m4.info, Node: Macro expansion, Prev: Quoting Arguments, Up: Macros - -4.5 Macro expansion -=================== - -When the arguments, if any, to a macro call have been collected, the -macro is expanded, and the expansion text is pushed back onto the input -(unquoted), and reread. The expansion text from one macro call might -therefore result in more macros being called, if the calls are included, -completely or partially, in the first macro calls' expansion. - - Taking a very simple example, if FOO expands to `bar', and BAR -expands to `Hello', the input - - $ m4 -Dbar=Hello -Dfoo=bar - foo - =>Hello - -will expand first to `bar', and when this is reread and expanded, into -`Hello'. - - -File: m4.info, Node: Definitions, Next: Conditionals, Prev: Macros, Up: Top - -5 How to define new macros -************************** - -Macros can be defined, redefined and deleted in several different ways. -Also, it is possible to redefine a macro without losing a previous -value, and bring back the original value at a later time. - -* Menu: - -* Define:: Defining a new macro -* Arguments:: Arguments to macros -* Pseudo Arguments:: Special arguments to macros -* Undefine:: Deleting a macro -* Defn:: Renaming macros -* Pushdef:: Temporarily redefining macros - -* Indir:: Indirect call of macros -* Builtin:: Indirect call of builtins - - -File: m4.info, Node: Define, Next: Arguments, Up: Definitions - -5.1 Defining a macro -==================== - -The normal way to define or redefine macros is to use the builtin -`define': - - -- Builtin: define (NAME, [EXPANSION]) - Defines NAME to expand to EXPANSION. If EXPANSION is not given, - it is taken to be empty. - - The expansion of `define' is void. The macro `define' is - recognized only with parameters. - - The following example defines the macro FOO to expand to the text -`Hello World.'. - - define(`foo', `Hello world.') - => - foo - =>Hello world. - - The empty line in the output is there because the newline is not a -part of the macro definition, and it is consequently copied to the -output. This can be avoided by use of the macro `dnl'. *Note Dnl::, -for details. - - The first argument to `define' should be quoted; otherwise, if the -macro is already defined, you will be defining a different macro. This -example shows the problems with underquoting, since we did not want to -redefine `one': - - define(foo, one) - => - define(foo, two) - => - one - =>two - - GNU `m4' normally replaces only the _topmost_ definition of a macro -if it has several definitions from `pushdef' (*note Pushdef::). Some -other implementations of `m4' replace all definitions of a macro with -`define'. *Note Incompatibilities::, for more details. - - As a GNU extension, the first argument to `define' does not have to -be a simple word. It can be any text string, even the empty string. A -macro with a non-standard name cannot be invoked in the normal way, as -the name is not recognized. It can only be referenced by the builtins -`indir' (*note Indir::) and `defn' (*note Defn::). - - Arrays and associative arrays can be simulated by using non-standard -macro names. - - -- Composite: array (INDEX) - -- Composite: array_set (INDEX, [VALUE]) - Provide access to entries within an array. `array' reads the entry - at location INDEX, and `array_set' assigns VALUE to location INDEX. - - define(`array', `defn(format(``array[%d]'', `$1'))') - => - define(`array_set', `define(format(``array[%d]'', `$1'), `$2')') - => - array_set(`4', `array element no. 4') - => - array_set(`17', `array element no. 17') - => - array(`4') - =>array element no. 4 - array(eval(`10 + 7')) - =>array element no. 17 - - Change the `%d' to `%s' and it is an associative array. - - -File: m4.info, Node: Arguments, Next: Pseudo Arguments, Prev: Define, Up: Definitions - -5.2 Arguments to macros -======================= - -Macros can have arguments. The Nth argument is denoted by `$n' in the -expansion text, and is replaced by the Nth actual argument, when the -macro is expanded. Replacement of arguments happens before rescanning, -regardless of how many nesting levels of quoting appear in the -expansion. Here is an example of a macro with two arguments. - - -- Composite: exch (ARG1, ARG2) - Expands to ARG2 followed by ARG1, effectively exchanging their - order. - - define(`exch', `$2, $1') - => - exch(`arg1', `arg2') - =>arg2, arg1 - - This can be used, for example, if you like the arguments to `define' -to be reversed. - - define(`exch', `$2, $1') - => - define(exch(``expansion text'', ``macro'')) - => - macro - =>expansion text - - *Note Quoting Arguments::, for an explanation of the double quotes. -(You should try and improve this example so that clients of `exch' do -not have to double quote; or *note Answers: Improved exch.). - - As a special case, the zeroth argument, `$0', is always the name of -the macro being expanded. - - define(`test', ``Macro name: $0'') - => - test - =>Macro name: test - - If you want quoted text to appear as part of the expansion text, -remember that quotes can be nested in quoted strings. Thus, in - - define(`foo', `This is macro `foo'.') - => - foo - =>This is macro foo. - -The `foo' in the expansion text is _not_ expanded, since it is a quoted -string, and not a name. - - GNU `m4' allows the number following the `$' to consist of one or -more digits, allowing macros to have any number of arguments. The -extension of accepting multiple digits is incompatible with POSIX, and -is different than traditional implementations of `m4', which only -recognize one digit. Therefore, future versions of GNU M4 will phase -out this feature. To portably access beyond the ninth argument, you -can use the `argn' macro documented later (*note Shift::). - - POSIX also states that `$' followed immediately by `{' in a macro -definition is implementation-defined. This version of M4 passes the -literal characters `${' through unchanged, but M4 2.0 will implement an -optional feature similar to `sh', where `${11}' expands to the eleventh -argument, to replace the current recognition of `$11'. Meanwhile, if -you want to guarantee that you will get a literal `${' in output when -expanding a macro, even when you upgrade to M4 2.0, you can use nested -quoting to your advantage: - - define(`foo', `single quoted $`'{1} output') - => - define(`bar', ``double quoted $'`{2} output'') - => - foo(`a', `b') - =>single quoted ${1} output - bar(`a', `b') - =>double quoted ${2} output - - To help you detect places in your M4 input files that might change in -behavior due to the changed behavior of M4 2.0, you can use the -`--warn-macro-sequence' command-line option (*note Invoking m4: -Operation modes.) with the default regular expression. This will add a -warning any time a macro definition includes `$' followed by multiple -digits, or by `{'. The warning is not enabled by default, because it -triggers a number of warnings in Autoconf 2.61 (and Autoconf uses `-E' -to treat warnings as errors), and because it will still be possible to -restore older behavior in M4 2.0. - - $ m4 --warn-macro-sequence - define(`foo', `$001 ${1} $1') - error-->m4:stdin:1: Warning: definition of `foo' contains sequence `$001' - error-->m4:stdin:1: Warning: definition of `foo' contains sequence `${1}' - => - foo(`bar') - =>bar ${1} bar - - -File: m4.info, Node: Pseudo Arguments, Next: Undefine, Prev: Arguments, Up: Definitions - -5.3 Special arguments to macros -=============================== - -There is a special notation for the number of actual arguments supplied, -and for all the actual arguments. - - The number of actual arguments in a macro call is denoted by `$#' in -the expansion text. - - -- Composite: nargs (...) - Expands to a count of the number of arguments supplied. - - define(`nargs', `$#') - => - nargs - =>0 - nargs() - =>1 - nargs(`arg1', `arg2', `arg3') - =>3 - nargs(`commas can be quoted, like this') - =>1 - nargs(arg1#inside comments, commas do not separate arguments - still arg1) - =>1 - nargs((unquoted parentheses, like this, group arguments)) - =>1 - - Remember that `#' defaults to the comment character; if you forget -quotes to inhibit the comment behavior, your macro definition may not -end where you expected. - - dnl Attempt to define a macro to just `$#' - define(underquoted, $#) - oops) - => - underquoted - =>0) - =>oops - - The notation `$*' can be used in the expansion text to denote all -the actual arguments, unquoted, with commas in between. For example - - define(`echo', `$*') - => - echo(arg1, arg2, arg3 , arg4) - =>arg1,arg2,arg3 ,arg4 - - Often each argument should be quoted, and the notation `$@' handles -that. It is just like `$*', except that it quotes each argument. A -simple example of that is: - - define(`echo', `$@') - => - echo(arg1, arg2, arg3 , arg4) - =>arg1,arg2,arg3 ,arg4 - - Where did the quotes go? Of course, they were eaten, when the -expanded text were reread by `m4'. To show the difference, try - - define(`echo1', `$*') - => - define(`echo2', `$@') - => - define(`foo', `This is macro `foo'.') - => - echo1(foo) - =>This is macro This is macro foo.. - echo1(`foo') - =>This is macro foo. - echo2(foo) - =>This is macro foo. - echo2(`foo') - =>foo - -*Note Trace::, if you do not understand this. As another example of the -difference, remember that comments encountered in arguments are passed -untouched to the macro, and that quoting disables comments. - - define(`echo1', `$*') - => - define(`echo2', `$@') - => - define(`foo', `bar') - => - echo1(#foo'foo - foo) - =>#foo'foo - =>bar - echo2(#foo'foo - foo) - =>#foobar - =>bar' - - A `$' sign in the expansion text, that is not followed by anything -`m4' understands, is simply copied to the macro expansion, as any other -text is. - - define(`foo', `$$$ hello $$$') - => - foo - =>$$$ hello $$$ - - If you want a macro to expand to something like `$12', the judicious -use of nested quoting can put a safe character between the `$' and the -next character, relying on the rescanning to remove the nested quote. -This will prevent `m4' from interpreting the `$' sign as a reference to -an argument. - - define(`foo', `no nested quote: $1') - => - foo(`arg') - =>no nested quote: arg - define(`foo', `nested quote around $: `$'1') - => - foo(`arg') - =>nested quote around $: $1 - define(`foo', `nested empty quote after $: $`'1') - => - foo(`arg') - =>nested empty quote after $: $1 - define(`foo', `nested quote around next character: $`1'') - => - foo(`arg') - =>nested quote around next character: $1 - define(`foo', `nested quote around both: `$1'') - => - foo(`arg') - =>nested quote around both: arg - - -File: m4.info, Node: Undefine, Next: Defn, Prev: Pseudo Arguments, Up: Definitions - -5.4 Deleting a macro -==================== - -A macro definition can be removed with `undefine': - - -- Builtin: undefine (NAME...) - For each argument, remove the macro NAME. The macro names must - necessarily be quoted, since they will be expanded otherwise. - - The expansion of `undefine' is void. The macro `undefine' is - recognized only with parameters. - - foo bar blah - =>foo bar blah - define(`foo', `some')define(`bar', `other')define(`blah', `text') - => - foo bar blah - =>some other text - undefine(`foo') - => - foo bar blah - =>foo other text - undefine(`bar', `blah') - => - foo bar blah - =>foo bar blah - - Undefining a macro inside that macro's expansion is safe; the macro -still expands to the definition that was in effect at the `('. - - define(`f', ``$0':$1') - => - f(f(f(undefine(`f')`hello world'))) - =>f:f:f:hello world - f(`bye') - =>f(bye) - - It is not an error for NAME to have no macro definition. In that -case, `undefine' does nothing. - - -File: m4.info, Node: Defn, Next: Pushdef, Prev: Undefine, Up: Definitions - -5.5 Renaming macros -=================== - -It is possible to rename an already defined macro. To do this, you need -the builtin `defn': - - -- Builtin: defn (NAME) - Expands to the _quoted definition_ of NAME. If the argument is - not a defined macro, the expansion is void. - - If NAME is a user-defined macro, the quoted definition is simply - the quoted expansion text. If, instead, NAME is a builtin, the - expansion is a special token, which points to the builtin's - internal definition. This token is only meaningful as the second - argument to `define' (and `pushdef'), and is silently converted to - an empty string in most other contexts. - - The macro `defn' is recognized only with parameters. - - Its normal use is best understood through an example, which shows -how to rename `undefine' to `zap': - - define(`zap', defn(`undefine')) - => - zap(`undefine') - => - undefine(`zap') - =>undefine(zap) - - In this way, `defn' can be used to copy macro definitions, and also -definitions of builtin macros. Even if the original macro is removed, -the other name can still be used to access the definition. - - The fact that macro definitions can be transferred also explains why -you should use `$0', rather than retyping a macro's name in its -definition: - - define(`foo', `This is `$0'') - => - define(`bar', defn(`foo')) - => - bar - =>This is bar - - Macros used as string variables should be referred through `defn', -to avoid unwanted expansion of the text: - - define(`string', `The macro dnl is very useful - ') - => - string - =>The macro - defn(`string') - =>The macro dnl is very useful - => - - However, it is important to remember that `m4' rescanning is purely -textual. If an unbalanced end-quote string occurs in a macro -definition, the rescan will see that embedded quote as the termination -of the quoted string, and the remainder of the macro's definition will -be rescanned unquoted. Thus it is a good idea to avoid unbalanced -end-quotes in macro definitions or arguments to macros. - - define(`foo', a'a) - => - define(`a', `A') - => - define(`echo', `$@') - => - foo - =>A'A - defn(`foo') - =>aA' - echo(foo) - =>AA' - - Using `defn' to generate special tokens for builtin macros outside -of expected contexts can sometimes trigger warnings. But most of the -time, such tokens are silently converted to the empty string. - - defn(`defn') - => - define(defn(`divnum'), `cannot redefine a builtin token') - error-->m4:stdin:2: Warning: define: invalid macro name ignored - => - divnum - =>0 - - -File: m4.info, Node: Pushdef, Next: Indir, Prev: Defn, Up: Definitions - -5.6 Temporarily redefining macros -================================= - -It is possible to redefine a macro temporarily, reverting to the -previous definition at a later time. This is done with the builtins -`pushdef' and `popdef': - - -- Builtin: pushdef (NAME, [EXPANSION]) - -- Builtin: popdef (NAME...) - Analogous to `define' and `undefine'. - - These macros work in a stack-like fashion. A macro is temporarily - redefined with `pushdef', which replaces an existing definition of - NAME, while saving the previous definition, before the new one is - installed. If there is no previous definition, `pushdef' behaves - exactly like `define'. - - If a macro has several definitions (of which only one is - accessible), the topmost definition can be removed with `popdef'. - If there is no previous definition, `popdef' behaves like - `undefine'. - - The expansion of both `pushdef' and `popdef' is void. The macros - `pushdef' and `popdef' are recognized only with parameters. - - define(`foo', `Expansion one.') - => - foo - =>Expansion one. - pushdef(`foo', `Expansion two.') - => - foo - =>Expansion two. - pushdef(`foo', `Expansion three.') - => - pushdef(`foo', `Expansion four.') - => - popdef(`foo') - => - foo - =>Expansion three. - popdef(`foo', `foo') - => - foo - =>Expansion one. - popdef(`foo') - => - foo - =>foo - - If a macro with several definitions is redefined with `define', the -topmost definition is _replaced_ with the new definition. If it is -removed with `undefine', _all_ the definitions are removed, and not -only the topmost one. However, POSIX allows other implementations that -treat `define' as replacing an entire stack of definitions with a -single new definition, so to be portable to other implementations, it -may be worth explicitly using `popdef' and `pushdef' rather than -relying on the GNU behavior of `define'. - - define(`foo', `Expansion one.') - => - foo - =>Expansion one. - pushdef(`foo', `Expansion two.') - => - foo - =>Expansion two. - define(`foo', `Second expansion two.') - => - foo - =>Second expansion two. - undefine(`foo') - => - foo - =>foo - - Local variables within macros are made with `pushdef' and `popdef'. -At the start of the macro a new definition is pushed, within the macro -it is manipulated and at the end it is popped, revealing the former -definition. - - It is possible to temporarily redefine a builtin with `pushdef' and -`defn'. - - -File: m4.info, Node: Indir, Next: Builtin, Prev: Pushdef, Up: Definitions - -5.7 Indirect call of macros -=========================== - -Any macro can be called indirectly with `indir': - - -- Builtin: indir (NAME, [ARGS...]) - Results in a call to the macro NAME, which is passed the rest of - the arguments ARGS. If NAME is not defined, an error message is - printed, and the expansion is void. - - The macro `indir' is recognized only with parameters. - - This can be used to call macros with computed or "invalid" names -(`define' allows such names to be defined): - - define(`$$internal$macro', `Internal macro (name `$0')') - => - $$internal$macro - =>$$internal$macro - indir(`$$internal$macro') - =>Internal macro (name $$internal$macro) - - The point is, here, that larger macro packages can have private -macros defined, that will not be called by accident. They can _only_ be -called through the builtin `indir'. - - One other point to observe is that argument collection occurs before -`indir' invokes NAME, so if argument collection changes the value of -NAME, that will be reflected in the final expansion. This is different -than the behavior when invoking macros directly, where the definition -that was in effect before argument collection is used. - - $ m4 -d - define(`f', `1') - => - f(define(`f', `2')) - =>1 - indir(`f', define(`f', `3')) - =>3 - indir(`f', undefine(`f')) - error-->m4:stdin:4: undefined macro `f' - => - - When handed the result of `defn' (*note Defn::) as one of its -arguments, `indir' defers to the invoked NAME for whether a token -representing a builtin is recognized or flattened to the empty string. - - $ m4 -d - indir(defn(`defn'), `divnum') - error-->m4:stdin:1: Warning: indir: invalid macro name ignored - => - indir(`define', defn(`defn'), `divnum') - error-->m4:stdin:2: Warning: define: invalid macro name ignored - => - indir(`define', `foo', defn(`divnum')) - => - foo - =>0 - indir(`divert', defn(`foo')) - error-->m4:stdin:5: empty string treated as 0 in builtin `divert' - => - - -File: m4.info, Node: Builtin, Prev: Indir, Up: Definitions - -5.8 Indirect call of builtins -============================= - -Builtin macros can be called indirectly with `builtin': - - -- Builtin: builtin (NAME, [ARGS...]) - Results in a call to the builtin NAME, which is passed the rest of - the arguments ARGS. If NAME does not name a builtin, an error - message is printed, and the expansion is void. - - The macro `builtin' is recognized only with parameters. - - This can be used even if NAME has been given another definition that -has covered the original, or been undefined so that no macro maps to -the builtin. - - pushdef(`define', `hidden') - => - undefine(`undefine') - => - define(`foo', `bar') - =>hidden - foo - =>foo - builtin(`define', `foo', defn(`divnum')) - => - foo - =>0 - builtin(`define', `foo', `BAR') - => - foo - =>BAR - undefine(`foo') - =>undefine(foo) - foo - =>BAR - builtin(`undefine', `foo') - => - foo - =>foo - - The NAME argument only matches the original name of the builtin, -even when the `--prefix-builtins' option (or `-P', *note Invoking m4: -Operation modes.) is in effect. This is different from `indir', which -only tracks current macro names. - - $ m4 -P - m4_builtin(`divnum') - =>0 - m4_builtin(`m4_divnum') - error-->m4:stdin:2: undefined builtin `m4_divnum' - => - m4_indir(`divnum') - error-->m4:stdin:3: undefined macro `divnum' - => - m4_indir(`m4_divnum') - =>0 - - Note that `indir' and `builtin' can be used to invoke builtins -without arguments, even when they normally require parameters to be -recognized; but it will provoke a warning, and result in a void -expansion. - - builtin - =>builtin - builtin() - error-->m4:stdin:2: undefined builtin `' - => - builtin(`builtin') - error-->m4:stdin:3: Warning: too few arguments to builtin `builtin' - => - builtin(`builtin',) - error-->m4:stdin:4: undefined builtin `' - => - - -File: m4.info, Node: Conditionals, Next: Debugging, Prev: Definitions, Up: Top - -6 Conditionals, loops, and recursion -************************************ - -Macros, expanding to plain text, perhaps with arguments, are not quite -enough. We would like to have macros expand to different things, based -on decisions taken at run-time. For that, we need some kind of -conditionals. Also, we would like to have some kind of loop construct, -so we could do something a number of times, or while some condition is -true. - -* Menu: - -* Ifdef:: Testing if a macro is defined -* Ifelse:: If-else construct, or multibranch -* Shift:: Recursion in `m4' -* Forloop:: Iteration by counting -* Foreach:: Iteration by list contents - - -File: m4.info, Node: Ifdef, Next: Ifelse, Up: Conditionals - -6.1 Testing if a macro is defined -================================= - -There are two different builtin conditionals in `m4'. The first is -`ifdef': - - -- Builtin: ifdef (NAME, STRING-1, [STRING-2]) - If NAME is defined as a macro, `ifdef' expands to STRING-1, - otherwise to STRING-2. If STRING-2 is omitted, it is taken to be - the empty string (according to the normal rules). - - The macro `ifdef' is recognized only with parameters. - - ifdef(`foo', ``foo' is defined', ``foo' is not defined') - =>foo is not defined - define(`foo', `') - => - ifdef(`foo', ``foo' is defined', ``foo' is not defined') - =>foo is defined - ifdef(`no_such_macro', `yes', `no', `extra argument') - error-->m4:stdin:4: Warning: excess arguments to builtin `ifdef' ignored - =>no - - -File: m4.info, Node: Ifelse, Next: Shift, Prev: Ifdef, Up: Conditionals - -6.2 If-else construct, or multibranch -===================================== - -The other conditional, `ifelse', is much more powerful. It can be used -as a way to introduce a long comment, as an if-else construct, or as a -multibranch, depending on the number of arguments supplied: - - -- Builtin: ifelse (COMMENT) - -- Builtin: ifelse (STRING-1, STRING-2, EQUAL, [NOT-EQUAL]) - -- Builtin: ifelse (STRING-1, STRING-2, EQUAL-1, STRING-3, STRING-4, - EQUAL-2, ...) - Used with only one argument, the `ifelse' simply discards it and - produces no output. - - If called with three or four arguments, `ifelse' expands into - EQUAL, if STRING-1 and STRING-2 are equal (character for - character), otherwise it expands to NOT-EQUAL. A final fifth - argument is ignored, after triggering a warning. - - If called with six or more arguments, and STRING-1 and STRING-2 - are equal, `ifelse' expands into EQUAL-1, otherwise the first - three arguments are discarded and the processing starts again. - - The macro `ifelse' is recognized only with parameters. - - Using only one argument is a common `m4' idiom for introducing a -block comment, as an alternative to repeatedly using `dnl'. This -special usage is recognized by GNU `m4', so that in this case, the -warning about missing arguments is never triggered. - - ifelse(`some comments') - => - ifelse(`foo', `bar') - error-->m4:stdin:2: Warning: too few arguments to builtin `ifelse' - => - - Using three or four arguments provides decision points. - - ifelse(`foo', `bar', `true') - => - ifelse(`foo', `foo', `true') - =>true - define(`foo', `bar') - => - ifelse(foo, `bar', `true', `false') - =>true - ifelse(foo, `foo', `true', `false') - =>false - - Notice how the first argument was used unquoted; it is common to -compare the expansion of a macro with a string. With this macro, you -can now reproduce the behavior of blind builtins, where the macro is -recognized only with arguments. - - define(`foo', `ifelse(`$#', `0', ``$0'', `arguments:$#')') - => - foo - =>foo - foo() - =>arguments:1 - foo(`a', `b', `c') - =>arguments:3 - - However, `ifelse' can take more than four arguments. If given more -than four arguments, `ifelse' works like a `case' or `switch' statement -in traditional programming languages. If STRING-1 and STRING-2 are -equal, `ifelse' expands into EQUAL-1, otherwise the procedure is -repeated with the first three arguments discarded. This calls for an -example: - - ifelse(`foo', `bar', `third', `gnu', `gnats') - error-->m4:stdin:1: Warning: excess arguments to builtin `ifelse' ignored - =>gnu - ifelse(`foo', `bar', `third', `gnu', `gnats', `sixth') - => - ifelse(`foo', `bar', `third', `gnu', `gnats', `sixth', `seventh') - =>seventh - ifelse(`foo', `bar', `3', `gnu', `gnats', `6', `7', `8') - error-->m4:stdin:4: Warning: excess arguments to builtin `ifelse' ignored - =>7 - - Naturally, the normal case will be slightly more advanced than these -examples. A common use of `ifelse' is in macros implementing loops of -various kinds. - - -File: m4.info, Node: Shift, Next: Forloop, Prev: Ifelse, Up: Conditionals - -6.3 Recursion in `m4' -===================== - -There is no direct support for loops in `m4', but macros can be -recursive. There is no limit on the number of recursion levels, other -than those enforced by your hardware and operating system. - - Loops can be programmed using recursion and the conditionals -described previously. - - There is a builtin macro, `shift', which can, among other things, be -used for iterating through the actual arguments to a macro: - - -- Builtin: shift (ARG1, ...) - Takes any number of arguments, and expands to all its arguments - except ARG1, separated by commas, with each argument quoted. - - The macro `shift' is recognized only with parameters. - - shift - =>shift - shift(`bar') - => - shift(`foo', `bar', `baz') - =>bar,baz - - An example of the use of `shift' is this macro: - - -- Composite: reverse (...) - Takes any number of arguments, and reverses their order. - - It is implemented as: - - define(`reverse', `ifelse(`$#', `0', , `$#', `1', ``$1'', - `reverse(shift($@)), `$1'')') - => - reverse - => - reverse(`foo') - =>foo - reverse(`foo', `bar', `gnats', `and gnus') - =>and gnus, gnats, bar, foo - - While not a very interesting macro, it does show how simple loops -can be made with `shift', `ifelse' and recursion. It also shows that -`shift' is usually used with `$@'. Sometimes, a recursive algorithm -requires adding quotes to each element: - - -- Composite: quote (...) - -- Composite: dquote (...) - -- Composite: dquote_elt (...) - Takes any number of arguments, and adds quoting. With `quote', - only one level of quoting is added, effectively removing whitespace - after commas and turning multiple arguments into a single string. - With `dquote', two levels of quoting are added, one around each - element, and one around the list. And with `dquote_elt', two - levels of quoting are added around each element. - - An actual implementation of these three macros is distributed as -`m4-1.4.10/examples/quote.m4' in this package. First, let's examine -their usage: - - $ m4 -I examples - include(`quote.m4') - => - -quote-dquote-dquote_elt- - =>---- - -quote()-dquote()-dquote_elt()- - =>--`'-`'- - -quote(`1')-dquote(`1')-dquote_elt(`1')- - =>-1-`1'-`1'- - -quote(`1', `2')-dquote(`1', `2')-dquote_elt(`1', `2')- - =>-1,2-`1',`2'-`1',`2'- - define(`n', `$#')dnl - -n(quote(`1', `2'))-n(dquote(`1', `2'))-n(dquote_elt(`1', `2'))- - =>-1-1-2- - dquote(dquote_elt(`1', `2')) - =>``1'',``2'' - dquote_elt(dquote(`1', `2')) - =>``1',`2'' - - The last two lines show that when given two arguments, `dquote' -results in one string, while `dquote_elt' results in two. Now, examine -the implementation. Note that `quote' and `dquote_elt' make decisions -based on their number of arguments, so that when called without -arguments, they result in nothing instead of a quoted empty string; -this is so that it is possible to distinguish between no arguments and -an empty first argument. `dquote', on the other hand, results in a -string no matter what, since it is still possible to tell whether it -was invoked without arguments based on the resulting string. - - $ m4 -I examples - undivert(`quote.m4')dnl - =>divert(`-1') - =># quote(args) - convert args to single-quoted string - =>define(`quote', `ifelse(`$#', `0', `', ``$*'')') - =># dquote(args) - convert args to quoted list of quoted strings - =>define(`dquote', ``$@'') - =># dquote_elt(args) - convert args to list of double-quoted strings - =>define(`dquote_elt', `ifelse(`$#', `0', `', `$#', `1', ```$1''', - => ```$1'',$0(shift($@))')') - =>divert`'dnl - - One more useful macro based on `shift' allows portably selecting an -arbitrary argument (usually greater than the ninth argument), without -relying on the GNU extension of multi-digit arguments (*note -Arguments::). - - -- Composite: argn (N, ...) - Expands to argument N out of the remaining arguments. N must be a - positive number. Usually invoked as `argn(`N',$@)'. - - It is implemented as: - - define(`argn', `ifelse(`$1', 1, ``$2'', - `argn(decr(`$1'), shift(shift($@)))')') - => - argn(`1', `a') - =>a - define(`foo', `argn(`11', $@)') - => - foo(`a', `b', `c', `d', `e', `f', `g', `h', `i', `j', `k', `l') - =>k - - -File: m4.info, Node: Forloop, Next: Foreach, Prev: Shift, Up: Conditionals - -6.4 Iteration by counting -========================= - -Here is an example of a loop macro that implements a simple for loop. - - -- Composite: forloop (ITERATOR, START, END, TEXT) - Takes the name in ITERATOR, which must be a valid macro name, and - successively assign it each integer value from START to END, - inclusive. For each assignment to ITERATOR, append TEXT to the - expansion of the `forloop'. TEXT may refer to ITERATOR. Any - definition of ITERATOR prior to this invocation is restored. - - It can, for example, be used for simple counting: - - $ m4 -I examples - include(`forloop.m4') - => - forloop(`i', `1', `8', `i ') - =>1 2 3 4 5 6 7 8 - - For-loops can be nested, like: - - $ m4 -I examples - include(`forloop.m4') - => - forloop(`i', `1', `4', `forloop(`j', `1', `8', ` (i, j)') - ') - => (1, 1) (1, 2) (1, 3) (1, 4) (1, 5) (1, 6) (1, 7) (1, 8) - => (2, 1) (2, 2) (2, 3) (2, 4) (2, 5) (2, 6) (2, 7) (2, 8) - => (3, 1) (3, 2) (3, 3) (3, 4) (3, 5) (3, 6) (3, 7) (3, 8) - => (4, 1) (4, 2) (4, 3) (4, 4) (4, 5) (4, 6) (4, 7) (4, 8) - => - - The implementation of the `forloop' macro is fairly straightforward. -The `forloop' macro itself is simply a wrapper, which saves the -previous definition of the first argument, calls the internal macro -`_forloop', and re-establishes the saved definition of the first -argument. - - The macro `_forloop' expands the fourth argument once, and tests to -see if the iterator has reached the final value. If it has not -finished, it increments the iterator (using the predefined macro -`incr', *note Incr::), and recurses. - - Here is an actual implementation of `forloop', distributed as -`m4-1.4.10/examples/forloop.m4' in this package: - - $ m4 -I examples - undivert(`forloop.m4')dnl - =>divert(`-1') - =># forloop(var, from, to, stmt) - simple version - =>define(`forloop', `pushdef(`$1', `$2')_forloop($@)popdef(`$1')') - =>define(`_forloop', - => `$4`'ifelse($1, `$3', `', `define(`$1', incr($1))$0($@)')') - =>divert`'dnl - - Notice the careful use of quotes. Certain macro arguments are left -unquoted, each for its own reason. Try to find out _why_ these -arguments are left unquoted, and see what happens if they are quoted. -(As presented, these two macros are useful but not very robust for -general use. They lack even basic error handling for cases like START -less than END, END not numeric, or ITERATOR not being a macro name. -See if you can improve these macros; or *note Answers: Improved -forloop.). - - -File: m4.info, Node: Foreach, Prev: Forloop, Up: Conditionals - -6.5 Iteration by list contents -============================== - -Here is an example of a loop macro that implements list iteration. - - -- Composite: foreach (ITERATOR, PAREN-LIST, TEXT) - -- Composite: foreachq (ITERATOR, QUOTE-LIST, TEXT) - Takes the name in ITERATOR, which must be a valid macro name, and - successively assign it each value from PAREN-LIST or QUOTE-LIST. - In `foreach', PAREN-LIST is a comma-separated list of elements - contained in parentheses. In `foreachq', QUOTE-LIST is a - comma-separated list of elements contained in a quoted string. - For each assignment to ITERATOR, append TEXT to the overall - expansion. TEXT may refer to ITERATOR. Any definition of - ITERATOR prior to this invocation is restored. - - As an example, this displays each word in a list inside of a -sentence, using an implementation of `foreach' distributed as -`m4-1.4.10/examples/foreach.m4', and `foreachq' in -`m4-1.4.10/examples/foreachq.m4'. - - $ m4 -I examples - include(`foreach.m4') - => - foreach(`x', (foo, bar, foobar), `Word was: x - ')dnl - =>Word was: foo - =>Word was: bar - =>Word was: foobar - include(`foreachq.m4') - => - foreachq(`x', `foo, bar, foobar', `Word was: x - ')dnl - =>Word was: foo - =>Word was: bar - =>Word was: foobar - - It is possible to be more complex; each element of the PAREN-LIST or -QUOTE-LIST can itself be a list, to pass as further arguments to a -helper macro. This example generates a shell case statement: - - $ m4 -I examples - include(`foreach.m4') - => - define(`_case', ` $1) - $2=" $1";; - ')dnl - define(`_cat', `$1$2')dnl - case $`'1 in - =>case $1 in - foreach(`x', `(`(`a', `vara')', `(`b', `varb')', `(`c', `varc')')', - `_cat(`_case', x)')dnl - => a) - => vara=" a";; - => b) - => varb=" b";; - => c) - => varc=" c";; - esac - =>esac - - The implementation of the `foreach' macro is a bit more involved; it -is a wrapper around two helper macros. First, `_arg1' is needed to -grab the first element of a list. Second, `_foreach' implements the -recursion, successively walking through the original list. Here is a -simple implementation of `foreach': - - $ m4 -I examples - undivert(`foreach.m4')dnl - =>divert(`-1') - =># foreach(x, (item_1, item_2, ..., item_n), stmt) - =># parenthesized list, simple version - =>define(`foreach', `pushdef(`$1')_foreach($@)popdef(`$1')') - =>define(`_arg1', `$1') - =>define(`_foreach', `ifelse(`$2', `()', `', - => `define(`$1', _arg1$2)$3`'$0(`$1', (shift$2), `$3')')') - =>divert`'dnl - - Unfortunately, that implementation is not robust to macro names as -list elements. Each iteration of `_foreach' is stripping another layer -of quotes, leading to erratic results if list elements are not already -fully expanded. The first cut at implementing `foreachq' takes this -into account. Also, when using quoted elements in a PAREN-LIST, the -overall list must be quoted. A QUOTE-LIST has the nice property of -requiring fewer characters to create a list containing the same quoted -elements. To see the difference between the two macros, we attempt to -pass double-quoted macro names in a list, expecting the macro name on -output after one layer of quotes is removed during list iteration and -the final layer removed during the final rescan: - - $ m4 -I examples - define(`a', `1')define(`b', `2')define(`c', `3') - => - include(`foreach.m4') - => - include(`foreachq.m4') - => - foreach(`x', `(``a'', ``(b'', ``c)'')', `x - ') - =>1 - =>(2)1 - => - =>, x - =>) - foreachq(`x', ```a'', ``(b'', ``c)''', `x - ')dnl - =>a - =>(b - =>c) - - Obviously, `foreachq' did a better job; here is its implementation: - - $ m4 -I examples - undivert(`foreachq.m4')dnl - =>include(`quote.m4')dnl - =>divert(`-1') - =># foreachq(x, `item_1, item_2, ..., item_n', stmt) - =># quoted list, simple version - =>define(`foreachq', `pushdef(`$1')_foreachq($@)popdef(`$1')') - =>define(`_arg1', `$1') - =>define(`_foreachq', `ifelse(quote($2), `', `', - => `define(`$1', `_arg1($2)')$3`'$0(`$1', `shift($2)', `$3')')') - =>divert`'dnl - - Notice that `_foreachq' had to use the helper macro `quote' defined -earlier (*note Shift::), to ensure that the embedded `ifelse' call does -not go haywire if a list element contains a comma. Unfortunately, this -implementation of `foreachq' has its own severe flaw. Whereas the -`foreach' implementation was linear, this macro is quadratic in the -number of list elements, and is much more likely to trip up the limit -set by the command line option `--nesting-limit' (or `-L', *note -Invoking m4: Limits control.). (It is possible to have robust -iteration with linear behavior for either list style. See if you can -learn from the best elements of both of these implementations to create -robust macros; or *note Answers: Improved foreach.). - - -File: m4.info, Node: Debugging, Next: Input Control, Prev: Conditionals, Up: Top - -7 How to debug macros and input -******************************* - -When writing macros for `m4', they often do not work as intended on the -first try (as is the case with most programming languages). -Fortunately, there is support for macro debugging in `m4'. - -* Menu: - -* Dumpdef:: Displaying macro definitions -* Trace:: Tracing macro calls -* Debug Levels:: Controlling debugging output -* Debug Output:: Saving debugging output - - -File: m4.info, Node: Dumpdef, Next: Trace, Up: Debugging - -7.1 Displaying macro definitions -================================ - -If you want to see what a name expands into, you can use the builtin -`dumpdef': - - -- Builtin: dumpdef ([NAMES...]) - Accepts any number of arguments. If called without any arguments, - it displays the definitions of all known names, otherwise it - displays the definitions of the NAMES given. The output is - printed to the current debug file (usually standard error), and is - sorted by name. If an unknown name is encountered, a warning is - printed. - - The expansion of `dumpdef' is void. - - $ m4 -d - define(`foo', `Hello world.') - => - dumpdef(`foo') - error-->foo: `Hello world.' - => - dumpdef(`define') - error-->define: <define> - => - - The last example shows how builtin macros definitions are displayed. -The definition that is dumped corresponds to what would occur if the -macro were to be called at that point, even if other definitions are -still live due to redefining a macro during argument collection. - - $ m4 -d - pushdef(`f', ``$0'1')pushdef(`f', ``$0'2') - => - f(popdef(`f')dumpdef(`f')) - error-->f: ``$0'1' - =>f2 - f(popdef(`f')dumpdef(`f')) - error-->m4:stdin:3: undefined macro `f' - =>f1 - - *Note Debug Levels::, for information on controlling the details of -the display. - - -File: m4.info, Node: Trace, Next: Debug Levels, Prev: Dumpdef, Up: Debugging - -7.2 Tracing macro calls -======================= - -It is possible to trace macro calls and expansions through the builtins -`traceon' and `traceoff': - - -- Builtin: traceon ([NAMES...]) - -- Builtin: traceoff ([NAMES...]) - When called without any arguments, `traceon' and `traceoff' will - turn tracing on and off, respectively, for all currently defined - macros. - - When called with arguments, only the macros listed in NAMES are - affected, whether or not they are currently defined. - - The expansion of `traceon' and `traceoff' is void. - - Whenever a traced macro is called and the arguments have been -collected, the call is displayed. If the expansion of the macro call -is not void, the expansion can be displayed after the call. The output -is printed to the current debug file (defaulting to standard error, -*note Debug Output::). - - $ m4 -d - define(`foo', `Hello World.') - => - define(`echo', `$@') - => - traceon(`foo', `echo') - => - foo - error-->m4trace: -1- foo -> `Hello World.' - =>Hello World. - echo(`gnus', `and gnats') - error-->m4trace: -1- echo(`gnus', `and gnats') -> ``gnus',`and gnats'' - =>gnus,and gnats - - The number between dashes is the depth of the expansion. It is one -most of the time, signifying an expansion at the outermost level, but it -increases when macro arguments contain unquoted macro calls. The -maximum number that will appear between dashes is controlled by the -option `--nesting-limit' (or `-L', *note Invoking m4: Limits control.). -Additionally, the option `--trace' (or `-t') can be used to invoke -`traceon(NAME)' before parsing input. - - $ m4 -L 3 -t ifelse - ifelse(`one level') - error-->m4trace: -1- ifelse - => - ifelse(ifelse(ifelse(`three levels'))) - error-->m4trace: -3- ifelse - error-->m4trace: -2- ifelse - error-->m4trace: -1- ifelse - => - ifelse(ifelse(ifelse(ifelse(`four levels')))) - error-->m4:stdin:3: recursion limit of 3 exceeded, use -L<N> to change it - - Tracing by name is an attribute that is preserved whether the macro -is defined or not. This allows the selection of macros to trace before -those macros are defined. - - $ m4 -d - traceoff(`foo') - => - traceon(`foo') - => - foo - =>foo - define(`foo', `bar') - => - foo - error-->m4trace: -1- foo -> `bar' - =>bar - undefine(`foo') - => - ifdef(`foo', `yes', `no') - =>no - indir(`foo') - error-->m4:stdin:8: undefined macro `foo' - => - define(`foo', `blah') - => - foo - error-->m4trace: -1- foo -> `blah' - =>blah - traceoff - => - foo - =>blah - - Tracing even works on builtins. However, `defn' (*note Defn::) does -not transfer tracing status. - - $ m4 -d - traceon(`eval', `m4_divnum') - => - define(`m4_eval', defn(`eval')) - => - define(`m4_divnum', defn(`divnum')) - => - eval(divnum) - error-->m4trace: -1- eval(`0') -> `0' - =>0 - m4_eval(m4_divnum) - error-->m4trace: -2- m4_divnum -> `0' - =>0 - - *Note Debug Levels::, for information on controlling the details of -the display. - - -File: m4.info, Node: Debug Levels, Next: Debug Output, Prev: Trace, Up: Debugging - -7.3 Controlling debugging output -================================ - -The `-d' option to `m4' (or `--debug', *note Invoking m4: Debugging -options.) controls the amount of details presented in three categories -of output. Trace output is requested by `traceon' (*note Trace::), and -each line is prefixed by `m4trace:' in relation to a macro invocation. -Debug output tracks useful events not associated with a macro -invocation, and each line is prefixed by `m4debug:'. Finally, -`dumpdef' (*note Dumpdef::) output is affected, with no prefix added to -the output lines. - - The FLAGS following the option can be one or more of the following: - -`a' - In trace output, show the actual arguments that were collected - before invoking the macro. This applies to all macro calls if the - `t' flag is used, otherwise only the macros covered by calls of - `traceon'. - -`c' - In trace output, show several trace lines for each macro call. A - line is shown when the macro is seen, but before the arguments are - collected; a second line when the arguments have been collected - and a third line after the call has completed. - -`e' - In trace output, show the expansion of each macro call, if it is - not void. This applies to all macro calls if the `t' flag is used, - otherwise only the macros covered by calls of `traceon'. - -`f' - In debug and trace output, include the name of the current input - file in the output line. - -`i' - In debug output, print a message each time the current input file - is changed. - -`l' - In debug and trace output, include the current input line number - in the output line. - -`p' - In debug output, print a message when a named file is found - through the path search mechanism (*note Search Path::), giving - the actual file name used. - -`q' - In trace and dumpdef output, quote actual arguments and macro - expansions in the display with the current quotes. This is useful - in connection with the `a' and `e' flags above. - -`t' - In trace output, trace all macro calls made in this invocation of - `m4', regardless of the settings of `traceon'. - -`x' - In trace output, add a unique `macro call id' to each line of the - trace output. This is useful in connection with the `c' flag - above. - -`V' - A shorthand for all of the above flags. - - If no flags are specified with the `-d' option, the default is -`aeq'. The examples throughout this manual assume the default flags. - - There is a builtin macro `debugmode', which allows on-the-fly -control of the debugging output format: - - -- Builtin: debugmode ([FLAGS]) - The argument FLAGS should be a subset of the letters listed above. - As special cases, if the argument starts with a `+', the flags are - added to the current debug flags, and if it starts with a `-', they - are removed. If no argument is present, all debugging flags are - cleared (as if no `-d' was given), and with an empty argument the - flags are reset to the default of `aeq'. - - The expansion of `debugmode' is void. - - $ m4 - define(`foo', `FOO') - => - traceon(`foo') - => - debugmode() - => - foo - error-->m4trace: -1- foo -> `FOO' - =>FOO - debugmode - => - foo - error-->m4trace: -1- foo - =>FOO - debugmode(`+l') - => - foo - error-->m4trace:8: -1- foo - =>FOO - - -File: m4.info, Node: Debug Output, Prev: Debug Levels, Up: Debugging - -7.4 Saving debugging output -=========================== - -Debug and tracing output can be redirected to files using either the -`--debugfile' option to `m4' (*note Invoking m4: Debugging options.), -or with the builtin macro `debugfile': - - -- Builtin: debugfile ([FILE]) - Sends all further debug and trace output to FILE, opened in append - mode. If FILE is the empty string, debug and trace output are - discarded. If `debugfile' is called without any arguments, debug - and trace output are sent to standard error. This does not affect - warnings, error messages, or `errprint' output, which are always - sent to standard error. If FILE cannot be opened, the current - debug file is unchanged, and an error is issued. - - The expansion of `debugfile' is void. - - $ m4 - traceon(`divnum') - => - divnum(`extra') - error-->m4:stdin:2: Warning: excess arguments to builtin `divnum' ignored - error-->m4trace: -1- divnum(`extra') -> `0' - =>0 - debugfile() - => - divnum(`extra') - error-->m4:stdin:4: Warning: excess arguments to builtin `divnum' ignored - =>0 - debugfile - => - divnum - error-->m4trace: -1- divnum -> `0' - =>0 - - -File: m4.info, Node: Input Control, Next: File Inclusion, Prev: Debugging, Up: Top - -8 Input control -*************** - -This chapter describes various builtin macros for controlling the input -to `m4'. - -* Menu: - -* Dnl:: Deleting whitespace in input -* Changequote:: Changing the quote characters -* Changecom:: Changing the comment delimiters -* Changeword:: Changing the lexical structure of words -* M4wrap:: Saving text until end of input - - -File: m4.info, Node: Dnl, Next: Changequote, Up: Input Control - -8.1 Deleting whitespace in input -================================ - -The builtin `dnl' stands for "Discard to Next Line": - - -- Builtin: dnl - All characters, up to and including the next newline, are discarded - without performing any macro expansion. A warning is issued if - the end of the file is encountered without a newline. - - The expansion of `dnl' is void. - - It is often used in connection with `define', to remove the newline -that follows the call to `define'. Thus - - define(`foo', `Macro `foo'.')dnl A very simple macro, indeed. - foo - =>Macro foo. - - The input up to and including the next newline is discarded, as -opposed to the way comments are treated (*note Comments::). - - Usually, `dnl' is immediately followed by an end of line or some -other whitespace. GNU `m4' will produce a warning diagnostic if `dnl' -is followed by an open parenthesis. In this case, `dnl' will collect -and process all arguments, looking for a matching close parenthesis. -All predictable side effects resulting from this collection will take -place. `dnl' will return no output. The input following the matching -close parenthesis up to and including the next newline, on whatever -line containing it, will still be discarded. - - dnl(`args are ignored, but side effects occur', - define(`foo', `like this')) while this text is ignored: undefine(`foo') - error-->m4:stdin:1: Warning: excess arguments to builtin `dnl' ignored - See how `foo' was defined, foo? - =>See how foo was defined, like this? - - If the end of file is encountered without a newline character, a -warning is issued and dnl stops consuming input. - - m4wrap(`m4wrap(`2 hi - ')0 hi dnl 1 hi') - => - define(`hi', `HI') - => - ^D - error-->m4:stdin:1: Warning: end of file treated as newline - =>0 HI 2 HI - - -File: m4.info, Node: Changequote, Next: Changecom, Prev: Dnl, Up: Input Control - -8.2 Changing the quote characters -================================= - -The default quote delimiters can be changed with the builtin -`changequote': - - -- Builtin: changequote ([START = ``'], [END = `'']) - This sets START as the new begin-quote delimiter and END as the - new end-quote delimiter. If both arguments are missing, the - default quotes (``' and `'') are used. If START is void, then - quoting is disabled. Otherwise, if END is missing or void, the - default end-quote delimiter (`'') is used. The quote delimiters - can be of any length. - - The expansion of `changequote' is void. - - changequote(`[', `]') - => - define([foo], [Macro [foo].]) - => - foo - =>Macro foo. - - The quotation strings can safely contain eight-bit characters. If -no single character is appropriate, START and END can be of any length. -Other implementations cap the delimiter length to five characters, but -GNU has no inherent limit. - - changequote(`[[[', `]]]') - => - define([[[foo]]], [[[Macro [[[[[foo]]]]].]]]) - => - foo - =>Macro [[foo]]. - - Calling `changequote' with START as the empty string will -effectively disable the quoting mechanism, leaving no way to quote text. -However, using an empty string is not portable, as some other -implementations of `m4' revert to the default quoting, while others -preserve the prior non-empty delimiter. If START is not empty, then an -empty END will use the default end-quote delimiter of `'', as -otherwise, it would be impossible to end a quoted string. Again, this -is not portable, as some other `m4' implementations reuse START as the -end-quote delimiter, while others preserve the previous non-empty -value. Omitting both arguments restores the default begin-quote and -end-quote delimiters; fortunately this behavior is portable to all -implementations of `m4'. - - define(`foo', `Macro `FOO'.') - => - changequote(`', `') - => - foo - =>Macro `FOO'. - `foo' - =>`Macro `FOO'.' - changequote(`,) - => - foo - =>Macro FOO. - - There is no way in `m4' to quote a string containing an unmatched -begin-quote, except using `changequote' to change the current quotes. - - If the quotes should be changed from, say, `[' to `[[', temporary -quote characters have to be defined. To achieve this, two calls of -`changequote' must be made, one for the temporary quotes and one for -the new quotes. - - Macros are recognized in preference to the begin-quote string, so if -a prefix of START can be recognized as part of a potential macro name, -the quoting mechanism is effectively disabled. Unless you use -`changeword' (*note Changeword::), this means that START should not -begin with a letter, digit, or `_' (underscore). However, even though -quoted strings are not recognized, the quote characters can still be -discerned in macro expansion and in trace output. - - define(`echo', `$@') - => - define(`hi', `HI') - => - changequote(`q', `Q') - => - q hi Q hi - =>q HI Q HI - echo(hi) - =>qHIQ - changequote - => - changequote(`-', `EOF') - => - - hi EOF hi - => hi HI - changequote - => - changequote(`1', `2') - => - hi1hi2 - =>hi1hi2 - hi 1hi2 - =>HI hi - - Quotes are recognized in preference to argument collection. In -particular, if START is a single `(', then argument collection is -effectively disabled. For portability with other implementations, it -is a good idea to avoid `(', `,', and `)' as the first character in -START. - - define(`echo', `$#:$@:') - => - define(`hi', `HI') - => - changequote(`(',`)') - => - echo(hi) - =>0::hi - changequote - => - changequote(`((', `))') - => - echo(hi) - =>1:HI: - echo((hi)) - =>0::hi - changequote - => - changequote(`,', `)') - => - echo(hi,hi)bye) - =>1:HIhibye: - - If END is a prefix of START, the end-quote will be recognized in -preference to a nested begin-quote. In particular, changing the quotes -to have the same string for START and END disables nesting of quotes. -When quote nesting is disabled, it is impossible to double-quote -strings across macro expansions, so using the same string is not done -very often. - - define(`hi', `HI') - => - changequote(`""', `"') - => - ""hi"""hi" - =>hihi - ""hi" ""hi" - =>hi hi - ""hi"" "hi" - =>hi" "HI" - changequote - => - `hi`hi'hi' - =>hi`hi'hi - changequote(`"', `"') - => - "hi"hi"hi" - =>hiHIhi - - It is an error if the end of file occurs within a quoted string. - - `hello world' - =>hello world - `dangling quote - ^D - error-->m4:stdin:2: ERROR: end of file in string - - -File: m4.info, Node: Changecom, Next: Changeword, Prev: Changequote, Up: Input Control - -8.3 Changing the comment delimiters -=================================== - -The default comment delimiters can be changed with the builtin macro -`changecom': - - -- Builtin: changecom ([START], [END = `<NL>']) - This sets START as the new begin-comment delimiter and END as the - new end-comment delimiter. If both arguments are missing, or - START is void, then comments are disabled. Otherwise, if END is - missing or void, the default end-comment delimiter of newline is - used. The comment delimiters can be of any length. - - The expansion of `changecom' is void. - - define(`comment', `COMMENT') - => - # A normal comment - =># A normal comment - changecom(`/*', `*/') - => - # Not a comment anymore - =># Not a COMMENT anymore - But: /* this is a comment now */ while this is not a comment - =>But: /* this is a comment now */ while this is not a COMMENT - - Note how comments are copied to the output, much as if they were -quoted strings. If you want the text inside a comment expanded, quote -the begin-comment delimiter. - - Calling `changecom' without any arguments, or with START as the -empty string, will effectively disable the commenting mechanism. To -restore the original comment start of `#', you must explicitly ask for -it. If START is not empty, then an empty END will use the default -end-comment delimiter of newline, as otherwise, it would be impossible -to end a comment. However, this is not portable, as some other `m4' -implementations preserve the previous non-empty delimiters instead. - - define(`comment', `COMMENT') - => - changecom - => - # Not a comment anymore - =># Not a COMMENT anymore - changecom(`#', `') - => - # comment again - =># comment again - - The comment strings can safely contain eight-bit characters. If no -single character is appropriate, START and END can be of any length. -Other implementations cap the delimiter length to five characters, but -GNU has no inherent limit. - - Comments are recognized in preference to macros. However, this is -not compatible with other implementations, where macros and even quoting -takes precedence over comments, so it may change in a future release. -For portability, this means that START should not begin with a letter, -digit, or `_' (underscore), and that neither the start-quote nor the -start-comment string should be a prefix of the other. - - define(`hi', `HI') - => - define(`hi1hi2', `hello') - => - changecom(`q', `Q') - => - q hi Q hi - =>q hi Q HI - changecom(`1', `2') - => - hi1hi2 - =>hello - hi 1hi2 - =>HI 1hi2 - - Comments are recognized in preference to argument collection. In -particular, if START is a single `(', then argument collection is -effectively disabled. For portability with other implementations, it -is a good idea to avoid `(', `,', and `)' as the first character in -START. - - define(`echo', `$#:$@:') - => - define(`hi', `HI') - => - changecom(`(',`)') - => - echo(hi) - =>0::(hi) - changecom - => - changecom(`((', `))') - => - echo(hi) - =>1:HI: - echo((hi)) - =>0::((hi)) - changecom(`,', `)') - => - echo(hi,hi)bye) - =>1:HI,hi)bye: - - It is an error if the end of file occurs within a comment. - - changecom(`/*', `*/') - => - /*dangling comment - ^D - error-->m4:stdin:2: ERROR: end of file in comment - - -File: m4.info, Node: Changeword, Next: M4wrap, Prev: Changecom, Up: Input Control - -8.4 Changing the lexical structure of words -=========================================== - - The macro `changeword' and all associated functionality is - experimental. It is only available if the `--enable-changeword' - option was given to `configure', at GNU `m4' installation time. - The functionality will go away in the future, to be replaced by - other new features that are more efficient at providing the same - capabilities. _Do not rely on it_. Please direct your comments - about it the same way you would do for bugs. - - A file being processed by `m4' is split into quoted strings, words -(potential macro names) and simple tokens (any other single character). -Initially a word is defined by the following regular expression: - - [_a-zA-Z][_a-zA-Z0-9]* - - Using `changeword', you can change this regular expression: - - -- Optional builtin: changeword (REGEX) - Changes the regular expression for recognizing macro names to be - REGEX. If REGEX is empty, use `[_a-zA-Z][_a-zA-Z0-9]*'. REGEX - must obey the constraint that every prefix of the desired final - pattern is also accepted by the regular expression. If REGEX - contains grouping parentheses, the macro invoked is the portion - that matched the first group, rather than the entire matching - string. - - The expansion of `changeword' is void. The macro `changeword' is - recognized only with parameters. - - Relaxing the lexical rules of `m4' might be useful (for example) if -you wanted to apply translations to a file of numbers: - - ifdef(`changeword', `', `errprint(` skipping: no changeword support - ')m4exit(`77')')dnl - changeword(`[_a-zA-Z0-9]+') - => - define(`1', `0')1 - =>0 - - Tightening the lexical rules is less useful, because it will -generally make some of the builtins unavailable. You could use it to -prevent accidental call of builtins, for example: - - ifdef(`changeword', `', `errprint(` skipping: no changeword support - ')m4exit(`77')')dnl - define(`_indir', defn(`indir')) - => - changeword(`_[_a-zA-Z0-9]*') - => - esyscmd(`foo') - =>esyscmd(foo) - _indir(`esyscmd', `echo hi') - =>hi - => - - Because `m4' constructs its words a character at a time, there is a -restriction on the regular expressions that may be passed to -`changeword'. This is that if your regular expression accepts `foo', -it must also accept `f' and `fo'. - - ifdef(`changeword', `', `errprint(` skipping: no changeword support - ')m4exit(`77')')dnl - define(`foo - ', `bar - ') - => - dnl This example wants to recognize changeword, dnl, and `foo\n'. - dnl First, we check that our regexp will match. - regexp(`changeword', `[cd][a-z]*\|foo[ - ]') - =>0 - regexp(`foo - ', `[cd][a-z]*\|foo[ - ]') - =>0 - regexp(`f', `[cd][a-z]*\|foo[ - ]') - =>-1 - foo - =>foo - changeword(`[cd][a-z]*\|foo[ - ]') - => - dnl Even though `foo\n' matches, we forgot to allow `f'. - foo - =>foo - changeword(`[cd][a-z]*\|fo*[ - ]?') - => - dnl Now we can call `foo\n'. - foo - =>bar - - `changeword' has another function. If the regular expression -supplied contains any grouped subexpressions, then text outside the -first of these is discarded before symbol lookup. So: - - ifdef(`changeword', `', `errprint(` skipping: no changeword support - ')m4exit(`77')')dnl - ifdef(`__unix__', , - `errprint(` skipping: syscmd does not have unix semantics - ')m4exit(`77')')dnl - changecom(`/*', `*/')dnl - define(`foo', `bar')dnl - changeword(`#\([_a-zA-Z0-9]*\)') - => - #esyscmd(`echo foo \#foo') - =>foo bar - => - - `m4' now requires a `#' mark at the beginning of every macro -invocation, so one can use `m4' to preprocess plain text without losing -various words like `divert'. - - In `m4', macro substitution is based on text, while in TeX, it is -based on tokens. `changeword' can throw this difference into relief. -For example, here is the same idea represented in TeX and `m4'. First, -the TeX version: - - \def\a{\message{Hello}} - \catcode`\@=0 - \catcode`\\=12 - @a - @bye - =>Hello - -Then, the `m4' version: - - ifdef(`changeword', `', `errprint(` skipping: no changeword support - ')m4exit(`77')')dnl - define(`a', `errprint(`Hello')')dnl - changeword(`@\([_a-zA-Z0-9]*\)') - => - @a - =>errprint(Hello) - - In the TeX example, the first line defines a macro `a' to print the -message `Hello'. The second line defines <@> to be usable instead of -<\> as an escape character. The third line defines <\> to be a normal -printing character, not an escape. The fourth line invokes the macro -`a'. So, when TeX is run on this file, it displays the message `Hello'. - - When the `m4' example is passed through `m4', it outputs -`errprint(Hello)'. The reason for this is that TeX does lexical -analysis of macro definition when the macro is _defined_. `m4' just -stores the text, postponing the lexical analysis until the macro is -_used_. - - You should note that using `changeword' will slow `m4' down by a -factor of about seven, once it is changed to something other than the -default regular expression. You can invoke `changeword' with the empty -string to restore the default word definition, and regain the parsing -speed. - - -File: m4.info, Node: M4wrap, Prev: Changeword, Up: Input Control - -8.5 Saving text until end of input -================================== - -It is possible to `save' some text until the end of the normal input has -been seen. Text can be saved, to be read again by `m4' when the normal -input has been exhausted. This feature is normally used to initiate -cleanup actions before normal exit, e.g., deleting temporary files. - - To save input text, use the builtin `m4wrap': - - -- Builtin: m4wrap (STRING, ...) - Stores STRING in a safe place, to be reread when end of input is - reached. As a GNU extension, additional arguments are - concatenated with a space to the STRING. - - The expansion of `m4wrap' is void. The macro `m4wrap' is - recognized only with parameters. - - define(`cleanup', `This is the `cleanup' action. - ') - => - m4wrap(`cleanup') - => - This is the first and last normal input line. - =>This is the first and last normal input line. - ^D - =>This is the cleanup action. - - The saved input is only reread when the end of normal input is seen, -and not if `m4exit' is used to exit `m4'. - - It is safe to call `m4wrap' from saved text, but then the order in -which the saved text is reread is undefined. If `m4wrap' is not used -recursively, the saved pieces of text are reread in the opposite order -in which they were saved (LIFO--last in, first out). However, this -behavior is likely to change in a future release, to match POSIX, so -you should not depend on this order. - - Here is an example of implementing a factorial function using -`m4wrap': - - define(`f', `ifelse(`$1', `0', `Answer: 0!=1 - ', eval(`$1>1'), `0', `Answer: $2$1=eval(`$2$1') - ', `m4wrap(`f(decr(`$1'), `$2$1*')')')') - => - f(`10') - => - ^D - =>Answer: 10*9*8*7*6*5*4*3*2*1=3628800 - - Invocations of `m4wrap' at the same recursion level are concatenated -and rescanned as usual: - - define(`aa', `AA - ') - => - m4wrap(`a')m4wrap(`a') - => - ^D - =>AA - -however, the transition between recursion levels behaves like an end of -file condition between two input files. - - m4wrap(`m4wrap(`)')len(abc') - => - ^D - error-->m4:stdin:1: ERROR: end of file in argument list - - -File: m4.info, Node: File Inclusion, Next: Diversions, Prev: Input Control, Up: Top - -9 File inclusion -**************** - -`m4' allows you to include named files at any point in the input. - -* Menu: - -* Include:: Including named files -* Search Path:: Searching for include files - - -File: m4.info, Node: Include, Next: Search Path, Up: File Inclusion - -9.1 Including named files -========================= - -There are two builtin macros in `m4' for including files: - - -- Builtin: include (FILE) - -- Builtin: sinclude (FILE) - Both macros cause the file named FILE to be read by `m4'. When - the end of the file is reached, input is resumed from the previous - input file. - - The expansion of `include' and `sinclude' is therefore the - contents of FILE. - - If FILE does not exist (or cannot be read), the expansion is void, - and `include' will fail with an error while `sinclude' is silent. - The empty string counts as a file that does not exist. - - The macros `include' and `sinclude' are recognized only with - parameters. - - include(`none') - error-->m4:stdin:1: cannot open `none': No such file or directory - => - include() - error-->m4:stdin:2: cannot open `': No such file or directory - => - sinclude(`none') - => - sinclude() - => - - The rest of this section assumes that `m4' is invoked with the `-I' -option (*note Invoking m4: Preprocessor features.) pointing to the -`m4-1.4.10/examples' directory shipped as part of the GNU `m4' package. -The file `m4-1.4.10/examples/incl.m4' in the distribution contains the -lines: - - $ cat examples/incl.m4 - =>Include file start - =>foo - =>Include file end - - Normally file inclusion is used to insert the contents of a file -into the input stream. The contents of the file will be read by `m4' -and macro calls in the file will be expanded: - - $ m4 -I examples - define(`foo', `FOO') - => - include(`incl.m4') - =>Include file start - =>FOO - =>Include file end - => - - The fact that `include' and `sinclude' expand to the contents of the -file can be used to define macros that operate on entire files. Here -is an example, which defines `bar' to expand to the contents of -`incl.m4': - - $ m4 -I examples - define(`bar', include(`incl.m4')) - => - This is `bar': >>bar<< - =>This is bar: >>Include file start - =>foo - =>Include file end - =><< - - This use of `include' is not trivial, though, as files can contain -quotes, commas, and parentheses, which can interfere with the way the -`m4' parser works. GNU `m4' seamlessly concatenates the file contents -with the next character, even if the included file ended in the middle -of a comment, string, or macro call. These conditions are only treated -as end of file errors if specified as input files on the command line. - - In GNU `m4', an alternative method of reading files is using -`undivert' (*note Undivert::) on a named file. - - -File: m4.info, Node: Search Path, Prev: Include, Up: File Inclusion - -9.2 Searching for include files -=============================== - -GNU `m4' allows included files to be found in other directories than -the current working directory. - - If the `--prepend-include' or `-B' command-line option was provided -(*note Invoking m4: Preprocessor features.), those directories are -searched first, in reverse order that those options were listed on the -command line. Then `m4' looks in the current working directory. Next -comes the directories specified with the `--include' or `-I' option, in -the order found on the command line. Finally, if the `M4PATH' -environment variable is set, it is expected to contain a -colon-separated list of directories, which will be searched in order. - - If the automatic search for include-files causes trouble, the `p' -debug flag (*note Debug Levels::) can help isolate the problem. - - -File: m4.info, Node: Diversions, Next: Text handling, Prev: File Inclusion, Up: Top - -10 Diverting and undiverting output -*********************************** - -Diversions are a way of temporarily saving output. The output of `m4' -can at any time be diverted to a temporary file, and be reinserted into -the output stream, "undiverted", again at a later time. - - Numbered diversions are counted from 0 upwards, diversion number 0 -being the normal output stream. The number of simultaneous diversions -is limited mainly by the memory used to describe them, because GNU `m4' -tries to keep diversions in memory. However, there is a limit to the -overall memory usable by all diversions taken altogether (512K, -currently). When this maximum is about to be exceeded, a temporary -file is opened to receive the contents of the biggest diversion still -in memory, freeing this memory for other diversions. When creating the -temporary file, `m4' honors the value of the environment variable -`TMPDIR', and falls back to `/tmp'. So, it is theoretically possible -that the number and aggregate size of diversions is limited only by -available disk space. - - Diversions make it possible to generate output in a different order -than the input was read. It is possible to implement topological -sorting dependencies. For example, GNU Autoconf makes use of -diversions under the hood to ensure that the expansion of a prerequisite -macro appears in the output prior to the expansion of a dependent macro, -regardless of which order the two macros were invoked in the user's -input file. - -* Menu: - -* Divert:: Diverting output -* Undivert:: Undiverting output -* Divnum:: Diversion numbers -* Cleardivert:: Discarding diverted text - - -File: m4.info, Node: Divert, Next: Undivert, Up: Diversions - -10.1 Diverting output -===================== - -Output is diverted using `divert': - - -- Builtin: divert ([NUMBER = `0']) - The current diversion is changed to NUMBER. If NUMBER is left out - or empty, it is assumed to be zero. If NUMBER cannot be parsed, - the diversion is unchanged. - - The expansion of `divert' is void. - - When all the `m4' input will have been processed, all existing -diversions are automatically undiverted, in numerical order. - - divert(`1') - This text is diverted. - divert - => - This text is not diverted. - =>This text is not diverted. - ^D - => - =>This text is diverted. - - Several calls of `divert' with the same argument do not overwrite -the previous diverted text, but append to it. Diversions are printed -after any wrapped text is expanded. - - define(`text', `TEXT') - => - divert(`1')`diverted text.' - divert - => - m4wrap(`Wrapped text precedes ') - => - ^D - =>Wrapped TEXT precedes diverted text. - - If output is diverted to a negative diversion, it is simply -discarded. This can be used to suppress unwanted output. A common -example of unwanted output is the trailing newlines after macro -definitions. Here is a common programming idiom in `m4' for avoiding -them. - - divert(`-1') - define(`foo', `Macro `foo'.') - define(`bar', `Macro `bar'.') - divert - => - - Traditional implementations only supported ten diversions. But as a -GNU extension, diversion numbers can be as large as positive integers -will allow, rather than treating a multi-digit diversion number as a -request to discard text. - - divert(eval(`1<<28'))world - divert(`2')hello - ^D - =>hello - =>world - - Note that `divert' is an English word, but also an active macro -without arguments. When processing plain text, the word might appear in -normal text and be unintentionally swallowed as a macro invocation. One -way to avoid this is to use the `-P' option to rename all builtins -(*note Invoking m4: Operation modes.). Another is to write a wrapper -that requires a parameter to be recognized. - - We decided to divert the stream for irrigation. - =>We decided to the stream for irrigation. - define(`divert', `ifelse(`$#', `0', ``$0'', `builtin(`$0', $@)')') - => - divert(`-1') - Ignored text. - divert(`0') - => - We decided to divert the stream for irrigation. - =>We decided to divert the stream for irrigation. - - -File: m4.info, Node: Undivert, Next: Divnum, Prev: Divert, Up: Diversions - -10.2 Undiverting output -======================= - -Diverted text can be undiverted explicitly using the builtin `undivert': - - -- Builtin: undivert ([DIVERSIONS...]) - Undiverts the numeric DIVERSIONS given by the arguments, in the - order given. If no arguments are supplied, all diversions are - undiverted, in numerical order. - - As a GNU extension, DIVERSIONS may contain non-numeric strings, - which are treated as the names of files to copy into the output - without expansion. A warning is issued if a file could not be - opened. - - The expansion of `undivert' is void. - - divert(`1') - This text is diverted. - divert - => - This text is not diverted. - =>This text is not diverted. - undivert(`1') - => - =>This text is diverted. - => - - Notice the last two blank lines. One of them comes from the newline -following `undivert', the other from the newline that followed the -`divert'! A diversion often starts with a blank line like this. - - When diverted text is undiverted, it is _not_ reread by `m4', but -rather copied directly to the current output, and it is therefore not -an error to undivert into a diversion. Undiverting the empty string is -the same as specifying diversion 0; in either case nothing happens -since the output has already been flushed. - - divert(`1')diverted text - divert - => - undivert() - => - undivert(`0') - => - undivert - =>diverted text - => - - When a diversion has been undiverted, the diverted text is discarded, -and it is not possible to bring back diverted text more than once. - - divert(`1') - This text is diverted first. - divert(`0')undivert(`1')dnl - => - =>This text is diverted first. - undivert(`1') - => - divert(`1') - This text is also diverted but not appended. - divert(`0')undivert(`1')dnl - => - =>This text is also diverted but not appended. - - Attempts to undivert the current diversion are silently ignored. -Thus, when the current diversion is not 0, the current diversion does -not get rearranged among the other diversions. - - divert(`1')one - divert(`2')two - divert(`3')three - divert(`2')undivert`'dnl - divert`'undivert`'dnl - =>two - =>one - =>three - - GNU `m4' allows named files to be undiverted. Given a non-numeric -argument, the contents of the file named will be copied, uninterpreted, -to the current output. This complements the builtin `include' (*note -Include::). To illustrate the difference, assume the file `foo' -contains: - - $ cat foo - bar - -then - - define(`bar', `BAR') - => - undivert(`foo') - =>bar - => - include(`foo') - =>BAR - => - - If the file is not found (or cannot be read), an error message is -issued, and the expansion is void. It is possible to intermix files -and diversion numbers. - - divert(`1')diversion one - divert(`2')undivert(`foo')dnl - divert(`3')diversion three - divert`'dnl - undivert(`1', `2', `foo', `3')dnl - =>diversion one - =>bar - =>bar - =>diversion three - - -File: m4.info, Node: Divnum, Next: Cleardivert, Prev: Undivert, Up: Diversions - -10.3 Diversion numbers -====================== - -The current diversion is tracked by the builtin `divnum': - - -- Builtin: divnum - Expands to the number of the current diversion. - - Initial divnum - =>Initial 0 - divert(`1') - Diversion one: divnum - divert(`2') - Diversion two: divnum - ^D - => - =>Diversion one: 1 - => - =>Diversion two: 2 - - -File: m4.info, Node: Cleardivert, Prev: Divnum, Up: Diversions - -10.4 Discarding diverted text -============================= - -Often it is not known, when output is diverted, whether the diverted -text is actually needed. Since all non-empty diversion are brought back -on the main output stream when the end of input is seen, a method of -discarding a diversion is needed. If all diversions should be -discarded, the easiest is to end the input to `m4' with `divert(`-1')' -followed by an explicit `undivert': - - divert(`1') - Diversion one: divnum - divert(`2') - Diversion two: divnum - divert(`-1') - undivert - ^D - -No output is produced at all. - - Clearing selected diversions can be done with the following macro: - - -- Composite: cleardivert ([DIVERSIONS...]) - Discard the contents of each of the listed numeric DIVERSIONS. - - define(`cleardivert', - `pushdef(`_n', divnum)divert(`-1')undivert($@)divert(_n)popdef(`_n')') - => - - It is called just like `undivert', but the effect is to clear the -diversions, given by the arguments. (This macro has a nasty bug! You -should try to see if you can find it and correct it; or *note Answers: -Improved cleardivert.). - - -File: m4.info, Node: Text handling, Next: Arithmetic, Prev: Diversions, Up: Top - -11 Macros for text handling -*************************** - -There are a number of builtins in `m4' for manipulating text in various -ways, extracting substrings, searching, substituting, and so on. - -* Menu: - -* Len:: Calculating length of strings -* Index macro:: Searching for substrings -* Regexp:: Searching for regular expressions -* Substr:: Extracting substrings -* Translit:: Translating characters -* Patsubst:: Substituting text by regular expression -* Format:: Formatting strings (printf-like) - - -File: m4.info, Node: Len, Next: Index macro, Up: Text handling - -11.1 Calculating length of strings -================================== - -The length of a string can be calculated by `len': - - -- Builtin: len (STRING) - Expands to the length of STRING, as a decimal number. - - The macro `len' is recognized only with parameters. - - len() - =>0 - len(`abcdef') - =>6 - - -File: m4.info, Node: Index macro, Next: Regexp, Prev: Len, Up: Text handling - -11.2 Searching for substrings -============================= - -Searching for substrings is done with `index': - - -- Builtin: index (STRING, SUBSTRING) - Expands to the index of the first occurrence of SUBSTRING in - STRING. The first character in STRING has index 0. If SUBSTRING - does not occur in STRING, `index' expands to `-1'. - - The macro `index' is recognized only with parameters. - - index(`gnus, gnats, and armadillos', `nat') - =>7 - index(`gnus, gnats, and armadillos', `dag') - =>-1 - - Omitting SUBSTRING evokes a warning, but still produces output. - - index(`abc') - error-->m4:stdin:1: Warning: too few arguments to builtin `index' - =>0 - - -File: m4.info, Node: Regexp, Next: Substr, Prev: Index macro, Up: Text handling - -11.3 Searching for regular expressions -====================================== - -Searching for regular expressions is done with the builtin `regexp': - - -- Builtin: regexp (STRING, REGEXP, [REPLACEMENT]) - Searches for REGEXP in STRING. The syntax for regular expressions - is the same as in GNU Emacs, which is similar to BRE (Basic - Regular Expressions) in POSIX. *Note Syntax of Regular - Expressions: (emacs)Regexps. Support for ERE (Extended Regular - Expressions) is not available, but will be added in GNU M4 2.0. - - If REPLACEMENT is omitted, `regexp' expands to the index of the - first match of REGEXP in STRING. If REGEXP does not match - anywhere in STRING, it expands to -1. - - If REPLACEMENT is supplied, and there was a match, `regexp' - changes the expansion to this argument, with `\N' substituted by - the text matched by the Nth parenthesized sub-expression of - REGEXP, up to nine sub-expressions. The escape `\&' is replaced - by the text of the entire regular expression matched. For all - other characters, `\' treats the next character literally. A - warning is issued if there were fewer sub-expressions than the - `\N' requested, or if there is a trailing `\'. If there was no - match, `regexp' expands to the empty string. - - The macro `regexp' is recognized only with parameters. - - regexp(`GNUs not Unix', `\<[a-z]\w+') - =>5 - regexp(`GNUs not Unix', `\<Q\w*') - =>-1 - regexp(`GNUs not Unix', `\w\(\w+\)$', `*** \& *** \1 ***') - =>*** Unix *** nix *** - regexp(`GNUs not Unix', `\<Q\w*', `*** \& *** \1 ***') - => - - Here are some more examples on the handling of backslash: - - regexp(`abc', `\(b\)', `\\\10\a') - =>\b0a - regexp(`abc', `b', `\1\') - error-->m4:stdin:2: Warning: sub-expression 1 not present - error-->m4:stdin:2: Warning: trailing \ ignored in replacement - => - regexp(`abc', `\(\(d\)?\)\(c\)', `\1\2\3\4\5\6') - error-->m4:stdin:3: Warning: sub-expression 4 not present - error-->m4:stdin:3: Warning: sub-expression 5 not present - error-->m4:stdin:3: Warning: sub-expression 6 not present - =>c - - Omitting REGEXP evokes a warning, but still produces output. - - regexp(`abc') - error-->m4:stdin:1: Warning: too few arguments to builtin `regexp' - =>0 - - -File: m4.info, Node: Substr, Next: Translit, Prev: Regexp, Up: Text handling - -11.4 Extracting substrings -========================== - -Substrings are extracted with `substr': - - -- Builtin: substr (STRING, FROM, [LENGTH]) - Expands to the substring of STRING, which starts at index FROM, - and extends for LENGTH characters, or to the end of STRING, if - LENGTH is omitted. The starting index of a string is always 0. - The expansion is empty if there is an error parsing FROM or - LENGTH, if FROM is beyond the end of STRING, or if LENGTH is - negative. - - The macro `substr' is recognized only with parameters. - - substr(`gnus, gnats, and armadillos', `6') - =>gnats, and armadillos - substr(`gnus, gnats, and armadillos', `6', `5') - =>gnats - - Omitting FROM evokes a warning, but still produces output. - - substr(`abc') - error-->m4:stdin:1: Warning: too few arguments to builtin `substr' - =>abc - substr(`abc',) - error-->m4:stdin:2: empty string treated as 0 in builtin `substr' - =>abc - - -File: m4.info, Node: Translit, Next: Patsubst, Prev: Substr, Up: Text handling - -11.5 Translating characters -=========================== - -Character translation is done with `translit': - - -- Builtin: translit (STRING, CHARS, [REPLACEMENT]) - Expands to STRING, with each character that occurs in CHARS - translated into the character from REPLACEMENT with the same index. - - If REPLACEMENT is shorter than CHARS, the excess characters of - CHARS are deleted from the expansion; if CHARS is shorter, the - excess characters in REPLACEMENT are silently ignored. If - REPLACEMENT is omitted, all characters in STRING that are present - in CHARS are deleted from the expansion. If a character appears - more than once in CHARS, only the first instance is used in making - the translation. Only a single translation pass is made, even if - characters in REPLACEMENT also appear in CHARS. - - As a GNU extension, both CHARS and REPLACEMENT can contain - character-ranges, e.g., `a-z' (meaning all lowercase letters) or - `0-9' (meaning all digits). To include a dash `-' in CHARS or - REPLACEMENT, place it first or last in the entire string, or as - the last character of a range. Back-to-back ranges can share a - common endpoint. It is not an error for the last character in the - range to be `larger' than the first. In that case, the range runs - backwards, i.e., `9-0' means the string `9876543210'. The - expansion of a range is dependent on the underlying encoding of - characters, so using ranges is not always portable between - machines. - - The macro `translit' is recognized only with parameters. - - translit(`GNUs not Unix', `A-Z') - =>s not nix - translit(`GNUs not Unix', `a-z', `A-Z') - =>GNUS NOT UNIX - translit(`GNUs not Unix', `A-Z', `z-a') - =>tmfs not fnix - translit(`+,-12345', `+--1-5', `<;>a-c-a') - =><;>abcba - translit(`abcdef', `aabdef', `bcged') - =>bgced - - In the ASCII encoding, the first example deletes all uppercase -letters, the second converts lowercase to uppercase, and the third -`mirrors' all uppercase letters, while converting them to lowercase. -The two first cases are by far the most common, even though they are not -portable to EBCDIC or other encodings. The fourth example shows a -range ending in `-', as well as back-to-back ranges. The final example -shows that `a' is mapped to `b', not `c'; the resulting `b' is not -further remapped to `g'; the `d' and `e' are swapped, and the `f' is -discarded. - - Omitting CHARS evokes a warning, but still produces output. - - translit(`abc') - error-->m4:stdin:1: Warning: too few arguments to builtin `translit' - =>abc - - -File: m4.info, Node: Patsubst, Next: Format, Prev: Translit, Up: Text handling - -11.6 Substituting text by regular expression -============================================ - -Global substitution in a string is done by `patsubst': - - -- Builtin: patsubst (STRING, REGEXP, [REPLACEMENT]) - Searches STRING for matches of REGEXP, and substitutes REPLACEMENT - for each match. The syntax for regular expressions is the same as - in GNU Emacs (*note Regexp::). - - The parts of STRING that are not covered by any match of REGEXP - are copied to the expansion. Whenever a match is found, the - search proceeds from the end of the match, so a character from - STRING will never be substituted twice. If REGEXP matches a - string of zero length, the start position for the search is - incremented, to avoid infinite loops. - - When a replacement is to be made, REPLACEMENT is inserted into the - expansion, with `\N' substituted by the text matched by the Nth - parenthesized sub-expression of PATSUBST, for up to nine - sub-expressions. The escape `\&' is replaced by the text of the - entire regular expression matched. For all other characters, `\' - treats the next character literally. A warning is issued if there - were fewer sub-expressions than the `\N' requested, or if there is - a trailing `\'. - - The REPLACEMENT argument can be omitted, in which case the text - matched by REGEXP is deleted. - - The macro `patsubst' is recognized only with parameters. - - patsubst(`GNUs not Unix', `^', `OBS: ') - =>OBS: GNUs not Unix - patsubst(`GNUs not Unix', `\<', `OBS: ') - =>OBS: GNUs OBS: not OBS: Unix - patsubst(`GNUs not Unix', `\w*', `(\&)') - =>(GNUs)() (not)() (Unix)() - patsubst(`GNUs not Unix', `\w+', `(\&)') - =>(GNUs) (not) (Unix) - patsubst(`GNUs not Unix', `[A-Z][a-z]+') - =>GN not - patsubst(`GNUs not Unix', `not', `NOT\') - error-->m4:stdin:6: Warning: trailing \ ignored in replacement - =>GNUs NOT Unix - - Here is a slightly more realistic example, which capitalizes -individual words or whole sentences, by substituting calls of the macros -`upcase' and `downcase' into the strings. - - -- Composite: upcase (TEXT) - -- Composite: downcase (TEXT) - -- Composite: capitalize (TEXT) - Expand to TEXT, but with capitalization changed: `upcase' changes - all letters to upper case, `downcase' changes all letters to lower - case, and `capitalize' changes the first character of each word to - upper case and the remaining characters to lower case. - - define(`upcase', `translit(`$*', `a-z', `A-Z')')dnl - define(`downcase', `translit(`$*', `A-Z', `a-z')')dnl - define(`capitalize1', - `regexp(`$1', `^\(\w\)\(\w*\)', - `upcase(`\1')`'downcase(`\2')')')dnl - define(`capitalize', - `patsubst(`$1', `\w+', `capitalize1(`\&')')')dnl - capitalize(`GNUs not Unix') - =>Gnus Not Unix - - While `regexp' replaces the whole input with the replacement as soon -as there is a match, `patsubst' replaces each _occurrence_ of a match -and preserves non-matching pieces: - - define(`patreg', - `patsubst($@) - regexp($@)')dnl - patreg(`bar foo baz Foo', `foo\|Foo', `FOO') - =>bar FOO baz FOO - =>FOO - patreg(`aba abb 121', `\(.\)\(.\)\1', `\2\1\2') - =>bab abb 212 - =>bab - - Omitting REGEXP evokes a warning, but still produces output. - - patsubst(`abc') - error-->m4:stdin:1: Warning: too few arguments to builtin `patsubst' - =>abc - - -File: m4.info, Node: Format, Prev: Patsubst, Up: Text handling - -11.7 Formatting strings (printf-like) -===================================== - -Formatted output can be made with `format': - - -- Builtin: format (FORMAT-STRING, ...) - Works much like the C function `printf'. The first argument - FORMAT-STRING can contain `%' specifications which are satisfied - by additional arguments, and the expansion of `format' is the - formatted string. - - The macro `format' is recognized only with parameters. - - Its use is best described by a few examples: - - define(`foo', `The brown fox jumped over the lazy dog') - => - format(`The string "%s" uses %d characters', foo, len(foo)) - =>The string "The brown fox jumped over the lazy dog" uses 38 characters - format(`%*.*d', `-1', `-1', `1') - =>1 - format(`%.0f', `56789.9876') - =>56790 - len(format(`%-*X', `5000', `1')) - =>5000 - ifelse(format(`%010F', `infinity'), ` INF', `success', - format(`%010F', `infinity'), ` INFINITY', `success', - format(`%010F', `infinity')) - =>success - ifelse(format(`%.1A', `1.999'), `0X1.0P+1', `success', - format(`%.1A', `1.999'), `0X2.0P+0', `success', - format(`%.1A', `1.999')) - =>success - - Using the `forloop' macro defined earlier (*note Forloop::), this -example shows how `format' can be used to produce tabular output. - - $ m4 -I examples - include(`forloop.m4') - => - forloop(`i', `1', `10', `format(`%6d squared is %10d - ', i, eval(i**2))') - => 1 squared is 1 - => 2 squared is 4 - => 3 squared is 9 - => 4 squared is 16 - => 5 squared is 25 - => 6 squared is 36 - => 7 squared is 49 - => 8 squared is 64 - => 9 squared is 81 - => 10 squared is 100 - => - - The builtin `format' is modeled after the ANSI C `printf' function, -and supports these `%' specifiers: `c', `s', `d', `o', `x', `X', `u', -`a', `A', `e', `E', `f', `F', `g', `G', and `%'; it supports field -widths and precisions, and the flags `+', `-', ` ', `0', `#', and `''. -For integer specifiers, the width modifiers `hh', `h', and `l' are -recognized, and for floating point specifiers, the width modifier `l' -is recognized. Items not yet supported include positional arguments, -the `n', `p', `S', and `C' specifiers, the `z', `t', `j', `L' and `ll' -modifiers, and any platform extensions available in the native -`printf'. For more details on the functioning of `printf', see the C -Library Manual, or the POSIX specification (for example, `%a' is -supported even on platforms that haven't yet implemented C99 -hexadecimal floating point output natively). - - Unrecognized specifiers result in a warning. It is anticipated that -a future release of GNU `m4' will support more specifiers, and give -better warnings when various problems such as overflow are encountered. -Likewise, escape sequences are not yet recognized. - - format(`%p', `0') - error-->m4:stdin:1: Warning: unrecognized specifier in `%p' - => - - -File: m4.info, Node: Arithmetic, Next: Shell commands, Prev: Text handling, Up: Top - -12 Macros for doing arithmetic -****************************** - -Integer arithmetic is included in `m4', with a C-like syntax. As -convenient shorthands, there are builtins for simple increment and -decrement operations. - -* Menu: - -* Incr:: Decrement and increment operators -* Eval:: Evaluating integer expressions - - -File: m4.info, Node: Incr, Next: Eval, Up: Arithmetic - -12.1 Decrement and increment operators -====================================== - -Increment and decrement of integers are supported using the builtins -`incr' and `decr': - - -- Builtin: incr (NUMBER) - -- Builtin: decr (NUMBER) - Expand to the numerical value of NUMBER, incremented or - decremented, respectively, by one. Except for the empty string, - the expansion is empty if NUMBER could not be parsed. - - The macros `incr' and `decr' are recognized only with parameters. - - incr(`4') - =>5 - decr(`7') - =>6 - incr() - error-->m4:stdin:3: empty string treated as 0 in builtin `incr' - =>1 - decr() - error-->m4:stdin:4: empty string treated as 0 in builtin `decr' - =>-1 - - -File: m4.info, Node: Eval, Prev: Incr, Up: Arithmetic - -12.2 Evaluating integer expressions -=================================== - -Integer expressions are evaluated with `eval': - - -- Builtin: eval (EXPRESSION, [RADIX = `10'], [WIDTH]) - Expands to the value of EXPRESSION. The expansion is empty if a - problem is encountered while parsing the arguments. If specified, - RADIX and WIDTH control the format of the output. - - Calculations are done with 32-bit signed numbers. Overflow - silently results in wraparound. A warning is issued if division - by zero is attempted, or if EXPRESSION could not be parsed. - - Expressions can contain the following operators, listed in order of - decreasing precedence. - - `()' - Parentheses - - `+ - ~ !' - Unary plus and minus, and bitwise and logical negation - - `**' - Exponentiation - - `* / %' - Multiplication, division, and modulo - - `+ -' - Addition and subtraction - - `<< >>' - Shift left or right - - `> >= < <=' - Relational operators - - `== !=' - Equality operators - - `&' - Bitwise and - - `^' - Bitwise exclusive-or - - `|' - Bitwise or - - `&&' - Logical and - - `||' - Logical or - - The macro `eval' is recognized only with parameters. - - All binary operators, except exponentiation, are left associative. C -operators that perform variable assignment, such as `+=' or `--', are -not implemented, since `eval' only operates on constants, not -variables. Attempting to use them results in an error. However, since -traditional implementations treated `=' as an undocumented alias for -`==' as opposed to an assignment operator, this usage is supported as a -special case. Be aware that a future version of GNU M4 may support -assignment semantics as an extension when POSIX mode is not requested, -and that using `=' to check equality is not portable. - - eval(`2 = 2') - error-->m4:stdin:1: Warning: recommend ==, not =, for equality operator - =>1 - eval(`++0') - error-->m4:stdin:2: invalid operator in eval: ++0 - => - eval(`0 |= 1') - error-->m4:stdin:3: invalid operator in eval: 0 |= 1 - => - - Note that some older `m4' implementations use `^' as an alternate -operator for the exponentiation, although POSIX requires the C behavior -of bitwise exclusive-or. The precedence of the negation operators, `~' -and `!', was traditionally lower than equality. The unary operators -could not be used reliably more than once on the same term without -intervening parentheses. The traditional precedence of the equality -operators `==' and `!=' was identical instead of lower than the -relational operators such as `<', even through GNU M4 1.4.8. Starting -with version 1.4.9, GNU M4 correctly follows POSIX precedence rules. -M4 scripts designed to be portable between releases must be aware that -parentheses may be required to enforce C precedence rules. Likewise, -division by zero, even in the unused branch of a short-circuiting -operator, is not always well-defined in other implementations. - - Following are some examples where the current version of M4 follows C -precedence rules, but where older versions and some other -implementations of `m4' require explicit parentheses to get the correct -result: - - eval(`1 == 2 > 0') - =>1 - eval(`(1 == 2) > 0') - =>0 - eval(`! 0 * 2') - =>2 - eval(`! (0 * 2)') - =>1 - eval(`1 | 1 ^ 1') - =>1 - eval(`(1 | 1) ^ 1') - =>0 - eval(`+ + - ~ ! ~ 0') - =>1 - eval(`2 || 1 / 0') - =>1 - eval(`0 || 1 / 0') - error-->m4:stdin:9: divide by zero in eval: 0 || 1 / 0 - => - eval(`0 && 1 % 0') - =>0 - eval(`2 && 1 % 0') - error-->m4:stdin:11: modulo by zero in eval: 2 && 1 % 0 - => - - As a GNU extension, the operator `**' performs integral -exponentiation. The operator is right-associative, and if evaluated, -the exponent must be non-negative, and at least one of the arguments -must be non-zero, or a warning is issued. - - eval(`2 ** 3 ** 2') - =>512 - eval(`(2 ** 3) ** 2') - =>64 - eval(`0 ** 1') - =>0 - eval(`2 ** 0') - =>1 - eval(`0 ** 0') - => - error-->m4:stdin:5: divide by zero in eval: 0 ** 0 - eval(`4 ** -2') - error-->m4:stdin:6: negative exponent in eval: 4 ** -2 - => - - Within EXPRESSION, (but not RADIX or WIDTH), numbers without a -special prefix are decimal. A simple `0' prefix introduces an octal -number. `0x' introduces a hexadecimal number. As GNU extensions, `0b' -introduces a binary number. `0r' introduces a number expressed in any -radix between 1 and 36: the prefix should be immediately followed by -the decimal expression of the radix, a colon, then the digits making -the number. For radix 1, leading zeros are ignored, and all remaining -digits must be `1'; for all other radices, the digits are `0', `1', `2', -.... Beyond `9', the digits are `a', `b' ... up to `z'. Lower and -upper case letters can be used interchangeably in numbers prefixes and -as number digits. - - Parentheses may be used to group subexpressions whenever needed. -For the relational operators, a true relation returns `1', and a false -relation return `0'. - - Here are a few examples of use of `eval'. - - eval(`-3 * 5') - =>-15 - eval(`-99 / 10') - =>-9 - eval(`-99 % 10') - =>-9 - eval(`99 % -10') - =>9 - eval(index(`Hello world', `llo') >= 0) - =>1 - eval(`0r1:0111 + 0b100 + 0r3:12') - =>12 - define(`square', `eval(`($1) ** 2')') - => - square(`9') - =>81 - square(square(`5')` + 1') - =>676 - define(`foo', `666') - => - eval(`foo / 6') - error-->m4:stdin:11: bad expression in eval: foo / 6 - => - eval(foo / 6) - =>111 - - As the last two lines show, `eval' does not handle macro names, even -if they expand to a valid expression (or part of a valid expression). -Therefore all macros must be expanded before they are passed to `eval'. - - Some calculations are not portable to other implementations, since -they have undefined semantics in C, but GNU `m4' has well-defined -behavior on overflow. When shifting, an out-of-range shift amount is -implicitly brought into the range of 32-bit signed integers using an -implicit bit-wise and with 0x1f). - - define(`max_int', eval(`0x7fffffff')) - => - define(`min_int', incr(max_int)) - => - eval(min_int` < 0') - =>1 - eval(max_int` > 0') - =>1 - ifelse(eval(min_int` / -1'), min_int, `overflow occurred') - =>overflow occurred - min_int - =>-2147483648 - eval(`0x80000000 % -1') - =>0 - eval(`-4 >> 1') - =>-2 - eval(`-4 >> 33') - =>-2 - - If RADIX is specified, it specifies the radix to be used in the -expansion. The default radix is 10; this is also the case if RADIX is -the empty string. A warning results if the radix is outside the range -of 1 through 36, inclusive. The result of `eval' is always taken to be -signed. No radix prefix is output, and for radices greater than 10, -the digits are lower case. The WIDTH argument specifies the minimum -output width, excluding any negative sign. The result is zero-padded -to extend the expansion to the requested width. A warning results if -the width is negative. If RADIX or WIDTH is out of bounds, the -expansion of `eval' is empty. - - eval(`666', `10') - =>666 - eval(`666', `11') - =>556 - eval(`666', `6') - =>3030 - eval(`666', `6', `10') - =>0000003030 - eval(`-666', `6', `10') - =>-0000003030 - eval(`10', `', `0') - =>10 - `0r1:'eval(`10', `1', `11') - =>0r1:01111111111 - eval(`10', `16') - =>a - eval(`1', `37') - error-->m4:stdin:9: radix 37 in builtin `eval' out of range - => - eval(`1', , `-1') - error-->m4:stdin:10: negative width to builtin `eval' - => - eval() - error-->m4:stdin:11: empty string treated as 0 in builtin `eval' - =>0 - - -File: m4.info, Node: Shell commands, Next: Miscellaneous, Prev: Arithmetic, Up: Top - -13 Macros for running shell commands -************************************ - -There are a few builtin macros in `m4' that allow you to run shell -commands from within `m4'. - - Note that the definition of a valid shell command is system -dependent. On UNIX systems, this is the typical `/bin/sh'. But on -other systems, such as native Windows, the shell has a different syntax -of commands that it understands. Some examples in this chapter assume -`/bin/sh', and also demonstrate how to quit early with a known exit -value if this is not the case. - -* Menu: - -* Platform macros:: Determining the platform -* Syscmd:: Executing simple commands -* Esyscmd:: Reading the output of commands -* Sysval:: Exit status -* Mkstemp:: Making temporary files - - -File: m4.info, Node: Platform macros, Next: Syscmd, Up: Shell commands - -13.1 Determining the platform -============================= - -Sometimes it is desirable for an input file to know which platform `m4' -is running on. GNU `m4' provides several macros that are predefined to -expand to the empty string; checking for their existence will confirm -platform details. - - -- Optional builtin: __gnu__ - -- Optional builtin: __os2__ - -- Optional builtin: os2 - -- Optional builtin: __unix__ - -- Optional builtin: unix - -- Optional builtin: __windows__ - -- Optional builtin: windows - Each of these macros is conditionally defined as needed to - describe the environment of `m4'. If defined, each macro expands - to the empty string. - - When GNU extensions are in effect (that is, when you did not use the -`-G' option, *note Invoking m4: Limits control.), GNU `m4' will define -the macro `__gnu__' to expand to the empty string. - - __gnu__ - => - ifdef(`__gnu__', `Extensions are active') - =>Extensions are active - - On UNIX systems, GNU `m4' will define `__unix__' by default, or -`unix' when the `-G' option is specified. - - On native Windows systems, GNU `m4' will define `__windows__' by -default, or `windows' when the `-G' option is specified. - - On OS/2 systems, GNU `m4' will define `__os2__' by default, or `os2' -when the `-G' option is specified. - - If GNU `m4' does not provide a platform macro for your system, -please report that as a bug. - - define(`provided', `0') - => - ifdef(`__unix__', `define(`provided', incr(provided))') - => - ifdef(`__windows__', `define(`provided', incr(provided))') - => - ifdef(`__os2__', `define(`provided', incr(provided))') - => - provided - =>1 - - -File: m4.info, Node: Syscmd, Next: Esyscmd, Prev: Platform macros, Up: Shell commands - -13.2 Executing simple commands -============================== - -Any shell command can be executed, using `syscmd': - - -- Builtin: syscmd (SHELL-COMMAND) - Executes SHELL-COMMAND as a shell command. - - The expansion of `syscmd' is void, _not_ the output from - SHELL-COMMAND! Output or error messages from SHELL-COMMAND are - not read by `m4'. *Note Esyscmd::, if you need to process the - command output. - - Prior to executing the command, `m4' flushes its buffers. The - default standard input, output and error of SHELL-COMMAND are the - same as those of `m4'. - - The macro `syscmd' is recognized only with parameters. - - define(`foo', `FOO') - => - syscmd(`echo foo') - =>foo - => - - Note how the expansion of `syscmd' keeps the trailing newline of the -command, as well as using the newline that appeared after the macro. - - The following is an example of SHELL-COMMAND using the same standard -input as `m4': - - $ echo "m4wrap(\`syscmd(\`cat')')" | m4 - => - - It tells `m4' to read all of its input before executing the wrapped -text, then hand a valid (albeit emptied) pipe as standard input for the -`cat' subcommand. Therefore, you should be careful when using standard -input (either by specifying no files, or by passing `-' as a file name -on the command line, *note Invoking m4: Command line files.), and also -invoking subcommands via `syscmd' or `esyscmd' that consume data from -standard input. When standard input is a seekable file, the subprocess -will pick up with the next character not yet processed by `m4'; when it -is a pipe or other non-seekable file, there is no guarantee how much -data will already be buffered by `m4' and thus unavailable to the child. - - -File: m4.info, Node: Esyscmd, Next: Sysval, Prev: Syscmd, Up: Shell commands - -13.3 Reading the output of commands -=================================== - -If you want `m4' to read the output of a shell command, use `esyscmd': - - -- Builtin: esyscmd (SHELL-COMMAND) - Expands to the standard output of the shell command SHELL-COMMAND. - - Prior to executing the command, `m4' flushes its buffers. The - default standard input and standard error of SHELL-COMMAND are the - same as those of `m4'. The error output of SHELL-COMMAND is not a - part of the expansion: it will appear along with the error output - of `m4'. - - The macro `esyscmd' is recognized only with parameters. - - define(`foo', `FOO') - => - esyscmd(`echo foo') - =>FOO - => - - Note how the expansion of `esyscmd' keeps the trailing newline of -the command, as well as using the newline that appeared after the macro. - - Just as with `syscmd', care must be exercised when sharing standard -input between `m4' and the child process of `esyscmd'. - - -File: m4.info, Node: Sysval, Next: Mkstemp, Prev: Esyscmd, Up: Shell commands - -13.4 Exit status -================ - -To see whether a shell command succeeded, use `sysval': - - -- Builtin: sysval - Expands to the exit status of the last shell command run with - `syscmd' or `esyscmd'. Expands to 0 if no command has been run - yet. - - sysval - =>0 - syscmd(`false') - => - ifelse(sysval, `0', `zero', `non-zero') - =>non-zero - syscmd(`exit 2') - => - sysval - =>2 - syscmd(`true') - => - sysval - =>0 - esyscmd(`false') - => - ifelse(sysval, `0', `zero', `non-zero') - =>non-zero - esyscmd(`exit 2') - => - sysval - =>2 - esyscmd(`true') - => - sysval - =>0 - - `sysval' results in 127 if there was a problem executing the -command, for example, if the system-imposed argument length is exceeded, -or if there were not enough resources to fork. It is not possible to -distinguish between failed execution and successful execution that had -an exit status of 127. - - On UNIX platforms, where it is possible to detect when command -execution is terminated by a signal, rather than a normal exit, the -result is the signal number shifted left by eight bits. - - dnl This test assumes kill is a shell builtin, and that signals are - dnl recognizable. - ifdef(`__unix__', , - `errprint(` skipping: syscmd does not have unix semantics - ')m4exit(`77')')dnl - syscmd(`kill -9 $$') - => - sysval - =>2304 - syscmd() - => - sysval - =>0 - esyscmd(`kill -9 $$') - => - sysval - =>2304 - - -File: m4.info, Node: Mkstemp, Prev: Sysval, Up: Shell commands - -13.5 Making temporary files -=========================== - -Commands specified to `syscmd' or `esyscmd' might need a temporary -file, for output or for some other purpose. There is a builtin macro, -`mkstemp', for making a temporary file: - - -- Builtin: mkstemp (TEMPLATE) - -- Builtin: maketemp (TEMPLATE) - Expands to a name of a new, empty file, made from the string - TEMPLATE, which should end with the string `XXXXXX'. The six `X' - characters are then replaced with random characters matching the - regular expression `[a-zA-Z0-9._-]', in order to make the file - name unique. If fewer than six `X' characters are found at the end - of `template', the result will be longer than the template. The - created file will have access permissions as if by `chmod =rw,go=', - meaning that the current umask of the `m4' process is taken into - account, and at most only the current user can read and write the - file. - - The traditional behavior, standardized by POSIX, is that - `maketemp' merely replaces the trailing `X' with the process id, - without creating a file, and without ensuring that the resulting - string is a unique file name. In part, this means that using the - same TEMPLATE twice in the same input file will result in the same - expansion. This behavior is a security hole, as it is very easy - for another process to guess the name that will be generated, and - thus interfere with a subsequent use of `syscmd' trying to - manipulate that file name. Hence, POSIX has recommended that all - new implementations of `m4' provide the secure `mkstemp' builtin, - and that users of `m4' check for its existence. - - The expansion is void and an error issued if a temporary file could - not be created. - - The macros `mkstemp' and `maketemp' are recognized only with - parameters. - - If you try this next example, you will most likely get different -output for the two file names, since the replacement characters are -randomly chosen: - - $ m4 - maketemp(`/tmp/fooXXXXXX') - =>/tmp/fooa07346 - ifdef(`mkstemp', `define(`maketemp', defn(`mkstemp'))', - `define(`mkstemp', defn(`maketemp'))dnl - errprint(`warning: potentially insecure maketemp implementation - ')') - => - mkstemp(`doc') - =>docQv83Uw - - Unless you use the `--traditional' command line option (or `-G', -*note Invoking m4: Limits control.), the GNU version of `maketemp' is -secure. This means that using the same template to multiple calls will -generate multiple files. However, we recommend that you use the new -`mkstemp' macro, introduced in GNU M4 1.4.8, which is secure even in -traditional mode. - - $ m4 - syscmd(`echo foo??????')dnl - =>foo?????? - define(`file1', maketemp(`fooXXXXXX'))dnl - ifelse(esyscmd(`echo foo??????'), `foo??????', `no file', `created') - =>created - define(`file2', maketemp(`fooXX'))dnl - define(`file3', mkstemp(`fooXXXXXX'))dnl - ifelse(len(file1), len(file2), `same length', `different') - =>same length - ifelse(file1, file2, `same', `different file') - =>different file - ifelse(file2, file3, `same', `different file') - =>different file - ifelse(file1, file3, `same', `different file') - =>different file - syscmd(`rm 'file1 file2 file3) - => - sysval - =>0 - - -File: m4.info, Node: Miscellaneous, Next: Frozen files, Prev: Shell commands, Up: Top - -14 Miscellaneous builtin macros -******************************* - -This chapter describes various builtins, that do not really belong in -any of the previous chapters. - -* Menu: - -* Errprint:: Printing error messages -* Location:: Printing current location -* M4exit:: Exiting from `m4' - - -File: m4.info, Node: Errprint, Next: Location, Up: Miscellaneous - -14.1 Printing error messages -============================ - -You can print error messages using `errprint': - - -- Builtin: errprint (MESSAGE, ...) - Prints MESSAGE and the rest of the arguments to standard error, - separated by spaces. Standard error is used, regardless of the - `--debugfile' option (*note Invoking m4: Debugging options.). - - The expansion of `errprint' is void. The macro `errprint' is - recognized only with parameters. - - errprint(`Invalid arguments to forloop - ') - error-->Invalid arguments to forloop - => - errprint(`1')errprint(`2',`3 - ') - error-->12 3 - => - - A trailing newline is _not_ printed automatically, so it should be -supplied as part of the argument, as in the example. Unfortunately, the -exact output of `errprint' is not very portable to other `m4' -implementations: POSIX requires that all arguments be printed, but some -implementations of `m4' only print the first. Furthermore, some BSD -implementations always append a newline for each `errprint' call, -regardless of whether the last argument already had one, and POSIX is -silent on whether this is acceptable. - - -File: m4.info, Node: Location, Next: M4exit, Prev: Errprint, Up: Miscellaneous - -14.2 Printing current location -============================== - -To make it possible to specify the location of an error, three utility -builtins exist: - - -- Builtin: __file__ - -- Builtin: __line__ - -- Builtin: __program__ - Expand to the quoted name of the current input file, the current - input line number in that file, and the quoted name of the current - invocation of `m4'. - - errprint(__program__:__file__:__line__: `input error - ') - error-->m4:stdin:1: input error - => - - Line numbers start at 1 for each file. If the file was found due to -the `-I' option or `M4PATH' environment variable, that is reflected in -the file name. The syncline option (`-s', *note Invoking m4: -Preprocessor features.), and the `f' and `l' flags of `debugmode' -(*note Debug Levels::), also use this notion of current file and line. -Redefining the three location macros has no effect on syncline, debug, -warning, or error message output. - - This example reuses the file `incl.m4' mentioned earlier (*note -Include::): - - $ m4 -I examples - define(`foo', ``$0' called at __file__:__line__') - => - foo - =>foo called at stdin:2 - include(`incl.m4') - =>Include file start - =>foo called at ../examples/incl.m4:2 - =>Include file end - => - - The location of macros invoked during the rescanning of macro -expansion text corresponds to the location in the file where the -expansion was triggered, regardless of how many newline characters the -expansion text contains. As of GNU M4 1.4.8, the location of text -wrapped with `m4wrap' (*note M4wrap::) is the point at which the -`m4wrap' was invoked. Previous versions, however, behaved as though -wrapped text came from line 0 of the file "". - - define(`echo', `$@') - => - define(`foo', `echo(__line__ - __line__)') - => - echo(__line__ - __line__) - =>4 - =>5 - m4wrap(`foo - ') - => - foo(errprint(__line__ - __line__ - )) - error-->8 - error-->9 - =>8 - =>8 - __line__ - =>11 - ^D - =>6 - =>6 - - The `__program__' macro behaves like `$0' in shell terminology. If -you invoke `m4' through an absolute path or a link with a different -spelling, rather than by relying on a `PATH' search for plain `m4', it -will affect how `__program__' expands. The intent is that you can use -it to produce error messages with the same formatting that `m4' -produces internally. It can also be used within `syscmd' (*note -Syscmd::) to pick the same version of `m4' that is currently running, -rather than whatever version of `m4' happens to be first in `PATH'. It -was first introduced in GNU M4 1.4.6. - - -File: m4.info, Node: M4exit, Prev: Location, Up: Miscellaneous - -14.3 Exiting from `m4' -====================== - -If you need to exit from `m4' before the entire input has been read, -you can use `m4exit': - - -- Builtin: m4exit ([CODE = `0']) - Causes `m4' to exit, with exit status CODE. If CODE is left out, - the exit status is zero. If CODE cannot be parsed, or is outside - the range of 0 to 255, the exit status is one. No further input - is read, and all wrapped and diverted text is discarded. - - m4wrap(`This text is lost due to `m4exit'.') - => - divert(`1') So is this. - divert - => - m4exit And this is never read. - - A common use of this is to abort processing: - - -- Composite: fatal_error (MESSAGE) - Abort processing with an error message and non-zero status. Prefix - MESSAGE with details about where the error occurred, and print the - resulting string to standard error. - - define(`fatal_error', - `errprint(__program__:__file__:__line__`: fatal error: $* - ')m4exit(`1')') - => - fatal_error(`this is a BAD one, buster') - error-->m4:stdin:4: fatal error: this is a BAD one, buster - - After this macro call, `m4' will exit with exit status 1. This macro -is only intended for error exits, since the normal exit procedures are -not followed, e.g., diverted text is not undiverted, and saved text -(*note M4wrap::) is not reread. (This macro could be made more robust -to earlier versions of `m4'. You should try to see if you can find -weaknesses and correct them; or *note Answers: Improved fatal_error.). - - Note that it is still possible for the exit status to be different -than what was requested by `m4exit'. If `m4' detects some other error, -such as a write error on standard output, the exit status will be -non-zero even if `m4exit' requested zero. - - If standard input is seekable, then the file will be positioned at -the next unread character. If it is a pipe or other non-seekable file, -then there are no guarantees how much data `m4' might have read into -buffers, and thus discarded. - - -File: m4.info, Node: Frozen files, Next: Compatibility, Prev: Miscellaneous, Up: Top - -15 Fast loading of frozen state -******************************* - -Some bigger `m4' applications may be built over a common base -containing hundreds of definitions and other costly initializations. -Usually, the common base is kept in one or more declarative files, -which files are listed on each `m4' invocation prior to the user's -input file, or else each input file uses `include'. - - Reading the common base of a big application, over and over again, -may be time consuming. GNU `m4' offers some machinery to speed up the -start of an application using lengthy common bases. - -* Menu: - -* Using frozen files:: Using frozen files -* Frozen file format:: Frozen file format - - -File: m4.info, Node: Using frozen files, Next: Frozen file format, Up: Frozen files - -15.1 Using frozen files -======================= - -Suppose a user has a library of `m4' initializations in `base.m4', -which is then used with multiple input files: - - $ m4 base.m4 input1.m4 - $ m4 base.m4 input2.m4 - $ m4 base.m4 input3.m4 - - Rather than spending time parsing the fixed contents of `base.m4' -every time, the user might rather execute: - - $ m4 -F base.m4f base.m4 - -once, and further execute, as often as needed: - - $ m4 -R base.m4f input1.m4 - $ m4 -R base.m4f input2.m4 - $ m4 -R base.m4f input3.m4 - -with the varying input. The first call, containing the `-F' option, -only reads and executes file `base.m4', defining various application -macros and computing other initializations. Once the input file -`base.m4' has been completely processed, GNU `m4' produces in -`base.m4f' a "frozen" file, that is, a file which contains a kind of -snapshot of the `m4' internal state. - - Later calls, containing the `-R' option, are able to reload the -internal state of `m4', from `base.m4f', _prior_ to reading any other -input files. This means instead of starting with a virgin copy of -`m4', input will be read after having effectively recovered the effect -of a prior run. In our example, the effect is the same as if file -`base.m4' has been read anew. However, this effect is achieved a lot -faster. - - Only one frozen file may be created or read in any one `m4' -invocation. It is not possible to recover two frozen files at once. -However, frozen files may be updated incrementally, through using `-R' -and `-F' options simultaneously. For example, if some care is taken, -the command: - - $ m4 file1.m4 file2.m4 file3.m4 file4.m4 - -could be broken down in the following sequence, accumulating the same -output: - - $ m4 -F file1.m4f file1.m4 - $ m4 -R file1.m4f -F file2.m4f file2.m4 - $ m4 -R file2.m4f -F file3.m4f file3.m4 - $ m4 -R file3.m4f file4.m4 - - Some care is necessary because not every effort has been made for -this to work in all cases. In particular, the trace attribute of -macros is not handled, nor the current setting of `changeword'. -Currently, `m4wrap' and `sysval' also have problems. Also, -interactions for some options of `m4', being used in one call and not -in the next, have not been fully analyzed yet. On the other end, you -may be confident that stacks of `pushdef' definitions are handled -correctly, as well as undefined or renamed builtins, and changed -strings for quotes or comments. And future releases of GNU M4 will -improve on the utility of frozen files. - - When an `m4' run is to be frozen, the automatic undiversion which -takes place at end of execution is inhibited. Instead, all positively -numbered diversions are saved into the frozen file. The active -diversion number is also transmitted. - - A frozen file to be reloaded need not reside in the current -directory. It is looked up the same way as an `include' file (*note -Search Path::). - - If the frozen file was generated with a newer version of `m4', and -contains directives that an older `m4' cannot parse, attempting to load -the frozen file with option `-R' will cause `m4' to exit with status 63 -to indicate version mismatch. - - -File: m4.info, Node: Frozen file format, Prev: Using frozen files, Up: Frozen files - -15.2 Frozen file format -======================= - -Frozen files are sharable across architectures. It is safe to write a -frozen file on one machine and read it on another, given that the -second machine uses the same or newer version of GNU `m4'. It is -conventional, but not required, to give a frozen file the suffix of -`.m4f'. - - These are simple (editable) text files, made up of directives, each -starting with a capital letter and ending with a newline (<NL>). -Wherever a directive is expected, the character `#' introduces a -comment line; empty lines are also ignored if they are not part of an -embedded string. In the following descriptions, each LEN refers to the -length of the corresponding strings STR in the next line of input. -Numbers are always expressed in decimal. There are no escape -characters. The directives are: - -`C LEN1 , LEN2 <NL> STR1 STR2 <NL>' - Uses STR1 and STR2 as the begin-comment and end-comment strings. - If omitted, then `#' and <NL> are the comment delimiters. - -`D NUMBER, LEN <NL> STR <NL>' - Selects diversion NUMBER, making it current, then copy STR in the - current diversion. NUMBER may be a negative number for a - non-existing diversion. To merely specify an active selection, - use this command with an empty STR. With 0 as the diversion - NUMBER, STR will be issued on standard output at reload time. GNU - `m4' will not produce the `D' directive with non-zero length for - diversion 0, but this can be done with manual edits. This - directive may appear more than once for the same diversion, in - which case the diversion is the concatenation of the various uses. - If omitted, then diversion 0 is current. - -`F LEN1 , LEN2 <NL> STR1 STR2 <NL>' - Defines, through `pushdef', a definition for STR1 expanding to the - function whose builtin name is STR2. If the builtin does not - exist (for example, if the frozen file was produced by a copy of - `m4' compiled with changeword support, but the version of `m4' - reloading was compiled without it), the reload is silent, but any - subsequent use of the definition of STR1 will result in a warning. - This directive may appear more than once for the same name, and - its order, along with `T', is important. If omitted, you will - have no access to any builtins. - -`Q LEN1 , LEN2 <NL> STR1 STR2 <NL>' - Uses STR1 and STR2 as the begin-quote and end-quote strings. If - omitted, then ``' and `'' are the quote delimiters. - -`T LEN1 , LEN2 <NL> STR1 STR2 <NL>' - Defines, though `pushdef', a definition for STR1 expanding to the - text given by STR2. This directive may appear more than once for - the same name, and its order, along with `F', is important. - -`V NUMBER <NL>' - Confirms the format of the file. `m4' 1.4.10 only creates and - understands frozen files where NUMBER is 1. This directive must - be the first non-comment in the file, and may not appear more than - once. - - -File: m4.info, Node: Compatibility, Next: Answers, Prev: Frozen files, Up: Top - -16 Compatibility with other versions of `m4' -******************************************** - -This chapter describes the differences between this implementation of -`m4', and the implementation found under UNIX, notably System V, -Release 3. - - There are also differences in BSD flavors of `m4'. No attempt is -made to summarize these here. - -* Menu: - -* Extensions:: Extensions in GNU M4 -* Incompatibilities:: Facilities in System V m4 not in GNU M4 -* Other Incompatibilities:: Other incompatibilities - - -File: m4.info, Node: Extensions, Next: Incompatibilities, Up: Compatibility - -16.1 Extensions in GNU `m4' -=========================== - -This version of `m4' contains a few facilities that do not exist in -System V `m4'. These extra facilities are all suppressed by using the -`-G' command line option (*note Invoking m4: Limits control.), unless -overridden by other command line options. - - * In the `$N' notation for macro arguments, N can contain several - digits, while the System V `m4' only accepts one digit. This - allows macros in GNU `m4' to take any number of arguments, and not - only nine (*note Arguments::). - - This means that `define(`foo', `$11')' is ambiguous between - implementations. To portably choose between grabbing the first - parameter and appending 1 to the expansion, or grabbing the - eleventh parameter, you can do the following: - - define(`a1', `A1') - => - dnl First argument, concatenated with 1 - define(`_1', `$1')define(`first1', `_1($@)1') - => - dnl Eleventh argument, portable - define(`_9', `$9')define(`eleventh', `_9(shift(shift($@)))') - => - dnl Eleventh argument, GNU style - define(`Eleventh', `$11') - => - first1(`a', `b', `c', `d', `e', `f', `g', `h', `i', `j', `k') - =>A1 - eleventh(`a', `b', `c', `d', `e', `f', `g', `h', `i', `j', `k') - =>k - Eleventh(`a', `b', `c', `d', `e', `f', `g', `h', `i', `j', `k') - =>k - - Also see the `argn' macro (*note Shift::). - - * The `divert' (*note Divert::) macro can manage more than 9 - diversions. GNU `m4' treats all positive numbers as valid - diversions, rather than discarding diversions greater than 9. - - * Files included with `include' and `sinclude' are sought in a user - specified search path, if they are not found in the working - directory. The search path is specified by the `-I' option and the - `M4PATH' environment variable (*note Search Path::). - - * Arguments to `undivert' can be non-numeric, in which case the named - file will be included uninterpreted in the output (*note - Undivert::). - - * Formatted output is supported through the `format' builtin, which - is modeled after the C library function `printf' (*note Format::). - - * Searches and text substitution through basic regular expressions - are supported by the `regexp' (*note Regexp::) and `patsubst' - (*note Patsubst::) builtins. - - * The output of shell commands can be read into `m4' with `esyscmd' - (*note Esyscmd::). - - * There is indirect access to any builtin macro with `builtin' - (*note Builtin::). - - * Macros can be called indirectly through `indir' (*note Indir::). - - * The name of the program, the current input file, and the current - input line number are accessible through the builtins - `__program__', `__file__', and `__line__' (*note Location::). - - * The format of the output from `dumpdef' and macro tracing can be - controlled with `debugmode' (*note Debug Levels::). - - * The destination of trace and debug output can be controlled with - `debugfile' (*note Debug Output::). - - * The `maketemp' (*note Mkstemp::) macro behaves like `mkstemp', - creating a new file with a unique name on every invocation, rather - than following the insecure behavior of replacing the trailing `X' - characters with the `m4' process id. - - In addition to the above extensions, GNU `m4' implements the -following command line options: `-F', `-G', `-I', `-L', `-R', `-V', -`-W', `-d', `-i', `-l', `--debugfile' and `-t'. *Note Invoking m4::, -for a description of these options. - - Also, the debugging and tracing facilities in GNU `m4' are much more -extensive than in most other versions of `m4'. - - -File: m4.info, Node: Incompatibilities, Next: Other Incompatibilities, Prev: Extensions, Up: Compatibility - -16.2 Facilities in System V `m4' not in GNU `m4' -================================================ - -The version of `m4' from System V contains a few facilities that have -not been implemented in GNU `m4' yet. Additionally, POSIX requires -some behaviors that GNU `m4' has not implemented yet. Relying on these -behaviors is non-portable, as a future release of GNU `m4' may change. - - * System V `m4' supports multiple arguments to `defn', and POSIX - requires it. This is not yet implemented in GNU `m4'. - Unfortunately, this means it is not possible to mix builtins and - other text into a single macro; a helper macro is required. - - * POSIX requires an application to exit with non-zero status if it - wrote an error message to stderr. This has not yet been - consistently implemented for the various builtins that are - required to issue an error (such as `include' (*note Include::) - when a file is unreadable, `eval' (*note Eval::) when an argument - cannot be parsed, or using `m4exit' (*note M4exit::) with a - non-numeric argument). - - * Some traditional implementations only allow reading standard input - once, but GNU `m4' correctly handles multiple instances of `-' on - the command line. - - * POSIX requires `m4wrap' (*note M4wrap::) to act in FIFO (first-in, - first-out) order, but GNU `m4' currently uses LIFO order. - Furthermore, POSIX states that only the first argument to `m4wrap' - is saved for later evaluation, bug GNU `m4' saves and processes - all arguments, with output separated by spaces. - - However, it is possible to emulate POSIX behavior by including the - file `m4-1.4.10/examples/wrapfifo.m4' from the distribution: - - undivert(`wrapfifo.m4')dnl - =>dnl Redefine m4wrap to have FIFO semantics. - =>define(`_m4wrap_level', `0')dnl - =>define(`m4wrap', - =>`ifdef(`m4wrap'_m4wrap_level, - => `define(`m4wrap'_m4wrap_level, - => defn(`m4wrap'_m4wrap_level)`$1')', - => `builtin(`m4wrap', `define(`_m4wrap_level', - => incr(_m4wrap_level))dnl - =>m4wrap'_m4wrap_level)dnl - =>define(`m4wrap'_m4wrap_level, `$1')')')dnl - include(`wrapfifo.m4') - => - m4wrap(`a`'m4wrap(`c - ', `d')')m4wrap(`b') - => - ^D - =>abc - - * POSIX states that builtins that require arguments, but are called - without arguments, have undefined behavior. Traditional - implementations simply behave as though empty strings had been - passed. For example, `a`'define`'b' would expand to `ab'. But - GNU `m4' ignores certain builtins if they have missing arguments, - giving `adefineb' for the above example. - - * Traditional implementations handle `define(`f',`1')' (*note - Define::) by undefining the entire stack of previous definitions, - and if doing `undefine(`f')' first. GNU `m4' replaces just the top - definition on the stack, as if doing `popdef(`f')' followed by - `pushdef(`f',`1')'. POSIX allows either behavior. - - * POSIX requires `syscmd' (*note Syscmd::) to evaluate command - output for macro expansion, but this appears to be a mistake in - POSIX since traditional implementations did not do this. GNU `m4' - follows traditional behavior in `syscmd', and provides the - extension `esyscmd' that provides the POSIX semantics. - - * At one point, POSIX required `changequote(ARG)' (*note - Changequote::) to use newline as the close quote, but this was a - bug, and the next version of POSIX is anticipated to state that - using empty strings or just one argument is unspecified. - Meanwhile, the GNU `m4' behavior of treating an empty end-quote - delimiter as `'' is not portable, as Solaris treats it as - repeating the start-quote delimiter, and BSD treats it as leaving - the previous end-quote delimiter unchanged. For predictable - results, never call changequote with just one argument, or with - empty strings for arguments. - - * At one point, POSIX required `changecom(ARG,)' (*note Changecom::) - to make it impossible to end a comment, but this is a bug, and the - next version of POSIX is anticipated to state that using empty - strings is unspecified. Meanwhile, the GNU `m4' behavior of - treating an empty end-comment delimiter as newline is not - portable, as BSD treats it as leaving the previous end-comment - delimiter unchanged. It is also impossible in BSD implementations - to disable comments, even though that is required by POSIX. For - predictable results, never call changecom with empty strings for - arguments. - - * Most implementations of `m4' give macros a higher precedence than - comments when parsing, meaning that if the start delimiter given to - `changecom' (*note Changecom::) starts with a macro name, comments - are effectively disabled. POSIX does not specify what the - precedence is, so the GNU `m4' parser recognizes comments, then - macros, then quoted strings. - - * Traditional implementations allow argument collection, but not - string and comment processing, to span file boundaries. Thus, if - `a.m4' contains `len(', and `b.m4' contains `abc)', `m4 a.m4 b.m4' - outputs `3' with traditional `m4', but gives an error message that - the end of file was encountered inside a macro with GNU `m4'. On - the other hand, traditional implementations do end of file - processing for files included with `include' or `sinclude' (*note - Include::), while GNU `m4' seamlessly integrates the content of - those files. Thus `include(`a.m4')include(`b.m4')' will output - `3' instead of giving an error. - - * Traditional `m4' treats `traceon' (*note Trace::) without - arguments as a global variable, independent of named macro tracing. - Also, once a macro is undefined, named tracing of that macro is - lost. On the other hand, when GNU `m4' encounters `traceon' - without arguments, it turns tracing on for all existing - definitions at the time, but does not trace future definitions; - `traceoff' without arguments turns tracing off for all definitions - regardless of whether they were also traced by name; and tracing - by name, such as with `-tfoo' at the command line or - `traceon(`foo')' in the input, is an attribute that is preserved - even if the macro is currently undefined. - - * POSIX requires `eval' (*note Eval::) to treat all operators with - the same precedence as C. However, earlier versions of GNU `m4' - followed the traditional behavior of other `m4' implementations, - where bitwise and logical negation (`~' and `!') have lower - precedence than equality operators; and where equality operators - (`==' and `!=') had the same precedence as relational operators - (such as `<'). Use explicit parentheses to ensure proper - precedence. As extensions to POSIX, GNU `m4' gives well-defined - semantics to operations that C leaves undefined, such as when - overflow occurs, when shifting negative numbers, or when - performing division by zero. POSIX also requires `=' to cause an - error, but many traditional implementations allowed it as an alias - for `=='. - - * POSIX requires `translit' (*note Translit::) to treat each - character of the second and third arguments literally, but GNU - `m4' treats `-' as a range operator. - - * POSIX requires `m4' to honor the locale environment variables of - `LANG', `LC_ALL', `LC_CTYPE', `LC_MESSAGES', and `NLSPATH', but - this has not yet been implemented in GNU `m4'. - - * POSIX states that only unquoted leading newlines and blanks (that - is, space and tab) are ignored when collecting macro arguments. - However, this appears to be a bug in POSIX, since most traditional - implementations also ignore all whitespace (formfeed, carriage - return, and vertical tab). GNU `m4' follows tradition and ignores - all leading unquoted whitespace. - - -File: m4.info, Node: Other Incompatibilities, Prev: Incompatibilities, Up: Compatibility - -16.3 Other incompatibilities -============================ - -There are a few other incompatibilities between this implementation of -`m4', and the System V version. - - * GNU `m4' implements sync lines differently from System V `m4', - when text is being diverted. GNU `m4' outputs the sync lines when - the text is being diverted, and System V `m4' when the diverted - text is being brought back. - - The problem is which lines and file names should be attached to - text that is being, or has been, diverted. System V `m4' regards - all the diverted text as being generated by the source line - containing the `undivert' call, whereas GNU `m4' regards the - diverted text as being generated at the time it is diverted. - - The sync line option is used mostly when using `m4' as a front end - to a compiler. If a diverted line causes a compiler error, the - error messages should most probably refer to the place where the - diversion was made, and not where it was inserted again. - - divert(2)2 - divert(1)1 - divert`'0 - =>#line 3 "stdin" - =>0 - ^D - =>#line 2 "stdin" - =>1 - =>#line 1 "stdin" - =>2 - - The current `m4' implementation has a limitation that the syncline - output at the start of each diversion occurs no matter what, even - if the previous diversion did not end with a newline. This goes - contrary to the claim that synclines appear on a line by - themselves, so this limitation may be corrected in a future - version of `m4'. In the meantime, when using `-s', it is wisest - to make sure all diversions end with newline. - - * GNU `m4' makes no attempt at prohibiting self-referential - definitions like: - - define(`x', `x') - => - define(`x', `x ') - => - - There is nothing inherently wrong with defining `x' to return `x'. - The wrong thing is to expand `x' unquoted, because that would - cause an infinite rescan loop. In `m4', one might use macros to - hold strings, as we do for variables in other programming - languages, further checking them with: - - ifelse(defn(`HOLDER'), `VALUE', ...) - - In cases like this one, an interdiction for a macro to hold its - own name would be a useless limitation. Of course, this leaves - more rope for the GNU `m4' user to hang himself! Rescanning hangs - may be avoided through careful programming, a little like for - endless loops in traditional programming languages. - - -File: m4.info, Node: Answers, Next: Copying This Package, Prev: Compatibility, Up: Top - -17 Correct version of some examples -*********************************** - -Some of the examples in this manuals are buggy or not very robust, for -demonstration purposes. Improved versions of these composite macros are -presented here. - -* Menu: - -* Improved exch:: Solution for `exch' -* Improved forloop:: Solution for `forloop' -* Improved foreach:: Solution for `foreach' -* Improved cleardivert:: Solution for `cleardivert' -* Improved fatal_error:: Solution for `fatal_error' - - -File: m4.info, Node: Improved exch, Next: Improved forloop, Up: Answers - -17.1 Solution for `exch' -======================== - -The `exch' macro (*note Arguments::) as presented requires clients to -double quote their arguments. A nicer definition, which lets clients -follow the rule of thumb of one level of quoting per level of -parentheses, involves adding quotes in the definition of `exch', as -follows: - - define(`exch', ``$2', `$1'') - => - define(exch(`expansion text', `macro')) - => - macro - =>expansion text - - -File: m4.info, Node: Improved forloop, Next: Improved foreach, Prev: Improved exch, Up: Answers - -17.2 Solution for `forloop' -=========================== - -The `forloop' macro (*note Forloop::) as presented earlier can go into -an infinite loop if given an iterator that is not parsed as a macro -name. It does not do any sanity checking on its numeric bounds, and -only permits decimal numbers for bounds. Here is an improved version, -shipped as `m4-1.4.10/examples/forloop2.m4'; this version also -optimizes based on the fact that the starting bound does not need to be -passed to the helper `_forloop'. - - $ m4 -I examples - undivert(`forloop2.m4')dnl - =>divert(`-1') - =># forloop(var, from, to, stmt) - improved version: - =># works even if VAR is not a strict macro name - =># performs sanity check that FROM is larger than TO - =># allows complex numerical expressions in TO and FROM - =>define(`forloop', `ifelse(eval(`($3) >= ($2)'), `1', - => `pushdef(`$1', eval(`$2'))_forloop(`$1', - => eval(`$3'), `$4')popdef(`$1')')') - =>define(`_forloop', - => `$3`'ifelse(indir(`$1'), `$2', `', - => `define(`$1', incr(indir(`$1')))$0($@)')') - =>divert`'dnl - include(`forloop2.m4') - => - forloop(`i', `2', `1', `no iteration occurs') - => - forloop(`', `1', `2', ` odd iterator name') - => odd iterator name odd iterator name - forloop(`i', `5 + 5', `0xc', ` 0x`'eval(i, `16')') - => 0xa 0xb 0xc - forloop(`i', `a', `b', `non-numeric bounds') - error-->m4:stdin:6: bad expression in eval (bad input): (b) >= (a) - => - - Of course, it is possible to make even more improvements, such as -adding an optional step argument, or allowing iteration through -descending sequences. GNU Autoconf provides some of these additional -bells and whistles in its `m4_for' macro. - - -File: m4.info, Node: Improved foreach, Next: Improved cleardivert, Prev: Improved forloop, Up: Answers - -17.3 Solution for `foreach' -=========================== - -The `foreach' and `foreachq' macros (*note Foreach::) as presented -earlier each have flaws. First, we will examine and fix the quadratic -behavior of `foreachq': - - $ m4 -I examples - include(`foreachq.m4') - => - traceon(`shift')debugmode(`aq') - => - foreachq(`x', ``1', `2', `3', `4'', `x - ')dnl - =>1 - error-->m4trace: -3- shift(`1', `2', `3', `4') - error-->m4trace: -2- shift(`1', `2', `3', `4') - =>2 - error-->m4trace: -4- shift(`1', `2', `3', `4') - error-->m4trace: -3- shift(`2', `3', `4') - error-->m4trace: -3- shift(`1', `2', `3', `4') - error-->m4trace: -2- shift(`2', `3', `4') - =>3 - error-->m4trace: -5- shift(`1', `2', `3', `4') - error-->m4trace: -4- shift(`2', `3', `4') - error-->m4trace: -3- shift(`3', `4') - error-->m4trace: -4- shift(`1', `2', `3', `4') - error-->m4trace: -3- shift(`2', `3', `4') - error-->m4trace: -2- shift(`3', `4') - =>4 - error-->m4trace: -6- shift(`1', `2', `3', `4') - error-->m4trace: -5- shift(`2', `3', `4') - error-->m4trace: -4- shift(`3', `4') - error-->m4trace: -3- shift(`4') - - Each successive iteration was adding more quoted `shift' -invocations, and the entire list contents were passing through every -iteration. In general, when recursing, it is a good idea to make the -recursion use fewer arguments, rather than adding additional quoted -uses of `shift'. By doing so, `m4' uses less memory, invokes fewer -macros, is less likely to run into machine limits, and most -importantly, performs faster. The fixed version of `foreachq' can be -found in `m4-1.4.10/examples/foreachq2.m4': - - $ m4 -I examples - include(`foreachq2.m4') - => - undivert(`foreachq2.m4')dnl - =>include(`quote.m4')dnl - =>divert(`-1') - =># foreachq(x, `item_1, item_2, ..., item_n', stmt) - =># quoted list, improved version - =>define(`foreachq', `pushdef(`$1')_foreachq($@)popdef(`$1')') - =>define(`_arg1q', ``$1'') - =>define(`_rest', `ifelse(`$#', `1', `', `dquote(shift($@))')') - =>define(`_foreachq', `ifelse(`$2', `', `', - => `define(`$1', _arg1q($2))$3`'$0(`$1', _rest($2), `$3')')') - =>divert`'dnl - traceon(`shift')debugmode(`aq') - => - foreachq(`x', ``1', `2', `3', `4'', `x - ')dnl - =>1 - error-->m4trace: -3- shift(`1', `2', `3', `4') - =>2 - error-->m4trace: -3- shift(`2', `3', `4') - =>3 - error-->m4trace: -3- shift(`3', `4') - =>4 - - Note that the fixed version calls unquoted helper macros in -`_foreachq' to trim elements immediately; those helper macros in turn -must re-supply the layer of quotes lost in the macro invocation. -Contrast the use of `_arg1q', which quotes the first list element, with -`_arg1' of the earlier implementation that returned the first list -element directly. - - For a different approach, the improved version of `foreach', -available in `m4-1.4.10/examples/foreach2.m4', simply overquotes the -arguments to `_foreach' to begin with, using `dquote_elt'. Then -`_foreach' can just use `_arg1' to remove the extra layer of quoting -that was added up front: - - $ m4 -I examples - include(`foreach2.m4') - => - undivert(`foreach2.m4')dnl - =>include(`quote.m4')dnl - =>divert(`-1') - =># foreach(x, (item_1, item_2, ..., item_n), stmt) - =># parenthesized list, improved version - =>define(`foreach', `pushdef(`$1')_foreach(`$1', - => (dquote(dquote_elt$2)), `$3')popdef(`$1')') - =>define(`_arg1', `$1') - =>define(`_foreach', `ifelse(`$2', `(`')', `', - => `define(`$1', _arg1$2)$3`'$0(`$1', (dquote(shift$2)), `$3')')') - =>divert`'dnl - traceon(`shift')debugmode(`aq') - => - foreach(`x', `(`1', `2', `3', `4')', `x - ')dnl - error-->m4trace: -4- shift(`1', `2', `3', `4') - error-->m4trace: -4- shift(`2', `3', `4') - error-->m4trace: -4- shift(`3', `4') - =>1 - error-->m4trace: -3- shift(``1'', ``2'', ``3'', ``4'') - =>2 - error-->m4trace: -3- shift(``2'', ``3'', ``4'') - =>3 - error-->m4trace: -3- shift(``3'', ``4'') - =>4 - error-->m4trace: -3- shift(``4'') - - In summary, recursion over list elements is trickier than it -appeared at first glance, but provides a powerful idiom within `m4' -processing. As a final demonstration, both list styles are now able to -handle several scenarios that would wreak havoc on the original -implementations. This points out one other difference between the two -list styles. `foreach' evaluates unquoted list elements only once, in -preparation for calling `_foreach'. But `foreachq' evaluates unquoted -list elements twice while visiting the first list element, once in -`_arg1q' and once in `_rest'. When deciding which list style to use, -one must take into account whether repeating the side effects of -unquoted list elements will have any detrimental effects. - - $ m4 -I examples - include(`foreach2.m4') - => - include(`foreachq2.m4') - => - dnl 0-element list: - foreach(`x', `', `<x>') / foreachq(`x', `', `<x>') - => / - dnl 1-element list of empty element - foreach(`x', `()', `<x>') / foreachq(`x', ``'', `<x>') - =><> / <> - dnl 2-element list of empty elements - foreach(`x', `(`',`')', `<x>') / foreachq(`x', ``',`'', `<x>') - =><><> / <><> - dnl 1-element list of a comma - foreach(`x', `(`,')', `<x>') / foreachq(`x', ``,'', `<x>') - =><,> / <,> - dnl 2-element list of unbalanced parentheses - foreach(`x', `(`(', `)')', `<x>') / foreachq(`x', ``(', `)'', `<x>') - =><(><)> / <(><)> - define(`active', `ACT, IVE') - => - traceon(`active') - => - dnl list of unquoted macros; expansion occurs before recursion - foreach(`x', `(active, active)', `<x> - ')dnl - error-->m4trace: -4- active -> `ACT, IVE' - error-->m4trace: -4- active -> `ACT, IVE' - =><ACT> - =><IVE> - =><ACT> - =><IVE> - foreachq(`x', `active, active', `<x> - ')dnl - error-->m4trace: -3- active -> `ACT, IVE' - error-->m4trace: -3- active -> `ACT, IVE' - =><ACT> - error-->m4trace: -3- active -> `ACT, IVE' - error-->m4trace: -3- active -> `ACT, IVE' - =><IVE> - =><ACT> - =><IVE> - dnl list of quoted macros; expansion occurs during recursion - foreach(`x', `(`active', `active')', `<x> - ')dnl - error-->m4trace: -1- active -> `ACT, IVE' - =><ACT, IVE> - error-->m4trace: -1- active -> `ACT, IVE' - =><ACT, IVE> - foreachq(`x', ``active', `active'', `<x> - ')dnl - error-->m4trace: -1- active -> `ACT, IVE' - =><ACT, IVE> - error-->m4trace: -1- active -> `ACT, IVE' - =><ACT, IVE> - dnl list of double-quoted macro names; no expansion - foreach(`x', `(``active'', ``active'')', `<x> - ')dnl - =><active> - =><active> - foreachq(`x', ```active'', ``active''', `<x> - ')dnl - =><active> - =><active> - - -File: m4.info, Node: Improved cleardivert, Next: Improved fatal_error, Prev: Improved foreach, Up: Answers - -17.4 Solution for `cleardivert' -=============================== - -The `cleardivert' macro (*note Cleardivert::) cannot, as it stands, be -called without arguments to clear all pending diversions. That is -because using undivert with an empty string for an argument is different -than using it with no arguments at all. Compare the earlier definition -with one that takes the number of arguments into account: - - define(`cleardivert', - `pushdef(`_n', divnum)divert(`-1')undivert($@)divert(_n)popdef(`_n')') - => - divert(`1')one - divert - => - cleardivert - => - undivert - =>one - => - define(`cleardivert', - `pushdef(`_num', divnum)divert(`-1')ifelse(`$#', `0', - `undivert`'', `undivert($@)')divert(_num)popdef(`_num')') - => - divert(`2')two - divert - => - cleardivert - => - undivert - => - - -File: m4.info, Node: Improved fatal_error, Prev: Improved cleardivert, Up: Answers - -17.5 Solution for `fatal_error' -=============================== - -The `fatal_error' macro (*note M4exit::) is not robust to versions of -GNU M4 earlier than 1.4.8, where invoking `__file__' (*note Location::) -inside `m4wrap' would result in an empty string, and `__line__' -resulted in `0' even though all files start at line 1. Furthermore, -versions earlier than 1.4.6 did not support the `__program__' macro. -If you want `fatal_error' to work across the entire 1.4.x release -series, a better implementation would be: - - define(`fatal_error', - `errprint(ifdef(`__program__', `__program__', ``m4'')'dnl - `:ifelse(__line__, `0', `', - `__file__:__line__:')` fatal error: $* - ')m4exit(`1')') - => - m4wrap(`divnum(`demo of internal message') - fatal_error(`inside wrapped text')') - => - ^D - error-->m4:stdin:6: Warning: excess arguments to builtin `divnum' ignored - =>0 - error-->m4:stdin:6: fatal error: inside wrapped text - - -File: m4.info, Node: Copying This Package, Next: Copying This Manual, Prev: Answers, Up: Top - -Appendix A How to make copies of the overall M4 package -******************************************************* - -This appendix covers the license for copying the source code of the -overall M4 package. This manual is under a different set of -restrictions, covered later (*note Copying This Manual::). - -* Menu: - -* Copying:: GNU General Public License - - -File: m4.info, Node: Copying, Up: Copying This Package - -A.1 GNU General Public License -============================== - - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. `http://fsf.org/' - - Everyone is permitted to copy and distribute verbatim copies of this - license document, but changing it is not allowed. - -Preamble -======== - -The GNU General Public License is a free, copyleft license for software -and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program-to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you -have certain responsibilities if you distribute copies of the software, -or if you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the -manufacturer can do so. This is fundamentally incompatible with the -aim of protecting users' freedom to change the software. The -systematic pattern of such abuse occurs in the area of products for -individuals to use, which is precisely where it is most unacceptable. -Therefore, we have designed this version of the GPL to prohibit the -practice for those products. If such problems arise substantially in -other domains, we stand ready to extend this provision to those domains -in future versions of the GPL, as needed to protect the freedom of -users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - -TERMS AND CONDITIONS -==================== - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public - License. - - "Copyright" also means copyright-like laws that apply to other - kinds of works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this - License. Each licensee is addressed as "you". "Licensees" and - "recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the - work in a fashion requiring copyright permission, other than the - making of an exact copy. The resulting work is called a "modified - version" of the earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work - based on the Program. - - To "propagate" a work means to do anything with it that, without - permission, would make you directly or secondarily liable for - infringement under applicable copyright law, except executing it - on a computer or modifying a private copy. Propagation includes - copying, distribution (with or without modification), making - available to the public, and in some countries other activities as - well. - - To "convey" a work means any kind of propagation that enables other - parties to make or receive copies. Mere interaction with a user - through a computer network, with no transfer of a copy, is not - conveying. - - An interactive user interface displays "Appropriate Legal Notices" - to the extent that it includes a convenient and prominently visible - feature that (1) displays an appropriate copyright notice, and (2) - tells the user that there is no warranty for the work (except to - the extent that warranties are provided), that licensees may - convey the work under this License, and how to view a copy of this - License. If the interface presents a list of user commands or - options, such as a menu, a prominent item in the list meets this - criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work - for making modifications to it. "Object code" means any - non-source form of a work. - - A "Standard Interface" means an interface that either is an - official standard defined by a recognized standards body, or, in - the case of interfaces specified for a particular programming - language, one that is widely used among developers working in that - language. - - The "System Libraries" of an executable work include anything, - other than the work as a whole, that (a) is included in the normal - form of packaging a Major Component, but which is not part of that - Major Component, and (b) serves only to enable use of the work - with that Major Component, or to implement a Standard Interface - for which an implementation is available to the public in source - code form. A "Major Component", in this context, means a major - essential component (kernel, window system, and so on) of the - specific operating system (if any) on which the executable work - runs, or a compiler used to produce the work, or an object code - interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all - the source code needed to generate, install, and (for an executable - work) run the object code and to modify the work, including - scripts to control those activities. However, it does not include - the work's System Libraries, or general-purpose tools or generally - available free programs which are used unmodified in performing - those activities but which are not part of the work. For example, - Corresponding Source includes interface definition files - associated with source files for the work, and the source code for - shared libraries and dynamically linked subprograms that the work - is specifically designed to require, such as by intimate data - communication or control flow between those subprograms and other - parts of the work. - - The Corresponding Source need not include anything that users can - regenerate automatically from other parts of the Corresponding - Source. - - The Corresponding Source for a work in source code form is that - same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of - copyright on the Program, and are irrevocable provided the stated - conditions are met. This License explicitly affirms your unlimited - permission to run the unmodified Program. The output from running - a covered work is covered by this License only if the output, - given its content, constitutes a covered work. This License - acknowledges your rights of fair use or other equivalent, as - provided by copyright law. - - You may make, run and propagate covered works that you do not - convey, without conditions so long as your license otherwise - remains in force. You may convey covered works to others for the - sole purpose of having them make modifications exclusively for - you, or provide you with facilities for running those works, - provided that you comply with the terms of this License in - conveying all material for which you do not control copyright. - Those thus making or running the covered works for you must do so - exclusively on your behalf, under your direction and control, on - terms that prohibit them from making any copies of your - copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under - the conditions stated below. Sublicensing is not allowed; section - 10 makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological - measure under any applicable law fulfilling obligations under - article 11 of the WIPO copyright treaty adopted on 20 December - 1996, or similar laws prohibiting or restricting circumvention of - such measures. - - When you convey a covered work, you waive any legal power to forbid - circumvention of technological measures to the extent such - circumvention is effected by exercising rights under this License - with respect to the covered work, and you disclaim any intention - to limit operation or modification of the work as a means of - enforcing, against the work's users, your or third parties' legal - rights to forbid circumvention of technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you - receive it, in any medium, provided that you conspicuously and - appropriately publish on each copy an appropriate copyright notice; - keep intact all notices stating that this License and any - non-permissive terms added in accord with section 7 apply to the - code; keep intact all notices of the absence of any warranty; and - give all recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, - and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to - produce it from the Program, in the form of source code under the - terms of section 4, provided that you also meet all of these - conditions: - - a. The work must carry prominent notices stating that you - modified it, and giving a relevant date. - - b. The work must carry prominent notices stating that it is - released under this License and any conditions added under - section 7. This requirement modifies the requirement in - section 4 to "keep intact all notices". - - c. You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable - section 7 additional terms, to the whole of the work, and all - its parts, regardless of how they are packaged. This License - gives no permission to license the work in any other way, but - it does not invalidate such permission if you have separately - received it. - - d. If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has - interactive interfaces that do not display Appropriate Legal - Notices, your work need not make them do so. - - A compilation of a covered work with other separate and independent - works, which are not by their nature extensions of the covered - work, and which are not combined with it such as to form a larger - program, in or on a volume of a storage or distribution medium, is - called an "aggregate" if the compilation and its resulting - copyright are not used to limit the access or legal rights of the - compilation's users beyond what the individual works permit. - Inclusion of a covered work in an aggregate does not cause this - License to apply to the other parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms - of sections 4 and 5, provided that you also convey the - machine-readable Corresponding Source under the terms of this - License, in one of these ways: - - a. Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b. Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for - as long as you offer spare parts or customer support for that - product model, to give anyone who possesses the object code - either (1) a copy of the Corresponding Source for all the - software in the product that is covered by this License, on a - durable physical medium customarily used for software - interchange, for a price no more than your reasonable cost of - physically performing this conveying of source, or (2) access - to copy the Corresponding Source from a network server at no - charge. - - c. Convey individual copies of the object code with a copy of - the written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, - and only if you received the object code with such an offer, - in accord with subsection 6b. - - d. Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access - to the Corresponding Source in the same way through the same - place at no further charge. You need not require recipients - to copy the Corresponding Source along with the object code. - If the place to copy the object code is a network server, the - Corresponding Source may be on a different server (operated - by you or a third party) that supports equivalent copying - facilities, provided you maintain clear directions next to - the object code saying where to find the Corresponding Source. - Regardless of what server hosts the Corresponding Source, you - remain obligated to ensure that it is available for as long - as needed to satisfy these requirements. - - e. Convey the object code using peer-to-peer transmission, - provided you inform other peers where the object code and - Corresponding Source of the work are being offered to the - general public at no charge under subsection 6d. - - - A separable portion of the object code, whose source code is - excluded from the Corresponding Source as a System Library, need - not be included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means - any tangible personal property which is normally used for personal, - family, or household purposes, or (2) anything designed or sold for - incorporation into a dwelling. In determining whether a product - is a consumer product, doubtful cases shall be resolved in favor of - coverage. For a particular product received by a particular user, - "normally used" refers to a typical or common use of that class of - product, regardless of the status of the particular user or of the - way in which the particular user actually uses, or expects or is - expected to use, the product. A product is a consumer product - regardless of whether the product has substantial commercial, - industrial or non-consumer uses, unless such uses represent the - only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, - procedures, authorization keys, or other information required to - install and execute modified versions of a covered work in that - User Product from a modified version of its Corresponding Source. - The information must suffice to ensure that the continued - functioning of the modified object code is in no case prevented or - interfered with solely because modification has been made. - - If you convey an object code work under this section in, or with, - or specifically for use in, a User Product, and the conveying - occurs as part of a transaction in which the right of possession - and use of the User Product is transferred to the recipient in - perpetuity or for a fixed term (regardless of how the transaction - is characterized), the Corresponding Source conveyed under this - section must be accompanied by the Installation Information. But - this requirement does not apply if neither you nor any third party - retains the ability to install modified object code on the User - Product (for example, the work has been installed in ROM). - - The requirement to provide Installation Information does not - include a requirement to continue to provide support service, - warranty, or updates for a work that has been modified or - installed by the recipient, or for the User Product in which it - has been modified or installed. Access to a network may be denied - when the modification itself materially and adversely affects the - operation of the network or violates the rules and protocols for - communication across the network. - - Corresponding Source conveyed, and Installation Information - provided, in accord with this section must be in a format that is - publicly documented (and with an implementation available to the - public in source code form), and must require no special password - or key for unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of - this License by making exceptions from one or more of its - conditions. Additional permissions that are applicable to the - entire Program shall be treated as though they were included in - this License, to the extent that they are valid under applicable - law. If additional permissions apply only to part of the Program, - that part may be used separately under those permissions, but the - entire Program remains governed by this License without regard to - the additional permissions. - - When you convey a copy of a covered work, you may at your option - remove any additional permissions from that copy, or from any part - of it. (Additional permissions may be written to require their own - removal in certain cases when you modify the work.) You may place - additional permissions on material, added by you to a covered work, - for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material - you add to a covered work, you may (if authorized by the copyright - holders of that material) supplement the terms of this License - with terms: - - a. Disclaiming warranty or limiting liability differently from - the terms of sections 15 and 16 of this License; or - - b. Requiring preservation of specified reasonable legal notices - or author attributions in that material or in the Appropriate - Legal Notices displayed by works containing it; or - - c. Prohibiting misrepresentation of the origin of that material, - or requiring that modified versions of such material be - marked in reasonable ways as different from the original - version; or - - d. Limiting the use for publicity purposes of names of licensors - or authors of the material; or - - e. Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f. Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified - versions of it) with contractual assumptions of liability to - the recipient, for any liability that these contractual - assumptions directly impose on those licensors and authors. - - All other non-permissive additional terms are considered "further - restrictions" within the meaning of section 10. If the Program as - you received it, or any part of it, contains a notice stating that - it is governed by this License along with a term that is a further - restriction, you may remove that term. If a license document - contains a further restriction but permits relicensing or - conveying under this License, you may add to a covered work - material governed by the terms of that license document, provided - that the further restriction does not survive such relicensing or - conveying. - - If you add terms to a covered work in accord with this section, you - must place, in the relevant source files, a statement of the - additional terms that apply to those files, or a notice indicating - where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in - the form of a separately written license, or stated as exceptions; - the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly - provided under this License. Any attempt otherwise to propagate or - modify it is void, and will automatically terminate your rights - under this License (including any patent licenses granted under - the third paragraph of section 11). - - However, if you cease all violation of this License, then your - license from a particular copyright holder is reinstated (a) - provisionally, unless and until the copyright holder explicitly - and finally terminates your license, and (b) permanently, if the - copyright holder fails to notify you of the violation by some - reasonable means prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is - reinstated permanently if the copyright holder notifies you of the - violation by some reasonable means, this is the first time you have - received notice of violation of this License (for any work) from - that copyright holder, and you cure the violation prior to 30 days - after your receipt of the notice. - - Termination of your rights under this section does not terminate - the licenses of parties who have received copies or rights from - you under this License. If your rights have been terminated and - not permanently reinstated, you do not qualify to receive new - licenses for the same material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or - run a copy of the Program. Ancillary propagation of a covered work - occurring solely as a consequence of using peer-to-peer - transmission to receive a copy likewise does not require - acceptance. However, nothing other than this License grants you - permission to propagate or modify any covered work. These actions - infringe copyright if you do not accept this License. Therefore, - by modifying or propagating a covered work, you indicate your - acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically - receives a license from the original licensors, to run, modify and - propagate that work, subject to this License. You are not - responsible for enforcing compliance by third parties with this - License. - - An "entity transaction" is a transaction transferring control of an - organization, or substantially all assets of one, or subdividing an - organization, or merging organizations. If propagation of a - covered work results from an entity transaction, each party to that - transaction who receives a copy of the work also receives whatever - licenses to the work the party's predecessor in interest had or - could give under the previous paragraph, plus a right to - possession of the Corresponding Source of the work from the - predecessor in interest, if the predecessor has it or can get it - with reasonable efforts. - - You may not impose any further restrictions on the exercise of the - rights granted or affirmed under this License. For example, you - may not impose a license fee, royalty, or other charge for - exercise of rights granted under this License, and you may not - initiate litigation (including a cross-claim or counterclaim in a - lawsuit) alleging that any patent claim is infringed by making, - using, selling, offering for sale, or importing the Program or any - portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this - License of the Program or a work on which the Program is based. - The work thus licensed is called the contributor's "contributor - version". - - A contributor's "essential patent claims" are all patent claims - owned or controlled by the contributor, whether already acquired or - hereafter acquired, that would be infringed by some manner, - permitted by this License, of making, using, or selling its - contributor version, but do not include claims that would be - infringed only as a consequence of further modification of the - contributor version. For purposes of this definition, "control" - includes the right to grant patent sublicenses in a manner - consistent with the requirements of this License. - - Each contributor grants you a non-exclusive, worldwide, - royalty-free patent license under the contributor's essential - patent claims, to make, use, sell, offer for sale, import and - otherwise run, modify and propagate the contents of its - contributor version. - - In the following three paragraphs, a "patent license" is any - express agreement or commitment, however denominated, not to - enforce a patent (such as an express permission to practice a - patent or covenant not to sue for patent infringement). To - "grant" such a patent license to a party means to make such an - agreement or commitment not to enforce a patent against the party. - - If you convey a covered work, knowingly relying on a patent - license, and the Corresponding Source of the work is not available - for anyone to copy, free of charge and under the terms of this - License, through a publicly available network server or other - readily accessible means, then you must either (1) cause the - Corresponding Source to be so available, or (2) arrange to deprive - yourself of the benefit of the patent license for this particular - work, or (3) arrange, in a manner consistent with the requirements - of this License, to extend the patent license to downstream - recipients. "Knowingly relying" means you have actual knowledge - that, but for the patent license, your conveying the covered work - in a country, or your recipient's use of the covered work in a - country, would infringe one or more identifiable patents in that - country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or - arrangement, you convey, or propagate by procuring conveyance of, a - covered work, and grant a patent license to some of the parties - receiving the covered work authorizing them to use, propagate, - modify or convey a specific copy of the covered work, then the - patent license you grant is automatically extended to all - recipients of the covered work and works based on it. - - A patent license is "discriminatory" if it does not include within - the scope of its coverage, prohibits the exercise of, or is - conditioned on the non-exercise of one or more of the rights that - are specifically granted under this License. You may not convey a - covered work if you are a party to an arrangement with a third - party that is in the business of distributing software, under - which you make payment to the third party based on the extent of - your activity of conveying the work, and under which the third - party grants, to any of the parties who would receive the covered - work from you, a discriminatory patent license (a) in connection - with copies of the covered work conveyed by you (or copies made - from those copies), or (b) primarily for and in connection with - specific products or compilations that contain the covered work, - unless you entered into that arrangement, or that patent license - was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting - any implied license or other defenses to infringement that may - otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, - agreement or otherwise) that contradict the conditions of this - License, they do not excuse you from the conditions of this - License. If you cannot convey a covered work so as to satisfy - simultaneously your obligations under this License and any other - pertinent obligations, then as a consequence you may not convey it - at all. For example, if you agree to terms that obligate you to - collect a royalty for further conveying from those to whom you - convey the Program, the only way you could satisfy both those - terms and this License would be to refrain entirely from conveying - the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have - permission to link or combine any covered work with a work licensed - under version 3 of the GNU Affero General Public License into a - single combined work, and to convey the resulting work. The terms - of this License will continue to apply to the part which is the - covered work, but the special requirements of the GNU Affero - General Public License, section 13, concerning interaction through - a network will apply to the combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new - versions of the GNU General Public License from time to time. - Such new versions will be similar in spirit to the present - version, but may differ in detail to address new problems or - concerns. - - Each version is given a distinguishing version number. If the - Program specifies that a certain numbered version of the GNU - General Public License "or any later version" applies to it, you - have the option of following the terms and conditions either of - that numbered version or of any later version published by the - Free Software Foundation. If the Program does not specify a - version number of the GNU General Public License, you may choose - any version ever published by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future - versions of the GNU General Public License can be used, that - proxy's public statement of acceptance of a version permanently - authorizes you to choose that version for the Program. - - Later license versions may give you additional or different - permissions. However, no additional obligations are imposed on any - author or copyright holder as a result of your choosing to follow a - later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY - APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE - COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" - WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE - RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. - SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL - NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN - WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES - AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU - FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR - CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE - THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA - BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD - PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF - THE POSSIBILITY OF SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided - above cannot be given local legal effect according to their terms, - reviewing courts shall apply local law that most closely - approximates an absolute waiver of all civil liability in - connection with the Program, unless a warranty or assumption of - liability accompanies a copy of the Program in return for a fee. - - -END OF TERMS AND CONDITIONS -=========================== - -How to Apply These Terms to Your New Programs -============================================= - -If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these -terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - ONE LINE TO GIVE THE PROGRAM'S NAME AND A BRIEF IDEA OF WHAT IT DOES. - Copyright (C) YEAR NAME OF AUTHOR - - 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/'. - - Also add information on how to contact you by electronic and paper -mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - PROGRAM Copyright (C) YEAR NAME OF AUTHOR - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - - The hypothetical commands `show w' and `show c' should show the -appropriate parts of the General Public License. Of course, your -program's commands might be different; for a GUI interface, you would -use an "about box". - - You should also get your employer (if you work as a programmer) or -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. For more information on this, and how to apply and follow -the GNU GPL, see `http://www.gnu.org/licenses/'. - - The GNU General Public License does not permit incorporating your -program into proprietary programs. If your program is a subroutine -library, you may consider it more useful to permit linking proprietary -applications with the library. If this is what you want to do, use the -GNU Lesser General Public License instead of this License. But first, -please read `http://www.gnu.org/philosophy/why-not-lgpl.html'. - - -File: m4.info, Node: Copying This Manual, Next: Indices, Prev: Copying This Package, Up: Top - -Appendix B How to make copies of this manual -******************************************** - -This appendix covers the license for copying this manual. Note that -some of the longer examples in this manual are also distributed in the -directory `m4-1.4.10/examples/', where a more permissive license is in -effect when copying just the examples. - -* Menu: - -* GNU Free Documentation License:: License for copying this manual - - -File: m4.info, Node: GNU Free Documentation License, Up: Copying This Manual - -B.1 GNU Free Documentation License -================================== - - Version 1.2, November 2002 - - Copyright (C) 2000,2001,2002 Free Software Foundation, Inc. - 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - 0. PREAMBLE - - The purpose of this License is to make a manual, textbook, or other - functional and useful document "free" in the sense of freedom: to - assure everyone the effective freedom to copy and redistribute it, - with or without modifying it, either commercially or - noncommercially. Secondarily, this License preserves for the - author and publisher a way to get credit for their work, while not - being considered responsible for modifications made by others. - - This License is a kind of "copyleft", which means that derivative - works of the document must themselves be free in the same sense. - It complements the GNU General Public License, which is a copyleft - license designed for free software. - - We have designed this License in order to use it for manuals for - free software, because free software needs free documentation: a - free program should come with manuals providing the same freedoms - that the software does. But this License is not limited to - software manuals; it can be used for any textual work, regardless - of subject matter or whether it is published as a printed book. - We recommend this License principally for works whose purpose is - instruction or reference. - - 1. APPLICABILITY AND DEFINITIONS - - This License applies to any manual or other work, in any medium, - that contains a notice placed by the copyright holder saying it - can be distributed under the terms of this License. Such a notice - grants a world-wide, royalty-free license, unlimited in duration, - to use that work under the conditions stated herein. The - "Document", below, refers to any such manual or work. Any member - of the public is a licensee, and is addressed as "you". You - accept the license if you copy, modify or distribute the work in a - way requiring permission under copyright law. - - A "Modified Version" of the Document means any work containing the - Document or a portion of it, either copied verbatim, or with - modifications and/or translated into another language. - - A "Secondary Section" is a named appendix or a front-matter section - of the Document that deals exclusively with the relationship of the - publishers or authors of the Document to the Document's overall - subject (or to related matters) and contains nothing that could - fall directly within that overall subject. (Thus, if the Document - is in part a textbook of mathematics, a Secondary Section may not - explain any mathematics.) The relationship could be a matter of - historical connection with the subject or with related matters, or - of legal, commercial, philosophical, ethical or political position - regarding them. - - The "Invariant Sections" are certain Secondary Sections whose - titles are designated, as being those of Invariant Sections, in - the notice that says that the Document is released under this - License. If a section does not fit the above definition of - Secondary then it is not allowed to be designated as Invariant. - The Document may contain zero Invariant Sections. If the Document - does not identify any Invariant Sections then there are none. - - The "Cover Texts" are certain short passages of text that are - listed, as Front-Cover Texts or Back-Cover Texts, in the notice - that says that the Document is released under this License. A - Front-Cover Text may be at most 5 words, and a Back-Cover Text may - be at most 25 words. - - A "Transparent" copy of the Document means a machine-readable copy, - represented in a format whose specification is available to the - general public, that is suitable for revising the document - straightforwardly with generic text editors or (for images - composed of pixels) generic paint programs or (for drawings) some - widely available drawing editor, and that is suitable for input to - text formatters or for automatic translation to a variety of - formats suitable for input to text formatters. A copy made in an - otherwise Transparent file format whose markup, or absence of - markup, has been arranged to thwart or discourage subsequent - modification by readers is not Transparent. An image format is - not Transparent if used for any substantial amount of text. A - copy that is not "Transparent" is called "Opaque". - - Examples of suitable formats for Transparent copies include plain - ASCII without markup, Texinfo input format, LaTeX input format, - SGML or XML using a publicly available DTD, and - standard-conforming simple HTML, PostScript or PDF designed for - human modification. Examples of transparent image formats include - PNG, XCF and JPG. Opaque formats include proprietary formats that - can be read and edited only by proprietary word processors, SGML or - XML for which the DTD and/or processing tools are not generally - available, and the machine-generated HTML, PostScript or PDF - produced by some word processors for output purposes only. - - The "Title Page" means, for a printed book, the title page itself, - plus such following pages as are needed to hold, legibly, the - material this License requires to appear in the title page. For - works in formats which do not have any title page as such, "Title - Page" means the text near the most prominent appearance of the - work's title, preceding the beginning of the body of the text. - - A section "Entitled XYZ" means a named subunit of the Document - whose title either is precisely XYZ or contains XYZ in parentheses - following text that translates XYZ in another language. (Here XYZ - stands for a specific section name mentioned below, such as - "Acknowledgements", "Dedications", "Endorsements", or "History".) - To "Preserve the Title" of such a section when you modify the - Document means that it remains a section "Entitled XYZ" according - to this definition. - - The Document may include Warranty Disclaimers next to the notice - which states that this License applies to the Document. These - Warranty Disclaimers are considered to be included by reference in - this License, but only as regards disclaiming warranties: any other - implication that these Warranty Disclaimers may have is void and - has no effect on the meaning of this License. - - 2. VERBATIM COPYING - - You may copy and distribute the Document in any medium, either - commercially or noncommercially, provided that this License, the - copyright notices, and the license notice saying this License - applies to the Document are reproduced in all copies, and that you - add no other conditions whatsoever to those of this License. You - may not use technical measures to obstruct or control the reading - or further copying of the copies you make or distribute. However, - you may accept compensation in exchange for copies. If you - distribute a large enough number of copies you must also follow - the conditions in section 3. - - You may also lend copies, under the same conditions stated above, - and you may publicly display copies. - - 3. COPYING IN QUANTITY - - If you publish printed copies (or copies in media that commonly - have printed covers) of the Document, numbering more than 100, and - the Document's license notice requires Cover Texts, you must - enclose the copies in covers that carry, clearly and legibly, all - these Cover Texts: Front-Cover Texts on the front cover, and - Back-Cover Texts on the back cover. Both covers must also clearly - and legibly identify you as the publisher of these copies. The - front cover must present the full title with all words of the - title equally prominent and visible. You may add other material - on the covers in addition. Copying with changes limited to the - covers, as long as they preserve the title of the Document and - satisfy these conditions, can be treated as verbatim copying in - other respects. - - If the required texts for either cover are too voluminous to fit - legibly, you should put the first ones listed (as many as fit - reasonably) on the actual cover, and continue the rest onto - adjacent pages. - - If you publish or distribute Opaque copies of the Document - numbering more than 100, you must either include a - machine-readable Transparent copy along with each Opaque copy, or - state in or with each Opaque copy a computer-network location from - which the general network-using public has access to download - using public-standard network protocols a complete Transparent - copy of the Document, free of added material. If you use the - latter option, you must take reasonably prudent steps, when you - begin distribution of Opaque copies in quantity, to ensure that - this Transparent copy will remain thus accessible at the stated - location until at least one year after the last time you - distribute an Opaque copy (directly or through your agents or - retailers) of that edition to the public. - - It is requested, but not required, that you contact the authors of - the Document well before redistributing any large number of - copies, to give them a chance to provide you with an updated - version of the Document. - - 4. MODIFICATIONS - - You may copy and distribute a Modified Version of the Document - under the conditions of sections 2 and 3 above, provided that you - release the Modified Version under precisely this License, with - the Modified Version filling the role of the Document, thus - licensing distribution and modification of the Modified Version to - whoever possesses a copy of it. In addition, you must do these - things in the Modified Version: - - A. Use in the Title Page (and on the covers, if any) a title - distinct from that of the Document, and from those of - previous versions (which should, if there were any, be listed - in the History section of the Document). You may use the - same title as a previous version if the original publisher of - that version gives permission. - - B. List on the Title Page, as authors, one or more persons or - entities responsible for authorship of the modifications in - the Modified Version, together with at least five of the - principal authors of the Document (all of its principal - authors, if it has fewer than five), unless they release you - from this requirement. - - C. State on the Title page the name of the publisher of the - Modified Version, as the publisher. - - D. Preserve all the copyright notices of the Document. - - E. Add an appropriate copyright notice for your modifications - adjacent to the other copyright notices. - - F. Include, immediately after the copyright notices, a license - notice giving the public permission to use the Modified - Version under the terms of this License, in the form shown in - the Addendum below. - - G. Preserve in that license notice the full lists of Invariant - Sections and required Cover Texts given in the Document's - license notice. - - H. Include an unaltered copy of this License. - - I. Preserve the section Entitled "History", Preserve its Title, - and add to it an item stating at least the title, year, new - authors, and publisher of the Modified Version as given on - the Title Page. If there is no section Entitled "History" in - the Document, create one stating the title, year, authors, - and publisher of the Document as given on its Title Page, - then add an item describing the Modified Version as stated in - the previous sentence. - - J. Preserve the network location, if any, given in the Document - for public access to a Transparent copy of the Document, and - likewise the network locations given in the Document for - previous versions it was based on. These may be placed in - the "History" section. You may omit a network location for a - work that was published at least four years before the - Document itself, or if the original publisher of the version - it refers to gives permission. - - K. For any section Entitled "Acknowledgements" or "Dedications", - Preserve the Title of the section, and preserve in the - section all the substance and tone of each of the contributor - acknowledgements and/or dedications given therein. - - L. Preserve all the Invariant Sections of the Document, - unaltered in their text and in their titles. Section numbers - or the equivalent are not considered part of the section - titles. - - M. Delete any section Entitled "Endorsements". Such a section - may not be included in the Modified Version. - - N. Do not retitle any existing section to be Entitled - "Endorsements" or to conflict in title with any Invariant - Section. - - O. Preserve any Warranty Disclaimers. - - If the Modified Version includes new front-matter sections or - appendices that qualify as Secondary Sections and contain no - material copied from the Document, you may at your option - designate some or all of these sections as invariant. To do this, - add their titles to the list of Invariant Sections in the Modified - Version's license notice. These titles must be distinct from any - other section titles. - - You may add a section Entitled "Endorsements", provided it contains - nothing but endorsements of your Modified Version by various - parties--for example, statements of peer review or that the text - has been approved by an organization as the authoritative - definition of a standard. - - You may add a passage of up to five words as a Front-Cover Text, - and a passage of up to 25 words as a Back-Cover Text, to the end - of the list of Cover Texts in the Modified Version. Only one - passage of Front-Cover Text and one of Back-Cover Text may be - added by (or through arrangements made by) any one entity. If the - Document already includes a cover text for the same cover, - previously added by you or by arrangement made by the same entity - you are acting on behalf of, you may not add another; but you may - replace the old one, on explicit permission from the previous - publisher that added the old one. - - The author(s) and publisher(s) of the Document do not by this - License give permission to use their names for publicity for or to - assert or imply endorsement of any Modified Version. - - 5. COMBINING DOCUMENTS - - You may combine the Document with other documents released under - this License, under the terms defined in section 4 above for - modified versions, provided that you include in the combination - all of the Invariant Sections of all of the original documents, - unmodified, and list them all as Invariant Sections of your - combined work in its license notice, and that you preserve all - their Warranty Disclaimers. - - The combined work need only contain one copy of this License, and - multiple identical Invariant Sections may be replaced with a single - copy. If there are multiple Invariant Sections with the same name - but different contents, make the title of each such section unique - by adding at the end of it, in parentheses, the name of the - original author or publisher of that section if known, or else a - unique number. Make the same adjustment to the section titles in - the list of Invariant Sections in the license notice of the - combined work. - - In the combination, you must combine any sections Entitled - "History" in the various original documents, forming one section - Entitled "History"; likewise combine any sections Entitled - "Acknowledgements", and any sections Entitled "Dedications". You - must delete all sections Entitled "Endorsements." - - 6. COLLECTIONS OF DOCUMENTS - - You may make a collection consisting of the Document and other - documents released under this License, and replace the individual - copies of this License in the various documents with a single copy - that is included in the collection, provided that you follow the - rules of this License for verbatim copying of each of the - documents in all other respects. - - You may extract a single document from such a collection, and - distribute it individually under this License, provided you insert - a copy of this License into the extracted document, and follow - this License in all other respects regarding verbatim copying of - that document. - - 7. AGGREGATION WITH INDEPENDENT WORKS - - A compilation of the Document or its derivatives with other - separate and independent documents or works, in or on a volume of - a storage or distribution medium, is called an "aggregate" if the - copyright resulting from the compilation is not used to limit the - legal rights of the compilation's users beyond what the individual - works permit. When the Document is included in an aggregate, this - License does not apply to the other works in the aggregate which - are not themselves derivative works of the Document. - - If the Cover Text requirement of section 3 is applicable to these - copies of the Document, then if the Document is less than one half - of the entire aggregate, the Document's Cover Texts may be placed - on covers that bracket the Document within the aggregate, or the - electronic equivalent of covers if the Document is in electronic - form. Otherwise they must appear on printed covers that bracket - the whole aggregate. - - 8. TRANSLATION - - Translation is considered a kind of modification, so you may - distribute translations of the Document under the terms of section - 4. Replacing Invariant Sections with translations requires special - permission from their copyright holders, but you may include - translations of some or all Invariant Sections in addition to the - original versions of these Invariant Sections. You may include a - translation of this License, and all the license notices in the - Document, and any Warranty Disclaimers, provided that you also - include the original English version of this License and the - original versions of those notices and disclaimers. In case of a - disagreement between the translation and the original version of - this License or a notice or disclaimer, the original version will - prevail. - - If a section in the Document is Entitled "Acknowledgements", - "Dedications", or "History", the requirement (section 4) to - Preserve its Title (section 1) will typically require changing the - actual title. - - 9. TERMINATION - - You may not copy, modify, sublicense, or distribute the Document - except as expressly provided for under this License. Any other - attempt to copy, modify, sublicense or distribute the Document is - void, and will automatically terminate your rights under this - License. However, parties who have received copies, or rights, - from you under this License will not have their licenses - terminated so long as such parties remain in full compliance. - - 10. FUTURE REVISIONS OF THIS LICENSE - - The Free Software Foundation may publish new, revised versions of - the GNU Free Documentation License from time to time. Such new - versions will be similar in spirit to the present version, but may - differ in detail to address new problems or concerns. See - `http://www.gnu.org/copyleft/'. - - Each version of the License is given a distinguishing version - number. If the Document specifies that a particular numbered - version of this License "or any later version" applies to it, you - have the option of following the terms and conditions either of - that specified version or of any later version that has been - published (not as a draft) by the Free Software Foundation. If - the Document does not specify a version number of this License, - you may choose any version ever published (not as a draft) by the - Free Software Foundation. - -ADDENDUM: How to use this License for your documents -==================================================== - -To use this License in a document you have written, include a copy of -the License in the document and put the following copyright and license -notices just after the title page: - - Copyright (C) YEAR YOUR NAME. - Permission is granted to copy, distribute and/or modify this document - under the terms of the GNU Free Documentation License, Version 1.2 - or any later version published by the Free Software Foundation; - with no Invariant Sections, no Front-Cover Texts, and no Back-Cover - Texts. A copy of the license is included in the section entitled ``GNU - Free Documentation License''. - - If you have Invariant Sections, Front-Cover Texts and Back-Cover -Texts, replace the "with...Texts." line with this: - - with the Invariant Sections being LIST THEIR TITLES, with - the Front-Cover Texts being LIST, and with the Back-Cover Texts - being LIST. - - If you have Invariant Sections without Cover Texts, or some other -combination of the three, merge those two alternatives to suit the -situation. - - If your document contains nontrivial examples of program code, we -recommend releasing these examples in parallel under your choice of -free software license, such as the GNU General Public License, to -permit their use in free software. - - -File: m4.info, Node: Indices, Prev: Copying This Manual, Up: Top - -Appendix C Indices of concepts and macros -***************************************** - -* Menu: - -* Macro index:: Index for all `m4' macros -* Concept index:: Index for many concepts - - -File: m4.info, Node: Macro index, Next: Concept index, Up: Indices - -C.1 Index for all `m4' macros -============================= - -This index covers all `m4' builtins, as well as several useful -composite macros. References are exclusively to the places where a -macro is introduced the first time. - -�[index�] -* Menu: - -* __file__: Location. (line 10) -* __gnu__: Platform macros. (line 12) -* __line__: Location. (line 11) -* __os2__: Platform macros. (line 13) -* __program__: Location. (line 12) -* __unix__: Platform macros. (line 15) -* __windows__: Platform macros. (line 17) -* argn: Shift. (line 112) -* array: Define. (line 56) -* array_set: Define. (line 57) -* builtin: Builtin. (line 9) -* capitalize: Patsubst. (line 55) -* changecom: Changecom. (line 10) -* changequote: Changequote. (line 10) -* changeword: Changeword. (line 23) -* cleardivert: Cleardivert. (line 26) -* debugfile: Debug Output. (line 11) -* debugmode: Debug Levels. (line 75) -* decr: Incr. (line 11) -* define: Define. (line 10) -* defn: Defn. (line 10) -* divert: Divert. (line 9) -* divnum: Divnum. (line 9) -* dnl: Dnl. (line 9) -* downcase: Patsubst. (line 54) -* dquote: Shift. (line 53) -* dquote_elt: Shift. (line 54) -* dumpdef: Dumpdef. (line 10) -* errprint: Errprint. (line 9) -* esyscmd: Esyscmd. (line 9) -* eval: Eval. (line 9) -* example: Manual. (line 40) -* exch: Arguments. (line 13) -* fatal_error: M4exit. (line 25) -* foreach: Foreach. (line 9) -* foreachq: Foreach. (line 10) -* forloop: Forloop. (line 9) -* format: Format. (line 9) -* ifdef: Ifdef. (line 10) -* ifelse: Ifelse. (line 11) -* include: Include. (line 9) -* incr: Incr. (line 10) -* index: Index macro. (line 9) -* indir: Indir. (line 9) -* len: Len. (line 9) -* m4exit: M4exit. (line 10) -* m4wrap: M4wrap. (line 14) -* maketemp: Mkstemp. (line 12) -* mkstemp: Mkstemp. (line 11) -* nargs: Pseudo Arguments. (line 13) -* os2: Platform macros. (line 14) -* patsubst: Patsubst. (line 9) -* popdef: Pushdef. (line 12) -* pushdef: Pushdef. (line 11) -* quote: Shift. (line 52) -* regexp: Regexp. (line 9) -* reverse: Shift. (line 32) -* shift: Shift. (line 17) -* sinclude: Include. (line 10) -* substr: Substr. (line 9) -* syscmd: Syscmd. (line 9) -* sysval: Sysval. (line 9) -* traceoff: Trace. (line 11) -* traceon: Trace. (line 10) -* translit: Translit. (line 9) -* undefine: Undefine. (line 9) -* undivert: Undivert. (line 9) -* unix: Platform macros. (line 16) -* upcase: Patsubst. (line 53) -* windows: Platform macros. (line 18) - - -File: m4.info, Node: Concept index, Prev: Macro index, Up: Indices - -C.2 Index for many concepts -=========================== - -�[index�] -* Menu: - -* arguments to macros <1>: Macro Arguments. (line 6) -* arguments to macros: Arguments. (line 6) -* arguments to macros, special: Pseudo Arguments. (line 6) -* arguments, more than nine <1>: Arguments. (line 54) -* arguments, more than nine: Shift. (line 106) -* arguments, quoted macro: Quoting Arguments. (line 6) -* arithmetic: Arithmetic. (line 6) -* arrays: Define. (line 52) -* avoiding quadratic behavior: Improved foreach. (line 38) -* basic regular expressions <1>: Patsubst. (line 6) -* basic regular expressions: Regexp. (line 6) -* blind macro <1>: Inhibiting Invocation. - (line 14) -* blind macro: Ifelse. (line 52) -* bug reports: Bugs. (line 6) -* builtins, indirect call of: Builtin. (line 6) -* builtins, special tokens: Defn. (line 79) -* call of builtins, indirect: Builtin. (line 6) -* call of macros, indirect: Indir. (line 6) -* case statement: Ifelse. (line 66) -* changing comment delimiters: Changecom. (line 6) -* changing quote delimiters: Changequote. (line 6) -* changing syntax: Changeword. (line 6) -* characters, translating: Translit. (line 6) -* command line: Invoking m4. (line 6) -* command line, file names on the: Command line files. (line 6) -* command line, macro definitions on the: Preprocessor features. - (line 6) -* command line, options: Invoking m4. (line 10) -* commands, exit status from shell: Sysval. (line 6) -* commands, running shell: Shell commands. (line 6) -* comment delimiters, changing: Changecom. (line 6) -* comments: Comments. (line 6) -* comments, copied to output: Changecom. (line 29) -* comparing strings: Ifelse. (line 6) -* compatibility: Compatibility. (line 6) -* conditionals: Ifdef. (line 6) -* controlling debugging output: Debug Levels. (line 6) -* counting loops: Forloop. (line 6) -* debugging macros: Debugging. (line 6) -* debugging output, controlling: Debug Levels. (line 6) -* debugging output, saving: Debug Output. (line 6) -* decrement operator: Incr. (line 6) -* deferring expansion: M4wrap. (line 6) -* deferring output: Diversions. (line 6) -* defining new macros: Definitions. (line 6) -* definition stack: Pushdef. (line 6) -* definitions, displaying macro <1>: Dumpdef. (line 6) -* definitions, displaying macro: Defn. (line 6) -* deleting macros: Undefine. (line 6) -* deleting whitespace in input: Dnl. (line 6) -* delimiters, changing <1>: Changequote. (line 6) -* delimiters, changing: Changecom. (line 6) -* discarding diverted text: Cleardivert. (line 6) -* discarding input <1>: Dnl. (line 6) -* discarding input <2>: Ifelse. (line 6) -* discarding input: Divert. (line 42) -* displaying macro definitions: Dumpdef. (line 6) -* diversion numbers: Divnum. (line 6) -* diverted text, discarding: Cleardivert. (line 6) -* diverting output to files: Divert. (line 6) -* dumping into frozen file: Using frozen files. (line 6) -* error messages, printing: Errprint. (line 6) -* errors, fatal: Operation modes. (line 20) -* evaluation, of integer expressions: Eval. (line 6) -* examples, understanding: Manual. (line 6) -* executing shell commands: Shell commands. (line 6) -* exit status from shell commands: Sysval. (line 6) -* exiting from m4: M4exit. (line 6) -* expansion of macros: Macro expansion. (line 6) -* expansion, deferring: M4wrap. (line 6) -* expansion, tracing macro: Trace. (line 6) -* expressions, evaluation of integer: Eval. (line 6) -* expressions, regular <1>: Patsubst. (line 6) -* expressions, regular: Regexp. (line 6) -* extracting substrings: Substr. (line 6) -* fast loading of frozen files: Using frozen files. (line 6) -* fatal errors: Operation modes. (line 20) -* FDL, GNU Free Documentation License: GNU Free Documentation License. - (line 6) -* file format, frozen file: Frozen file format. (line 6) -* file inclusion <1>: File Inclusion. (line 6) -* file inclusion: Undivert. (line 13) -* file names, on the command line: Command line files. (line 6) -* files, diverting output to: Divert. (line 6) -* files, names of temporary: Mkstemp. (line 6) -* for each loops: Foreach. (line 6) -* for loops: Forloop. (line 6) -* formatted output: Format. (line 6) -* frozen file format: Frozen file format. (line 6) -* frozen files for fast loading: Using frozen files. (line 6) -* GNU extensions <1>: Inhibiting Invocation. - (line 14) -* GNU extensions <2>: Search Path. (line 6) -* GNU extensions <3>: Divert. (line 54) -* GNU extensions <4>: Undivert. (line 13) -* GNU extensions <5>: Esyscmd. (line 6) -* GNU extensions <6>: Regexp. (line 6) -* GNU extensions <7>: Builtin. (line 6) -* GNU extensions <8>: Using frozen files. (line 6) -* GNU extensions <9>: Debug Output. (line 6) -* GNU extensions <10>: Define. (line 41) -* GNU extensions <11>: Debug Levels. (line 71) -* GNU extensions <12>: Eval. (line 125) -* GNU extensions <13>: Patsubst. (line 6) -* GNU extensions <14>: Mkstemp. (line 56) -* GNU extensions <15>: Undivert. (line 81) -* GNU extensions <16>: Format. (line 6) -* GNU extensions <17>: Extensions. (line 6) -* GNU extensions <18>: Arguments. (line 54) -* GNU extensions: Indir. (line 6) -* GNU M4, history of: History. (line 6) -* history of m4: History. (line 6) -* included files, search path for: Search Path. (line 6) -* inclusion, of files <1>: File Inclusion. (line 6) -* inclusion, of files: Undivert. (line 81) -* increment operator: Incr. (line 6) -* indirect call of builtins: Builtin. (line 6) -* indirect call of macros: Indir. (line 6) -* initialization, frozen state: Using frozen files. (line 6) -* input location <1>: Location. (line 6) -* input location: Preprocessor features. - (line 28) -* input tokens: Syntax. (line 6) -* input, discarding <1>: Divert. (line 42) -* input, discarding <2>: Ifelse. (line 6) -* input, discarding: Dnl. (line 6) -* input, saving: M4wrap. (line 6) -* integer arithmetic: Arithmetic. (line 6) -* integer expression evaluation: Eval. (line 6) -* invoking m4: Invoking m4. (line 6) -* invoking macros: Invocation. (line 6) -* iterating over lists: Foreach. (line 6) -* length of strings: Len. (line 6) -* lexical structure of words: Changeword. (line 6) -* License, code: Copying This Package. - (line 6) -* License, manual: Copying This Manual. (line 6) -* limit, nesting: Limits control. (line 27) -* literal output: Pseudo Arguments. (line 106) -* local variables: Pushdef. (line 79) -* location, input <1>: Preprocessor features. - (line 28) -* location, input: Location. (line 6) -* loops: Shift. (line 10) -* loops, counting: Forloop. (line 6) -* loops, list iteration: Foreach. (line 6) -* M4PATH: Search Path. (line 9) -* macro definitions, on the command line: Preprocessor features. - (line 6) -* macro expansion, tracing: Trace. (line 6) -* macro invocation: Invocation. (line 6) -* macro, blind <1>: Ifelse. (line 52) -* macro, blind: Inhibiting Invocation. - (line 14) -* macros, arguments to <1>: Macro Arguments. (line 6) -* macros, arguments to: Arguments. (line 6) -* macros, debugging: Debugging. (line 6) -* macros, displaying definitions <1>: Defn. (line 6) -* macros, displaying definitions: Dumpdef. (line 6) -* macros, expansion of: Macro expansion. (line 6) -* macros, how to define new: Definitions. (line 6) -* macros, how to delete: Undefine. (line 6) -* macros, how to rename: Defn. (line 6) -* macros, indirect call of: Indir. (line 6) -* macros, quoted arguments to: Quoting Arguments. (line 6) -* macros, recursive: Shift. (line 6) -* macros, special arguments to: Pseudo Arguments. (line 6) -* macros, temporary redefinition of: Pushdef. (line 6) -* messages, printing error: Errprint. (line 6) -* more than nine arguments <1>: Arguments. (line 54) -* more than nine arguments: Shift. (line 106) -* multibranches: Ifelse. (line 66) -* names: Names. (line 6) -* nesting limit: Limits control. (line 27) -* nine arguments, more than <1>: Shift. (line 106) -* nine arguments, more than: Arguments. (line 54) -* numbers: Manual. (line 57) -* options, command line: Invoking m4. (line 10) -* output, diverting to files: Divert. (line 6) -* output, formatted: Format. (line 6) -* output, literal: Pseudo Arguments. (line 106) -* output, saving debugging: Debug Output. (line 6) -* overview of m4: Intro. (line 6) -* pattern substitution: Patsubst. (line 6) -* platform macros: Platform macros. (line 6) -* positional parameters, more than nine: Arguments. (line 54) -* POSIX: Extensions. (line 6) -* POSIXLY_CORRECT: Invoking m4. (line 10) -* preprocessor features: Preprocessor features. - (line 6) -* printing error messages: Errprint. (line 6) -* quadratic behavior, avoiding: Improved foreach. (line 38) -* quote delimiters, changing: Changequote. (line 6) -* quoted macro arguments: Quoting Arguments. (line 6) -* quoted string: Quoted strings. (line 6) -* quoting rule of thumb: Quoting Arguments. (line 22) -* recursive macros: Shift. (line 6) -* redefinition of macros, temporary: Pushdef. (line 6) -* regular expressions <1>: Regexp. (line 6) -* regular expressions <2>: Patsubst. (line 6) -* regular expressions: Changeword. (line 6) -* reloading a frozen file: Using frozen files. (line 6) -* renaming macros: Defn. (line 6) -* reporting bugs: Bugs. (line 6) -* rescanning <1>: Pseudo Arguments. (line 106) -* rescanning <2>: Defn. (line 59) -* rescanning <3>: Other Incompatibilities. - (line 52) -* rescanning <4>: Inhibiting Invocation. - (line 87) -* rescanning: Limits control. (line 40) -* rule of thumb, quoting: Quoting Arguments. (line 22) -* running shell commands: Shell commands. (line 6) -* saving debugging output: Debug Output. (line 6) -* saving input: M4wrap. (line 6) -* search path for included files: Search Path. (line 6) -* shell commands, exit status from: Sysval. (line 6) -* shell commands, running: Shell commands. (line 6) -* special arguments to macros: Pseudo Arguments. (line 6) -* stack, macro definition: Pushdef. (line 6) -* standard error, output to <1>: Trace. (line 6) -* standard error, output to <2>: Errprint. (line 6) -* standard error, output to: Dumpdef. (line 6) -* status of shell commands: Sysval. (line 6) -* status, setting m4 exit: M4exit. (line 6) -* string, quoted: Quoted strings. (line 6) -* strings, length of: Len. (line 6) -* substitution by regular expression: Patsubst. (line 6) -* substrings, extracting: Substr. (line 6) -* substrings, locating: Index macro. (line 6) -* suggestions, reporting: Bugs. (line 6) -* suppressing warnings: Macro Arguments. (line 38) -* switch statement: Ifelse. (line 66) -* synchronization lines: Preprocessor features. - (line 28) -* syntax, changing: Changeword. (line 6) -* temporary file names: Mkstemp. (line 6) -* temporary redefinition of macros: Pushdef. (line 6) -* TMPDIR: Diversions. (line 10) -* tokens: Syntax. (line 6) -* tokens, builtin macro: Defn. (line 79) -* tokens, special: Other tokens. (line 6) -* tracing macro expansion: Trace. (line 6) -* translating characters: Translit. (line 6) -* undefining macros: Undefine. (line 6) -* UNIX commands, exit status from: Sysval. (line 6) -* UNIX commands, running: Shell commands. (line 6) -* variables, local: Pushdef. (line 79) -* warnings, suppressing: Macro Arguments. (line 38) -* words: Names. (line 6) -* words, lexical structure of: Changeword. (line 6) - - +Indirect: +m4.info-1: 879 +m4.info-2: 298627  Tag Table: -Node: Top851 -Node: Preliminaries9359 -Node: Intro10045 -Node: History11677 -Node: Bugs14401 -Node: Manual15652 -Node: Invoking m419050 -Node: Operation modes21198 -Node: Preprocessor features24170 -Node: Limits control27267 -Node: Frozen state30203 -Node: Debugging options31002 -Node: Command line files32741 -Node: Syntax34314 -Node: Names35433 -Node: Quoted strings35895 -Node: Comments36544 -Node: Other tokens37421 -Node: Input processing37999 -Ref: Input processing-Footnote-145672 -Node: Macros45867 -Node: Invocation46361 -Node: Inhibiting Invocation47162 -Node: Macro Arguments51242 -Node: Quoting Arguments54304 -Node: Macro expansion56427 -Node: Definitions57128 -Node: Define57913 -Node: Arguments60351 -Node: Pseudo Arguments64023 -Node: Undefine67565 -Node: Defn68695 -Node: Pushdef71428 -Node: Indir74054 -Node: Builtin76182 -Node: Conditionals78203 -Node: Ifdef79022 -Node: Ifelse79885 -Node: Shift83098 -Node: Forloop87598 -Node: Foreach90234 -Node: Debugging95325 -Node: Dumpdef95910 -Node: Trace97320 -Node: Debug Levels100540 -Node: Debug Output104010 -Node: Input Control105291 -Node: Dnl105828 -Node: Changequote107729 -Node: Changecom112525 -Node: Changeword116041 -Node: M4wrap121482 -Node: File Inclusion123743 -Node: Include124060 -Node: Search Path126740 -Node: Diversions127657 -Node: Divert129448 -Node: Undivert131974 -Node: Divnum135138 -Node: Cleardivert135602 -Node: Text handling136807 -Node: Len137530 -Node: Index macro137915 -Node: Regexp138686 -Node: Substr141106 -Node: Translit142157 -Node: Patsubst144879 -Node: Format148420 -Node: Arithmetic151574 -Node: Incr152023 -Node: Eval152798 -Node: Shell commands160761 -Node: Platform macros161683 -Node: Syscmd163427 -Node: Esyscmd165246 -Node: Sysval166294 -Node: Mkstemp167912 -Node: Miscellaneous171329 -Node: Errprint171762 -Node: Location172981 -Node: M4exit175710 -Node: Frozen files177797 -Node: Using frozen files178578 -Node: Frozen file format181842 -Node: Compatibility184906 -Node: Extensions185521 -Node: Incompatibilities189343 -Node: Other Incompatibilities197551 -Node: Answers200197 -Node: Improved exch200815 -Node: Improved forloop201353 -Node: Improved foreach203212 -Node: Improved cleardivert210241 -Node: Improved fatal_error211224 -Node: Copying This Package212286 -Node: Copying212757 -Node: Copying This Manual250280 -Node: GNU Free Documentation License250800 -Node: Indices273194 -Node: Macro index273474 -Node: Concept index278908 +(Indirect) +Node: Top879 +Node: Preliminaries9552 +Node: Intro10238 +Node: History11870 +Node: Bugs14604 +Node: Manual15855 +Node: Invoking m419253 +Node: Operation modes21401 +Node: Preprocessor features24373 +Node: Limits control27470 +Node: Frozen state30406 +Node: Debugging options31205 +Node: Command line files32944 +Node: Syntax34517 +Node: Names35636 +Node: Quoted strings36098 +Node: Comments36747 +Node: Other tokens37624 +Node: Input processing38202 +Ref: Input processing-Footnote-145875 +Node: Macros46070 +Node: Invocation46564 +Node: Inhibiting Invocation47365 +Node: Macro Arguments51497 +Node: Quoting Arguments54559 +Node: Macro expansion56682 +Node: Definitions57383 +Node: Define58168 +Node: Arguments60606 +Node: Pseudo Arguments64278 +Node: Undefine67820 +Node: Defn68950 +Node: Pushdef73400 +Node: Indir76026 +Node: Builtin78154 +Node: Conditionals80175 +Node: Ifdef80994 +Node: Ifelse81857 +Node: Shift85083 +Node: Forloop95632 +Node: Foreach98268 +Node: Debugging103741 +Node: Dumpdef104326 +Node: Trace105736 +Node: Debug Levels108956 +Node: Debug Output112426 +Node: Input Control113710 +Node: Dnl114247 +Node: Changequote116148 +Node: Changecom122154 +Node: Changeword125850 +Node: M4wrap131291 +Node: File Inclusion135287 +Node: Include135604 +Node: Search Path138284 +Node: Diversions139201 +Node: Divert140992 +Node: Undivert143518 +Node: Divnum146682 +Node: Cleardivert147146 +Node: Text handling148351 +Node: Len149074 +Node: Index macro149459 +Node: Regexp150332 +Node: Substr152873 +Node: Translit153924 +Node: Patsubst156646 +Node: Format161172 +Node: Arithmetic164365 +Node: Incr164814 +Node: Eval165589 +Node: Shell commands173552 +Node: Platform macros174474 +Node: Syscmd176589 +Node: Esyscmd178408 +Node: Sysval179456 +Node: Mkstemp181074 +Node: Miscellaneous185029 +Node: Errprint185462 +Node: Location186681 +Node: M4exit189458 +Node: Frozen files191545 +Node: Using frozen files192326 +Node: Frozen file format195590 +Node: Compatibility198654 +Node: Extensions199720 +Node: Incompatibilities203587 +Node: Other Incompatibilities211278 +Node: Answers213924 +Node: Improved exch214654 +Node: Improved forloop215192 +Node: Improved foreach218647 +Node: Improved m4wrap227996 +Node: Improved cleardivert230423 +Node: Improved capitalize231404 +Node: Improved fatal_error236332 +Node: Copying This Package237393 +Node: GNU General Public License237872 +Node: Copying This Manual275431 +Node: GNU Free Documentation License275951 +Node: Indices298347 +Node: Macro index298627 +Node: Concept index304280  End Tag Table diff -ruNp m4-1.4.10/doc/m4.info-1 m4-1.4.11/doc/m4.info-1 --- m4-1.4.10/doc/m4.info-1 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/doc/m4.info-1 2008-04-01 21:34:34.000000000 -0600 @@ -0,0 +1,7738 @@ +This is ../../doc/m4.info, produced by makeinfo version 4.8 from +../../doc/m4.texinfo. + + This manual is for GNU M4 (version 1.4.11, 29 March 2008), a package +containing an implementation of the m4 macro language. + + Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 2004, 2005, 2006, +2007, 2008 Free Software Foundation, Inc. + + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU Free Documentation License, + Version 1.2 or any later version published by the Free Software + Foundation; with no Invariant Sections, no Front-Cover Texts, and + no Back-Cover Texts. A copy of the license is included in the + section entitled "GNU Free Documentation License." + +INFO-DIR-SECTION Text creation and manipulation +START-INFO-DIR-ENTRY +* M4: (m4). A powerful macro processor. +END-INFO-DIR-ENTRY + + +File: m4.info, Node: Top, Next: Preliminaries, Up: (dir) + +GNU M4 +****** + +This manual is for GNU M4 (version 1.4.11, 29 March 2008), a package +containing an implementation of the m4 macro language. + + Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 2004, 2005, 2006, +2007, 2008 Free Software Foundation, Inc. + + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU Free Documentation License, + Version 1.2 or any later version published by the Free Software + Foundation; with no Invariant Sections, no Front-Cover Texts, and + no Back-Cover Texts. A copy of the license is included in the + section entitled "GNU Free Documentation License." + + GNU `m4' is an implementation of the traditional UNIX macro +processor. It is mostly SVR4 compatible, although it has some +extensions (for example, handling more than 9 positional parameters to +macros). `m4' also has builtin functions for including files, running +shell commands, doing arithmetic, etc. Autoconf needs GNU `m4' for +generating `configure' scripts, but not for running them. + + GNU `m4' was originally written by Rene' Seindal, with subsequent +changes by Franc,ois Pinard and other volunteers on the Internet. All +names and email addresses can be found in the files `m4-1.4.11/AUTHORS' +and `m4-1.4.11/THANKS' from the GNU M4 distribution. + + This is release 1.4.11. It is now considered stable: future +releases in the 1.4.x series are only meant to fix bugs, increase speed, +or improve documentation. However... + + An experimental feature, which would improve `m4' usefulness, allows +for changing the syntax for what is a "word" in `m4'. You should use: + ./configure --enable-changeword + if you want this feature compiled in. The current implementation +slows down `m4' considerably and is hardly acceptable. In the future, +`m4' 2.0 will come with a different set of new features that provide +similar capabilities, but without the inefficiencies, so changeword +will go away and _you should not count on it_. + +* Menu: + +* Preliminaries:: Introduction and preliminaries +* Invoking m4:: Invoking `m4' +* Syntax:: Lexical and syntactic conventions + +* Macros:: How to invoke macros +* Definitions:: How to define new macros +* Conditionals:: Conditionals, loops, and recursion + +* Debugging:: How to debug macros and input + +* Input Control:: Input control +* File Inclusion:: File inclusion +* Diversions:: Diverting and undiverting output + +* Text handling:: Macros for text handling +* Arithmetic:: Macros for doing arithmetic +* Shell commands:: Macros for running shell commands +* Miscellaneous:: Miscellaneous builtin macros +* Frozen files:: Fast loading of frozen state + +* Compatibility:: Compatibility with other versions of `m4' +* Answers:: Correct version of some examples + +* Copying This Package:: How to make copies of the overall M4 package +* Copying This Manual:: How to make copies of this manual +* Indices:: Indices of concepts and macros + + --- The Detailed Node Listing --- + +Introduction and preliminaries + +* Intro:: Introduction to `m4' +* History:: Historical references +* Bugs:: Problems and bugs +* Manual:: Using this manual + +Invoking `m4' + +* Operation modes:: Command line options for operation modes +* Preprocessor features:: Command line options for preprocessor features +* Limits control:: Command line options for limits control +* Frozen state:: Command line options for frozen state +* Debugging options:: Command line options for debugging +* Command line files:: Specifying input files on the command line + +Lexical and syntactic conventions + +* Names:: Macro names +* Quoted strings:: Quoting input to `m4' +* Comments:: Comments in `m4' input +* Other tokens:: Other kinds of input tokens +* Input processing:: How `m4' copies input to output + +How to invoke macros + +* Invocation:: Macro invocation +* Inhibiting Invocation:: Preventing macro invocation +* Macro Arguments:: Macro arguments +* Quoting Arguments:: On Quoting Arguments to macros +* Macro expansion:: Expanding macros + +How to define new macros + +* Define:: Defining a new macro +* Arguments:: Arguments to macros +* Pseudo Arguments:: Special arguments to macros +* Undefine:: Deleting a macro +* Defn:: Renaming macros +* Pushdef:: Temporarily redefining macros + +* Indir:: Indirect call of macros +* Builtin:: Indirect call of builtins + +Conditionals, loops, and recursion + +* Ifdef:: Testing if a macro is defined +* Ifelse:: If-else construct, or multibranch +* Shift:: Recursion in `m4' +* Forloop:: Iteration by counting +* Foreach:: Iteration by list contents + +How to debug macros and input + +* Dumpdef:: Displaying macro definitions +* Trace:: Tracing macro calls +* Debug Levels:: Controlling debugging output +* Debug Output:: Saving debugging output + +Input control + +* Dnl:: Deleting whitespace in input +* Changequote:: Changing the quote characters +* Changecom:: Changing the comment delimiters +* Changeword:: Changing the lexical structure of words +* M4wrap:: Saving text until end of input + +File inclusion + +* Include:: Including named files +* Search Path:: Searching for include files + +Diverting and undiverting output + +* Divert:: Diverting output +* Undivert:: Undiverting output +* Divnum:: Diversion numbers +* Cleardivert:: Discarding diverted text + +Macros for text handling + +* Len:: Calculating length of strings +* Index macro:: Searching for substrings +* Regexp:: Searching for regular expressions +* Substr:: Extracting substrings +* Translit:: Translating characters +* Patsubst:: Substituting text by regular expression +* Format:: Formatting strings (printf-like) + +Macros for doing arithmetic + +* Incr:: Decrement and increment operators +* Eval:: Evaluating integer expressions + +Macros for running shell commands + +* Platform macros:: Determining the platform +* Syscmd:: Executing simple commands +* Esyscmd:: Reading the output of commands +* Sysval:: Exit status +* Mkstemp:: Making temporary files + +Miscellaneous builtin macros + +* Errprint:: Printing error messages +* Location:: Printing current location +* M4exit:: Exiting from `m4' + +Fast loading of frozen state + +* Using frozen files:: Using frozen files +* Frozen file format:: Frozen file format + +Compatibility with other versions of `m4' + +* Extensions:: Extensions in GNU M4 +* Incompatibilities:: Facilities in System V m4 not in GNU M4 +* Other Incompatibilities:: Other incompatibilities + +Correct version of some examples + +* Improved exch:: Solution for `exch' +* Improved forloop:: Solution for `forloop' +* Improved foreach:: Solution for `foreach' +* Improved m4wrap:: Solution for `m4wrap' +* Improved cleardivert:: Solution for `cleardivert' +* Improved capitalize:: Solution for `capitalize' +* Improved fatal_error:: Solution for `fatal_error' + +How to make copies of the overall M4 package + +* GNU General Public License:: License for copying the M4 package + +How to make copies of this manual + +* GNU Free Documentation License:: License for copying this manual + +Indices of concepts and macros + +* Macro index:: Index for all `m4' macros +* Concept index:: Index for many concepts + + +File: m4.info, Node: Preliminaries, Next: Invoking m4, Prev: Top, Up: Top + +1 Introduction and preliminaries +******************************** + +This first chapter explains what GNU `m4' is, where `m4' comes from, +how to read and use this documentation, how to call the `m4' program, +and how to report bugs about it. It concludes by giving tips for +reading the remainder of the manual. + + The following chapters then detail all the features of the `m4' +language. + +* Menu: + +* Intro:: Introduction to `m4' +* History:: Historical references +* Bugs:: Problems and bugs +* Manual:: Using this manual + + +File: m4.info, Node: Intro, Next: History, Up: Preliminaries + +1.1 Introduction to `m4' +======================== + +`m4' is a macro processor, in the sense that it copies its input to the +output, expanding macros as it goes. Macros are either builtin or +user-defined, and can take any number of arguments. Besides just doing +macro expansion, `m4' has builtin functions for including named files, +running shell commands, doing integer arithmetic, manipulating text in +various ways, performing recursion, etc.... `m4' can be used either as +a front-end to a compiler, or as a macro processor in its own right. + + The `m4' macro processor is widely available on all UNIXes, and has +been standardized by POSIX. Usually, only a small percentage of users +are aware of its existence. However, those who find it often become +committed users. The popularity of GNU Autoconf, which requires GNU +`m4' for _generating_ `configure' scripts, is an incentive for many to +install it, while these people will not themselves program in `m4'. +GNU `m4' is mostly compatible with the System V, Release 3 version, +except for some minor differences. *Note Compatibility::, for more +details. + + Some people find `m4' to be fairly addictive. They first use `m4' +for simple problems, then take bigger and bigger challenges, learning +how to write complex sets of `m4' macros along the way. Once really +addicted, users pursue writing of sophisticated `m4' applications even +to solve simple problems, devoting more time debugging their `m4' +scripts than doing real work. Beware that `m4' may be dangerous for +the health of compulsive programmers. + + +File: m4.info, Node: History, Next: Bugs, Prev: Intro, Up: Preliminaries + +1.2 Historical references +========================= + +`GPM' was an important ancestor of `m4'. See C. Stratchey: "A General +Purpose Macro generator", Computer Journal 8,3 (1965), pp. 225 ff. +`GPM' is also succinctly described into David Gries classic "Compiler +Construction for Digital Computers". + + The classic B. Kernighan and P.J. Plauger: "Software Tools", +Addison-Wesley, Inc. (1976) describes and implements a Unix +macro-processor language, which inspired Dennis Ritchie to write `m3', +a macro processor for the AP-3 minicomputer. + + Kernighan and Ritchie then joined forces to develop the original +`m4', as described in "The M4 Macro Processor", Bell Laboratories +(1977). It had only 21 builtin macros. + + While `GPM' was more _pure_, `m4' is meant to deal with the true +intricacies of real life: macros can be recognized without being +pre-announced, skipping whitespace or end-of-lines is easier, more +constructs are builtin instead of derived, etc. + + Originally, the Kernighan and Plauger macro-processor, and then +`m3', formed the engine for the Rational FORTRAN preprocessor, that is, +the `Ratfor' equivalent of `cpp'. Later, `m4' was used as a front-end +for `Ratfor', `C' and `Cobol'. + + Rene' Seindal released his implementation of `m4', GNU `m4', in +1990, with the aim of removing the artificial limitations in many of +the traditional `m4' implementations, such as maximum line length, +macro size, or number of macros. + + The late Professor A. Dain Samples described and implemented a +further evolution in the form of `M5': "User's Guide to the M5 Macro +Language: 2nd edition", Electronic Announcement on comp.compilers +newsgroup (1992). + + Franc,ois Pinard took over maintenance of GNU `m4' in 1992, until +1994 when he released GNU `m4' 1.4, which was the stable release for 10 +years. It was at this time that GNU Autoconf decided to require GNU +`m4' as its underlying engine, since all other implementations of `m4' +had too many limitations. + + More recently, in 2004, Paul Eggert released 1.4.1 and 1.4.2 which +addressed some long standing bugs in the venerable 1.4 release. Then in +2005, Gary V. Vaughan collected together the many patches to GNU `m4' +1.4 that were floating around the net and released 1.4.3 and 1.4.4. +And in 2006, Eric Blake joined the team and prepared patches for the +release of 1.4.5, 1.4.6, 1.4.7, and 1.4.8. The 1.4.x series remains +open for bug fixes, including releases 1.4.9, 1.4.10, and 1.4.11 in +2007. + + Meanwhile, development has continued on new features for `m4', such +as dynamic module loading and additional builtins. When complete, GNU +`m4' 2.0 will start a new series of releases. + + +File: m4.info, Node: Bugs, Next: Manual, Prev: History, Up: Preliminaries + +1.3 Problems and bugs +===================== + +If you have problems with GNU M4 or think you've found a bug, please +report it. Before reporting a bug, make sure you've actually found a +real bug. Carefully reread the documentation and see if it really says +you can do what you're trying to do. If it's not clear whether you +should be able to do something or not, report that too; it's a bug in +the documentation! + + Before reporting a bug or trying to fix it yourself, try to isolate +it to the smallest possible input file that reproduces the problem. +Then send us the input file and the exact results `m4' gave you. Also +say what you expected to occur; this will help us decide whether the +problem was really in the documentation. + + Once you've got a precise problem, send e-mail to <bug-m4@gnu.org>. +Please include the version number of `m4' you are using. You can get +this information with the command `m4 --version'. Also provide details +about the platform you are executing on. + + Non-bug suggestions are always welcome as well. If you have +questions about things that are unclear in the documentation or are +just obscure features, please report them too. + + +File: m4.info, Node: Manual, Prev: Bugs, Up: Preliminaries + +1.4 Using this manual +===================== + +This manual contains a number of examples of `m4' input and output, and +a simple notation is used to distinguish input, output and error +messages from `m4'. Examples are set out from the normal text, and +shown in a fixed width font, like this + + This is an example of an example! + + To distinguish input from output, all output from `m4' is prefixed +by the string `=>', and all error messages by the string `error-->'. +When showing how command line options affect matters, the command line +is shown with a prompt `$ like this', otherwise, you can assume that a +simple `m4' invocation will work. Thus: + + $ command line to invoke m4 + Example of input line + =>Output line from m4 + error-->and an error message + + The sequence `^D' in an example indicates the end of the input file. +The sequence `<NL>' refers to the newline character. The majority of +these examples are self-contained, and you can run them with similar +results by invoking `m4 -d'. In fact, the testsuite that is bundled in +the GNU M4 package consists of the examples in this document! Some of +the examples assume that your current directory is located where you +unpacked the installation, so if you plan on following along, you may +find it helpful to do this now: + + $ cd m4-1.4.11 + + As each of the predefined macros in `m4' is described, a prototype +call of the macro will be shown, giving descriptive names to the +arguments, e.g., + + -- Composite: example (STRING, [COUNT = `1'], [ARGUMENT]...) + This is a sample prototype. There is not really a macro named + `example', but this documents that if there were, it would be a + Composite macro, rather than a Builtin. It requires at least one + argument, STRING. Remember that in `m4', there must not be a + space between the macro name and the opening parenthesis, unless + it was intended to call the macro without any arguments. The + brackets around COUNT and ARGUMENT show that these arguments are + optional. If COUNT is omitted, the macro behaves as if count were + `1', whereas if ARGUMENT is omitted, the macro behaves as if it + were the empty string. A blank argument is not the same as an + omitted argument. For example, `example(`a')', `example(`a',`1')', + and `example(`a',`1',)' would behave identically with COUNT set to + `1'; while `example(`a',)' and `example(`a',`')' would explicitly + pass the empty string for COUNT. The ellipses (`...') show that + the macro processes additional arguments after ARGUMENT, rather + than ignoring them. + + All macro arguments in `m4' are strings, but some are given special +interpretation, e.g., as numbers, file names, regular expressions, etc. +The documentation for each macro will state how the parameters are +interpreted, and what happens if the argument cannot be parsed +according to the desired interpretation. Unless specified otherwise, a +parameter specified to be a number is parsed as a decimal, even if the +argument has leading zeros; and parsing the empty string as a number +results in 0 rather than an error, although a warning will be issued. + + This document consistently writes and uses "builtin", without a +hyphen, as if it were an English word. This is how the `builtin' +primitive is spelled within `m4'. + + +File: m4.info, Node: Invoking m4, Next: Syntax, Prev: Preliminaries, Up: Top + +2 Invoking `m4' +*************** + +The format of the `m4' command is: + + `m4' [OPTION...] [FILE...] + + All options begin with `-', or if long option names are used, with +`--'. A long option name need not be written completely, any +unambiguous prefix is sufficient. POSIX requires `m4' to recognize +arguments intermixed with files, even when `POSIXLY_CORRECT' is set in +the environment. Most options take effect at startup regardless of +their position, but some are documented below as taking effect after +any files that occurred earlier in the command line. The argument `--' +is a marker to denote the end of options. + + With short options, options that do not take arguments may be +combined into a single command line argument with subsequent options, +options with mandatory arguments may be provided either as a single +command line argument or as two arguments, and options with optional +arguments must be provided as a single argument. In other words, `m4 +-QPDfoo -d a -d+f' is equivalent to `m4 -Q -P -D foo -d -d+f -- ./a', +although the latter form is considered canonical. + + With long options, options with mandatory arguments may be provided +with an equal sign (`=') in a single argument, or as two arguments, and +options with optional arguments must be provided as a single argument. +In other words, `m4 --def foo --debug a' is equivalent to `m4 +--define=foo --debug= -- ./a', although the latter form is considered +canonical (not to mention more robust, in case a future version of `m4' +introduces an option named `--default'). + + `m4' understands the following options, grouped by functionality. + +* Menu: + +* Operation modes:: Command line options for operation modes +* Preprocessor features:: Command line options for preprocessor features +* Limits control:: Command line options for limits control +* Frozen state:: Command line options for frozen state +* Debugging options:: Command line options for debugging +* Command line files:: Specifying input files on the command line + + +File: m4.info, Node: Operation modes, Next: Preprocessor features, Up: Invoking m4 + +2.1 Command line options for operation modes +============================================ + +Several options control the overall operation of `m4': + +`--help' + Print a help summary on standard output, then immediately exit + `m4' without reading any input files or performing any other + actions. + +`--version' + Print the version number of the program on standard output, then + immediately exit `m4' without reading any input files or + performing any other actions. + +`-E' +`--fatal-warnings' + Controls the effect of warnings. If unspecified, then execution + continues and exit status is unaffected when a warning is printed. + If specified exactly once, warnings become fatal; when one is + issued, execution continues, but the exit status will be non-zero. + If specified multiple times, then execution halts with non-zero + status the first time a warning is issued. The introduction of + behavior levels is new to M4 1.4.9; for behavior consistent with + earlier versions, you should specify `-E' twice. + +`-i' +`--interactive' +`-e' + Makes this invocation of `m4' interactive. This means that all + output will be unbuffered, and interrupts will be ignored. The + spelling `-e' exists for compatibility with other `m4' + implementations, and issues a warning because it may be withdrawn + in a future version of GNU M4. + +`-P' +`--prefix-builtins' + Internally modify _all_ builtin macro names so they all start with + the prefix `m4_'. For example, using this option, one should write + `m4_define' instead of `define', and `m4___file__' instead of + `__file__'. This option has no effect if `-R' is also specified. + +`-Q' +`--quiet' +`--silent' + Suppress warnings, such as missing or superfluous arguments in + macro calls, or treating the empty string as zero. + +`--warn-macro-sequence[=REGEXP]' + Issue a warning if the regular expression REGEXP has a non-empty + match in any macro definition (either by `define' or `pushdef'). + Empty matches are ignored; therefore, supplying the empty string + as REGEXP disables any warning. If the optional REGEXP is not + supplied, then the default regular expression is + `\$\({[^}]*}\|[0-9][0-9]+\)' (a literal `$' followed by multiple + digits or by an open brace), since these sequences will change + semantics in the default operation of GNU M4 2.0 (due to a change + in how more than 9 arguments in a macro definition will be + handled, *note Arguments::). Providing an alternate regular + expression can provide a useful reverse lookup feature of finding + where a macro is defined to have a given definition. + +`-W REGEXP' +`--word-regexp=REGEXP' + Use REGEXP as an alternative syntax for macro names. This + experimental option will not be present in all GNU `m4' + implementations (*note Changeword::). + + +File: m4.info, Node: Preprocessor features, Next: Limits control, Prev: Operation modes, Up: Invoking m4 + +2.2 Command line options for preprocessor features +================================================== + +Several options allow `m4' to behave more like a preprocessor. Macro +definitions and deletions can be made on the command line, the search +path can be altered, and the output file can track where the input came +from. These features occur with the following options: + +`-D NAME[=VALUE]' +`--define=NAME[=VALUE]' + This enters NAME into the symbol table. If `=VALUE' is missing, + the value is taken to be the empty string. The VALUE can be any + string, and the macro can be defined to take arguments, just as if + it was defined from within the input. This option may be given + more than once; order with respect to file names is significant, + and redefining the same NAME loses the previous value. + +`-I DIRECTORY' +`--include=DIRECTORY' + Make `m4' search DIRECTORY for included files that are not found + in the current working directory. *Note Search Path::, for more + details. This option may be given more than once. + +`-s' +`--synclines' + Generate synchronization lines, for use by the C preprocessor or + other similar tools. Order is significant with respect to file + names. This option is useful, for example, when `m4' is used as a + front end to a compiler. Source file name and line number + information is conveyed by directives of the form `#line LINENUM + "FILE"', which are inserted as needed into the middle of the + output. Such directives mean that the following line originated + or was expanded from the contents of input file FILE at line + LINENUM. The `"FILE"' part is often omitted when the file name + did not change from the previous directive. + + Synchronization directives are always given on complete lines by + themselves. When a synchronization discrepancy occurs in the + middle of an output line, the associated synchronization directive + is delayed until the next newline that does not occur in the + middle of a quoted string or comment. + + define(`twoline', `1 + 2') + =>#line 2 "stdin" + => + changecom(`/*', `*/') + => + define(`comment', `/*1 + 2*/') + =>#line 5 + => + dnl no line + hello + =>#line 7 + =>hello + twoline + =>1 + =>#line 8 + =>2 + comment + =>/*1 + =>2*/ + one comment `two + three' + =>#line 10 + =>one /*1 + =>2*/ two + =>three + goodbye + =>#line 12 + =>goodbye + +`-U NAME' +`--undefine=NAME' + This deletes any predefined meaning NAME might have. Obviously, + only predefined macros can be deleted in this way. This option + may be given more than once; undefining a NAME that does not have a + definition is silently ignored. Order is significant with respect + to file names. + + +File: m4.info, Node: Limits control, Next: Frozen state, Prev: Preprocessor features, Up: Invoking m4 + +2.3 Command line options for limits control +=========================================== + +There are some limits within `m4' that can be tuned. For +compatibility, `m4' also accepts some options that control limits in +other implementations, but which are automatically unbounded (limited +only by your hardware and operating system constraints) in GNU `m4'. + +`-G' +`--traditional' + Suppress all the extensions made in this implementation, compared + to the System V version. *Note Compatibility::, for a list of + these. + +`-H NUM' +`--hashsize=NUM' + Make the internal hash table for symbol lookup be NUM entries big. + For better performance, the number should be prime, but this is not + checked. The default is 509 entries. It should not be necessary + to increase this value, unless you define an excessive number of + macros. + +`-L NUM' +`--nesting-limit=NUM' + Artificially limit the nesting of macro calls to NUM levels, + stopping program execution if this limit is ever exceeded. When + not specified, nesting is limited to 1024 levels. A value of zero + means unlimited; but then heavily nested code could potentially + cause a stack overflow. + + The precise effect of this option might be more correctly + associated with textual nesting than dynamic recursion. It has + been useful when some complex `m4' input was generated by + mechanical means. Most users would never need this option. If + shown to be obtrusive, this option (which is still experimental) + might well disappear. + + This option does _not_ have the ability to break endless + rescanning loops, since these do not necessarily consume much + memory or stack space. Through clever usage of rescanning loops, + one can request complex, time-consuming computations from `m4' + with useful results. Putting limitations in this area would break + `m4' power. There are many pathological cases: + `define(`a', `a')a' is only the simplest example (but *note + Compatibility::). Expecting GNU `m4' to detect these would be a + little like expecting a compiler system to detect and diagnose + endless loops: it is a quite _hard_ problem in general, if not + undecidable! + +`-B NUM' +`-S NUM' +`-T NUM' + These options are present for compatibility with System V `m4', but + do nothing in this implementation. They may disappear in future + releases, and issue a warning to that effect. + +`-N NUM' +`--diversions=NUM' + These options are present only for compatibility with previous + versions of GNU `m4', and were controlling the number of possible + diversions which could be used at the same time. They do nothing, + because there is no fixed limit anymore. They may disappear in + future releases, and issue a warning to that effect. + + +File: m4.info, Node: Frozen state, Next: Debugging options, Prev: Limits control, Up: Invoking m4 + +2.4 Command line options for frozen state +========================================= + +GNU `m4' comes with a feature of freezing internal state (*note Frozen +files::). This can be used to speed up `m4' execution when reusing a +common initialization script. + +`-F FILE' +`--freeze-state=FILE' + Once execution is finished, write out the frozen state on the + specified FILE. It is conventional, but not required, for FILE to + end in `.m4f'. + +`-R FILE' +`--reload-state=FILE' + Before execution starts, recover the internal state from the + specified frozen FILE. The options `-D', `-U', and `-t' take + effect after state is reloaded, but before the input files are + read. + + +File: m4.info, Node: Debugging options, Next: Command line files, Prev: Frozen state, Up: Invoking m4 + +2.5 Command line options for debugging +====================================== + +Finally, there are several options for aiding in debugging `m4' scripts. + +`-d[FLAGS]' +`--debug[=FLAGS]' + Set the debug-level according to the flags FLAGS. The debug-level + controls the format and amount of information presented by the + debugging functions. *Note Debug Levels::, for more details on + the format and meaning of FLAGS. If omitted, FLAGS defaults to + `aeq'. + +`--debugfile=FILE' +`-o FILE' +`--error-output=FILE' + Redirect `dumpdef' output, debug messages, and trace output to the + named FILE. Warnings, error messages, and `errprint' output are + still printed to standard error. If unspecified, debug output goes + to standard error; if empty, debug output is discarded. *Note + Debug Output::, for more details. The spellings `-o' and + `--error-output' are misleading and inconsistent with other GNU + tools; for now they are silently accepted as synonyms of + `--debugfile', but in a future version of M4, using them will + cause a warning to be issued. + +`-l NUM' +`--arglength=NUM' + Restrict the size of the output generated by macro tracing to NUM + characters per trace line. If unspecified or zero, output is + unlimited. *Note Debug Levels::, for more details. + +`-t NAME' +`--trace=NAME' + This enables tracing for the macro NAME, at any point where it is + defined. NAME need not be defined when this option is given. + This option may be given more than once, and order is significant + with respect to file names. *Note Trace::, for more details. + + +File: m4.info, Node: Command line files, Prev: Debugging options, Up: Invoking m4 + +2.6 Specifying input files on the command line +============================================== + +The remaining arguments on the command line are taken to be input file +names. If no names are present, standard input is read. A file name +of `-' is taken to mean standard input. It is conventional, but not +required, for input files to end in `.m4'. + + The input files are read in the sequence given. Standard input can +be read more than once, so the file name `-' may appear multiple times +on the command line; this makes a difference when input is from a +terminal or other special file type. It is an error if an input file +ends in the middle of argument collection, a comment, or a quoted +string. + + The options `--define' (`-D'), `--undefine' (`-U'), `--synclines' +(`-s'), and `--trace' (`-t') only take effect after processing input +from any file names that occur earlier on the command line. For +example, assume the file `foo' contains: + + $ cat foo + bar + + The text `bar' can then be redefined over multiple uses of `foo': + + $ m4 -Dbar=hello foo -Dbar=world foo + =>hello + =>world + + If none of the input files invoked `m4exit' (*note M4exit::), the +exit status of `m4' will be 0 for success, 1 for general failure (such +as problems with reading an input file), and 63 for version mismatch +(*note Using frozen files::). + + If you need to read a file whose name starts with a `-', you can +specify it as `./-file', or use `--' to mark the end of options. + + +File: m4.info, Node: Syntax, Next: Macros, Prev: Invoking m4, Up: Top + +3 Lexical and syntactic conventions +*********************************** + +As `m4' reads its input, it separates it into "tokens". A token is +either a name, a quoted string, or any single character, that is not a +part of either a name or a string. Input to `m4' can also contain +comments. GNU `m4' does not yet understand multibyte locales; all +operations are byte-oriented rather than character-oriented (although +if your locale uses a single byte encoding, such as ISO-8859-1, you +will not notice a difference). However, `m4' is eight-bit clean, so +you can use non-ASCII characters in quoted strings (*note +Changequote::), comments (*note Changecom::), and macro names (*note +Indir::), with the exception of the NUL character (the zero byte +`'\0''). + +* Menu: + +* Names:: Macro names +* Quoted strings:: Quoting input to `m4' +* Comments:: Comments in `m4' input +* Other tokens:: Other kinds of input tokens +* Input processing:: How `m4' copies input to output + + +File: m4.info, Node: Names, Next: Quoted strings, Up: Syntax + +3.1 Macro names +=============== + +A name is any sequence of letters, digits, and the character `_' +(underscore), where the first character is not a digit. `m4' will use +the longest such sequence found in the input. If a name has a macro +definition, it will be subject to macro expansion (*note Macros::). +Names are case-sensitive. + + Examples of legal names are: `foo', `_tmp', and `name01'. + + +File: m4.info, Node: Quoted strings, Next: Comments, Prev: Names, Up: Syntax + +3.2 Quoting input to `m4' +========================= + +A quoted string is a sequence of characters surrounded by quote +strings, defaulting to ``' and `'', where the nested begin and end +quotes within the string are balanced. The value of a string token is +the text, with one level of quotes stripped off. Thus + + `' + => + +is the empty string, and double-quoting turns into single-quoting. + + ``quoted'' + =>`quoted' + + The quote characters can be changed at any time, using the builtin +macro `changequote'. *Note Changequote::, for more information. + + +File: m4.info, Node: Comments, Next: Other tokens, Prev: Quoted strings, Up: Syntax + +3.3 Comments in `m4' input +========================== + +Comments in `m4' are normally delimited by the characters `#' and +newline. All characters between the comment delimiters are ignored, +but the entire comment (including the delimiters) is passed through to +the output--comments are _not_ discarded by `m4'. + + Comments cannot be nested, so the first newline after a `#' ends the +comment. The commenting effect of the begin-comment string can be +inhibited by quoting it. + + $ m4 + `quoted text' # `commented text' + =>quoted text # `commented text' + `quoting inhibits' `#' `comments' + =>quoting inhibits # comments + + The comment delimiters can be changed to any string at any time, +using the builtin macro `changecom'. *Note Changecom::, for more +information. + + +File: m4.info, Node: Other tokens, Next: Input processing, Prev: Comments, Up: Syntax + +3.4 Other kinds of input tokens +=============================== + +Any character, that is neither a part of a name, nor of a quoted string, +nor a comment, is a token by itself. When not in the context of macro +expansion, all of these tokens are just copied to output. However, +during macro expansion, whitespace characters (space, tab, newline, +formfeed, carriage return, vertical tab), parentheses (`(' and `)'), +comma (`,'), and dollar (`$') have additional roles, explained later. + + +File: m4.info, Node: Input processing, Prev: Other tokens, Up: Syntax + +3.5 How `m4' copies input to output +=================================== + +As `m4' reads the input token by token, it will copy each token +directly to the output immediately. + + The exception is when it finds a word with a macro definition. In +that case `m4' will calculate the macro's expansion, possibly reading +more input to get the arguments. It then inserts the expansion in front +of the remaining input. In other words, the resulting text from a macro +call will be read and parsed into tokens again. + + `m4' expands a macro as soon as possible. If it finds a macro call +when collecting the arguments to another, it will expand the second call +first. This process continues until there are no more macro calls to +expand and all the input has been consumed. + + For a running example, examine how `m4' handles this input: + + format(`Result is %d', eval(`2**15')) + +First, `m4' sees that the token `format' is a macro name, so it +collects the tokens `(', ``Result is %d'', `,', and ` ', before +encountering another potential macro. Sure enough, `eval' is a macro +name, so the nested argument collection picks up `(', ``2**15'', and +`)', invoking the eval macro with the lone argument of `2**15'. The +expansion of `eval(2**15)' is `32768', which is then rescanned as the +five tokens `3', `2', `7', `6', and `8'; and combined with the next +`)', the format macro now has all its arguments, as if the user had +typed: + + format(`Result is %d', 32768) + +The format macro expands to `Result is 32768', and we have another +round of scanning for the tokens `Result', ` ', `is', ` ', `3', `2', +`7', `6', and `8'. None of these are macros, so the final output is + + =>Result is 32768 + + As a more complicated example, we will contrast an actual code +example from the Gnulib project(1), showing both a buggy approach and +the desired results. The user desires to output a shell assignment +statement that takes its argument and turns it into a shell variable by +converting it to uppercase and prepending a prefix. The original +attempt looks like this: + + changequote([,])dnl + define([gl_STRING_MODULE_INDICATOR], + [ + dnl comment + GNULIB_]translit([$1],[a-z],[A-Z])[=1 + ])dnl + gl_STRING_MODULE_INDICATOR([strcase]) + => + => GNULIB_strcase=1 + => + + Oops - the argument did not get capitalized. And although the manual +is not able to easily show it, both lines that appear empty actually +contain two trailing spaces. By stepping through the parse, it is easy +to see what happened. First, `m4' sees the token `changequote', which +it recognizes as a macro, followed by `(', `[', `,', `]', and `)' to +form the argument list. The macro expands to the empty string, but +changes the quoting characters to something more useful for generating +shell code (unbalanced ``' and `'' appear all the time in shell scripts, +but unbalanced `[]' tend to be rare). Also in the first line, `m4' +sees the token `dnl', which it recognizes as a builtin macro that +consumes the rest of the line, resulting in no output for that line. + + The second line starts a macro definition. `m4' sees the token +`define', which it recognizes as a macro, followed by a `(', +`[gl_STRING_MODULE_INDICATOR]', and `,'. Because an unquoted comma was +encountered, the first argument is known to be the expansion of the +single-quoted string token, or `gl_STRING_MODULE_INDICATOR'. Next, +`m4' sees `<NL>', ` ', and ` ', but this whitespace is discarded as +part of argument collection. Then comes a rather lengthy single-quoted +string token, `[<NL> dnl comment<NL> GNULIB_]'. This is followed +by the token `translit', which `m4' recognizes as a macro name, so a +nested macro expansion has started. + + The arguments to the `translit' are found by the tokens `(', `[$1]', +`,', `[a-z]', `,', `[A-Z]', and finally `)'. All three string +arguments are expanded (or in other words, the quotes are stripped), +and since neither `$' nor `1' need capitalization, the result of the +macro is `$1'. This expansion is rescanned, resulting in the two +literal characters `$' and `1'. + + Scanning of the outer macro resumes, and picks up with `[=1<NL> ]', +and finally `)'. The collected pieces of expanded text are +concatenated, with the end result that the macro +`gl_STRING_MODULE_INDICATOR' is now defined to be the sequence `<NL> +dnl comment<NL> GNULIB_$1=1<NL> '. Once again, `dnl' is recognized +and avoids a newline in the output. + + The final line is then parsed, beginning with ` ' and ` ' that are +output literally. Then `gl_STRING_MODULE_INDICATOR' is recognized as a +macro name, with an argument list of `(', `[strcase]', and `)'. Since +the definition of the macro contains the sequence `$1', that sequence +is replaced with the argument `strcase' prior to starting the rescan. +The rescan sees `<NL>' and four spaces, which are output literally, then +`dnl', which discards the text ` comment<NL>'. Next comes four more +spaces, also output literally, and the token `GNULIB_strcase', which +resulted from the earlier parameter substitution. Since that is not a +macro name, it is output literally, followed by the literal tokens `=', +`1', `<NL>', and two more spaces. Finally, the original `<NL>' seen +after the macro invocation is scanned and output literally. + + Now for a corrected approach. This rearranges the use of newlines +and whitespace so that less whitespace is output (which, although +harmless to shell scripts, can be visually unappealing), and fixes the +quoting issues so that the capitalization occurs when the macro +`gl_STRING_MODULE_INDICATOR' is invoked, rather then when it is defined. + + changequote([,])dnl + define([gl_STRING_MODULE_INDICATOR], + [dnl comment + GNULIB_[]translit([$1], [a-z], [A-Z])=1dnl + ])dnl + gl_STRING_MODULE_INDICATOR([strcase]) + => GNULIB_STRCASE=1 + + The parsing of the first line is unchanged. The second line sees the +name of the macro to define, then sees the discarded `<NL>' and two +spaces, as before. But this time, the next token is `[dnl comment<NL> +GNULIB_[]translit([$1], [a-z], [A-Z])=1dnl<NL>]', which includes nested +quotes, followed by `)' to end the macro definition and `dnl' to skip +the newline. No early expansion of `translit' occurs, so the entire +string becomes the definition of the macro. + + The final line is then parsed, beginning with two spaces that are +output literally, and an invocation of `gl_STRING_MODULE_INDICATOR' +with the argument `strcase'. Again, the `$1' in the macro definition +is substituted prior to rescanning. Rescanning first encounters `dnl', +and discards ` comment<NL>'. Then two spaces are output literally. +Next comes the token `GNULIB_', but that is not a macro, so it is +output literally. The token `[]' is an empty string, so it does not +affect output. Then the token `translit' is encountered. + + This time, the arguments to `translit' are parsed as `(', +`[strcase]', `,', ` ', `[a-z]', `,', ` ', `[A-Z]', and `)'. The two +spaces are discarded, and the translit results in the desired result +`STRCASE'. This is rescanned, but since it is not a macro name, it is +output literally. Then the scanner sees `=' and `1', which are output +literally, followed by `dnl' which discards the rest of the definition +of `gl_STRING_MODULE_INDICATOR'. The newline at the end of output is +the literal `<NL>' that appeared after the invocation of the macro. + + The order in which `m4' expands the macros can be further explored +using the trace facilities of GNU `m4' (*note Trace::). + + ---------- Footnotes ---------- + + (1) Derived from a patch in +`http://lists.gnu.org/archive/html/bug-gnulib/2007-01/msg00389.html', +and a followup patch in +`http://lists.gnu.org/archive/html/bug-gnulib/2007-02/msg00000.html' + + +File: m4.info, Node: Macros, Next: Definitions, Prev: Syntax, Up: Top + +4 How to invoke macros +********************** + +This chapter covers macro invocation, macro arguments and how macro +expansion is treated. + +* Menu: + +* Invocation:: Macro invocation +* Inhibiting Invocation:: Preventing macro invocation +* Macro Arguments:: Macro arguments +* Quoting Arguments:: On Quoting Arguments to macros +* Macro expansion:: Expanding macros + + +File: m4.info, Node: Invocation, Next: Inhibiting Invocation, Up: Macros + +4.1 Macro invocation +==================== + +Macro invocations has one of the forms + + name + +which is a macro invocation without any arguments, or + + name(arg1, arg2, ..., argN) + +which is a macro invocation with N arguments. Macros can have any +number of arguments. All arguments are strings, but different macros +might interpret the arguments in different ways. + + The opening parenthesis _must_ follow the NAME directly, with no +spaces in between. If it does not, the macro is called with no +arguments at all. + + For a macro call to have no arguments, the parentheses _must_ be +left out. The macro call + + name() + +is a macro call with one argument, which is the empty string, not a call +with no arguments. + + +File: m4.info, Node: Inhibiting Invocation, Next: Macro Arguments, Prev: Invocation, Up: Macros + +4.2 Preventing macro invocation +=============================== + +An innovation of the `m4' language, compared to some of its +predecessors (like Stratchey's `GPM', for example), is the ability to +recognize macro calls without resorting to any special, prefixed +invocation character. While generally useful, this feature might +sometimes be the source of spurious, unwanted macro calls. So, GNU +`m4' offers several mechanisms or techniques for inhibiting the +recognition of names as macro calls. + + First of all, many builtin macros cannot meaningfully be called +without arguments. As a GNU extension, for any of these macros, +whenever an opening parenthesis does not immediately follow their name, +the builtin macro call is not triggered. This solves the most usual +cases, like for `include' or `eval'. Later in this document, the +sentence "This macro is recognized only with parameters" refers to this +specific provision of GNU M4, also known as a blind builtin macro. For +the builtins defined by POSIX that bear this disclaimer, POSIX +specifically states that invoking those builtins without arguments is +unspecified, because many other implementations simply invoke the +builtin as though it were given one empty argument instead. + + $ m4 + eval + =>eval + eval(`1') + =>1 + + There is also a command line option (`--prefix-builtins', or `-P', +*note Invoking m4: Operation modes.) that renames all builtin macros +with a prefix of `m4_' at startup. The option has no effect whatsoever +on user defined macros. For example, with this option, one has to +write `m4_dnl' and even `m4_m4exit'. It also has no effect on whether +a macro requires parameters. + + $ m4 -P + eval + =>eval + eval(`1') + =>eval(1) + m4_eval + =>m4_eval + m4_eval(`1') + =>1 + + Another alternative is to redefine problematic macros to a name less +likely to cause conflicts, *Note Definitions::. + + If your version of GNU `m4' has the `changeword' feature compiled +in, it offers far more flexibility in specifying the syntax of macro +names, both builtin or user-defined. *Note Changeword::, for more +information on this experimental feature. + + Of course, the simplest way to prevent a name from being interpreted +as a call to an existing macro is to quote it. The remainder of this +section studies a little more deeply how quoting affects macro +invocation, and how quoting can be used to inhibit macro invocation. + + Even if quoting is usually done over the whole macro name, it can +also be done over only a few characters of this name (provided, of +course, that the unquoted portions are not also a macro). It is also +possible to quote the empty string, but this works only _inside_ the +name. For example: + + `divert' + =>divert + `d'ivert + =>divert + di`ver't + =>divert + div`'ert + =>divert + +all yield the string `divert'. While in both: + + `'divert + => + divert`' + => + +the `divert' builtin macro will be called, which expands to the empty +string. + + The output of macro evaluations is always rescanned. In the +following example, the input `x`'y' yields the string `bCD', exactly as +if `m4' has been given `substr(ab`'cde, `1', `3')' as input: + + define(`cde', `CDE') + => + define(`x', `substr(ab') + => + define(`y', `cde, `1', `3')') + => + x`'y + =>bCD + + Unquoted strings on either side of a quoted string are subject to +being recognized as macro names. In the following example, quoting the +empty string allows for the second `macro' to be recognized as such: + + define(`macro', `m') + => + macro(`m')macro + =>mmacro + macro(`m')`'macro + =>mm + + Quoting may prevent recognizing as a macro name the concatenation of +a macro expansion with the surrounding characters. In this example: + + define(`macro', `di$1') + => + macro(`v')`ert' + =>divert + macro(`v')ert + => + +the input will produce the string `divert'. When the quotes were +removed, the `divert' builtin was called instead. + + +File: m4.info, Node: Macro Arguments, Next: Quoting Arguments, Prev: Inhibiting Invocation, Up: Macros + +4.3 Macro arguments +=================== + +When a name is seen, and it has a macro definition, it will be expanded +as a macro. + + If the name is followed by an opening parenthesis, the arguments +will be collected before the macro is called. If too few arguments are +supplied, the missing arguments are taken to be the empty string. +However, some builtins are documented to behave differently for a +missing optional argument than for an explicit empty string. If there +are too many arguments, the excess arguments are ignored. Unquoted +leading whitespace is stripped off all arguments, but whitespace +generated by a macro expansion or occurring after a macro that expanded +to an empty string remains intact. Whitespace includes space, tab, +newline, carriage return, vertical tab, and formfeed. + + define(`macro', `$1') + => + macro( unquoted leading space lost) + =>unquoted leading space lost + macro(` quoted leading space kept') + => quoted leading space kept + macro( + divert `unquoted space kept after expansion') + => unquoted space kept after expansion + macro(macro(` + ')`whitespace from expansion kept') + => + =>whitespace from expansion kept + macro(`unquoted trailing whitespace kept' + ) + =>unquoted trailing whitespace kept + => + + Normally `m4' will issue warnings if a builtin macro is called with +an inappropriate number of arguments, but it can be suppressed with the +`--quiet' command line option (or `--silent', or `-Q', *note Invoking +m4: Operation modes.). For user defined macros, there is no check of +the number of arguments given. + + $ m4 + index(`abc') + error-->m4:stdin:1: Warning: too few arguments to builtin `index' + =>0 + index(`abc',) + =>0 + index(`abc', `b', `ignored') + error-->m4:stdin:3: Warning: excess arguments to builtin `index' ignored + =>1 + + $ m4 -Q + index(`abc') + =>0 + index(`abc',) + =>0 + index(`abc', `b', `ignored') + =>1 + + Macros are expanded normally during argument collection, and whatever +commas, quotes and parentheses that might show up in the resulting +expanded text will serve to define the arguments as well. Thus, if FOO +expands to `, b, c', the macro call + + bar(a foo, d) + +is a macro call with four arguments, which are `a ', `b', `c' and `d'. +To understand why the first argument contains whitespace, remember that +unquoted leading whitespace is never part of an argument, but trailing +whitespace always is. + + It is possible for a macro's definition to change during argument +collection, in which case the expansion uses the definition that was in +effect at the time the opening `(' was seen. + + define(`f', `1') + => + f(define(`f', `2')) + =>1 + f + =>2 + + It is an error if the end of file occurs while collecting arguments. + + hello world + =>hello world + define( + ^D + error-->m4:stdin:2: ERROR: end of file in argument list + + +File: m4.info, Node: Quoting Arguments, Next: Macro expansion, Prev: Macro Arguments, Up: Macros + +4.4 On Quoting Arguments to macros +================================== + +Each argument has unquoted leading whitespace removed. Within each +argument, all unquoted parentheses must match. For example, if FOO is +a macro, + + foo(() (`(') `(') + +is a macro call, with one argument, whose value is `() (() ('. Commas +separate arguments, except when they occur inside quotes, comments, or +unquoted parentheses. *Note Pseudo Arguments::, for examples. + + It is common practice to quote all arguments to macros, unless you +are sure you want the arguments expanded. Thus, in the above example +with the parentheses, the `right' way to do it is like this: + + foo(`() (() (') + + It is, however, in certain cases necessary (because nested expansion +must occur to create the arguments for the outer macro) or convenient +(because it uses fewer characters) to leave out quotes for some +arguments, and there is nothing wrong in doing it. It just makes life a +bit harder, if you are not careful to follow a consistent quoting style. +For consistency, this manual follows the rule of thumb that each layer +of parentheses introduces another layer of single quoting, except when +showing the consequences of quoting rules. This is done even when the +quoted string cannot be a macro, such as with integers when you have not +changed the syntax via `changeword' (*note Changeword::). + + The quoting rule of thumb of one level of quoting per parentheses +has a nice property: when a macro name appears inside parentheses, you +can determine when it will be expanded. If it is not quoted, it will be +expanded prior to the outer macro, so that its expansion becomes the +argument. If it is single-quoted, it will be expanded after the outer +macro. And if it is double-quoted, it will be used as literal text +instead of a macro name. + + define(`active', `ACT, IVE') + => + define(`show', `$1 $1') + => + show(active) + =>ACT ACT + show(`active') + =>ACT, IVE ACT, IVE + show(``active'') + =>active active + + +File: m4.info, Node: Macro expansion, Prev: Quoting Arguments, Up: Macros + +4.5 Macro expansion +=================== + +When the arguments, if any, to a macro call have been collected, the +macro is expanded, and the expansion text is pushed back onto the input +(unquoted), and reread. The expansion text from one macro call might +therefore result in more macros being called, if the calls are included, +completely or partially, in the first macro calls' expansion. + + Taking a very simple example, if FOO expands to `bar', and BAR +expands to `Hello', the input + + $ m4 -Dbar=Hello -Dfoo=bar + foo + =>Hello + +will expand first to `bar', and when this is reread and expanded, into +`Hello'. + + +File: m4.info, Node: Definitions, Next: Conditionals, Prev: Macros, Up: Top + +5 How to define new macros +************************** + +Macros can be defined, redefined and deleted in several different ways. +Also, it is possible to redefine a macro without losing a previous +value, and bring back the original value at a later time. + +* Menu: + +* Define:: Defining a new macro +* Arguments:: Arguments to macros +* Pseudo Arguments:: Special arguments to macros +* Undefine:: Deleting a macro +* Defn:: Renaming macros +* Pushdef:: Temporarily redefining macros + +* Indir:: Indirect call of macros +* Builtin:: Indirect call of builtins + + +File: m4.info, Node: Define, Next: Arguments, Up: Definitions + +5.1 Defining a macro +==================== + +The normal way to define or redefine macros is to use the builtin +`define': + + -- Builtin: define (NAME, [EXPANSION]) + Defines NAME to expand to EXPANSION. If EXPANSION is not given, + it is taken to be empty. + + The expansion of `define' is void. The macro `define' is + recognized only with parameters. + + The following example defines the macro FOO to expand to the text +`Hello World.'. + + define(`foo', `Hello world.') + => + foo + =>Hello world. + + The empty line in the output is there because the newline is not a +part of the macro definition, and it is consequently copied to the +output. This can be avoided by use of the macro `dnl'. *Note Dnl::, +for details. + + The first argument to `define' should be quoted; otherwise, if the +macro is already defined, you will be defining a different macro. This +example shows the problems with underquoting, since we did not want to +redefine `one': + + define(foo, one) + => + define(foo, two) + => + one + =>two + + GNU `m4' normally replaces only the _topmost_ definition of a macro +if it has several definitions from `pushdef' (*note Pushdef::). Some +other implementations of `m4' replace all definitions of a macro with +`define'. *Note Incompatibilities::, for more details. + + As a GNU extension, the first argument to `define' does not have to +be a simple word. It can be any text string, even the empty string. A +macro with a non-standard name cannot be invoked in the normal way, as +the name is not recognized. It can only be referenced by the builtins +`indir' (*note Indir::) and `defn' (*note Defn::). + + Arrays and associative arrays can be simulated by using non-standard +macro names. + + -- Composite: array (INDEX) + -- Composite: array_set (INDEX, [VALUE]) + Provide access to entries within an array. `array' reads the entry + at location INDEX, and `array_set' assigns VALUE to location INDEX. + + define(`array', `defn(format(``array[%d]'', `$1'))') + => + define(`array_set', `define(format(``array[%d]'', `$1'), `$2')') + => + array_set(`4', `array element no. 4') + => + array_set(`17', `array element no. 17') + => + array(`4') + =>array element no. 4 + array(eval(`10 + 7')) + =>array element no. 17 + + Change the `%d' to `%s' and it is an associative array. + + +File: m4.info, Node: Arguments, Next: Pseudo Arguments, Prev: Define, Up: Definitions + +5.2 Arguments to macros +======================= + +Macros can have arguments. The Nth argument is denoted by `$n' in the +expansion text, and is replaced by the Nth actual argument, when the +macro is expanded. Replacement of arguments happens before rescanning, +regardless of how many nesting levels of quoting appear in the +expansion. Here is an example of a macro with two arguments. + + -- Composite: exch (ARG1, ARG2) + Expands to ARG2 followed by ARG1, effectively exchanging their + order. + + define(`exch', `$2, $1') + => + exch(`arg1', `arg2') + =>arg2, arg1 + + This can be used, for example, if you like the arguments to `define' +to be reversed. + + define(`exch', `$2, $1') + => + define(exch(``expansion text'', ``macro'')) + => + macro + =>expansion text + + *Note Quoting Arguments::, for an explanation of the double quotes. +(You should try and improve this example so that clients of `exch' do +not have to double quote; or *note Answers: Improved exch.). + + As a special case, the zeroth argument, `$0', is always the name of +the macro being expanded. + + define(`test', ``Macro name: $0'') + => + test + =>Macro name: test + + If you want quoted text to appear as part of the expansion text, +remember that quotes can be nested in quoted strings. Thus, in + + define(`foo', `This is macro `foo'.') + => + foo + =>This is macro foo. + +The `foo' in the expansion text is _not_ expanded, since it is a quoted +string, and not a name. + + GNU `m4' allows the number following the `$' to consist of one or +more digits, allowing macros to have any number of arguments. The +extension of accepting multiple digits is incompatible with POSIX, and +is different than traditional implementations of `m4', which only +recognize one digit. Therefore, future versions of GNU M4 will phase +out this feature. To portably access beyond the ninth argument, you +can use the `argn' macro documented later (*note Shift::). + + POSIX also states that `$' followed immediately by `{' in a macro +definition is implementation-defined. This version of M4 passes the +literal characters `${' through unchanged, but M4 2.0 will implement an +optional feature similar to `sh', where `${11}' expands to the eleventh +argument, to replace the current recognition of `$11'. Meanwhile, if +you want to guarantee that you will get a literal `${' in output when +expanding a macro, even when you upgrade to M4 2.0, you can use nested +quoting to your advantage: + + define(`foo', `single quoted $`'{1} output') + => + define(`bar', ``double quoted $'`{2} output'') + => + foo(`a', `b') + =>single quoted ${1} output + bar(`a', `b') + =>double quoted ${2} output + + To help you detect places in your M4 input files that might change in +behavior due to the changed behavior of M4 2.0, you can use the +`--warn-macro-sequence' command-line option (*note Invoking m4: +Operation modes.) with the default regular expression. This will add a +warning any time a macro definition includes `$' followed by multiple +digits, or by `{'. The warning is not enabled by default, because it +triggers a number of warnings in Autoconf 2.61 (and Autoconf uses `-E' +to treat warnings as errors), and because it will still be possible to +restore older behavior in M4 2.0. + + $ m4 --warn-macro-sequence + define(`foo', `$001 ${1} $1') + error-->m4:stdin:1: Warning: definition of `foo' contains sequence `$001' + error-->m4:stdin:1: Warning: definition of `foo' contains sequence `${1}' + => + foo(`bar') + =>bar ${1} bar + + +File: m4.info, Node: Pseudo Arguments, Next: Undefine, Prev: Arguments, Up: Definitions + +5.3 Special arguments to macros +=============================== + +There is a special notation for the number of actual arguments supplied, +and for all the actual arguments. + + The number of actual arguments in a macro call is denoted by `$#' in +the expansion text. + + -- Composite: nargs (...) + Expands to a count of the number of arguments supplied. + + define(`nargs', `$#') + => + nargs + =>0 + nargs() + =>1 + nargs(`arg1', `arg2', `arg3') + =>3 + nargs(`commas can be quoted, like this') + =>1 + nargs(arg1#inside comments, commas do not separate arguments + still arg1) + =>1 + nargs((unquoted parentheses, like this, group arguments)) + =>1 + + Remember that `#' defaults to the comment character; if you forget +quotes to inhibit the comment behavior, your macro definition may not +end where you expected. + + dnl Attempt to define a macro to just `$#' + define(underquoted, $#) + oops) + => + underquoted + =>0) + =>oops + + The notation `$*' can be used in the expansion text to denote all +the actual arguments, unquoted, with commas in between. For example + + define(`echo', `$*') + => + echo(arg1, arg2, arg3 , arg4) + =>arg1,arg2,arg3 ,arg4 + + Often each argument should be quoted, and the notation `$@' handles +that. It is just like `$*', except that it quotes each argument. A +simple example of that is: + + define(`echo', `$@') + => + echo(arg1, arg2, arg3 , arg4) + =>arg1,arg2,arg3 ,arg4 + + Where did the quotes go? Of course, they were eaten, when the +expanded text were reread by `m4'. To show the difference, try + + define(`echo1', `$*') + => + define(`echo2', `$@') + => + define(`foo', `This is macro `foo'.') + => + echo1(foo) + =>This is macro This is macro foo.. + echo1(`foo') + =>This is macro foo. + echo2(foo) + =>This is macro foo. + echo2(`foo') + =>foo + +*Note Trace::, if you do not understand this. As another example of the +difference, remember that comments encountered in arguments are passed +untouched to the macro, and that quoting disables comments. + + define(`echo1', `$*') + => + define(`echo2', `$@') + => + define(`foo', `bar') + => + echo1(#foo'foo + foo) + =>#foo'foo + =>bar + echo2(#foo'foo + foo) + =>#foobar + =>bar' + + A `$' sign in the expansion text, that is not followed by anything +`m4' understands, is simply copied to the macro expansion, as any other +text is. + + define(`foo', `$$$ hello $$$') + => + foo + =>$$$ hello $$$ + + If you want a macro to expand to something like `$12', the judicious +use of nested quoting can put a safe character between the `$' and the +next character, relying on the rescanning to remove the nested quote. +This will prevent `m4' from interpreting the `$' sign as a reference to +an argument. + + define(`foo', `no nested quote: $1') + => + foo(`arg') + =>no nested quote: arg + define(`foo', `nested quote around $: `$'1') + => + foo(`arg') + =>nested quote around $: $1 + define(`foo', `nested empty quote after $: $`'1') + => + foo(`arg') + =>nested empty quote after $: $1 + define(`foo', `nested quote around next character: $`1'') + => + foo(`arg') + =>nested quote around next character: $1 + define(`foo', `nested quote around both: `$1'') + => + foo(`arg') + =>nested quote around both: arg + + +File: m4.info, Node: Undefine, Next: Defn, Prev: Pseudo Arguments, Up: Definitions + +5.4 Deleting a macro +==================== + +A macro definition can be removed with `undefine': + + -- Builtin: undefine (NAME...) + For each argument, remove the macro NAME. The macro names must + necessarily be quoted, since they will be expanded otherwise. + + The expansion of `undefine' is void. The macro `undefine' is + recognized only with parameters. + + foo bar blah + =>foo bar blah + define(`foo', `some')define(`bar', `other')define(`blah', `text') + => + foo bar blah + =>some other text + undefine(`foo') + => + foo bar blah + =>foo other text + undefine(`bar', `blah') + => + foo bar blah + =>foo bar blah + + Undefining a macro inside that macro's expansion is safe; the macro +still expands to the definition that was in effect at the `('. + + define(`f', ``$0':$1') + => + f(f(f(undefine(`f')`hello world'))) + =>f:f:f:hello world + f(`bye') + =>f(bye) + + It is not an error for NAME to have no macro definition. In that +case, `undefine' does nothing. + + +File: m4.info, Node: Defn, Next: Pushdef, Prev: Undefine, Up: Definitions + +5.5 Renaming macros +=================== + +It is possible to rename an already defined macro. To do this, you need +the builtin `defn': + + -- Builtin: defn (NAME...) + Expands to the _quoted definition_ of each NAME. If an argument + is not a defined macro, the expansion for that argument is empty. + + If NAME is a user-defined macro, the quoted definition is simply + the quoted expansion text. If, instead, there is only one NAME + and it is a builtin, the expansion is a special token, which + points to the builtin's internal definition. This token is only + meaningful as the second argument to `define' (and `pushdef'), and + is silently converted to an empty string in most other contexts. + Combining a builtin with anything else is not supported; a warning + is issued and the builtin is omitted from the final expansion. + + The macro `defn' is recognized only with parameters. + + Its normal use is best understood through an example, which shows +how to rename `undefine' to `zap': + + define(`zap', defn(`undefine')) + => + zap(`undefine') + => + undefine(`zap') + =>undefine(zap) + + In this way, `defn' can be used to copy macro definitions, and also +definitions of builtin macros. Even if the original macro is removed, +the other name can still be used to access the definition. + + The fact that macro definitions can be transferred also explains why +you should use `$0', rather than retyping a macro's name in its +definition: + + define(`foo', `This is `$0'') + => + define(`bar', defn(`foo')) + => + bar + =>This is bar + + Macros used as string variables should be referred through `defn', +to avoid unwanted expansion of the text: + + define(`string', `The macro dnl is very useful + ') + => + string + =>The macro + defn(`string') + =>The macro dnl is very useful + => + + However, it is important to remember that `m4' rescanning is purely +textual. If an unbalanced end-quote string occurs in a macro +definition, the rescan will see that embedded quote as the termination +of the quoted string, and the remainder of the macro's definition will +be rescanned unquoted. Thus it is a good idea to avoid unbalanced +end-quotes in macro definitions or arguments to macros. + + define(`foo', a'a) + => + define(`a', `A') + => + define(`echo', `$@') + => + foo + =>A'A + defn(`foo') + =>aA' + echo(foo) + =>AA' + + On the other hand, it is possible to exploit the fact that `defn' +can concatenate multiple macros prior to the rescanning phase, in order +to join the definitions of macros that, in isolation, have unbalanced +quotes. This is particularly useful when one has used several macros to +accumulate text that M4 should rescan as a whole. In the example below, +note how the use of `defn' on `l' in isolation opens a string, which is +not closed until the next line; but used on `l' and `r' together +results in nested quoting. + + define(`l', `<[>')define(`r', `<]>') + => + changequote(`[', `]') + => + defn([l])defn([r]) + ]) + =><[>]defn([r]) + =>) + defn([l], [r]) + =><[>][<]> + + Using `defn' to generate special tokens for builtin macros outside +of expected contexts can sometimes trigger warnings. But most of the +time, such tokens are silently converted to the empty string. + + $ m4 -d + defn(`defn') + => + define(defn(`divnum'), `cannot redefine a builtin token') + error-->m4:stdin:2: Warning: define: invalid macro name ignored + => + divnum + =>0 + len(defn(`divnum')) + =>0 + + Also note that `defn' with multiple arguments can only join text +macros, not builtins, although a future version of GNU M4 may lift this +restriction. + + $ m4 -d + define(`a', `A')define(`AA', `b') + => + traceon(`defn', `define') + => + defn(`a', `divnum', `a') + error-->m4:stdin:3: Warning: cannot concatenate builtin `divnum' + error-->m4trace: -1- defn(`a', `divnum', `a') -> ``A'`A'' + =>AA + define(`mydivnum', defn(`divnum', `divnum'))mydivnum + error-->m4:stdin:4: Warning: cannot concatenate builtin `divnum' + error-->m4:stdin:4: Warning: cannot concatenate builtin `divnum' + error-->m4trace: -2- defn(`divnum', `divnum') + error-->m4trace: -1- define(`mydivnum', `') + => + traceoff(`defn', `define') + => + + +File: m4.info, Node: Pushdef, Next: Indir, Prev: Defn, Up: Definitions + +5.6 Temporarily redefining macros +================================= + +It is possible to redefine a macro temporarily, reverting to the +previous definition at a later time. This is done with the builtins +`pushdef' and `popdef': + + -- Builtin: pushdef (NAME, [EXPANSION]) + -- Builtin: popdef (NAME...) + Analogous to `define' and `undefine'. + + These macros work in a stack-like fashion. A macro is temporarily + redefined with `pushdef', which replaces an existing definition of + NAME, while saving the previous definition, before the new one is + installed. If there is no previous definition, `pushdef' behaves + exactly like `define'. + + If a macro has several definitions (of which only one is + accessible), the topmost definition can be removed with `popdef'. + If there is no previous definition, `popdef' behaves like + `undefine'. + + The expansion of both `pushdef' and `popdef' is void. The macros + `pushdef' and `popdef' are recognized only with parameters. + + define(`foo', `Expansion one.') + => + foo + =>Expansion one. + pushdef(`foo', `Expansion two.') + => + foo + =>Expansion two. + pushdef(`foo', `Expansion three.') + => + pushdef(`foo', `Expansion four.') + => + popdef(`foo') + => + foo + =>Expansion three. + popdef(`foo', `foo') + => + foo + =>Expansion one. + popdef(`foo') + => + foo + =>foo + + If a macro with several definitions is redefined with `define', the +topmost definition is _replaced_ with the new definition. If it is +removed with `undefine', _all_ the definitions are removed, and not +only the topmost one. However, POSIX allows other implementations that +treat `define' as replacing an entire stack of definitions with a +single new definition, so to be portable to other implementations, it +may be worth explicitly using `popdef' and `pushdef' rather than +relying on the GNU behavior of `define'. + + define(`foo', `Expansion one.') + => + foo + =>Expansion one. + pushdef(`foo', `Expansion two.') + => + foo + =>Expansion two. + define(`foo', `Second expansion two.') + => + foo + =>Second expansion two. + undefine(`foo') + => + foo + =>foo + + Local variables within macros are made with `pushdef' and `popdef'. +At the start of the macro a new definition is pushed, within the macro +it is manipulated and at the end it is popped, revealing the former +definition. + + It is possible to temporarily redefine a builtin with `pushdef' and +`defn'. + + +File: m4.info, Node: Indir, Next: Builtin, Prev: Pushdef, Up: Definitions + +5.7 Indirect call of macros +=========================== + +Any macro can be called indirectly with `indir': + + -- Builtin: indir (NAME, [ARGS...]) + Results in a call to the macro NAME, which is passed the rest of + the arguments ARGS. If NAME is not defined, an error message is + printed, and the expansion is void. + + The macro `indir' is recognized only with parameters. + + This can be used to call macros with computed or "invalid" names +(`define' allows such names to be defined): + + define(`$$internal$macro', `Internal macro (name `$0')') + => + $$internal$macro + =>$$internal$macro + indir(`$$internal$macro') + =>Internal macro (name $$internal$macro) + + The point is, here, that larger macro packages can have private +macros defined, that will not be called by accident. They can _only_ be +called through the builtin `indir'. + + One other point to observe is that argument collection occurs before +`indir' invokes NAME, so if argument collection changes the value of +NAME, that will be reflected in the final expansion. This is different +than the behavior when invoking macros directly, where the definition +that was in effect before argument collection is used. + + $ m4 -d + define(`f', `1') + => + f(define(`f', `2')) + =>1 + indir(`f', define(`f', `3')) + =>3 + indir(`f', undefine(`f')) + error-->m4:stdin:4: undefined macro `f' + => + + When handed the result of `defn' (*note Defn::) as one of its +arguments, `indir' defers to the invoked NAME for whether a token +representing a builtin is recognized or flattened to the empty string. + + $ m4 -d + indir(defn(`defn'), `divnum') + error-->m4:stdin:1: Warning: indir: invalid macro name ignored + => + indir(`define', defn(`defn'), `divnum') + error-->m4:stdin:2: Warning: define: invalid macro name ignored + => + indir(`define', `foo', defn(`divnum')) + => + foo + =>0 + indir(`divert', defn(`foo')) + error-->m4:stdin:5: empty string treated as 0 in builtin `divert' + => + + +File: m4.info, Node: Builtin, Prev: Indir, Up: Definitions + +5.8 Indirect call of builtins +============================= + +Builtin macros can be called indirectly with `builtin': + + -- Builtin: builtin (NAME, [ARGS...]) + Results in a call to the builtin NAME, which is passed the rest of + the arguments ARGS. If NAME does not name a builtin, an error + message is printed, and the expansion is void. + + The macro `builtin' is recognized only with parameters. + + This can be used even if NAME has been given another definition that +has covered the original, or been undefined so that no macro maps to +the builtin. + + pushdef(`define', `hidden') + => + undefine(`undefine') + => + define(`foo', `bar') + =>hidden + foo + =>foo + builtin(`define', `foo', defn(`divnum')) + => + foo + =>0 + builtin(`define', `foo', `BAR') + => + foo + =>BAR + undefine(`foo') + =>undefine(foo) + foo + =>BAR + builtin(`undefine', `foo') + => + foo + =>foo + + The NAME argument only matches the original name of the builtin, +even when the `--prefix-builtins' option (or `-P', *note Invoking m4: +Operation modes.) is in effect. This is different from `indir', which +only tracks current macro names. + + $ m4 -P + m4_builtin(`divnum') + =>0 + m4_builtin(`m4_divnum') + error-->m4:stdin:2: undefined builtin `m4_divnum' + => + m4_indir(`divnum') + error-->m4:stdin:3: undefined macro `divnum' + => + m4_indir(`m4_divnum') + =>0 + + Note that `indir' and `builtin' can be used to invoke builtins +without arguments, even when they normally require parameters to be +recognized; but it will provoke a warning, and result in a void +expansion. + + builtin + =>builtin + builtin() + error-->m4:stdin:2: undefined builtin `' + => + builtin(`builtin') + error-->m4:stdin:3: Warning: too few arguments to builtin `builtin' + => + builtin(`builtin',) + error-->m4:stdin:4: undefined builtin `' + => + + +File: m4.info, Node: Conditionals, Next: Debugging, Prev: Definitions, Up: Top + +6 Conditionals, loops, and recursion +************************************ + +Macros, expanding to plain text, perhaps with arguments, are not quite +enough. We would like to have macros expand to different things, based +on decisions taken at run-time. For that, we need some kind of +conditionals. Also, we would like to have some kind of loop construct, +so we could do something a number of times, or while some condition is +true. + +* Menu: + +* Ifdef:: Testing if a macro is defined +* Ifelse:: If-else construct, or multibranch +* Shift:: Recursion in `m4' +* Forloop:: Iteration by counting +* Foreach:: Iteration by list contents + + +File: m4.info, Node: Ifdef, Next: Ifelse, Up: Conditionals + +6.1 Testing if a macro is defined +================================= + +There are two different builtin conditionals in `m4'. The first is +`ifdef': + + -- Builtin: ifdef (NAME, STRING-1, [STRING-2]) + If NAME is defined as a macro, `ifdef' expands to STRING-1, + otherwise to STRING-2. If STRING-2 is omitted, it is taken to be + the empty string (according to the normal rules). + + The macro `ifdef' is recognized only with parameters. + + ifdef(`foo', ``foo' is defined', ``foo' is not defined') + =>foo is not defined + define(`foo', `') + => + ifdef(`foo', ``foo' is defined', ``foo' is not defined') + =>foo is defined + ifdef(`no_such_macro', `yes', `no', `extra argument') + error-->m4:stdin:4: Warning: excess arguments to builtin `ifdef' ignored + =>no + + +File: m4.info, Node: Ifelse, Next: Shift, Prev: Ifdef, Up: Conditionals + +6.2 If-else construct, or multibranch +===================================== + +The other conditional, `ifelse', is much more powerful. It can be used +as a way to introduce a long comment, as an if-else construct, or as a +multibranch, depending on the number of arguments supplied: + + -- Builtin: ifelse (COMMENT) + -- Builtin: ifelse (STRING-1, STRING-2, EQUAL, [NOT-EQUAL]) + -- Builtin: ifelse (STRING-1, STRING-2, EQUAL-1, STRING-3, STRING-4, + EQUAL-2, ..., [NOT-EQUAL]) + Used with only one argument, the `ifelse' simply discards it and + produces no output. + + If called with three or four arguments, `ifelse' expands into + EQUAL, if STRING-1 and STRING-2 are equal (character for + character), otherwise it expands to NOT-EQUAL. A final fifth + argument is ignored, after triggering a warning. + + If called with six or more arguments, and STRING-1 and STRING-2 + are equal, `ifelse' expands into EQUAL-1, otherwise the first + three arguments are discarded and the processing starts again. + + The macro `ifelse' is recognized only with parameters. + + Using only one argument is a common `m4' idiom for introducing a +block comment, as an alternative to repeatedly using `dnl'. This +special usage is recognized by GNU `m4', so that in this case, the +warning about missing arguments is never triggered. + + ifelse(`some comments') + => + ifelse(`foo', `bar') + error-->m4:stdin:2: Warning: too few arguments to builtin `ifelse' + => + + Using three or four arguments provides decision points. + + ifelse(`foo', `bar', `true') + => + ifelse(`foo', `foo', `true') + =>true + define(`foo', `bar') + => + ifelse(foo, `bar', `true', `false') + =>true + ifelse(foo, `foo', `true', `false') + =>false + + Notice how the first argument was used unquoted; it is common to +compare the expansion of a macro with a string. With this macro, you +can now reproduce the behavior of blind builtins, where the macro is +recognized only with arguments. + + define(`foo', `ifelse(`$#', `0', ``$0'', `arguments:$#')') + => + foo + =>foo + foo() + =>arguments:1 + foo(`a', `b', `c') + =>arguments:3 + + However, `ifelse' can take more than four arguments. If given more +than four arguments, `ifelse' works like a `case' or `switch' statement +in traditional programming languages. If STRING-1 and STRING-2 are +equal, `ifelse' expands into EQUAL-1, otherwise the procedure is +repeated with the first three arguments discarded. This calls for an +example: + + ifelse(`foo', `bar', `third', `gnu', `gnats') + error-->m4:stdin:1: Warning: excess arguments to builtin `ifelse' ignored + =>gnu + ifelse(`foo', `bar', `third', `gnu', `gnats', `sixth') + => + ifelse(`foo', `bar', `third', `gnu', `gnats', `sixth', `seventh') + =>seventh + ifelse(`foo', `bar', `3', `gnu', `gnats', `6', `7', `8') + error-->m4:stdin:4: Warning: excess arguments to builtin `ifelse' ignored + =>7 + + Naturally, the normal case will be slightly more advanced than these +examples. A common use of `ifelse' is in macros implementing loops of +various kinds. + + +File: m4.info, Node: Shift, Next: Forloop, Prev: Ifelse, Up: Conditionals + +6.3 Recursion in `m4' +===================== + +There is no direct support for loops in `m4', but macros can be +recursive. There is no limit on the number of recursion levels, other +than those enforced by your hardware and operating system. + + Loops can be programmed using recursion and the conditionals +described previously. + + There is a builtin macro, `shift', which can, among other things, be +used for iterating through the actual arguments to a macro: + + -- Builtin: shift (ARG1, ...) + Takes any number of arguments, and expands to all its arguments + except ARG1, separated by commas, with each argument quoted. + + The macro `shift' is recognized only with parameters. + + shift + =>shift + shift(`bar') + => + shift(`foo', `bar', `baz') + =>bar,baz + + An example of the use of `shift' is this macro: + + -- Composite: reverse (...) + Takes any number of arguments, and reverses their order. + + It is implemented as: + + define(`reverse', `ifelse(`$#', `0', , `$#', `1', ``$1'', + `reverse(shift($@)), `$1'')') + => + reverse + => + reverse(`foo') + =>foo + reverse(`foo', `bar', `gnats', `and gnus') + =>and gnus, gnats, bar, foo + + While not a very interesting macro, it does show how simple loops +can be made with `shift', `ifelse' and recursion. It also shows that +`shift' is usually used with `$@'. Another example of this is an +implementation of a short-circuiting conditional operator. + + -- Composite: cond (TEST-1, STRING-1, EQUAL-1, [TEST-2], [STRING-2], + [EQUAL-2], ..., [NOT-EQUAL]) + Similar to `ifelse', where an equal comparison between the first + two strings results in the third, otherwise the first three + arguments are discarded and the process repeats. The difference + is that each TEST-<N> is expanded only when it is encountered. + This means that every third argument to `cond' is normally given + one more level of quoting than the corresponding argument to + `ifelse'. + + Here is the implementation of `cond', along with a demonstration of +how it can short-circuit the side effects in `side'. Notice how all +the unquoted side effects happen regardless of how many comparisons are +made with `ifelse', compared with only the relevant effects with `cond'. + + define(`cond', + `ifelse(`$#', `1', `$1', + `ifelse($1, `$2', `$3', + `$0(shift(shift(shift($@))))')')')dnl + define(`side', `define(`counter', incr(counter))$1')dnl + define(`example1', + `define(`counter', `0')dnl + ifelse(side(`$1'), `yes', `one comparison: ', + side(`$1'), `no', `two comparisons: ', + side(`$1'), `maybe', `three comparisons: ', + `side(`default answer: ')')counter')dnl + define(`example2', + `define(`counter', `0')dnl + cond(`side(`$1')', `yes', `one comparison: ', + `side(`$1')', `no', `two comparisons: ', + `side(`$1')', `maybe', `three comparisons: ', + `side(`default answer: ')')counter')dnl + example1(`yes') + =>one comparison: 3 + example1(`no') + =>two comparisons: 3 + example1(`maybe') + =>three comparisons: 3 + example1(`feeling rather indecisive today') + =>default answer: 4 + example2(`yes') + =>one comparison: 1 + example2(`no') + =>two comparisons: 2 + example2(`maybe') + =>three comparisons: 3 + example2(`feeling rather indecisive today') + =>default answer: 4 + + Another common task that requires iteration is joining a list of +arguments into a single string. + + -- Composite: join ([SEPARATOR], [ARGS...]) + -- Composite: joinall ([SEPARATOR], [ARGS...]) + Generate a single-quoted string, consisting of each ARG separated + by SEPARATOR. While `joinall' always outputs a SEPARATOR between + arguments, `join' avoids the SEPARATOR for an empty ARG. + + Here are some examples of its usage, based on the implementation +`m4-1.4.11/examples/join.m4' distributed in this package: + + $ m4 -I examples + include(`join.m4') + => + join,join(`-'),join(`-', `'),join(`-', `', `') + =>,,, + joinall,joinall(`-'),joinall(`-', `'),joinall(`-', `', `') + =>,,,- + join(`-', `1') + =>1 + join(`-', `1', `2', `3') + =>1-2-3 + join(`', `1', `2', `3') + =>123 + join(`-', `', `1', `', `', `2', `') + =>1-2 + joinall(`-', `', `1', `', `', `2', `') + =>-1---2- + join(`,', `1', `2', `3') + =>1,2,3 + define(`nargs', `$#')dnl + nargs(join(`,', `1', `2', `3')) + =>1 + + Examining the implementation shows some interesting points about +several m4 programming idioms. + + $ m4 -I examples + undivert(`join.m4')dnl + =>divert(`-1') + =># join(sep, args) - join each non-empty ARG into a single + =># string, with each element separated by SEP + =>define(`join', + =>`ifelse(`$#', `2', ``$2'', + => `ifelse(`$2', `', `', ``$2'_')$0(`$1', shift(shift($@)))')') + =>define(`_join', + =>`ifelse(`$#$2', `2', `', + => `ifelse(`$2', `', `', ``$1$2'')$0(`$1', shift(shift($@)))')') + =># joinall(sep, args) - join each ARG, including empty ones, + =># into a single string, with each element separated by SEP + =>define(`joinall', ``$2'_$0(`$1', shift($@))') + =>define(`_joinall', + =>`ifelse(`$#', `2', `', ``$1$3'$0(`$1', shift(shift($@)))')') + =>divert`'dnl + + First, notice that this implementation creates helper macros `_join' +and `_joinall'. This division of labor makes it easier to output the +correct number of SEPARATOR instances: `join' and `joinall' are +responsible for the first argument, without a separator, while `_join' +and `_joinall' are responsible for all remaining arguments, always +outputting a separator when outputting an argument. + + Next, observe how `join' decides to iterate to itself, because the +first ARG was empty, or to output the argument and swap over to +`_join'. If the argument is non-empty, then the nested `ifelse' +results in an unquoted `_', which is concatenated with the `$0' to form +the next macro name to invoke. The `joinall' implementation is simpler +since it does not have to suppress empty ARG; it always executes once +then defers to `_joinall'. + + Another important idiom is the idea that SEPARATOR is reused for +each iteration. Each iteration has one less argument, but rather than +discarding `$1' by iterating with `$0(shift($@))', the macro discards +`$2' by using `$0(`$1', shift(shift($@)))'. + + Next, notice that it is possible to compare more than one condition +in a single `ifelse' test. The test of `$#$2' against `2' allows +`_join' to iterate for two separate reasons--either there are still +more than two arguments, or there are exactly two arguments but the +last argument is not empty. + + Finally, notice that these macros require exactly two arguments to +terminate recursion, but that they still correctly result in empty +output when given no ARGS (i.e., zero or one macro argument). On the +first pass when there are too few arguments, the `shift' results in no +output, but leaves an empty string to serve as the required second +argument for the second pass. Put another way, ``$1', shift($@)' is +not the same as `$@', since only the former guarantees at least two +arguments. + + Sometimes, a recursive algorithm requires adding quotes to each +element, or treating multiple arguments as a single element: + + -- Composite: quote (...) + -- Composite: dquote (...) + -- Composite: dquote_elt (...) + Takes any number of arguments, and adds quoting. With `quote', + only one level of quoting is added, effectively removing whitespace + after commas and turning multiple arguments into a single string. + With `dquote', two levels of quoting are added, one around each + element, and one around the list. And with `dquote_elt', two + levels of quoting are added around each element. + + An actual implementation of these three macros is distributed as +`m4-1.4.11/examples/quote.m4' in this package. First, let's examine +their usage: + + $ m4 -I examples + include(`quote.m4') + => + -quote-dquote-dquote_elt- + =>---- + -quote()-dquote()-dquote_elt()- + =>--`'-`'- + -quote(`1')-dquote(`1')-dquote_elt(`1')- + =>-1-`1'-`1'- + -quote(`1', `2')-dquote(`1', `2')-dquote_elt(`1', `2')- + =>-1,2-`1',`2'-`1',`2'- + define(`n', `$#')dnl + -n(quote(`1', `2'))-n(dquote(`1', `2'))-n(dquote_elt(`1', `2'))- + =>-1-1-2- + dquote(dquote_elt(`1', `2')) + =>``1'',``2'' + dquote_elt(dquote(`1', `2')) + =>``1',`2'' + + The last two lines show that when given two arguments, `dquote' +results in one string, while `dquote_elt' results in two. Now, examine +the implementation. Note that `quote' and `dquote_elt' make decisions +based on their number of arguments, so that when called without +arguments, they result in nothing instead of a quoted empty string; +this is so that it is possible to distinguish between no arguments and +an empty first argument. `dquote', on the other hand, results in a +string no matter what, since it is still possible to tell whether it +was invoked without arguments based on the resulting string. + + $ m4 -I examples + undivert(`quote.m4')dnl + =>divert(`-1') + =># quote(args) - convert args to single-quoted string + =>define(`quote', `ifelse(`$#', `0', `', ``$*'')') + =># dquote(args) - convert args to quoted list of quoted strings + =>define(`dquote', ``$@'') + =># dquote_elt(args) - convert args to list of double-quoted strings + =>define(`dquote_elt', `ifelse(`$#', `0', `', `$#', `1', ```$1''', + => ```$1'',$0(shift($@))')') + =>divert`'dnl + + It is worth pointing out that `quote(ARGS)' is more efficient than +`joinall(`,', ARGS)' for producing the same output. + + One more useful macro based on `shift' allows portably selecting an +arbitrary argument (usually greater than the ninth argument), without +relying on the GNU extension of multi-digit arguments (*note +Arguments::). + + -- Composite: argn (N, ...) + Expands to argument N out of the remaining arguments. N must be a + positive number. Usually invoked as `argn(`N',$@)'. + + It is implemented as: + + define(`argn', `ifelse(`$1', 1, ``$2'', + `argn(decr(`$1'), shift(shift($@)))')') + => + argn(`1', `a') + =>a + define(`foo', `argn(`11', $@)') + => + foo(`a', `b', `c', `d', `e', `f', `g', `h', `i', `j', `k', `l') + =>k + + +File: m4.info, Node: Forloop, Next: Foreach, Prev: Shift, Up: Conditionals + +6.4 Iteration by counting +========================= + +Here is an example of a loop macro that implements a simple for loop. + + -- Composite: forloop (ITERATOR, START, END, TEXT) + Takes the name in ITERATOR, which must be a valid macro name, and + successively assign it each integer value from START to END, + inclusive. For each assignment to ITERATOR, append TEXT to the + expansion of the `forloop'. TEXT may refer to ITERATOR. Any + definition of ITERATOR prior to this invocation is restored. + + It can, for example, be used for simple counting: + + $ m4 -I examples + include(`forloop.m4') + => + forloop(`i', `1', `8', `i ') + =>1 2 3 4 5 6 7 8 + + For-loops can be nested, like: + + $ m4 -I examples + include(`forloop.m4') + => + forloop(`i', `1', `4', `forloop(`j', `1', `8', ` (i, j)') + ') + => (1, 1) (1, 2) (1, 3) (1, 4) (1, 5) (1, 6) (1, 7) (1, 8) + => (2, 1) (2, 2) (2, 3) (2, 4) (2, 5) (2, 6) (2, 7) (2, 8) + => (3, 1) (3, 2) (3, 3) (3, 4) (3, 5) (3, 6) (3, 7) (3, 8) + => (4, 1) (4, 2) (4, 3) (4, 4) (4, 5) (4, 6) (4, 7) (4, 8) + => + + The implementation of the `forloop' macro is fairly straightforward. +The `forloop' macro itself is simply a wrapper, which saves the +previous definition of the first argument, calls the internal macro +`_forloop', and re-establishes the saved definition of the first +argument. + + The macro `_forloop' expands the fourth argument once, and tests to +see if the iterator has reached the final value. If it has not +finished, it increments the iterator (using the predefined macro +`incr', *note Incr::), and recurses. + + Here is an actual implementation of `forloop', distributed as +`m4-1.4.11/examples/forloop.m4' in this package: + + $ m4 -I examples + undivert(`forloop.m4')dnl + =>divert(`-1') + =># forloop(var, from, to, stmt) - simple version + =>define(`forloop', `pushdef(`$1', `$2')_forloop($@)popdef(`$1')') + =>define(`_forloop', + => `$4`'ifelse($1, `$3', `', `define(`$1', incr($1))$0($@)')') + =>divert`'dnl + + Notice the careful use of quotes. Certain macro arguments are left +unquoted, each for its own reason. Try to find out _why_ these +arguments are left unquoted, and see what happens if they are quoted. +(As presented, these two macros are useful but not very robust for +general use. They lack even basic error handling for cases like START +less than END, END not numeric, or ITERATOR not being a macro name. +See if you can improve these macros; or *note Answers: Improved +forloop.). + + +File: m4.info, Node: Foreach, Prev: Forloop, Up: Conditionals + +6.5 Iteration by list contents +============================== + +Here is an example of a loop macro that implements list iteration. + + -- Composite: foreach (ITERATOR, PAREN-LIST, TEXT) + -- Composite: foreachq (ITERATOR, QUOTE-LIST, TEXT) + Takes the name in ITERATOR, which must be a valid macro name, and + successively assign it each value from PAREN-LIST or QUOTE-LIST. + In `foreach', PAREN-LIST is a comma-separated list of elements + contained in parentheses. In `foreachq', QUOTE-LIST is a + comma-separated list of elements contained in a quoted string. + For each assignment to ITERATOR, append TEXT to the overall + expansion. TEXT may refer to ITERATOR. Any definition of + ITERATOR prior to this invocation is restored. + + As an example, this displays each word in a list inside of a +sentence, using an implementation of `foreach' distributed as +`m4-1.4.11/examples/foreach.m4', and `foreachq' in +`m4-1.4.11/examples/foreachq.m4'. + + $ m4 -I examples + include(`foreach.m4') + => + foreach(`x', (foo, bar, foobar), `Word was: x + ')dnl + =>Word was: foo + =>Word was: bar + =>Word was: foobar + include(`foreachq.m4') + => + foreachq(`x', `foo, bar, foobar', `Word was: x + ')dnl + =>Word was: foo + =>Word was: bar + =>Word was: foobar + + It is possible to be more complex; each element of the PAREN-LIST or +QUOTE-LIST can itself be a list, to pass as further arguments to a +helper macro. This example generates a shell case statement: + + $ m4 -I examples + include(`foreach.m4') + => + define(`_case', ` $1) + $2=" $1";; + ')dnl + define(`_cat', `$1$2')dnl + case $`'1 in + =>case $1 in + foreach(`x', `(`(`a', `vara')', `(`b', `varb')', `(`c', `varc')')', + `_cat(`_case', x)')dnl + => a) + => vara=" a";; + => b) + => varb=" b";; + => c) + => varc=" c";; + esac + =>esac + + The implementation of the `foreach' macro is a bit more involved; it +is a wrapper around two helper macros. First, `_arg1' is needed to +grab the first element of a list. Second, `_foreach' implements the +recursion, successively walking through the original list. Here is a +simple implementation of `foreach': + + $ m4 -I examples + undivert(`foreach.m4')dnl + =>divert(`-1') + =># foreach(x, (item_1, item_2, ..., item_n), stmt) + =># parenthesized list, simple version + =>define(`foreach', `pushdef(`$1')_foreach($@)popdef(`$1')') + =>define(`_arg1', `$1') + =>define(`_foreach', `ifelse(`$2', `()', `', + => `define(`$1', _arg1$2)$3`'$0(`$1', (shift$2), `$3')')') + =>divert`'dnl + + Unfortunately, that implementation is not robust to macro names as +list elements. Each iteration of `_foreach' is stripping another layer +of quotes, leading to erratic results if list elements are not already +fully expanded. The first cut at implementing `foreachq' takes this +into account. Also, when using quoted elements in a PAREN-LIST, the +overall list must be quoted. A QUOTE-LIST has the nice property of +requiring fewer characters to create a list containing the same quoted +elements. To see the difference between the two macros, we attempt to +pass double-quoted macro names in a list, expecting the macro name on +output after one layer of quotes is removed during list iteration and +the final layer removed during the final rescan: + + $ m4 -I examples + define(`a', `1')define(`b', `2')define(`c', `3') + => + include(`foreach.m4') + => + include(`foreachq.m4') + => + foreach(`x', `(``a'', ``(b'', ``c)'')', `x + ') + =>1 + =>(2)1 + => + =>, x + =>) + foreachq(`x', ```a'', ``(b'', ``c)''', `x + ')dnl + =>a + =>(b + =>c) + + Obviously, `foreachq' did a better job; here is its implementation: + + $ m4 -I examples + undivert(`foreachq.m4')dnl + =>include(`quote.m4')dnl + =>divert(`-1') + =># foreachq(x, `item_1, item_2, ..., item_n', stmt) + =># quoted list, simple version + =>define(`foreachq', `pushdef(`$1')_foreachq($@)popdef(`$1')') + =>define(`_arg1', `$1') + =>define(`_foreachq', `ifelse(quote($2), `', `', + => `define(`$1', `_arg1($2)')$3`'$0(`$1', `shift($2)', `$3')')') + =>divert`'dnl + + Notice that `_foreachq' had to use the helper macro `quote' defined +earlier (*note Shift::), to ensure that the embedded `ifelse' call does +not go haywire if a list element contains a comma. Unfortunately, this +implementation of `foreachq' has its own severe flaw. Whereas the +`foreach' implementation was linear, this macro is quadratic in the +number of list elements, and is much more likely to trip up the limit +set by the command line option `--nesting-limit' (or `-L', *note +Invoking m4: Limits control.). Additionally, this implementation does +not expand `defn(`ITERATOR')' very well, when compared with `foreach'. + + $ m4 -I examples + include(`foreach.m4')include(`foreachq.m4') + => + foreach(`name', `(`a', `b')', ` defn(`name')') + => a b + foreachq(`name', ``a', `b'', ` defn(`name')') + => _arg1(`a', `b') _arg1(shift(`a', `b')) + + It is possible to have robust iteration with linear behavior and sane +ITERATOR contents for either list style. See if you can learn from the +best elements of both of these implementations to create robust macros +(or *note Answers: Improved foreach.). + + +File: m4.info, Node: Debugging, Next: Input Control, Prev: Conditionals, Up: Top + +7 How to debug macros and input +******************************* + +When writing macros for `m4', they often do not work as intended on the +first try (as is the case with most programming languages). +Fortunately, there is support for macro debugging in `m4'. + +* Menu: + +* Dumpdef:: Displaying macro definitions +* Trace:: Tracing macro calls +* Debug Levels:: Controlling debugging output +* Debug Output:: Saving debugging output + + +File: m4.info, Node: Dumpdef, Next: Trace, Up: Debugging + +7.1 Displaying macro definitions +================================ + +If you want to see what a name expands into, you can use the builtin +`dumpdef': + + -- Builtin: dumpdef ([NAMES...]) + Accepts any number of arguments. If called without any arguments, + it displays the definitions of all known names, otherwise it + displays the definitions of the NAMES given. The output is + printed to the current debug file (usually standard error), and is + sorted by name. If an unknown name is encountered, a warning is + printed. + + The expansion of `dumpdef' is void. + + $ m4 -d + define(`foo', `Hello world.') + => + dumpdef(`foo') + error-->foo: `Hello world.' + => + dumpdef(`define') + error-->define: <define> + => + + The last example shows how builtin macros definitions are displayed. +The definition that is dumped corresponds to what would occur if the +macro were to be called at that point, even if other definitions are +still live due to redefining a macro during argument collection. + + $ m4 -d + pushdef(`f', ``$0'1')pushdef(`f', ``$0'2') + => + f(popdef(`f')dumpdef(`f')) + error-->f: ``$0'1' + =>f2 + f(popdef(`f')dumpdef(`f')) + error-->m4:stdin:3: undefined macro `f' + =>f1 + + *Note Debug Levels::, for information on controlling the details of +the display. + + +File: m4.info, Node: Trace, Next: Debug Levels, Prev: Dumpdef, Up: Debugging + +7.2 Tracing macro calls +======================= + +It is possible to trace macro calls and expansions through the builtins +`traceon' and `traceoff': + + -- Builtin: traceon ([NAMES...]) + -- Builtin: traceoff ([NAMES...]) + When called without any arguments, `traceon' and `traceoff' will + turn tracing on and off, respectively, for all currently defined + macros. + + When called with arguments, only the macros listed in NAMES are + affected, whether or not they are currently defined. + + The expansion of `traceon' and `traceoff' is void. + + Whenever a traced macro is called and the arguments have been +collected, the call is displayed. If the expansion of the macro call +is not void, the expansion can be displayed after the call. The output +is printed to the current debug file (defaulting to standard error, +*note Debug Output::). + + $ m4 -d + define(`foo', `Hello World.') + => + define(`echo', `$@') + => + traceon(`foo', `echo') + => + foo + error-->m4trace: -1- foo -> `Hello World.' + =>Hello World. + echo(`gnus', `and gnats') + error-->m4trace: -1- echo(`gnus', `and gnats') -> ``gnus',`and gnats'' + =>gnus,and gnats + + The number between dashes is the depth of the expansion. It is one +most of the time, signifying an expansion at the outermost level, but it +increases when macro arguments contain unquoted macro calls. The +maximum number that will appear between dashes is controlled by the +option `--nesting-limit' (or `-L', *note Invoking m4: Limits control.). +Additionally, the option `--trace' (or `-t') can be used to invoke +`traceon(NAME)' before parsing input. + + $ m4 -L 3 -t ifelse + ifelse(`one level') + error-->m4trace: -1- ifelse + => + ifelse(ifelse(ifelse(`three levels'))) + error-->m4trace: -3- ifelse + error-->m4trace: -2- ifelse + error-->m4trace: -1- ifelse + => + ifelse(ifelse(ifelse(ifelse(`four levels')))) + error-->m4:stdin:3: recursion limit of 3 exceeded, use -L<N> to change it + + Tracing by name is an attribute that is preserved whether the macro +is defined or not. This allows the selection of macros to trace before +those macros are defined. + + $ m4 -d + traceoff(`foo') + => + traceon(`foo') + => + foo + =>foo + define(`foo', `bar') + => + foo + error-->m4trace: -1- foo -> `bar' + =>bar + undefine(`foo') + => + ifdef(`foo', `yes', `no') + =>no + indir(`foo') + error-->m4:stdin:8: undefined macro `foo' + => + define(`foo', `blah') + => + foo + error-->m4trace: -1- foo -> `blah' + =>blah + traceoff + => + foo + =>blah + + Tracing even works on builtins. However, `defn' (*note Defn::) does +not transfer tracing status. + + $ m4 -d + traceon(`eval', `m4_divnum') + => + define(`m4_eval', defn(`eval')) + => + define(`m4_divnum', defn(`divnum')) + => + eval(divnum) + error-->m4trace: -1- eval(`0') -> `0' + =>0 + m4_eval(m4_divnum) + error-->m4trace: -2- m4_divnum -> `0' + =>0 + + *Note Debug Levels::, for information on controlling the details of +the display. + + +File: m4.info, Node: Debug Levels, Next: Debug Output, Prev: Trace, Up: Debugging + +7.3 Controlling debugging output +================================ + +The `-d' option to `m4' (or `--debug', *note Invoking m4: Debugging +options.) controls the amount of details presented in three categories +of output. Trace output is requested by `traceon' (*note Trace::), and +each line is prefixed by `m4trace:' in relation to a macro invocation. +Debug output tracks useful events not associated with a macro +invocation, and each line is prefixed by `m4debug:'. Finally, +`dumpdef' (*note Dumpdef::) output is affected, with no prefix added to +the output lines. + + The FLAGS following the option can be one or more of the following: + +`a' + In trace output, show the actual arguments that were collected + before invoking the macro. This applies to all macro calls if the + `t' flag is used, otherwise only the macros covered by calls of + `traceon'. + +`c' + In trace output, show several trace lines for each macro call. A + line is shown when the macro is seen, but before the arguments are + collected; a second line when the arguments have been collected + and a third line after the call has completed. + +`e' + In trace output, show the expansion of each macro call, if it is + not void. This applies to all macro calls if the `t' flag is used, + otherwise only the macros covered by calls of `traceon'. + +`f' + In debug and trace output, include the name of the current input + file in the output line. + +`i' + In debug output, print a message each time the current input file + is changed. + +`l' + In debug and trace output, include the current input line number + in the output line. + +`p' + In debug output, print a message when a named file is found + through the path search mechanism (*note Search Path::), giving + the actual file name used. + +`q' + In trace and dumpdef output, quote actual arguments and macro + expansions in the display with the current quotes. This is useful + in connection with the `a' and `e' flags above. + +`t' + In trace output, trace all macro calls made in this invocation of + `m4', regardless of the settings of `traceon'. + +`x' + In trace output, add a unique `macro call id' to each line of the + trace output. This is useful in connection with the `c' flag + above. + +`V' + A shorthand for all of the above flags. + + If no flags are specified with the `-d' option, the default is +`aeq'. The examples throughout this manual assume the default flags. + + There is a builtin macro `debugmode', which allows on-the-fly +control of the debugging output format: + + -- Builtin: debugmode ([FLAGS]) + The argument FLAGS should be a subset of the letters listed above. + As special cases, if the argument starts with a `+', the flags are + added to the current debug flags, and if it starts with a `-', they + are removed. If no argument is present, all debugging flags are + cleared (as if no `-d' was given), and with an empty argument the + flags are reset to the default of `aeq'. + + The expansion of `debugmode' is void. + + $ m4 + define(`foo', `FOO') + => + traceon(`foo') + => + debugmode() + => + foo + error-->m4trace: -1- foo -> `FOO' + =>FOO + debugmode + => + foo + error-->m4trace: -1- foo + =>FOO + debugmode(`+l') + => + foo + error-->m4trace:8: -1- foo + =>FOO + + +File: m4.info, Node: Debug Output, Prev: Debug Levels, Up: Debugging + +7.4 Saving debugging output +=========================== + +Debug and tracing output can be redirected to files using either the +`--debugfile' option to `m4' (*note Invoking m4: Debugging options.), +or with the builtin macro `debugfile': + + -- Builtin: debugfile ([FILE]) + Sends all further debug and trace output to FILE, opened in append + mode. If FILE is the empty string, debug and trace output are + discarded. If `debugfile' is called without any arguments, debug + and trace output are sent to standard error. This does not affect + warnings, error messages, or `errprint' output, which are always + sent to standard error. If FILE cannot be opened, the current + debug file is unchanged, and an error is issued. + + The expansion of `debugfile' is void. + + $ m4 -d + traceon(`divnum') + => + divnum(`extra') + error-->m4:stdin:2: Warning: excess arguments to builtin `divnum' ignored + error-->m4trace: -1- divnum(`extra') -> `0' + =>0 + debugfile() + => + divnum(`extra') + error-->m4:stdin:4: Warning: excess arguments to builtin `divnum' ignored + =>0 + debugfile + => + divnum + error-->m4trace: -1- divnum -> `0' + =>0 + + +File: m4.info, Node: Input Control, Next: File Inclusion, Prev: Debugging, Up: Top + +8 Input control +*************** + +This chapter describes various builtin macros for controlling the input +to `m4'. + +* Menu: + +* Dnl:: Deleting whitespace in input +* Changequote:: Changing the quote characters +* Changecom:: Changing the comment delimiters +* Changeword:: Changing the lexical structure of words +* M4wrap:: Saving text until end of input + + +File: m4.info, Node: Dnl, Next: Changequote, Up: Input Control + +8.1 Deleting whitespace in input +================================ + +The builtin `dnl' stands for "Discard to Next Line": + + -- Builtin: dnl + All characters, up to and including the next newline, are discarded + without performing any macro expansion. A warning is issued if + the end of the file is encountered without a newline. + + The expansion of `dnl' is void. + + It is often used in connection with `define', to remove the newline +that follows the call to `define'. Thus + + define(`foo', `Macro `foo'.')dnl A very simple macro, indeed. + foo + =>Macro foo. + + The input up to and including the next newline is discarded, as +opposed to the way comments are treated (*note Comments::). + + Usually, `dnl' is immediately followed by an end of line or some +other whitespace. GNU `m4' will produce a warning diagnostic if `dnl' +is followed by an open parenthesis. In this case, `dnl' will collect +and process all arguments, looking for a matching close parenthesis. +All predictable side effects resulting from this collection will take +place. `dnl' will return no output. The input following the matching +close parenthesis up to and including the next newline, on whatever +line containing it, will still be discarded. + + dnl(`args are ignored, but side effects occur', + define(`foo', `like this')) while this text is ignored: undefine(`foo') + error-->m4:stdin:1: Warning: excess arguments to builtin `dnl' ignored + See how `foo' was defined, foo? + =>See how foo was defined, like this? + + If the end of file is encountered without a newline character, a +warning is issued and dnl stops consuming input. + + m4wrap(`m4wrap(`2 hi + ')0 hi dnl 1 hi') + => + define(`hi', `HI') + => + ^D + error-->m4:stdin:1: Warning: end of file treated as newline + =>0 HI 2 HI + + +File: m4.info, Node: Changequote, Next: Changecom, Prev: Dnl, Up: Input Control + +8.2 Changing the quote characters +================================= + +The default quote delimiters can be changed with the builtin +`changequote': + + -- Builtin: changequote ([START = ``'], [END = `'']) + This sets START as the new begin-quote delimiter and END as the + new end-quote delimiter. If both arguments are missing, the + default quotes (``' and `'') are used. If START is void, then + quoting is disabled. Otherwise, if END is missing or void, the + default end-quote delimiter (`'') is used. The quote delimiters + can be of any length. + + The expansion of `changequote' is void. + + changequote(`[', `]') + => + define([foo], [Macro [foo].]) + => + foo + =>Macro foo. + + The quotation strings can safely contain eight-bit characters. If +no single character is appropriate, START and END can be of any length. +Other implementations cap the delimiter length to five characters, but +GNU has no inherent limit. + + changequote(`[[[', `]]]') + => + define([[[foo]]], [[[Macro [[[[[foo]]]]].]]]) + => + foo + =>Macro [[foo]]. + + Calling `changequote' with START as the empty string will +effectively disable the quoting mechanism, leaving no way to quote text. +However, using an empty string is not portable, as some other +implementations of `m4' revert to the default quoting, while others +preserve the prior non-empty delimiter. If START is not empty, then an +empty END will use the default end-quote delimiter of `'', as +otherwise, it would be impossible to end a quoted string. Again, this +is not portable, as some other `m4' implementations reuse START as the +end-quote delimiter, while others preserve the previous non-empty +value. Omitting both arguments restores the default begin-quote and +end-quote delimiters; fortunately this behavior is portable to all +implementations of `m4'. + + define(`foo', `Macro `FOO'.') + => + changequote(`', `') + => + foo + =>Macro `FOO'. + `foo' + =>`Macro `FOO'.' + changequote(`,) + => + foo + =>Macro FOO. + + There is no way in `m4' to quote a string containing an unmatched +begin-quote, except using `changequote' to change the current quotes. + + If the quotes should be changed from, say, `[' to `[[', temporary +quote characters have to be defined. To achieve this, two calls of +`changequote' must be made, one for the temporary quotes and one for +the new quotes. + + Macros are recognized in preference to the begin-quote string, so if +a prefix of START can be recognized as part of a potential macro name, +the quoting mechanism is effectively disabled. Unless you use +`changeword' (*note Changeword::), this means that START should not +begin with a letter, digit, or `_' (underscore). However, even though +quoted strings are not recognized, the quote characters can still be +discerned in macro expansion and in trace output. + + define(`echo', `$@') + => + define(`hi', `HI') + => + changequote(`q', `Q') + => + q hi Q hi + =>q HI Q HI + echo(hi) + =>qHIQ + changequote + => + changequote(`-', `EOF') + => + - hi EOF hi + => hi HI + changequote + => + changequote(`1', `2') + => + hi1hi2 + =>hi1hi2 + hi 1hi2 + =>HI hi + + Quotes are recognized in preference to argument collection. In +particular, if START is a single `(', then argument collection is +effectively disabled. For portability with other implementations, it +is a good idea to avoid `(', `,', and `)' as the first character in +START. + + define(`echo', `$#:$@:') + => + define(`hi', `HI') + => + changequote(`(',`)') + => + echo(hi) + =>0::hi + changequote + => + changequote(`((', `))') + => + echo(hi) + =>1:HI: + echo((hi)) + =>0::hi + changequote + => + changequote(`,', `)') + => + echo(hi,hi)bye) + =>1:HIhibye: + + However, if you are not worried about portability, using `(' and `)' +as quoting characters has an interesting property--you can use it to +compute a quoted string containing the expansion of any quoted text, as +long as the expansion results in both balanced quotes and balanced +parentheses. The trick is realizing `expand' uses `$1' unquoted, to +trigger its expansion using the normal quoting characters, but uses +extra parentheses to group unquoted commas that occur in the expansion +without consuming whitespace following those commas. Then `_expand' +uses `changequote' to convert the extra parentheses back into quoting +characters. Note that it takes two more `changequote' invocations to +restore the original quotes. Contrast the behavior on whitespace when +using `$*', via `quote', to attempt the same task. + + changequote(`[', `]')dnl + define([a], [1, (b)])dnl + define([b], [2])dnl + define([quote], [[$*]])dnl + define([expand], [_$0(($1))])dnl + define([_expand], + [changequote([(], [)])$1changequote`'changequote(`[', `]')])dnl + expand([a, a, [a, a], [[a, a]]]) + =>1, (2), 1, (2), a, a, [a, a] + quote(a, a, [a, a], [[a, a]]) + =>1,(2),1,(2),a, a,[a, a] + + If END is a prefix of START, the end-quote will be recognized in +preference to a nested begin-quote. In particular, changing the quotes +to have the same string for START and END disables nesting of quotes. +When quote nesting is disabled, it is impossible to double-quote +strings across macro expansions, so using the same string is not done +very often. + + define(`hi', `HI') + => + changequote(`""', `"') + => + ""hi"""hi" + =>hihi + ""hi" ""hi" + =>hi hi + ""hi"" "hi" + =>hi" "HI" + changequote + => + `hi`hi'hi' + =>hi`hi'hi + changequote(`"', `"') + => + "hi"hi"hi" + =>hiHIhi + + It is an error if the end of file occurs within a quoted string. + + `hello world' + =>hello world + `dangling quote + ^D + error-->m4:stdin:2: ERROR: end of file in string + + +File: m4.info, Node: Changecom, Next: Changeword, Prev: Changequote, Up: Input Control + +8.3 Changing the comment delimiters +=================================== + +The default comment delimiters can be changed with the builtin macro +`changecom': + + -- Builtin: changecom ([START], [END = `<NL>']) + This sets START as the new begin-comment delimiter and END as the + new end-comment delimiter. If both arguments are missing, or + START is void, then comments are disabled. Otherwise, if END is + missing or void, the default end-comment delimiter of newline is + used. The comment delimiters can be of any length. + + The expansion of `changecom' is void. + + define(`comment', `COMMENT') + => + # A normal comment + =># A normal comment + changecom(`/*', `*/') + => + # Not a comment anymore + =># Not a COMMENT anymore + But: /* this is a comment now */ while this is not a comment + =>But: /* this is a comment now */ while this is not a COMMENT + + Note how comments are copied to the output, much as if they were +quoted strings. If you want the text inside a comment expanded, quote +the begin-comment delimiter. + + Calling `changecom' without any arguments, or with START as the +empty string, will effectively disable the commenting mechanism. To +restore the original comment start of `#', you must explicitly ask for +it. If START is not empty, then an empty END will use the default +end-comment delimiter of newline, as otherwise, it would be impossible +to end a comment. However, this is not portable, as some other `m4' +implementations preserve the previous non-empty delimiters instead. + + define(`comment', `COMMENT') + => + changecom + => + # Not a comment anymore + =># Not a COMMENT anymore + changecom(`#', `') + => + # comment again + =># comment again + + The comment strings can safely contain eight-bit characters. If no +single character is appropriate, START and END can be of any length. +Other implementations cap the delimiter length to five characters, but +GNU has no inherent limit. + + Comments are recognized in preference to macros. However, this is +not compatible with other implementations, where macros and even quoting +takes precedence over comments, so it may change in a future release. +For portability, this means that START should not begin with a letter, +digit, or `_' (underscore), and that neither the start-quote nor the +start-comment string should be a prefix of the other. + + define(`hi', `HI') + => + define(`hi1hi2', `hello') + => + changecom(`q', `Q') + => + q hi Q hi + =>q hi Q HI + changecom(`1', `2') + => + hi1hi2 + =>hello + hi 1hi2 + =>HI 1hi2 + + Comments are recognized in preference to argument collection. In +particular, if START is a single `(', then argument collection is +effectively disabled. For portability with other implementations, it +is a good idea to avoid `(', `,', and `)' as the first character in +START. + + define(`echo', `$#:$*:$@:') + => + define(`hi', `HI') + => + changecom(`(',`)') + => + echo(hi) + =>0:::(hi) + changecom + => + changecom(`((', `))') + => + echo(hi) + =>1:HI:HI: + echo((hi)) + =>0:::((hi)) + changecom(`,', `)') + => + echo(hi,hi)bye) + =>1:HI,hi)bye:HI,hi)bye: + changecom + => + echo(hi,`,`'hi',hi) + =>3:HI,,HI,HI:HI,,`'hi,HI: + echo(hi,`,`'hi',hi`'changecom(`,,', `hi')) + =>3:HI,,`'hi,HI:HI,,`'hi,HI: + + It is an error if the end of file occurs within a comment. + + changecom(`/*', `*/') + => + /*dangling comment + ^D + error-->m4:stdin:2: ERROR: end of file in comment + + +File: m4.info, Node: Changeword, Next: M4wrap, Prev: Changecom, Up: Input Control + +8.4 Changing the lexical structure of words +=========================================== + + The macro `changeword' and all associated functionality is + experimental. It is only available if the `--enable-changeword' + option was given to `configure', at GNU `m4' installation time. + The functionality will go away in the future, to be replaced by + other new features that are more efficient at providing the same + capabilities. _Do not rely on it_. Please direct your comments + about it the same way you would do for bugs. + + A file being processed by `m4' is split into quoted strings, words +(potential macro names) and simple tokens (any other single character). +Initially a word is defined by the following regular expression: + + [_a-zA-Z][_a-zA-Z0-9]* + + Using `changeword', you can change this regular expression: + + -- Optional builtin: changeword (REGEX) + Changes the regular expression for recognizing macro names to be + REGEX. If REGEX is empty, use `[_a-zA-Z][_a-zA-Z0-9]*'. REGEX + must obey the constraint that every prefix of the desired final + pattern is also accepted by the regular expression. If REGEX + contains grouping parentheses, the macro invoked is the portion + that matched the first group, rather than the entire matching + string. + + The expansion of `changeword' is void. The macro `changeword' is + recognized only with parameters. + + Relaxing the lexical rules of `m4' might be useful (for example) if +you wanted to apply translations to a file of numbers: + + ifdef(`changeword', `', `errprint(` skipping: no changeword support + ')m4exit(`77')')dnl + changeword(`[_a-zA-Z0-9]+') + => + define(`1', `0')1 + =>0 + + Tightening the lexical rules is less useful, because it will +generally make some of the builtins unavailable. You could use it to +prevent accidental call of builtins, for example: + + ifdef(`changeword', `', `errprint(` skipping: no changeword support + ')m4exit(`77')')dnl + define(`_indir', defn(`indir')) + => + changeword(`_[_a-zA-Z0-9]*') + => + esyscmd(`foo') + =>esyscmd(foo) + _indir(`esyscmd', `echo hi') + =>hi + => + + Because `m4' constructs its words a character at a time, there is a +restriction on the regular expressions that may be passed to +`changeword'. This is that if your regular expression accepts `foo', +it must also accept `f' and `fo'. + + ifdef(`changeword', `', `errprint(` skipping: no changeword support + ')m4exit(`77')')dnl + define(`foo + ', `bar + ') + => + dnl This example wants to recognize changeword, dnl, and `foo\n'. + dnl First, we check that our regexp will match. + regexp(`changeword', `[cd][a-z]*\|foo[ + ]') + =>0 + regexp(`foo + ', `[cd][a-z]*\|foo[ + ]') + =>0 + regexp(`f', `[cd][a-z]*\|foo[ + ]') + =>-1 + foo + =>foo + changeword(`[cd][a-z]*\|foo[ + ]') + => + dnl Even though `foo\n' matches, we forgot to allow `f'. + foo + =>foo + changeword(`[cd][a-z]*\|fo*[ + ]?') + => + dnl Now we can call `foo\n'. + foo + =>bar + + `changeword' has another function. If the regular expression +supplied contains any grouped subexpressions, then text outside the +first of these is discarded before symbol lookup. So: + + ifdef(`changeword', `', `errprint(` skipping: no changeword support + ')m4exit(`77')')dnl + ifdef(`__unix__', , + `errprint(` skipping: syscmd does not have unix semantics + ')m4exit(`77')')dnl + changecom(`/*', `*/')dnl + define(`foo', `bar')dnl + changeword(`#\([_a-zA-Z0-9]*\)') + => + #esyscmd(`echo foo \#foo') + =>foo bar + => + + `m4' now requires a `#' mark at the beginning of every macro +invocation, so one can use `m4' to preprocess plain text without losing +various words like `divert'. + + In `m4', macro substitution is based on text, while in TeX, it is +based on tokens. `changeword' can throw this difference into relief. +For example, here is the same idea represented in TeX and `m4'. First, +the TeX version: + + \def\a{\message{Hello}} + \catcode`\@=0 + \catcode`\\=12 + @a + @bye + =>Hello + +Then, the `m4' version: + + ifdef(`changeword', `', `errprint(` skipping: no changeword support + ')m4exit(`77')')dnl + define(`a', `errprint(`Hello')')dnl + changeword(`@\([_a-zA-Z0-9]*\)') + => + @a + =>errprint(Hello) + + In the TeX example, the first line defines a macro `a' to print the +message `Hello'. The second line defines <@> to be usable instead of +<\> as an escape character. The third line defines <\> to be a normal +printing character, not an escape. The fourth line invokes the macro +`a'. So, when TeX is run on this file, it displays the message `Hello'. + + When the `m4' example is passed through `m4', it outputs +`errprint(Hello)'. The reason for this is that TeX does lexical +analysis of macro definition when the macro is _defined_. `m4' just +stores the text, postponing the lexical analysis until the macro is +_used_. + + You should note that using `changeword' will slow `m4' down by a +factor of about seven, once it is changed to something other than the +default regular expression. You can invoke `changeword' with the empty +string to restore the default word definition, and regain the parsing +speed. + + +File: m4.info, Node: M4wrap, Prev: Changeword, Up: Input Control + +8.5 Saving text until end of input +================================== + +It is possible to `save' some text until the end of the normal input has +been seen. Text can be saved, to be read again by `m4' when the normal +input has been exhausted. This feature is normally used to initiate +cleanup actions before normal exit, e.g., deleting temporary files. + + To save input text, use the builtin `m4wrap': + + -- Builtin: m4wrap (STRING, ...) + Stores STRING in a safe place, to be reread when end of input is + reached. As a GNU extension, additional arguments are + concatenated with a space to the STRING. + + The expansion of `m4wrap' is void. The macro `m4wrap' is + recognized only with parameters. + + define(`cleanup', `This is the `cleanup' action. + ') + => + m4wrap(`cleanup') + => + This is the first and last normal input line. + =>This is the first and last normal input line. + ^D + =>This is the cleanup action. + + The saved input is only reread when the end of normal input is seen, +and not if `m4exit' is used to exit `m4'. + + It is safe to call `m4wrap' from saved text, but then the order in +which the saved text is reread is undefined. If `m4wrap' is not used +recursively, the saved pieces of text are reread in the opposite order +in which they were saved (LIFO--last in, first out). However, this +behavior is likely to change in a future release, to match POSIX, so +you should not depend on this order. + + It is possible to emulate POSIX behavior even with older versions of +GNU M4 by including the file `m4-1.4.11/examples/wrapfifo.m4' from the +distribution: + + $ m4 -I examples + undivert(`wrapfifo.m4')dnl + =>dnl Redefine m4wrap to have FIFO semantics. + =>define(`_m4wrap_level', `0')dnl + =>define(`m4wrap', + =>`ifdef(`m4wrap'_m4wrap_level, + => `define(`m4wrap'_m4wrap_level, + => defn(`m4wrap'_m4wrap_level)`$1')', + => `builtin(`m4wrap', `define(`_m4wrap_level', + => incr(_m4wrap_level))dnl + =>m4wrap'_m4wrap_level)dnl + =>define(`m4wrap'_m4wrap_level, `$1')')')dnl + include(`wrapfifo.m4') + => + m4wrap(`a`'m4wrap(`c + ', `d')')m4wrap(`b') + => + ^D + =>abc + + It is likewise possible to emulate LIFO behavior without resorting to +the GNU M4 extension of `builtin', by including the file +`m4-1.4.11/examples/wraplifo.m4' from the distribution. +(Unfortunately, both examples shown here share some subtle bugs. See +if you can find and correct them; or *note Answers: Improved m4wrap.). + + $ m4 -I examples + undivert(`wraplifo.m4')dnl + =>dnl Redefine m4wrap to have LIFO semantics. + =>define(`_m4wrap_level', `0')dnl + =>define(`_m4wrap', defn(`m4wrap'))dnl + =>define(`m4wrap', + =>`ifdef(`m4wrap'_m4wrap_level, + => `define(`m4wrap'_m4wrap_level, + => `$1'defn(`m4wrap'_m4wrap_level))', + => `_m4wrap(`define(`_m4wrap_level', incr(_m4wrap_level))dnl + =>m4wrap'_m4wrap_level)dnl + =>define(`m4wrap'_m4wrap_level, `$1')')')dnl + include(`wraplifo.m4') + => + m4wrap(`a`'m4wrap(`c + ', `d')')m4wrap(`b') + => + ^D + =>bac + + Here is an example of implementing a factorial function using +`m4wrap': + + define(`f', `ifelse(`$1', `0', `Answer: 0!=1 + ', eval(`$1>1'), `0', `Answer: $2$1=eval(`$2$1') + ', `m4wrap(`f(decr(`$1'), `$2$1*')')')') + => + f(`10') + => + ^D + =>Answer: 10*9*8*7*6*5*4*3*2*1=3628800 + + Invocations of `m4wrap' at the same recursion level are concatenated +and rescanned as usual: + + define(`aa', `AA + ') + => + m4wrap(`a')m4wrap(`a') + => + ^D + =>AA + +however, the transition between recursion levels behaves like an end of +file condition between two input files. + + m4wrap(`m4wrap(`)')len(abc') + => + ^D + error-->m4:stdin:1: ERROR: end of file in argument list + + +File: m4.info, Node: File Inclusion, Next: Diversions, Prev: Input Control, Up: Top + +9 File inclusion +**************** + +`m4' allows you to include named files at any point in the input. + +* Menu: + +* Include:: Including named files +* Search Path:: Searching for include files + + +File: m4.info, Node: Include, Next: Search Path, Up: File Inclusion + +9.1 Including named files +========================= + +There are two builtin macros in `m4' for including files: + + -- Builtin: include (FILE) + -- Builtin: sinclude (FILE) + Both macros cause the file named FILE to be read by `m4'. When + the end of the file is reached, input is resumed from the previous + input file. + + The expansion of `include' and `sinclude' is therefore the + contents of FILE. + + If FILE does not exist (or cannot be read), the expansion is void, + and `include' will fail with an error while `sinclude' is silent. + The empty string counts as a file that does not exist. + + The macros `include' and `sinclude' are recognized only with + parameters. + + include(`none') + error-->m4:stdin:1: cannot open `none': No such file or directory + => + include() + error-->m4:stdin:2: cannot open `': No such file or directory + => + sinclude(`none') + => + sinclude() + => + + The rest of this section assumes that `m4' is invoked with the `-I' +option (*note Invoking m4: Preprocessor features.) pointing to the +`m4-1.4.11/examples' directory shipped as part of the GNU `m4' package. +The file `m4-1.4.11/examples/incl.m4' in the distribution contains the +lines: + + $ cat examples/incl.m4 + =>Include file start + =>foo + =>Include file end + + Normally file inclusion is used to insert the contents of a file +into the input stream. The contents of the file will be read by `m4' +and macro calls in the file will be expanded: + + $ m4 -I examples + define(`foo', `FOO') + => + include(`incl.m4') + =>Include file start + =>FOO + =>Include file end + => + + The fact that `include' and `sinclude' expand to the contents of the +file can be used to define macros that operate on entire files. Here +is an example, which defines `bar' to expand to the contents of +`incl.m4': + + $ m4 -I examples + define(`bar', include(`incl.m4')) + => + This is `bar': >>bar<< + =>This is bar: >>Include file start + =>foo + =>Include file end + =><< + + This use of `include' is not trivial, though, as files can contain +quotes, commas, and parentheses, which can interfere with the way the +`m4' parser works. GNU `m4' seamlessly concatenates the file contents +with the next character, even if the included file ended in the middle +of a comment, string, or macro call. These conditions are only treated +as end of file errors if specified as input files on the command line. + + In GNU `m4', an alternative method of reading files is using +`undivert' (*note Undivert::) on a named file. + + +File: m4.info, Node: Search Path, Prev: Include, Up: File Inclusion + +9.2 Searching for include files +=============================== + +GNU `m4' allows included files to be found in other directories than +the current working directory. + + If the `--prepend-include' or `-B' command-line option was provided +(*note Invoking m4: Preprocessor features.), those directories are +searched first, in reverse order that those options were listed on the +command line. Then `m4' looks in the current working directory. Next +comes the directories specified with the `--include' or `-I' option, in +the order found on the command line. Finally, if the `M4PATH' +environment variable is set, it is expected to contain a +colon-separated list of directories, which will be searched in order. + + If the automatic search for include-files causes trouble, the `p' +debug flag (*note Debug Levels::) can help isolate the problem. + + +File: m4.info, Node: Diversions, Next: Text handling, Prev: File Inclusion, Up: Top + +10 Diverting and undiverting output +*********************************** + +Diversions are a way of temporarily saving output. The output of `m4' +can at any time be diverted to a temporary file, and be reinserted into +the output stream, "undiverted", again at a later time. + + Numbered diversions are counted from 0 upwards, diversion number 0 +being the normal output stream. The number of simultaneous diversions +is limited mainly by the memory used to describe them, because GNU `m4' +tries to keep diversions in memory. However, there is a limit to the +overall memory usable by all diversions taken altogether (512K, +currently). When this maximum is about to be exceeded, a temporary +file is opened to receive the contents of the biggest diversion still +in memory, freeing this memory for other diversions. When creating the +temporary file, `m4' honors the value of the environment variable +`TMPDIR', and falls back to `/tmp'. So, it is theoretically possible +that the number and aggregate size of diversions is limited only by +available disk space. + + Diversions make it possible to generate output in a different order +than the input was read. It is possible to implement topological +sorting dependencies. For example, GNU Autoconf makes use of +diversions under the hood to ensure that the expansion of a prerequisite +macro appears in the output prior to the expansion of a dependent macro, +regardless of which order the two macros were invoked in the user's +input file. + +* Menu: + +* Divert:: Diverting output +* Undivert:: Undiverting output +* Divnum:: Diversion numbers +* Cleardivert:: Discarding diverted text + + +File: m4.info, Node: Divert, Next: Undivert, Up: Diversions + +10.1 Diverting output +===================== + +Output is diverted using `divert': + + -- Builtin: divert ([NUMBER = `0']) + The current diversion is changed to NUMBER. If NUMBER is left out + or empty, it is assumed to be zero. If NUMBER cannot be parsed, + the diversion is unchanged. + + The expansion of `divert' is void. + + When all the `m4' input will have been processed, all existing +diversions are automatically undiverted, in numerical order. + + divert(`1') + This text is diverted. + divert + => + This text is not diverted. + =>This text is not diverted. + ^D + => + =>This text is diverted. + + Several calls of `divert' with the same argument do not overwrite +the previous diverted text, but append to it. Diversions are printed +after any wrapped text is expanded. + + define(`text', `TEXT') + => + divert(`1')`diverted text.' + divert + => + m4wrap(`Wrapped text precedes ') + => + ^D + =>Wrapped TEXT precedes diverted text. + + If output is diverted to a negative diversion, it is simply +discarded. This can be used to suppress unwanted output. A common +example of unwanted output is the trailing newlines after macro +definitions. Here is a common programming idiom in `m4' for avoiding +them. + + divert(`-1') + define(`foo', `Macro `foo'.') + define(`bar', `Macro `bar'.') + divert + => + + Traditional implementations only supported ten diversions. But as a +GNU extension, diversion numbers can be as large as positive integers +will allow, rather than treating a multi-digit diversion number as a +request to discard text. + + divert(eval(`1<<28'))world + divert(`2')hello + ^D + =>hello + =>world + + Note that `divert' is an English word, but also an active macro +without arguments. When processing plain text, the word might appear in +normal text and be unintentionally swallowed as a macro invocation. One +way to avoid this is to use the `-P' option to rename all builtins +(*note Invoking m4: Operation modes.). Another is to write a wrapper +that requires a parameter to be recognized. + + We decided to divert the stream for irrigation. + =>We decided to the stream for irrigation. + define(`divert', `ifelse(`$#', `0', ``$0'', `builtin(`$0', $@)')') + => + divert(`-1') + Ignored text. + divert(`0') + => + We decided to divert the stream for irrigation. + =>We decided to divert the stream for irrigation. + + +File: m4.info, Node: Undivert, Next: Divnum, Prev: Divert, Up: Diversions + +10.2 Undiverting output +======================= + +Diverted text can be undiverted explicitly using the builtin `undivert': + + -- Builtin: undivert ([DIVERSIONS...]) + Undiverts the numeric DIVERSIONS given by the arguments, in the + order given. If no arguments are supplied, all diversions are + undiverted, in numerical order. + + As a GNU extension, DIVERSIONS may contain non-numeric strings, + which are treated as the names of files to copy into the output + without expansion. A warning is issued if a file could not be + opened. + + The expansion of `undivert' is void. + + divert(`1') + This text is diverted. + divert + => + This text is not diverted. + =>This text is not diverted. + undivert(`1') + => + =>This text is diverted. + => + + Notice the last two blank lines. One of them comes from the newline +following `undivert', the other from the newline that followed the +`divert'! A diversion often starts with a blank line like this. + + When diverted text is undiverted, it is _not_ reread by `m4', but +rather copied directly to the current output, and it is therefore not +an error to undivert into a diversion. Undiverting the empty string is +the same as specifying diversion 0; in either case nothing happens +since the output has already been flushed. + + divert(`1')diverted text + divert + => + undivert() + => + undivert(`0') + => + undivert + =>diverted text + => + + When a diversion has been undiverted, the diverted text is discarded, +and it is not possible to bring back diverted text more than once. + + divert(`1') + This text is diverted first. + divert(`0')undivert(`1')dnl + => + =>This text is diverted first. + undivert(`1') + => + divert(`1') + This text is also diverted but not appended. + divert(`0')undivert(`1')dnl + => + =>This text is also diverted but not appended. + + Attempts to undivert the current diversion are silently ignored. +Thus, when the current diversion is not 0, the current diversion does +not get rearranged among the other diversions. + + divert(`1')one + divert(`2')two + divert(`3')three + divert(`2')undivert`'dnl + divert`'undivert`'dnl + =>two + =>one + =>three + + GNU `m4' allows named files to be undiverted. Given a non-numeric +argument, the contents of the file named will be copied, uninterpreted, +to the current output. This complements the builtin `include' (*note +Include::). To illustrate the difference, assume the file `foo' +contains: + + $ cat foo + bar + +then + + define(`bar', `BAR') + => + undivert(`foo') + =>bar + => + include(`foo') + =>BAR + => + + If the file is not found (or cannot be read), an error message is +issued, and the expansion is void. It is possible to intermix files +and diversion numbers. + + divert(`1')diversion one + divert(`2')undivert(`foo')dnl + divert(`3')diversion three + divert`'dnl + undivert(`1', `2', `foo', `3')dnl + =>diversion one + =>bar + =>bar + =>diversion three + + +File: m4.info, Node: Divnum, Next: Cleardivert, Prev: Undivert, Up: Diversions + +10.3 Diversion numbers +====================== + +The current diversion is tracked by the builtin `divnum': + + -- Builtin: divnum + Expands to the number of the current diversion. + + Initial divnum + =>Initial 0 + divert(`1') + Diversion one: divnum + divert(`2') + Diversion two: divnum + ^D + => + =>Diversion one: 1 + => + =>Diversion two: 2 + + +File: m4.info, Node: Cleardivert, Prev: Divnum, Up: Diversions + +10.4 Discarding diverted text +============================= + +Often it is not known, when output is diverted, whether the diverted +text is actually needed. Since all non-empty diversion are brought back +on the main output stream when the end of input is seen, a method of +discarding a diversion is needed. If all diversions should be +discarded, the easiest is to end the input to `m4' with `divert(`-1')' +followed by an explicit `undivert': + + divert(`1') + Diversion one: divnum + divert(`2') + Diversion two: divnum + divert(`-1') + undivert + ^D + +No output is produced at all. + + Clearing selected diversions can be done with the following macro: + + -- Composite: cleardivert ([DIVERSIONS...]) + Discard the contents of each of the listed numeric DIVERSIONS. + + define(`cleardivert', + `pushdef(`_n', divnum)divert(`-1')undivert($@)divert(_n)popdef(`_n')') + => + + It is called just like `undivert', but the effect is to clear the +diversions, given by the arguments. (This macro has a nasty bug! You +should try to see if you can find it and correct it; or *note Answers: +Improved cleardivert.). + + +File: m4.info, Node: Text handling, Next: Arithmetic, Prev: Diversions, Up: Top + +11 Macros for text handling +*************************** + +There are a number of builtins in `m4' for manipulating text in various +ways, extracting substrings, searching, substituting, and so on. + +* Menu: + +* Len:: Calculating length of strings +* Index macro:: Searching for substrings +* Regexp:: Searching for regular expressions +* Substr:: Extracting substrings +* Translit:: Translating characters +* Patsubst:: Substituting text by regular expression +* Format:: Formatting strings (printf-like) + + +File: m4.info, Node: Len, Next: Index macro, Up: Text handling + +11.1 Calculating length of strings +================================== + +The length of a string can be calculated by `len': + + -- Builtin: len (STRING) + Expands to the length of STRING, as a decimal number. + + The macro `len' is recognized only with parameters. + + len() + =>0 + len(`abcdef') + =>6 + + +File: m4.info, Node: Index macro, Next: Regexp, Prev: Len, Up: Text handling + +11.2 Searching for substrings +============================= + +Searching for substrings is done with `index': + + -- Builtin: index (STRING, SUBSTRING) + Expands to the index of the first occurrence of SUBSTRING in + STRING. The first character in STRING has index 0. If SUBSTRING + does not occur in STRING, `index' expands to `-1'. + + The macro `index' is recognized only with parameters. + + index(`gnus, gnats, and armadillos', `nat') + =>7 + index(`gnus, gnats, and armadillos', `dag') + =>-1 + + Omitting SUBSTRING evokes a warning, but still produces output; +contrast this with an empty SUBSTRING. + + index(`abc') + error-->m4:stdin:1: Warning: too few arguments to builtin `index' + =>0 + index(`abc', `') + =>0 + index(`abc', `b') + =>1 + + +File: m4.info, Node: Regexp, Next: Substr, Prev: Index macro, Up: Text handling + +11.3 Searching for regular expressions +====================================== + +Searching for regular expressions is done with the builtin `regexp': + + -- Builtin: regexp (STRING, REGEXP, [REPLACEMENT]) + Searches for REGEXP in STRING. The syntax for regular expressions + is the same as in GNU Emacs, which is similar to BRE (Basic + Regular Expressions) in POSIX. *Note Syntax of Regular + Expressions: (emacs)Regexps. Support for ERE (Extended Regular + Expressions) is not available, but will be added in GNU M4 2.0. + + If REPLACEMENT is omitted, `regexp' expands to the index of the + first match of REGEXP in STRING. If REGEXP does not match + anywhere in STRING, it expands to -1. + + If REPLACEMENT is supplied, and there was a match, `regexp' + changes the expansion to this argument, with `\N' substituted by + the text matched by the Nth parenthesized sub-expression of + REGEXP, up to nine sub-expressions. The escape `\&' is replaced + by the text of the entire regular expression matched. For all + other characters, `\' treats the next character literally. A + warning is issued if there were fewer sub-expressions than the + `\N' requested, or if there is a trailing `\'. If there was no + match, `regexp' expands to the empty string. + + The macro `regexp' is recognized only with parameters. + + regexp(`GNUs not Unix', `\<[a-z]\w+') + =>5 + regexp(`GNUs not Unix', `\<Q\w*') + =>-1 + regexp(`GNUs not Unix', `\w\(\w+\)$', `*** \& *** \1 ***') + =>*** Unix *** nix *** + regexp(`GNUs not Unix', `\<Q\w*', `*** \& *** \1 ***') + => + + Here are some more examples on the handling of backslash: + + regexp(`abc', `\(b\)', `\\\10\a') + =>\b0a + regexp(`abc', `b', `\1\') + error-->m4:stdin:2: Warning: sub-expression 1 not present + error-->m4:stdin:2: Warning: trailing \ ignored in replacement + => + regexp(`abc', `\(\(d\)?\)\(c\)', `\1\2\3\4\5\6') + error-->m4:stdin:3: Warning: sub-expression 4 not present + error-->m4:stdin:3: Warning: sub-expression 5 not present + error-->m4:stdin:3: Warning: sub-expression 6 not present + =>c + + Omitting REGEXP evokes a warning, but still produces output; +contrast this with an empty REGEXP argument. + + regexp(`abc') + error-->m4:stdin:1: Warning: too few arguments to builtin `regexp' + =>0 + regexp(`abc', `') + =>0 + regexp(`abc', `', `\\def') + =>\def + + +File: m4.info, Node: Substr, Next: Translit, Prev: Regexp, Up: Text handling + +11.4 Extracting substrings +========================== + +Substrings are extracted with `substr': + + -- Builtin: substr (STRING, FROM, [LENGTH]) + Expands to the substring of STRING, which starts at index FROM, + and extends for LENGTH characters, or to the end of STRING, if + LENGTH is omitted. The starting index of a string is always 0. + The expansion is empty if there is an error parsing FROM or + LENGTH, if FROM is beyond the end of STRING, or if LENGTH is + negative. + + The macro `substr' is recognized only with parameters. + + substr(`gnus, gnats, and armadillos', `6') + =>gnats, and armadillos + substr(`gnus, gnats, and armadillos', `6', `5') + =>gnats + + Omitting FROM evokes a warning, but still produces output. + + substr(`abc') + error-->m4:stdin:1: Warning: too few arguments to builtin `substr' + =>abc + substr(`abc',) + error-->m4:stdin:2: empty string treated as 0 in builtin `substr' + =>abc + + +File: m4.info, Node: Translit, Next: Patsubst, Prev: Substr, Up: Text handling + +11.5 Translating characters +=========================== + +Character translation is done with `translit': + + -- Builtin: translit (STRING, CHARS, [REPLACEMENT]) + Expands to STRING, with each character that occurs in CHARS + translated into the character from REPLACEMENT with the same index. + + If REPLACEMENT is shorter than CHARS, the excess characters of + CHARS are deleted from the expansion; if CHARS is shorter, the + excess characters in REPLACEMENT are silently ignored. If + REPLACEMENT is omitted, all characters in STRING that are present + in CHARS are deleted from the expansion. If a character appears + more than once in CHARS, only the first instance is used in making + the translation. Only a single translation pass is made, even if + characters in REPLACEMENT also appear in CHARS. + + As a GNU extension, both CHARS and REPLACEMENT can contain + character-ranges, e.g., `a-z' (meaning all lowercase letters) or + `0-9' (meaning all digits). To include a dash `-' in CHARS or + REPLACEMENT, place it first or last in the entire string, or as + the last character of a range. Back-to-back ranges can share a + common endpoint. It is not an error for the last character in the + range to be `larger' than the first. In that case, the range runs + backwards, i.e., `9-0' means the string `9876543210'. The + expansion of a range is dependent on the underlying encoding of + characters, so using ranges is not always portable between + machines. + + The macro `translit' is recognized only with parameters. + + translit(`GNUs not Unix', `A-Z') + =>s not nix + translit(`GNUs not Unix', `a-z', `A-Z') + =>GNUS NOT UNIX + translit(`GNUs not Unix', `A-Z', `z-a') + =>tmfs not fnix + translit(`+,-12345', `+--1-5', `<;>a-c-a') + =><;>abcba + translit(`abcdef', `aabdef', `bcged') + =>bgced + + In the ASCII encoding, the first example deletes all uppercase +letters, the second converts lowercase to uppercase, and the third +`mirrors' all uppercase letters, while converting them to lowercase. +The two first cases are by far the most common, even though they are not +portable to EBCDIC or other encodings. The fourth example shows a +range ending in `-', as well as back-to-back ranges. The final example +shows that `a' is mapped to `b', not `c'; the resulting `b' is not +further remapped to `g'; the `d' and `e' are swapped, and the `f' is +discarded. + + Omitting CHARS evokes a warning, but still produces output. + + translit(`abc') + error-->m4:stdin:1: Warning: too few arguments to builtin `translit' + =>abc + + +File: m4.info, Node: Patsubst, Next: Format, Prev: Translit, Up: Text handling + +11.6 Substituting text by regular expression +============================================ + +Global substitution in a string is done by `patsubst': + + -- Builtin: patsubst (STRING, REGEXP, [REPLACEMENT]) + Searches STRING for matches of REGEXP, and substitutes REPLACEMENT + for each match. The syntax for regular expressions is the same as + in GNU Emacs (*note Regexp::). + + The parts of STRING that are not covered by any match of REGEXP + are copied to the expansion. Whenever a match is found, the + search proceeds from the end of the match, so a character from + STRING will never be substituted twice. If REGEXP matches a + string of zero length, the start position for the search is + incremented, to avoid infinite loops. + + When a replacement is to be made, REPLACEMENT is inserted into the + expansion, with `\N' substituted by the text matched by the Nth + parenthesized sub-expression of PATSUBST, for up to nine + sub-expressions. The escape `\&' is replaced by the text of the + entire regular expression matched. For all other characters, `\' + treats the next character literally. A warning is issued if there + were fewer sub-expressions than the `\N' requested, or if there is + a trailing `\'. + + The REPLACEMENT argument can be omitted, in which case the text + matched by REGEXP is deleted. + + The macro `patsubst' is recognized only with parameters. + + patsubst(`GNUs not Unix', `^', `OBS: ') + =>OBS: GNUs not Unix + patsubst(`GNUs not Unix', `\<', `OBS: ') + =>OBS: GNUs OBS: not OBS: Unix + patsubst(`GNUs not Unix', `\w*', `(\&)') + =>(GNUs)() (not)() (Unix)() + patsubst(`GNUs not Unix', `\w+', `(\&)') + =>(GNUs) (not) (Unix) + patsubst(`GNUs not Unix', `[A-Z][a-z]+') + =>GN not + patsubst(`GNUs not Unix', `not', `NOT\') + error-->m4:stdin:6: Warning: trailing \ ignored in replacement + =>GNUs NOT Unix + + Here is a slightly more realistic example, which capitalizes +individual words or whole sentences, by substituting calls of the macros +`upcase' and `downcase' into the strings. + + -- Composite: upcase (TEXT) + -- Composite: downcase (TEXT) + -- Composite: capitalize (TEXT) + Expand to TEXT, but with capitalization changed: `upcase' changes + all letters to upper case, `downcase' changes all letters to lower + case, and `capitalize' changes the first character of each word to + upper case and the remaining characters to lower case. + + First, an example of their usage, using implementations distributed +in `m4-1.4.11/examples/capitalize.m4'. + + $ m4 -I examples + include(`capitalize.m4') + => + upcase(`GNUs not Unix') + =>GNUS NOT UNIX + downcase(`GNUs not Unix') + =>gnus not unix + capitalize(`GNUs not Unix') + =>Gnus Not Unix + + Now for the implementation. There is a helper macro `_capitalize' +which puts only its first word in mixed case. Then `capitalize' merely +parses out the words, and replaces them with an invocation of +`_capitalize'. (As presented here, the `capitalize' macro has some +subtle flaws. You should try to see if you can find and correct them; +or *note Answers: Improved capitalize.). + + $ m4 -I examples + undivert(`capitalize.m4')dnl + =>divert(`-1') + =># upcase(text) + =># downcase(text) + =># capitalize(text) + =># change case of text, simple version + =>define(`upcase', `translit(`$*', `a-z', `A-Z')') + =>define(`downcase', `translit(`$*', `A-Z', `a-z')') + =>define(`_capitalize', + => `regexp(`$1', `^\(\w\)\(\w*\)', + => `upcase(`\1')`'downcase(`\2')')') + =>define(`capitalize', `patsubst(`$1', `\w+', `_$0(`\&')')') + =>divert`'dnl + + While `regexp' replaces the whole input with the replacement as soon +as there is a match, `patsubst' replaces each _occurrence_ of a match +and preserves non-matching pieces: + + define(`patreg', + `patsubst($@) + regexp($@)')dnl + patreg(`bar foo baz Foo', `foo\|Foo', `FOO') + =>bar FOO baz FOO + =>FOO + patreg(`aba abb 121', `\(.\)\(.\)\1', `\2\1\2') + =>bab abb 212 + =>bab + + Omitting REGEXP evokes a warning, but still produces output; +contrast this with an empty REGEXP argument. + + patsubst(`abc') + error-->m4:stdin:1: Warning: too few arguments to builtin `patsubst' + =>abc + patsubst(`abc', `') + =>abc + patsubst(`abc', `', `\\-') + =>\-a\-b\-c\- + + +File: m4.info, Node: Format, Prev: Patsubst, Up: Text handling + +11.7 Formatting strings (printf-like) +===================================== + +Formatted output can be made with `format': + + -- Builtin: format (FORMAT-STRING, ...) + Works much like the C function `printf'. The first argument + FORMAT-STRING can contain `%' specifications which are satisfied + by additional arguments, and the expansion of `format' is the + formatted string. + + The macro `format' is recognized only with parameters. + + Its use is best described by a few examples: + + define(`foo', `The brown fox jumped over the lazy dog') + => + format(`The string "%s" uses %d characters', foo, len(foo)) + =>The string "The brown fox jumped over the lazy dog" uses 38 characters + format(`%*.*d', `-1', `-1', `1') + =>1 + format(`%.0f', `56789.9876') + =>56790 + len(format(`%-*X', `5000', `1')) + =>5000 + ifelse(format(`%010F', `infinity'), ` INF', `success', + format(`%010F', `infinity'), ` INFINITY', `success', + format(`%010F', `infinity')) + =>success + ifelse(format(`%.1A', `1.999'), `0X1.0P+1', `success', + format(`%.1A', `1.999'), `0X2.0P+0', `success', + format(`%.1A', `1.999')) + =>success + format(`%g', `0xa.P+1') + =>20 + + Using the `forloop' macro defined earlier (*note Forloop::), this +example shows how `format' can be used to produce tabular output. + + $ m4 -I examples + include(`forloop.m4') + => + forloop(`i', `1', `10', `format(`%6d squared is %10d + ', i, eval(i**2))') + => 1 squared is 1 + => 2 squared is 4 + => 3 squared is 9 + => 4 squared is 16 + => 5 squared is 25 + => 6 squared is 36 + => 7 squared is 49 + => 8 squared is 64 + => 9 squared is 81 + => 10 squared is 100 + => + + The builtin `format' is modeled after the ANSI C `printf' function, +and supports these `%' specifiers: `c', `s', `d', `o', `x', `X', `u', +`a', `A', `e', `E', `f', `F', `g', `G', and `%'; it supports field +widths and precisions, and the flags `+', `-', ` ', `0', `#', and `''. +For integer specifiers, the width modifiers `hh', `h', and `l' are +recognized, and for floating point specifiers, the width modifier `l' +is recognized. Items not yet supported include positional arguments, +the `n', `p', `S', and `C' specifiers, the `z', `t', `j', `L' and `ll' +modifiers, and any platform extensions available in the native +`printf'. For more details on the functioning of `printf', see the C +Library Manual, or the POSIX specification (for example, `%a' is +supported even on platforms that haven't yet implemented C99 +hexadecimal floating point output natively). + + Unrecognized specifiers result in a warning. It is anticipated that +a future release of GNU `m4' will support more specifiers, and give +better warnings when various problems such as overflow are encountered. +Likewise, escape sequences are not yet recognized. + + format(`%p', `0') + error-->m4:stdin:1: Warning: unrecognized specifier in `%p' + => + + +File: m4.info, Node: Arithmetic, Next: Shell commands, Prev: Text handling, Up: Top + +12 Macros for doing arithmetic +****************************** + +Integer arithmetic is included in `m4', with a C-like syntax. As +convenient shorthands, there are builtins for simple increment and +decrement operations. + +* Menu: + +* Incr:: Decrement and increment operators +* Eval:: Evaluating integer expressions + + +File: m4.info, Node: Incr, Next: Eval, Up: Arithmetic + +12.1 Decrement and increment operators +====================================== + +Increment and decrement of integers are supported using the builtins +`incr' and `decr': + + -- Builtin: incr (NUMBER) + -- Builtin: decr (NUMBER) + Expand to the numerical value of NUMBER, incremented or + decremented, respectively, by one. Except for the empty string, + the expansion is empty if NUMBER could not be parsed. + + The macros `incr' and `decr' are recognized only with parameters. + + incr(`4') + =>5 + decr(`7') + =>6 + incr() + error-->m4:stdin:3: empty string treated as 0 in builtin `incr' + =>1 + decr() + error-->m4:stdin:4: empty string treated as 0 in builtin `decr' + =>-1 + + +File: m4.info, Node: Eval, Prev: Incr, Up: Arithmetic + +12.2 Evaluating integer expressions +=================================== + +Integer expressions are evaluated with `eval': + + -- Builtin: eval (EXPRESSION, [RADIX = `10'], [WIDTH]) + Expands to the value of EXPRESSION. The expansion is empty if a + problem is encountered while parsing the arguments. If specified, + RADIX and WIDTH control the format of the output. + + Calculations are done with 32-bit signed numbers. Overflow + silently results in wraparound. A warning is issued if division + by zero is attempted, or if EXPRESSION could not be parsed. + + Expressions can contain the following operators, listed in order of + decreasing precedence. + + `()' + Parentheses + + `+ - ~ !' + Unary plus and minus, and bitwise and logical negation + + `**' + Exponentiation + + `* / %' + Multiplication, division, and modulo + + `+ -' + Addition and subtraction + + `<< >>' + Shift left or right + + `> >= < <=' + Relational operators + + `== !=' + Equality operators + + `&' + Bitwise and + + `^' + Bitwise exclusive-or + + `|' + Bitwise or + + `&&' + Logical and + + `||' + Logical or + + The macro `eval' is recognized only with parameters. + + All binary operators, except exponentiation, are left associative. C +operators that perform variable assignment, such as `+=' or `--', are +not implemented, since `eval' only operates on constants, not +variables. Attempting to use them results in an error. However, since +traditional implementations treated `=' as an undocumented alias for +`==' as opposed to an assignment operator, this usage is supported as a +special case. Be aware that a future version of GNU M4 may support +assignment semantics as an extension when POSIX mode is not requested, +and that using `=' to check equality is not portable. + + eval(`2 = 2') + error-->m4:stdin:1: Warning: recommend ==, not =, for equality operator + =>1 + eval(`++0') + error-->m4:stdin:2: invalid operator in eval: ++0 + => + eval(`0 |= 1') + error-->m4:stdin:3: invalid operator in eval: 0 |= 1 + => + + Note that some older `m4' implementations use `^' as an alternate +operator for the exponentiation, although POSIX requires the C behavior +of bitwise exclusive-or. The precedence of the negation operators, `~' +and `!', was traditionally lower than equality. The unary operators +could not be used reliably more than once on the same term without +intervening parentheses. The traditional precedence of the equality +operators `==' and `!=' was identical instead of lower than the +relational operators such as `<', even through GNU M4 1.4.8. Starting +with version 1.4.9, GNU M4 correctly follows POSIX precedence rules. +M4 scripts designed to be portable between releases must be aware that +parentheses may be required to enforce C precedence rules. Likewise, +division by zero, even in the unused branch of a short-circuiting +operator, is not always well-defined in other implementations. + + Following are some examples where the current version of M4 follows C +precedence rules, but where older versions and some other +implementations of `m4' require explicit parentheses to get the correct +result: + + eval(`1 == 2 > 0') + =>1 + eval(`(1 == 2) > 0') + =>0 + eval(`! 0 * 2') + =>2 + eval(`! (0 * 2)') + =>1 + eval(`1 | 1 ^ 1') + =>1 + eval(`(1 | 1) ^ 1') + =>0 + eval(`+ + - ~ ! ~ 0') + =>1 + eval(`2 || 1 / 0') + =>1 + eval(`0 || 1 / 0') + error-->m4:stdin:9: divide by zero in eval: 0 || 1 / 0 + => + eval(`0 && 1 % 0') + =>0 + eval(`2 && 1 % 0') + error-->m4:stdin:11: modulo by zero in eval: 2 && 1 % 0 + => + + As a GNU extension, the operator `**' performs integral +exponentiation. The operator is right-associative, and if evaluated, +the exponent must be non-negative, and at least one of the arguments +must be non-zero, or a warning is issued. + + eval(`2 ** 3 ** 2') + =>512 + eval(`(2 ** 3) ** 2') + =>64 + eval(`0 ** 1') + =>0 + eval(`2 ** 0') + =>1 + eval(`0 ** 0') + => + error-->m4:stdin:5: divide by zero in eval: 0 ** 0 + eval(`4 ** -2') + error-->m4:stdin:6: negative exponent in eval: 4 ** -2 + => + + Within EXPRESSION, (but not RADIX or WIDTH), numbers without a +special prefix are decimal. A simple `0' prefix introduces an octal +number. `0x' introduces a hexadecimal number. As GNU extensions, `0b' +introduces a binary number. `0r' introduces a number expressed in any +radix between 1 and 36: the prefix should be immediately followed by +the decimal expression of the radix, a colon, then the digits making +the number. For radix 1, leading zeros are ignored, and all remaining +digits must be `1'; for all other radices, the digits are `0', `1', `2', +.... Beyond `9', the digits are `a', `b' ... up to `z'. Lower and +upper case letters can be used interchangeably in numbers prefixes and +as number digits. + + Parentheses may be used to group subexpressions whenever needed. +For the relational operators, a true relation returns `1', and a false +relation return `0'. + + Here are a few examples of use of `eval'. + + eval(`-3 * 5') + =>-15 + eval(`-99 / 10') + =>-9 + eval(`-99 % 10') + =>-9 + eval(`99 % -10') + =>9 + eval(index(`Hello world', `llo') >= 0) + =>1 + eval(`0r1:0111 + 0b100 + 0r3:12') + =>12 + define(`square', `eval(`($1) ** 2')') + => + square(`9') + =>81 + square(square(`5')` + 1') + =>676 + define(`foo', `666') + => + eval(`foo / 6') + error-->m4:stdin:11: bad expression in eval: foo / 6 + => + eval(foo / 6) + =>111 + + As the last two lines show, `eval' does not handle macro names, even +if they expand to a valid expression (or part of a valid expression). +Therefore all macros must be expanded before they are passed to `eval'. + + Some calculations are not portable to other implementations, since +they have undefined semantics in C, but GNU `m4' has well-defined +behavior on overflow. When shifting, an out-of-range shift amount is +implicitly brought into the range of 32-bit signed integers using an +implicit bit-wise and with 0x1f). + + define(`max_int', eval(`0x7fffffff')) + => + define(`min_int', incr(max_int)) + => + eval(min_int` < 0') + =>1 + eval(max_int` > 0') + =>1 + ifelse(eval(min_int` / -1'), min_int, `overflow occurred') + =>overflow occurred + min_int + =>-2147483648 + eval(`0x80000000 % -1') + =>0 + eval(`-4 >> 1') + =>-2 + eval(`-4 >> 33') + =>-2 + + If RADIX is specified, it specifies the radix to be used in the +expansion. The default radix is 10; this is also the case if RADIX is +the empty string. A warning results if the radix is outside the range +of 1 through 36, inclusive. The result of `eval' is always taken to be +signed. No radix prefix is output, and for radices greater than 10, +the digits are lower case. The WIDTH argument specifies the minimum +output width, excluding any negative sign. The result is zero-padded +to extend the expansion to the requested width. A warning results if +the width is negative. If RADIX or WIDTH is out of bounds, the +expansion of `eval' is empty. + + eval(`666', `10') + =>666 + eval(`666', `11') + =>556 + eval(`666', `6') + =>3030 + eval(`666', `6', `10') + =>0000003030 + eval(`-666', `6', `10') + =>-0000003030 + eval(`10', `', `0') + =>10 + `0r1:'eval(`10', `1', `11') + =>0r1:01111111111 + eval(`10', `16') + =>a + eval(`1', `37') + error-->m4:stdin:9: radix 37 in builtin `eval' out of range + => + eval(`1', , `-1') + error-->m4:stdin:10: negative width to builtin `eval' + => + eval() + error-->m4:stdin:11: empty string treated as 0 in builtin `eval' + =>0 + + +File: m4.info, Node: Shell commands, Next: Miscellaneous, Prev: Arithmetic, Up: Top + +13 Macros for running shell commands +************************************ + +There are a few builtin macros in `m4' that allow you to run shell +commands from within `m4'. + + Note that the definition of a valid shell command is system +dependent. On UNIX systems, this is the typical `/bin/sh'. But on +other systems, such as native Windows, the shell has a different syntax +of commands that it understands. Some examples in this chapter assume +`/bin/sh', and also demonstrate how to quit early with a known exit +value if this is not the case. + +* Menu: + +* Platform macros:: Determining the platform +* Syscmd:: Executing simple commands +* Esyscmd:: Reading the output of commands +* Sysval:: Exit status +* Mkstemp:: Making temporary files + + +File: m4.info, Node: Platform macros, Next: Syscmd, Up: Shell commands + +13.1 Determining the platform +============================= + +Sometimes it is desirable for an input file to know which platform `m4' +is running on. GNU `m4' provides several macros that are predefined to +expand to the empty string; checking for their existence will confirm +platform details. + + -- Optional builtin: __gnu__ + -- Optional builtin: __os2__ + -- Optional builtin: os2 + -- Optional builtin: __unix__ + -- Optional builtin: unix + -- Optional builtin: __windows__ + -- Optional builtin: windows + Each of these macros is conditionally defined as needed to + describe the environment of `m4'. If defined, each macro expands + to the empty string. For now, these macros silently ignore all + arguments, but in a future release of M4, they might warn if + arguments are present. + + When GNU extensions are in effect (that is, when you did not use the +`-G' option, *note Invoking m4: Limits control.), GNU `m4' will define +the macro `__gnu__' to expand to the empty string. + + $ m4 + __gnu__ + => + __gnu__(`ignored') + => + Extensions are ifdef(`__gnu__', `active', `inactive') + =>Extensions are active + + $ m4 -G + __gnu__ + =>__gnu__ + __gnu__(`ignored') + =>__gnu__(ignored) + Extensions are ifdef(`__gnu__', `active', `inactive') + =>Extensions are inactive + + On UNIX systems, GNU `m4' will define `__unix__' by default, or +`unix' when the `-G' option is specified. + + On native Windows systems, GNU `m4' will define `__windows__' by +default, or `windows' when the `-G' option is specified. + + On OS/2 systems, GNU `m4' will define `__os2__' by default, or `os2' +when the `-G' option is specified. + + If GNU `m4' does not provide a platform macro for your system, +please report that as a bug. + + define(`provided', `0') + => + ifdef(`__unix__', `define(`provided', incr(provided))') + => + ifdef(`__windows__', `define(`provided', incr(provided))') + => + ifdef(`__os2__', `define(`provided', incr(provided))') + => + provided + =>1 + + +File: m4.info, Node: Syscmd, Next: Esyscmd, Prev: Platform macros, Up: Shell commands + +13.2 Executing simple commands +============================== + +Any shell command can be executed, using `syscmd': + + -- Builtin: syscmd (SHELL-COMMAND) + Executes SHELL-COMMAND as a shell command. + + The expansion of `syscmd' is void, _not_ the output from + SHELL-COMMAND! Output or error messages from SHELL-COMMAND are + not read by `m4'. *Note Esyscmd::, if you need to process the + command output. + + Prior to executing the command, `m4' flushes its buffers. The + default standard input, output and error of SHELL-COMMAND are the + same as those of `m4'. + + The macro `syscmd' is recognized only with parameters. + + define(`foo', `FOO') + => + syscmd(`echo foo') + =>foo + => + + Note how the expansion of `syscmd' keeps the trailing newline of the +command, as well as using the newline that appeared after the macro. + + The following is an example of SHELL-COMMAND using the same standard +input as `m4': + + $ echo "m4wrap(\`syscmd(\`cat')')" | m4 + => + + It tells `m4' to read all of its input before executing the wrapped +text, then hand a valid (albeit emptied) pipe as standard input for the +`cat' subcommand. Therefore, you should be careful when using standard +input (either by specifying no files, or by passing `-' as a file name +on the command line, *note Invoking m4: Command line files.), and also +invoking subcommands via `syscmd' or `esyscmd' that consume data from +standard input. When standard input is a seekable file, the subprocess +will pick up with the next character not yet processed by `m4'; when it +is a pipe or other non-seekable file, there is no guarantee how much +data will already be buffered by `m4' and thus unavailable to the child. + + +File: m4.info, Node: Esyscmd, Next: Sysval, Prev: Syscmd, Up: Shell commands + +13.3 Reading the output of commands +=================================== + +If you want `m4' to read the output of a shell command, use `esyscmd': + + -- Builtin: esyscmd (SHELL-COMMAND) + Expands to the standard output of the shell command SHELL-COMMAND. + + Prior to executing the command, `m4' flushes its buffers. The + default standard input and standard error of SHELL-COMMAND are the + same as those of `m4'. The error output of SHELL-COMMAND is not a + part of the expansion: it will appear along with the error output + of `m4'. + + The macro `esyscmd' is recognized only with parameters. + + define(`foo', `FOO') + => + esyscmd(`echo foo') + =>FOO + => + + Note how the expansion of `esyscmd' keeps the trailing newline of +the command, as well as using the newline that appeared after the macro. + + Just as with `syscmd', care must be exercised when sharing standard +input between `m4' and the child process of `esyscmd'. + + +File: m4.info, Node: Sysval, Next: Mkstemp, Prev: Esyscmd, Up: Shell commands + +13.4 Exit status +================ + +To see whether a shell command succeeded, use `sysval': + + -- Builtin: sysval + Expands to the exit status of the last shell command run with + `syscmd' or `esyscmd'. Expands to 0 if no command has been run + yet. + + sysval + =>0 + syscmd(`false') + => + ifelse(sysval, `0', `zero', `non-zero') + =>non-zero + syscmd(`exit 2') + => + sysval + =>2 + syscmd(`true') + => + sysval + =>0 + esyscmd(`false') + => + ifelse(sysval, `0', `zero', `non-zero') + =>non-zero + esyscmd(`exit 2') + => + sysval + =>2 + esyscmd(`true') + => + sysval + =>0 + + `sysval' results in 127 if there was a problem executing the +command, for example, if the system-imposed argument length is exceeded, +or if there were not enough resources to fork. It is not possible to +distinguish between failed execution and successful execution that had +an exit status of 127. + + On UNIX platforms, where it is possible to detect when command +execution is terminated by a signal, rather than a normal exit, the +result is the signal number shifted left by eight bits. + + dnl This test assumes kill is a shell builtin, and that signals are + dnl recognizable. + ifdef(`__unix__', , + `errprint(` skipping: syscmd does not have unix semantics + ')m4exit(`77')')dnl + syscmd(`kill -9 $$') + => + sysval + =>2304 + syscmd() + => + sysval + =>0 + esyscmd(`kill -9 $$') + => + sysval + =>2304 + + +File: m4.info, Node: Mkstemp, Prev: Sysval, Up: Shell commands + +13.5 Making temporary files +=========================== + +Commands specified to `syscmd' or `esyscmd' might need a temporary +file, for output or for some other purpose. There is a builtin macro, +`mkstemp', for making a temporary file: + + -- Builtin: mkstemp (TEMPLATE) + -- Builtin: maketemp (TEMPLATE) + Expands to the quoted name of a new, empty file, made from the + string TEMPLATE, which should end with the string `XXXXXX'. The + six `X' characters are then replaced with random characters + matching the regular expression `[a-zA-Z0-9._-]', in order to make + the file name unique. If fewer than six `X' characters are found + at the end of `template', the result will be longer than the + template. The created file will have access permissions as if by + `chmod =rw,go=', meaning that the current umask of the `m4' + process is taken into account, and at most only the current user + can read and write the file. + + The traditional behavior, standardized by POSIX, is that + `maketemp' merely replaces the trailing `X' with the process id, + without creating a file or quoting the expansion, and without + ensuring that the resulting string is a unique file name. In + part, this means that using the same TEMPLATE twice in the same + input file will result in the same expansion. This behavior is a + security hole, as it is very easy for another process to guess the + name that will be generated, and thus interfere with a subsequent + use of `syscmd' trying to manipulate that file name. Hence, POSIX + has recommended that all new implementations of `m4' provide the + secure `mkstemp' builtin, and that users of `m4' check for its + existence. + + The expansion is void and an error issued if a temporary file could + not be created. + + The macros `mkstemp' and `maketemp' are recognized only with + parameters. + + If you try this next example, you will most likely get different +output for the two file names, since the replacement characters are +randomly chosen: + + $ m4 + define(`tmp', `oops') + => + maketemp(`/tmp/fooXXXXXX') + =>/tmp/fooa07346 + ifdef(`mkstemp', `define(`maketemp', defn(`mkstemp'))', + `define(`mkstemp', defn(`maketemp'))dnl + errprint(`warning: potentially insecure maketemp implementation + ')') + => + mkstemp(`doc') + =>docQv83Uw + + Unless you use the `--traditional' command line option (or `-G', +*note Invoking m4: Limits control.), the GNU version of `maketemp' is +secure. This means that using the same template to multiple calls will +generate multiple files. However, we recommend that you use the new +`mkstemp' macro, introduced in GNU M4 1.4.8, which is secure even in +traditional mode. Also, as of M4 1.4.11, the secure implementation +quotes the resulting file name, so that you are guaranteed to know what +file was created even if the random file name happens to match an +existing macro. Notice that this example is careful to use `defn' to +avoid unintended expansion of `foo'. + + $ m4 + define(`foo', `errprint(`oops')') + => + syscmd(`rm -f foo-??????')sysval + =>0 + define(`file1', maketemp(`foo-XXXXXX'))dnl + ifelse(esyscmd(`echo \` foo-?????? \''), ` foo-?????? ', + `no file', `created') + =>created + define(`file2', maketemp(`foo-XX'))dnl + define(`file3', mkstemp(`foo-XXXXXX'))dnl + ifelse(len(defn(`file1')), len(defn(`file2')), + `same length', `different') + =>same length + ifelse(defn(`file1'), defn(`file2'), `same', `different file') + =>different file + ifelse(defn(`file2'), defn(`file3'), `same', `different file') + =>different file + ifelse(defn(`file1'), defn(`file3'), `same', `different file') + =>different file + syscmd(`rm 'defn(`file1') defn(`file2') defn(`file3')) + => + sysval + =>0 + + +File: m4.info, Node: Miscellaneous, Next: Frozen files, Prev: Shell commands, Up: Top + +14 Miscellaneous builtin macros +******************************* + +This chapter describes various builtins, that do not really belong in +any of the previous chapters. + +* Menu: + +* Errprint:: Printing error messages +* Location:: Printing current location +* M4exit:: Exiting from `m4' + + +File: m4.info, Node: Errprint, Next: Location, Up: Miscellaneous + +14.1 Printing error messages +============================ + +You can print error messages using `errprint': + + -- Builtin: errprint (MESSAGE, ...) + Prints MESSAGE and the rest of the arguments to standard error, + separated by spaces. Standard error is used, regardless of the + `--debugfile' option (*note Invoking m4: Debugging options.). + + The expansion of `errprint' is void. The macro `errprint' is + recognized only with parameters. + + errprint(`Invalid arguments to forloop + ') + error-->Invalid arguments to forloop + => + errprint(`1')errprint(`2',`3 + ') + error-->12 3 + => + + A trailing newline is _not_ printed automatically, so it should be +supplied as part of the argument, as in the example. Unfortunately, the +exact output of `errprint' is not very portable to other `m4' +implementations: POSIX requires that all arguments be printed, but some +implementations of `m4' only print the first. Furthermore, some BSD +implementations always append a newline for each `errprint' call, +regardless of whether the last argument already had one, and POSIX is +silent on whether this is acceptable. + + +File: m4.info, Node: Location, Next: M4exit, Prev: Errprint, Up: Miscellaneous + +14.2 Printing current location +============================== + +To make it possible to specify the location of an error, three utility +builtins exist: + + -- Builtin: __file__ + -- Builtin: __line__ + -- Builtin: __program__ + Expand to the quoted name of the current input file, the current + input line number in that file, and the quoted name of the current + invocation of `m4'. + + errprint(__program__:__file__:__line__: `input error + ') + error-->m4:stdin:1: input error + => + + Line numbers start at 1 for each file. If the file was found due to +the `-I' option or `M4PATH' environment variable, that is reflected in +the file name. The syncline option (`-s', *note Invoking m4: +Preprocessor features.), and the `f' and `l' flags of `debugmode' +(*note Debug Levels::), also use this notion of current file and line. +Redefining the three location macros has no effect on syncline, debug, +warning, or error message output. + + This example reuses the file `incl.m4' mentioned earlier (*note +Include::): + + $ m4 -I examples + define(`foo', ``$0' called at __file__:__line__') + => + foo + =>foo called at stdin:2 + include(`incl.m4') + =>Include file start + =>foo called at ../examples/incl.m4:2 + =>Include file end + => + + The location of macros invoked during the rescanning of macro +expansion text corresponds to the location in the file where the +expansion was triggered, regardless of how many newline characters the +expansion text contains. As of GNU M4 1.4.8, the location of text +wrapped with `m4wrap' (*note M4wrap::) is the point at which the +`m4wrap' was invoked. Previous versions, however, behaved as though +wrapped text came from line 0 of the file "". + + define(`echo', `$@') + => + define(`foo', `echo(__line__ + __line__)') + => + echo(__line__ + __line__) + =>4 + =>5 + m4wrap(`foo + ') + => + foo(errprint(__line__ + __line__ + )) + error-->8 + error-->9 + =>8 + =>8 + __line__ + =>11 + m4wrap(`__line__ + ') + => + ^D + =>12 + =>6 + =>6 + + The `__program__' macro behaves like `$0' in shell terminology. If +you invoke `m4' through an absolute path or a link with a different +spelling, rather than by relying on a `PATH' search for plain `m4', it +will affect how `__program__' expands. The intent is that you can use +it to produce error messages with the same formatting that `m4' +produces internally. It can also be used within `syscmd' (*note +Syscmd::) to pick the same version of `m4' that is currently running, +rather than whatever version of `m4' happens to be first in `PATH'. It +was first introduced in GNU M4 1.4.6. + + +File: m4.info, Node: M4exit, Prev: Location, Up: Miscellaneous + +14.3 Exiting from `m4' +====================== + +If you need to exit from `m4' before the entire input has been read, +you can use `m4exit': + + -- Builtin: m4exit ([CODE = `0']) + Causes `m4' to exit, with exit status CODE. If CODE is left out, + the exit status is zero. If CODE cannot be parsed, or is outside + the range of 0 to 255, the exit status is one. No further input + is read, and all wrapped and diverted text is discarded. + + m4wrap(`This text is lost due to `m4exit'.') + => + divert(`1') So is this. + divert + => + m4exit And this is never read. + + A common use of this is to abort processing: + + -- Composite: fatal_error (MESSAGE) + Abort processing with an error message and non-zero status. Prefix + MESSAGE with details about where the error occurred, and print the + resulting string to standard error. + + define(`fatal_error', + `errprint(__program__:__file__:__line__`: fatal error: $* + ')m4exit(`1')') + => + fatal_error(`this is a BAD one, buster') + error-->m4:stdin:4: fatal error: this is a BAD one, buster + + After this macro call, `m4' will exit with exit status 1. This macro +is only intended for error exits, since the normal exit procedures are +not followed, i.e., diverted text is not undiverted, and saved text +(*note M4wrap::) is not reread. (This macro could be made more robust +to earlier versions of `m4'. You should try to see if you can find +weaknesses and correct them; or *note Answers: Improved fatal_error.). + + Note that it is still possible for the exit status to be different +than what was requested by `m4exit'. If `m4' detects some other error, +such as a write error on standard output, the exit status will be +non-zero even if `m4exit' requested zero. + + If standard input is seekable, then the file will be positioned at +the next unread character. If it is a pipe or other non-seekable file, +then there are no guarantees how much data `m4' might have read into +buffers, and thus discarded. + + +File: m4.info, Node: Frozen files, Next: Compatibility, Prev: Miscellaneous, Up: Top + +15 Fast loading of frozen state +******************************* + +Some bigger `m4' applications may be built over a common base +containing hundreds of definitions and other costly initializations. +Usually, the common base is kept in one or more declarative files, +which files are listed on each `m4' invocation prior to the user's +input file, or else each input file uses `include'. + + Reading the common base of a big application, over and over again, +may be time consuming. GNU `m4' offers some machinery to speed up the +start of an application using lengthy common bases. + +* Menu: + +* Using frozen files:: Using frozen files +* Frozen file format:: Frozen file format + + +File: m4.info, Node: Using frozen files, Next: Frozen file format, Up: Frozen files + +15.1 Using frozen files +======================= + +Suppose a user has a library of `m4' initializations in `base.m4', +which is then used with multiple input files: + + $ m4 base.m4 input1.m4 + $ m4 base.m4 input2.m4 + $ m4 base.m4 input3.m4 + + Rather than spending time parsing the fixed contents of `base.m4' +every time, the user might rather execute: + + $ m4 -F base.m4f base.m4 + +once, and further execute, as often as needed: + + $ m4 -R base.m4f input1.m4 + $ m4 -R base.m4f input2.m4 + $ m4 -R base.m4f input3.m4 + +with the varying input. The first call, containing the `-F' option, +only reads and executes file `base.m4', defining various application +macros and computing other initializations. Once the input file +`base.m4' has been completely processed, GNU `m4' produces in +`base.m4f' a "frozen" file, that is, a file which contains a kind of +snapshot of the `m4' internal state. + + Later calls, containing the `-R' option, are able to reload the +internal state of `m4', from `base.m4f', _prior_ to reading any other +input files. This means instead of starting with a virgin copy of +`m4', input will be read after having effectively recovered the effect +of a prior run. In our example, the effect is the same as if file +`base.m4' has been read anew. However, this effect is achieved a lot +faster. + + Only one frozen file may be created or read in any one `m4' +invocation. It is not possible to recover two frozen files at once. +However, frozen files may be updated incrementally, through using `-R' +and `-F' options simultaneously. For example, if some care is taken, +the command: + + $ m4 file1.m4 file2.m4 file3.m4 file4.m4 + +could be broken down in the following sequence, accumulating the same +output: + + $ m4 -F file1.m4f file1.m4 + $ m4 -R file1.m4f -F file2.m4f file2.m4 + $ m4 -R file2.m4f -F file3.m4f file3.m4 + $ m4 -R file3.m4f file4.m4 + + Some care is necessary because not every effort has been made for +this to work in all cases. In particular, the trace attribute of +macros is not handled, nor the current setting of `changeword'. +Currently, `m4wrap' and `sysval' also have problems. Also, +interactions for some options of `m4', being used in one call and not +in the next, have not been fully analyzed yet. On the other end, you +may be confident that stacks of `pushdef' definitions are handled +correctly, as well as undefined or renamed builtins, and changed +strings for quotes or comments. And future releases of GNU M4 will +improve on the utility of frozen files. + + When an `m4' run is to be frozen, the automatic undiversion which +takes place at end of execution is inhibited. Instead, all positively +numbered diversions are saved into the frozen file. The active +diversion number is also transmitted. + + A frozen file to be reloaded need not reside in the current +directory. It is looked up the same way as an `include' file (*note +Search Path::). + + If the frozen file was generated with a newer version of `m4', and +contains directives that an older `m4' cannot parse, attempting to load +the frozen file with option `-R' will cause `m4' to exit with status 63 +to indicate version mismatch. + + +File: m4.info, Node: Frozen file format, Prev: Using frozen files, Up: Frozen files + +15.2 Frozen file format +======================= + +Frozen files are sharable across architectures. It is safe to write a +frozen file on one machine and read it on another, given that the +second machine uses the same or newer version of GNU `m4'. It is +conventional, but not required, to give a frozen file the suffix of +`.m4f'. + + These are simple (editable) text files, made up of directives, each +starting with a capital letter and ending with a newline (<NL>). +Wherever a directive is expected, the character `#' introduces a +comment line; empty lines are also ignored if they are not part of an +embedded string. In the following descriptions, each LEN refers to the +length of the corresponding strings STR in the next line of input. +Numbers are always expressed in decimal. There are no escape +characters. The directives are: + +`C LEN1 , LEN2 <NL> STR1 STR2 <NL>' + Uses STR1 and STR2 as the begin-comment and end-comment strings. + If omitted, then `#' and <NL> are the comment delimiters. + +`D NUMBER, LEN <NL> STR <NL>' + Selects diversion NUMBER, making it current, then copy STR in the + current diversion. NUMBER may be a negative number for a + non-existing diversion. To merely specify an active selection, + use this command with an empty STR. With 0 as the diversion + NUMBER, STR will be issued on standard output at reload time. GNU + `m4' will not produce the `D' directive with non-zero length for + diversion 0, but this can be done with manual edits. This + directive may appear more than once for the same diversion, in + which case the diversion is the concatenation of the various uses. + If omitted, then diversion 0 is current. + +`F LEN1 , LEN2 <NL> STR1 STR2 <NL>' + Defines, through `pushdef', a definition for STR1 expanding to the + function whose builtin name is STR2. If the builtin does not + exist (for example, if the frozen file was produced by a copy of + `m4' compiled with changeword support, but the version of `m4' + reloading was compiled without it), the reload is silent, but any + subsequent use of the definition of STR1 will result in a warning. + This directive may appear more than once for the same name, and + its order, along with `T', is important. If omitted, you will + have no access to any builtins. + +`Q LEN1 , LEN2 <NL> STR1 STR2 <NL>' + Uses STR1 and STR2 as the begin-quote and end-quote strings. If + omitted, then ``' and `'' are the quote delimiters. + +`T LEN1 , LEN2 <NL> STR1 STR2 <NL>' + Defines, though `pushdef', a definition for STR1 expanding to the + text given by STR2. This directive may appear more than once for + the same name, and its order, along with `F', is important. + +`V NUMBER <NL>' + Confirms the format of the file. `m4' 1.4.11 only creates and + understands frozen files where NUMBER is 1. This directive must + be the first non-comment in the file, and may not appear more than + once. + + +File: m4.info, Node: Compatibility, Next: Answers, Prev: Frozen files, Up: Top + +16 Compatibility with other versions of `m4' +******************************************** + +This chapter describes the many of the differences between this +implementation of `m4', and of other implementations found under UNIX, +such as System V Release 3, Solaris, and BSD flavors. In particular, +it lists the known differences and extensions to POSIX. However, the +list is not necessarily comprehensive. + + At the time of this writing, POSIX 2001 (also known as IEEE Std +1003.1-2001) is the latest standard, although a new version of POSIX is +under development and includes several proposals for modifying what +`m4' is required to do. The requirements for `m4' are shared between +SUSv3 and POSIX, and can be viewed at +`http://www.opengroup.org/onlinepubs/000095399/utilities/m4.html'. + +* Menu: + +* Extensions:: Extensions in GNU M4 +* Incompatibilities:: Facilities in System V m4 not in GNU M4 +* Other Incompatibilities:: Other incompatibilities + + +File: m4.info, Node: Extensions, Next: Incompatibilities, Up: Compatibility + +16.1 Extensions in GNU M4 +========================= + +This version of `m4' contains a few facilities that do not exist in +System V `m4'. These extra facilities are all suppressed by using the +`-G' command line option (*note Invoking m4: Limits control.), unless +overridden by other command line options. + + * In the `$N' notation for macro arguments, N can contain several + digits, while the System V `m4' only accepts one digit. This + allows macros in GNU `m4' to take any number of arguments, and not + only nine (*note Arguments::). + + This means that `define(`foo', `$11')' is ambiguous between + implementations. To portably choose between grabbing the first + parameter and appending 1 to the expansion, or grabbing the + eleventh parameter, you can do the following: + + define(`a1', `A1') + => + dnl First argument, concatenated with 1 + define(`_1', `$1')define(`first1', `_1($@)1') + => + dnl Eleventh argument, portable + define(`_9', `$9')define(`eleventh', `_9(shift(shift($@)))') + => + dnl Eleventh argument, GNU style + define(`Eleventh', `$11') + => + first1(`a', `b', `c', `d', `e', `f', `g', `h', `i', `j', `k') + =>A1 + eleventh(`a', `b', `c', `d', `e', `f', `g', `h', `i', `j', `k') + =>k + Eleventh(`a', `b', `c', `d', `e', `f', `g', `h', `i', `j', `k') + =>k + + Also see the `argn' macro (*note Shift::). + + * The `divert' (*note Divert::) macro can manage more than 9 + diversions. GNU `m4' treats all positive numbers as valid + diversions, rather than discarding diversions greater than 9. + + * Files included with `include' and `sinclude' are sought in a user + specified search path, if they are not found in the working + directory. The search path is specified by the `-I' option and the + `M4PATH' environment variable (*note Search Path::). + + * Arguments to `undivert' can be non-numeric, in which case the named + file will be included uninterpreted in the output (*note + Undivert::). + + * Formatted output is supported through the `format' builtin, which + is modeled after the C library function `printf' (*note Format::). + + * Searches and text substitution through basic regular expressions + are supported by the `regexp' (*note Regexp::) and `patsubst' + (*note Patsubst::) builtins. Some BSD implementations use + extended regular expressions instead. + + * The output of shell commands can be read into `m4' with `esyscmd' + (*note Esyscmd::). + + * There is indirect access to any builtin macro with `builtin' + (*note Builtin::). + + * Macros can be called indirectly through `indir' (*note Indir::). + + * The name of the program, the current input file, and the current + input line number are accessible through the builtins + `__program__', `__file__', and `__line__' (*note Location::). + + * The format of the output from `dumpdef' and macro tracing can be + controlled with `debugmode' (*note Debug Levels::). + + * The destination of trace and debug output can be controlled with + `debugfile' (*note Debug Output::). + + * The `maketemp' (*note Mkstemp::) macro behaves like `mkstemp', + creating a new file with a unique name on every invocation, rather + than following the insecure behavior of replacing the trailing `X' + characters with the `m4' process id. + + * POSIX only requires support for the command line options `-s', + `-D', and `-U', so all other options accepted by GNU M4 are + extensions. *Note Invoking m4::, for a description of these + options. + + The debugging and tracing facilities in GNU `m4' are much more + extensive than in most other versions of `m4'. + + +File: m4.info, Node: Incompatibilities, Next: Other Incompatibilities, Prev: Extensions, Up: Compatibility + +16.2 Facilities in System V `m4' not in GNU `m4' +================================================ + +The version of `m4' from System V contains a few facilities that have +not been implemented in GNU `m4' yet. Additionally, POSIX requires +some behaviors that GNU `m4' has not implemented yet. Relying on these +behaviors is non-portable, as a future release of GNU `m4' may change. + + * POSIX requires support for multiple arguments to `defn', without + any clarification on how `defn' behaves when one of the multiple + arguments names a builtin. System V `m4' and some other + implementations allow mixing builtins and text macros into a single + macro. GNU `m4' only supports joining multiple text arguments, + although a future implementation may lift this restriction to + behave more like System V. The only portable way to join text + macros with builtins is via helper macros and implicit + concatenation of macro results. + + * POSIX requires an application to exit with non-zero status if it + wrote an error message to stderr. This has not yet been + consistently implemented for the various builtins that are + required to issue an error (such as `eval' (*note Eval::) when an + argument cannot be parsed). + + * Some traditional implementations only allow reading standard input + once, but GNU `m4' correctly handles multiple instances of `-' on + the command line. + + * POSIX requires `m4wrap' (*note M4wrap::) to act in FIFO (first-in, + first-out) order, but GNU `m4' currently uses LIFO order. + Furthermore, POSIX states that only the first argument to `m4wrap' + is saved for later evaluation, bug GNU `m4' saves and processes + all arguments, with output separated by spaces. + + * POSIX states that builtins that require arguments, but are called + without arguments, have undefined behavior. Traditional + implementations simply behave as though empty strings had been + passed. For example, `a`'define`'b' would expand to `ab'. But + GNU `m4' ignores certain builtins if they have missing arguments, + giving `adefineb' for the above example. + + * Traditional implementations handle `define(`f',`1')' (*note + Define::) by undefining the entire stack of previous definitions, + and if doing `undefine(`f')' first. GNU `m4' replaces just the top + definition on the stack, as if doing `popdef(`f')' followed by + `pushdef(`f',`1')'. POSIX allows either behavior. + + * POSIX 2001 requires `syscmd' (*note Syscmd::) to evaluate command + output for macro expansion, but this was a mistake that is + anticipated to be corrected in the next version of POSIX. GNU + `m4' follows traditional behavior in `syscmd' where output is not + rescanned, and provides the extension `esyscmd' that does scan the + output. + + * At one point, POSIX required `changequote(ARG)' (*note + Changequote::) to use newline as the close quote, but this was a + bug, and the next version of POSIX is anticipated to state that + using empty strings or just one argument is unspecified. + Meanwhile, the GNU `m4' behavior of treating an empty end-quote + delimiter as `'' is not portable, as Solaris treats it as + repeating the start-quote delimiter, and BSD treats it as leaving + the previous end-quote delimiter unchanged. For predictable + results, never call changequote with just one argument, or with + empty strings for arguments. + + * At one point, POSIX required `changecom(ARG,)' (*note Changecom::) + to make it impossible to end a comment, but this is a bug, and the + next version of POSIX is anticipated to state that using empty + strings is unspecified. Meanwhile, the GNU `m4' behavior of + treating an empty end-comment delimiter as newline is not + portable, as BSD treats it as leaving the previous end-comment + delimiter unchanged. It is also impossible in BSD implementations + to disable comments, even though that is required by POSIX. For + predictable results, never call changecom with empty strings for + arguments. + + * Most implementations of `m4' give macros a higher precedence than + comments when parsing, meaning that if the start delimiter given to + `changecom' (*note Changecom::) starts with a macro name, comments + are effectively disabled. POSIX does not specify what the + precedence is, so this version of GNU `m4' parser recognizes + comments, then macros, then quoted strings. + + * Traditional implementations allow argument collection, but not + string and comment processing, to span file boundaries. Thus, if + `a.m4' contains `len(', and `b.m4' contains `abc)', `m4 a.m4 b.m4' + outputs `3' with traditional `m4', but gives an error message that + the end of file was encountered inside a macro with GNU `m4'. On + the other hand, traditional implementations do end of file + processing for files included with `include' or `sinclude' (*note + Include::), while GNU `m4' seamlessly integrates the content of + those files. Thus `include(`a.m4')include(`b.m4')' will output + `3' instead of giving an error. + + * Traditional `m4' treats `traceon' (*note Trace::) without + arguments as a global variable, independent of named macro tracing. + Also, once a macro is undefined, named tracing of that macro is + lost. On the other hand, when GNU `m4' encounters `traceon' + without arguments, it turns tracing on for all existing + definitions at the time, but does not trace future definitions; + `traceoff' without arguments turns tracing off for all definitions + regardless of whether they were also traced by name; and tracing + by name, such as with `-tfoo' at the command line or + `traceon(`foo')' in the input, is an attribute that is preserved + even if the macro is currently undefined. + + * POSIX requires `eval' (*note Eval::) to treat all operators with + the same precedence as C. However, earlier versions of GNU `m4' + followed the traditional behavior of other `m4' implementations, + where bitwise and logical negation (`~' and `!') have lower + precedence than equality operators; and where equality operators + (`==' and `!=') had the same precedence as relational operators + (such as `<'). Use explicit parentheses to ensure proper + precedence. As extensions to POSIX, GNU `m4' gives well-defined + semantics to operations that C leaves undefined, such as when + overflow occurs, when shifting negative numbers, or when + performing division by zero. POSIX also requires `=' to cause an + error, but many traditional implementations allowed it as an alias + for `=='. + + * POSIX 2001 requires `translit' (*note Translit::) to treat each + character of the second and third arguments literally. However, + it is anticipated that the next version of POSIX will allow the + GNU `m4' behavior of treating `-' as a range operator. + + * POSIX requires `m4' to honor the locale environment variables of + `LANG', `LC_ALL', `LC_CTYPE', `LC_MESSAGES', and `NLSPATH', but + this has not yet been implemented in GNU `m4'. + + * POSIX states that only unquoted leading newlines and blanks (that + is, space and tab) are ignored when collecting macro arguments. + However, this appears to be a bug in POSIX, since most traditional + implementations also ignore all whitespace (formfeed, carriage + return, and vertical tab). GNU `m4' follows tradition and ignores + all leading unquoted whitespace. + + +File: m4.info, Node: Other Incompatibilities, Prev: Incompatibilities, Up: Compatibility + +16.3 Other incompatibilities +============================ + +There are a few other incompatibilities between this implementation of +`m4', and the System V version. + + * GNU `m4' implements sync lines differently from System V `m4', + when text is being diverted. GNU `m4' outputs the sync lines when + the text is being diverted, and System V `m4' when the diverted + text is being brought back. + + The problem is which lines and file names should be attached to + text that is being, or has been, diverted. System V `m4' regards + all the diverted text as being generated by the source line + containing the `undivert' call, whereas GNU `m4' regards the + diverted text as being generated at the time it is diverted. + + The sync line option is used mostly when using `m4' as a front end + to a compiler. If a diverted line causes a compiler error, the + error messages should most probably refer to the place where the + diversion was made, and not where it was inserted again. + + divert(2)2 + divert(1)1 + divert`'0 + =>#line 3 "stdin" + =>0 + ^D + =>#line 2 "stdin" + =>1 + =>#line 1 "stdin" + =>2 + + The current `m4' implementation has a limitation that the syncline + output at the start of each diversion occurs no matter what, even + if the previous diversion did not end with a newline. This goes + contrary to the claim that synclines appear on a line by + themselves, so this limitation may be corrected in a future + version of `m4'. In the meantime, when using `-s', it is wisest + to make sure all diversions end with newline. + + * GNU `m4' makes no attempt at prohibiting self-referential + definitions like: + + define(`x', `x') + => + define(`x', `x ') + => + + There is nothing inherently wrong with defining `x' to return `x'. + The wrong thing is to expand `x' unquoted, because that would + cause an infinite rescan loop. In `m4', one might use macros to + hold strings, as we do for variables in other programming + languages, further checking them with: + + ifelse(defn(`HOLDER'), `VALUE', ...) + + In cases like this one, an interdiction for a macro to hold its + own name would be a useless limitation. Of course, this leaves + more rope for the GNU `m4' user to hang himself! Rescanning hangs + may be avoided through careful programming, a little like for + endless loops in traditional programming languages. + + +File: m4.info, Node: Answers, Next: Copying This Package, Prev: Compatibility, Up: Top + +17 Correct version of some examples +*********************************** + +Some of the examples in this manuals are buggy or not very robust, for +demonstration purposes. Improved versions of these composite macros are +presented here. + +* Menu: + +* Improved exch:: Solution for `exch' +* Improved forloop:: Solution for `forloop' +* Improved foreach:: Solution for `foreach' +* Improved m4wrap:: Solution for `m4wrap' +* Improved cleardivert:: Solution for `cleardivert' +* Improved capitalize:: Solution for `capitalize' +* Improved fatal_error:: Solution for `fatal_error' + + +File: m4.info, Node: Improved exch, Next: Improved forloop, Up: Answers + +17.1 Solution for `exch' +======================== + +The `exch' macro (*note Arguments::) as presented requires clients to +double quote their arguments. A nicer definition, which lets clients +follow the rule of thumb of one level of quoting per level of +parentheses, involves adding quotes in the definition of `exch', as +follows: + + define(`exch', ``$2', `$1'') + => + define(exch(`expansion text', `macro')) + => + macro + =>expansion text + + +File: m4.info, Node: Improved forloop, Next: Improved foreach, Prev: Improved exch, Up: Answers + +17.2 Solution for `forloop' +=========================== + +The `forloop' macro (*note Forloop::) as presented earlier can go into +an infinite loop if given an iterator that is not parsed as a macro +name. It does not do any sanity checking on its numeric bounds, and +only permits decimal numbers for bounds. Here is an improved version, +shipped as `m4-1.4.11/examples/forloop2.m4'; this version also +optimizes based on the fact that the starting bound does not need to be +passed to the helper `_forloop'. + + $ m4 -I examples + undivert(`forloop2.m4')dnl + =>divert(`-1') + =># forloop(var, from, to, stmt) - improved version: + =># works even if VAR is not a strict macro name + =># performs sanity check that FROM is larger than TO + =># allows complex numerical expressions in TO and FROM + =>define(`forloop', `ifelse(eval(`($3) >= ($2)'), `1', + => `pushdef(`$1', eval(`$2'))_$0(`$1', + => eval(`$3'), `$4')popdef(`$1')')') + =>define(`_forloop', + => `$3`'ifelse(indir(`$1'), `$2', `', + => `define(`$1', incr(indir(`$1')))$0($@)')') + =>divert`'dnl + include(`forloop2.m4') + => + forloop(`i', `2', `1', `no iteration occurs') + => + forloop(`', `1', `2', ` odd iterator name') + => odd iterator name odd iterator name + forloop(`i', `5 + 5', `0xc', ` 0x`'eval(i, `16')') + => 0xa 0xb 0xc + forloop(`i', `a', `b', `non-numeric bounds') + error-->m4:stdin:6: bad expression in eval (bad input): (b) >= (a) + => + + One other change to notice is that the improved version used `_$0' +rather than `_foreach' to invoke the helper routine. In general, this +is a good practice to follow, because then the set of macros can be +uniformly transformed. The following example shows a transformation +that doubles the current quoting and appends a suffix `2' to each +transformed macro. If `foreach' refers to the literal `_foreach', then +`foreach2' invokes `_foreach' instead of the intended `_foreach2', and +the mixing of quoting paradigms leads to an infinite recursion loop in +this example. + + $ m4 -d -L 9 -I examples + define(`arg1', `$1')include(`forloop2.m4')include(`quote.m4') + => + define(`double', `define(`$1'`2', + arg1(patsubst(dquote(defn(`$1')), `[`']', `\&\&')))') + => + double(`forloop')double(`_forloop')defn(`forloop2') + =>ifelse(eval(``($3) >= ($2)''), ``1'', + => ``pushdef(``$1'', eval(``$2''))_$0(``$1'', + => eval(``$3''), ``$4'')popdef(``$1'')'') + forloop(i, 1, 5, `ifelse(')forloop(i, 1, 5, `)') + => + changequote(`[', `]')changequote([``], ['']) + => + forloop2(i, 1, 5, ``ifelse('')forloop2(i, 1, 5, ``)'') + => + changequote`'include(`forloop.m4') + => + double(`forloop')double(`_forloop')defn(`forloop2') + =>pushdef(``$1'', ``$2'')_forloop($@)popdef(``$1'') + forloop(i, 1, 5, `ifelse(')forloop(i, 1, 5, `)') + => + changequote(`[', `]')changequote([``], ['']) + => + forloop2(i, 1, 5, ``ifelse('')forloop2(i, 1, 5, ``)'') + error-->m4:stdin:12: recursion limit of 9 exceeded, use -L<N> to change it + + Of course, it is possible to make even more improvements, such as +adding an optional step argument, or allowing iteration through +descending sequences. GNU Autoconf provides some of these additional +bells and whistles in its `m4_for' macro. + + +File: m4.info, Node: Improved foreach, Next: Improved m4wrap, Prev: Improved forloop, Up: Answers + +17.3 Solution for `foreach' +=========================== + +The `foreach' and `foreachq' macros (*note Foreach::) as presented +earlier each have flaws. First, we will examine and fix the quadratic +behavior of `foreachq': + + $ m4 -I examples + include(`foreachq.m4') + => + traceon(`shift')debugmode(`aq') + => + foreachq(`x', ``1', `2', `3', `4'', `x + ')dnl + =>1 + error-->m4trace: -3- shift(`1', `2', `3', `4') + error-->m4trace: -2- shift(`1', `2', `3', `4') + =>2 + error-->m4trace: -4- shift(`1', `2', `3', `4') + error-->m4trace: -3- shift(`2', `3', `4') + error-->m4trace: -3- shift(`1', `2', `3', `4') + error-->m4trace: -2- shift(`2', `3', `4') + =>3 + error-->m4trace: -5- shift(`1', `2', `3', `4') + error-->m4trace: -4- shift(`2', `3', `4') + error-->m4trace: -3- shift(`3', `4') + error-->m4trace: -4- shift(`1', `2', `3', `4') + error-->m4trace: -3- shift(`2', `3', `4') + error-->m4trace: -2- shift(`3', `4') + =>4 + error-->m4trace: -6- shift(`1', `2', `3', `4') + error-->m4trace: -5- shift(`2', `3', `4') + error-->m4trace: -4- shift(`3', `4') + error-->m4trace: -3- shift(`4') + + Each successive iteration was adding more quoted `shift' +invocations, and the entire list contents were passing through every +iteration. In general, when recursing, it is a good idea to make the +recursion use fewer arguments, rather than adding additional quoted +uses of `shift'. By doing so, `m4' uses less memory, invokes fewer +macros, is less likely to run into machine limits, and most +importantly, performs faster. The fixed version of `foreachq' can be +found in `m4-1.4.11/examples/foreachq2.m4': + + $ m4 -I examples + include(`foreachq2.m4') + => + undivert(`foreachq2.m4')dnl + =>include(`quote.m4')dnl + =>divert(`-1') + =># foreachq(x, `item_1, item_2, ..., item_n', stmt) + =># quoted list, improved version + =>define(`foreachq', `pushdef(`$1')_$0($@)popdef(`$1')') + =>define(`_arg1q', ``$1'') + =>define(`_rest', `ifelse(`$#', `1', `', `dquote(shift($@))')') + =>define(`_foreachq', `ifelse(`$2', `', `', + => `define(`$1', _arg1q($2))$3`'$0(`$1', _rest($2), `$3')')') + =>divert`'dnl + traceon(`shift')debugmode(`aq') + => + foreachq(`x', ``1', `2', `3', `4'', `x + ')dnl + =>1 + error-->m4trace: -3- shift(`1', `2', `3', `4') + =>2 + error-->m4trace: -3- shift(`2', `3', `4') + =>3 + error-->m4trace: -3- shift(`3', `4') + =>4 + + Note that the fixed version calls unquoted helper macros in +`_foreachq' to trim elements immediately; those helper macros in turn +must re-supply the layer of quotes lost in the macro invocation. +Contrast the use of `_arg1q', which quotes the first list element, with +`_arg1' of the earlier implementation that returned the first list +element directly. Additionally, by calling the helper method +immediately, the `defn(`ITERATOR')' no longer contains unexpanded +macros. + + The astute m4 programmer might notice that the solution above still +uses more memory, and thus more time, than strictly necessary. Note +that `$2', which contains an arbitrarily long quoted list, is expanded +and rescanned three times per iteration of `_foreachq'. Furthermore, +every iteration of the algorithm effectively unboxes then reboxes the +list, which costs a couple of macro invocations. It is possible to +rewrite the algorithm for a bit more speed by swapping the order of the +arguments to `_foreachq' in order to operate on an unboxed list in the +first place, and by using the fixed-length `$#' instead of an arbitrary +length list as the key to end recursion. This alternative approach is +available as `m4-1.4.11/examples/foreach3.m4': + + $ m4 -I examples + include(`foreachq3.m4') + => + undivert(`foreachq3.m4')dnl + =>divert(`-1') + =># foreachq(x, `item_1, item_2, ..., item_n', stmt) + =># quoted list, alternate improved version + =>define(`foreachq', + =>`pushdef(`$1')_$0(`$1', `$3'ifelse(`$2', `', `', + => `, $2'))popdef(`$1')') + =>define(`_foreachq', `ifelse(`$#', `2', `', + => `define(`$1', `$3')$2`'$0(`$1', `$2'ifelse(`$#', `3', `', + => `, shift(shift(shift($@)))'))')') + =>divert`'dnl + traceon(`shift')debugmode(`aq') + => + foreachq(`x', ``1', `2', `3', `4'', `x + ')dnl + =>1 + error-->m4trace: -4- shift(`x', `x + error-->', `1', `2', `3', `4') + error-->m4trace: -3- shift(`x + error-->', `1', `2', `3', `4') + error-->m4trace: -2- shift(`1', `2', `3', `4') + =>2 + error-->m4trace: -4- shift(`x', `x + error-->', `2', `3', `4') + error-->m4trace: -3- shift(`x + error-->', `2', `3', `4') + error-->m4trace: -2- shift(`2', `3', `4') + =>3 + error-->m4trace: -4- shift(`x', `x + error-->', `3', `4') + error-->m4trace: -3- shift(`x + error-->', `3', `4') + error-->m4trace: -2- shift(`3', `4') + =>4 + + For yet another approach, the improved version of `foreach', +available in `m4-1.4.11/examples/foreach2.m4', simply overquotes the +arguments to `_foreach' to begin with, using `dquote_elt'. Then +`_foreach' can just use `_arg1' to remove the extra layer of quoting +that was added up front: + + $ m4 -I examples + include(`foreach2.m4') + => + undivert(`foreach2.m4')dnl + =>include(`quote.m4')dnl + =>divert(`-1') + =># foreach(x, (item_1, item_2, ..., item_n), stmt) + =># parenthesized list, improved version + =>define(`foreach', `pushdef(`$1')_$0(`$1', + => (dquote(dquote_elt$2)), `$3')popdef(`$1')') + =>define(`_arg1', `$1') + =>define(`_foreach', `ifelse(`$2', `(`')', `', + => `define(`$1', _arg1$2)$3`'$0(`$1', (dquote(shift$2)), `$3')')') + =>divert`'dnl + traceon(`shift')debugmode(`aq') + => + foreach(`x', `(`1', `2', `3', `4')', `x + ')dnl + error-->m4trace: -4- shift(`1', `2', `3', `4') + error-->m4trace: -4- shift(`2', `3', `4') + error-->m4trace: -4- shift(`3', `4') + =>1 + error-->m4trace: -3- shift(``1'', ``2'', ``3'', ``4'') + =>2 + error-->m4trace: -3- shift(``2'', ``3'', ``4'') + =>3 + error-->m4trace: -3- shift(``3'', ``4'') + =>4 + error-->m4trace: -3- shift(``4'') + + In summary, recursion over list elements is trickier than it +appeared at first glance, but provides a powerful idiom within `m4' +processing. As a final demonstration, both list styles are now able to +handle several scenarios that would wreak havoc on one or both of the +original implementations. This points out one other difference between +the list styles. `foreach' evaluates unquoted list elements only once, +in preparation for calling `_foreach', similary for `foreachq' as +provided by `foreachq3.m4'. But `foreachq', as provided by +`foreachq2.m4', evaluates unquoted list elements twice while visiting +the first list element, once in `_arg1q' and once in `_rest'. When +deciding which list style to use, one must take into account whether +repeating the side effects of unquoted list elements will have any +detrimental effects. + + $ m4 -I examples + include(`foreach2.m4') + => + include(`foreachq2.m4') + => + dnl 0-element list: + foreach(`x', `', `<x>') / foreachq(`x', `', `<x>') + => / + dnl 1-element list of empty element + foreach(`x', `()', `<x>') / foreachq(`x', ``'', `<x>') + =><> / <> + dnl 2-element list of empty elements + foreach(`x', `(`',`')', `<x>') / foreachq(`x', ``',`'', `<x>') + =><><> / <><> + dnl 1-element list of a comma + foreach(`x', `(`,')', `<x>') / foreachq(`x', ``,'', `<x>') + =><,> / <,> + dnl 2-element list of unbalanced parentheses + foreach(`x', `(`(', `)')', `<x>') / foreachq(`x', ``(', `)'', `<x>') + =><(><)> / <(><)> + define(`ab', `oops')dnl using defn(`iterator') + foreach(`x', `(`a', `b')', `defn(`x')') /dnl + foreachq(`x', ``a', `b'', `defn(`x')') + =>ab / ab + define(`active', `ACT, IVE') + => + traceon(`active') + => + dnl list of unquoted macros; expansion occurs before recursion + foreach(`x', `(active, active)', `<x> + ')dnl + error-->m4trace: -4- active -> `ACT, IVE' + error-->m4trace: -4- active -> `ACT, IVE' + =><ACT> + =><IVE> + =><ACT> + =><IVE> + foreachq(`x', `active, active', `<x> + ')dnl + error-->m4trace: -3- active -> `ACT, IVE' + error-->m4trace: -3- active -> `ACT, IVE' + =><ACT> + error-->m4trace: -3- active -> `ACT, IVE' + error-->m4trace: -3- active -> `ACT, IVE' + =><IVE> + =><ACT> + =><IVE> + dnl list of quoted macros; expansion occurs during recursion + foreach(`x', `(`active', `active')', `<x> + ')dnl + error-->m4trace: -1- active -> `ACT, IVE' + =><ACT, IVE> + error-->m4trace: -1- active -> `ACT, IVE' + =><ACT, IVE> + foreachq(`x', ``active', `active'', `<x> + ')dnl + error-->m4trace: -1- active -> `ACT, IVE' + =><ACT, IVE> + error-->m4trace: -1- active -> `ACT, IVE' + =><ACT, IVE> + dnl list of double-quoted macro names; no expansion + foreach(`x', `(``active'', ``active'')', `<x> + ')dnl + =><active> + =><active> + foreachq(`x', ```active'', ``active''', `<x> + ')dnl + =><active> + =><active> + + +File: m4.info, Node: Improved m4wrap, Next: Improved cleardivert, Prev: Improved foreach, Up: Answers + +17.4 Solution for `m4wrap' +========================== + +The replacement `m4wrap' versions presented above, designed to +guarantee FIFO or LIFO order regardless of the underlying M4 +implementation, share a bug when dealing with wrapped text that looks +like parameter expansion. Note how the invocation of `m4wrapN' +interprets these parameters, while using the builtin preserves them for +their intended use. + + $ m4 -I examples + include(`wraplifo.m4') + => + m4wrap(`define(`foo', ``$0:'-$1-$*-$#-')foo(`a', `b') + ') + => + builtin(`m4wrap', ``'define(`bar', ``$0:'-$1-$*-$#-')bar(`a', `b') + ') + => + ^D + =>bar:-a-a,b-2- + =>m4wrap0:---0- + + Additionally, the computation of `_m4wrap_level' and creation of +multiple `m4wrapN' placeholders in the original examples is more +expensive in time and memory than strictly necessary. Notice how the +improved version grabs the wrapped text via `defn' to avoid parameter +expansion, then undefines `_m4wrap_text', before stripping a level of +quotes with `_arg1' to expand the text. That way, each level of +wrapping reuses the single placeholder, which starts each nesting level +in an undefined state. + + Finally, it is worth emulating the GNU M4 extension of saving all +arguments to `m4wrap', separated by a space, rather than saving just +the first argument. This is done with the `join' macro documented +previously (*note Shift::). The improved LIFO example is shipped as +`m4-1.4.11/examples/wraplifo2.m4', and can easily be converted to a +FIFO solution by swapping the adjacent invocations of `joinall' and +`defn'. + + $ m4 -I examples + include(`wraplifo2.m4') + => + undivert(`wraplifo2.m4')dnl + =>dnl Redefine m4wrap to have LIFO semantics, improved example. + =>include(`join.m4')dnl + =>define(`_m4wrap', defn(`m4wrap'))dnl + =>define(`_arg1', `$1')dnl + =>define(`m4wrap', + =>`ifdef(`_$0_text', + => `define(`_$0_text', joinall(` ', $@)defn(`_$0_text'))', + => `_$0(`_arg1(defn(`_$0_text')undefine(`_$0_text'))')dnl + =>define(`_$0_text', joinall(` ', $@))')')dnl + m4wrap(`define(`foo', ``$0:'-$1-$*-$#-')foo(`a', `b') + ') + => + m4wrap(`lifo text + m4wrap(`nested', `', `$@ + ')') + => + ^D + =>lifo text + =>foo:-a-a,b-2- + =>nested $@ + + +File: m4.info, Node: Improved cleardivert, Next: Improved capitalize, Prev: Improved m4wrap, Up: Answers + +17.5 Solution for `cleardivert' +=============================== + +The `cleardivert' macro (*note Cleardivert::) cannot, as it stands, be +called without arguments to clear all pending diversions. That is +because using undivert with an empty string for an argument is different +than using it with no arguments at all. Compare the earlier definition +with one that takes the number of arguments into account: + + define(`cleardivert', + `pushdef(`_n', divnum)divert(`-1')undivert($@)divert(_n)popdef(`_n')') + => + divert(`1')one + divert + => + cleardivert + => + undivert + =>one + => + define(`cleardivert', + `pushdef(`_num', divnum)divert(`-1')ifelse(`$#', `0', + `undivert`'', `undivert($@)')divert(_num)popdef(`_num')') + => + divert(`2')two + divert + => + cleardivert + => + undivert + => + + +File: m4.info, Node: Improved capitalize, Next: Improved fatal_error, Prev: Improved cleardivert, Up: Answers + +17.6 Solution for `capitalize' +============================== + +The `capitalize' macro (*note Patsubst::) as presented earlier does not +allow clients to follow the quoting rule of thumb. Consider the three +macros `active', `Active', and `ACTIVE', and the difference between +calling `capitalize' with the expansion of a macro, expanding the +result of a case change, and changing the case of a double-quoted +string: + + $ m4 -I examples + include(`capitalize.m4')dnl + define(`active', `act1, ive')dnl + define(`Active', `Act2, Ive')dnl + define(`ACTIVE', `ACT3, IVE')dnl + upcase(active) + =>ACT1,IVE + upcase(`active') + =>ACT3, IVE + upcase(``active'') + =>ACTIVE + downcase(ACTIVE) + =>act3,ive + downcase(`ACTIVE') + =>act1, ive + downcase(``ACTIVE'') + =>active + capitalize(active) + =>Act1 + capitalize(`active') + =>Active + capitalize(``active'') + =>_capitalize(`active') + define(`A', `OOPS') + => + capitalize(active) + =>OOPSct1 + capitalize(`active') + =>OOPSctive + + First, when `capitalize' is called with more than one argument, it +was throwing away later arguments, whereas `upcase' and `downcase' used +`$*' to collect them all. The fix is simple: use `$*' consistently. + + Next, with single-quoting, `capitalize' outputs a single character, +a set of quotes, then the rest of the characters, making it impossible +to invoke `Active' after the fact, and allowing the alternate macro `A' +to interfere. Here, the solution is to use additional quoting in the +helper macros, then pass the final over-quoted output string through +`_arg1' to remove the extra quoting and finally invoke the concatenated +portions as a single string. + + Finally, when passed a double-quoted string, the nested macro +`_capitalize' is never invoked because it ended up nested inside +quotes. This one is the toughest to fix. In short, we have no idea how +many levels of quotes are in effect on the substring being altered by +`patsubst'. If the replacement string cannot be expressed entirely in +terms of literal text and backslash substitutions, then we need a +mechanism to guarantee that the helper macros are invoked outside of +quotes. In other words, this sounds like a job for `changequote' +(*note Changequote::). By changing the active quoting characters, we +can guarantee that replacement text injected by `patsubst' always +occurs in the middle of a string that has exactly one level of +over-quoting using alternate quotes; so the replacement text closes the +quoted string, invokes the helper macros, then reopens the quoted +string. In turn, that means the replacement text has unbalanced quotes, +necessitating another round of `changequote'. + + In the fixed version below, (also shipped as +`m4-1.4.11/examples/capitalize.m4'), `capitalize' uses the alternate +quotes of `<<[' and `]>>' (the longer strings are chosen so as to be +less likely to appear in the text being converted). The helpers +`_to_alt' and `_from_alt' merely reduce the number of characters +required to perform a `changequote', since the definition changes +twice. The outermost pair means that `patsubst' and `_capitalize_alt' +are invoked with alternate quoting; the innermost pair is used so that +the third argument to `patsubst' can contain an unbalanced `]>>'/`<<[' +pair. Note that `upcase' and `downcase' must be redefined as +`_upcase_alt' and `_downcase_alt', since they contain nested quotes but +are invoked with the alternate quoting scheme in effect. + + $ m4 -I examples + include(`capitalize2.m4')dnl + define(`active', `act1, ive')dnl + define(`Active', `Act2, Ive')dnl + define(`ACTIVE', `ACT3, IVE')dnl + define(`A', `OOPS')dnl + capitalize(active) + =>Act1,Ive + capitalize(`active') + =>Act2, Ive + capitalize(``active'') + =>Active + capitalize(```actIVE''') + =>`Active' + undivert(`capitalize2.m4')dnl + =>divert(`-1') + =># upcase(text) + =># downcase(text) + =># capitalize(text) + =># change case of text, improved version + =>define(`upcase', `translit(`$*', `a-z', `A-Z')') + =>define(`downcase', `translit(`$*', `A-Z', `a-z')') + =>define(`_arg1', `$1') + =>define(`_to_alt', `changequote(`<<[', `]>>')') + =>define(`_from_alt', `changequote(<<[`]>>, <<[']>>)') + =>define(`_upcase_alt', `translit(<<[$*]>>, <<[a-z]>>, <<[A-Z]>>)') + =>define(`_downcase_alt', `translit(<<[$*]>>, <<[A-Z]>>, <<[a-z]>>)') + =>define(`_capitalize_alt', + => `regexp(<<[$1]>>, <<[^\(\w\)\(\w*\)]>>, + => <<[_upcase_alt(<<[<<[\1]>>]>>)_downcase_alt(<<[<<[\2]>>]>>)]>>)') + =>define(`capitalize', + => `_arg1(_to_alt()patsubst(<<[<<[$*]>>]>>, <<[\w+]>>, + => _from_alt()`]>>_$0_alt(<<[\&]>>)<<['_to_alt())_from_alt())') + =>divert`'dnl + + +File: m4.info, Node: Improved fatal_error, Prev: Improved capitalize, Up: Answers + +17.7 Solution for `fatal_error' +=============================== + +The `fatal_error' macro (*note M4exit::) is not robust to versions of +GNU M4 earlier than 1.4.8, where invoking `__file__' (*note Location::) +inside `m4wrap' would result in an empty string, and `__line__' +resulted in `0' even though all files start at line 1. Furthermore, +versions earlier than 1.4.6 did not support the `__program__' macro. +If you want `fatal_error' to work across the entire 1.4.x release +series, a better implementation would be: + + define(`fatal_error', + `errprint(ifdef(`__program__', `__program__', ``m4'')'dnl + `:ifelse(__line__, `0', `', + `__file__:__line__:')` fatal error: $* + ')m4exit(`1')') + => + m4wrap(`divnum(`demo of internal message') + fatal_error(`inside wrapped text')') + => + ^D + error-->m4:stdin:6: Warning: excess arguments to builtin `divnum' ignored + =>0 + error-->m4:stdin:6: fatal error: inside wrapped text + + +File: m4.info, Node: Copying This Package, Next: Copying This Manual, Prev: Answers, Up: Top + +Appendix A How to make copies of the overall M4 package +******************************************************* + +This appendix covers the license for copying the source code of the +overall M4 package. This manual is under a different set of +restrictions, covered later (*note Copying This Manual::). + +* Menu: + +* GNU General Public License:: License for copying the M4 package + + +File: m4.info, Node: GNU General Public License, Up: Copying This Package + +A.1 License for copying the M4 package +====================================== + + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. `http://fsf.org/' + + Everyone is permitted to copy and distribute verbatim copies of this + license document, but changing it is not allowed. + +Preamble +======== + +The GNU General Public License is a free, copyleft license for software +and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains +free software for all its users. We, the Free Software Foundation, use +the GNU General Public License for most of our software; it applies +also to any other work released this way by its authors. You can apply +it to your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you +have certain responsibilities if you distribute copies of the software, +or if you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the +manufacturer can do so. This is fundamentally incompatible with the +aim of protecting users' freedom to change the software. The +systematic pattern of such abuse occurs in the area of products for +individuals to use, which is precisely where it is most unacceptable. +Therefore, we have designed this version of the GPL to prohibit the +practice for those products. If such problems arise substantially in +other domains, we stand ready to extend this provision to those domains +in future versions of the GPL, as needed to protect the freedom of +users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + +TERMS AND CONDITIONS +==================== + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public + License. + + "Copyright" also means copyright-like laws that apply to other + kinds of works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this + License. Each licensee is addressed as "you". "Licensees" and + "recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the + work in a fashion requiring copyright permission, other than the + making of an exact copy. The resulting work is called a "modified + version" of the earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work + based on the Program. + + To "propagate" a work means to do anything with it that, without + permission, would make you directly or secondarily liable for + infringement under applicable copyright law, except executing it + on a computer or modifying a private copy. Propagation includes + copying, distribution (with or without modification), making + available to the public, and in some countries other activities as + well. + + To "convey" a work means any kind of propagation that enables other + parties to make or receive copies. Mere interaction with a user + through a computer network, with no transfer of a copy, is not + conveying. + + An interactive user interface displays "Appropriate Legal Notices" + to the extent that it includes a convenient and prominently visible + feature that (1) displays an appropriate copyright notice, and (2) + tells the user that there is no warranty for the work (except to + the extent that warranties are provided), that licensees may + convey the work under this License, and how to view a copy of this + License. If the interface presents a list of user commands or + options, such as a menu, a prominent item in the list meets this + criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work + for making modifications to it. "Object code" means any + non-source form of a work. + + A "Standard Interface" means an interface that either is an + official standard defined by a recognized standards body, or, in + the case of interfaces specified for a particular programming + language, one that is widely used among developers working in that + language. + + The "System Libraries" of an executable work include anything, + other than the work as a whole, that (a) is included in the normal + form of packaging a Major Component, but which is not part of that + Major Component, and (b) serves only to enable use of the work + with that Major Component, or to implement a Standard Interface + for which an implementation is available to the public in source + code form. A "Major Component", in this context, means a major + essential component (kernel, window system, and so on) of the + specific operating system (if any) on which the executable work + runs, or a compiler used to produce the work, or an object code + interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all + the source code needed to generate, install, and (for an executable + work) run the object code and to modify the work, including + scripts to control those activities. However, it does not include + the work's System Libraries, or general-purpose tools or generally + available free programs which are used unmodified in performing + those activities but which are not part of the work. For example, + Corresponding Source includes interface definition files + associated with source files for the work, and the source code for + shared libraries and dynamically linked subprograms that the work + is specifically designed to require, such as by intimate data + communication or control flow between those subprograms and other + parts of the work. + + The Corresponding Source need not include anything that users can + regenerate automatically from other parts of the Corresponding + Source. + + The Corresponding Source for a work in source code form is that + same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of + copyright on the Program, and are irrevocable provided the stated + conditions are met. This License explicitly affirms your unlimited + permission to run the unmodified Program. The output from running + a covered work is covered by this License only if the output, + given its content, constitutes a covered work. This License + acknowledges your rights of fair use or other equivalent, as + provided by copyright law. + + You may make, run and propagate covered works that you do not + convey, without conditions so long as your license otherwise + remains in force. You may convey covered works to others for the + sole purpose of having them make modifications exclusively for + you, or provide you with facilities for running those works, + provided that you comply with the terms of this License in + conveying all material for which you do not control copyright. + Those thus making or running the covered works for you must do so + exclusively on your behalf, under your direction and control, on + terms that prohibit them from making any copies of your + copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under + the conditions stated below. Sublicensing is not allowed; section + 10 makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological + measure under any applicable law fulfilling obligations under + article 11 of the WIPO copyright treaty adopted on 20 December + 1996, or similar laws prohibiting or restricting circumvention of + such measures. + + When you convey a covered work, you waive any legal power to forbid + circumvention of technological measures to the extent such + circumvention is effected by exercising rights under this License + with respect to the covered work, and you disclaim any intention + to limit operation or modification of the work as a means of + enforcing, against the work's users, your or third parties' legal + rights to forbid circumvention of technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you + receive it, in any medium, provided that you conspicuously and + appropriately publish on each copy an appropriate copyright notice; + keep intact all notices stating that this License and any + non-permissive terms added in accord with section 7 apply to the + code; keep intact all notices of the absence of any warranty; and + give all recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, + and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to + produce it from the Program, in the form of source code under the + terms of section 4, provided that you also meet all of these + conditions: + + a. The work must carry prominent notices stating that you + modified it, and giving a relevant date. + + b. The work must carry prominent notices stating that it is + released under this License and any conditions added under + section 7. This requirement modifies the requirement in + section 4 to "keep intact all notices". + + c. You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable + section 7 additional terms, to the whole of the work, and all + its parts, regardless of how they are packaged. This License + gives no permission to license the work in any other way, but + it does not invalidate such permission if you have separately + received it. + + d. If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has + interactive interfaces that do not display Appropriate Legal + Notices, your work need not make them do so. + + A compilation of a covered work with other separate and independent + works, which are not by their nature extensions of the covered + work, and which are not combined with it such as to form a larger + program, in or on a volume of a storage or distribution medium, is + called an "aggregate" if the compilation and its resulting + copyright are not used to limit the access or legal rights of the + compilation's users beyond what the individual works permit. + Inclusion of a covered work in an aggregate does not cause this + License to apply to the other parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms + of sections 4 and 5, provided that you also convey the + machine-readable Corresponding Source under the terms of this + License, in one of these ways: + + a. Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b. Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for + as long as you offer spare parts or customer support for that + product model, to give anyone who possesses the object code + either (1) a copy of the Corresponding Source for all the + software in the product that is covered by this License, on a + durable physical medium customarily used for software + interchange, for a price no more than your reasonable cost of + physically performing this conveying of source, or (2) access + to copy the Corresponding Source from a network server at no + charge. + + c. Convey individual copies of the object code with a copy of + the written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, + and only if you received the object code with such an offer, + in accord with subsection 6b. + + d. Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access + to the Corresponding Source in the same way through the same + place at no further charge. You need not require recipients + to copy the Corresponding Source along with the object code. + If the place to copy the object code is a network server, the + Corresponding Source may be on a different server (operated + by you or a third party) that supports equivalent copying + facilities, provided you maintain clear directions next to + the object code saying where to find the Corresponding Source. + Regardless of what server hosts the Corresponding Source, you + remain obligated to ensure that it is available for as long + as needed to satisfy these requirements. + + e. Convey the object code using peer-to-peer transmission, + provided you inform other peers where the object code and + Corresponding Source of the work are being offered to the + general public at no charge under subsection 6d. + + + A separable portion of the object code, whose source code is + excluded from the Corresponding Source as a System Library, need + not be included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means + any tangible personal property which is normally used for personal, + family, or household purposes, or (2) anything designed or sold for + incorporation into a dwelling. In determining whether a product + is a consumer product, doubtful cases shall be resolved in favor of + coverage. For a particular product received by a particular user, + "normally used" refers to a typical or common use of that class of + product, regardless of the status of the particular user or of the + way in which the particular user actually uses, or expects or is + expected to use, the product. A product is a consumer product + regardless of whether the product has substantial commercial, + industrial or non-consumer uses, unless such uses represent the + only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, + procedures, authorization keys, or other information required to + install and execute modified versions of a covered work in that + User Product from a modified version of its Corresponding Source. + The information must suffice to ensure that the continued + functioning of the modified object code is in no case prevented or + interfered with solely because modification has been made. + + If you convey an object code work under this section in, or with, + or specifically for use in, a User Product, and the conveying + occurs as part of a transaction in which the right of possession + and use of the User Product is transferred to the recipient in + perpetuity or for a fixed term (regardless of how the transaction + is characterized), the Corresponding Source conveyed under this + section must be accompanied by the Installation Information. But + this requirement does not apply if neither you nor any third party + retains the ability to install modified object code on the User + Product (for example, the work has been installed in ROM). + + The requirement to provide Installation Information does not + include a requirement to continue to provide support service, + warranty, or updates for a work that has been modified or + installed by the recipient, or for the User Product in which it + has been modified or installed. Access to a network may be denied + when the modification itself materially and adversely affects the + operation of the network or violates the rules and protocols for + communication across the network. + + Corresponding Source conveyed, and Installation Information + provided, in accord with this section must be in a format that is + publicly documented (and with an implementation available to the + public in source code form), and must require no special password + or key for unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of + this License by making exceptions from one or more of its + conditions. Additional permissions that are applicable to the + entire Program shall be treated as though they were included in + this License, to the extent that they are valid under applicable + law. If additional permissions apply only to part of the Program, + that part may be used separately under those permissions, but the + entire Program remains governed by this License without regard to + the additional permissions. + + When you convey a copy of a covered work, you may at your option + remove any additional permissions from that copy, or from any part + of it. (Additional permissions may be written to require their own + removal in certain cases when you modify the work.) You may place + additional permissions on material, added by you to a covered work, + for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material + you add to a covered work, you may (if authorized by the copyright + holders of that material) supplement the terms of this License + with terms: + + a. Disclaiming warranty or limiting liability differently from + the terms of sections 15 and 16 of this License; or + + b. Requiring preservation of specified reasonable legal notices + or author attributions in that material or in the Appropriate + Legal Notices displayed by works containing it; or + + c. Prohibiting misrepresentation of the origin of that material, + or requiring that modified versions of such material be + marked in reasonable ways as different from the original + version; or + + d. Limiting the use for publicity purposes of names of licensors + or authors of the material; or + + e. Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f. Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified + versions of it) with contractual assumptions of liability to + the recipient, for any liability that these contractual + assumptions directly impose on those licensors and authors. + + All other non-permissive additional terms are considered "further + restrictions" within the meaning of section 10. If the Program as + you received it, or any part of it, contains a notice stating that + it is governed by this License along with a term that is a further + restriction, you may remove that term. If a license document + contains a further restriction but permits relicensing or + conveying under this License, you may add to a covered work + material governed by the terms of that license document, provided + that the further restriction does not survive such relicensing or + conveying. + + If you add terms to a covered work in accord with this section, you + must place, in the relevant source files, a statement of the + additional terms that apply to those files, or a notice indicating + where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in + the form of a separately written license, or stated as exceptions; + the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly + provided under this License. Any attempt otherwise to propagate or + modify it is void, and will automatically terminate your rights + under this License (including any patent licenses granted under + the third paragraph of section 11). + + However, if you cease all violation of this License, then your + license from a particular copyright holder is reinstated (a) + provisionally, unless and until the copyright holder explicitly + and finally terminates your license, and (b) permanently, if the + copyright holder fails to notify you of the violation by some + reasonable means prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is + reinstated permanently if the copyright holder notifies you of the + violation by some reasonable means, this is the first time you have + received notice of violation of this License (for any work) from + that copyright holder, and you cure the violation prior to 30 days + after your receipt of the notice. + + Termination of your rights under this section does not terminate + the licenses of parties who have received copies or rights from + you under this License. If your rights have been terminated and + not permanently reinstated, you do not qualify to receive new + licenses for the same material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or + run a copy of the Program. Ancillary propagation of a covered work + occurring solely as a consequence of using peer-to-peer + transmission to receive a copy likewise does not require + acceptance. However, nothing other than this License grants you + permission to propagate or modify any covered work. These actions + infringe copyright if you do not accept this License. Therefore, + by modifying or propagating a covered work, you indicate your + acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically + receives a license from the original licensors, to run, modify and + propagate that work, subject to this License. You are not + responsible for enforcing compliance by third parties with this + License. + + An "entity transaction" is a transaction transferring control of an + organization, or substantially all assets of one, or subdividing an + organization, or merging organizations. If propagation of a + covered work results from an entity transaction, each party to that + transaction who receives a copy of the work also receives whatever + licenses to the work the party's predecessor in interest had or + could give under the previous paragraph, plus a right to + possession of the Corresponding Source of the work from the + predecessor in interest, if the predecessor has it or can get it + with reasonable efforts. + + You may not impose any further restrictions on the exercise of the + rights granted or affirmed under this License. For example, you + may not impose a license fee, royalty, or other charge for + exercise of rights granted under this License, and you may not + initiate litigation (including a cross-claim or counterclaim in a + lawsuit) alleging that any patent claim is infringed by making, + using, selling, offering for sale, or importing the Program or any + portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this + License of the Program or a work on which the Program is based. + The work thus licensed is called the contributor's "contributor + version". + + A contributor's "essential patent claims" are all patent claims + owned or controlled by the contributor, whether already acquired or + hereafter acquired, that would be infringed by some manner, + permitted by this License, of making, using, or selling its + contributor version, but do not include claims that would be + infringed only as a consequence of further modification of the + contributor version. For purposes of this definition, "control" + includes the right to grant patent sublicenses in a manner + consistent with the requirements of this License. + + Each contributor grants you a non-exclusive, worldwide, + royalty-free patent license under the contributor's essential + patent claims, to make, use, sell, offer for sale, import and + otherwise run, modify and propagate the contents of its + contributor version. + + In the following three paragraphs, a "patent license" is any + express agreement or commitment, however denominated, not to + enforce a patent (such as an express permission to practice a + patent or covenant not to sue for patent infringement). To + "grant" such a patent license to a party means to make such an + agreement or commitment not to enforce a patent against the party. + + If you convey a covered work, knowingly relying on a patent + license, and the Corresponding Source of the work is not available + for anyone to copy, free of charge and under the terms of this + License, through a publicly available network server or other + readily accessible means, then you must either (1) cause the + Corresponding Source to be so available, or (2) arrange to deprive + yourself of the benefit of the patent license for this particular + work, or (3) arrange, in a manner consistent with the requirements + of this License, to extend the patent license to downstream + recipients. "Knowingly relying" means you have actual knowledge + that, but for the patent license, your conveying the covered work + in a country, or your recipient's use of the covered work in a + country, would infringe one or more identifiable patents in that + country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or + arrangement, you convey, or propagate by procuring conveyance of, a + covered work, and grant a patent license to some of the parties + receiving the covered work authorizing them to use, propagate, + modify or convey a specific copy of the covered work, then the + patent license you grant is automatically extended to all + recipients of the covered work and works based on it. + + A patent license is "discriminatory" if it does not include within + the scope of its coverage, prohibits the exercise of, or is + conditioned on the non-exercise of one or more of the rights that + are specifically granted under this License. You may not convey a + covered work if you are a party to an arrangement with a third + party that is in the business of distributing software, under + which you make payment to the third party based on the extent of + your activity of conveying the work, and under which the third + party grants, to any of the parties who would receive the covered + work from you, a discriminatory patent license (a) in connection + with copies of the covered work conveyed by you (or copies made + from those copies), or (b) primarily for and in connection with + specific products or compilations that contain the covered work, + unless you entered into that arrangement, or that patent license + was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting + any implied license or other defenses to infringement that may + otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, + agreement or otherwise) that contradict the conditions of this + License, they do not excuse you from the conditions of this + License. If you cannot convey a covered work so as to satisfy + simultaneously your obligations under this License and any other + pertinent obligations, then as a consequence you may not convey it + at all. For example, if you agree to terms that obligate you to + collect a royalty for further conveying from those to whom you + convey the Program, the only way you could satisfy both those + terms and this License would be to refrain entirely from conveying + the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have + permission to link or combine any covered work with a work licensed + under version 3 of the GNU Affero General Public License into a + single combined work, and to convey the resulting work. The terms + of this License will continue to apply to the part which is the + covered work, but the special requirements of the GNU Affero + General Public License, section 13, concerning interaction through + a network will apply to the combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new + versions of the GNU General Public License from time to time. + Such new versions will be similar in spirit to the present + version, but may differ in detail to address new problems or + concerns. + + Each version is given a distinguishing version number. If the + Program specifies that a certain numbered version of the GNU + General Public License "or any later version" applies to it, you + have the option of following the terms and conditions either of + that numbered version or of any later version published by the + Free Software Foundation. If the Program does not specify a + version number of the GNU General Public License, you may choose + any version ever published by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future + versions of the GNU General Public License can be used, that + proxy's public statement of acceptance of a version permanently + authorizes you to choose that version for the Program. + + Later license versions may give you additional or different + permissions. However, no additional obligations are imposed on any + author or copyright holder as a result of your choosing to follow a + later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY + APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE + COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" + WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE + RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. + SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL + NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN + WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES + AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU + FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR + CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE + THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA + BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD + PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER + PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF + THE POSSIBILITY OF SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided + above cannot be given local legal effect according to their terms, + reviewing courts shall apply local law that most closely + approximates an absolute waiver of all civil liability in + connection with the Program, unless a warranty or assumption of + liability accompanies a copy of the Program in return for a fee. + + +END OF TERMS AND CONDITIONS +=========================== + +How to Apply These Terms to Your New Programs +============================================= + +If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these +terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + ONE LINE TO GIVE THE PROGRAM'S NAME AND A BRIEF IDEA OF WHAT IT DOES. + Copyright (C) YEAR NAME OF AUTHOR + + 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/'. + + Also add information on how to contact you by electronic and paper +mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + PROGRAM Copyright (C) YEAR NAME OF AUTHOR + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + + The hypothetical commands `show w' and `show c' should show the +appropriate parts of the General Public License. Of course, your +program's commands might be different; for a GUI interface, you would +use an "about box". + + You should also get your employer (if you work as a programmer) or +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. For more information on this, and how to apply and follow +the GNU GPL, see `http://www.gnu.org/licenses/'. + + The GNU General Public License does not permit incorporating your +program into proprietary programs. If your program is a subroutine +library, you may consider it more useful to permit linking proprietary +applications with the library. If this is what you want to do, use the +GNU Lesser General Public License instead of this License. But first, +please read `http://www.gnu.org/philosophy/why-not-lgpl.html'. + + +File: m4.info, Node: Copying This Manual, Next: Indices, Prev: Copying This Package, Up: Top + +Appendix B How to make copies of this manual +******************************************** + +This appendix covers the license for copying this manual. Note that +some of the longer examples in this manual are also distributed in the +directory `m4-1.4.11/examples/', where a more permissive license is in +effect when copying just the examples. + +* Menu: + +* GNU Free Documentation License:: License for copying this manual + + +File: m4.info, Node: GNU Free Documentation License, Up: Copying This Manual + +B.1 License for copying this manual +=================================== + + Version 1.2, November 2002 + + Copyright (C) 2000,2001,2002 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + 0. PREAMBLE + + The purpose of this License is to make a manual, textbook, or other + functional and useful document "free" in the sense of freedom: to + assure everyone the effective freedom to copy and redistribute it, + with or without modifying it, either commercially or + noncommercially. Secondarily, this License preserves for the + author and publisher a way to get credit for their work, while not + being considered responsible for modifications made by others. + + This License is a kind of "copyleft", which means that derivative + works of the document must themselves be free in the same sense. + It complements the GNU General Public License, which is a copyleft + license designed for free software. + + We have designed this License in order to use it for manuals for + free software, because free software needs free documentation: a + free program should come with manuals providing the same freedoms + that the software does. But this License is not limited to + software manuals; it can be used for any textual work, regardless + of subject matter or whether it is published as a printed book. + We recommend this License principally for works whose purpose is + instruction or reference. + + 1. APPLICABILITY AND DEFINITIONS + + This License applies to any manual or other work, in any medium, + that contains a notice placed by the copyright holder saying it + can be distributed under the terms of this License. Such a notice + grants a world-wide, royalty-free license, unlimited in duration, + to use that work under the conditions stated herein. The + "Document", below, refers to any such manual or work. Any member + of the public is a licensee, and is addressed as "you". You + accept the license if you copy, modify or distribute the work in a + way requiring permission under copyright law. + + A "Modified Version" of the Document means any work containing the + Document or a portion of it, either copied verbatim, or with + modifications and/or translated into another language. + + A "Secondary Section" is a named appendix or a front-matter section + of the Document that deals exclusively with the relationship of the + publishers or authors of the Document to the Document's overall + subject (or to related matters) and contains nothing that could + fall directly within that overall subject. (Thus, if the Document + is in part a textbook of mathematics, a Secondary Section may not + explain any mathematics.) The relationship could be a matter of + historical connection with the subject or with related matters, or + of legal, commercial, philosophical, ethical or political position + regarding them. + + The "Invariant Sections" are certain Secondary Sections whose + titles are designated, as being those of Invariant Sections, in + the notice that says that the Document is released under this + License. If a section does not fit the above definition of + Secondary then it is not allowed to be designated as Invariant. + The Document may contain zero Invariant Sections. If the Document + does not identify any Invariant Sections then there are none. + + The "Cover Texts" are certain short passages of text that are + listed, as Front-Cover Texts or Back-Cover Texts, in the notice + that says that the Document is released under this License. A + Front-Cover Text may be at most 5 words, and a Back-Cover Text may + be at most 25 words. + + A "Transparent" copy of the Document means a machine-readable copy, + represented in a format whose specification is available to the + general public, that is suitable for revising the document + straightforwardly with generic text editors or (for images + composed of pixels) generic paint programs or (for drawings) some + widely available drawing editor, and that is suitable for input to + text formatters or for automatic translation to a variety of + formats suitable for input to text formatters. A copy made in an + otherwise Transparent file format whose markup, or absence of + markup, has been arranged to thwart or discourage subsequent + modification by readers is not Transparent. An image format is + not Transparent if used for any substantial amount of text. A + copy that is not "Transparent" is called "Opaque". + + Examples of suitable formats for Transparent copies include plain + ASCII without markup, Texinfo input format, LaTeX input format, + SGML or XML using a publicly available DTD, and + standard-conforming simple HTML, PostScript or PDF designed for + human modification. Examples of transparent image formats include + PNG, XCF and JPG. Opaque formats include proprietary formats that + can be read and edited only by proprietary word processors, SGML or + XML for which the DTD and/or processing tools are not generally + available, and the machine-generated HTML, PostScript or PDF + produced by some word processors for output purposes only. + + The "Title Page" means, for a printed book, the title page itself, + plus such following pages as are needed to hold, legibly, the + material this License requires to appear in the title page. For + works in formats which do not have any title page as such, "Title + Page" means the text near the most prominent appearance of the + work's title, preceding the beginning of the body of the text. + + A section "Entitled XYZ" means a named subunit of the Document + whose title either is precisely XYZ or contains XYZ in parentheses + following text that translates XYZ in another language. (Here XYZ + stands for a specific section name mentioned below, such as + "Acknowledgements", "Dedications", "Endorsements", or "History".) + To "Preserve the Title" of such a section when you modify the + Document means that it remains a section "Entitled XYZ" according + to this definition. + + The Document may include Warranty Disclaimers next to the notice + which states that this License applies to the Document. These + Warranty Disclaimers are considered to be included by reference in + this License, but only as regards disclaiming warranties: any other + implication that these Warranty Disclaimers may have is void and + has no effect on the meaning of this License. + + 2. VERBATIM COPYING + + You may copy and distribute the Document in any medium, either + commercially or noncommercially, provided that this License, the + copyright notices, and the license notice saying this License + applies to the Document are reproduced in all copies, and that you + add no other conditions whatsoever to those of this License. You + may not use technical measures to obstruct or control the reading + or further copying of the copies you make or distribute. However, + you may accept compensation in exchange for copies. If you + distribute a large enough number of copies you must also follow + the conditions in section 3. + + You may also lend copies, under the same conditions stated above, + and you may publicly display copies. + + 3. COPYING IN QUANTITY + + If you publish printed copies (or copies in media that commonly + have printed covers) of the Document, numbering more than 100, and + the Document's license notice requires Cover Texts, you must + enclose the copies in covers that carry, clearly and legibly, all + these Cover Texts: Front-Cover Texts on the front cover, and + Back-Cover Texts on the back cover. Both covers must also clearly + and legibly identify you as the publisher of these copies. The + front cover must present the full title with all words of the + title equally prominent and visible. You may add other material + on the covers in addition. Copying with changes limited to the + covers, as long as they preserve the title of the Document and + satisfy these conditions, can be treated as verbatim copying in + other respects. + + If the required texts for either cover are too voluminous to fit + legibly, you should put the first ones listed (as many as fit + reasonably) on the actual cover, and continue the rest onto + adjacent pages. + + If you publish or distribute Opaque copies of the Document + numbering more than 100, you must either include a + machine-readable Transparent copy along with each Opaque copy, or + state in or with each Opaque copy a computer-network location from + which the general network-using public has access to download + using public-standard network protocols a complete Transparent + copy of the Document, free of added material. If you use the + latter option, you must take reasonably prudent steps, when you + begin distribution of Opaque copies in quantity, to ensure that + this Transparent copy will remain thus accessible at the stated + location until at least one year after the last time you + distribute an Opaque copy (directly or through your agents or + retailers) of that edition to the public. + + It is requested, but not required, that you contact the authors of + the Document well before redistributing any large number of + copies, to give them a chance to provide you with an updated + version of the Document. + + 4. MODIFICATIONS + + You may copy and distribute a Modified Version of the Document + under the conditions of sections 2 and 3 above, provided that you + release the Modified Version under precisely this License, with + the Modified Version filling the role of the Document, thus + licensing distribution and modification of the Modified Version to + whoever possesses a copy of it. In addition, you must do these + things in the Modified Version: + + A. Use in the Title Page (and on the covers, if any) a title + distinct from that of the Document, and from those of + previous versions (which should, if there were any, be listed + in the History section of the Document). You may use the + same title as a previous version if the original publisher of + that version gives permission. + + B. List on the Title Page, as authors, one or more persons or + entities responsible for authorship of the modifications in + the Modified Version, together with at least five of the + principal authors of the Document (all of its principal + authors, if it has fewer than five), unless they release you + from this requirement. + + C. State on the Title page the name of the publisher of the + Modified Version, as the publisher. + + D. Preserve all the copyright notices of the Document. + + E. Add an appropriate copyright notice for your modifications + adjacent to the other copyright notices. + + F. Include, immediately after the copyright notices, a license + notice giving the public permission to use the Modified + Version under the terms of this License, in the form shown in + the Addendum below. + + G. Preserve in that license notice the full lists of Invariant + Sections and required Cover Texts given in the Document's + license notice. + + H. Include an unaltered copy of this License. + + I. Preserve the section Entitled "History", Preserve its Title, + and add to it an item stating at least the title, year, new + authors, and publisher of the Modified Version as given on + the Title Page. If there is no section Entitled "History" in + the Document, create one stating the title, year, authors, + and publisher of the Document as given on its Title Page, + then add an item describing the Modified Version as stated in + the previous sentence. + + J. Preserve the network location, if any, given in the Document + for public access to a Transparent copy of the Document, and + likewise the network locations given in the Document for + previous versions it was based on. These may be placed in + the "History" section. You may omit a network location for a + work that was published at least four years before the + Document itself, or if the original publisher of the version + it refers to gives permission. + + K. For any section Entitled "Acknowledgements" or "Dedications", + Preserve the Title of the section, and preserve in the + section all the substance and tone of each of the contributor + acknowledgements and/or dedications given therein. + + L. Preserve all the Invariant Sections of the Document, + unaltered in their text and in their titles. Section numbers + or the equivalent are not considered part of the section + titles. + + M. Delete any section Entitled "Endorsements". Such a section + may not be included in the Modified Version. + + N. Do not retitle any existing section to be Entitled + "Endorsements" or to conflict in title with any Invariant + Section. + + O. Preserve any Warranty Disclaimers. + + If the Modified Version includes new front-matter sections or + appendices that qualify as Secondary Sections and contain no + material copied from the Document, you may at your option + designate some or all of these sections as invariant. To do this, + add their titles to the list of Invariant Sections in the Modified + Version's license notice. These titles must be distinct from any + other section titles. + + You may add a section Entitled "Endorsements", provided it contains + nothing but endorsements of your Modified Version by various + parties--for example, statements of peer review or that the text + has been approved by an organization as the authoritative + definition of a standard. + + You may add a passage of up to five words as a Front-Cover Text, + and a passage of up to 25 words as a Back-Cover Text, to the end + of the list of Cover Texts in the Modified Version. Only one + passage of Front-Cover Text and one of Back-Cover Text may be + added by (or through arrangements made by) any one entity. If the + Document already includes a cover text for the same cover, + previously added by you or by arrangement made by the same entity + you are acting on behalf of, you may not add another; but you may + replace the old one, on explicit permission from the previous + publisher that added the old one. + + The author(s) and publisher(s) of the Document do not by this + License give permission to use their names for publicity for or to + assert or imply endorsement of any Modified Version. + + 5. COMBINING DOCUMENTS + + You may combine the Document with other documents released under + this License, under the terms defined in section 4 above for + modified versions, provided that you include in the combination + all of the Invariant Sections of all of the original documents, + unmodified, and list them all as Invariant Sections of your + combined work in its license notice, and that you preserve all + their Warranty Disclaimers. + + The combined work need only contain one copy of this License, and + multiple identical Invariant Sections may be replaced with a single + copy. If there are multiple Invariant Sections with the same name + but different contents, make the title of each such section unique + by adding at the end of it, in parentheses, the name of the + original author or publisher of that section if known, or else a + unique number. Make the same adjustment to the section titles in + the list of Invariant Sections in the license notice of the + combined work. + + In the combination, you must combine any sections Entitled + "History" in the various original documents, forming one section + Entitled "History"; likewise combine any sections Entitled + "Acknowledgements", and any sections Entitled "Dedications". You + must delete all sections Entitled "Endorsements." + + 6. COLLECTIONS OF DOCUMENTS + + You may make a collection consisting of the Document and other + documents released under this License, and replace the individual + copies of this License in the various documents with a single copy + that is included in the collection, provided that you follow the + rules of this License for verbatim copying of each of the + documents in all other respects. + + You may extract a single document from such a collection, and + distribute it individually under this License, provided you insert + a copy of this License into the extracted document, and follow + this License in all other respects regarding verbatim copying of + that document. + + 7. AGGREGATION WITH INDEPENDENT WORKS + + A compilation of the Document or its derivatives with other + separate and independent documents or works, in or on a volume of + a storage or distribution medium, is called an "aggregate" if the + copyright resulting from the compilation is not used to limit the + legal rights of the compilation's users beyond what the individual + works permit. When the Document is included in an aggregate, this + License does not apply to the other works in the aggregate which + are not themselves derivative works of the Document. + + If the Cover Text requirement of section 3 is applicable to these + copies of the Document, then if the Document is less than one half + of the entire aggregate, the Document's Cover Texts may be placed + on covers that bracket the Document within the aggregate, or the + electronic equivalent of covers if the Document is in electronic + form. Otherwise they must appear on printed covers that bracket + the whole aggregate. + + 8. TRANSLATION + + Translation is considered a kind of modification, so you may + distribute translations of the Document under the terms of section + 4. Replacing Invariant Sections with translations requires special + permission from their copyright holders, but you may include + translations of some or all Invariant Sections in addition to the + original versions of these Invariant Sections. You may include a + translation of this License, and all the license notices in the + Document, and any Warranty Disclaimers, provided that you also + include the original English version of this License and the + original versions of those notices and disclaimers. In case of a + disagreement between the translation and the original version of + this License or a notice or disclaimer, the original version will + prevail. + + If a section in the Document is Entitled "Acknowledgements", + "Dedications", or "History", the requirement (section 4) to + Preserve its Title (section 1) will typically require changing the + actual title. + + 9. TERMINATION + + You may not copy, modify, sublicense, or distribute the Document + except as expressly provided for under this License. Any other + attempt to copy, modify, sublicense or distribute the Document is + void, and will automatically terminate your rights under this + License. However, parties who have received copies, or rights, + from you under this License will not have their licenses + terminated so long as such parties remain in full compliance. + + 10. FUTURE REVISIONS OF THIS LICENSE + + The Free Software Foundation may publish new, revised versions of + the GNU Free Documentation License from time to time. Such new + versions will be similar in spirit to the present version, but may + differ in detail to address new problems or concerns. See + `http://www.gnu.org/copyleft/'. + + Each version of the License is given a distinguishing version + number. If the Document specifies that a particular numbered + version of this License "or any later version" applies to it, you + have the option of following the terms and conditions either of + that specified version or of any later version that has been + published (not as a draft) by the Free Software Foundation. If + the Document does not specify a version number of this License, + you may choose any version ever published (not as a draft) by the + Free Software Foundation. + +ADDENDUM: How to use this License for your documents +==================================================== + +To use this License in a document you have written, include a copy of +the License in the document and put the following copyright and license +notices just after the title page: + + Copyright (C) YEAR YOUR NAME. + Permission is granted to copy, distribute and/or modify this document + under the terms of the GNU Free Documentation License, Version 1.2 + or any later version published by the Free Software Foundation; + with no Invariant Sections, no Front-Cover Texts, and no Back-Cover + Texts. A copy of the license is included in the section entitled ``GNU + Free Documentation License''. + + If you have Invariant Sections, Front-Cover Texts and Back-Cover +Texts, replace the "with...Texts." line with this: + + with the Invariant Sections being LIST THEIR TITLES, with + the Front-Cover Texts being LIST, and with the Back-Cover Texts + being LIST. + + If you have Invariant Sections without Cover Texts, or some other +combination of the three, merge those two alternatives to suit the +situation. + + If your document contains nontrivial examples of program code, we +recommend releasing these examples in parallel under your choice of +free software license, such as the GNU General Public License, to +permit their use in free software. + + +File: m4.info, Node: Indices, Prev: Copying This Manual, Up: Top + +Appendix C Indices of concepts and macros +***************************************** + +* Menu: + +* Macro index:: Index for all `m4' macros +* Concept index:: Index for many concepts + Files m4-1.4.10/doc/m4.info-2 and m4-1.4.11/doc/m4.info-2 differ diff -ruNp m4-1.4.10/doc/m4.texinfo m4-1.4.11/doc/m4.texinfo --- m4-1.4.10/doc/m4.texinfo 2007-07-04 21:56:03.000000000 -0600 +++ m4-1.4.11/doc/m4.texinfo 2008-03-29 20:30:29.000000000 -0600 @@ -43,7 +43,7 @@ This manual is for @acronym{GNU} M4 (ver a package containing an implementation of the m4 macro language. Copyright @copyright{} 1989, 1990, 1991, 1992, 1993, 1994, 2004, 2005, -2006, 2007 Free Software Foundation, Inc. +2006, 2007, 2008 Free Software Foundation, Inc. @quotation Permission is granted to copy, distribute and/or modify this document @@ -137,6 +137,7 @@ changeword will go away and @emph{you sh * Compatibility:: Compatibility with other versions of @code{m4} * Answers:: Correct version of some examples + * Copying This Package:: How to make copies of the overall M4 package * Copying This Manual:: How to make copies of this manual * Indices:: Indices of concepts and macros @@ -268,12 +269,17 @@ Correct version of some examples * Improved exch:: Solution for @code{exch} * Improved forloop:: Solution for @code{forloop} * Improved foreach:: Solution for @code{foreach} +* Improved m4wrap:: Solution for @code{m4wrap} * Improved cleardivert:: Solution for @code{cleardivert} +* Improved capitalize:: Solution for @code{capitalize} * Improved fatal_error:: Solution for @code{fatal_error} -How to make copies of this package or manual +How to make copies of the overall M4 package + +* GNU General Public License:: License for copying the M4 package + +How to make copies of this manual -* Copying:: GNU General Public License * GNU Free Documentation License:: License for copying this manual Indices of concepts and macros @@ -341,11 +347,11 @@ debugging their @code{m4} scripts than d @cindex @acronym{GNU} M4, history of @code{GPM} was an important ancestor of @code{m4}. See C. Stratchey: ``A General Purpose Macro generator'', Computer Journal -8,3 (1965), pp. 225 ff. @code{GPM} is also succinctly described into +8,3 (1965), pp.@: 225 ff. @code{GPM} is also succinctly described into David Gries classic ``Compiler Construction for Digital Computers''. The classic B. Kernighan and P.J. Plauger: ``Software Tools'', -Addison-Wesley, Inc. (1976) describes and implements a Unix +Addison-Wesley, Inc.@: (1976) describes and implements a Unix macro-processor language, which inspired Dennis Ritchie to write @code{m3}, a macro processor for the AP-3 minicomputer. @@ -387,8 +393,8 @@ addressed some long standing bugs in the @acronym{GNU} @code{m4} 1.4 that were floating around the net and released 1.4.3 and 1.4.4. And in 2006, Eric Blake joined the team and prepared patches for the release of 1.4.5, 1.4.6, 1.4.7, and 1.4.8. The -1.4.x series remains open for bug fixes, including release 1.4.9 and -1.4.10 in 2007. +1.4.x series remains open for bug fixes, including releases 1.4.9, +1.4.10, and 1.4.11 in 2007. Meanwhile, development has continued on new features for @code{m4}, such as dynamic module loading and additional builtins. When complete, @@ -1340,18 +1346,34 @@ the @code{divert} builtin macro will be empty string. @cindex rescanning -The output of macro evaluations is always rescanned. The following -example would yield the string @samp{de}, exactly as if @code{m4} -has been given @w{@samp{substr(`abcde', `3', `2')}} as input: +The output of macro evaluations is always rescanned. In the following +example, the input @samp{x`'y} yields the string @samp{bCD}, exactly as +if @code{m4} +has been given @w{@samp{substr(ab`'cde, `1', `3')}} as input: @example +define(`cde', `CDE') +@result{} define(`x', `substr(ab') @result{} -define(`y', `cde, `3', `2')') +define(`y', `cde, `1', `3')') @result{} x`'y -@result{}de +@result{}bCD +@end example + +@ignore +@comment Similar, but with argument references, to ensure good test +@comment coverage. +@example +define(`x1', `len(`$1'') +@result{} +define(`y1', ``$1')') +@result{} +x1(`01234567890123456789')y1(`98765432109876543210') +@result{}40 @end example +@end ignore Unquoted strings on either side of a quoted string are subject to being recognized as macro names. In the following example, quoting the @@ -1581,6 +1603,22 @@ foo will expand first to @samp{bar}, and when this is reread and expanded, into @samp{Hello}. +@ignore +@comment not worth documenting, but test that the command line can +@comment define macros that take parameters + +@comment options: -Dfoo -Decho=$@ +@example +$ @kbd{m4 -Dfoo -Decho='$@'} +foo +@result{} +foo(`silently ignored') +@result{} +echo(`1', `2') +@result{}1,2 +@end example +@end ignore + @node Definitions @chapter How to define new macros @@ -1796,7 +1834,7 @@ default, because it triggers a number of Autoconf uses @option{-E} to treat warnings as errors), and because it will still be possible to restore older behavior in M4 2.0. -@comment ignore +@comment options: --warn-macro-sequence @example $ @kbd{m4 --warn-macro-sequence} define(`foo', `$001 $@{1@} $1') @@ -1918,6 +1956,35 @@ foo) @result{}bar' @end example +@ignore +@comment Not worth putting in the manual, but this example is needed for +@comment good test coverage of copying large strings across recursion +@comment levels. + +@example +define(`echo', `$@@')dnl +echo(echo(`01234567890123456789', `01234567890123456789') +echo(`98765432109876543210', `98765432109876543210')) +@result{}01234567890123456789,01234567890123456789 +@result{}98765432109876543210,98765432109876543210 +len((echo(`01234567890123456789', + `01234567890123456789')echo(`98765432109876543210', + `98765432109876543210'))) +@result{}84 +indir(`echo', indir(`echo', `01234567890123456789', + `01234567890123456789') +indir(`echo', `98765432109876543210', `98765432109876543210')) +@result{}01234567890123456789,01234567890123456789 +@result{}98765432109876543210,98765432109876543210 +define(`argn', `$#')dnl +define(`echo1', `-$@@-')define(`echo2', `,$@@,')dnl +echo1(`1', `2', `3') argn(echo1(`1', `2', `3')) +@result{}-1,2,3- 3 +echo2(`1', `2', `3') argn(echo2(`1', `2', `3')) +@result{},1,2,3, 5 +@end example +@end ignore + A @samp{$} sign in the expansion text, that is not followed by anything @code{m4} understands, is simply copied to the macro expansion, as any other text is. @@ -2019,16 +2086,20 @@ case, @code{undefine} does nothing. It is possible to rename an already defined macro. To do this, you need the builtin @code{defn}: -@deffn Builtin defn (@var{name}) -Expands to the @emph{quoted definition} of @var{name}. If the -argument is not a defined macro, the expansion is void. +@deffn Builtin defn (@var{name}@dots{}) +Expands to the @emph{quoted definition} of each @var{name}. If an +argument is not a defined macro, the expansion for that argument is +empty. If @var{name} is a user-defined macro, the quoted definition is simply -the quoted expansion text. If, instead, @var{name} is a builtin, the +the quoted expansion text. If, instead, there is only one @var{name} +and it is a builtin, the expansion is a special token, which points to the builtin's internal definition. This token is only meaningful as the second argument to @code{define} (and @code{pushdef}), and is silently converted to an -empty string in most other contexts. +empty string in most other contexts. Combining a builtin with anything +else is not supported; a warning is issued and the builtin is omitted +from the final expansion. The macro @code{defn} is recognized only with parameters. @end deffn @@ -2099,6 +2170,28 @@ echo(foo) @result{}AA' @end example +On the other hand, it is possible to exploit the fact that @code{defn} +can concatenate multiple macros prior to the rescanning phase, in order +to join the definitions of macros that, in isolation, have unbalanced +quotes. This is particularly useful when one has used several macros to +accumulate text that M4 should rescan as a whole. In the example below, +note how the use of @code{defn} on @code{l} in isolation opens a string, +which is not closed until the next line; but used on @code{l} and +@code{r} together results in nested quoting. + +@example +define(`l', `<[>')define(`r', `<]>') +@result{} +changequote(`[', `]') +@result{} +defn([l])defn([r]) +]) +@result{}<[>]defn([r]) +@result{}) +defn([l], [r]) +@result{}<[>][<]> +@end example + @cindex builtins, special tokens @cindex tokens, builtin macro Using @code{defn} to generate special tokens for builtin macros outside @@ -2106,6 +2199,7 @@ of expected contexts can sometimes trigg time, such tokens are silently converted to the empty string. @example +$ @kbd{m4 -d} defn(`defn') @result{} define(defn(`divnum'), `cannot redefine a builtin token') @@ -2113,6 +2207,32 @@ define(defn(`divnum'), `cannot redefine @result{} divnum @result{}0 +len(defn(`divnum')) +@result{}0 +@end example + +Also note that @code{defn} with multiple arguments can only join text +macros, not builtins, although a future version of @acronym{GNU} M4 may +lift this restriction. + +@example +$ @kbd{m4 -d} +define(`a', `A')define(`AA', `b') +@result{} +traceon(`defn', `define') +@result{} +defn(`a', `divnum', `a') +@error{}m4:stdin:3: Warning: cannot concatenate builtin `divnum' +@error{}m4trace: -1- defn(`a', `divnum', `a') -> ``A'`A'' +@result{}AA +define(`mydivnum', defn(`divnum', `divnum'))mydivnum +@error{}m4:stdin:4: Warning: cannot concatenate builtin `divnum' +@error{}m4:stdin:4: Warning: cannot concatenate builtin `divnum' +@error{}m4trace: -2- defn(`divnum', `divnum') +@error{}m4trace: -1- define(`mydivnum', `') +@result{} +traceoff(`defn', `define') +@result{} @end example @node Pushdef @@ -2373,6 +2493,34 @@ builtin(`builtin',) @result{} @end example +@ignore +@comment This example is not worth putting in the manual, but it is +@comment needed for full coverage. Autoconf's m4_include relies heavily +@comment on this feature. + +@example +builtin(`include', `foo')dnl +@result{}bar +@end example + +@comment And this example triggers a regression present in 1.4.10b. + +@example +define(`s', `builtin(`shift', $@@)')dnl +define(`loop', `ifelse(`$2', `', `-', `$1$2: $0(`$1', s(s($@@)))')')dnl +loop(`1') +@result{}- +loop(`1', `2') +@result{}12: - +loop(`1', `2', `3') +@result{}12: 13: - +loop(`1', `2', `3', `4') +@result{}12: 13: 14: - +loop(`1', `2', `3', `4', `5') +@result{}12: 13: 14: 15: - +@end example +@end ignore + @node Conditionals @chapter Conditionals, loops, and recursion @@ -2432,7 +2580,7 @@ as a multibranch, depending on the numbe @deffnx Builtin ifelse (@var{string-1}, @var{string-2}, @var{equal}, @ @ovar{not-equal}) @deffnx Builtin ifelse (@var{string-1}, @var{string-2}, @var{equal-1}, @ - @var{string-3}, @var{string-4}, @var{equal-2}, @dots{}) + @var{string-3}, @var{string-4}, @var{equal-2}, @dots{}, @ovar{not-equal}) Used with only one argument, the @code{ifelse} simply discards it and produces no output. @@ -2518,6 +2666,65 @@ ifelse(`foo', `bar', `3', `gnu', `gnats' @result{}7 @end example +@ignore +@comment Stress tests, not worth documenting. + +@comment Ensure that references compared to strings work regardless of +@comment similar prefixes. +@example +define(`e', `$@@')define(`long', `01234567890123456789') +@result{} +ifelse(long, `01234567890123456789', `yes', `no') +@result{}yes +ifelse(`01234567890123456789', long, `yes', `no') +@result{}yes +ifelse(long, `01234567890123456789-', `yes', `no') +@result{}no +ifelse(`01234567890123456789-', long, `yes', `no') +@result{}no +ifelse(e(long), `01234567890123456789', `yes', `no') +@result{}yes +ifelse(`01234567890123456789', e(long), `yes', `no') +@result{}yes +ifelse(e(long), `01234567890123456789-', `yes', `no') +@result{}no +ifelse(`01234567890123456789-', e(long), `yes', `no') +@result{}no +ifelse(-e(long), `-01234567890123456789', `yes', `no') +@result{}yes +ifelse(-`01234567890123456789', -e(long), `yes', `no') +@result{}yes +ifelse(-e(long), `-01234567890123456789-', `yes', `no') +@result{}no +ifelse(`-01234567890123456789-', -e(long), `yes', `no') +@result{}no +ifelse(-e(long)-, `-01234567890123456789-', `yes', `no') +@result{}yes +ifelse(-`01234567890123456789-', -e(long)-, `yes', `no') +@result{}yes +ifelse(-e(long)-, `-01234567890123456789', `yes', `no') +@result{}no +ifelse(`-01234567890123456789', -e(long)-, `yes', `no') +@result{}no +ifelse(`-'e(long), `-01234567890123456789', `yes', `no') +@result{}yes +ifelse(-`01234567890123456789', `-'e(long), `yes', `no') +@result{}yes +ifelse(`-'e(long), `-01234567890123456789-', `yes', `no') +@result{}no +ifelse(`-01234567890123456789-', `-'e(long), `yes', `no') +@result{}no +ifelse(`-'e(long)`-', `-01234567890123456789-', `yes', `no') +@result{}yes +ifelse(-`01234567890123456789-', `-'e(long)`-', `yes', `no') +@result{}yes +ifelse(`-'e(long)`-', `-01234567890123456789', `yes', `no') +@result{}no +ifelse(`-01234567890123456789', `-'e(long)`-', `yes', `no') +@result{}no +@end example +@end ignore + Naturally, the normal case will be slightly more advanced than these examples. A common use of @code{ifelse} is in macros implementing loops of various kinds. @@ -2556,6 +2763,8 @@ shift(`foo', `bar', `baz') An example of the use of @code{shift} is this macro: +@cindex reversing arguments +@cindex arguments, reversing @deffn Composite reverse (@dots{}) Takes any number of arguments, and reverses their order. @end deffn @@ -2576,8 +2785,172 @@ reverse(`foo', `bar', `gnats', `and gnus While not a very interesting macro, it does show how simple loops can be made with @code{shift}, @code{ifelse} and recursion. It also shows -that @code{shift} is usually used with @samp{$@@}. Sometimes, a -recursive algorithm requires adding quotes to each element: +that @code{shift} is usually used with @samp{$@@}. Another example of +this is an implementation of a short-circuiting conditional operator. + +@cindex short-circuiting conditional +@cindex conditional, short-circuiting +@deffn Composite cond (@var{test-1}, @var{string-1}, @var{equal-1}, @ + @ovar{test-2}, @ovar{string-2}, @ovar{equal-2}, @dots{}, @ovar{not-equal}) +Similar to @code{ifelse}, where an equal comparison between the first +two strings results in the third, otherwise the first three arguments +are discarded and the process repeats. The difference is that each +@var{test-<n>} is expanded only when it is encountered. This means that +every third argument to @code{cond} is normally given one more level of +quoting than the corresponding argument to @code{ifelse}. +@end deffn + +Here is the implementation of @code{cond}, along with a demonstration of +how it can short-circuit the side effects in @code{side}. Notice how +all the unquoted side effects happen regardless of how many comparisons +are made with @code{ifelse}, compared with only the relevant effects +with @code{cond}. + +@example +define(`cond', +`ifelse(`$#', `1', `$1', + `ifelse($1, `$2', `$3', + `$0(shift(shift(shift($@@))))')')')dnl +define(`side', `define(`counter', incr(counter))$1')dnl +define(`example1', +`define(`counter', `0')dnl +ifelse(side(`$1'), `yes', `one comparison: ', + side(`$1'), `no', `two comparisons: ', + side(`$1'), `maybe', `three comparisons: ', + `side(`default answer: ')')counter')dnl +define(`example2', +`define(`counter', `0')dnl +cond(`side(`$1')', `yes', `one comparison: ', + `side(`$1')', `no', `two comparisons: ', + `side(`$1')', `maybe', `three comparisons: ', + `side(`default answer: ')')counter')dnl +example1(`yes') +@result{}one comparison: 3 +example1(`no') +@result{}two comparisons: 3 +example1(`maybe') +@result{}three comparisons: 3 +example1(`feeling rather indecisive today') +@result{}default answer: 4 +example2(`yes') +@result{}one comparison: 1 +example2(`no') +@result{}two comparisons: 2 +example2(`maybe') +@result{}three comparisons: 3 +example2(`feeling rather indecisive today') +@result{}default answer: 4 +@end example + +@cindex joining arguments +@cindex arguments, joining +@cindex concatenating arguments +Another common task that requires iteration is joining a list of +arguments into a single string. + +@deffn Composite join (@ovar{separator}, @ovar{args@dots{}}) +@deffnx Composite joinall (@ovar{separator}, @ovar{args@dots{}}) +Generate a single-quoted string, consisting of each @var{arg} separated +by @var{separator}. While @code{joinall} always outputs a +@var{separator} between arguments, @code{join} avoids the +@var{separator} for an empty @var{arg}. +@end deffn + +Here are some examples of its usage, based on the implementation +@file{m4-@value{VERSION}/@/examples/@/join.m4} distributed in this +package: + +@comment examples +@example +$ @kbd{m4 -I examples} +include(`join.m4') +@result{} +join,join(`-'),join(`-', `'),join(`-', `', `') +@result{},,, +joinall,joinall(`-'),joinall(`-', `'),joinall(`-', `', `') +@result{},,,- +join(`-', `1') +@result{}1 +join(`-', `1', `2', `3') +@result{}1-2-3 +join(`', `1', `2', `3') +@result{}123 +join(`-', `', `1', `', `', `2', `') +@result{}1-2 +joinall(`-', `', `1', `', `', `2', `') +@result{}-1---2- +join(`,', `1', `2', `3') +@result{}1,2,3 +define(`nargs', `$#')dnl +nargs(join(`,', `1', `2', `3')) +@result{}1 +@end example + +Examining the implementation shows some interesting points about several +m4 programming idioms. + +@comment examples +@example +$ @kbd{m4 -I examples} +undivert(`join.m4')dnl +@result{}divert(`-1') +@result{}# join(sep, args) - join each non-empty ARG into a single +@result{}# string, with each element separated by SEP +@result{}define(`join', +@result{}`ifelse(`$#', `2', ``$2'', +@result{} `ifelse(`$2', `', `', ``$2'_')$0(`$1', shift(shift($@@)))')') +@result{}define(`_join', +@result{}`ifelse(`$#$2', `2', `', +@result{} `ifelse(`$2', `', `', ``$1$2'')$0(`$1', shift(shift($@@)))')') +@result{}# joinall(sep, args) - join each ARG, including empty ones, +@result{}# into a single string, with each element separated by SEP +@result{}define(`joinall', ``$2'_$0(`$1', shift($@@))') +@result{}define(`_joinall', +@result{}`ifelse(`$#', `2', `', ``$1$3'$0(`$1', shift(shift($@@)))')') +@result{}divert`'dnl +@end example + +First, notice that this implementation creates helper macros +@code{_join} and @code{_joinall}. This division of labor makes it +easier to output the correct number of @var{separator} instances: +@code{join} and @code{joinall} are responsible for the first argument, +without a separator, while @code{_join} and @code{_joinall} are +responsible for all remaining arguments, always outputting a separator +when outputting an argument. + +Next, observe how @code{join} decides to iterate to itself, because the +first @var{arg} was empty, or to output the argument and swap over to +@code{_join}. If the argument is non-empty, then the nested +@code{ifelse} results in an unquoted @samp{_}, which is concatenated +with the @samp{$0} to form the next macro name to invoke. The +@code{joinall} implementation is simpler since it does not have to +suppress empty @var{arg}; it always executes once then defers to +@code{_joinall}. + +Another important idiom is the idea that @var{separator} is reused for +each iteration. Each iteration has one less argument, but rather than +discarding @samp{$1} by iterating with @code{$0(shift($@@))}, the macro +discards @samp{$2} by using @code{$0(`$1', shift(shift($@@)))}. + +Next, notice that it is possible to compare more than one condition in a +single @code{ifelse} test. The test of @samp{$#$2} against @samp{2} +allows @code{_join} to iterate for two separate reasons---either there +are still more than two arguments, or there are exactly two arguments +but the last argument is not empty. + +Finally, notice that these macros require exactly two arguments to +terminate recursion, but that they still correctly result in empty +output when given no @var{args} (i.e., zero or one macro argument). On +the first pass when there are too few arguments, the @code{shift} +results in no output, but leaves an empty string to serve as the +required second argument for the second pass. Put another way, +@samp{`$1', shift($@@)} is not the same as @samp{$@@}, since only the +former guarantees at least two arguments. + +@cindex quote manipulation +@cindex manipulating quotes +Sometimes, a recursive algorithm requires adding quotes to each element, +or treating multiple arguments as a single element: @deffn Composite quote (@dots{}) @deffnx Composite dquote (@dots{}) @@ -2594,6 +2967,7 @@ An actual implementation of these three @file{m4-@value{VERSION}/@/examples/@/quote.m4} in this package. First, let's examine their usage: +@comment examples @example $ @kbd{m4 -I examples} include(`quote.m4') @@ -2626,6 +3000,7 @@ other hand, results in a string no matte possible to tell whether it was invoked without arguments based on the resulting string. +@comment examples @example $ @kbd{m4 -I examples} undivert(`quote.m4')dnl @@ -2640,6 +3015,9 @@ undivert(`quote.m4')dnl @result{}divert`'dnl @end example +It is worth pointing out that @samp{quote(@var{args})} is more efficient +than @samp{joinall(`,', @var{args})} for producing the same output. + @cindex nine arguments, more than @cindex more than nine arguments @cindex arguments, more than nine @@ -2687,6 +3065,7 @@ invocation is restored. It can, for example, be used for simple counting: +@comment examples @example $ @kbd{m4 -I examples} include(`forloop.m4') @@ -2697,6 +3076,7 @@ forloop(`i', `1', `8', `i ') For-loops can be nested, like: +@comment examples @example $ @kbd{m4 -I examples} include(`forloop.m4') @@ -2724,6 +3104,7 @@ not finished, it increments the iterator Here is an actual implementation of @code{forloop}, distributed as @file{m4-@value{VERSION}/@/examples/@/forloop.m4} in this package: +@comment examples @example $ @kbd{m4 -I examples} undivert(`forloop.m4')dnl @@ -2770,6 +3151,7 @@ using an implementation of @code{foreach @file{m4-@value{VERSION}/@/examples/@/foreach.m4}, and @code{foreachq} in @file{m4-@value{VERSION}/@/examples/@/foreachq.m4}. +@comment examples @example $ @kbd{m4 -I examples} include(`foreach.m4') @@ -2792,6 +3174,7 @@ It is possible to be more complex; each or @var{quote-list} can itself be a list, to pass as further arguments to a helper macro. This example generates a shell case statement: +@comment examples @example $ @kbd{m4 -I examples} include(`foreach.m4') @@ -2821,6 +3204,7 @@ needed to grab the first element of a li through the original list. Here is a simple implementation of @code{foreach}: +@comment examples @example $ @kbd{m4 -I examples} undivert(`foreach.m4')dnl @@ -2847,6 +3231,7 @@ expecting the macro name on output after during list iteration and the final layer removed during the final rescan: +@comment examples @example $ @kbd{m4 -I examples} define(`a', `1')define(`b', `2')define(`c', `3') @@ -2871,6 +3256,7 @@ foreachq(`x', ```a'', ``(b'', ``c)''', ` Obviously, @code{foreachq} did a better job; here is its implementation: +@comment examples @example $ @kbd{m4 -I examples} undivert(`foreachq.m4')dnl @@ -2893,10 +3279,25 @@ has its own severe flaw. Whereas the @c linear, this macro is quadratic in the number of list elements, and is much more likely to trip up the limit set by the command line option @option{--nesting-limit} (or @option{-L}, @pxref{Limits control, , -Invoking m4}). (It is possible to have robust iteration with linear -behavior for either list style. See if you can learn from the best -elements of both of these implementations to create robust macros; or -@pxref{Improved foreach, , Answers}). +Invoking m4}). Additionally, this implementation does not expand +@samp{defn(`@var{iterator}')} very well, when compared with +@code{foreach}. + +@comment examples +@example +$ @kbd{m4 -I examples} +include(`foreach.m4')include(`foreachq.m4') +@result{} +foreach(`name', `(`a', `b')', ` defn(`name')') +@result{} a b +foreachq(`name', ``a', `b'', ` defn(`name')') +@result{} _arg1(`a', `b') _arg1(shift(`a', `b')) +@end example + +It is possible to have robust iteration with linear behavior and sane +@var{iterator} contents for either list style. See if you can learn +from the best elements of both of these implementations to create robust +macros (or @pxref{Improved foreach, , Answers}). @node Debugging @chapter How to debug macros and input @@ -3019,6 +3420,7 @@ option @option{--nesting-limit} (or @opt @option{-t}) can be used to invoke @code{traceon(@var{name})} before parsing input. +@comment The explicit -dp neutralizes the testsuite default of -d. @comment options: -dp -L3 -tifelse @comment status: 1 @example @@ -3181,6 +3583,7 @@ are reset to the default of @samp{aeq}. The expansion of @code{debugmode} is void. @end deffn +@comment The explicit -dp neutralizes the testsuite default of -d. @comment options: -dp @example $ @kbd{m4} @@ -3229,7 +3632,7 @@ The expansion of @code{debugfile} is voi @end deffn @example -$ @kbd{m4} +$ @kbd{m4 -d} traceon(`divnum') @result{} divnum(`extra') @@ -3484,6 +3887,34 @@ echo(hi,hi)bye) @result{}1:HIhibye: @end example +However, if you are not worried about portability, using @samp{(} and +@samp{)} as quoting characters has an interesting property---you can use +it to compute a quoted string containing the expansion of any quoted +text, as long as the expansion results in both balanced quotes and +balanced parentheses. The trick is realizing @code{expand} uses +@samp{$1} unquoted, to trigger its expansion using the normal quoting +characters, but uses extra parentheses to group unquoted commas that +occur in the expansion without consuming whitespace following those +commas. Then @code{_expand} uses @code{changequote} to convert the +extra parentheses back into quoting characters. Note that it takes two +more @code{changequote} invocations to restore the original quotes. +Contrast the behavior on whitespace when using @samp{$*}, via +@code{quote}, to attempt the same task. + +@example +changequote(`[', `]')dnl +define([a], [1, (b)])dnl +define([b], [2])dnl +define([quote], [[$*]])dnl +define([expand], [_$0(($1))])dnl +define([_expand], + [changequote([(], [)])$1changequote`'changequote(`[', `]')])dnl +expand([a, a, [a, a], [[a, a]]]) +@result{}1, (2), 1, (2), a, a, [a, a] +quote(a, a, [a, a], [[a, a]]) +@result{}1,(2),1,(2),a, a,[a, a] +@end example + If @var{end} is a prefix of @var{start}, the end-quote will be recognized in preference to a nested begin-quote. In particular, changing the quotes to have the same string for @var{start} and @@ -3512,6 +3943,18 @@ changequote(`"', `"') @result{}hiHIhi @end example +@ignore +@comment And another stress test, not worth documenting in the manual. +@example +define(`aaaaaaaaaaaaaaaaaaaa', `A')define(`q', `"$@@"') +@result{} +changequote(`"', `"') +@result{} +q(q("aaaaaaaaaaaaaaaaaaaa", "a")) +@result{}A,a +@end example +@end ignore + It is an error if the end of file occurs within a quoted string. @comment status: 1 @@ -3635,26 +4078,32 @@ implementations, it is a good idea to av @samp{)} as the first character in @var{start}. @example -define(`echo', `$#:$@@:') +define(`echo', `$#:$*:$@@:') @result{} define(`hi', `HI') @result{} changecom(`(',`)') @result{} echo(hi) -@result{}0::(hi) +@result{}0:::(hi) changecom @result{} changecom(`((', `))') @result{} echo(hi) -@result{}1:HI: +@result{}1:HI:HI: echo((hi)) -@result{}0::((hi)) +@result{}0:::((hi)) changecom(`,', `)') @result{} echo(hi,hi)bye) -@result{}1:HI,hi)bye: +@result{}1:HI,hi)bye:HI,hi)bye: +changecom +@result{} +echo(hi,`,`'hi',hi) +@result{}3:HI,,HI,HI:HI,,`'hi,HI: +echo(hi,`,`'hi',hi`'changecom(`,,', `hi')) +@result{}3:HI,,`'hi,HI:HI,,`'hi,HI: @end example It is an error if the end of file occurs within a comment. @@ -3941,6 +4390,64 @@ in which they were saved (LIFO---last in behavior is likely to change in a future release, to match @acronym{POSIX}, so you should not depend on this order. +It is possible to emulate @acronym{POSIX} behavior even +with older versions of @acronym{GNU} M4 by including the file +@file{m4-@value{VERSION}/@/examples/@/wrapfifo.m4} from the +distribution: + +@comment examples +@example +$ @kbd{m4 -I examples} +undivert(`wrapfifo.m4')dnl +@result{}dnl Redefine m4wrap to have FIFO semantics. +@result{}define(`_m4wrap_level', `0')dnl +@result{}define(`m4wrap', +@result{}`ifdef(`m4wrap'_m4wrap_level, +@result{} `define(`m4wrap'_m4wrap_level, +@result{} defn(`m4wrap'_m4wrap_level)`$1')', +@result{} `builtin(`m4wrap', `define(`_m4wrap_level', +@result{} incr(_m4wrap_level))dnl +@result{}m4wrap'_m4wrap_level)dnl +@result{}define(`m4wrap'_m4wrap_level, `$1')')')dnl +include(`wrapfifo.m4') +@result{} +m4wrap(`a`'m4wrap(`c +', `d')')m4wrap(`b') +@result{} +^D +@result{}abc +@end example + +It is likewise possible to emulate LIFO behavior without resorting to +the @acronym{GNU} M4 extension of @code{builtin}, by including the file +@file{m4-@value{VERSION}/@/examples/@/wraplifo.m4} from the +distribution. (Unfortunately, both examples shown here share some +subtle bugs. See if you can find and correct them; or @pxref{Improved +m4wrap, , Answers}). + +@comment examples +@example +$ @kbd{m4 -I examples} +undivert(`wraplifo.m4')dnl +@result{}dnl Redefine m4wrap to have LIFO semantics. +@result{}define(`_m4wrap_level', `0')dnl +@result{}define(`_m4wrap', defn(`m4wrap'))dnl +@result{}define(`m4wrap', +@result{}`ifdef(`m4wrap'_m4wrap_level, +@result{} `define(`m4wrap'_m4wrap_level, +@result{} `$1'defn(`m4wrap'_m4wrap_level))', +@result{} `_m4wrap(`define(`_m4wrap_level', incr(_m4wrap_level))dnl +@result{}m4wrap'_m4wrap_level)dnl +@result{}define(`m4wrap'_m4wrap_level, `$1')')')dnl +include(`wraplifo.m4') +@result{} +m4wrap(`a`'m4wrap(`c +', `d')')m4wrap(`b') +@result{} +^D +@result{}bac +@end example + Here is an example of implementing a factorial function using @code{m4wrap}: @@ -4047,6 +4554,7 @@ Normally file inclusion is used to inser into the input stream. The contents of the file will be read by @code{m4} and macro calls in the file will be expanded: +@comment examples @example $ @kbd{m4 -I examples} define(`foo', `FOO') @@ -4063,6 +4571,7 @@ of the file can be used to define macros Here is an example, which defines @samp{bar} to expand to the contents of @file{incl.m4}: +@comment examples @example $ @kbd{m4 -I examples} define(`bar', include(`incl.m4')) @@ -4196,6 +4705,20 @@ divert(`1') f m4exit @end example + +@comment Catch regression in 1.4.10 with spilled diversions. + +@example +ifdef(`__unix__', , + `errprint(` skipping: syscmd does not have unix semantics +')m4exit(`77')')dnl +changequote(`[', `]')dnl +syscmd([echo 'divert(1)hi +format(%1000000d, 1)' | m4 | sed 1q])dnl +@result{}hi +sysval +@result{}0 +@end example @end ignore Diversions make it possible to generate output in a different order than @@ -4568,12 +5091,17 @@ index(`gnus, gnats, and armadillos', `da @result{}-1 @end example -Omitting @var{substring} evokes a warning, but still produces output. +Omitting @var{substring} evokes a warning, but still produces output; +contrast this with an empty @var{substring}. @example index(`abc') @error{}m4:stdin:1: Warning: too few arguments to builtin `index' @result{}0 +index(`abc', `') +@result{}0 +index(`abc', `b') +@result{}1 @end example @node Regexp @@ -4646,12 +5174,17 @@ regexp(`abc', `\(\(d\)?\)\(c\)', `\1\2\3 @result{}c @end example -Omitting @var{regexp} evokes a warning, but still produces output. +Omitting @var{regexp} evokes a warning, but still produces output; +contrast this with an empty @var{regexp} argument. @example regexp(`abc') @error{}m4:stdin:1: Warning: too few arguments to builtin `regexp' @result{}0 +regexp(`abc', `') +@result{}0 +regexp(`abc', `', `\\def') +@result{}\def @end example @node Substr @@ -4834,18 +5367,47 @@ to lower case, and @code{capitalize} cha word to upper case and the remaining characters to lower case. @end deffn +First, an example of their usage, using implementations distributed in +@file{m4-@value{VERSION}/@/examples/@/capitalize.m4}. + +@comment examples @example -define(`upcase', `translit(`$*', `a-z', `A-Z')')dnl -define(`downcase', `translit(`$*', `A-Z', `a-z')')dnl -define(`capitalize1', - `regexp(`$1', `^\(\w\)\(\w*\)', - `upcase(`\1')`'downcase(`\2')')')dnl -define(`capitalize', - `patsubst(`$1', `\w+', `capitalize1(`\&')')')dnl +$ @kbd{m4 -I examples} +include(`capitalize.m4') +@result{} +upcase(`GNUs not Unix') +@result{}GNUS NOT UNIX +downcase(`GNUs not Unix') +@result{}gnus not unix capitalize(`GNUs not Unix') @result{}Gnus Not Unix @end example +Now for the implementation. There is a helper macro @code{_capitalize} +which puts only its first word in mixed case. Then @code{capitalize} +merely parses out the words, and replaces them with an invocation of +@code{_capitalize}. (As presented here, the @code{capitalize} macro has +some subtle flaws. You should try to see if you can find and correct +them; or @pxref{Improved capitalize, , Answers}). + +@comment examples +@example +$ @kbd{m4 -I examples} +undivert(`capitalize.m4')dnl +@result{}divert(`-1') +@result{}# upcase(text) +@result{}# downcase(text) +@result{}# capitalize(text) +@result{}# change case of text, simple version +@result{}define(`upcase', `translit(`$*', `a-z', `A-Z')') +@result{}define(`downcase', `translit(`$*', `A-Z', `a-z')') +@result{}define(`_capitalize', +@result{} `regexp(`$1', `^\(\w\)\(\w*\)', +@result{} `upcase(`\1')`'downcase(`\2')')') +@result{}define(`capitalize', `patsubst(`$1', `\w+', `_$0(`\&')')') +@result{}divert`'dnl +@end example + While @code{regexp} replaces the whole input with the replacement as soon as there is a match, @code{patsubst} replaces each @emph{occurrence} of a match and preserves non-matching pieces: @@ -4862,12 +5424,17 @@ patreg(`aba abb 121', `\(.\)\(.\)\1', `\ @result{}bab @end example -Omitting @var{regexp} evokes a warning, but still produces output. +Omitting @var{regexp} evokes a warning, but still produces output; +contrast this with an empty @var{regexp} argument. @example patsubst(`abc') @error{}m4:stdin:1: Warning: too few arguments to builtin `patsubst' @result{}abc +patsubst(`abc', `') +@result{}abc +patsubst(`abc', `', `\\-') +@result{}\-a\-b\-c\- @end example @node Format @@ -4910,11 +5477,14 @@ ifelse(format(`%.1A', `1.999'), `0X1.0P+ format(`%.1A', `1.999'), `0X2.0P+0', `success', format(`%.1A', `1.999')) @result{}success +format(`%g', `0xa.P+1') +@result{}20 @end example Using the @code{forloop} macro defined earlier (@pxref{Forloop}), this example shows how @code{format} can be used to produce tabular output. +@comment examples @example $ @kbd{m4 -I examples} include(`forloop.m4') @@ -5317,7 +5887,8 @@ their existence will confirm platform de @deffnx {Optional builtin} windows Each of these macros is conditionally defined as needed to describe the environment of @code{m4}. If defined, each macro expands to the empty -string. +string. For now, these macros silently ignore all arguments, but in a +future release of M4, they might warn if arguments are present. @end deffn When @acronym{GNU} extensions are in effect (that is, when you did not @@ -5326,12 +5897,26 @@ use the @option{-G} option, @pxref{Limit expand to the empty string. @example +$ @kbd{m4} __gnu__ @result{} -ifdef(`__gnu__', `Extensions are active') +__gnu__(`ignored') +@result{} +Extensions are ifdef(`__gnu__', `active', `inactive') @result{}Extensions are active @end example +@comment options: -G +@example +$ @kbd{m4 -G} +__gnu__ +@result{}__gnu__ +__gnu__(`ignored') +@result{}__gnu__(ignored) +Extensions are ifdef(`__gnu__', `active', `inactive') +@result{}Extensions are inactive +@end example + On UNIX systems, @acronym{GNU} @code{m4} will define @code{@w{__unix__}} by default, or @code{unix} when the @option{-G} option is specified. @@ -5557,7 +6142,7 @@ builtin macro, @code{mkstemp}, for makin @deffn Builtin mkstemp (@var{template}) @deffnx Builtin maketemp (@var{template}) -Expands to a name of a new, empty file, made from the string +Expands to the quoted name of a new, empty file, made from the string @var{template}, which should end with the string @samp{XXXXXX}. The six @samp{X} characters are then replaced with random characters matching the regular expression @samp{[a-zA-Z0-9._-]}, in order to make the file @@ -5569,7 +6154,8 @@ account, and at most only the current us The traditional behavior, standardized by @acronym{POSIX}, is that @code{maketemp} merely replaces the trailing @samp{X} with the process -id, without creating a file, and without ensuring that the resulting +id, without creating a file or quoting the expansion, and without +ensuring that the resulting string is a unique file name. In part, this means that using the same @var{template} twice in the same input file will result in the same expansion. This behavior is a security hole, as it is very easy for @@ -5593,6 +6179,8 @@ chosen: @comment ignore @example $ @kbd{m4} +define(`tmp', `oops') +@result{} maketemp(`/tmp/fooXXXXXX') @result{}/tmp/fooa07346 ifdef(`mkstemp', `define(`maketemp', defn(`mkstemp'))', @@ -5610,31 +6198,73 @@ Unless you use the @option{--traditional version of @code{maketemp} is secure. This means that using the same template to multiple calls will generate multiple files. However, we recommend that you use the new @code{mkstemp} macro, introduced in -@acronym{GNU} M4 1.4.8, which is secure even in traditional mode. +@acronym{GNU} M4 1.4.8, which is secure even in traditional mode. Also, +as of M4 1.4.11, the secure implementation quotes the resulting file +name, so that you are guaranteed to know what file was created even if +the random file name happens to match an existing macro. Notice that +this example is careful to use @code{defn} to avoid unintended expansion +of @samp{foo}. @example $ @kbd{m4} -syscmd(`echo foo??????')dnl -@result{}foo?????? -define(`file1', maketemp(`fooXXXXXX'))dnl -ifelse(esyscmd(`echo foo??????'), `foo??????', `no file', `created') +define(`foo', `errprint(`oops')') +@result{} +syscmd(`rm -f foo-??????')sysval +@result{}0 +define(`file1', maketemp(`foo-XXXXXX'))dnl +ifelse(esyscmd(`echo \` foo-?????? \''), ` foo-?????? ', + `no file', `created') @result{}created -define(`file2', maketemp(`fooXX'))dnl -define(`file3', mkstemp(`fooXXXXXX'))dnl -ifelse(len(file1), len(file2), `same length', `different') +define(`file2', maketemp(`foo-XX'))dnl +define(`file3', mkstemp(`foo-XXXXXX'))dnl +ifelse(len(defn(`file1')), len(defn(`file2')), + `same length', `different') @result{}same length -ifelse(file1, file2, `same', `different file') +ifelse(defn(`file1'), defn(`file2'), `same', `different file') @result{}different file -ifelse(file2, file3, `same', `different file') +ifelse(defn(`file2'), defn(`file3'), `same', `different file') @result{}different file -ifelse(file1, file3, `same', `different file') +ifelse(defn(`file1'), defn(`file3'), `same', `different file') @result{}different file -syscmd(`rm 'file1 file2 file3) +syscmd(`rm 'defn(`file1') defn(`file2') defn(`file3')) @result{} sysval @result{}0 @end example +@ignore +@c Not worth documenting, but make sure we don't leave trailing NUL in +@c the expansion. + +@example +syscmd(`rm -f foo??????')sysval +@result{}0 +len(mkstemp(`fooXXXXX')) +@result{}9 +syscmd(`rm foo??????')sysval +@result{}0 +@end example + +@c Likewise, and ensure that traditional mode leaves the result unquoted +@c without creating a file. + +@comment options: -G +@example +syscmd(`rm -f foo-*')sysval +@result{}0 +len(maketemp(`foo-XXXXX')) +@error{}m4:stdin:2: recommend using mkstemp instead +@result{}9 +define(`abc', `def') +@result{} +maketemp(`foo-abc') +@result{}foo-def +@error{}m4:stdin:4: recommend using mkstemp instead +syscmd(`test -f foo-*')sysval +@result{}1 +@end example +@end ignore + @node Miscellaneous @chapter Miscellaneous builtin macros @@ -5681,9 +6311,10 @@ supplied as part of the argument, as in exact output of @code{errprint} is not very portable to other @code{m4} implementations: @acronym{POSIX} requires that all arguments be printed, but some implementations of @code{m4} only print the first. -Furthermore, some BSD implementations always append a newline for each -@code{errprint} call, regardless of whether the last argument already -had one, and @acronym{POSIX} is silent on whether this is acceptable. +Furthermore, some @acronym{BSD} implementations always append a newline +for each @code{errprint} call, regardless of whether the last argument +already had one, and @acronym{POSIX} is silent on whether this is +acceptable. @node Location @section Printing current location @@ -5720,6 +6351,7 @@ message output. This example reuses the file @file{incl.m4} mentioned earlier (@pxref{Include}): +@comment examples @example $ @kbd{m4 -I examples} define(`foo', ``$0' called at __file__:__line__') @@ -5763,7 +6395,11 @@ __line__ @result{}8 __line__ @result{}11 +m4wrap(`__line__ +') +@result{} ^D +@result{}12 @result{}6 @result{}6 @end example @@ -5823,7 +6459,7 @@ fatal_error(`this is a BAD one, buster') After this macro call, @code{m4} will exit with exit status 1. This macro is only intended for error exits, since the normal exit procedures are -not followed, e.g., diverted text is not undiverted, and saved text +not followed, i.e., diverted text is not undiverted, and saved text (@pxref{M4wrap}) is not reread. (This macro could be made more robust to earlier versions of @code{m4}. You should try to see if you can find weaknesses and correct them; or @pxref{Improved fatal_error, , Answers}). @@ -5943,6 +6579,19 @@ are handled correctly, as well as undefi changed strings for quotes or comments. And future releases of @acronym{GNU} M4 will improve on the utility of frozen files. +@ignore +@c This example is not worth putting in the manual, but caused core +@c dumps in all versions prior to 1.4.11. + +@comment options: -F /dev/null +@example +ifdef(`__unix__', , + `errprint(` skipping: /dev/null not known to exist +')m4exit(`77')')dnl +traceon(`undefined')dnl +@end example +@end ignore + When an @code{m4} run is to be frozen, the automatic undiversion which takes place at end of execution is inhibited. Instead, all positively numbered diversions are saved into the frozen file. @@ -6030,12 +6679,19 @@ once. @chapter Compatibility with other versions of @code{m4} @cindex compatibility -This chapter describes the differences between this implementation of -@code{m4}, and the implementation found under UNIX, notably System V, -Release 3. - -There are also differences in BSD flavors of @code{m4}. No attempt -is made to summarize these here. +This chapter describes the many of the differences between this +implementation of @code{m4}, and of other implementations found under +UNIX, such as System V Release 3, Solaris, and @acronym{BSD} flavors. +In particular, it lists the known differences and extensions to +@acronym{POSIX}. However, the list is not necessarily comprehensive. + +At the time of this writing, @acronym{POSIX} 2001 (also known as IEEE +Std 1003.1-2001) is the latest standard, although a new version of +@acronym{POSIX} is under development and includes several proposals for +modifying what @code{m4} is required to do. The requirements for +@code{m4} are shared between @acronym{SUSv3} and @acronym{POSIX}, and +can be viewed at +@uref{http://www.opengroup.org/onlinepubs/@/000095399/@/utilities/@/m4.html}. @menu * Extensions:: Extensions in @acronym{GNU} M4 @@ -6044,7 +6700,7 @@ is made to summarize these here. @end menu @node Extensions -@section Extensions in @acronym{GNU} @code{m4} +@section Extensions in @acronym{GNU} M4 @cindex @acronym{GNU} extensions @cindex @acronym{POSIX} @@ -6110,7 +6766,8 @@ is modeled after the C library function @item Searches and text substitution through basic regular expressions are supported by the @code{regexp} (@pxref{Regexp}) and @code{patsubst} -(@pxref{Patsubst}) builtins. +(@pxref{Patsubst}) builtins. Some @acronym{BSD} implementations use +extended regular expressions instead. @item The output of shell commands can be read into @code{m4} with @@ -6141,16 +6798,16 @@ The @code{maketemp} (@pxref{Mkstemp}) ma creating a new file with a unique name on every invocation, rather than following the insecure behavior of replacing the trailing @samp{X} characters with the @code{m4} process id. -@end itemize -In addition to the above extensions, @acronym{GNU} @code{m4} implements the -following command line options: @option{-F}, @option{-G}, @option{-I}, -@option{-L}, @option{-R}, @option{-V}, @option{-W}, @option{-d}, @option{-i}, -@option{-l}, @option{--debugfile} and @option{-t}. @xref{Invoking m4}, for a +@item +@acronym{POSIX} only requires support for the command line options +@option{-s}, @option{-D}, and @option{-U}, so all other options accepted +by @acronym{GNU} M4 are extensions. @xref{Invoking m4}, for a description of these options. -Also, the debugging and tracing facilities in @acronym{GNU} @code{m4} are much +The debugging and tracing facilities in @acronym{GNU} @code{m4} are much more extensive than in most other versions of @code{m4}. +@end itemize @node Incompatibilities @section Facilities in System V @code{m4} not in @acronym{GNU} @code{m4} @@ -6163,18 +6820,21 @@ future release of @acronym{GNU} @code{m4 @itemize @bullet @item -System V @code{m4} supports multiple arguments to @code{defn}, and -@acronym{POSIX} requires it. This is not yet implemented in @acronym{GNU} -@code{m4}. Unfortunately, this means it is not possible to mix builtins -and other text into a single macro; a helper macro is required. +@acronym{POSIX} requires support for multiple arguments to @code{defn}, +without any clarification on how @code{defn} behaves when one of the +multiple arguments names a builtin. System V @code{m4} and some other +implementations allow mixing builtins and text macros into a single +macro. @acronym{GNU} @code{m4} only supports joining multiple text +arguments, although a future implementation may lift this restriction to +behave more like System V@. The only portable way to join text macros +with builtins is via helper macros and implicit concatenation of macro +results. @item @acronym{POSIX} requires an application to exit with non-zero status if it wrote an error message to stderr. This has not yet been consistently implemented for the various builtins that are required to issue an error -(such as @code{include} (@pxref{Include}) when a file is unreadable, -@code{eval} (@pxref{Eval}) when an argument cannot be parsed, or using -@code{m4exit} (@pxref{M4exit}) with a non-numeric argument). +(such as @code{eval} (@pxref{Eval}) when an argument cannot be parsed). @item Some traditional implementations only allow reading standard input @@ -6189,31 +6849,6 @@ argument to @code{m4wrap} is saved for l @acronym{GNU} @code{m4} saves and processes all arguments, with output separated by spaces. -However, it is possible to emulate @acronym{POSIX} behavior by -including the file @file{m4-@value{VERSION}/@/examples/@/wrapfifo.m4} -from the distribution: - -@example -undivert(`wrapfifo.m4')dnl -@result{}dnl Redefine m4wrap to have FIFO semantics. -@result{}define(`_m4wrap_level', `0')dnl -@result{}define(`m4wrap', -@result{}`ifdef(`m4wrap'_m4wrap_level, -@result{} `define(`m4wrap'_m4wrap_level, -@result{} defn(`m4wrap'_m4wrap_level)`$1')', -@result{} `builtin(`m4wrap', `define(`_m4wrap_level', -@result{} incr(_m4wrap_level))dnl -@result{}m4wrap'_m4wrap_level)dnl -@result{}define(`m4wrap'_m4wrap_level, `$1')')')dnl -include(`wrapfifo.m4') -@result{} -m4wrap(`a`'m4wrap(`c -', `d')')m4wrap(`b') -@result{} -^D -@result{}abc -@end example - @item @acronym{POSIX} states that builtins that require arguments, but are called without arguments, have undefined behavior. Traditional @@ -6230,12 +6865,12 @@ definition on the stack, as if doing @co @code{pushdef(`f',`1')}. @acronym{POSIX} allows either behavior. @item -@acronym{POSIX} requires @code{syscmd} (@pxref{Syscmd}) to evaluate -command output for macro expansion, but this appears to be a mistake -in @acronym{POSIX} since traditional implementations did not do this. -@acronym{GNU} @code{m4} follows traditional behavior in @code{syscmd}, and -provides the extension @code{esyscmd} that provides the @acronym{POSIX} -semantics. +@acronym{POSIX} 2001 requires @code{syscmd} (@pxref{Syscmd}) to evaluate +command output for macro expansion, but this was a mistake that is +anticipated to be corrected in the next version of @acronym{POSIX}. +@acronym{GNU} @code{m4} follows traditional behavior in @code{syscmd} +where output is not rescanned, and provides the extension @code{esyscmd} +that does scan the output. @item At one point, @acronym{POSIX} required @code{changequote(@var{arg})} @@ -6266,8 +6901,8 @@ Most implementations of @code{m4} give m comments when parsing, meaning that if the start delimiter given to @code{changecom} (@pxref{Changecom}) starts with a macro name, comments are effectively disabled. @acronym{POSIX} does not specify what the -precedence is, so the @acronym{GNU} @code{m4} parser recognizes -comments, then macros, then quoted strings. +precedence is, so this version of @acronym{GNU} @code{m4} parser +recognizes comments, then macros, then quoted strings. @item Traditional implementations allow argument collection, but not string @@ -6297,7 +6932,7 @@ that is preserved even if the macro is c @item @acronym{POSIX} requires @code{eval} (@pxref{Eval}) to treat all -operators with the same precedence as C. However, earlier versions of +operators with the same precedence as C@. However, earlier versions of @acronym{GNU} @code{m4} followed the traditional behavior of other @code{m4} implementations, where bitwise and logical negation (@samp{~} and @samp{!}) have lower precedence than equality operators; and where @@ -6311,9 +6946,11 @@ requires @samp{=} to cause an error, but implementations allowed it as an alias for @samp{==}. @item -@acronym{POSIX} requires @code{translit} (@pxref{Translit}) to treat -each character of the second and third arguments literally, but @acronym{GNU} -@code{m4} treats @samp{-} as a range operator. +@acronym{POSIX} 2001 requires @code{translit} (@pxref{Translit}) to +treat each character of the second and third arguments literally. +However, it is anticipated that the next version of @acronym{POSIX} will +allow the @acronym{GNU} @code{m4} behavior of treating @samp{-} as a +range operator. @item @acronym{POSIX} requires @code{m4} to honor the locale environment @@ -6343,9 +6980,9 @@ There are a few other incompatibilities the sync lines when the text is being diverted, and System V @code{m4} when the diverted text is being brought back. -The problem is which lines and file names should be attached to text that -is being, or has been, diverted. System V @code{m4} regards all the -diverted text as being generated by the source line containing the +The problem is which lines and file names should be attached to text +that is being, or has been, diverted. System V @code{m4} regards all +the diverted text as being generated by the source line containing the @code{undivert} call, whereas @acronym{GNU} @code{m4} regards the diverted text as being generated at the time it is diverted. @@ -6418,7 +7055,9 @@ presented here. * Improved exch:: Solution for @code{exch} * Improved forloop:: Solution for @code{forloop} * Improved foreach:: Solution for @code{foreach} +* Improved m4wrap:: Solution for @code{m4wrap} * Improved cleardivert:: Solution for @code{cleardivert} +* Improved capitalize:: Solution for @code{capitalize} * Improved fatal_error:: Solution for @code{fatal_error} @end menu @@ -6451,6 +7090,7 @@ shipped as @file{m4-@value{VERSION}/@/ex version also optimizes based on the fact that the starting bound does not need to be passed to the helper @code{@w{_forloop}}. +@comment examples @example $ @kbd{m4 -I examples} undivert(`forloop2.m4')dnl @@ -6460,7 +7100,7 @@ undivert(`forloop2.m4')dnl @result{}# performs sanity check that FROM is larger than TO @result{}# allows complex numerical expressions in TO and FROM @result{}define(`forloop', `ifelse(eval(`($3) >= ($2)'), `1', -@result{} `pushdef(`$1', eval(`$2'))_forloop(`$1', +@result{} `pushdef(`$1', eval(`$2'))_$0(`$1', @result{} eval(`$3'), `$4')popdef(`$1')')') @result{}define(`_forloop', @result{} `$3`'ifelse(indir(`$1'), `$2', `', @@ -6479,6 +7119,48 @@ forloop(`i', `a', `b', `non-numeric boun @result{} @end example +One other change to notice is that the improved version used @samp{_$0} +rather than @samp{_foreach} to invoke the helper routine. In general, +this is a good practice to follow, because then the set of macros can be +uniformly transformed. The following example shows a transformation +that doubles the current quoting and appends a suffix @samp{2} to each +transformed macro. If @code{foreach} refers to the literal +@samp{_foreach}, then @code{foreach2} invokes @code{_foreach} instead of +the intended @code{_foreach2}, and the mixing of quoting paradigms leads +to an infinite recursion loop in this example. + +@comment options: -L9 +@comment status: 1 +@comment examples +@example +$ @kbd{m4 -d -L 9 -I examples} +define(`arg1', `$1')include(`forloop2.m4')include(`quote.m4') +@result{} +define(`double', `define(`$1'`2', + arg1(patsubst(dquote(defn(`$1')), `[`']', `\&\&')))') +@result{} +double(`forloop')double(`_forloop')defn(`forloop2') +@result{}ifelse(eval(``($3) >= ($2)''), ``1'', +@result{} ``pushdef(``$1'', eval(``$2''))_$0(``$1'', +@result{} eval(``$3''), ``$4'')popdef(``$1'')'') +forloop(i, 1, 5, `ifelse(')forloop(i, 1, 5, `)') +@result{} +changequote(`[', `]')changequote([``], ['']) +@result{} +forloop2(i, 1, 5, ``ifelse('')forloop2(i, 1, 5, ``)'') +@result{} +changequote`'include(`forloop.m4') +@result{} +double(`forloop')double(`_forloop')defn(`forloop2') +@result{}pushdef(``$1'', ``$2'')_forloop($@@)popdef(``$1'') +forloop(i, 1, 5, `ifelse(')forloop(i, 1, 5, `)') +@result{} +changequote(`[', `]')changequote([``], ['']) +@result{} +forloop2(i, 1, 5, ``ifelse('')forloop2(i, 1, 5, ``)'') +@error{}m4:stdin:12: recursion limit of 9 exceeded, use -L<N> to change it +@end example + Of course, it is possible to make even more improvements, such as adding an optional step argument, or allowing iteration through descending sequences. @acronym{GNU} Autoconf provides some of these @@ -6491,6 +7173,7 @@ The @code{foreach} and @code{foreachq} m presented earlier each have flaws. First, we will examine and fix the quadratic behavior of @code{foreachq}: +@comment examples @example $ @kbd{m4 -I examples} include(`foreachq.m4') @@ -6532,6 +7215,7 @@ fewer macros, is less likely to run into importantly, performs faster. The fixed version of @code{foreachq} can be found in @file{m4-@value{VERSION}/@/examples/@/foreachq2.m4}: +@comment examples @example $ @kbd{m4 -I examples} include(`foreachq2.m4') @@ -6541,7 +7225,7 @@ undivert(`foreachq2.m4')dnl @result{}divert(`-1') @result{}# foreachq(x, `item_1, item_2, ..., item_n', stmt) @result{}# quoted list, improved version -@result{}define(`foreachq', `pushdef(`$1')_foreachq($@@)popdef(`$1')') +@result{}define(`foreachq', `pushdef(`$1')_$0($@@)popdef(`$1')') @result{}define(`_arg1q', ``$1'') @result{}define(`_rest', `ifelse(`$#', `1', `', `dquote(shift($@@))')') @result{}define(`_foreachq', `ifelse(`$2', `', `', @@ -6565,15 +7249,72 @@ Note that the fixed version calls unquot in turn must re-supply the layer of quotes lost in the macro invocation. Contrast the use of @code{@w{_arg1q}}, which quotes the first list element, with @code{@w{_arg1}} of the earlier implementation that -returned the first list element directly. +returned the first list element directly. Additionally, by calling the +helper method immediately, the @samp{defn(`@var{iterator}')} no longer +contains unexpanded macros. + +The astute m4 programmer might notice that the solution above still uses +more memory, and thus more time, than strictly necessary. Note that +@samp{$2}, which contains an arbitrarily long quoted list, is expanded +and rescanned three times per iteration of @code{_foreachq}. +Furthermore, every iteration of the algorithm effectively unboxes then +reboxes the list, which costs a couple of macro invocations. It is +possible to rewrite the algorithm for a bit more speed by swapping the +order of the arguments to @code{_foreachq} in order to operate on an +unboxed list in the first place, and by using the fixed-length @samp{$#} +instead of an arbitrary length list as the key to end recursion. This +alternative approach is available as +@file{m4-@value{VERSION}/@/examples/@/foreach3.m4}: -For a different approach, the improved version of @code{foreach}, +@comment examples +@example +$ @kbd{m4 -I examples} +include(`foreachq3.m4') +@result{} +undivert(`foreachq3.m4')dnl +@result{}divert(`-1') +@result{}# foreachq(x, `item_1, item_2, ..., item_n', stmt) +@result{}# quoted list, alternate improved version +@result{}define(`foreachq', +@result{}`pushdef(`$1')_$0(`$1', `$3'ifelse(`$2', `', `', +@result{} `, $2'))popdef(`$1')') +@result{}define(`_foreachq', `ifelse(`$#', `2', `', +@result{} `define(`$1', `$3')$2`'$0(`$1', `$2'ifelse(`$#', `3', `', +@result{} `, shift(shift(shift($@@)))'))')') +@result{}divert`'dnl +traceon(`shift')debugmode(`aq') +@result{} +foreachq(`x', ``1', `2', `3', `4'', `x +')dnl +@result{}1 +@error{}m4trace: -4- shift(`x', `x +@error{}', `1', `2', `3', `4') +@error{}m4trace: -3- shift(`x +@error{}', `1', `2', `3', `4') +@error{}m4trace: -2- shift(`1', `2', `3', `4') +@result{}2 +@error{}m4trace: -4- shift(`x', `x +@error{}', `2', `3', `4') +@error{}m4trace: -3- shift(`x +@error{}', `2', `3', `4') +@error{}m4trace: -2- shift(`2', `3', `4') +@result{}3 +@error{}m4trace: -4- shift(`x', `x +@error{}', `3', `4') +@error{}m4trace: -3- shift(`x +@error{}', `3', `4') +@error{}m4trace: -2- shift(`3', `4') +@result{}4 +@end example + +For yet another approach, the improved version of @code{foreach}, available in @file{m4-@value{VERSION}/@/examples/@/foreach2.m4}, simply overquotes the arguments to @code{@w{_foreach}} to begin with, using @code{dquote_elt}. Then @code{@w{_foreach}} can just use @code{@w{_arg1}} to remove the extra layer of quoting that was added up front: +@comment examples @example $ @kbd{m4 -I examples} include(`foreach2.m4') @@ -6583,7 +7324,7 @@ undivert(`foreach2.m4')dnl @result{}divert(`-1') @result{}# foreach(x, (item_1, item_2, ..., item_n), stmt) @result{}# parenthesized list, improved version -@result{}define(`foreach', `pushdef(`$1')_foreach(`$1', +@result{}define(`foreach', `pushdef(`$1')_$0(`$1', @result{} (dquote(dquote_elt$2)), `$3')popdef(`$1')') @result{}define(`_arg1', `$1') @result{}define(`_foreach', `ifelse(`$2', `(`')', `', @@ -6609,16 +7350,19 @@ foreach(`x', `(`1', `2', `3', `4')', `x In summary, recursion over list elements is trickier than it appeared at first glance, but provides a powerful idiom within @code{m4} processing. As a final demonstration, both list styles are now able to handle -several scenarios that would wreak havoc on the original -implementations. This points out one other difference between the two +several scenarios that would wreak havoc on one or both of the original +implementations. This points out one other difference between the list styles. @code{foreach} evaluates unquoted list elements only once, -in preparation for calling @code{@w{_foreach}}. But @code{foreachq} +in preparation for calling @code{@w{_foreach}}, similary for +@code{foreachq} as provided by @file{foreachq3.m4}. But +@code{foreachq}, as provided by @file{foreachq2.m4}, evaluates unquoted list elements twice while visiting the first list element, once in @code{@w{_arg1q}} and once in @code{@w{_rest}}. When deciding which list style to use, one must take into account whether repeating the side effects of unquoted list elements will have any detrimental effects. +@comment examples @example $ @kbd{m4 -I examples} include(`foreach2.m4') @@ -6640,6 +7384,10 @@ foreach(`x', `(`,')', `<x>') / foreachq( dnl 2-element list of unbalanced parentheses foreach(`x', `(`(', `)')', `<x>') / foreachq(`x', ``(', `)'', `<x>') @result{}<(><)> / <(><)> +define(`ab', `oops')dnl using defn(`iterator') +foreach(`x', `(`a', `b')', `defn(`x')') /dnl + foreachq(`x', ``a', `b'', `defn(`x')') +@result{}ab / ab define(`active', `ACT, IVE') @result{} traceon(`active') @@ -6687,6 +7435,77 @@ foreachq(`x', ```active'', ``active''', @result{}<active> @end example +@node Improved m4wrap +@section Solution for @code{m4wrap} + +The replacement @code{m4wrap} versions presented above, designed to +guarantee FIFO or LIFO order regardless of the underlying M4 +implementation, share a bug when dealing with wrapped text that looks +like parameter expansion. Note how the invocation of +@code{m4wrap@var{n}} interprets these parameters, while using the +builtin preserves them for their intended use. + +@comment examples +@example +$ @kbd{m4 -I examples} +include(`wraplifo.m4') +@result{} +m4wrap(`define(`foo', ``$0:'-$1-$*-$#-')foo(`a', `b') +') +@result{} +builtin(`m4wrap', ``'define(`bar', ``$0:'-$1-$*-$#-')bar(`a', `b') +') +@result{} +^D +@result{}bar:-a-a,b-2- +@result{}m4wrap0:---0- +@end example + +Additionally, the computation of @code{_m4wrap_level} and creation of +multiple @code{m4wrap@var{n}} placeholders in the original examples is +more expensive in time and memory than strictly necessary. Notice how +the improved version grabs the wrapped text via @code{defn} to avoid +parameter expansion, then undefines @code{_m4wrap_text}, before +stripping a level of quotes with @code{_arg1} to expand the text. That +way, each level of wrapping reuses the single placeholder, which starts +each nesting level in an undefined state. + +Finally, it is worth emulating the @acronym{GNU} M4 extension of saving +all arguments to @code{m4wrap}, separated by a space, rather than saving +just the first argument. This is done with the @code{join} macro +documented previously (@pxref{Shift}). The improved LIFO example is +shipped as @file{m4-@value{VERSION}/@/examples/@/wraplifo2.m4}, and can +easily be converted to a FIFO solution by swapping the adjacent +invocations of @code{joinall} and @code{defn}. + +@comment examples +@example +$ @kbd{m4 -I examples} +include(`wraplifo2.m4') +@result{} +undivert(`wraplifo2.m4')dnl +@result{}dnl Redefine m4wrap to have LIFO semantics, improved example. +@result{}include(`join.m4')dnl +@result{}define(`_m4wrap', defn(`m4wrap'))dnl +@result{}define(`_arg1', `$1')dnl +@result{}define(`m4wrap', +@result{}`ifdef(`_$0_text', +@result{} `define(`_$0_text', joinall(` ', $@@)defn(`_$0_text'))', +@result{} `_$0(`_arg1(defn(`_$0_text')undefine(`_$0_text'))')dnl +@result{}define(`_$0_text', joinall(` ', $@@))')')dnl +m4wrap(`define(`foo', ``$0:'-$1-$*-$#-')foo(`a', `b') +') +@result{} +m4wrap(`lifo text +m4wrap(`nested', `', `$@@ +')') +@result{} +^D +@result{}lifo text +@result{}foo:-a-a,b-2- +@result{}nested $@@ +@end example + @node Improved cleardivert @section Solution for @code{cleardivert} @@ -6721,6 +7540,131 @@ undivert @result{} @end example +@node Improved capitalize +@section Solution for @code{capitalize} + +The @code{capitalize} macro (@pxref{Patsubst}) as presented earlier does +not allow clients to follow the quoting rule of thumb. Consider the +three macros @code{active}, @code{Active}, and @code{ACTIVE}, and the +difference between calling @code{capitalize} with the expansion of a +macro, expanding the result of a case change, and changing the case of a +double-quoted string: + +@comment examples +@example +$ @kbd{m4 -I examples} +include(`capitalize.m4')dnl +define(`active', `act1, ive')dnl +define(`Active', `Act2, Ive')dnl +define(`ACTIVE', `ACT3, IVE')dnl +upcase(active) +@result{}ACT1,IVE +upcase(`active') +@result{}ACT3, IVE +upcase(``active'') +@result{}ACTIVE +downcase(ACTIVE) +@result{}act3,ive +downcase(`ACTIVE') +@result{}act1, ive +downcase(``ACTIVE'') +@result{}active +capitalize(active) +@result{}Act1 +capitalize(`active') +@result{}Active +capitalize(``active'') +@result{}_capitalize(`active') +define(`A', `OOPS') +@result{} +capitalize(active) +@result{}OOPSct1 +capitalize(`active') +@result{}OOPSctive +@end example + +First, when @code{capitalize} is called with more than one argument, it +was throwing away later arguments, whereas @code{upcase} and +@code{downcase} used @samp{$*} to collect them all. The fix is simple: +use @samp{$*} consistently. + +Next, with single-quoting, @code{capitalize} outputs a single character, +a set of quotes, then the rest of the characters, making it impossible +to invoke @code{Active} after the fact, and allowing the alternate macro +@code{A} to interfere. Here, the solution is to use additional quoting +in the helper macros, then pass the final over-quoted output string +through @code{_arg1} to remove the extra quoting and finally invoke the +concatenated portions as a single string. + +Finally, when passed a double-quoted string, the nested macro +@code{_capitalize} is never invoked because it ended up nested inside +quotes. This one is the toughest to fix. In short, we have no idea how +many levels of quotes are in effect on the substring being altered by +@code{patsubst}. If the replacement string cannot be expressed entirely +in terms of literal text and backslash substitutions, then we need a +mechanism to guarantee that the helper macros are invoked outside of +quotes. In other words, this sounds like a job for @code{changequote} +(@pxref{Changequote}). By changing the active quoting characters, we +can guarantee that replacement text injected by @code{patsubst} always +occurs in the middle of a string that has exactly one level of +over-quoting using alternate quotes; so the replacement text closes the +quoted string, invokes the helper macros, then reopens the quoted +string. In turn, that means the replacement text has unbalanced quotes, +necessitating another round of @code{changequote}. + +In the fixed version below, (also shipped as +@file{m4-@value{VERSION}/@/examples/@/capitalize.m4}), @code{capitalize} +uses the alternate quotes of @samp{<<[} and @samp{]>>} (the longer +strings are chosen so as to be less likely to appear in the text being +converted). The helpers @code{_to_alt} and @code{_from_alt} merely +reduce the number of characters required to perform a +@code{changequote}, since the definition changes twice. The outermost +pair means that @code{patsubst} and @code{_capitalize_alt} are invoked +with alternate quoting; the innermost pair is used so that the third +argument to @code{patsubst} can contain an unbalanced +@samp{]>>}/@samp{<<[} pair. Note that @code{upcase} and @code{downcase} +must be redefined as @code{_upcase_alt} and @code{_downcase_alt}, since +they contain nested quotes but are invoked with the alternate quoting +scheme in effect. + +@comment examples +@example +$ @kbd{m4 -I examples} +include(`capitalize2.m4')dnl +define(`active', `act1, ive')dnl +define(`Active', `Act2, Ive')dnl +define(`ACTIVE', `ACT3, IVE')dnl +define(`A', `OOPS')dnl +capitalize(active) +@result{}Act1,Ive +capitalize(`active') +@result{}Act2, Ive +capitalize(``active'') +@result{}Active +capitalize(```actIVE''') +@result{}`Active' +undivert(`capitalize2.m4')dnl +@result{}divert(`-1') +@result{}# upcase(text) +@result{}# downcase(text) +@result{}# capitalize(text) +@result{}# change case of text, improved version +@result{}define(`upcase', `translit(`$*', `a-z', `A-Z')') +@result{}define(`downcase', `translit(`$*', `A-Z', `a-z')') +@result{}define(`_arg1', `$1') +@result{}define(`_to_alt', `changequote(`<<[', `]>>')') +@result{}define(`_from_alt', `changequote(<<[`]>>, <<[']>>)') +@result{}define(`_upcase_alt', `translit(<<[$*]>>, <<[a-z]>>, <<[A-Z]>>)') +@result{}define(`_downcase_alt', `translit(<<[$*]>>, <<[A-Z]>>, <<[a-z]>>)') +@result{}define(`_capitalize_alt', +@result{} `regexp(<<[$1]>>, <<[^\(\w\)\(\w*\)]>>, +@result{} <<[_upcase_alt(<<[<<[\1]>>]>>)_downcase_alt(<<[<<[\2]>>]>>)]>>)') +@result{}define(`capitalize', +@result{} `_arg1(_to_alt()patsubst(<<[<<[$*]>>]>>, <<[\w+]>>, +@result{} _from_alt()`]>>_$0_alt(<<[\&]>>)<<['_to_alt())_from_alt())') +@result{}divert`'dnl +@end example + @node Improved fatal_error @section Solution for @code{fatal_error} @@ -6761,9 +7705,14 @@ overall M4 package. This manual is unde restrictions, covered later (@pxref{Copying This Manual}). @menu -* Copying:: GNU General Public License +* GNU General Public License:: License for copying the M4 package @end menu +@node GNU General Public License +@appendixsec License for copying the M4 package +@cindex GPL, GNU General Public License +@cindex GNU General Public License +@cindex General Public License (GPL), GNU @include gpl-3.0.texi @node Copying This Manual @@ -6779,6 +7728,11 @@ permissive license is in effect when cop * GNU Free Documentation License:: License for copying this manual @end menu +@node GNU Free Documentation License +@appendixsec License for copying this manual +@cindex FDL, GNU Free Documentation License +@cindex GNU Free Documentation License +@cindex Free Documentation License (FDL), GNU @include fdl.texi @node Indices diff -ruNp m4-1.4.10/doc/stamp-vti m4-1.4.11/doc/stamp-vti --- m4-1.4.10/doc/stamp-vti 2007-07-09 21:20:49.000000000 -0600 +++ m4-1.4.11/doc/stamp-vti 2008-04-02 06:48:14.000000000 -0600 @@ -1,4 +1,4 @@ -@set UPDATED 4 July 2007 -@set UPDATED-MONTH July 2007 -@set EDITION 1.4.10 -@set VERSION 1.4.10 +@set UPDATED 29 March 2008 +@set UPDATED-MONTH March 2008 +@set EDITION 1.4.11 +@set VERSION 1.4.11 diff -ruNp m4-1.4.10/doc/texinfo.tex m4-1.4.11/doc/texinfo.tex --- m4-1.4.10/doc/texinfo.tex 2007-07-09 21:15:36.000000000 -0600 +++ m4-1.4.11/doc/texinfo.tex 2007-10-09 06:20:39.000000000 -0600 @@ -3,15 +3,15 @@ % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % -\def\texinfoversion{2007-07-05.10} +\def\texinfoversion{2007-09-03.05} % % Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, 2007, % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, % 2007 Free Software Foundation, Inc. % -% This texinfo.tex file is free software; you can redistribute it and/or +% This texinfo.tex file 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 +% published by the Free Software Foundation, either version 3 of the % License, or (at your option) any later version. % % This texinfo.tex file is distributed in the hope that it will be @@ -277,6 +277,50 @@ \newdimen\cornerthick \cornerthick=.3pt \newdimen\topandbottommargin \topandbottommargin=.75in +% Output a mark which sets \thischapter, \thissection and \thiscolor. +% We dump everything together because we only have one kind of mark. +% This works because we only use \botmark / \topmark, not \firstmark. +% +% A mark contains a subexpression of the \ifcase ... \fi construct. +% \get*marks macros below extract the needed part using \ifcase. +% +% Another complication is to let the user choose whether \thischapter +% (\thissection) refers to the chapter (section) in effect at the top +% of a page, or that at the bottom of a page. The solution is +% described on page 260 of The TeXbook. It involves outputting two +% marks for the sectioning macros, one before the section break, and +% one after. I won't pretend I can describe this better than DEK... +\def\domark{% + \toks0=\expandafter{\lastchapterdefs}% + \toks2=\expandafter{\lastsectiondefs}% + \toks4=\expandafter{\prevchapterdefs}% + \toks6=\expandafter{\prevsectiondefs}% + \toks8=\expandafter{\lastcolordefs}% + \mark{% + \the\toks0 \the\toks2 + \noexpand\or \the\toks4 \the\toks6 + \noexpand\else \the\toks8 + }% +} +% \topmark doesn't work for the very first chapter (after the title +% page or the contents), so we use \firstmark there -- this gets us +% the mark with the chapter defs, unless the user sneaks in, e.g., +% @setcolor (or @url, or @link, etc.) between @contents and the very +% first @chapter. +\def\gettopheadingmarks{% + \ifcase0\topmark\fi + \ifx\thischapter\empty \ifcase0\firstmark\fi \fi +} +\def\getbottomheadingmarks{\ifcase1\botmark\fi} +\def\getcolormarks{\ifcase2\topmark\fi} + +% Avoid "undefined control sequence" errors. +\def\lastchapterdefs{} +\def\lastsectiondefs{} +\def\prevchapterdefs{} +\def\prevsectiondefs{} +\def\lastcolordefs{} + % Main output routine. \chardef\PAGE = 255 \output = {\onepageout{\pagecontents\PAGE}} @@ -294,7 +338,9 @@ % % Do this outside of the \shipout so @code etc. will be expanded in % the headline as they should be, not taken literally (outputting ''code). + \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}% + \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}% % {% @@ -1261,27 +1307,43 @@ output) for that.)} \ifpdf % - % Color manipulation macros from pdfcolor.tex. + % Color manipulation macros based on pdfcolor.tex. \def\cmykDarkRed{0.28 1 1 0.35} \def\cmykBlack{0 0 0 1} % \def\pdfsetcolor#1{\pdfliteral{#1 k}} - \def\setcolor#1{\mark{#1}\pdfsetcolor{#1}} + % Set color, and create a mark which defines \thiscolor accordingly, + % so that \makeheadline knows which color to restore. + \def\setcolor#1{% + \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}% + \domark + \pdfsetcolor{#1}% + } % \def\maincolor{\cmykBlack} \pdfsetcolor{\maincolor} + \edef\thiscolor{\maincolor} + \def\lastcolordefs{} % - \def\makefootline{ - \baselineskip24pt - \line{\pdfsetcolor{\maincolor}\the\footline}} + \def\makefootline{% + \baselineskip24pt + \line{\pdfsetcolor{\maincolor}\the\footline}% + } % \def\makeheadline{% - \edef\M{\topmark} - \ifx\M\empty\let\M=\maincolor\fi - \vbox to 0pt{\vskip-22.5pt - \line{\vbox to8.5pt{}% - \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\M}}\vss}% - \nointerlineskip} + \vbox to 0pt{% + \vskip-22.5pt + \line{% + \vbox to8.5pt{}% + % Extract \thiscolor definition from the marks. + \getcolormarks + % Typeset the headline with \maincolor, then restore the color. + \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}% + }% + \vss + }% + \nointerlineskip + } % % \pdfcatalog{/PageMode /UseOutlines} @@ -1566,8 +1628,12 @@ output) for that.)} \def\strutheightpercent{.70833} \def\strutdepthpercent {.29167} % +% can get a sort of poor man's double spacing by redefining this. +\def\baselinefactor{1} +% \def\setleading#1{% - \normalbaselineskip = #1\relax + \dimen0 = #1\relax + \normalbaselineskip = \baselinefactor\dimen0 \normallineskip = \lineskipfactor\normalbaselineskip \normalbaselines \setbox\strutbox =\hbox{% @@ -1888,6 +1954,7 @@ end \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT} \font\texti=cmmi10 scaled \mainmagstep \font\textsy=cmsy10 scaled \mainmagstep +\def\textecsize{1095} % A few fonts for @defun names and args. \setfont\defbf\bfshape{10}{\magstep1}{OT1} @@ -1907,6 +1974,7 @@ end \setfont\smallttsl\ttslshape{10}{900}{OT1TT} \font\smalli=cmmi9 \font\smallsy=cmsy9 +\def\smallecsize{0900} % Fonts for small examples (8pt). \def\smallernominalsize{8pt} @@ -1920,6 +1988,7 @@ end \setfont\smallerttsl\ttslshape{10}{800}{OT1TT} \font\smalleri=cmmi8 \font\smallersy=cmsy8 +\def\smallerecsize{0800} % Fonts for title page (20.4pt): \def\titlenominalsize{20pt} @@ -1935,6 +2004,7 @@ end \font\titlesy=cmsy10 scaled \magstep4 \def\authorrm{\secrm} \def\authortt{\sectt} +\def\titleecsize{2074} % Chapter (and unnumbered) fonts (17.28pt). \def\chapnominalsize{17pt} @@ -1948,6 +2018,7 @@ end \setfont\chapsc\scbshape{10}{\magstep3}{OT1} \font\chapi=cmmi12 scaled \magstep2 \font\chapsy=cmsy10 scaled \magstep3 +\def\chapecsize{1728} % Section fonts (14.4pt). \def\secnominalsize{14pt} @@ -1961,6 +2032,7 @@ end \setfont\secsc\scbshape{10}{\magstep2}{OT1} \font\seci=cmmi12 scaled \magstep1 \font\secsy=cmsy10 scaled \magstep2 +\def\sececsize{1440} % Subsection fonts (13.15pt). \def\ssecnominalsize{13pt} @@ -1974,6 +2046,7 @@ end \setfont\ssecsc\scbshape{10}{1315}{OT1} \font\sseci=cmmi12 scaled \magstephalf \font\ssecsy=cmsy10 scaled 1315 +\def\ssececsize{1200} % Reduced fonts for @acro in text (10pt). \def\reducednominalsize{10pt} @@ -1987,6 +2060,7 @@ end \setfont\reducedttsl\ttslshape{10}{1000}{OT1TT} \font\reducedi=cmmi10 \font\reducedsy=cmsy10 +\def\reducedecsize{1000} % reset the current fonts \textfonts @@ -2013,6 +2087,7 @@ end \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT} \font\texti=cmmi10 scaled \mainmagstep \font\textsy=cmsy10 scaled \mainmagstep +\def\textecsize{1000} % A few fonts for @defun names and args. \setfont\defbf\bfshape{10}{\magstephalf}{OT1} @@ -2032,6 +2107,7 @@ end \setfont\smallttsl\ttslshape{10}{900}{OT1TT} \font\smalli=cmmi9 \font\smallsy=cmsy9 +\def\smallecsize{0900} % Fonts for small examples (8pt). \def\smallernominalsize{8pt} @@ -2045,6 +2121,7 @@ end \setfont\smallerttsl\ttslshape{10}{800}{OT1TT} \font\smalleri=cmmi8 \font\smallersy=cmsy8 +\def\smallerecsize{0800} % Fonts for title page (20.4pt): \def\titlenominalsize{20pt} @@ -2060,6 +2137,7 @@ end \font\titlesy=cmsy10 scaled \magstep4 \def\authorrm{\secrm} \def\authortt{\sectt} +\def\titleecsize{2074} % Chapter fonts (14.4pt). \def\chapnominalsize{14pt} @@ -2073,6 +2151,7 @@ end \setfont\chapsc\scbshape{10}{\magstep2}{OT1} \font\chapi=cmmi12 scaled \magstep1 \font\chapsy=cmsy10 scaled \magstep2 +\def\chapecsize{1440} % Section fonts (12pt). \def\secnominalsize{12pt} @@ -2086,6 +2165,7 @@ end \setfont\secsc\scbshape{10}{\magstep1}{OT1} \font\seci=cmmi12 \font\secsy=cmsy10 scaled \magstep1 +\def\sececsize{1200} % Subsection fonts (10pt). \def\ssecnominalsize{10pt} @@ -2099,6 +2179,7 @@ end \setfont\ssecsc\scbshape{10}{1000}{OT1} \font\sseci=cmmi10 \font\ssecsy=cmsy10 +\def\ssececsize{1000} % Reduced fonts for @acro in text (9pt). \def\reducednominalsize{9pt} @@ -2112,6 +2193,7 @@ end \setfont\reducedttsl\ttslshape{10}{900}{OT1TT} \font\reducedi=cmmi9 \font\reducedsy=cmsy9 +\def\reducedecsize{0900} % reduce space between paragraphs \divide\parskip by 2 @@ -2626,6 +2708,35 @@ end \thiseurofont } +% Hacks for glyphs from the EC fonts similar to \euro. We don't +% use \let for the aliases, because sometimes we redefine the original +% macro, and the alias should reflect the redefinition. +\def\guillemetleft{{\ecfont \char"13}} +\def\guillemotleft{\guillemetleft} +\def\guillemetright{{\ecfont \char"14}} +\def\guillemotright{\guillemetright} +\def\guilsinglleft{{\ecfont \char"0E}} +\def\guilsinglright{{\ecfont \char"0F}} +\def\quotedblbase{{\ecfont \char"12}} +\def\quotesinglbase{{\ecfont \char"0D}} +% +\def\ecfont{% + % We can't distinguish serif/sanserif and italic/slanted, but this + % is used for crude hacks anyway (like adding French and German + % quotes to documents typeset with CM, where we lose kerning), so + % hopefully nobody will notice/care. + \edef\ecsize{\csname\curfontsize ecsize\endcsname}% + \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}% + \ifx\curfontstyle\bfstylename + % bold: + \font\thisecfont = ecb\ifusingit{i}{x}\ecsize \space at \nominalsize + \else + % regular: + \font\thisecfont = ec\ifusingit{ti}{rm}\ecsize \space at \nominalsize + \fi + \thisecfont +} + % @registeredsymbol - R in a circle. The font for the R should really % be smaller yet, but lllsize is the best we can do for now. % Adapted from the plain.tex definition of \copyright. @@ -2648,6 +2759,11 @@ end \def\Orb{\mathhexbox20D} \fi +% Quotes. +\chardef\quotedblleft="5C +\chardef\quotedblright=`\" +\chardef\quoteleft=`\` +\chardef\quoteright=`\' \message{page headings,} @@ -2817,6 +2933,33 @@ end \parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}} +% @evenheadingmarks top \thischapter <- chapter at the top of a page +% @evenheadingmarks bottom \thischapter <- chapter at the bottom of a page +% +% The same set of arguments for: +% +% @oddheadingmarks +% @evenfootingmarks +% @oddfootingmarks +% @everyheadingmarks +% @everyfootingmarks + +\def\evenheadingmarks{\headingmarks{even}{heading}} +\def\oddheadingmarks{\headingmarks{odd}{heading}} +\def\evenfootingmarks{\headingmarks{even}{footing}} +\def\oddfootingmarks{\headingmarks{odd}{footing}} +\def\everyheadingmarks#1 {\headingmarks{even}{heading}{#1} + \headingmarks{odd}{heading}{#1} } +\def\everyfootingmarks#1 {\headingmarks{even}{footing}{#1} + \headingmarks{odd}{footing}{#1} } +% #1 = even/odd, #2 = heading/footing, #3 = top/bottom. +\def\headingmarks#1#2#3 {% + \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname + \global\expandafter\let\csname get#1#2marks\endcsname \temp +} + +\everyheadingmarks bottom +\everyfootingmarks bottom % @headings double turns headings on for double-sided printing. % @headings single turns headings on for single-sided printing. @@ -3857,11 +4000,21 @@ end \definedummyword\equiv \definedummyword\error \definedummyword\euro + \definedummyword\guillemetleft + \definedummyword\guillemetright + \definedummyword\guilsinglleft + \definedummyword\guilsinglright \definedummyword\expansion \definedummyword\minus \definedummyword\pounds \definedummyword\point \definedummyword\print + \definedummyword\quotedblbase + \definedummyword\quotedblleft + \definedummyword\quotedblright + \definedummyword\quoteleft + \definedummyword\quoteright + \definedummyword\quotesinglbase \definedummyword\result \definedummyword\textdegree % @@ -3991,11 +4144,21 @@ end \def\equiv{==}% \def\error{error}% \def\euro{euro}% + \def\guillemetleft{<<}% + \def\guillemetright{>>}% + \def\guilsinglleft{<}% + \def\guilsinglright{>}% \def\expansion{==>}% \def\minus{-}% \def\pounds{pounds}% \def\point{.}% \def\print{-|}% + \def\quotedblbase{"}% + \def\quotedblleft{"}% + \def\quotedblright{"}% + \def\quoteleft{`}% + \def\quoteright{'}% + \def\quotesinglbase{,}% \def\result{=>}% \def\textdegree{degrees}% % @@ -4596,11 +4759,15 @@ end \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} -% Each @chapter defines this as the name of the chapter. -% page headings and footings can use it. @section does likewise. -% However, they are not reliable, because we don't use marks. +% Each @chapter defines these (using marks) as the number+name, number +% and name of the chapter. Page headings and footings can use +% these. @section does likewise. \def\thischapter{} +\def\thischapternum{} +\def\thischaptername{} \def\thissection{} +\def\thissectionnum{} +\def\thissectionname{} \newcount\absseclevel % used to calculate proper heading level \newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count @@ -4901,7 +5068,20 @@ end \def\chapbreak{\dobreak \chapheadingskip {-4000}} \def\chappager{\par\vfill\supereject} -\def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi} +% Because \domark is called before \chapoddpage, the filler page will +% get the headings for the next chapter, which is wrong. But we don't +% care -- we just disable all headings on the filler page. +\def\chapoddpage{% + \chappager + \ifodd\pageno \else + \begingroup + \evenheadline={\hfil}\evenfootline={\hfil}% + \oddheadline={\hfil}\oddfootline={\hfil}% + \hbox to 0pt{}% + \chappager + \endgroup + \fi +} \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname} @@ -4935,45 +5115,72 @@ end \def\Yappendixkeyword{Yappendix} % \def\chapmacro#1#2#3{% + % Insert the first mark before the heading break (see notes for \domark). + \let\prevchapterdefs=\lastchapterdefs + \let\prevsectiondefs=\lastsectiondefs + \gdef\lastsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}% + \gdef\thissection{}}% + % + \def\temptype{#2}% + \ifx\temptype\Ynothingkeyword + \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}% + \gdef\thischapter{\thischaptername}}% + \else\ifx\temptype\Yomitfromtockeyword + \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}% + \gdef\thischapter{}}% + \else\ifx\temptype\Yappendixkeyword + \toks0={#1}% + \xdef\lastchapterdefs{% + \gdef\noexpand\thischaptername{\the\toks0}% + \gdef\noexpand\thischapternum{\appendixletter}% + \gdef\noexpand\thischapter{\putwordAppendix{} \noexpand\thischapternum: + \noexpand\thischaptername}% + }% + \else + \toks0={#1}% + \xdef\lastchapterdefs{% + \gdef\noexpand\thischaptername{\the\toks0}% + \gdef\noexpand\thischapternum{\the\chapno}% + \gdef\noexpand\thischapter{\putwordChapter{} \noexpand\thischapternum: + \noexpand\thischaptername}% + }% + \fi\fi\fi + % + % Output the mark. Pass it through \safewhatsit, to take care of + % the preceding space. + \safewhatsit\domark + % + % Insert the chapter heading break. \pchapsepmacro + % + % Now the second mark, after the heading break. No break points + % between here and the heading. + \let\prevchapterdefs=\lastchapterdefs + \let\prevsectiondefs=\lastsectiondefs + \domark + % {% \chapfonts \rm % - % Have to define \thissection before calling \donoderef, because the + % Have to define \lastsection before calling \donoderef, because the % xref code eventually uses it. On the other hand, it has to be called % after \pchapsepmacro, or the headline will change too soon. - \gdef\thissection{#1}% - \gdef\thischaptername{#1}% + \gdef\lastsection{#1}% % % Only insert the separating space if we have a chapter/appendix % number, and don't print the unnumbered ``number''. - \def\temptype{#2}% \ifx\temptype\Ynothingkeyword \setbox0 = \hbox{}% \def\toctype{unnchap}% - \gdef\thischapternum{}% - \gdef\thischapter{#1}% \else\ifx\temptype\Yomitfromtockeyword \setbox0 = \hbox{}% contents like unnumbered, but no toc entry \def\toctype{omit}% - \gdef\thischapternum{}% - \gdef\thischapter{}% \else\ifx\temptype\Yappendixkeyword \setbox0 = \hbox{\putwordAppendix{} #3\enspace}% \def\toctype{app}% - \xdef\thischapternum{\appendixletter}% - % We don't substitute the actual chapter name into \thischapter - % because we don't want its macros evaluated now. And we don't - % use \thissection because that changes with each section. - % - \xdef\thischapter{\putwordAppendix{} \appendixletter: - \noexpand\thischaptername}% \else \setbox0 = \hbox{#3\enspace}% \def\toctype{numchap}% - \xdef\thischapternum{\the\chapno}% - \xdef\thischapter{\putwordChapter{} \the\chapno: - \noexpand\thischaptername}% \fi\fi\fi % % Write the toc entry for this chapter. Must come before the @@ -5052,36 +5259,78 @@ end % the section type for xrefs (Ynumbered, Ynothing, Yappendix), #4 is the % section number. % +\def\seckeyword{sec} +% \def\sectionheading#1#2#3#4{% {% % Switch to the right set of fonts. \csname #2fonts\endcsname \rm % + \def\sectionlevel{#2}% + \def\temptype{#3}% + % + % Insert first mark before the heading break (see notes for \domark). + \let\prevsectiondefs=\lastsectiondefs + \ifx\temptype\Ynothingkeyword + \ifx\sectionlevel\seckeyword + \gdef\lastsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}% + \gdef\thissection{\thissectionname}}% + \fi + \else\ifx\temptype\Yomitfromtockeyword + % Don't redefine \thissection. + \else\ifx\temptype\Yappendixkeyword + \ifx\sectionlevel\seckeyword + \toks0={#1}% + \xdef\lastsectiondefs{% + \gdef\noexpand\thissectionname{\the\toks0}% + \gdef\noexpand\thissectionnum{#4}% + \gdef\noexpand\thissection{\putwordSection{} \noexpand\thissectionnum: + \noexpand\thissectionname}% + }% + \fi + \else + \ifx\sectionlevel\seckeyword + \toks0={#1}% + \xdef\lastsectiondefs{% + \gdef\noexpand\thissectionname{\the\toks0}% + \gdef\noexpand\thissectionnum{#4}% + \gdef\noexpand\thissection{\putwordSection{} \noexpand\thissectionnum: + \noexpand\thissectionname}% + }% + \fi + \fi\fi\fi + % + % Output the mark. Pass it through \safewhatsit, to take care of + % the preceding space. + \safewhatsit\domark + % % Insert space above the heading. \csname #2headingbreak\endcsname % - % Only insert the space after the number if we have a section number. - \def\sectionlevel{#2}% - \def\temptype{#3}% + % Now the second mark, after the heading break. No break points + % between here and the heading. + \let\prevsectiondefs=\lastsectiondefs + \domark % + % Only insert the space after the number if we have a section number. \ifx\temptype\Ynothingkeyword \setbox0 = \hbox{}% \def\toctype{unn}% - \gdef\thissection{#1}% + \gdef\lastsection{#1}% \else\ifx\temptype\Yomitfromtockeyword % for @headings -- no section number, don't include in toc, - % and don't redefine \thissection. + % and don't redefine \lastsection. \setbox0 = \hbox{}% \def\toctype{omit}% \let\sectionlevel=\empty \else\ifx\temptype\Yappendixkeyword \setbox0 = \hbox{#4\enspace}% \def\toctype{app}% - \gdef\thissection{#1}% + \gdef\lastsection{#1}% \else \setbox0 = \hbox{#4\enspace}% \def\toctype{num}% - \gdef\thissection{#1}% + \gdef\lastsection{#1}% \fi\fi\fi % % Write the toc entry (before \donoderef). See comments in \chapmacro. @@ -5215,7 +5464,6 @@ end % % Don't need to put `Contents' or `Short Contents' in the headline. % It is abundantly clear what they are. - \def\thischapter{}% \chapmacro{#1}{Yomitfromtoc}{}% % \savepageno = \pageno @@ -6254,12 +6502,14 @@ end \ifnum\parencount=0 \else \badparencount \fi \ifnum\brackcount=0 \else \badbrackcount \fi } +% these should not use \errmessage; the glibc manual, at least, actually +% has such constructs (when documenting function pointers). \def\badparencount{% - \errmessage{Unbalanced parentheses in @def}% + \message{Warning: unbalanced parentheses in @def...}% \global\parencount=0 } \def\badbrackcount{% - \errmessage{Unbalanced square braces in @def}% + \message{Warning: unbalanced square brackets in @def...}% \global\brackcount=0 } @@ -6634,7 +6884,7 @@ end % \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an % anchor), which consists of three parts: -% 1) NAME-title - the current sectioning name taken from \thissection, +% 1) NAME-title - the current sectioning name taken from \lastsection, % or the anchor name. % 2) NAME-snt - section number and type, passed as the SNT arg, or % empty for anchors. @@ -6653,7 +6903,7 @@ end \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef ##1}{##2}}% these are parameters of \writexrdef }% - \toks0 = \expandafter{\thissection}% + \toks0 = \expandafter{\lastsection}% \immediate \writexrdef{title}{\the\toks0 }% \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc. \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, during \shipout @@ -6754,7 +7004,7 @@ end % is a loss. Therefore, we give the text of the node name again, so it % is as if TeX is seeing it for the first time. \ifdim \wd1 > 0pt - \putwordsection{} ``\printedrefname'' \putwordin{} \cite{\printedmanual}% + \putwordSection{} ``\printedrefname'' \putwordin{} \cite{\printedmanual}% \else % _ (for example) has to be the character _ for the purposes of the % control sequence corresponding to the node, but it has to expand @@ -7254,13 +7504,13 @@ end \global\advance\floatno by 1 % {% - % This magic value for \thissection is output by \setref as the + % This magic value for \lastsection is output by \setref as the % XREFLABEL-title value. \xrefX uses it to distinguish float % labels (which have a completely different output format) from % node and anchor labels. And \xrdef uses it to construct the % lists of floats. % - \edef\thissection{\floatmagic=\safefloattype}% + \edef\lastsection{\floatmagic=\safefloattype}% \setref{\floatlabel}{Yfloat}% }% \fi @@ -7395,7 +7645,7 @@ end % #1 is the control sequence we are passed; we expand into a conditional % which is true if #1 represents a float ref. That is, the magic -% \thissection value which we \setref above. +% \lastsection value which we \setref above. % \def\iffloat#1{\expandafter\doiffloat#1==\finish} % @@ -7928,6 +8178,7 @@ should work if nowhere else does.} \DeclareUnicodeCharacter{00A8}{\"{ }} \DeclareUnicodeCharacter{00A9}{\copyright} \DeclareUnicodeCharacter{00AA}{\ordf} + \DeclareUnicodeCharacter{00AB}{\guillemetleft} \DeclareUnicodeCharacter{00AD}{\-} \DeclareUnicodeCharacter{00AE}{\registeredsymbol} \DeclareUnicodeCharacter{00AF}{\={ }} @@ -7936,6 +8187,7 @@ should work if nowhere else does.} \DeclareUnicodeCharacter{00B4}{\'{ }} \DeclareUnicodeCharacter{00B8}{\cedilla{ }} \DeclareUnicodeCharacter{00BA}{\ordm} + \DeclareUnicodeCharacter{00BB}{\guillemetright} \DeclareUnicodeCharacter{00BF}{\questiondown} \DeclareUnicodeCharacter{00C0}{\`A} @@ -8284,8 +8536,16 @@ should work if nowhere else does.} \DeclareUnicodeCharacter{2013}{--} \DeclareUnicodeCharacter{2014}{---} + \DeclareUnicodeCharacter{2018}{\quoteleft} + \DeclareUnicodeCharacter{2019}{\quoteright} + \DeclareUnicodeCharacter{201A}{\quotesinglbase} + \DeclareUnicodeCharacter{201C}{\quotedblleft} + \DeclareUnicodeCharacter{201D}{\quotedblright} + \DeclareUnicodeCharacter{201E}{\quotedblbase} \DeclareUnicodeCharacter{2022}{\bullet} \DeclareUnicodeCharacter{2026}{\dots} + \DeclareUnicodeCharacter{2039}{\guilsinglleft} + \DeclareUnicodeCharacter{203A}{\guilsinglright} \DeclareUnicodeCharacter{20AC}{\euro} \DeclareUnicodeCharacter{2192}{\expansion} @@ -8323,7 +8583,7 @@ should work if nowhere else does.} % Don't be so finicky about underfull hboxes, either. \hbadness = 2000 -% Following George Bush, just get rid of widows and orphans. +% Following George Bush, get rid of widows and orphans. \widowpenalty=10000 \clubpenalty=10000 @@ -8388,7 +8648,7 @@ should work if nowhere else does.} \textleading = 13.2pt % % If page is nothing but text, make it come out even. - \internalpagesizes{46\baselineskip}{6in}% + \internalpagesizes{607.2pt}{6in}% that's 46 lines {\voffset}{.25in}% {\bindingoffset}{36pt}% {11in}{8.5in}% @@ -8444,7 +8704,7 @@ should work if nowhere else does.} % \global\normaloffset = -6mm % \global\bindingoffset = 10mm % @end tex - \internalpagesizes{51\baselineskip}{160mm} + \internalpagesizes{673.2pt}{160mm}% that's 51 lines {\voffset}{\hoffset}% {\bindingoffset}{44pt}% {297mm}{210mm}% diff -ruNp m4-1.4.10/doc/version.texi m4-1.4.11/doc/version.texi --- m4-1.4.10/doc/version.texi 2007-07-09 21:20:49.000000000 -0600 +++ m4-1.4.11/doc/version.texi 2008-04-01 21:34:32.000000000 -0600 @@ -1,4 +1,4 @@ -@set UPDATED 4 July 2007 -@set UPDATED-MONTH July 2007 -@set EDITION 1.4.10 -@set VERSION 1.4.10 +@set UPDATED 29 March 2008 +@set UPDATED-MONTH March 2008 +@set EDITION 1.4.11 +@set VERSION 1.4.11 diff -ruNp m4-1.4.10/examples/Makefile.am m4-1.4.11/examples/Makefile.am --- m4-1.4.10/examples/Makefile.am 2007-07-04 21:56:03.000000000 -0600 +++ m4-1.4.11/examples/Makefile.am 2008-03-29 16:33:27.000000000 -0600 @@ -1,26 +1,27 @@ -## This file is part of GNU M4. +## Makefile.am - template for generating Makefile via Automake +## +## Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc. ## -## Copyright (C) 2006, 2007 Free Software Foundation, Inc. +## This file is part of GNU M4. ## -## This program is free software; you can redistribute it and/or modify +## GNU M4 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 +## 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, +## GNU M4 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; see the file COPYING. If not, write to -## the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -## Boston, MA 02110-1301, USA. +## along with this program. If not, see <http://www.gnu.org/licenses/>. ## ## This file written by Eric Blake <ebb9@byu.net> EXTRA_DIST =\ capitalize.m4 \ +capitalize2.m4 \ comments.m4 \ ddivert.m4 \ debug.m4 \ @@ -32,6 +33,7 @@ foreach.m4 \ foreach2.m4 \ foreachq.m4 \ foreachq2.m4 \ +foreachq3.m4 \ forloop.m4 \ forloop2.m4 \ fstab.m4 \ @@ -40,6 +42,8 @@ incl-test.m4 \ incl.m4 \ include.m4 \ indir.m4 \ +join.m4 \ +loop.m4 \ misc.m4 \ multiquotes.m4 \ patsubst.m4 \ @@ -55,4 +59,6 @@ translit.m4 \ undivert.incl \ undivert.m4 \ wrap.m4 \ -wrapfifo.m4 +wrapfifo.m4 \ +wraplifo.m4 \ +wraplifo2.m4 diff -ruNp m4-1.4.10/examples/Makefile.in m4-1.4.11/examples/Makefile.in --- m4-1.4.10/examples/Makefile.in 2007-07-09 21:15:31.000000000 -0600 +++ m4-1.4.11/examples/Makefile.in 2008-04-02 06:45:28.000000000 -0600 @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.10 from Makefile.am. +# Makefile.in generated by automake 1.10.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -44,22 +44,23 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/a $(top_srcdir)/m4/fatal-signal.m4 $(top_srcdir)/m4/fflush.m4 \ $(top_srcdir)/m4/float_h.m4 $(top_srcdir)/m4/fpending.m4 \ $(top_srcdir)/m4/fpieee.m4 $(top_srcdir)/m4/fpurge.m4 \ - $(top_srcdir)/m4/freading.m4 $(top_srcdir)/m4/free.m4 \ - $(top_srcdir)/m4/frexp.m4 $(top_srcdir)/m4/frexpl.m4 \ - $(top_srcdir)/m4/fseeko.m4 $(top_srcdir)/m4/ftello.m4 \ - $(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gettimeofday.m4 \ - $(top_srcdir)/m4/gl_list.m4 $(top_srcdir)/m4/glibc21.m4 \ - $(top_srcdir)/m4/gnulib-common.m4 \ + $(top_srcdir)/m4/freading.m4 $(top_srcdir)/m4/frexp.m4 \ + $(top_srcdir)/m4/frexpl.m4 $(top_srcdir)/m4/fseeko.m4 \ + $(top_srcdir)/m4/ftello.m4 $(top_srcdir)/m4/getopt.m4 \ + $(top_srcdir)/m4/gettimeofday.m4 $(top_srcdir)/m4/gl_list.m4 \ + $(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/gnulib-common.m4 \ $(top_srcdir)/m4/gnulib-comp.m4 \ $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/inline.m4 \ $(top_srcdir)/m4/intmax_t.m4 $(top_srcdir)/m4/inttypes_h.m4 \ - $(top_srcdir)/m4/isnan.m4 $(top_srcdir)/m4/isnanf.m4 \ + $(top_srcdir)/m4/isnand.m4 $(top_srcdir)/m4/isnanf.m4 \ $(top_srcdir)/m4/isnanl.m4 $(top_srcdir)/m4/ldexpl.m4 \ $(top_srcdir)/m4/localcharset.m4 $(top_srcdir)/m4/longlong.m4 \ - $(top_srcdir)/m4/lseek.m4 $(top_srcdir)/m4/malloca.m4 \ - $(top_srcdir)/m4/math_h.m4 $(top_srcdir)/m4/mbrtowc.m4 \ - $(top_srcdir)/m4/mbstate_t.m4 $(top_srcdir)/m4/mkdtemp.m4 \ - $(top_srcdir)/m4/mkstemp.m4 $(top_srcdir)/m4/pathmax.m4 \ + $(top_srcdir)/m4/lseek.m4 $(top_srcdir)/m4/malloc.m4 \ + $(top_srcdir)/m4/malloca.m4 $(top_srcdir)/m4/math_h.m4 \ + $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbstate_t.m4 \ + $(top_srcdir)/m4/memchr.m4 $(top_srcdir)/m4/memcmp.m4 \ + $(top_srcdir)/m4/mkdtemp.m4 $(top_srcdir)/m4/mkstemp.m4 \ + $(top_srcdir)/m4/nocrash.m4 $(top_srcdir)/m4/pathmax.m4 \ $(top_srcdir)/m4/printf-frexp.m4 \ $(top_srcdir)/m4/printf-frexpl.m4 $(top_srcdir)/m4/printf.m4 \ $(top_srcdir)/m4/quotearg.m4 $(top_srcdir)/m4/regex.m4 \ @@ -70,11 +71,13 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/a $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdint_h.m4 \ $(top_srcdir)/m4/stdio-safer.m4 $(top_srcdir)/m4/stdio_h.m4 \ $(top_srcdir)/m4/stdlib-safer.m4 $(top_srcdir)/m4/stdlib_h.m4 \ + $(top_srcdir)/m4/strerror.m4 $(top_srcdir)/m4/string_h.m4 \ + $(top_srcdir)/m4/strstr.m4 $(top_srcdir)/m4/strtod.m4 \ $(top_srcdir)/m4/strtol.m4 $(top_srcdir)/m4/sys_stat_h.m4 \ $(top_srcdir)/m4/sys_time_h.m4 $(top_srcdir)/m4/tempname.m4 \ - $(top_srcdir)/m4/tmpdir.m4 $(top_srcdir)/m4/ulonglong.m4 \ - $(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/unistd_h.m4 \ - $(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/vasnprintf.m4 \ + $(top_srcdir)/m4/tmpdir.m4 $(top_srcdir)/m4/unistd-safer.m4 \ + $(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/unlocked-io.m4 \ + $(top_srcdir)/m4/vasnprintf.m4 \ $(top_srcdir)/m4/vasprintf-posix.m4 \ $(top_srcdir)/m4/vasprintf.m4 $(top_srcdir)/m4/wchar.m4 \ $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wctype.m4 \ @@ -119,11 +122,19 @@ EXEEXT = @EXEEXT@ FLOAT_H = @FLOAT_H@ GETOPT_H = @GETOPT_H@ GLIBC21 = @GLIBC21@ +GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@ +GNULIB_CEILF = @GNULIB_CEILF@ +GNULIB_CEILL = @GNULIB_CEILL@ GNULIB_CHOWN = @GNULIB_CHOWN@ GNULIB_DUP2 = @GNULIB_DUP2@ +GNULIB_ENVIRON = @GNULIB_ENVIRON@ GNULIB_FCHDIR = @GNULIB_FCHDIR@ GNULIB_FFLUSH = @GNULIB_FFLUSH@ +GNULIB_FLOORF = @GNULIB_FLOORF@ +GNULIB_FLOORL = @GNULIB_FLOORL@ +GNULIB_FOPEN = @GNULIB_FOPEN@ GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@ +GNULIB_FREOPEN = @GNULIB_FREOPEN@ GNULIB_FREXP = @GNULIB_FREXP@ GNULIB_FREXPL = @GNULIB_FREXPL@ GNULIB_FSEEK = @GNULIB_FSEEK@ @@ -132,21 +143,67 @@ GNULIB_FTELL = @GNULIB_FTELL@ GNULIB_FTELLO = @GNULIB_FTELLO@ GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@ GNULIB_GETCWD = @GNULIB_GETCWD@ +GNULIB_GETDELIM = @GNULIB_GETDELIM@ +GNULIB_GETLINE = @GNULIB_GETLINE@ GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@ +GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@ GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@ +GNULIB_ISFINITE = @GNULIB_ISFINITE@ GNULIB_LCHOWN = @GNULIB_LCHOWN@ GNULIB_LDEXPL = @GNULIB_LDEXPL@ GNULIB_LSEEK = @GNULIB_LSEEK@ +GNULIB_MALLOC_POSIX = @GNULIB_MALLOC_POSIX@ GNULIB_MATHL = @GNULIB_MATHL@ +GNULIB_MBSCASECMP = @GNULIB_MBSCASECMP@ +GNULIB_MBSCASESTR = @GNULIB_MBSCASESTR@ +GNULIB_MBSCHR = @GNULIB_MBSCHR@ +GNULIB_MBSCSPN = @GNULIB_MBSCSPN@ +GNULIB_MBSLEN = @GNULIB_MBSLEN@ +GNULIB_MBSNCASECMP = @GNULIB_MBSNCASECMP@ +GNULIB_MBSNLEN = @GNULIB_MBSNLEN@ +GNULIB_MBSPBRK = @GNULIB_MBSPBRK@ +GNULIB_MBSPCASECMP = @GNULIB_MBSPCASECMP@ +GNULIB_MBSRCHR = @GNULIB_MBSRCHR@ +GNULIB_MBSSEP = @GNULIB_MBSSEP@ +GNULIB_MBSSPN = @GNULIB_MBSSPN@ +GNULIB_MBSSTR = @GNULIB_MBSSTR@ +GNULIB_MBSTOK_R = @GNULIB_MBSTOK_R@ +GNULIB_MEMMEM = @GNULIB_MEMMEM@ +GNULIB_MEMPCPY = @GNULIB_MEMPCPY@ +GNULIB_MEMRCHR = @GNULIB_MEMRCHR@ GNULIB_MKDTEMP = @GNULIB_MKDTEMP@ GNULIB_MKSTEMP = @GNULIB_MKSTEMP@ GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@ +GNULIB_PUTENV = @GNULIB_PUTENV@ GNULIB_READLINK = @GNULIB_READLINK@ +GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@ +GNULIB_ROUND = @GNULIB_ROUND@ +GNULIB_ROUNDF = @GNULIB_ROUNDF@ +GNULIB_ROUNDL = @GNULIB_ROUNDL@ +GNULIB_SETENV = @GNULIB_SETENV@ GNULIB_SIGNBIT = @GNULIB_SIGNBIT@ GNULIB_SIGPROCMASK = @GNULIB_SIGPROCMASK@ GNULIB_SLEEP = @GNULIB_SLEEP@ GNULIB_SNPRINTF = @GNULIB_SNPRINTF@ GNULIB_SPRINTF_POSIX = @GNULIB_SPRINTF_POSIX@ +GNULIB_STPCPY = @GNULIB_STPCPY@ +GNULIB_STPNCPY = @GNULIB_STPNCPY@ +GNULIB_STRCASESTR = @GNULIB_STRCASESTR@ +GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@ +GNULIB_STRDUP = @GNULIB_STRDUP@ +GNULIB_STRERROR = @GNULIB_STRERROR@ +GNULIB_STRNDUP = @GNULIB_STRNDUP@ +GNULIB_STRNLEN = @GNULIB_STRNLEN@ +GNULIB_STRPBRK = @GNULIB_STRPBRK@ +GNULIB_STRSEP = @GNULIB_STRSEP@ +GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@ +GNULIB_STRSTR = @GNULIB_STRSTR@ +GNULIB_STRTOD = @GNULIB_STRTOD@ +GNULIB_STRTOK_R = @GNULIB_STRTOK_R@ +GNULIB_TRUNC = @GNULIB_TRUNC@ +GNULIB_TRUNCF = @GNULIB_TRUNCF@ +GNULIB_TRUNCL = @GNULIB_TRUNCL@ +GNULIB_UNSETENV = @GNULIB_UNSETENV@ GNULIB_VASPRINTF = @GNULIB_VASPRINTF@ GNULIB_VFPRINTF_POSIX = @GNULIB_VFPRINTF_POSIX@ GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@ @@ -154,49 +211,78 @@ GNULIB_VSNPRINTF = @GNULIB_VSNPRINTF@ GNULIB_VSPRINTF_POSIX = @GNULIB_VSPRINTF_POSIX@ GNULIB_WCWIDTH = @GNULIB_WCWIDTH@ GREP = @GREP@ +HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@ HAVE_DECL_ACOSL = @HAVE_DECL_ACOSL@ HAVE_DECL_ASINL = @HAVE_DECL_ASINL@ HAVE_DECL_ATANL = @HAVE_DECL_ATANL@ -HAVE_DECL_CEILL = @HAVE_DECL_CEILL@ HAVE_DECL_COSL = @HAVE_DECL_COSL@ +HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@ HAVE_DECL_EXPL = @HAVE_DECL_EXPL@ -HAVE_DECL_FLOORL = @HAVE_DECL_FLOORL@ HAVE_DECL_FREXPL = @HAVE_DECL_FREXPL@ +HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@ +HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@ HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ HAVE_DECL_LDEXPL = @HAVE_DECL_LDEXPL@ HAVE_DECL_LOGL = @HAVE_DECL_LOGL@ +HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@ +HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@ HAVE_DECL_MKDIR = @HAVE_DECL_MKDIR@ HAVE_DECL_SINL = @HAVE_DECL_SINL@ HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@ HAVE_DECL_SQRTL = @HAVE_DECL_SQRTL@ +HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@ +HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@ +HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@ +HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@ +HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@ +HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@ HAVE_DECL_TANL = @HAVE_DECL_TANL@ +HAVE_DECL_TRUNC = @HAVE_DECL_TRUNC@ +HAVE_DECL_TRUNCF = @HAVE_DECL_TRUNCF@ +HAVE_DECL_TRUNCL = @HAVE_DECL_TRUNCL@ HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@ HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@ HAVE_DUP2 = @HAVE_DUP2@ HAVE_FSEEKO = @HAVE_FSEEKO@ HAVE_FTELLO = @HAVE_FTELLO@ HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ +HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@ HAVE_GETSUBOPT = @HAVE_GETSUBOPT@ HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ HAVE_IO_H = @HAVE_IO_H@ HAVE_ISWCNTRL = @HAVE_ISWCNTRL@ HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ HAVE_LSTAT = @HAVE_LSTAT@ +HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@ +HAVE_MEMPCPY = @HAVE_MEMPCPY@ HAVE_MKDTEMP = @HAVE_MKDTEMP@ +HAVE_OS_H = @HAVE_OS_H@ HAVE_POSIX_SIGNALBLOCKING = @HAVE_POSIX_SIGNALBLOCKING@ HAVE_READLINK = @HAVE_READLINK@ +HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@ +HAVE_SETENV = @HAVE_SETENV@ HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@ HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@ HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@ HAVE_SIGSET_T = @HAVE_SIGSET_T@ HAVE_SLEEP = @HAVE_SLEEP@ HAVE_STDINT_H = @HAVE_STDINT_H@ +HAVE_STPCPY = @HAVE_STPCPY@ +HAVE_STPNCPY = @HAVE_STPNCPY@ +HAVE_STRCASESTR = @HAVE_STRCASESTR@ +HAVE_STRCHRNUL = @HAVE_STRCHRNUL@ +HAVE_STRNDUP = @HAVE_STRNDUP@ +HAVE_STRPBRK = @HAVE_STRPBRK@ +HAVE_STRSEP = @HAVE_STRSEP@ +HAVE_STRTOD = @HAVE_STRTOD@ HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@ HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@ HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@ +HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ HAVE_UNISTD_H = @HAVE_UNISTD_H@ +HAVE_UNSETENV = @HAVE_UNSETENV@ HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@ HAVE_VASPRINTF = @HAVE_VASPRINTF@ HAVE_WCHAR_H = @HAVE_WCHAR_H@ @@ -215,18 +301,24 @@ LIBM4_LIBDEPS = @LIBM4_LIBDEPS@ LIBM4_LTLIBDEPS = @LIBM4_LTLIBDEPS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ +LIBTESTS_LIBDEPS = @LIBTESTS_LIBDEPS@ +LOCALCHARSET_TESTS_ENVIRONMENT = @LOCALCHARSET_TESTS_ENVIRONMENT@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ M4_LIBOBJS = @M4_LIBOBJS@ M4_LTLIBOBJS = @M4_LTLIBOBJS@ +M4tests_LIBOBJS = @M4tests_LIBOBJS@ +M4tests_LTLIBOBJS = @M4tests_LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ NEXT_FLOAT_H = @NEXT_FLOAT_H@ NEXT_MATH_H = @NEXT_MATH_H@ NEXT_SIGNAL_H = @NEXT_SIGNAL_H@ +NEXT_STDARG_H = @NEXT_STDARG_H@ NEXT_STDINT_H = @NEXT_STDINT_H@ NEXT_STDIO_H = @NEXT_STDIO_H@ NEXT_STDLIB_H = @NEXT_STDLIB_H@ +NEXT_STRING_H = @NEXT_STRING_H@ NEXT_SYS_STAT_H = @NEXT_SYS_STAT_H@ NEXT_SYS_TIME_H = @NEXT_SYS_TIME_H@ NEXT_UNISTD_H = @NEXT_UNISTD_H@ @@ -240,12 +332,19 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +POW_LIB = @POW_LIB@ PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@ RANLIB = @RANLIB@ +REPLACE_CEILF = @REPLACE_CEILF@ +REPLACE_CEILL = @REPLACE_CEILL@ REPLACE_CHOWN = @REPLACE_CHOWN@ REPLACE_FCHDIR = @REPLACE_FCHDIR@ REPLACE_FFLUSH = @REPLACE_FFLUSH@ +REPLACE_FLOORF = @REPLACE_FLOORF@ +REPLACE_FLOORL = @REPLACE_FLOORL@ +REPLACE_FOPEN = @REPLACE_FOPEN@ REPLACE_FPRINTF = @REPLACE_FPRINTF@ +REPLACE_FREOPEN = @REPLACE_FREOPEN@ REPLACE_FREXP = @REPLACE_FREXP@ REPLACE_FREXPL = @REPLACE_FREXPL@ REPLACE_FSEEK = @REPLACE_FSEEK@ @@ -253,15 +352,29 @@ REPLACE_FSEEKO = @REPLACE_FSEEKO@ REPLACE_FTELL = @REPLACE_FTELL@ REPLACE_FTELLO = @REPLACE_FTELLO@ REPLACE_GETCWD = @REPLACE_GETCWD@ +REPLACE_GETLINE = @REPLACE_GETLINE@ +REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@ REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@ +REPLACE_ISFINITE = @REPLACE_ISFINITE@ REPLACE_LCHOWN = @REPLACE_LCHOWN@ REPLACE_LDEXPL = @REPLACE_LDEXPL@ REPLACE_LSEEK = @REPLACE_LSEEK@ +REPLACE_MEMMEM = @REPLACE_MEMMEM@ REPLACE_MKSTEMP = @REPLACE_MKSTEMP@ REPLACE_PRINTF = @REPLACE_PRINTF@ +REPLACE_PUTENV = @REPLACE_PUTENV@ +REPLACE_ROUND = @REPLACE_ROUND@ +REPLACE_ROUNDF = @REPLACE_ROUNDF@ +REPLACE_ROUNDL = @REPLACE_ROUNDL@ REPLACE_SIGNBIT = @REPLACE_SIGNBIT@ +REPLACE_SIGNBIT_USING_GCC = @REPLACE_SIGNBIT_USING_GCC@ REPLACE_SNPRINTF = @REPLACE_SNPRINTF@ REPLACE_SPRINTF = @REPLACE_SPRINTF@ +REPLACE_STRCASESTR = @REPLACE_STRCASESTR@ +REPLACE_STRERROR = @REPLACE_STRERROR@ +REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@ +REPLACE_STRSTR = @REPLACE_STRSTR@ +REPLACE_STRTOD = @REPLACE_STRTOD@ REPLACE_VASPRINTF = @REPLACE_VASPRINTF@ REPLACE_VFPRINTF = @REPLACE_VFPRINTF@ REPLACE_VPRINTF = @REPLACE_VPRINTF@ @@ -272,12 +385,14 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@ SIZE_T_SUFFIX = @SIZE_T_SUFFIX@ +STDARG_H = @STDARG_H@ STDBOOL_H = @STDBOOL_H@ STDINT_H = @STDINT_H@ STRIP = @STRIP@ SYS_STAT_H = @SYS_STAT_H@ SYS_TIME_H = @SYS_TIME_H@ VERSION = @VERSION@ +VOID_UNSETENV = @VOID_UNSETENV@ WCHAR_H = @WCHAR_H@ WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ WCTYPE_H = @WCTYPE_H@ @@ -333,6 +448,7 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = \ capitalize.m4 \ +capitalize2.m4 \ comments.m4 \ ddivert.m4 \ debug.m4 \ @@ -344,6 +460,7 @@ foreach.m4 \ foreach2.m4 \ foreachq.m4 \ foreachq2.m4 \ +foreachq3.m4 \ forloop.m4 \ forloop2.m4 \ fstab.m4 \ @@ -352,6 +469,8 @@ incl-test.m4 \ incl.m4 \ include.m4 \ indir.m4 \ +join.m4 \ +loop.m4 \ misc.m4 \ multiquotes.m4 \ patsubst.m4 \ @@ -367,7 +486,9 @@ translit.m4 \ undivert.incl \ undivert.m4 \ wrap.m4 \ -wrapfifo.m4 +wrapfifo.m4 \ +wraplifo.m4 \ +wraplifo2.m4 all: all-am diff -ruNp m4-1.4.10/examples/capitalize.m4 m4-1.4.11/examples/capitalize.m4 --- m4-1.4.10/examples/capitalize.m4 2000-02-16 20:03:19.000000000 -0700 +++ m4-1.4.11/examples/capitalize.m4 2007-10-17 19:27:13.000000000 -0600 @@ -1,8 +1,12 @@ -dnl -dnl convert to upper- resp. lowercase +divert(`-1') +# upcase(text) +# downcase(text) +# capitalize(text) +# change case of text, simple version define(`upcase', `translit(`$*', `a-z', `A-Z')') define(`downcase', `translit(`$*', `A-Z', `a-z')') -dnl -dnl capitalize a single word -define(`capitalize1', `regexp(`$1', `^\(\w\)\(\w*\)', `upcase(`\1')`'downcase(`\2')')') -define(`capitalize', `patsubst(`$1', `\w+', ``'capitalize1(`\0')')') +define(`_capitalize', + `regexp(`$1', `^\(\w\)\(\w*\)', + `upcase(`\1')`'downcase(`\2')')') +define(`capitalize', `patsubst(`$1', `\w+', `_$0(`\&')')') +divert`'dnl diff -ruNp m4-1.4.10/examples/capitalize2.m4 m4-1.4.11/examples/capitalize2.m4 --- m4-1.4.10/examples/capitalize2.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/examples/capitalize2.m4 2007-10-17 19:27:13.000000000 -0600 @@ -0,0 +1,19 @@ +divert(`-1') +# upcase(text) +# downcase(text) +# capitalize(text) +# change case of text, improved version +define(`upcase', `translit(`$*', `a-z', `A-Z')') +define(`downcase', `translit(`$*', `A-Z', `a-z')') +define(`_arg1', `$1') +define(`_to_alt', `changequote(`<<[', `]>>')') +define(`_from_alt', `changequote(<<[`]>>, <<[']>>)') +define(`_upcase_alt', `translit(<<[$*]>>, <<[a-z]>>, <<[A-Z]>>)') +define(`_downcase_alt', `translit(<<[$*]>>, <<[A-Z]>>, <<[a-z]>>)') +define(`_capitalize_alt', + `regexp(<<[$1]>>, <<[^\(\w\)\(\w*\)]>>, + <<[_upcase_alt(<<[<<[\1]>>]>>)_downcase_alt(<<[<<[\2]>>]>>)]>>)') +define(`capitalize', + `_arg1(_to_alt()patsubst(<<[<<[$*]>>]>>, <<[\w+]>>, + _from_alt()`]>>_$0_alt(<<[\&]>>)<<['_to_alt())_from_alt())') +divert`'dnl diff -ruNp m4-1.4.10/examples/foreach2.m4 m4-1.4.11/examples/foreach2.m4 --- m4-1.4.10/examples/foreach2.m4 2006-10-20 20:55:56.000000000 -0600 +++ m4-1.4.11/examples/foreach2.m4 2008-03-13 19:32:13.000000000 -0600 @@ -2,7 +2,7 @@ include(`quote.m4')dnl divert(`-1') # foreach(x, (item_1, item_2, ..., item_n), stmt) # parenthesized list, improved version -define(`foreach', `pushdef(`$1')_foreach(`$1', +define(`foreach', `pushdef(`$1')_$0(`$1', (dquote(dquote_elt$2)), `$3')popdef(`$1')') define(`_arg1', `$1') define(`_foreach', `ifelse(`$2', `(`')', `', diff -ruNp m4-1.4.10/examples/foreachq2.m4 m4-1.4.11/examples/foreachq2.m4 --- m4-1.4.10/examples/foreachq2.m4 2006-10-20 20:55:56.000000000 -0600 +++ m4-1.4.11/examples/foreachq2.m4 2008-03-13 19:32:13.000000000 -0600 @@ -2,7 +2,7 @@ include(`quote.m4')dnl divert(`-1') # foreachq(x, `item_1, item_2, ..., item_n', stmt) # quoted list, improved version -define(`foreachq', `pushdef(`$1')_foreachq($@)popdef(`$1')') +define(`foreachq', `pushdef(`$1')_$0($@)popdef(`$1')') define(`_arg1q', ``$1'') define(`_rest', `ifelse(`$#', `1', `', `dquote(shift($@))')') define(`_foreachq', `ifelse(`$2', `', `', diff -ruNp m4-1.4.10/examples/foreachq3.m4 m4-1.4.11/examples/foreachq3.m4 --- m4-1.4.10/examples/foreachq3.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/examples/foreachq3.m4 2007-11-02 14:11:07.000000000 -0600 @@ -0,0 +1,10 @@ +divert(`-1') +# foreachq(x, `item_1, item_2, ..., item_n', stmt) +# quoted list, alternate improved version +define(`foreachq', +`pushdef(`$1')_$0(`$1', `$3'ifelse(`$2', `', `', + `, $2'))popdef(`$1')') +define(`_foreachq', `ifelse(`$#', `2', `', + `define(`$1', `$3')$2`'$0(`$1', `$2'ifelse(`$#', `3', `', + `, shift(shift(shift($@)))'))')') +divert`'dnl diff -ruNp m4-1.4.10/examples/forloop2.m4 m4-1.4.11/examples/forloop2.m4 --- m4-1.4.10/examples/forloop2.m4 2006-10-19 10:12:46.000000000 -0600 +++ m4-1.4.11/examples/forloop2.m4 2008-03-13 19:32:13.000000000 -0600 @@ -4,7 +4,7 @@ divert(`-1') # performs sanity check that FROM is larger than TO # allows complex numerical expressions in TO and FROM define(`forloop', `ifelse(eval(`($3) >= ($2)'), `1', - `pushdef(`$1', eval(`$2'))_forloop(`$1', + `pushdef(`$1', eval(`$2'))_$0(`$1', eval(`$3'), `$4')popdef(`$1')')') define(`_forloop', `$3`'ifelse(indir(`$1'), `$2', `', diff -ruNp m4-1.4.10/examples/hanoi.m4 m4-1.4.11/examples/hanoi.m4 --- m4-1.4.10/examples/hanoi.m4 2000-02-16 20:03:19.000000000 -0700 +++ m4-1.4.11/examples/hanoi.m4 2008-03-29 16:33:27.000000000 -0600 @@ -6,10 +6,10 @@ define(`move', `Move one disk from `$1' # _hanoi (cnt, from, to, aux) define(`_hanoi', `ifelse(eval(`$1'<=1), 1, `move($2, $3)', -`_hanoi(decr($1), $2, $4, $3)move($2, $3)_hanoi(decr($1), $4, $3, $2)')') +`$0(decr($1), $2, $4, $3)move($2, $3)$0(decr($1), $4, $3, $2)')') # hanoi (cnt) -define(`hanoi', `_hanoi(`$1', source, destination, auxilliary)') +define(`hanoi', `_$0(`$1', source, destination, auxilliary)') # traceon(`move', `_hanoi', `decr') divert`'dnl diff -ruNp m4-1.4.10/examples/join.m4 m4-1.4.11/examples/join.m4 --- m4-1.4.10/examples/join.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/examples/join.m4 2008-03-20 22:21:15.000000000 -0600 @@ -0,0 +1,15 @@ +divert(`-1') +# join(sep, args) - join each non-empty ARG into a single +# string, with each element separated by SEP +define(`join', +`ifelse(`$#', `2', ``$2'', + `ifelse(`$2', `', `', ``$2'_')$0(`$1', shift(shift($@)))')') +define(`_join', +`ifelse(`$#$2', `2', `', + `ifelse(`$2', `', `', ``$1$2'')$0(`$1', shift(shift($@)))')') +# joinall(sep, args) - join each ARG, including empty ones, +# into a single string, with each element separated by SEP +define(`joinall', ``$2'_$0(`$1', shift($@))') +define(`_joinall', +`ifelse(`$#', `2', `', ``$1$3'$0(`$1', shift(shift($@)))')') +divert`'dnl diff -ruNp m4-1.4.10/examples/loop.m4 m4-1.4.11/examples/loop.m4 --- m4-1.4.10/examples/loop.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/examples/loop.m4 2007-11-02 14:11:07.000000000 -0600 @@ -0,0 +1,17 @@ +dnl Stress test for recursion algorithms. Usage: +dnl m4 -Ipath/to/examples [-Doptions] loop.m4 +dnl Options include: +dnl -Dalt - test with foreachq3 instead of foreachq2 +dnl -Dlimit=<num> - set upper limit of sequence to <num>, default 1000 +dnl -Dverbose - print the sequence to the screen, rather than discarding +dnl -Ddebug[=<code>] - execute <code> after forloop but before foreach +dnl -Dsleep=<num> - sleep for <num> seconds before exit, to allow time +dnl to examine peak process memory usage +include(`forloop2.m4')dnl +include(`quote.m4')dnl +include(ifdef(`alt', ``foreachq3.m4'', ``foreachq2.m4''))dnl +ifdef(`limit', `', `define(`limit', `1000')')dnl +ifdef(`verbose', `', `divert(`-1')')dnl +ifdef(`debug', `', `define(`debug')')dnl +foreachq(`i', dquote(1forloop(`i', `2', limit, `,i'))debug, ` i') +ifdef(`sleep',`syscmd(`echo done>/dev/tty;sleep 'sleep)')dnl diff -ruNp m4-1.4.10/examples/trace.m4 m4-1.4.11/examples/trace.m4 --- m4-1.4.10/examples/trace.m4 2000-02-16 20:03:19.000000000 -0700 +++ m4-1.4.11/examples/trace.m4 2008-03-29 16:33:27.000000000 -0600 @@ -6,10 +6,10 @@ define(`move', `Move one disk from `$1' # _hanoi (cnt, from, to, aux) define(`_hanoi', `ifelse(eval(`$1'<=1), 1, `move($2, $3)', -`_hanoi(decr($1), $2, $4, $3)move($2, $3)_hanoi(decr($1), $4, $3, $2)')') +`$0(decr($1), $2, $4, $3)move($2, $3)$0(decr($1), $4, $3, $2)')') # hanoi (cnt) -define(`hanoi', `_hanoi(`$1', source, destination, auxilliary)') +define(`hanoi', `_$0(`$1', source, destination, auxilliary)') divert`'dnl # Debugmode t diff -ruNp m4-1.4.10/examples/wraplifo.m4 m4-1.4.11/examples/wraplifo.m4 --- m4-1.4.10/examples/wraplifo.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/examples/wraplifo.m4 2008-03-13 19:32:13.000000000 -0600 @@ -0,0 +1,10 @@ +dnl Redefine m4wrap to have LIFO semantics. +define(`_m4wrap_level', `0')dnl +define(`_m4wrap', defn(`m4wrap'))dnl +define(`m4wrap', +`ifdef(`m4wrap'_m4wrap_level, + `define(`m4wrap'_m4wrap_level, + `$1'defn(`m4wrap'_m4wrap_level))', + `_m4wrap(`define(`_m4wrap_level', incr(_m4wrap_level))dnl +m4wrap'_m4wrap_level)dnl +define(`m4wrap'_m4wrap_level, `$1')')')dnl diff -ruNp m4-1.4.10/examples/wraplifo2.m4 m4-1.4.11/examples/wraplifo2.m4 --- m4-1.4.10/examples/wraplifo2.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/examples/wraplifo2.m4 2008-03-20 22:21:15.000000000 -0600 @@ -0,0 +1,9 @@ +dnl Redefine m4wrap to have LIFO semantics, improved example. +include(`join.m4')dnl +define(`_m4wrap', defn(`m4wrap'))dnl +define(`_arg1', `$1')dnl +define(`m4wrap', +`ifdef(`_$0_text', + `define(`_$0_text', joinall(` ', $@)defn(`_$0_text'))', + `_$0(`_arg1(defn(`_$0_text')undefine(`_$0_text'))')dnl +define(`_$0_text', joinall(` ', $@))')')dnl diff -ruNp m4-1.4.10/gendocs.sh m4-1.4.11/gendocs.sh --- m4-1.4.10/gendocs.sh 2007-07-04 22:02:42.000000000 -0600 +++ m4-1.4.11/gendocs.sh 1969-12-31 17:00:00.000000000 -0700 @@ -1,300 +0,0 @@ -#!/bin/sh -# gendocs.sh -- generate a GNU manual in many formats. This script is -# mentioned in maintain.texi. See the help message below for usage details. - -scriptversion=2007-07-01.15 - -# Copyright (C) 2003, 2004, 2005, 2006, 2007 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/>. -# -# Original author: Mohit Agarwal. -# Send bug reports and any other correspondence to bug-texinfo@gnu.org. - -prog=`basename "$0"` -srcdir=`pwd` - -scripturl="http://savannah.gnu.org/cgi-bin/viewcvs/~checkout~/texinfo/texinfo/util/gendocs.sh" -templateurl="http://savannah.gnu.org/cgi-bin/viewcvs/~checkout~/texinfo/texinfo/util/gendocs_template" - -: ${SETLANG="env LANG= LC_MESSAGES= LC_ALL= LANGUAGE="} -: ${MAKEINFO="makeinfo"} -: ${TEXI2DVI="texi2dvi -t @finalout"} -: ${DVIPS="dvips"} -: ${DOCBOOK2HTML="docbook2html"} -: ${DOCBOOK2PDF="docbook2pdf"} -: ${DOCBOOK2PS="docbook2ps"} -: ${DOCBOOK2TXT="docbook2txt"} -: ${GENDOCS_TEMPLATE_DIR="."} -unset CDPATH - -version="gendocs.sh $scriptversion - -Copyright (C) 2007 Free Software Foundation, Inc. -There is NO warranty. You may redistribute this software -under the terms of the GNU General Public License. -For more information about these matters, see the files named COPYING." - -usage="Usage: $prog [OPTION]... PACKAGE MANUAL-TITLE - -Generate various output formats from PACKAGE.texinfo (or .texi or .txi) source. -See the GNU Maintainers document for a more extensive discussion: - http://www.gnu.org/prep/maintain_toc.html - -Options: - -o OUTDIR write files into OUTDIR, instead of manual/. - --docbook convert to DocBook too (xml, txt, html, pdf and ps). - --html ARG pass indicated ARG to makeinfo for HTML targets. - --help display this help and exit successfully. - --version display version information and exit successfully. - -Simple example: $prog emacs \"GNU Emacs Manual\" - -Typical sequence: - cd YOURPACKAGESOURCE/doc - wget \"$scripturl\" - wget \"$templateurl\" - $prog YOURMANUAL \"GNU YOURMANUAL - One-line description\" - -Output will be in a new subdirectory \"manual\" (by default, use -o OUTDIR -to override). Move all the new files into your web CVS tree, as -explained in the Web Pages node of maintain.texi. - -MANUAL-TITLE is included as part of the HTML <title> of the overall -manual/index.html file. It should include the name of the package being -documented. manual/index.html is created by substitution from the file -$GENDOCS_TEMPLATE_DIR/gendocs_template. (Feel free to modify the -generic template for your own purposes.) - -If you have several manuals, you'll need to run this script several -times with different YOURMANUAL values, specifying a different output -directory with -o each time. Then write (by hand) an overall index.html -with links to them all. - -If a manual's texinfo sources are spread across several directories, -first copy or symlink all Texinfo sources into a single directory. -(Part of the script's work is to make a tar.gz of the sources.) - -You can set the environment variables MAKEINFO, TEXI2DVI, and DVIPS to -control the programs that get executed, and GENDOCS_TEMPLATE_DIR to -control where the gendocs_template file is looked for. (With --docbook, -the environment variables DOCBOOK2HTML, DOCBOOK2PDF, DOCBOOK2PS, and -DOCBOOK2TXT are also respected.) - -By default, makeinfo is run in the default (English) locale, since -that's the language of most Texinfo manuals. If you happen to have a -non-English manual and non-English web site, check the SETLANG setting -in the source. - -Email bug reports or enhancement requests to bug-texinfo@gnu.org. -" - -calcsize() -{ - size=`ls -ksl $1 | awk '{print $1}'` - echo $size -} - -outdir=manual -html= -PACKAGE= -MANUAL_TITLE= - -while test $# -gt 0; do - case $1 in - --help) echo "$usage"; exit 0;; - --version) echo "$version"; exit 0;; - -o) shift; outdir=$1;; - --docbook) docbook=yes;; - --html) shift; html=$1;; - -*) - echo "$0: Unknown or ambiguous option \`$1'." >&2 - echo "$0: Try \`--help' for more information." >&2 - exit 1;; - *) - if test -z "$PACKAGE"; then - PACKAGE=$1 - elif test -z "$MANUAL_TITLE"; then - MANUAL_TITLE=$1 - else - echo "$0: extra non-option argument \`$1'." >&2 - exit 1 - fi;; - esac - shift -done - -if test -s "$srcdir/$PACKAGE.texinfo"; then - srcfile=$srcdir/$PACKAGE.texinfo -elif test -s "$srcdir/$PACKAGE.texi"; then - srcfile=$srcdir/$PACKAGE.texi -elif test -s "$srcdir/$PACKAGE.txi"; then - srcfile=$srcdir/$PACKAGE.txi -else - echo "$0: cannot find .texinfo or .texi or .txi for $PACKAGE in $srcdir." >&2 - exit 1 -fi - -if test ! -r $GENDOCS_TEMPLATE_DIR/gendocs_template; then - echo "$0: cannot read $GENDOCS_TEMPLATE_DIR/gendocs_template." >&2 - echo "$0: it is available from $templateurl." >&2 - exit 1 -fi - -echo Generating output formats for $srcfile - -cmd="$SETLANG $MAKEINFO -o $PACKAGE.info \"$srcfile\"" -echo "Generating info files... ($cmd)" -eval "$cmd" -mkdir -p $outdir/ -tar czf $outdir/$PACKAGE.info.tar.gz $PACKAGE.info* -info_tgz_size=`calcsize $outdir/$PACKAGE.info.tar.gz` -# do not mv the info files, there's no point in having them available -# separately on the web. - -cmd="${TEXI2DVI} \"$srcfile\"" -echo "Generating dvi ... ($cmd)" -eval "$cmd" - -# now, before we compress dvi: -echo Generating postscript... -${DVIPS} $PACKAGE -o -gzip -f -9 $PACKAGE.ps -ps_gz_size=`calcsize $PACKAGE.ps.gz` -mv $PACKAGE.ps.gz $outdir/ - -# compress/finish dvi: -gzip -f -9 $PACKAGE.dvi -dvi_gz_size=`calcsize $PACKAGE.dvi.gz` -mv $PACKAGE.dvi.gz $outdir/ - -cmd="${TEXI2DVI} --pdf \"$srcfile\"" -echo "Generating pdf ... ($cmd)" -eval "$cmd" -pdf_size=`calcsize $PACKAGE.pdf` -mv $PACKAGE.pdf $outdir/ - -cmd="$SETLANG $MAKEINFO -o $PACKAGE.txt --no-split --no-headers \"$srcfile\"" -echo "Generating ASCII... ($cmd)" -eval "$cmd" -ascii_size=`calcsize $PACKAGE.txt` -gzip -f -9 -c $PACKAGE.txt >$outdir/$PACKAGE.txt.gz -ascii_gz_size=`calcsize $outdir/$PACKAGE.txt.gz` -mv $PACKAGE.txt $outdir/ - -cmd="$SETLANG $MAKEINFO --no-split --html -o $PACKAGE.html $html \"$srcfile\"" -echo "Generating monolithic html... ($cmd)" -rm -rf $PACKAGE.html # in case a directory is left over -eval "$cmd" -html_mono_size=`calcsize $PACKAGE.html` -gzip -f -9 -c $PACKAGE.html >$outdir/$PACKAGE.html.gz -html_mono_gz_size=`calcsize $outdir/$PACKAGE.html.gz` -mv $PACKAGE.html $outdir/ - -cmd="$SETLANG $MAKEINFO --html -o $PACKAGE.html $html \"$srcfile\"" -echo "Generating html by node... ($cmd)" -eval "$cmd" -split_html_dir=$PACKAGE.html -( - cd ${split_html_dir} || exit 1 - tar -czf ../$outdir/${PACKAGE}.html_node.tar.gz -- *.html -) -html_node_tgz_size=`calcsize $outdir/${PACKAGE}.html_node.tar.gz` -rm -f $outdir/html_node/*.html -mkdir -p $outdir/html_node/ -mv ${split_html_dir}/*.html $outdir/html_node/ -rmdir ${split_html_dir} - -echo Making .tar.gz for sources... -srcfiles=`ls *.texinfo *.texi *.txi *.eps 2>/dev/null` -tar cvzfh $outdir/$PACKAGE.texi.tar.gz $srcfiles -texi_tgz_size=`calcsize $outdir/$PACKAGE.texi.tar.gz` - -if test -n "$docbook"; then - cmd="$SETLANG $MAKEINFO -o - --docbook \"$srcfile\" > ${srcdir}/$PACKAGE-db.xml" - echo "Generating docbook XML... $(cmd)" - eval "$cmd" - docbook_xml_size=`calcsize $PACKAGE-db.xml` - gzip -f -9 -c $PACKAGE-db.xml >$outdir/$PACKAGE-db.xml.gz - docbook_xml_gz_size=`calcsize $outdir/$PACKAGE-db.xml.gz` - mv $PACKAGE-db.xml $outdir/ - - cmd="${DOCBOOK2HTML} -o $split_html_db_dir ${outdir}/$PACKAGE-db.xml" - echo "Generating docbook HTML... ($cmd)" - eval "$cmd" - split_html_db_dir=html_node_db - ( - cd ${split_html_db_dir} || exit 1 - tar -czf ../$outdir/${PACKAGE}.html_node_db.tar.gz -- *.html - ) - html_node_db_tgz_size=`calcsize $outdir/${PACKAGE}.html_node_db.tar.gz` - rm -f $outdir/html_node_db/*.html - mkdir -p $outdir/html_node_db - mv ${split_html_db_dir}/*.html $outdir/html_node_db/ - rmdir ${split_html_db_dir} - - cmd="${DOCBOOK2TXT} ${outdir}/$PACKAGE-db.xml" - echo "Generating docbook ASCII... ($cmd)" - eval "$cmd" - docbook_ascii_size=`calcsize $PACKAGE-db.txt` - mv $PACKAGE-db.txt $outdir/ - - cmd="${DOCBOOK2PS} ${outdir}/$PACKAGE-db.xml" - echo "Generating docbook PS... $(cmd)" - eval "$cmd" - gzip -f -9 -c $PACKAGE-db.ps >$outdir/$PACKAGE-db.ps.gz - docbook_ps_gz_size=`calcsize $outdir/$PACKAGE-db.ps.gz` - mv $PACKAGE-db.ps $outdir/ - - cmd="${DOCBOOK2PDF} ${outdir}/$PACKAGE-db.xml" - echo "Generating docbook PDF... ($cmd)" - eval "$cmd" - docbook_pdf_size=`calcsize $PACKAGE-db.pdf` - mv $PACKAGE-db.pdf $outdir/ -fi - -echo Writing index file... -curdate=`date '+%B %d, %Y'` -sed \ - -e "s!%%TITLE%%!$MANUAL_TITLE!g" \ - -e "s!%%DATE%%!$curdate!g" \ - -e "s!%%PACKAGE%%!$PACKAGE!g" \ - -e "s!%%HTML_MONO_SIZE%%!$html_mono_size!g" \ - -e "s!%%HTML_MONO_GZ_SIZE%%!$html_mono_gz_size!g" \ - -e "s!%%HTML_NODE_TGZ_SIZE%%!$html_node_tgz_size!g" \ - -e "s!%%INFO_TGZ_SIZE%%!$info_tgz_size!g" \ - -e "s!%%DVI_GZ_SIZE%%!$dvi_gz_size!g" \ - -e "s!%%PDF_SIZE%%!$pdf_size!g" \ - -e "s!%%PS_GZ_SIZE%%!$ps_gz_size!g" \ - -e "s!%%ASCII_SIZE%%!$ascii_size!g" \ - -e "s!%%ASCII_GZ_SIZE%%!$ascii_gz_size!g" \ - -e "s!%%TEXI_TGZ_SIZE%%!$texi_tgz_size!g" \ - -e "s!%%DOCBOOK_HTML_NODE_TGZ_SIZE%%!$html_node_db_tgz_size!g" \ - -e "s!%%DOCBOOK_ASCII_SIZE%%!$docbook_ascii_size!g" \ - -e "s!%%DOCBOOK_PS_GZ_SIZE%%!$docbook_ps_gz_size!g" \ - -e "s!%%DOCBOOK_PDF_SIZE%%!$docbook_pdf_size!g" \ - -e "s!%%DOCBOOK_XML_SIZE%%!$docbook_xml_size!g" \ - -e "s!%%DOCBOOK_XML_GZ_SIZE%%!$docbook_xml_gz_size!g" \ - -e "s,%%SCRIPTURL%%,$scripturl,g" \ - -e "s!%%SCRIPTNAME%%!$prog!g" \ -$GENDOCS_TEMPLATE_DIR/gendocs_template >$outdir/index.html - -echo "Done! See $outdir/ subdirectory for new files." - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff -ruNp m4-1.4.10/lib/COPYING.LIB m4-1.4.11/lib/COPYING.LIB --- m4-1.4.10/lib/COPYING.LIB 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/lib/COPYING.LIB 2000-02-16 20:03:19.000000000 -0700 @@ -0,0 +1,481 @@ + GNU LIBRARY GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the library GPL. It is + numbered 2 because it goes with version 2 of the ordinary GPL.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Library General Public License, applies to some +specially designated Free Software Foundation software, and to any +other libraries whose authors decide to use it. You can use it for +your libraries, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if +you distribute copies of the library, or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link a program with the library, you must provide +complete object files to the recipients so that they can relink them +with the library, after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + Our method of protecting your rights has two steps: (1) copyright +the library, and (2) offer you this license which gives you legal +permission to copy, distribute and/or modify the library. + + Also, for each distributor's protection, we want to make certain +that everyone understands that there is no warranty for this free +library. If the library is modified by someone else and passed on, we +want its recipients to know that what they have is not the original +version, so that any problems introduced by others will not reflect on +the original authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that companies distributing free +software will individually obtain patent licenses, thus in effect +transforming the program into proprietary software. To prevent this, +we have made it clear that any patent must be licensed for everyone's +free use or not licensed at all. + + Most GNU software, including some libraries, is covered by the ordinary +GNU General Public License, which was designed for utility programs. This +license, the GNU Library General Public License, applies to certain +designated libraries. This license is quite different from the ordinary +one; be sure to read it in full, and don't assume that anything in it is +the same as in the ordinary license. + + The reason we have a separate public license for some libraries is that +they blur the distinction we usually make between modifying or adding to a +program and simply using it. Linking a program with a library, without +changing the library, is in some sense simply using the library, and is +analogous to running a utility program or application program. However, in +a textual and legal sense, the linked executable is a combined work, a +derivative of the original library, and the ordinary General Public License +treats it as such. + + Because of this blurred distinction, using the ordinary General +Public License for libraries did not effectively promote software +sharing, because most developers did not use the libraries. We +concluded that weaker conditions might promote sharing better. + + However, unrestricted linking of non-free programs would deprive the +users of those programs of all benefit from the free status of the +libraries themselves. This Library General Public License is intended to +permit developers of non-free programs to use free libraries, while +preserving your freedom as a user of such programs to change the free +libraries that are incorporated in them. (We have not seen how to achieve +this as regards changes in header files, but we have achieved it as regards +changes in the actual functions of the Library.) The hope is that this +will lead to faster development of free libraries. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, while the latter only +works together with the library. + + Note that it is possible for a library to be covered by the ordinary +General Public License rather than by this special one. + + GNU LIBRARY GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library which +contains a notice placed by the copyright holder or other authorized +party saying it may be distributed under the terms of this Library +General Public License (also called "this License"). Each licensee is +addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also compile or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + c) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + d) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the source code distributed need not include anything that is normally +distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Library General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + Appendix: How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + <one line to give the library's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + <signature of Ty Coon>, 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! diff -ruNp m4-1.4.10/lib/Makefile.am m4-1.4.11/lib/Makefile.am --- m4-1.4.10/lib/Makefile.am 2007-07-09 21:13:55.000000000 -0600 +++ m4-1.4.11/lib/Makefile.am 2008-04-01 18:56:18.000000000 -0600 @@ -1,6 +1,6 @@ ## DO NOT EDIT! GENERATED AUTOMATICALLY! ## Process this file with automake to produce Makefile.in. -# Copyright (C) 2004-2007 Free Software Foundation, Inc. +# Copyright (C) 2002-2008 Free Software Foundation, Inc. # # This file is free software, distributed under the terms of the GNU # General Public License. As a special exception to the GNU General @@ -9,7 +9,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --local-dir=local --lib=libm4 --source-base=lib --m4-base=m4 --doc-base=doc --aux-dir=. --with-tests --no-libtool --macro-prefix=M4 assert avltree-oset binary-io clean-temp cloexec close-stream closein config-h error fdl fflush fopen-safer free fseeko gendocs getopt gnupload gpl-3.0 mkstemp obstack regex stdbool stdint stdlib-safer strtol unlocked-io vasprintf-posix verror version-etc version-etc-fsf xalloc xvasprintf +# Reproduce by: gnulib-tool --import --dir=. --local-dir=local --lib=libm4 --source-base=lib --m4-base=m4 --doc-base=doc --aux-dir=build-aux --with-tests --no-libtool --macro-prefix=M4 announce-gen assert avltree-oset binary-io clean-temp cloexec close-stream closein config-h error fdl fflush fopen-safer fseeko gendocs getopt git-version-gen gnumakefile gnupload gpl-3.0 intprops mkstemp obstack regex stdbool stdint stdlib-safer strstr strtod strtol unlocked-io verror version-etc version-etc-fsf xalloc xprintf xvasprintf-posix AUTOMAKE_OPTIONS = 1.5 gnits @@ -34,15 +34,6 @@ libm4_a_LIBADD = $(M4_LIBOBJS) libm4_a_DEPENDENCIES = $(M4_LIBOBJS) EXTRA_libm4_a_SOURCES = -## begin gnulib module absolute-header - -# Use this preprocessor expression to decide whether #include_next works. -# Do not rely on a 'configure'-time test for this, since the expression -# might appear in an installed header, which is used by some other compiler. -HAVE_INCLUDE_NEXT = (__GNUC__ || 60000000 <= __DECC_VER) - -## end gnulib module absolute-header - ## begin gnulib module alloca @@ -60,28 +51,23 @@ BUILT_SOURCES += $(ALLOCA_H) # We need the following in order to create <alloca.h> when the system # doesn't have one that works with the given compiler. -alloca.h: alloca_.h +alloca.h: alloca.in.h { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - cat $(srcdir)/alloca_.h; \ + cat $(srcdir)/alloca.in.h; \ } > $@-t mv -f $@-t $@ MOSTLYCLEANFILES += alloca.h alloca.h-t -EXTRA_DIST += alloca_.h +EXTRA_DIST += alloca.in.h ## end gnulib module alloca-opt -## begin gnulib module array-list +## begin gnulib module announce-gen -libm4_a_SOURCES += gl_array_list.h gl_array_list.c -## end gnulib module array-list +EXTRA_DIST += $(top_srcdir)/build-aux/announce-gen -## begin gnulib module array-oset - -libm4_a_SOURCES += gl_array_oset.h gl_array_oset.c - -## end gnulib module array-oset +## end gnulib module announce-gen ## begin gnulib module avltree-oset @@ -95,6 +81,12 @@ libm4_a_SOURCES += binary-io.h ## end gnulib module binary-io +## begin gnulib module c-ctype + +libm4_a_SOURCES += c-ctype.h c-ctype.c + +## end gnulib module c-ctype + ## begin gnulib module clean-temp libm4_a_SOURCES += clean-temp.h clean-temp.c @@ -232,17 +224,17 @@ BUILT_SOURCES += $(FLOAT_H) # We need the following in order to create <float.h> when the system # doesn't have one that works with the given compiler. -float.h: float_.h +float.h: float.in.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ -e 's|@''NEXT_FLOAT_H''@|$(NEXT_FLOAT_H)|g' \ - < $(srcdir)/float_.h; \ + < $(srcdir)/float.in.h; \ } > $@-t mv $@-t $@ MOSTLYCLEANFILES += float.h float.h-t -EXTRA_DIST += float_.h +EXTRA_DIST += float.in.h ## end gnulib module float @@ -258,9 +250,9 @@ EXTRA_libm4_a_SOURCES += fopen-safer.c ## begin gnulib module fpending -EXTRA_DIST += __fpending.c __fpending.h +EXTRA_DIST += fpending.c fpending.h -EXTRA_libm4_a_SOURCES += __fpending.c +EXTRA_libm4_a_SOURCES += fpending.c ## end gnulib module fpending @@ -279,6 +271,14 @@ EXTRA_DIST += fpurge.h ## end gnulib module fpurge +## begin gnulib module freadahead + +libm4_a_SOURCES += freadahead.c + +EXTRA_DIST += freadahead.h + +## end gnulib module freadahead + ## begin gnulib module freading libm4_a_SOURCES += freading.c @@ -287,14 +287,14 @@ EXTRA_DIST += freading.h ## end gnulib module freading -## begin gnulib module free +## begin gnulib module frexp-nolibm -EXTRA_DIST += free.c +EXTRA_DIST += frexp.c -EXTRA_libm4_a_SOURCES += free.c +EXTRA_libm4_a_SOURCES += frexp.c -## end gnulib module free +## end gnulib module frexp-nolibm ## begin gnulib module frexpl-nolibm @@ -323,20 +323,27 @@ EXTRA_libm4_a_SOURCES += ftello.c ## end gnulib module ftello +## begin gnulib module gendocs + + +EXTRA_DIST += $(top_srcdir)/build-aux/gendocs.sh + +## end gnulib module gendocs + ## begin gnulib module getopt BUILT_SOURCES += $(GETOPT_H) # We need the following in order to create <getopt.h> when the system # doesn't have one that works with the given compiler. -getopt.h: getopt_.h +getopt.h: getopt.in.h { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - cat $(srcdir)/getopt_.h; \ + cat $(srcdir)/getopt.in.h; \ } > $@-t mv -f $@-t $@ MOSTLYCLEANFILES += getopt.h getopt.h-t -EXTRA_DIST += getopt.c getopt1.c getopt_.h getopt_int.h +EXTRA_DIST += getopt.c getopt.in.h getopt1.c getopt_int.h EXTRA_libm4_a_SOURCES += getopt.c getopt1.c @@ -357,6 +364,30 @@ EXTRA_libm4_a_SOURCES += gettimeofday.c ## end gnulib module gettimeofday +## begin gnulib module git-version-gen + + +EXTRA_DIST += $(top_srcdir)/build-aux/git-version-gen + +## end gnulib module git-version-gen + +## begin gnulib module gnumakefile + +distclean-local: clean-GNUmakefile +clean-GNUmakefile: + test x'$(VPATH)' != x && rm -f $(top_builddir)/GNUmakefile || : + +EXTRA_DIST += $(top_srcdir)/GNUmakefile + +## end gnulib module gnumakefile + +## begin gnulib module gnupload + + +EXTRA_DIST += $(top_srcdir)/build-aux/gnupload + +## end gnulib module gnupload + ## begin gnulib module intprops @@ -364,14 +395,14 @@ EXTRA_DIST += intprops.h ## end gnulib module intprops -## begin gnulib module isnan-nolibm +## begin gnulib module isnand-nolibm -EXTRA_DIST += float+.h isnan.c isnan.h +EXTRA_DIST += float+.h isnan.c isnand.c isnand.h -EXTRA_libm4_a_SOURCES += isnan.c +EXTRA_libm4_a_SOURCES += isnan.c isnand.c -## end gnulib module isnan-nolibm +## end gnulib module isnand-nolibm ## begin gnulib module isnanf-nolibm @@ -393,7 +424,9 @@ EXTRA_libm4_a_SOURCES += isnan.c isnanl. ## begin gnulib module link-warning -LINK_WARNING_H=$(top_srcdir)/./link-warning.h +LINK_WARNING_H=$(top_srcdir)/build-aux/link-warning.h + +EXTRA_DIST += $(top_srcdir)/build-aux/link-warning.h ## end gnulib module link-warning @@ -485,6 +518,15 @@ EXTRA_libm4_a_SOURCES += malloc.c ## end gnulib module malloc +## begin gnulib module malloc-posix + + +EXTRA_DIST += malloc.c + +EXTRA_libm4_a_SOURCES += malloc.c + +## end gnulib module malloc-posix + ## begin gnulib module malloca libm4_a_SOURCES += malloca.c @@ -499,43 +541,82 @@ BUILT_SOURCES += math.h # We need the following in order to create <math.h> when the system # doesn't have one that works with the given compiler. -math.h: math_.h +math.h: math.in.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ -e 's|@''NEXT_MATH_H''@|$(NEXT_MATH_H)|g' \ + -e 's|@''GNULIB_CEILF''@|$(GNULIB_CEILF)|g' \ + -e 's|@''GNULIB_CEILL''@|$(GNULIB_CEILL)|g' \ + -e 's|@''GNULIB_FLOORF''@|$(GNULIB_FLOORF)|g' \ + -e 's|@''GNULIB_FLOORL''@|$(GNULIB_FLOORL)|g' \ -e 's|@''GNULIB_FREXP''@|$(GNULIB_FREXP)|g' \ -e 's|@''GNULIB_FREXPL''@|$(GNULIB_FREXPL)|g' \ + -e 's|@''GNULIB_ISFINITE''@|$(GNULIB_ISFINITE)|g' \ -e 's|@''GNULIB_LDEXPL''@|$(GNULIB_LDEXPL)|g' \ -e 's|@''GNULIB_MATHL''@|$(GNULIB_MATHL)|g' \ + -e 's|@''GNULIB_ROUND''@|$(GNULIB_ROUND)|g' \ + -e 's|@''GNULIB_ROUNDF''@|$(GNULIB_ROUNDF)|g' \ + -e 's|@''GNULIB_ROUNDL''@|$(GNULIB_ROUNDL)|g' \ -e 's|@''GNULIB_SIGNBIT''@|$(GNULIB_SIGNBIT)|g' \ + -e 's|@''GNULIB_TRUNC''@|$(GNULIB_TRUNC)|g' \ + -e 's|@''GNULIB_TRUNCF''@|$(GNULIB_TRUNCF)|g' \ + -e 's|@''GNULIB_TRUNCL''@|$(GNULIB_TRUNCL)|g' \ -e 's|@''HAVE_DECL_ACOSL''@|$(HAVE_DECL_ACOSL)|g' \ -e 's|@''HAVE_DECL_ASINL''@|$(HAVE_DECL_ASINL)|g' \ -e 's|@''HAVE_DECL_ATANL''@|$(HAVE_DECL_ATANL)|g' \ - -e 's|@''HAVE_DECL_CEILL''@|$(HAVE_DECL_CEILL)|g' \ -e 's|@''HAVE_DECL_COSL''@|$(HAVE_DECL_COSL)|g' \ -e 's|@''HAVE_DECL_EXPL''@|$(HAVE_DECL_EXPL)|g' \ - -e 's|@''HAVE_DECL_FLOORL''@|$(HAVE_DECL_FLOORL)|g' \ -e 's|@''HAVE_DECL_FREXPL''@|$(HAVE_DECL_FREXPL)|g' \ -e 's|@''HAVE_DECL_LDEXPL''@|$(HAVE_DECL_LDEXPL)|g' \ -e 's|@''HAVE_DECL_LOGL''@|$(HAVE_DECL_LOGL)|g' \ -e 's|@''HAVE_DECL_SINL''@|$(HAVE_DECL_SINL)|g' \ -e 's|@''HAVE_DECL_SQRTL''@|$(HAVE_DECL_SQRTL)|g' \ -e 's|@''HAVE_DECL_TANL''@|$(HAVE_DECL_TANL)|g' \ + -e 's|@''HAVE_DECL_TRUNC''@|$(HAVE_DECL_TRUNC)|g' \ + -e 's|@''HAVE_DECL_TRUNCF''@|$(HAVE_DECL_TRUNCF)|g' \ + -e 's|@''HAVE_DECL_TRUNCL''@|$(HAVE_DECL_TRUNCL)|g' \ + -e 's|@''REPLACE_CEILF''@|$(REPLACE_CEILF)|g' \ + -e 's|@''REPLACE_CEILL''@|$(REPLACE_CEILL)|g' \ + -e 's|@''REPLACE_FLOORF''@|$(REPLACE_FLOORF)|g' \ + -e 's|@''REPLACE_FLOORL''@|$(REPLACE_FLOORL)|g' \ -e 's|@''REPLACE_FREXP''@|$(REPLACE_FREXP)|g' \ -e 's|@''REPLACE_FREXPL''@|$(REPLACE_FREXPL)|g' \ + -e 's|@''REPLACE_ISFINITE''@|$(REPLACE_ISFINITE)|g' \ -e 's|@''REPLACE_LDEXPL''@|$(REPLACE_LDEXPL)|g' \ + -e 's|@''REPLACE_ROUND''@|$(REPLACE_ROUND)|g' \ + -e 's|@''REPLACE_ROUNDF''@|$(REPLACE_ROUNDF)|g' \ + -e 's|@''REPLACE_ROUNDL''@|$(REPLACE_ROUNDL)|g' \ -e 's|@''REPLACE_SIGNBIT''@|$(REPLACE_SIGNBIT)|g' \ + -e 's|@''REPLACE_SIGNBIT_USING_GCC''@|$(REPLACE_SIGNBIT_USING_GCC)|g' \ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ - < $(srcdir)/math_.h; \ + < $(srcdir)/math.in.h; \ } > $@-t mv $@-t $@ MOSTLYCLEANFILES += math.h math.h-t -EXTRA_DIST += math_.h +EXTRA_DIST += math.in.h ## end gnulib module math +## begin gnulib module memchr + + +EXTRA_DIST += memchr.c + +EXTRA_libm4_a_SOURCES += memchr.c + +## end gnulib module memchr + +## begin gnulib module memcmp + + +EXTRA_DIST += memcmp.c + +EXTRA_libm4_a_SOURCES += memcmp.c + +## end gnulib module memcmp + ## begin gnulib module mkdtemp @@ -594,12 +675,6 @@ EXTRA_libm4_a_SOURCES += printf-frexp.c ## end gnulib module printf-frexpl -## begin gnulib module progname - -libm4_a_SOURCES += progname.h progname.c - -## end gnulib module progname - ## begin gnulib module quotearg @@ -624,7 +699,7 @@ BUILT_SOURCES += signal.h # We need the following in order to create <signal.h> when the system # doesn't have a complete one. -signal.h: signal_.h +signal.h: signal.in.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ @@ -633,12 +708,12 @@ signal.h: signal_.h -e 's|@''HAVE_POSIX_SIGNALBLOCKING''@|$(HAVE_POSIX_SIGNALBLOCKING)|g' \ -e 's|@''HAVE_SIGSET_T''@|$(HAVE_SIGSET_T)|g' \ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ - < $(srcdir)/signal_.h; \ + < $(srcdir)/signal.in.h; \ } > $@-t mv $@-t $@ MOSTLYCLEANFILES += signal.h signal.h-t -EXTRA_DIST += signal_.h +EXTRA_DIST += signal.in.h ## end gnulib module signal @@ -666,21 +741,41 @@ libm4_a_SOURCES += size_max.h ## end gnulib module size_max +## begin gnulib module stdarg + +BUILT_SOURCES += $(STDARG_H) + +# We need the following in order to create <stdarg.h> when the system +# doesn't have one that works with the given compiler. +stdarg.h: stdarg.in.h + rm -f $@-t $@ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ + sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ + -e 's|@''NEXT_STDARG_H''@|$(NEXT_STDARG_H)|g' \ + < $(srcdir)/stdarg.in.h; \ + } > $@-t + mv $@-t $@ +MOSTLYCLEANFILES += stdarg.h stdarg.h-t + +EXTRA_DIST += stdarg.in.h + +## end gnulib module stdarg + ## begin gnulib module stdbool BUILT_SOURCES += $(STDBOOL_H) # We need the following in order to create <stdbool.h> when the system # doesn't have one that works. -stdbool.h: stdbool_.h +stdbool.h: stdbool.in.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool_.h; \ + sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool.in.h; \ } > $@-t mv $@-t $@ MOSTLYCLEANFILES += stdbool.h stdbool.h-t -EXTRA_DIST += stdbool_.h +EXTRA_DIST += stdbool.in.h ## end gnulib module stdbool @@ -690,7 +785,7 @@ BUILT_SOURCES += $(STDINT_H) # We need the following in order to create <stdint.h> when the system # doesn't have one that works with the given compiler. -stdint.h: stdint_.h +stdint.h: stdint.in.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \ @@ -715,12 +810,12 @@ stdint.h: stdint_.h -e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \ -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \ -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \ - < $(srcdir)/stdint_.h; \ + < $(srcdir)/stdint.in.h; \ } > $@-t mv $@-t $@ MOSTLYCLEANFILES += stdint.h stdint.h-t -EXTRA_DIST += stdint_.h +EXTRA_DIST += stdint.in.h ## end gnulib module stdint @@ -730,7 +825,7 @@ BUILT_SOURCES += stdio.h # We need the following in order to create <stdio.h> when the system # doesn't have one that works with the given compiler. -stdio.h: stdio_.h +stdio.h: stdio.in.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ @@ -744,11 +839,15 @@ stdio.h: stdio_.h -e 's|@''GNULIB_VSNPRINTF''@|$(GNULIB_VSNPRINTF)|g' \ -e 's|@''GNULIB_VSPRINTF_POSIX''@|$(GNULIB_VSPRINTF_POSIX)|g' \ -e 's|@''GNULIB_VASPRINTF''@|$(GNULIB_VASPRINTF)|g' \ + -e 's|@''GNULIB_FOPEN''@|$(GNULIB_FOPEN)|g' \ + -e 's|@''GNULIB_FREOPEN''@|$(GNULIB_FREOPEN)|g' \ -e 's|@''GNULIB_FSEEK''@|$(GNULIB_FSEEK)|g' \ -e 's|@''GNULIB_FSEEKO''@|$(GNULIB_FSEEKO)|g' \ -e 's|@''GNULIB_FTELL''@|$(GNULIB_FTELL)|g' \ -e 's|@''GNULIB_FTELLO''@|$(GNULIB_FTELLO)|g' \ -e 's|@''GNULIB_FFLUSH''@|$(GNULIB_FFLUSH)|g' \ + -e 's|@''GNULIB_GETDELIM''@|$(GNULIB_GETDELIM)|g' \ + -e 's|@''GNULIB_GETLINE''@|$(GNULIB_GETLINE)|g' \ -e 's|@''REPLACE_FPRINTF''@|$(REPLACE_FPRINTF)|g' \ -e 's|@''REPLACE_VFPRINTF''@|$(REPLACE_VFPRINTF)|g' \ -e 's|@''REPLACE_PRINTF''@|$(REPLACE_PRINTF)|g' \ @@ -761,18 +860,23 @@ stdio.h: stdio_.h -e 's|@''REPLACE_VSPRINTF''@|$(REPLACE_VSPRINTF)|g' \ -e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \ -e 's|@''REPLACE_VASPRINTF''@|$(REPLACE_VASPRINTF)|g' \ + -e 's|@''REPLACE_FOPEN''@|$(REPLACE_FOPEN)|g' \ + -e 's|@''REPLACE_FREOPEN''@|$(REPLACE_FREOPEN)|g' \ -e 's|@''REPLACE_FSEEKO''@|$(REPLACE_FSEEKO)|g' \ -e 's|@''REPLACE_FSEEK''@|$(REPLACE_FSEEK)|g' \ -e 's|@''REPLACE_FTELLO''@|$(REPLACE_FTELLO)|g' \ -e 's|@''REPLACE_FTELL''@|$(REPLACE_FTELL)|g' \ -e 's|@''REPLACE_FFLUSH''@|$(REPLACE_FFLUSH)|g' \ + -e 's|@''HAVE_DECL_GETDELIM''@|$(HAVE_DECL_GETDELIM)|g' \ + -e 's|@''HAVE_DECL_GETLINE''@|$(HAVE_DECL_GETLINE)|g' \ + -e 's|@''REPLACE_GETLINE''@|$(REPLACE_GETLINE)|g' \ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ - < $(srcdir)/stdio_.h; \ + < $(srcdir)/stdio.in.h; \ } > $@-t mv $@-t $@ MOSTLYCLEANFILES += stdio.h stdio.h-t -EXTRA_DIST += stdio_.h +EXTRA_DIST += stdio.in.h ## end gnulib module stdio @@ -782,24 +886,40 @@ BUILT_SOURCES += stdlib.h # We need the following in order to create <stdlib.h> when the system # doesn't have one that works with the given compiler. -stdlib.h: stdlib_.h +stdlib.h: stdlib.in.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ -e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \ + -e 's|@''GNULIB_MALLOC_POSIX''@|$(GNULIB_MALLOC_POSIX)|g' \ + -e 's|@''GNULIB_REALLOC_POSIX''@|$(GNULIB_REALLOC_POSIX)|g' \ + -e 's|@''GNULIB_CALLOC_POSIX''@|$(GNULIB_CALLOC_POSIX)|g' \ -e 's|@''GNULIB_GETSUBOPT''@|$(GNULIB_GETSUBOPT)|g' \ -e 's|@''GNULIB_MKDTEMP''@|$(GNULIB_MKDTEMP)|g' \ -e 's|@''GNULIB_MKSTEMP''@|$(GNULIB_MKSTEMP)|g' \ + -e 's|@''GNULIB_PUTENV''@|$(GNULIB_PUTENV)|g' \ + -e 's|@''GNULIB_SETENV''@|$(GNULIB_SETENV)|g' \ + -e 's|@''GNULIB_STRTOD''@|$(GNULIB_STRTOD)|g' \ + -e 's|@''GNULIB_UNSETENV''@|$(GNULIB_UNSETENV)|g' \ + -e 's|@''HAVE_CALLOC_POSIX''@|$(HAVE_CALLOC_POSIX)|g' \ -e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \ + -e 's|@''HAVE_MALLOC_POSIX''@|$(HAVE_MALLOC_POSIX)|g' \ -e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \ + -e 's|@''HAVE_REALLOC_POSIX''@|$(HAVE_REALLOC_POSIX)|g' \ + -e 's|@''HAVE_SETENV''@|$(HAVE_SETENV)|g' \ + -e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \ + -e 's|@''HAVE_UNSETENV''@|$(HAVE_UNSETENV)|g' \ -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \ + -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \ + -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \ + -e 's|@''VOID_UNSETENV''@|$(VOID_UNSETENV)|g' \ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ - < $(srcdir)/stdlib_.h; \ + < $(srcdir)/stdlib.in.h; \ } > $@-t mv $@-t $@ MOSTLYCLEANFILES += stdlib.h stdlib.h-t -EXTRA_DIST += stdlib_.h +EXTRA_DIST += stdlib.in.h ## end gnulib module stdlib @@ -812,6 +932,106 @@ EXTRA_libm4_a_SOURCES += mkstemp-safer.c ## end gnulib module stdlib-safer +## begin gnulib module strerror + + +EXTRA_DIST += strerror.c + +EXTRA_libm4_a_SOURCES += strerror.c + +## end gnulib module strerror + +## begin gnulib module string + +BUILT_SOURCES += string.h + +# We need the following in order to create <string.h> when the system +# doesn't have one that works with the given compiler. +string.h: string.in.h + rm -f $@-t $@ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ + sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ + -e 's|@''NEXT_STRING_H''@|$(NEXT_STRING_H)|g' \ + -e 's|@''GNULIB_MBSLEN''@|$(GNULIB_MBSLEN)|g' \ + -e 's|@''GNULIB_MBSNLEN''@|$(GNULIB_MBSNLEN)|g' \ + -e 's|@''GNULIB_MBSCHR''@|$(GNULIB_MBSCHR)|g' \ + -e 's|@''GNULIB_MBSRCHR''@|$(GNULIB_MBSRCHR)|g' \ + -e 's|@''GNULIB_MBSSTR''@|$(GNULIB_MBSSTR)|g' \ + -e 's|@''GNULIB_MBSCASECMP''@|$(GNULIB_MBSCASECMP)|g' \ + -e 's|@''GNULIB_MBSNCASECMP''@|$(GNULIB_MBSNCASECMP)|g' \ + -e 's|@''GNULIB_MBSPCASECMP''@|$(GNULIB_MBSPCASECMP)|g' \ + -e 's|@''GNULIB_MBSCASESTR''@|$(GNULIB_MBSCASESTR)|g' \ + -e 's|@''GNULIB_MBSCSPN''@|$(GNULIB_MBSCSPN)|g' \ + -e 's|@''GNULIB_MBSPBRK''@|$(GNULIB_MBSPBRK)|g' \ + -e 's|@''GNULIB_MBSSPN''@|$(GNULIB_MBSSPN)|g' \ + -e 's|@''GNULIB_MBSSEP''@|$(GNULIB_MBSSEP)|g' \ + -e 's|@''GNULIB_MBSTOK_R''@|$(GNULIB_MBSTOK_R)|g' \ + -e 's|@''GNULIB_MEMMEM''@|$(GNULIB_MEMMEM)|g' \ + -e 's|@''GNULIB_MEMPCPY''@|$(GNULIB_MEMPCPY)|g' \ + -e 's|@''GNULIB_MEMRCHR''@|$(GNULIB_MEMRCHR)|g' \ + -e 's|@''GNULIB_STPCPY''@|$(GNULIB_STPCPY)|g' \ + -e 's|@''GNULIB_STPNCPY''@|$(GNULIB_STPNCPY)|g' \ + -e 's|@''GNULIB_STRCHRNUL''@|$(GNULIB_STRCHRNUL)|g' \ + -e 's|@''GNULIB_STRDUP''@|$(GNULIB_STRDUP)|g' \ + -e 's|@''GNULIB_STRNDUP''@|$(GNULIB_STRNDUP)|g' \ + -e 's|@''GNULIB_STRNLEN''@|$(GNULIB_STRNLEN)|g' \ + -e 's|@''GNULIB_STRPBRK''@|$(GNULIB_STRPBRK)|g' \ + -e 's|@''GNULIB_STRSEP''@|$(GNULIB_STRSEP)|g' \ + -e 's|@''GNULIB_STRSTR''@|$(GNULIB_STRSTR)|g' \ + -e 's|@''GNULIB_STRCASESTR''@|$(GNULIB_STRCASESTR)|g' \ + -e 's|@''GNULIB_STRTOK_R''@|$(GNULIB_STRTOK_R)|g' \ + -e 's|@''GNULIB_STRERROR''@|$(GNULIB_STRERROR)|g' \ + -e 's|@''GNULIB_STRSIGNAL''@|$(GNULIB_STRSIGNAL)|g' \ + -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \ + -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \ + -e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \ + -e 's|@''HAVE_STPCPY''@|$(HAVE_STPCPY)|g' \ + -e 's|@''HAVE_STPNCPY''@|$(HAVE_STPNCPY)|g' \ + -e 's|@''HAVE_STRCHRNUL''@|$(HAVE_STRCHRNUL)|g' \ + -e 's|@''HAVE_DECL_STRDUP''@|$(HAVE_DECL_STRDUP)|g' \ + -e 's|@''HAVE_STRNDUP''@|$(HAVE_STRNDUP)|g' \ + -e 's|@''HAVE_DECL_STRNDUP''@|$(HAVE_DECL_STRNDUP)|g' \ + -e 's|@''HAVE_DECL_STRNLEN''@|$(HAVE_DECL_STRNLEN)|g' \ + -e 's|@''HAVE_STRPBRK''@|$(HAVE_STRPBRK)|g' \ + -e 's|@''HAVE_STRSEP''@|$(HAVE_STRSEP)|g' \ + -e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \ + -e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \ + -e 's|@''HAVE_DECL_STRERROR''@|$(HAVE_DECL_STRERROR)|g' \ + -e 's|@''HAVE_DECL_STRSIGNAL''@|$(HAVE_DECL_STRSIGNAL)|g' \ + -e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \ + -e 's|@''REPLACE_STRCASESTR''@|$(REPLACE_STRCASESTR)|g' \ + -e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \ + -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \ + -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \ + -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ + < $(srcdir)/string.in.h; \ + } > $@-t + mv $@-t $@ +MOSTLYCLEANFILES += string.h string.h-t + +EXTRA_DIST += string.in.h + +## end gnulib module string + +## begin gnulib module strstr + + +EXTRA_DIST += str-two-way.h strstr.c + +EXTRA_libm4_a_SOURCES += strstr.c + +## end gnulib module strstr + +## begin gnulib module strtod + +LIBS += $(POW_LIB) + +EXTRA_DIST += strtod.c + +EXTRA_libm4_a_SOURCES += strtod.c + +## end gnulib module strtod + ## begin gnulib module strtol @@ -827,7 +1047,7 @@ BUILT_SOURCES += $(SYS_STAT_H) # We need the following in order to create <sys/stat.h> when the system # has one that is incomplete. -sys/stat.h: sys_stat_.h +sys/stat.h: sys_stat.in.h @MKDIR_P@ sys rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ @@ -836,13 +1056,13 @@ sys/stat.h: sys_stat_.h -e 's|@''HAVE_IO_H''@|$(HAVE_IO_H)|g' \ -e 's|@''HAVE_LSTAT''@|$(HAVE_LSTAT)|g' \ -e 's|@''HAVE_DECL_MKDIR''@|$(HAVE_DECL_MKDIR)|g' \ - < $(srcdir)/sys_stat_.h; \ + < $(srcdir)/sys_stat.in.h; \ } > $@-t mv $@-t $@ MOSTLYCLEANFILES += sys/stat.h sys/stat.h-t MOSTLYCLEANDIRS += sys -EXTRA_DIST += sys_stat_.h +EXTRA_DIST += sys_stat.in.h ## end gnulib module sys_stat @@ -852,7 +1072,7 @@ BUILT_SOURCES += $(SYS_TIME_H) # We need the following in order to create <sys/time.h> when the system # doesn't have one that works with the given compiler. -sys/time.h: sys_time_.h +sys/time.h: sys_time.in.h @MKDIR_P@ sys rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ @@ -861,12 +1081,12 @@ sys/time.h: sys_time_.h -e 's|@''NEXT_SYS_TIME_H''@|$(NEXT_SYS_TIME_H)|g' \ -e 's/@''REPLACE_GETTIMEOFDAY''@/$(REPLACE_GETTIMEOFDAY)/g' \ -e 's/@''HAVE_STRUCT_TIMEVAL''@/$(HAVE_STRUCT_TIMEVAL)/g' \ - < $(srcdir)/sys_time_.h; \ + < $(srcdir)/sys_time.in.h; \ } > $@-t mv $@-t $@ MOSTLYCLEANFILES += sys/time.h sys/time.h-t -EXTRA_DIST += sys_time_.h +EXTRA_DIST += sys_time.in.h ## end gnulib module sys_time @@ -891,7 +1111,7 @@ BUILT_SOURCES += unistd.h # We need the following in order to create an empty placeholder for # <unistd.h> when the system doesn't have one. -unistd.h: unistd_.h +unistd.h: unistd.in.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \ @@ -899,30 +1119,37 @@ unistd.h: unistd_.h -e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \ -e 's|@''GNULIB_CHOWN''@|$(GNULIB_CHOWN)|g' \ -e 's|@''GNULIB_DUP2''@|$(GNULIB_DUP2)|g' \ + -e 's|@''GNULIB_ENVIRON''@|$(GNULIB_ENVIRON)|g' \ -e 's|@''GNULIB_FCHDIR''@|$(GNULIB_FCHDIR)|g' \ -e 's|@''GNULIB_FTRUNCATE''@|$(GNULIB_FTRUNCATE)|g' \ -e 's|@''GNULIB_GETCWD''@|$(GNULIB_GETCWD)|g' \ -e 's|@''GNULIB_GETLOGIN_R''@|$(GNULIB_GETLOGIN_R)|g' \ + -e 's|@''GNULIB_GETPAGESIZE''@|$(GNULIB_GETPAGESIZE)|g' \ -e 's|@''GNULIB_LCHOWN''@|$(GNULIB_LCHOWN)|g' \ -e 's|@''GNULIB_LSEEK''@|$(GNULIB_LSEEK)|g' \ -e 's|@''GNULIB_READLINK''@|$(GNULIB_READLINK)|g' \ -e 's|@''GNULIB_SLEEP''@|$(GNULIB_SLEEP)|g' \ -e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \ -e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \ + -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \ -e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \ -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \ + -e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \ -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \ + -e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \ + -e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \ -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \ -e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \ -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \ + -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \ -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \ -e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \ - < $(srcdir)/unistd_.h; \ + < $(srcdir)/unistd.in.h; \ } > $@-t mv $@-t $@ MOSTLYCLEANFILES += unistd.h unistd.h-t -EXTRA_DIST += unistd_.h +EXTRA_DIST += unistd.in.h ## end gnulib module unistd @@ -960,12 +1187,6 @@ EXTRA_libm4_a_SOURCES += asprintf.c vasp ## end gnulib module vasprintf -## begin gnulib module verify - -libm4_a_SOURCES += verify.h - -## end gnulib module verify - ## begin gnulib module verror libm4_a_SOURCES += verror.h verror.c @@ -990,7 +1211,7 @@ BUILT_SOURCES += $(WCHAR_H) # We need the following in order to create <wchar.h> when the system # version does not work standalone. -wchar.h: wchar_.h +wchar.h: wchar.in.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ @@ -1000,12 +1221,12 @@ wchar.h: wchar_.h -e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \ -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ - < $(srcdir)/wchar_.h; \ + < $(srcdir)/wchar.in.h; \ } > $@-t mv $@-t $@ MOSTLYCLEANFILES += wchar.h wchar.h-t -EXTRA_DIST += wchar_.h +EXTRA_DIST += wchar.in.h ## end gnulib module wchar @@ -1015,7 +1236,7 @@ BUILT_SOURCES += $(WCTYPE_H) # We need the following in order to create <wctype.h> when the system # doesn't have one that works with the given compiler. -wctype.h: wctype_.h +wctype.h: wctype.in.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's/@''HAVE_WCTYPE_H''@/$(HAVE_WCTYPE_H)/g' \ @@ -1023,12 +1244,12 @@ wctype.h: wctype_.h -e 's|@''NEXT_WCTYPE_H''@|$(NEXT_WCTYPE_H)|g' \ -e 's/@''HAVE_ISWCNTRL''@/$(HAVE_ISWCNTRL)/g' \ -e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \ - < $(srcdir)/wctype_.h; \ + < $(srcdir)/wctype.in.h; \ } > $@-t mv $@-t $@ MOSTLYCLEANFILES += wctype.h wctype.h-t -EXTRA_DIST += wctype_.h +EXTRA_DIST += wctype.in.h ## end gnulib module wctype @@ -1055,6 +1276,12 @@ EXTRA_DIST += xmalloca.h ## end gnulib module xmalloca +## begin gnulib module xprintf + +libm4_a_SOURCES += xprintf.h xprintf.c + +## end gnulib module xprintf + ## begin gnulib module xsize libm4_a_SOURCES += xsize.h diff -ruNp m4-1.4.10/lib/Makefile.in m4-1.4.11/lib/Makefile.in --- m4-1.4.10/lib/Makefile.in 2007-07-09 21:15:33.000000000 -0600 +++ m4-1.4.11/lib/Makefile.in 2008-04-02 06:45:29.000000000 -0600 @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.10 from Makefile.am. +# Makefile.in generated by automake 1.10.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -14,7 +14,7 @@ @SET_MAKE@ -# Copyright (C) 2004-2007 Free Software Foundation, Inc. +# Copyright (C) 2002-2008 Free Software Foundation, Inc. # # This file is free software, distributed under the terms of the GNU # General Public License. As a special exception to the GNU General @@ -23,7 +23,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --local-dir=local --lib=libm4 --source-base=lib --m4-base=m4 --doc-base=doc --aux-dir=. --with-tests --no-libtool --macro-prefix=M4 assert avltree-oset binary-io clean-temp cloexec close-stream closein config-h error fdl fflush fopen-safer free fseeko gendocs getopt gnupload gpl-3.0 mkstemp obstack regex stdbool stdint stdlib-safer strtol unlocked-io vasprintf-posix verror version-etc version-etc-fsf xalloc xvasprintf +# Reproduce by: gnulib-tool --import --dir=. --local-dir=local --lib=libm4 --source-base=lib --m4-base=m4 --doc-base=doc --aux-dir=build-aux --with-tests --no-libtool --macro-prefix=M4 announce-gen assert avltree-oset binary-io clean-temp cloexec close-stream closein config-h error fdl fflush fopen-safer fseeko gendocs getopt git-version-gen gnumakefile gnupload gpl-3.0 intprops mkstemp obstack regex stdbool stdint stdlib-safer strstr strtod strtol unlocked-io verror version-etc version-etc-fsf xalloc xprintf xvasprintf-posix @@ -47,7 +47,8 @@ build_triplet = @build@ host_triplet = @host@ subdir = lib DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in $(srcdir)/config.hin alloca.c + $(srcdir)/Makefile.in $(srcdir)/config.hin COPYING.LIB \ + alloca.c ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/alloca.m4 \ $(top_srcdir)/m4/assert.m4 $(top_srcdir)/m4/cloexec.m4 \ @@ -59,22 +60,23 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/a $(top_srcdir)/m4/fatal-signal.m4 $(top_srcdir)/m4/fflush.m4 \ $(top_srcdir)/m4/float_h.m4 $(top_srcdir)/m4/fpending.m4 \ $(top_srcdir)/m4/fpieee.m4 $(top_srcdir)/m4/fpurge.m4 \ - $(top_srcdir)/m4/freading.m4 $(top_srcdir)/m4/free.m4 \ - $(top_srcdir)/m4/frexp.m4 $(top_srcdir)/m4/frexpl.m4 \ - $(top_srcdir)/m4/fseeko.m4 $(top_srcdir)/m4/ftello.m4 \ - $(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gettimeofday.m4 \ - $(top_srcdir)/m4/gl_list.m4 $(top_srcdir)/m4/glibc21.m4 \ - $(top_srcdir)/m4/gnulib-common.m4 \ + $(top_srcdir)/m4/freading.m4 $(top_srcdir)/m4/frexp.m4 \ + $(top_srcdir)/m4/frexpl.m4 $(top_srcdir)/m4/fseeko.m4 \ + $(top_srcdir)/m4/ftello.m4 $(top_srcdir)/m4/getopt.m4 \ + $(top_srcdir)/m4/gettimeofday.m4 $(top_srcdir)/m4/gl_list.m4 \ + $(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/gnulib-common.m4 \ $(top_srcdir)/m4/gnulib-comp.m4 \ $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/inline.m4 \ $(top_srcdir)/m4/intmax_t.m4 $(top_srcdir)/m4/inttypes_h.m4 \ - $(top_srcdir)/m4/isnan.m4 $(top_srcdir)/m4/isnanf.m4 \ + $(top_srcdir)/m4/isnand.m4 $(top_srcdir)/m4/isnanf.m4 \ $(top_srcdir)/m4/isnanl.m4 $(top_srcdir)/m4/ldexpl.m4 \ $(top_srcdir)/m4/localcharset.m4 $(top_srcdir)/m4/longlong.m4 \ - $(top_srcdir)/m4/lseek.m4 $(top_srcdir)/m4/malloca.m4 \ - $(top_srcdir)/m4/math_h.m4 $(top_srcdir)/m4/mbrtowc.m4 \ - $(top_srcdir)/m4/mbstate_t.m4 $(top_srcdir)/m4/mkdtemp.m4 \ - $(top_srcdir)/m4/mkstemp.m4 $(top_srcdir)/m4/pathmax.m4 \ + $(top_srcdir)/m4/lseek.m4 $(top_srcdir)/m4/malloc.m4 \ + $(top_srcdir)/m4/malloca.m4 $(top_srcdir)/m4/math_h.m4 \ + $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbstate_t.m4 \ + $(top_srcdir)/m4/memchr.m4 $(top_srcdir)/m4/memcmp.m4 \ + $(top_srcdir)/m4/mkdtemp.m4 $(top_srcdir)/m4/mkstemp.m4 \ + $(top_srcdir)/m4/nocrash.m4 $(top_srcdir)/m4/pathmax.m4 \ $(top_srcdir)/m4/printf-frexp.m4 \ $(top_srcdir)/m4/printf-frexpl.m4 $(top_srcdir)/m4/printf.m4 \ $(top_srcdir)/m4/quotearg.m4 $(top_srcdir)/m4/regex.m4 \ @@ -85,11 +87,13 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/a $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdint_h.m4 \ $(top_srcdir)/m4/stdio-safer.m4 $(top_srcdir)/m4/stdio_h.m4 \ $(top_srcdir)/m4/stdlib-safer.m4 $(top_srcdir)/m4/stdlib_h.m4 \ + $(top_srcdir)/m4/strerror.m4 $(top_srcdir)/m4/string_h.m4 \ + $(top_srcdir)/m4/strstr.m4 $(top_srcdir)/m4/strtod.m4 \ $(top_srcdir)/m4/strtol.m4 $(top_srcdir)/m4/sys_stat_h.m4 \ $(top_srcdir)/m4/sys_time_h.m4 $(top_srcdir)/m4/tempname.m4 \ - $(top_srcdir)/m4/tmpdir.m4 $(top_srcdir)/m4/ulonglong.m4 \ - $(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/unistd_h.m4 \ - $(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/vasnprintf.m4 \ + $(top_srcdir)/m4/tmpdir.m4 $(top_srcdir)/m4/unistd-safer.m4 \ + $(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/unlocked-io.m4 \ + $(top_srcdir)/m4/vasnprintf.m4 \ $(top_srcdir)/m4/vasprintf-posix.m4 \ $(top_srcdir)/m4/vasprintf.m4 $(top_srcdir)/m4/wchar.m4 \ $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wctype.m4 \ @@ -106,20 +110,20 @@ AR = ar ARFLAGS = cru libm4_a_AR = $(AR) $(ARFLAGS) am__DEPENDENCIES_1 = -am_libm4_a_OBJECTS = gl_array_list.$(OBJEXT) gl_array_oset.$(OBJEXT) \ - gl_avltree_oset.$(OBJEXT) clean-temp.$(OBJEXT) \ - fatal-signal.$(OBJEXT) fpurge.$(OBJEXT) freading.$(OBJEXT) \ +am_libm4_a_OBJECTS = gl_avltree_oset.$(OBJEXT) c-ctype.$(OBJEXT) \ + clean-temp.$(OBJEXT) fatal-signal.$(OBJEXT) fpurge.$(OBJEXT) \ + freadahead.$(OBJEXT) freading.$(OBJEXT) \ gl_linkedhash_list.$(OBJEXT) gl_list.$(OBJEXT) \ localcharset.$(OBJEXT) malloca.$(OBJEXT) gl_oset.$(OBJEXT) \ printf-frexp.$(OBJEXT) printf-frexpl.$(OBJEXT) \ - progname.$(OBJEXT) tmpdir.$(OBJEXT) verror.$(OBJEXT) \ - version-etc.$(OBJEXT) version-etc-fsf.$(OBJEXT) \ - xalloc-die.$(OBJEXT) xmalloca.$(OBJEXT) xvasprintf.$(OBJEXT) \ + tmpdir.$(OBJEXT) verror.$(OBJEXT) version-etc.$(OBJEXT) \ + version-etc-fsf.$(OBJEXT) xalloc-die.$(OBJEXT) \ + xmalloca.$(OBJEXT) xprintf.$(OBJEXT) xvasprintf.$(OBJEXT) \ xasprintf.$(OBJEXT) libm4_a_OBJECTS = $(am_libm4_a_OBJECTS) LTLIBRARIES = $(noinst_LTLIBRARIES) DEFAULT_INCLUDES = -I.@am__isrc@ -depcomp = $(SHELL) $(top_srcdir)/depcomp +depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -161,11 +165,19 @@ EXEEXT = @EXEEXT@ FLOAT_H = @FLOAT_H@ GETOPT_H = @GETOPT_H@ GLIBC21 = @GLIBC21@ +GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@ +GNULIB_CEILF = @GNULIB_CEILF@ +GNULIB_CEILL = @GNULIB_CEILL@ GNULIB_CHOWN = @GNULIB_CHOWN@ GNULIB_DUP2 = @GNULIB_DUP2@ +GNULIB_ENVIRON = @GNULIB_ENVIRON@ GNULIB_FCHDIR = @GNULIB_FCHDIR@ GNULIB_FFLUSH = @GNULIB_FFLUSH@ +GNULIB_FLOORF = @GNULIB_FLOORF@ +GNULIB_FLOORL = @GNULIB_FLOORL@ +GNULIB_FOPEN = @GNULIB_FOPEN@ GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@ +GNULIB_FREOPEN = @GNULIB_FREOPEN@ GNULIB_FREXP = @GNULIB_FREXP@ GNULIB_FREXPL = @GNULIB_FREXPL@ GNULIB_FSEEK = @GNULIB_FSEEK@ @@ -174,21 +186,67 @@ GNULIB_FTELL = @GNULIB_FTELL@ GNULIB_FTELLO = @GNULIB_FTELLO@ GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@ GNULIB_GETCWD = @GNULIB_GETCWD@ +GNULIB_GETDELIM = @GNULIB_GETDELIM@ +GNULIB_GETLINE = @GNULIB_GETLINE@ GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@ +GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@ GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@ +GNULIB_ISFINITE = @GNULIB_ISFINITE@ GNULIB_LCHOWN = @GNULIB_LCHOWN@ GNULIB_LDEXPL = @GNULIB_LDEXPL@ GNULIB_LSEEK = @GNULIB_LSEEK@ +GNULIB_MALLOC_POSIX = @GNULIB_MALLOC_POSIX@ GNULIB_MATHL = @GNULIB_MATHL@ +GNULIB_MBSCASECMP = @GNULIB_MBSCASECMP@ +GNULIB_MBSCASESTR = @GNULIB_MBSCASESTR@ +GNULIB_MBSCHR = @GNULIB_MBSCHR@ +GNULIB_MBSCSPN = @GNULIB_MBSCSPN@ +GNULIB_MBSLEN = @GNULIB_MBSLEN@ +GNULIB_MBSNCASECMP = @GNULIB_MBSNCASECMP@ +GNULIB_MBSNLEN = @GNULIB_MBSNLEN@ +GNULIB_MBSPBRK = @GNULIB_MBSPBRK@ +GNULIB_MBSPCASECMP = @GNULIB_MBSPCASECMP@ +GNULIB_MBSRCHR = @GNULIB_MBSRCHR@ +GNULIB_MBSSEP = @GNULIB_MBSSEP@ +GNULIB_MBSSPN = @GNULIB_MBSSPN@ +GNULIB_MBSSTR = @GNULIB_MBSSTR@ +GNULIB_MBSTOK_R = @GNULIB_MBSTOK_R@ +GNULIB_MEMMEM = @GNULIB_MEMMEM@ +GNULIB_MEMPCPY = @GNULIB_MEMPCPY@ +GNULIB_MEMRCHR = @GNULIB_MEMRCHR@ GNULIB_MKDTEMP = @GNULIB_MKDTEMP@ GNULIB_MKSTEMP = @GNULIB_MKSTEMP@ GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@ +GNULIB_PUTENV = @GNULIB_PUTENV@ GNULIB_READLINK = @GNULIB_READLINK@ +GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@ +GNULIB_ROUND = @GNULIB_ROUND@ +GNULIB_ROUNDF = @GNULIB_ROUNDF@ +GNULIB_ROUNDL = @GNULIB_ROUNDL@ +GNULIB_SETENV = @GNULIB_SETENV@ GNULIB_SIGNBIT = @GNULIB_SIGNBIT@ GNULIB_SIGPROCMASK = @GNULIB_SIGPROCMASK@ GNULIB_SLEEP = @GNULIB_SLEEP@ GNULIB_SNPRINTF = @GNULIB_SNPRINTF@ GNULIB_SPRINTF_POSIX = @GNULIB_SPRINTF_POSIX@ +GNULIB_STPCPY = @GNULIB_STPCPY@ +GNULIB_STPNCPY = @GNULIB_STPNCPY@ +GNULIB_STRCASESTR = @GNULIB_STRCASESTR@ +GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@ +GNULIB_STRDUP = @GNULIB_STRDUP@ +GNULIB_STRERROR = @GNULIB_STRERROR@ +GNULIB_STRNDUP = @GNULIB_STRNDUP@ +GNULIB_STRNLEN = @GNULIB_STRNLEN@ +GNULIB_STRPBRK = @GNULIB_STRPBRK@ +GNULIB_STRSEP = @GNULIB_STRSEP@ +GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@ +GNULIB_STRSTR = @GNULIB_STRSTR@ +GNULIB_STRTOD = @GNULIB_STRTOD@ +GNULIB_STRTOK_R = @GNULIB_STRTOK_R@ +GNULIB_TRUNC = @GNULIB_TRUNC@ +GNULIB_TRUNCF = @GNULIB_TRUNCF@ +GNULIB_TRUNCL = @GNULIB_TRUNCL@ +GNULIB_UNSETENV = @GNULIB_UNSETENV@ GNULIB_VASPRINTF = @GNULIB_VASPRINTF@ GNULIB_VFPRINTF_POSIX = @GNULIB_VFPRINTF_POSIX@ GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@ @@ -196,49 +254,78 @@ GNULIB_VSNPRINTF = @GNULIB_VSNPRINTF@ GNULIB_VSPRINTF_POSIX = @GNULIB_VSPRINTF_POSIX@ GNULIB_WCWIDTH = @GNULIB_WCWIDTH@ GREP = @GREP@ +HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@ HAVE_DECL_ACOSL = @HAVE_DECL_ACOSL@ HAVE_DECL_ASINL = @HAVE_DECL_ASINL@ HAVE_DECL_ATANL = @HAVE_DECL_ATANL@ -HAVE_DECL_CEILL = @HAVE_DECL_CEILL@ HAVE_DECL_COSL = @HAVE_DECL_COSL@ +HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@ HAVE_DECL_EXPL = @HAVE_DECL_EXPL@ -HAVE_DECL_FLOORL = @HAVE_DECL_FLOORL@ HAVE_DECL_FREXPL = @HAVE_DECL_FREXPL@ +HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@ +HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@ HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ HAVE_DECL_LDEXPL = @HAVE_DECL_LDEXPL@ HAVE_DECL_LOGL = @HAVE_DECL_LOGL@ +HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@ +HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@ HAVE_DECL_MKDIR = @HAVE_DECL_MKDIR@ HAVE_DECL_SINL = @HAVE_DECL_SINL@ HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@ HAVE_DECL_SQRTL = @HAVE_DECL_SQRTL@ +HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@ +HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@ +HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@ +HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@ +HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@ +HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@ HAVE_DECL_TANL = @HAVE_DECL_TANL@ +HAVE_DECL_TRUNC = @HAVE_DECL_TRUNC@ +HAVE_DECL_TRUNCF = @HAVE_DECL_TRUNCF@ +HAVE_DECL_TRUNCL = @HAVE_DECL_TRUNCL@ HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@ HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@ HAVE_DUP2 = @HAVE_DUP2@ HAVE_FSEEKO = @HAVE_FSEEKO@ HAVE_FTELLO = @HAVE_FTELLO@ HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ +HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@ HAVE_GETSUBOPT = @HAVE_GETSUBOPT@ HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ HAVE_IO_H = @HAVE_IO_H@ HAVE_ISWCNTRL = @HAVE_ISWCNTRL@ HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ HAVE_LSTAT = @HAVE_LSTAT@ +HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@ +HAVE_MEMPCPY = @HAVE_MEMPCPY@ HAVE_MKDTEMP = @HAVE_MKDTEMP@ +HAVE_OS_H = @HAVE_OS_H@ HAVE_POSIX_SIGNALBLOCKING = @HAVE_POSIX_SIGNALBLOCKING@ HAVE_READLINK = @HAVE_READLINK@ +HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@ +HAVE_SETENV = @HAVE_SETENV@ HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@ HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@ HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@ HAVE_SIGSET_T = @HAVE_SIGSET_T@ HAVE_SLEEP = @HAVE_SLEEP@ HAVE_STDINT_H = @HAVE_STDINT_H@ +HAVE_STPCPY = @HAVE_STPCPY@ +HAVE_STPNCPY = @HAVE_STPNCPY@ +HAVE_STRCASESTR = @HAVE_STRCASESTR@ +HAVE_STRCHRNUL = @HAVE_STRCHRNUL@ +HAVE_STRNDUP = @HAVE_STRNDUP@ +HAVE_STRPBRK = @HAVE_STRPBRK@ +HAVE_STRSEP = @HAVE_STRSEP@ +HAVE_STRTOD = @HAVE_STRTOD@ HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@ HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@ HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@ +HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ HAVE_UNISTD_H = @HAVE_UNISTD_H@ +HAVE_UNSETENV = @HAVE_UNSETENV@ HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@ HAVE_VASPRINTF = @HAVE_VASPRINTF@ HAVE_WCHAR_H = @HAVE_WCHAR_H@ @@ -256,19 +343,25 @@ LIBINTL = @LIBINTL@ LIBM4_LIBDEPS = @LIBM4_LIBDEPS@ LIBM4_LTLIBDEPS = @LIBM4_LTLIBDEPS@ LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ +LIBS = @LIBS@ $(POW_LIB) +LIBTESTS_LIBDEPS = @LIBTESTS_LIBDEPS@ +LOCALCHARSET_TESTS_ENVIRONMENT = @LOCALCHARSET_TESTS_ENVIRONMENT@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ M4_LIBOBJS = @M4_LIBOBJS@ M4_LTLIBOBJS = @M4_LTLIBOBJS@ +M4tests_LIBOBJS = @M4tests_LIBOBJS@ +M4tests_LTLIBOBJS = @M4tests_LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ NEXT_FLOAT_H = @NEXT_FLOAT_H@ NEXT_MATH_H = @NEXT_MATH_H@ NEXT_SIGNAL_H = @NEXT_SIGNAL_H@ +NEXT_STDARG_H = @NEXT_STDARG_H@ NEXT_STDINT_H = @NEXT_STDINT_H@ NEXT_STDIO_H = @NEXT_STDIO_H@ NEXT_STDLIB_H = @NEXT_STDLIB_H@ +NEXT_STRING_H = @NEXT_STRING_H@ NEXT_SYS_STAT_H = @NEXT_SYS_STAT_H@ NEXT_SYS_TIME_H = @NEXT_SYS_TIME_H@ NEXT_UNISTD_H = @NEXT_UNISTD_H@ @@ -282,12 +375,19 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +POW_LIB = @POW_LIB@ PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@ RANLIB = @RANLIB@ +REPLACE_CEILF = @REPLACE_CEILF@ +REPLACE_CEILL = @REPLACE_CEILL@ REPLACE_CHOWN = @REPLACE_CHOWN@ REPLACE_FCHDIR = @REPLACE_FCHDIR@ REPLACE_FFLUSH = @REPLACE_FFLUSH@ +REPLACE_FLOORF = @REPLACE_FLOORF@ +REPLACE_FLOORL = @REPLACE_FLOORL@ +REPLACE_FOPEN = @REPLACE_FOPEN@ REPLACE_FPRINTF = @REPLACE_FPRINTF@ +REPLACE_FREOPEN = @REPLACE_FREOPEN@ REPLACE_FREXP = @REPLACE_FREXP@ REPLACE_FREXPL = @REPLACE_FREXPL@ REPLACE_FSEEK = @REPLACE_FSEEK@ @@ -295,15 +395,29 @@ REPLACE_FSEEKO = @REPLACE_FSEEKO@ REPLACE_FTELL = @REPLACE_FTELL@ REPLACE_FTELLO = @REPLACE_FTELLO@ REPLACE_GETCWD = @REPLACE_GETCWD@ +REPLACE_GETLINE = @REPLACE_GETLINE@ +REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@ REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@ +REPLACE_ISFINITE = @REPLACE_ISFINITE@ REPLACE_LCHOWN = @REPLACE_LCHOWN@ REPLACE_LDEXPL = @REPLACE_LDEXPL@ REPLACE_LSEEK = @REPLACE_LSEEK@ +REPLACE_MEMMEM = @REPLACE_MEMMEM@ REPLACE_MKSTEMP = @REPLACE_MKSTEMP@ REPLACE_PRINTF = @REPLACE_PRINTF@ +REPLACE_PUTENV = @REPLACE_PUTENV@ +REPLACE_ROUND = @REPLACE_ROUND@ +REPLACE_ROUNDF = @REPLACE_ROUNDF@ +REPLACE_ROUNDL = @REPLACE_ROUNDL@ REPLACE_SIGNBIT = @REPLACE_SIGNBIT@ +REPLACE_SIGNBIT_USING_GCC = @REPLACE_SIGNBIT_USING_GCC@ REPLACE_SNPRINTF = @REPLACE_SNPRINTF@ REPLACE_SPRINTF = @REPLACE_SPRINTF@ +REPLACE_STRCASESTR = @REPLACE_STRCASESTR@ +REPLACE_STRERROR = @REPLACE_STRERROR@ +REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@ +REPLACE_STRSTR = @REPLACE_STRSTR@ +REPLACE_STRTOD = @REPLACE_STRTOD@ REPLACE_VASPRINTF = @REPLACE_VASPRINTF@ REPLACE_VFPRINTF = @REPLACE_VFPRINTF@ REPLACE_VPRINTF = @REPLACE_VPRINTF@ @@ -314,12 +428,14 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@ SIZE_T_SUFFIX = @SIZE_T_SUFFIX@ +STDARG_H = @STDARG_H@ STDBOOL_H = @STDBOOL_H@ STDINT_H = @STDINT_H@ STRIP = @STRIP@ SYS_STAT_H = @SYS_STAT_H@ SYS_TIME_H = @SYS_TIME_H@ VERSION = @VERSION@ +VOID_UNSETENV = @VOID_UNSETENV@ WCHAR_H = @WCHAR_H@ WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ WCTYPE_H = @WCTYPE_H@ @@ -377,74 +493,76 @@ AUTOMAKE_OPTIONS = 1.5 gnits noinst_HEADERS = noinst_LIBRARIES = libm4.a noinst_LTLIBRARIES = -EXTRA_DIST = alloca.c alloca_.h cloexec.c cloexec.h close-stream.c \ - close-stream.h closein.c closein.h closeout.c closeout.h \ - error.c error.h exitfail.c exitfail.h fflush.c float_.h \ - fopen-safer.c stdio--.h stdio-safer.h __fpending.c \ - __fpending.h fpucw.h fpurge.h freading.h free.c frexp.c \ - frexpl.c fseeko.c ftello.c getopt.c getopt1.c getopt_.h \ - getopt_int.h gettimeofday.c intprops.h float+.h isnan.c \ - isnan.h float+.h isnan.c isnanf.c isnanf.h float+.h isnan.c \ - isnanl-nolibm.h isnanl.c config.charset ref-add.sin \ - ref-del.sin lseek.c malloc.c malloca.h malloca.valgrind \ - math_.h mkdtemp.c mkstemp.c obstack.c obstack.h pathmax.h \ - printf-frexp.h printf-frexp.c printf-frexpl.h quotearg.c \ - quotearg.h regcomp.c regex.c regex.h regex_internal.c \ - regex_internal.h regexec.c signal_.h float+.h signbitd.c \ - signbitf.c signbitl.c sigprocmask.c stdbool_.h stdint_.h \ - stdio_.h stdlib_.h mkstemp-safer.c stdlib--.h stdlib-safer.h \ - strtol.c sys_stat_.h sys_time_.h tempname.c tempname.h \ - unistd_.h dup-safer.c fd-safer.c pipe-safer.c unistd--.h \ +EXTRA_DIST = alloca.c alloca.in.h $(top_srcdir)/build-aux/announce-gen \ + cloexec.c cloexec.h close-stream.c close-stream.h closein.c \ + closein.h closeout.c closeout.h error.c error.h exitfail.c \ + exitfail.h fflush.c float.in.h fopen-safer.c stdio--.h \ + stdio-safer.h fpending.c fpending.h fpucw.h fpurge.h \ + freadahead.h freading.h frexp.c frexp.c frexpl.c fseeko.c \ + ftello.c $(top_srcdir)/build-aux/gendocs.sh getopt.c \ + getopt.in.h getopt1.c getopt_int.h gettimeofday.c \ + $(top_srcdir)/build-aux/git-version-gen \ + $(top_srcdir)/GNUmakefile $(top_srcdir)/build-aux/gnupload \ + intprops.h float+.h isnan.c isnand.c isnand.h float+.h isnan.c \ + isnanf.c isnanf.h float+.h isnan.c isnanl-nolibm.h isnanl.c \ + $(top_srcdir)/build-aux/link-warning.h config.charset \ + ref-add.sin ref-del.sin lseek.c malloc.c malloc.c malloca.h \ + malloca.valgrind math.in.h memchr.c memcmp.c mkdtemp.c \ + mkstemp.c obstack.c obstack.h pathmax.h printf-frexp.h \ + printf-frexp.c printf-frexpl.h quotearg.c quotearg.h regcomp.c \ + regex.c regex.h regex_internal.c regex_internal.h regexec.c \ + signal.in.h float+.h signbitd.c signbitf.c signbitl.c \ + sigprocmask.c stdarg.in.h stdbool.in.h stdint.in.h stdio.in.h \ + stdlib.in.h mkstemp-safer.c stdlib--.h stdlib-safer.h \ + strerror.c string.in.h str-two-way.h strstr.c strtod.c \ + strtol.c sys_stat.in.h sys_time.in.h tempname.c tempname.h \ + unistd.in.h dup-safer.c fd-safer.c pipe-safer.c unistd--.h \ unistd-safer.h unlocked-io.h asnprintf.c float+.h \ printf-args.c printf-args.h printf-parse.c printf-parse.h \ - vasnprintf.c vasnprintf.h asprintf.c vasprintf.c wchar_.h \ - wctype_.h xalloc.h xmalloc.c xmalloca.h xalloc.h + vasnprintf.c vasnprintf.h asprintf.c vasprintf.c wchar.in.h \ + wctype.in.h xalloc.h xmalloc.c xmalloca.h xalloc.h BUILT_SOURCES = $(ALLOCA_H) configmake.h $(FLOAT_H) $(GETOPT_H) math.h \ - signal.h $(STDBOOL_H) $(STDINT_H) stdio.h stdlib.h \ - $(SYS_STAT_H) $(SYS_TIME_H) unistd.h $(WCHAR_H) $(WCTYPE_H) + signal.h $(STDARG_H) $(STDBOOL_H) $(STDINT_H) stdio.h stdlib.h \ + string.h $(SYS_STAT_H) $(SYS_TIME_H) unistd.h $(WCHAR_H) \ + $(WCTYPE_H) SUFFIXES = .sed .sin MOSTLYCLEANFILES = core *.stackdump alloca.h alloca.h-t float.h \ float.h-t getopt.h getopt.h-t math.h math.h-t signal.h \ - signal.h-t stdbool.h stdbool.h-t stdint.h stdint.h-t stdio.h \ - stdio.h-t stdlib.h stdlib.h-t sys/stat.h sys/stat.h-t \ - sys/time.h sys/time.h-t unistd.h unistd.h-t wchar.h wchar.h-t \ - wctype.h wctype.h-t + signal.h-t stdarg.h stdarg.h-t stdbool.h stdbool.h-t stdint.h \ + stdint.h-t stdio.h stdio.h-t stdlib.h stdlib.h-t string.h \ + string.h-t sys/stat.h sys/stat.h-t sys/time.h sys/time.h-t \ + unistd.h unistd.h-t wchar.h wchar.h-t wctype.h wctype.h-t MOSTLYCLEANDIRS = sys CLEANFILES = configmake.h configmake.h-t charset.alias ref-add.sed \ ref-del.sed DISTCLEANFILES = MAINTAINERCLEANFILES = AM_CPPFLAGS = -libm4_a_SOURCES = gl_array_list.h gl_array_list.c gl_array_oset.h \ - gl_array_oset.c gl_avltree_oset.h gl_avltree_oset.c \ - gl_anytree_oset.h binary-io.h clean-temp.h clean-temp.c \ - fatal-signal.h fatal-signal.c fpurge.c freading.c gettext.h \ - gl_linkedhash_list.h gl_linkedhash_list.c gl_anyhash_list1.h \ - gl_anyhash_list2.h gl_anylinked_list1.h gl_anylinked_list2.h \ - gl_list.h gl_list.c localcharset.h localcharset.c malloca.c \ - gl_oset.h gl_oset.c printf-frexp.c printf-frexpl.c progname.h \ - progname.c size_max.h tmpdir.h tmpdir.c verify.h verror.h \ - verror.c version-etc.h version-etc.c version-etc-fsf.c \ - xalloc-die.c xmalloca.c xsize.h xvasprintf.h xvasprintf.c \ - xasprintf.c +libm4_a_SOURCES = gl_avltree_oset.h gl_avltree_oset.c \ + gl_anytree_oset.h binary-io.h c-ctype.h c-ctype.c clean-temp.h \ + clean-temp.c fatal-signal.h fatal-signal.c fpurge.c \ + freadahead.c freading.c gettext.h gl_linkedhash_list.h \ + gl_linkedhash_list.c gl_anyhash_list1.h gl_anyhash_list2.h \ + gl_anylinked_list1.h gl_anylinked_list2.h gl_list.h gl_list.c \ + localcharset.h localcharset.c malloca.c gl_oset.h gl_oset.c \ + printf-frexp.c printf-frexpl.c size_max.h tmpdir.h tmpdir.c \ + verror.h verror.c version-etc.h version-etc.c \ + version-etc-fsf.c xalloc-die.c xmalloca.c xprintf.h xprintf.c \ + xsize.h xvasprintf.h xvasprintf.c xasprintf.c libm4_a_LIBADD = $(M4_LIBOBJS) @ALLOCA@ libm4_a_DEPENDENCIES = $(M4_LIBOBJS) @ALLOCA@ EXTRA_libm4_a_SOURCES = alloca.c cloexec.c close-stream.c closein.c \ closeout.c error.c exitfail.c fflush.c fopen-safer.c \ - __fpending.c free.c frexp.c frexpl.c fseeko.c ftello.c \ - getopt.c getopt1.c gettimeofday.c isnan.c isnan.c isnanf.c \ - isnan.c isnanl.c lseek.c malloc.c mkdtemp.c mkstemp.c \ - obstack.c printf-frexp.c quotearg.c regcomp.c regex.c \ - regex_internal.c regexec.c signbitd.c signbitf.c signbitl.c \ - sigprocmask.c mkstemp-safer.c strtol.c tempname.c dup-safer.c \ - fd-safer.c pipe-safer.c asnprintf.c printf-args.c \ - printf-parse.c vasnprintf.c asprintf.c vasprintf.c xmalloc.c - -# Use this preprocessor expression to decide whether #include_next works. -# Do not rely on a 'configure'-time test for this, since the expression -# might appear in an installed header, which is used by some other compiler. -HAVE_INCLUDE_NEXT = (__GNUC__ || 60000000 <= __DECC_VER) -LINK_WARNING_H = $(top_srcdir)/./link-warning.h + fpending.c frexp.c frexp.c frexpl.c fseeko.c ftello.c getopt.c \ + getopt1.c gettimeofday.c isnan.c isnand.c isnan.c isnanf.c \ + isnan.c isnanl.c lseek.c malloc.c malloc.c memchr.c memcmp.c \ + mkdtemp.c mkstemp.c obstack.c printf-frexp.c quotearg.c \ + regcomp.c regex.c regex_internal.c regexec.c signbitd.c \ + signbitf.c signbitl.c sigprocmask.c mkstemp-safer.c strerror.c \ + strstr.c strtod.c strtol.c tempname.c dup-safer.c fd-safer.c \ + pipe-safer.c asnprintf.c printf-args.c printf-parse.c \ + vasnprintf.c asprintf.c vasprintf.c xmalloc.c +LINK_WARNING_H = $(top_srcdir)/build-aux/link-warning.h charset_alias = $(DESTDIR)$(libdir)/charset.alias charset_tmp = $(DESTDIR)$(libdir)/charset.tmp all: $(BUILT_SOURCES) config.h @@ -522,10 +640,10 @@ distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/alloca.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/__fpending.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alloca.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asnprintf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asprintf.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c-ctype.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/clean-temp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cloexec.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/close-stream.Po@am__quote@ @@ -538,9 +656,10 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fd-safer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fflush.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fopen-safer.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fpending.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fpurge.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/freadahead.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/freading.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/free.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frexp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frexpl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fseeko.Po@am__quote@ @@ -548,19 +667,20 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt1.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gettimeofday.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gl_array_list.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gl_array_oset.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gl_avltree_oset.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gl_linkedhash_list.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gl_list.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gl_oset.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isnan.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isnand.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isnanf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isnanl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/localcharset.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lseek.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/malloc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/malloca.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memchr.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memcmp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mkdtemp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mkstemp-safer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mkstemp.Po@am__quote@ @@ -570,7 +690,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/printf-frexp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/printf-frexpl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/printf-parse.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/progname.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/quotearg.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regcomp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regex.Po@am__quote@ @@ -580,6 +699,9 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/signbitf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/signbitl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sigprocmask.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strerror.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strstr.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strtod.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strtol.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tempname.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tmpdir.Po@am__quote@ @@ -592,6 +714,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xasprintf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmalloc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmalloca.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xprintf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xvasprintf.Po@am__quote@ .c.o: @@ -613,8 +736,8 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS @@ -626,8 +749,8 @@ TAGS: $(HEADERS) $(SOURCES) config.hin unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ @@ -637,13 +760,12 @@ ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) config.hin $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ - here=`pwd`; \ list='$(SOURCES) $(HEADERS) config.hin $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique @@ -727,7 +849,7 @@ distclean: distclean-am -rm -rf $(DEPDIR) ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ - distclean-hdr distclean-tags + distclean-hdr distclean-local distclean-tags dvi: dvi-am @@ -782,23 +904,23 @@ uninstall-am: uninstall-local .PHONY: CTAGS GTAGS all all-am all-local check check-am clean \ clean-generic clean-noinstLIBRARIES clean-noinstLTLIBRARIES \ ctags distclean distclean-compile distclean-generic \ - distclean-hdr distclean-tags distdir dvi dvi-am html html-am \ - info info-am install install-am install-data install-data-am \ - install-dvi install-dvi-am install-exec install-exec-am \ - install-exec-local install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-local pdf pdf-am ps ps-am tags \ - uninstall uninstall-am uninstall-local + distclean-hdr distclean-local distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-exec-local install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-local pdf \ + pdf-am ps ps-am tags uninstall uninstall-am uninstall-local # We need the following in order to create <alloca.h> when the system # doesn't have one that works with the given compiler. -alloca.h: alloca_.h +alloca.h: alloca.in.h { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - cat $(srcdir)/alloca_.h; \ + cat $(srcdir)/alloca.in.h; \ } > $@-t mv -f $@-t $@ @@ -854,23 +976,27 @@ configmake.h: Makefile # We need the following in order to create <float.h> when the system # doesn't have one that works with the given compiler. -float.h: float_.h +float.h: float.in.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ -e 's|@''NEXT_FLOAT_H''@|$(NEXT_FLOAT_H)|g' \ - < $(srcdir)/float_.h; \ + < $(srcdir)/float.in.h; \ } > $@-t mv $@-t $@ # We need the following in order to create <getopt.h> when the system # doesn't have one that works with the given compiler. -getopt.h: getopt_.h +getopt.h: getopt.in.h { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - cat $(srcdir)/getopt_.h; \ + cat $(srcdir)/getopt.in.h; \ } > $@-t mv -f $@-t $@ +distclean-local: clean-GNUmakefile +clean-GNUmakefile: + test x'$(VPATH)' != x && rm -f $(top_builddir)/GNUmakefile || : + # We need the following in order to install a simple file in $(libdir) # which is shared with other installed packages. We use a list of referencing # packages so that "make uninstall" will remove the file if and only if it @@ -916,41 +1042,62 @@ charset.alias: config.charset # We need the following in order to create <math.h> when the system # doesn't have one that works with the given compiler. -math.h: math_.h +math.h: math.in.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ -e 's|@''NEXT_MATH_H''@|$(NEXT_MATH_H)|g' \ + -e 's|@''GNULIB_CEILF''@|$(GNULIB_CEILF)|g' \ + -e 's|@''GNULIB_CEILL''@|$(GNULIB_CEILL)|g' \ + -e 's|@''GNULIB_FLOORF''@|$(GNULIB_FLOORF)|g' \ + -e 's|@''GNULIB_FLOORL''@|$(GNULIB_FLOORL)|g' \ -e 's|@''GNULIB_FREXP''@|$(GNULIB_FREXP)|g' \ -e 's|@''GNULIB_FREXPL''@|$(GNULIB_FREXPL)|g' \ + -e 's|@''GNULIB_ISFINITE''@|$(GNULIB_ISFINITE)|g' \ -e 's|@''GNULIB_LDEXPL''@|$(GNULIB_LDEXPL)|g' \ -e 's|@''GNULIB_MATHL''@|$(GNULIB_MATHL)|g' \ + -e 's|@''GNULIB_ROUND''@|$(GNULIB_ROUND)|g' \ + -e 's|@''GNULIB_ROUNDF''@|$(GNULIB_ROUNDF)|g' \ + -e 's|@''GNULIB_ROUNDL''@|$(GNULIB_ROUNDL)|g' \ -e 's|@''GNULIB_SIGNBIT''@|$(GNULIB_SIGNBIT)|g' \ + -e 's|@''GNULIB_TRUNC''@|$(GNULIB_TRUNC)|g' \ + -e 's|@''GNULIB_TRUNCF''@|$(GNULIB_TRUNCF)|g' \ + -e 's|@''GNULIB_TRUNCL''@|$(GNULIB_TRUNCL)|g' \ -e 's|@''HAVE_DECL_ACOSL''@|$(HAVE_DECL_ACOSL)|g' \ -e 's|@''HAVE_DECL_ASINL''@|$(HAVE_DECL_ASINL)|g' \ -e 's|@''HAVE_DECL_ATANL''@|$(HAVE_DECL_ATANL)|g' \ - -e 's|@''HAVE_DECL_CEILL''@|$(HAVE_DECL_CEILL)|g' \ -e 's|@''HAVE_DECL_COSL''@|$(HAVE_DECL_COSL)|g' \ -e 's|@''HAVE_DECL_EXPL''@|$(HAVE_DECL_EXPL)|g' \ - -e 's|@''HAVE_DECL_FLOORL''@|$(HAVE_DECL_FLOORL)|g' \ -e 's|@''HAVE_DECL_FREXPL''@|$(HAVE_DECL_FREXPL)|g' \ -e 's|@''HAVE_DECL_LDEXPL''@|$(HAVE_DECL_LDEXPL)|g' \ -e 's|@''HAVE_DECL_LOGL''@|$(HAVE_DECL_LOGL)|g' \ -e 's|@''HAVE_DECL_SINL''@|$(HAVE_DECL_SINL)|g' \ -e 's|@''HAVE_DECL_SQRTL''@|$(HAVE_DECL_SQRTL)|g' \ -e 's|@''HAVE_DECL_TANL''@|$(HAVE_DECL_TANL)|g' \ + -e 's|@''HAVE_DECL_TRUNC''@|$(HAVE_DECL_TRUNC)|g' \ + -e 's|@''HAVE_DECL_TRUNCF''@|$(HAVE_DECL_TRUNCF)|g' \ + -e 's|@''HAVE_DECL_TRUNCL''@|$(HAVE_DECL_TRUNCL)|g' \ + -e 's|@''REPLACE_CEILF''@|$(REPLACE_CEILF)|g' \ + -e 's|@''REPLACE_CEILL''@|$(REPLACE_CEILL)|g' \ + -e 's|@''REPLACE_FLOORF''@|$(REPLACE_FLOORF)|g' \ + -e 's|@''REPLACE_FLOORL''@|$(REPLACE_FLOORL)|g' \ -e 's|@''REPLACE_FREXP''@|$(REPLACE_FREXP)|g' \ -e 's|@''REPLACE_FREXPL''@|$(REPLACE_FREXPL)|g' \ + -e 's|@''REPLACE_ISFINITE''@|$(REPLACE_ISFINITE)|g' \ -e 's|@''REPLACE_LDEXPL''@|$(REPLACE_LDEXPL)|g' \ + -e 's|@''REPLACE_ROUND''@|$(REPLACE_ROUND)|g' \ + -e 's|@''REPLACE_ROUNDF''@|$(REPLACE_ROUNDF)|g' \ + -e 's|@''REPLACE_ROUNDL''@|$(REPLACE_ROUNDL)|g' \ -e 's|@''REPLACE_SIGNBIT''@|$(REPLACE_SIGNBIT)|g' \ + -e 's|@''REPLACE_SIGNBIT_USING_GCC''@|$(REPLACE_SIGNBIT_USING_GCC)|g' \ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ - < $(srcdir)/math_.h; \ + < $(srcdir)/math.in.h; \ } > $@-t mv $@-t $@ # We need the following in order to create <signal.h> when the system # doesn't have a complete one. -signal.h: signal_.h +signal.h: signal.in.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ @@ -959,22 +1106,33 @@ signal.h: signal_.h -e 's|@''HAVE_POSIX_SIGNALBLOCKING''@|$(HAVE_POSIX_SIGNALBLOCKING)|g' \ -e 's|@''HAVE_SIGSET_T''@|$(HAVE_SIGSET_T)|g' \ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ - < $(srcdir)/signal_.h; \ + < $(srcdir)/signal.in.h; \ + } > $@-t + mv $@-t $@ + +# We need the following in order to create <stdarg.h> when the system +# doesn't have one that works with the given compiler. +stdarg.h: stdarg.in.h + rm -f $@-t $@ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ + sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ + -e 's|@''NEXT_STDARG_H''@|$(NEXT_STDARG_H)|g' \ + < $(srcdir)/stdarg.in.h; \ } > $@-t mv $@-t $@ # We need the following in order to create <stdbool.h> when the system # doesn't have one that works. -stdbool.h: stdbool_.h +stdbool.h: stdbool.in.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool_.h; \ + sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool.in.h; \ } > $@-t mv $@-t $@ # We need the following in order to create <stdint.h> when the system # doesn't have one that works with the given compiler. -stdint.h: stdint_.h +stdint.h: stdint.in.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \ @@ -999,13 +1157,13 @@ stdint.h: stdint_.h -e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \ -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \ -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \ - < $(srcdir)/stdint_.h; \ + < $(srcdir)/stdint.in.h; \ } > $@-t mv $@-t $@ # We need the following in order to create <stdio.h> when the system # doesn't have one that works with the given compiler. -stdio.h: stdio_.h +stdio.h: stdio.in.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ @@ -1019,11 +1177,15 @@ stdio.h: stdio_.h -e 's|@''GNULIB_VSNPRINTF''@|$(GNULIB_VSNPRINTF)|g' \ -e 's|@''GNULIB_VSPRINTF_POSIX''@|$(GNULIB_VSPRINTF_POSIX)|g' \ -e 's|@''GNULIB_VASPRINTF''@|$(GNULIB_VASPRINTF)|g' \ + -e 's|@''GNULIB_FOPEN''@|$(GNULIB_FOPEN)|g' \ + -e 's|@''GNULIB_FREOPEN''@|$(GNULIB_FREOPEN)|g' \ -e 's|@''GNULIB_FSEEK''@|$(GNULIB_FSEEK)|g' \ -e 's|@''GNULIB_FSEEKO''@|$(GNULIB_FSEEKO)|g' \ -e 's|@''GNULIB_FTELL''@|$(GNULIB_FTELL)|g' \ -e 's|@''GNULIB_FTELLO''@|$(GNULIB_FTELLO)|g' \ -e 's|@''GNULIB_FFLUSH''@|$(GNULIB_FFLUSH)|g' \ + -e 's|@''GNULIB_GETDELIM''@|$(GNULIB_GETDELIM)|g' \ + -e 's|@''GNULIB_GETLINE''@|$(GNULIB_GETLINE)|g' \ -e 's|@''REPLACE_FPRINTF''@|$(REPLACE_FPRINTF)|g' \ -e 's|@''REPLACE_VFPRINTF''@|$(REPLACE_VFPRINTF)|g' \ -e 's|@''REPLACE_PRINTF''@|$(REPLACE_PRINTF)|g' \ @@ -1036,37 +1198,121 @@ stdio.h: stdio_.h -e 's|@''REPLACE_VSPRINTF''@|$(REPLACE_VSPRINTF)|g' \ -e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \ -e 's|@''REPLACE_VASPRINTF''@|$(REPLACE_VASPRINTF)|g' \ + -e 's|@''REPLACE_FOPEN''@|$(REPLACE_FOPEN)|g' \ + -e 's|@''REPLACE_FREOPEN''@|$(REPLACE_FREOPEN)|g' \ -e 's|@''REPLACE_FSEEKO''@|$(REPLACE_FSEEKO)|g' \ -e 's|@''REPLACE_FSEEK''@|$(REPLACE_FSEEK)|g' \ -e 's|@''REPLACE_FTELLO''@|$(REPLACE_FTELLO)|g' \ -e 's|@''REPLACE_FTELL''@|$(REPLACE_FTELL)|g' \ -e 's|@''REPLACE_FFLUSH''@|$(REPLACE_FFLUSH)|g' \ + -e 's|@''HAVE_DECL_GETDELIM''@|$(HAVE_DECL_GETDELIM)|g' \ + -e 's|@''HAVE_DECL_GETLINE''@|$(HAVE_DECL_GETLINE)|g' \ + -e 's|@''REPLACE_GETLINE''@|$(REPLACE_GETLINE)|g' \ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ - < $(srcdir)/stdio_.h; \ + < $(srcdir)/stdio.in.h; \ } > $@-t mv $@-t $@ # We need the following in order to create <stdlib.h> when the system # doesn't have one that works with the given compiler. -stdlib.h: stdlib_.h +stdlib.h: stdlib.in.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ -e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \ + -e 's|@''GNULIB_MALLOC_POSIX''@|$(GNULIB_MALLOC_POSIX)|g' \ + -e 's|@''GNULIB_REALLOC_POSIX''@|$(GNULIB_REALLOC_POSIX)|g' \ + -e 's|@''GNULIB_CALLOC_POSIX''@|$(GNULIB_CALLOC_POSIX)|g' \ -e 's|@''GNULIB_GETSUBOPT''@|$(GNULIB_GETSUBOPT)|g' \ -e 's|@''GNULIB_MKDTEMP''@|$(GNULIB_MKDTEMP)|g' \ -e 's|@''GNULIB_MKSTEMP''@|$(GNULIB_MKSTEMP)|g' \ + -e 's|@''GNULIB_PUTENV''@|$(GNULIB_PUTENV)|g' \ + -e 's|@''GNULIB_SETENV''@|$(GNULIB_SETENV)|g' \ + -e 's|@''GNULIB_STRTOD''@|$(GNULIB_STRTOD)|g' \ + -e 's|@''GNULIB_UNSETENV''@|$(GNULIB_UNSETENV)|g' \ + -e 's|@''HAVE_CALLOC_POSIX''@|$(HAVE_CALLOC_POSIX)|g' \ -e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \ + -e 's|@''HAVE_MALLOC_POSIX''@|$(HAVE_MALLOC_POSIX)|g' \ -e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \ + -e 's|@''HAVE_REALLOC_POSIX''@|$(HAVE_REALLOC_POSIX)|g' \ + -e 's|@''HAVE_SETENV''@|$(HAVE_SETENV)|g' \ + -e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \ + -e 's|@''HAVE_UNSETENV''@|$(HAVE_UNSETENV)|g' \ -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \ + -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \ + -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \ + -e 's|@''VOID_UNSETENV''@|$(VOID_UNSETENV)|g' \ + -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ + < $(srcdir)/stdlib.in.h; \ + } > $@-t + mv $@-t $@ + +# We need the following in order to create <string.h> when the system +# doesn't have one that works with the given compiler. +string.h: string.in.h + rm -f $@-t $@ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ + sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ + -e 's|@''NEXT_STRING_H''@|$(NEXT_STRING_H)|g' \ + -e 's|@''GNULIB_MBSLEN''@|$(GNULIB_MBSLEN)|g' \ + -e 's|@''GNULIB_MBSNLEN''@|$(GNULIB_MBSNLEN)|g' \ + -e 's|@''GNULIB_MBSCHR''@|$(GNULIB_MBSCHR)|g' \ + -e 's|@''GNULIB_MBSRCHR''@|$(GNULIB_MBSRCHR)|g' \ + -e 's|@''GNULIB_MBSSTR''@|$(GNULIB_MBSSTR)|g' \ + -e 's|@''GNULIB_MBSCASECMP''@|$(GNULIB_MBSCASECMP)|g' \ + -e 's|@''GNULIB_MBSNCASECMP''@|$(GNULIB_MBSNCASECMP)|g' \ + -e 's|@''GNULIB_MBSPCASECMP''@|$(GNULIB_MBSPCASECMP)|g' \ + -e 's|@''GNULIB_MBSCASESTR''@|$(GNULIB_MBSCASESTR)|g' \ + -e 's|@''GNULIB_MBSCSPN''@|$(GNULIB_MBSCSPN)|g' \ + -e 's|@''GNULIB_MBSPBRK''@|$(GNULIB_MBSPBRK)|g' \ + -e 's|@''GNULIB_MBSSPN''@|$(GNULIB_MBSSPN)|g' \ + -e 's|@''GNULIB_MBSSEP''@|$(GNULIB_MBSSEP)|g' \ + -e 's|@''GNULIB_MBSTOK_R''@|$(GNULIB_MBSTOK_R)|g' \ + -e 's|@''GNULIB_MEMMEM''@|$(GNULIB_MEMMEM)|g' \ + -e 's|@''GNULIB_MEMPCPY''@|$(GNULIB_MEMPCPY)|g' \ + -e 's|@''GNULIB_MEMRCHR''@|$(GNULIB_MEMRCHR)|g' \ + -e 's|@''GNULIB_STPCPY''@|$(GNULIB_STPCPY)|g' \ + -e 's|@''GNULIB_STPNCPY''@|$(GNULIB_STPNCPY)|g' \ + -e 's|@''GNULIB_STRCHRNUL''@|$(GNULIB_STRCHRNUL)|g' \ + -e 's|@''GNULIB_STRDUP''@|$(GNULIB_STRDUP)|g' \ + -e 's|@''GNULIB_STRNDUP''@|$(GNULIB_STRNDUP)|g' \ + -e 's|@''GNULIB_STRNLEN''@|$(GNULIB_STRNLEN)|g' \ + -e 's|@''GNULIB_STRPBRK''@|$(GNULIB_STRPBRK)|g' \ + -e 's|@''GNULIB_STRSEP''@|$(GNULIB_STRSEP)|g' \ + -e 's|@''GNULIB_STRSTR''@|$(GNULIB_STRSTR)|g' \ + -e 's|@''GNULIB_STRCASESTR''@|$(GNULIB_STRCASESTR)|g' \ + -e 's|@''GNULIB_STRTOK_R''@|$(GNULIB_STRTOK_R)|g' \ + -e 's|@''GNULIB_STRERROR''@|$(GNULIB_STRERROR)|g' \ + -e 's|@''GNULIB_STRSIGNAL''@|$(GNULIB_STRSIGNAL)|g' \ + -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \ + -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \ + -e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \ + -e 's|@''HAVE_STPCPY''@|$(HAVE_STPCPY)|g' \ + -e 's|@''HAVE_STPNCPY''@|$(HAVE_STPNCPY)|g' \ + -e 's|@''HAVE_STRCHRNUL''@|$(HAVE_STRCHRNUL)|g' \ + -e 's|@''HAVE_DECL_STRDUP''@|$(HAVE_DECL_STRDUP)|g' \ + -e 's|@''HAVE_STRNDUP''@|$(HAVE_STRNDUP)|g' \ + -e 's|@''HAVE_DECL_STRNDUP''@|$(HAVE_DECL_STRNDUP)|g' \ + -e 's|@''HAVE_DECL_STRNLEN''@|$(HAVE_DECL_STRNLEN)|g' \ + -e 's|@''HAVE_STRPBRK''@|$(HAVE_STRPBRK)|g' \ + -e 's|@''HAVE_STRSEP''@|$(HAVE_STRSEP)|g' \ + -e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \ + -e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \ + -e 's|@''HAVE_DECL_STRERROR''@|$(HAVE_DECL_STRERROR)|g' \ + -e 's|@''HAVE_DECL_STRSIGNAL''@|$(HAVE_DECL_STRSIGNAL)|g' \ + -e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \ + -e 's|@''REPLACE_STRCASESTR''@|$(REPLACE_STRCASESTR)|g' \ + -e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \ + -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \ + -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ - < $(srcdir)/stdlib_.h; \ + < $(srcdir)/string.in.h; \ } > $@-t mv $@-t $@ # We need the following in order to create <sys/stat.h> when the system # has one that is incomplete. -sys/stat.h: sys_stat_.h +sys/stat.h: sys_stat.in.h @MKDIR_P@ sys rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ @@ -1075,13 +1321,13 @@ sys/stat.h: sys_stat_.h -e 's|@''HAVE_IO_H''@|$(HAVE_IO_H)|g' \ -e 's|@''HAVE_LSTAT''@|$(HAVE_LSTAT)|g' \ -e 's|@''HAVE_DECL_MKDIR''@|$(HAVE_DECL_MKDIR)|g' \ - < $(srcdir)/sys_stat_.h; \ + < $(srcdir)/sys_stat.in.h; \ } > $@-t mv $@-t $@ # We need the following in order to create <sys/time.h> when the system # doesn't have one that works with the given compiler. -sys/time.h: sys_time_.h +sys/time.h: sys_time.in.h @MKDIR_P@ sys rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ @@ -1090,13 +1336,13 @@ sys/time.h: sys_time_.h -e 's|@''NEXT_SYS_TIME_H''@|$(NEXT_SYS_TIME_H)|g' \ -e 's/@''REPLACE_GETTIMEOFDAY''@/$(REPLACE_GETTIMEOFDAY)/g' \ -e 's/@''HAVE_STRUCT_TIMEVAL''@/$(HAVE_STRUCT_TIMEVAL)/g' \ - < $(srcdir)/sys_time_.h; \ + < $(srcdir)/sys_time.in.h; \ } > $@-t mv $@-t $@ # We need the following in order to create an empty placeholder for # <unistd.h> when the system doesn't have one. -unistd.h: unistd_.h +unistd.h: unistd.in.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \ @@ -1104,31 +1350,38 @@ unistd.h: unistd_.h -e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \ -e 's|@''GNULIB_CHOWN''@|$(GNULIB_CHOWN)|g' \ -e 's|@''GNULIB_DUP2''@|$(GNULIB_DUP2)|g' \ + -e 's|@''GNULIB_ENVIRON''@|$(GNULIB_ENVIRON)|g' \ -e 's|@''GNULIB_FCHDIR''@|$(GNULIB_FCHDIR)|g' \ -e 's|@''GNULIB_FTRUNCATE''@|$(GNULIB_FTRUNCATE)|g' \ -e 's|@''GNULIB_GETCWD''@|$(GNULIB_GETCWD)|g' \ -e 's|@''GNULIB_GETLOGIN_R''@|$(GNULIB_GETLOGIN_R)|g' \ + -e 's|@''GNULIB_GETPAGESIZE''@|$(GNULIB_GETPAGESIZE)|g' \ -e 's|@''GNULIB_LCHOWN''@|$(GNULIB_LCHOWN)|g' \ -e 's|@''GNULIB_LSEEK''@|$(GNULIB_LSEEK)|g' \ -e 's|@''GNULIB_READLINK''@|$(GNULIB_READLINK)|g' \ -e 's|@''GNULIB_SLEEP''@|$(GNULIB_SLEEP)|g' \ -e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \ -e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \ + -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \ -e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \ -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \ + -e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \ -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \ + -e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \ + -e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \ -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \ -e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \ -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \ + -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \ -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \ -e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \ - < $(srcdir)/unistd_.h; \ + < $(srcdir)/unistd.in.h; \ } > $@-t mv $@-t $@ # We need the following in order to create <wchar.h> when the system # version does not work standalone. -wchar.h: wchar_.h +wchar.h: wchar.in.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ @@ -1138,13 +1391,13 @@ wchar.h: wchar_.h -e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \ -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ - < $(srcdir)/wchar_.h; \ + < $(srcdir)/wchar.in.h; \ } > $@-t mv $@-t $@ # We need the following in order to create <wctype.h> when the system # doesn't have one that works with the given compiler. -wctype.h: wctype_.h +wctype.h: wctype.in.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's/@''HAVE_WCTYPE_H''@/$(HAVE_WCTYPE_H)/g' \ @@ -1152,7 +1405,7 @@ wctype.h: wctype_.h -e 's|@''NEXT_WCTYPE_H''@|$(NEXT_WCTYPE_H)|g' \ -e 's/@''HAVE_ISWCNTRL''@/$(HAVE_ISWCNTRL)/g' \ -e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \ - < $(srcdir)/wctype_.h; \ + < $(srcdir)/wctype.in.h; \ } > $@-t mv $@-t $@ diff -ruNp m4-1.4.10/lib/__fpending.c m4-1.4.11/lib/__fpending.c --- m4-1.4.10/lib/__fpending.c 2007-05-30 19:30:13.000000000 -0600 +++ m4-1.4.11/lib/__fpending.c 1969-12-31 17:00:00.000000000 -0700 @@ -1,30 +0,0 @@ -/* __fpending.c -- return the number of pending output bytes on a stream - Copyright (C) 2000, 2004, 2006 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 2, 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -/* Written by Jim Meyering. */ - -#include <config.h> - -#include "__fpending.h" - -/* Return the number of pending (aka buffered, unflushed) - bytes on the stream, FP, that is open for writing. */ -size_t -__fpending (FILE *fp) -{ - return PENDING_OUTPUT_N_BYTES; -} diff -ruNp m4-1.4.10/lib/__fpending.h m4-1.4.11/lib/__fpending.h --- m4-1.4.10/lib/__fpending.h 2007-05-30 19:30:13.000000000 -0600 +++ m4-1.4.11/lib/__fpending.h 1969-12-31 17:00:00.000000000 -0700 @@ -1,34 +0,0 @@ -/* Declare __fpending. - - Copyright (C) 2000, 2003, 2005, 2006 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 2, 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - Written by Jim Meyering. */ - -#include <stddef.h> -#include <stdio.h> - -#ifndef HAVE_DECL___FPENDING -"this configure-time declaration test was not run" -#endif - -#if HAVE_DECL___FPENDING -# if HAVE_STDIO_EXT_H -# include <stdio_ext.h> -# endif -#else -size_t __fpending (FILE *); -#endif diff -ruNp m4-1.4.10/lib/alloca.c m4-1.4.11/lib/alloca.c --- m4-1.4.10/lib/alloca.c 2007-05-30 19:30:13.000000000 -0600 +++ m4-1.4.11/lib/alloca.c 2007-11-02 12:07:17.000000000 -0600 @@ -486,4 +486,4 @@ i00afunc (long address) # endif /* CRAY */ # endif /* no alloca */ -#endif /* not GCC version 2 */ +#endif /* not GCC version 3 */ diff -ruNp m4-1.4.10/lib/alloca.in.h m4-1.4.11/lib/alloca.in.h --- m4-1.4.10/lib/alloca.in.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/lib/alloca.in.h 2008-03-10 20:11:17.000000000 -0600 @@ -0,0 +1,56 @@ +/* Memory allocation on the stack. + + Copyright (C) 1995, 1999, 2001-2004, 2006-2008 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, 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, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + USA. */ + +/* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H + means there is a real alloca function. */ +#ifndef _GL_ALLOCA_H +#define _GL_ALLOCA_H + +/* alloca (N) returns a pointer to N bytes of memory + allocated on the stack, which will last until the function returns. + Use of alloca should be avoided: + - inside arguments of function calls - undefined behaviour, + - in inline functions - the allocation may actually last until the + calling function returns, + - for huge N (say, N >= 65536) - you never know how large (or small) + the stack is, and when the stack cannot fulfill the memory allocation + request, the program just crashes. + */ + +#ifndef alloca +# ifdef __GNUC__ +# define alloca __builtin_alloca +# elif defined _AIX +# define alloca __alloca +# elif defined _MSC_VER +# include <malloc.h> +# define alloca _alloca +# elif defined __DECC && defined __VMS +# define alloca __ALLOCA +# else +# include <stddef.h> +# ifdef __cplusplus +extern "C" +# endif +void *alloca (size_t); +# endif +#endif + +#endif /* _GL_ALLOCA_H */ diff -ruNp m4-1.4.10/lib/alloca_.h m4-1.4.11/lib/alloca_.h --- m4-1.4.10/lib/alloca_.h 2007-05-30 19:30:14.000000000 -0600 +++ m4-1.4.11/lib/alloca_.h 1969-12-31 17:00:00.000000000 -0700 @@ -1,54 +0,0 @@ -/* Memory allocation on the stack. - - Copyright (C) 1995, 1999, 2001-2004, 2006-2007 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 2, 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, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. */ - -/* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H - means there is a real alloca function. */ -#ifndef _GL_ALLOCA_H -#define _GL_ALLOCA_H - -/* alloca (N) returns a pointer to N bytes of memory - allocated on the stack, which will last until the function returns. - Use of alloca should be avoided: - - inside arguments of function calls - undefined behaviour, - - in inline functions - the allocation may actually last until the - calling function returns, - - for huge N (say, N >= 65536) - you never know how large (or small) - the stack is, and when the stack cannot fulfill the memory allocation - request, the program just crashes. - */ - -#ifndef alloca -# ifdef __GNUC__ -# define alloca __builtin_alloca -# elif defined _AIX -# define alloca __alloca -# elif defined _MSC_VER -# include <malloc.h> -# define alloca _alloca -# else -# include <stddef.h> -# ifdef __cplusplus -extern "C" -# endif -void *alloca (size_t); -# endif -#endif - -#endif /* _GL_ALLOCA_H */ diff -ruNp m4-1.4.10/lib/asnprintf.c m4-1.4.11/lib/asnprintf.c --- m4-1.4.10/lib/asnprintf.c 2007-05-30 19:30:14.000000000 -0600 +++ m4-1.4.11/lib/asnprintf.c 2007-11-02 12:07:17.000000000 -0600 @@ -3,7 +3,7 @@ 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 2, or (at your option) + the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff -ruNp m4-1.4.10/lib/asprintf.c m4-1.4.11/lib/asprintf.c --- m4-1.4.10/lib/asprintf.c 2007-05-30 19:30:14.000000000 -0600 +++ m4-1.4.11/lib/asprintf.c 2007-11-02 12:07:17.000000000 -0600 @@ -3,7 +3,7 @@ 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 2, or (at your option) + the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff -ruNp m4-1.4.10/lib/binary-io.h m4-1.4.11/lib/binary-io.h --- m4-1.4.10/lib/binary-io.h 2007-05-30 19:30:15.000000000 -0600 +++ m4-1.4.11/lib/binary-io.h 2007-12-01 13:55:16.000000000 -0700 @@ -1,10 +1,10 @@ /* Binary mode I/O. Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -12,8 +12,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _BINARY_H #define _BINARY_H diff -ruNp m4-1.4.10/lib/c-ctype.c m4-1.4.11/lib/c-ctype.c --- m4-1.4.10/lib/c-ctype.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/lib/c-ctype.c 2008-03-29 20:30:57.000000000 -0600 @@ -0,0 +1,396 @@ +/* Character handling in C locale. + + Copyright 2000-2003, 2006 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, write to the Free Software Foundation, +Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include <config.h> + +/* Specification. */ +#define NO_C_CTYPE_MACROS +#include "c-ctype.h" + +/* The function isascii is not locale dependent. Its use in EBCDIC is + questionable. */ +bool +c_isascii (int c) +{ + return (c >= 0x00 && c <= 0x7f); +} + +bool +c_isalnum (int c) +{ +#if C_CTYPE_CONSECUTIVE_DIGITS \ + && C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE +#if C_CTYPE_ASCII + return ((c >= '0' && c <= '9') + || ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'Z')); +#else + return ((c >= '0' && c <= '9') + || (c >= 'A' && c <= 'Z') + || (c >= 'a' && c <= 'z')); +#endif +#else + switch (c) + { + case '0': case '1': case '2': case '3': case '4': case '5': + case '6': case '7': case '8': case '9': + case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': + case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': + case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': + case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': + case 'Y': case 'Z': + case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': + case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': + case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': + case 's': case 't': case 'u': case 'v': case 'w': case 'x': + case 'y': case 'z': + return 1; + default: + return 0; + } +#endif +} + +bool +c_isalpha (int c) +{ +#if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE +#if C_CTYPE_ASCII + return ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'Z'); +#else + return ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')); +#endif +#else + switch (c) + { + case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': + case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': + case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': + case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': + case 'Y': case 'Z': + case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': + case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': + case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': + case 's': case 't': case 'u': case 'v': case 'w': case 'x': + case 'y': case 'z': + return 1; + default: + return 0; + } +#endif +} + +bool +c_isblank (int c) +{ + return (c == ' ' || c == '\t'); +} + +bool +c_iscntrl (int c) +{ +#if C_CTYPE_ASCII + return ((c & ~0x1f) == 0 || c == 0x7f); +#else + switch (c) + { + case ' ': case '!': case '"': case '#': case '$': case '%': + case '&': case '\'': case '(': case ')': case '*': case '+': + case ',': case '-': case '.': case '/': + case '0': case '1': case '2': case '3': case '4': case '5': + case '6': case '7': case '8': case '9': + case ':': case ';': case '<': case '=': case '>': case '?': + case '@': + case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': + case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': + case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': + case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': + case 'Y': case 'Z': + case '[': case '\\': case ']': case '^': case '_': case '`': + case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': + case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': + case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': + case 's': case 't': case 'u': case 'v': case 'w': case 'x': + case 'y': case 'z': + case '{': case '|': case '}': case '~': + return 0; + default: + return 1; + } +#endif +} + +bool +c_isdigit (int c) +{ +#if C_CTYPE_CONSECUTIVE_DIGITS + return (c >= '0' && c <= '9'); +#else + switch (c) + { + case '0': case '1': case '2': case '3': case '4': case '5': + case '6': case '7': case '8': case '9': + return 1; + default: + return 0; + } +#endif +} + +bool +c_islower (int c) +{ +#if C_CTYPE_CONSECUTIVE_LOWERCASE + return (c >= 'a' && c <= 'z'); +#else + switch (c) + { + case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': + case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': + case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': + case 's': case 't': case 'u': case 'v': case 'w': case 'x': + case 'y': case 'z': + return 1; + default: + return 0; + } +#endif +} + +bool +c_isgraph (int c) +{ +#if C_CTYPE_ASCII + return (c >= '!' && c <= '~'); +#else + switch (c) + { + case '!': case '"': case '#': case '$': case '%': case '&': + case '\'': case '(': case ')': case '*': case '+': case ',': + case '-': case '.': case '/': + case '0': case '1': case '2': case '3': case '4': case '5': + case '6': case '7': case '8': case '9': + case ':': case ';': case '<': case '=': case '>': case '?': + case '@': + case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': + case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': + case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': + case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': + case 'Y': case 'Z': + case '[': case '\\': case ']': case '^': case '_': case '`': + case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': + case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': + case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': + case 's': case 't': case 'u': case 'v': case 'w': case 'x': + case 'y': case 'z': + case '{': case '|': case '}': case '~': + return 1; + default: + return 0; + } +#endif +} + +bool +c_isprint (int c) +{ +#if C_CTYPE_ASCII + return (c >= ' ' && c <= '~'); +#else + switch (c) + { + case ' ': case '!': case '"': case '#': case '$': case '%': + case '&': case '\'': case '(': case ')': case '*': case '+': + case ',': case '-': case '.': case '/': + case '0': case '1': case '2': case '3': case '4': case '5': + case '6': case '7': case '8': case '9': + case ':': case ';': case '<': case '=': case '>': case '?': + case '@': + case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': + case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': + case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': + case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': + case 'Y': case 'Z': + case '[': case '\\': case ']': case '^': case '_': case '`': + case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': + case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': + case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': + case 's': case 't': case 'u': case 'v': case 'w': case 'x': + case 'y': case 'z': + case '{': case '|': case '}': case '~': + return 1; + default: + return 0; + } +#endif +} + +bool +c_ispunct (int c) +{ +#if C_CTYPE_ASCII + return ((c >= '!' && c <= '~') + && !((c >= '0' && c <= '9') + || ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'Z'))); +#else + switch (c) + { + case '!': case '"': case '#': case '$': case '%': case '&': + case '\'': case '(': case ')': case '*': case '+': case ',': + case '-': case '.': case '/': + case ':': case ';': case '<': case '=': case '>': case '?': + case '@': + case '[': case '\\': case ']': case '^': case '_': case '`': + case '{': case '|': case '}': case '~': + return 1; + default: + return 0; + } +#endif +} + +bool +c_isspace (int c) +{ + return (c == ' ' || c == '\t' + || c == '\n' || c == '\v' || c == '\f' || c == '\r'); +} + +bool +c_isupper (int c) +{ +#if C_CTYPE_CONSECUTIVE_UPPERCASE + return (c >= 'A' && c <= 'Z'); +#else + switch (c) + { + case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': + case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': + case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': + case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': + case 'Y': case 'Z': + return 1; + default: + return 0; + } +#endif +} + +bool +c_isxdigit (int c) +{ +#if C_CTYPE_CONSECUTIVE_DIGITS \ + && C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE +#if C_CTYPE_ASCII + return ((c >= '0' && c <= '9') + || ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'F')); +#else + return ((c >= '0' && c <= '9') + || (c >= 'A' && c <= 'F') + || (c >= 'a' && c <= 'f')); +#endif +#else + switch (c) + { + case '0': case '1': case '2': case '3': case '4': case '5': + case '6': case '7': case '8': case '9': + case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': + case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': + return 1; + default: + return 0; + } +#endif +} + +int +c_tolower (int c) +{ +#if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE + return (c >= 'A' && c <= 'Z' ? c - 'A' + 'a' : c); +#else + switch (c) + { + case 'A': return 'a'; + case 'B': return 'b'; + case 'C': return 'c'; + case 'D': return 'd'; + case 'E': return 'e'; + case 'F': return 'f'; + case 'G': return 'g'; + case 'H': return 'h'; + case 'I': return 'i'; + case 'J': return 'j'; + case 'K': return 'k'; + case 'L': return 'l'; + case 'M': return 'm'; + case 'N': return 'n'; + case 'O': return 'o'; + case 'P': return 'p'; + case 'Q': return 'q'; + case 'R': return 'r'; + case 'S': return 's'; + case 'T': return 't'; + case 'U': return 'u'; + case 'V': return 'v'; + case 'W': return 'w'; + case 'X': return 'x'; + case 'Y': return 'y'; + case 'Z': return 'z'; + default: return c; + } +#endif +} + +int +c_toupper (int c) +{ +#if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE + return (c >= 'a' && c <= 'z' ? c - 'a' + 'A' : c); +#else + switch (c) + { + case 'a': return 'A'; + case 'b': return 'B'; + case 'c': return 'C'; + case 'd': return 'D'; + case 'e': return 'E'; + case 'f': return 'F'; + case 'g': return 'G'; + case 'h': return 'H'; + case 'i': return 'I'; + case 'j': return 'J'; + case 'k': return 'K'; + case 'l': return 'L'; + case 'm': return 'M'; + case 'n': return 'N'; + case 'o': return 'O'; + case 'p': return 'P'; + case 'q': return 'Q'; + case 'r': return 'R'; + case 's': return 'S'; + case 't': return 'T'; + case 'u': return 'U'; + case 'v': return 'V'; + case 'w': return 'W'; + case 'x': return 'X'; + case 'y': return 'Y'; + case 'z': return 'Z'; + default: return c; + } +#endif +} diff -ruNp m4-1.4.10/lib/c-ctype.h m4-1.4.11/lib/c-ctype.h --- m4-1.4.10/lib/c-ctype.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/lib/c-ctype.h 2008-03-29 20:30:57.000000000 -0600 @@ -0,0 +1,280 @@ +/* Character handling in C locale. + + These functions work like the corresponding functions in <ctype.h>, + except that they have the C (POSIX) locale hardwired, whereas the + <ctype.h> functions' behaviour depends on the current locale set via + setlocale. + + Copyright (C) 2000-2003, 2006 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, write to the Free Software Foundation, +Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef C_CTYPE_H +#define C_CTYPE_H + +#include <stdbool.h> + + +#ifdef __cplusplus +extern "C" { +#endif + + +/* The functions defined in this file assume the "C" locale and a character + set without diacritics (ASCII-US or EBCDIC-US or something like that). + Even if the "C" locale on a particular system is an extension of the ASCII + character set (like on BeOS, where it is UTF-8, or on AmigaOS, where it + is ISO-8859-1), the functions in this file recognize only the ASCII + characters. */ + + +/* Check whether the ASCII optimizations apply. */ + +/* ANSI C89 (and ISO C99 5.2.1.3 too) already guarantees that + '0', '1', ..., '9' have consecutive integer values. */ +#define C_CTYPE_CONSECUTIVE_DIGITS 1 + +#if ('A' <= 'Z') \ + && ('A' + 1 == 'B') && ('B' + 1 == 'C') && ('C' + 1 == 'D') \ + && ('D' + 1 == 'E') && ('E' + 1 == 'F') && ('F' + 1 == 'G') \ + && ('G' + 1 == 'H') && ('H' + 1 == 'I') && ('I' + 1 == 'J') \ + && ('J' + 1 == 'K') && ('K' + 1 == 'L') && ('L' + 1 == 'M') \ + && ('M' + 1 == 'N') && ('N' + 1 == 'O') && ('O' + 1 == 'P') \ + && ('P' + 1 == 'Q') && ('Q' + 1 == 'R') && ('R' + 1 == 'S') \ + && ('S' + 1 == 'T') && ('T' + 1 == 'U') && ('U' + 1 == 'V') \ + && ('V' + 1 == 'W') && ('W' + 1 == 'X') && ('X' + 1 == 'Y') \ + && ('Y' + 1 == 'Z') +#define C_CTYPE_CONSECUTIVE_UPPERCASE 1 +#endif + +#if ('a' <= 'z') \ + && ('a' + 1 == 'b') && ('b' + 1 == 'c') && ('c' + 1 == 'd') \ + && ('d' + 1 == 'e') && ('e' + 1 == 'f') && ('f' + 1 == 'g') \ + && ('g' + 1 == 'h') && ('h' + 1 == 'i') && ('i' + 1 == 'j') \ + && ('j' + 1 == 'k') && ('k' + 1 == 'l') && ('l' + 1 == 'm') \ + && ('m' + 1 == 'n') && ('n' + 1 == 'o') && ('o' + 1 == 'p') \ + && ('p' + 1 == 'q') && ('q' + 1 == 'r') && ('r' + 1 == 's') \ + && ('s' + 1 == 't') && ('t' + 1 == 'u') && ('u' + 1 == 'v') \ + && ('v' + 1 == 'w') && ('w' + 1 == 'x') && ('x' + 1 == 'y') \ + && ('y' + 1 == 'z') +#define C_CTYPE_CONSECUTIVE_LOWERCASE 1 +#endif + +#if (' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ + && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ + && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ + && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ + && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ + && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ + && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ + && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ + && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ + && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ + && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ + && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ + && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ + && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ + && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ + && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ + && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ + && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ + && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ + && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ + && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ + && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ + && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126) +/* The character set is ASCII or one of its variants or extensions, not EBCDIC. + Testing the value of '\n' and '\r' is not relevant. */ +#define C_CTYPE_ASCII 1 +#endif + + +/* Function declarations. */ + +extern bool c_isascii (int c); /* not locale dependent */ + +extern bool c_isalnum (int c); +extern bool c_isalpha (int c); +extern bool c_isblank (int c); +extern bool c_iscntrl (int c); +extern bool c_isdigit (int c); +extern bool c_islower (int c); +extern bool c_isgraph (int c); +extern bool c_isprint (int c); +extern bool c_ispunct (int c); +extern bool c_isspace (int c); +extern bool c_isupper (int c); +extern bool c_isxdigit (int c); + +extern int c_tolower (int c); +extern int c_toupper (int c); + + +#if defined __GNUC__ && defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__ && !defined NO_C_CTYPE_MACROS + +/* ASCII optimizations. */ + +#undef c_isascii +#define c_isascii(c) \ + ({ int __c = (c); \ + (__c >= 0x00 && __c <= 0x7f); \ + }) + +#if C_CTYPE_CONSECUTIVE_DIGITS \ + && C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE +#if C_CTYPE_ASCII +#undef c_isalnum +#define c_isalnum(c) \ + ({ int __c = (c); \ + ((__c >= '0' && __c <= '9') \ + || ((__c & ~0x20) >= 'A' && (__c & ~0x20) <= 'Z')); \ + }) +#else +#undef c_isalnum +#define c_isalnum(c) \ + ({ int __c = (c); \ + ((__c >= '0' && __c <= '9') \ + || (__c >= 'A' && __c <= 'Z') \ + || (__c >= 'a' && __c <= 'z')); \ + }) +#endif +#endif + +#if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE +#if C_CTYPE_ASCII +#undef c_isalpha +#define c_isalpha(c) \ + ({ int __c = (c); \ + ((__c & ~0x20) >= 'A' && (__c & ~0x20) <= 'Z'); \ + }) +#else +#undef c_isalpha +#define c_isalpha(c) \ + ({ int __c = (c); \ + ((__c >= 'A' && __c <= 'Z') || (__c >= 'a' && __c <= 'z')); \ + }) +#endif +#endif + +#undef c_isblank +#define c_isblank(c) \ + ({ int __c = (c); \ + (__c == ' ' || __c == '\t'); \ + }) + +#if C_CTYPE_ASCII +#undef c_iscntrl +#define c_iscntrl(c) \ + ({ int __c = (c); \ + ((__c & ~0x1f) == 0 || __c == 0x7f); \ + }) +#endif + +#if C_CTYPE_CONSECUTIVE_DIGITS +#undef c_isdigit +#define c_isdigit(c) \ + ({ int __c = (c); \ + (__c >= '0' && __c <= '9'); \ + }) +#endif + +#if C_CTYPE_CONSECUTIVE_LOWERCASE +#undef c_islower +#define c_islower(c) \ + ({ int __c = (c); \ + (__c >= 'a' && __c <= 'z'); \ + }) +#endif + +#if C_CTYPE_ASCII +#undef c_isgraph +#define c_isgraph(c) \ + ({ int __c = (c); \ + (__c >= '!' && __c <= '~'); \ + }) +#endif + +#if C_CTYPE_ASCII +#undef c_isprint +#define c_isprint(c) \ + ({ int __c = (c); \ + (__c >= ' ' && __c <= '~'); \ + }) +#endif + +#if C_CTYPE_ASCII +#undef c_ispunct +#define c_ispunct(c) \ + ({ int _c = (c); \ + (c_isgraph (_c) && ! c_isalnum (_c)); \ + }) +#endif + +#undef c_isspace +#define c_isspace(c) \ + ({ int __c = (c); \ + (__c == ' ' || __c == '\t' \ + || __c == '\n' || __c == '\v' || __c == '\f' || __c == '\r'); \ + }) + +#if C_CTYPE_CONSECUTIVE_UPPERCASE +#undef c_isupper +#define c_isupper(c) \ + ({ int __c = (c); \ + (__c >= 'A' && __c <= 'Z'); \ + }) +#endif + +#if C_CTYPE_CONSECUTIVE_DIGITS \ + && C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE +#if C_CTYPE_ASCII +#undef c_isxdigit +#define c_isxdigit(c) \ + ({ int __c = (c); \ + ((__c >= '0' && __c <= '9') \ + || ((__c & ~0x20) >= 'A' && (__c & ~0x20) <= 'F')); \ + }) +#else +#undef c_isxdigit +#define c_isxdigit(c) \ + ({ int __c = (c); \ + ((__c >= '0' && __c <= '9') \ + || (__c >= 'A' && __c <= 'F') \ + || (__c >= 'a' && __c <= 'f')); \ + }) +#endif +#endif + +#if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE +#undef c_tolower +#define c_tolower(c) \ + ({ int __c = (c); \ + (__c >= 'A' && __c <= 'Z' ? __c - 'A' + 'a' : __c); \ + }) +#undef c_toupper +#define c_toupper(c) \ + ({ int __c = (c); \ + (__c >= 'a' && __c <= 'z' ? __c - 'a' + 'A' : __c); \ + }) +#endif + +#endif /* optimizing for speed */ + + +#ifdef __cplusplus +} +#endif + +#endif /* C_CTYPE_H */ diff -ruNp m4-1.4.10/lib/clean-temp.c m4-1.4.11/lib/clean-temp.c --- m4-1.4.10/lib/clean-temp.c 2007-07-05 05:47:52.000000000 -0600 +++ m4-1.4.11/lib/clean-temp.c 2007-10-09 06:16:19.000000000 -0600 @@ -2,10 +2,10 @@ Copyright (C) 2001, 2003, 2006-2007 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -13,8 +13,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> diff -ruNp m4-1.4.10/lib/clean-temp.h m4-1.4.11/lib/clean-temp.h --- m4-1.4.10/lib/clean-temp.h 2007-05-30 19:30:15.000000000 -0600 +++ m4-1.4.11/lib/clean-temp.h 2007-12-01 13:55:16.000000000 -0700 @@ -2,10 +2,10 @@ Copyright (C) 2006 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -13,8 +13,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _CLEAN_TEMP_H #define _CLEAN_TEMP_H diff -ruNp m4-1.4.10/lib/cloexec.c m4-1.4.11/lib/cloexec.c --- m4-1.4.10/lib/cloexec.c 2007-05-30 19:30:15.000000000 -0600 +++ m4-1.4.11/lib/cloexec.c 2007-10-09 06:16:20.000000000 -0600 @@ -2,10 +2,10 @@ Copyright (C) 1991, 2004, 2005, 2006 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -13,8 +13,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. The code is taken from glibc/manual/llio.texi */ diff -ruNp m4-1.4.10/lib/close-stream.c m4-1.4.11/lib/close-stream.c --- m4-1.4.10/lib/close-stream.c 2007-05-30 19:30:16.000000000 -0600 +++ m4-1.4.11/lib/close-stream.c 2007-10-09 06:16:20.000000000 -0600 @@ -1,12 +1,12 @@ /* Close a stream, with nicer error checking than fclose's. - Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2006 Free + Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2006, 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -14,8 +14,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> @@ -24,7 +23,7 @@ #include <errno.h> #include <stdbool.h> -#include "__fpending.h" +#include "fpending.h" #if USE_UNLOCKED_IO # include "unlocked-io.h" diff -ruNp m4-1.4.10/lib/closein.c m4-1.4.11/lib/closein.c --- m4-1.4.10/lib/closein.c 2007-05-30 19:30:16.000000000 -0600 +++ m4-1.4.11/lib/closein.c 2007-10-09 06:16:21.000000000 -0600 @@ -2,10 +2,10 @@ Copyright (C) 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -13,8 +13,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> @@ -32,6 +31,7 @@ #include "closeout.h" #include "error.h" #include "exitfail.h" +#include "freadahead.h" #include "quotearg.h" static const char *file_name; @@ -80,10 +80,16 @@ close_stdin (void) { bool fail = false; - /* Only attempt flush if stdin is seekable, as fflush is entitled to - fail on non-seekable streams. */ - if (fseeko (stdin, 0, SEEK_CUR) == 0 && fflush (stdin) != 0) - fail = true; + /* There is no need to flush stdin if we can determine quickly that stdin's + input buffer is empty; in this case we know that if stdin is seekable, + fseeko (stdin, 0, SEEK_CUR) == lseek (0, 0, SEEK_CUR). */ + if (freadahead (stdin) > 0) + { + /* Only attempt flush if stdin is seekable, as fflush is entitled to + fail on non-seekable streams. */ + if (fseeko (stdin, 0, SEEK_CUR) == 0 && fflush (stdin) != 0) + fail = true; + } if (close_stream (stdin) != 0) fail = true; if (fail) diff -ruNp m4-1.4.10/lib/closein.h m4-1.4.11/lib/closein.h --- m4-1.4.10/lib/closein.h 2007-05-30 19:30:16.000000000 -0600 +++ m4-1.4.11/lib/closein.h 2007-12-01 13:55:17.000000000 -0700 @@ -2,10 +2,10 @@ Copyright (C) 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -13,8 +13,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _GL_CLOSEIN_H # define _GL_CLOSEIN_H 1 diff -ruNp m4-1.4.10/lib/closeout.c m4-1.4.11/lib/closeout.c --- m4-1.4.10/lib/closeout.c 2007-05-30 19:30:16.000000000 -0600 +++ m4-1.4.11/lib/closeout.c 2007-10-09 06:16:21.000000000 -0600 @@ -3,10 +3,10 @@ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2006 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -14,8 +14,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> diff -ruNp m4-1.4.10/lib/closeout.h m4-1.4.11/lib/closeout.h --- m4-1.4.10/lib/closeout.h 2007-05-30 19:30:16.000000000 -0600 +++ m4-1.4.11/lib/closeout.h 2007-12-01 13:55:18.000000000 -0700 @@ -2,10 +2,10 @@ Copyright (C) 1998, 2000, 2003, 2004, 2006 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -13,8 +13,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef CLOSEOUT_H # define CLOSEOUT_H 1 diff -ruNp m4-1.4.10/lib/config.charset m4-1.4.11/lib/config.charset --- m4-1.4.10/lib/config.charset 2007-05-30 19:30:17.000000000 -0600 +++ m4-1.4.11/lib/config.charset 2007-11-21 06:35:21.000000000 -0700 @@ -1,11 +1,11 @@ #! /bin/sh # Output a system dependent table of character encoding aliases. # -# Copyright (C) 2000-2004, 2006 Free Software Foundation, Inc. +# Copyright (C) 2000-2004, 2006-2007 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 2, or (at your option) +# the Free Software Foundation; either version 3, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, @@ -31,20 +31,20 @@ # # name MIME? used by which systems # ASCII, ANSI_X3.4-1968 glibc solaris freebsd netbsd darwin -# ISO-8859-1 Y glibc aix hpux irix osf solaris freebsd netbsd darwin -# ISO-8859-2 Y glibc aix hpux irix osf solaris freebsd netbsd darwin +# ISO-8859-1 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin +# ISO-8859-2 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin # ISO-8859-3 Y glibc solaris -# ISO-8859-4 Y osf solaris freebsd netbsd darwin -# ISO-8859-5 Y glibc aix hpux irix osf solaris freebsd netbsd darwin +# ISO-8859-4 Y osf solaris freebsd netbsd openbsd darwin +# ISO-8859-5 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin # ISO-8859-6 Y glibc aix hpux solaris -# ISO-8859-7 Y glibc aix hpux irix osf solaris netbsd darwin +# ISO-8859-7 Y glibc aix hpux irix osf solaris netbsd openbsd darwin # ISO-8859-8 Y glibc aix hpux osf solaris # ISO-8859-9 Y glibc aix hpux irix osf solaris darwin -# ISO-8859-13 glibc netbsd darwin +# ISO-8859-13 glibc netbsd openbsd darwin # ISO-8859-14 glibc -# ISO-8859-15 glibc aix osf solaris freebsd darwin -# KOI8-R Y glibc solaris freebsd netbsd darwin -# KOI8-U Y glibc freebsd netbsd darwin +# ISO-8859-15 glibc aix osf solaris freebsd netbsd openbsd darwin +# KOI8-R Y glibc solaris freebsd netbsd openbsd darwin +# KOI8-U Y glibc freebsd netbsd openbsd darwin # KOI8-T glibc # CP437 dos # CP775 dos @@ -57,7 +57,7 @@ # CP862 dos # CP864 dos # CP865 dos -# CP866 freebsd netbsd darwin dos +# CP866 freebsd netbsd openbsd darwin dos # CP869 dos # CP874 woe32 dos # CP922 aix @@ -70,7 +70,7 @@ # CP1125 dos # CP1129 aix # CP1250 woe32 -# CP1251 glibc solaris netbsd darwin woe32 +# CP1251 glibc solaris netbsd openbsd darwin woe32 # CP1252 aix woe32 # CP1253 woe32 # CP1254 woe32 @@ -397,6 +397,16 @@ case "$os" in echo "BIG5 BIG5" echo "SJIS SHIFT_JIS" ;; + openbsd*) + echo "646 ASCII" + echo "ISO8859-1 ISO-8859-1" + echo "ISO8859-2 ISO-8859-2" + echo "ISO8859-4 ISO-8859-4" + echo "ISO8859-5 ISO-8859-5" + echo "ISO8859-7 ISO-8859-7" + echo "ISO8859-13 ISO-8859-13" + echo "ISO8859-15 ISO-8859-15" + ;; darwin[56]*) # Darwin 6.8 doesn't have nl_langinfo(CODESET); therefore # localcharset.c falls back to using the full locale name diff -ruNp m4-1.4.10/lib/config.hin m4-1.4.11/lib/config.hin --- m4-1.4.10/lib/config.hin 2007-07-09 21:15:22.000000000 -0600 +++ m4-1.4.11/lib/config.hin 2008-04-02 06:45:18.000000000 -0600 @@ -71,14 +71,20 @@ /* Define to 1 when using the gnulib module fopen-safer. */ #undef GNULIB_FOPEN_SAFER +/* Define to indicate the 'malloc' module. */ +#undef GNULIB_MALLOC_GNU + /* Define to 1 if you have 'alloca' after including <alloca.h>, a header that may be supplied by this distribution. */ #undef HAVE_ALLOCA -/* Define HAVE_ALLOCA_H for backward compatibility with older code that - includes <alloca.h> only if HAVE_ALLOCA_H is defined. */ +/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix). + */ #undef HAVE_ALLOCA_H +/* Define to 1 if you have the <bp-sym.h> header file. */ +#undef HAVE_BP_SYM_H + /* Define if the copysignf function is declared in <math.h> and available in libc. */ #undef HAVE_COPYSIGNF_IN_LIBC @@ -91,6 +97,10 @@ libc. */ #undef HAVE_COPYSIGN_IN_LIBC +/* Define to 1 if you have the declaration of `alarm', and to 0 if you don't. + */ +#undef HAVE_DECL_ALARM + /* Define to 1 if you have the declaration of `clearerr_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_CLEARERR_UNLOCKED @@ -171,6 +181,10 @@ don't. */ #undef HAVE_DECL_PUTC_UNLOCKED +/* Define to 1 if you have the declaration of `strerror', and to 0 if you + don't. */ +#undef HAVE_DECL_STRERROR + /* Define to 1 if you have the declaration of `strerror_r', and to 0 if you don't. */ #undef HAVE_DECL_STRERROR_R @@ -231,15 +245,15 @@ /* Define to 1 if you have the `isblank' function. */ #undef HAVE_ISBLANK +/* Define if the isnan(double) function is available in libc. */ +#undef HAVE_ISNAND_IN_LIBC + /* Define if the isnan(float) function is available in libc. */ #undef HAVE_ISNANF_IN_LIBC /* Define if the isnan(long double) function is available in libc. */ #undef HAVE_ISNANL_IN_LIBC -/* Define if the isnan(double) function is available in libc. */ -#undef HAVE_ISNAN_IN_LIBC - /* Define to 1 if you have the `iswcntrl' function. */ #undef HAVE_ISWCNTRL @@ -261,9 +275,6 @@ /* Define to 1 if you have the <locale.h> header file. */ #undef HAVE_LOCALE_H -/* Define if you have the 'long long' type. */ -#undef HAVE_LONG_LONG - /* Define to 1 if the system has the type `long long int'. */ #undef HAVE_LONG_LONG_INT @@ -274,6 +285,9 @@ to 0 otherwise. */ #undef HAVE_MALLOC +/* Define if the 'malloc' function is POSIX compliant. */ +#undef HAVE_MALLOC_POSIX + /* Define to 1 if you have the <math.h> header file. */ #undef HAVE_MATH_H @@ -286,6 +300,9 @@ /* Define to 1 if <wchar.h> declares mbstate_t. */ #undef HAVE_MBSTATE_T +/* Define to 1 if you have the `memchr' function. */ +#undef HAVE_MEMCHR + /* Define to 1 if you have the <memory.h> header file. */ #undef HAVE_MEMORY_H @@ -301,9 +318,6 @@ /* Define to 1 if you have the `pipe' function. */ #undef HAVE_PIPE -/* Define to 1 if the system has the type `ptrdiff_t'. */ -#undef HAVE_PTRDIFF_T - /* Define to 1 if you have the `raise' function. */ #undef HAVE_RAISE @@ -358,6 +372,9 @@ /* Define to 1 if `ss_sp' is member of `stack_t'. */ #undef HAVE_STACK_T_SS_SP +/* Define to 1 if you have the <stdarg.h> header file. */ +#undef HAVE_STDARG_H + /* Define to 1 if stdbool.h conforms to C99. */ #undef HAVE_STDBOOL_H @@ -501,10 +518,22 @@ directive. */ #undef NEED_PRINTF_DIRECTIVE_F +/* Define if the vasnprintf implementation needs special code for 'double' + arguments. */ +#undef NEED_PRINTF_DOUBLE + +/* Define if the vasnprintf implementation needs special code for surviving + out-of-memory conditions. */ +#undef NEED_PRINTF_ENOMEM + /* Define if the vasnprintf implementation needs special code for the ' flag. */ #undef NEED_PRINTF_FLAG_GROUPING +/* Define if the vasnprintf implementation needs special code for the '-' + flag. */ +#undef NEED_PRINTF_FLAG_LEFTADJUST + /* Define if the vasnprintf implementation needs special code for the 0 flag. */ #undef NEED_PRINTF_FLAG_ZERO @@ -521,6 +550,10 @@ double' arguments. */ #undef NEED_PRINTF_LONG_DOUBLE +/* Define if the vasnprintf implementation needs special code for supporting + large precisions without arbitrary bounds. */ +#undef NEED_PRINTF_UNBOUNDED_PRECISION + /* Name of package */ #undef PACKAGE @@ -546,6 +579,9 @@ 'ptrdiff_t'. */ #undef PTRDIFF_T_SUFFIX +/* Define this to 1 if strerror is broken. */ +#undef REPLACE_STRERROR + /* Define if vasnprintf exists but is overridden by gnulib. */ #undef REPLACE_VASNPRINTF @@ -606,21 +642,9 @@ /* Define to 1 if malloc debugging is enabled */ #undef WITH_DMALLOC -/* Define to 1 if on AIX 3. - System headers sometimes define this. - We just want to avoid a redefinition error message. */ -#ifndef _ALL_SOURCE -# undef _ALL_SOURCE -#endif - /* Number of bits in a file offset, on hosts where this is settable. */ #undef _FILE_OFFSET_BITS -/* Enable GNU extensions on systems that have them. */ -#ifndef _GNU_SOURCE -# undef _GNU_SOURCE -#endif - /* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */ #undef _LARGEFILE_SOURCE @@ -640,24 +664,32 @@ /* Define if you want regoff_t to be at least as wide POSIX requires. */ #undef _REGEX_LARGE_OFFSETS -/* Enable extensions on Solaris. */ -#ifndef __EXTENSIONS__ -# undef __EXTENSIONS__ +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# undef _GNU_SOURCE #endif +/* Enable threading extensions on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # undef _POSIX_PTHREAD_SEMANTICS #endif +/* Enable extensions on HP NonStop. */ #ifndef _TANDEM_SOURCE # undef _TANDEM_SOURCE #endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# undef __EXTENSIONS__ +#endif + /* Define to rpl_ if the getopt replacement functions and variables should be used. */ #undef __GETOPT_PREFIX -/* Define to rpl_free if the replacement function should be used. */ -#undef free - /* A replacement for va_copy, if needed. */ #define gl_va_copy(a,b) ((a) = (b)) @@ -682,6 +714,13 @@ /* Define to a type if <wchar.h> does not define. */ #undef mbstate_t +/* Define to rpl_memcmp if the replacement function should be used. */ +#undef memcmp + +/* Define as the type of the result of subtracting two pointers, if the system + doesn't define it. */ +#undef ptrdiff_t + /* Define to rpl_re_comp if the replacement should be used. */ #undef re_comp @@ -727,9 +766,18 @@ /* Define to rpl_regfree if the replacement should be used. */ #undef regfree -/* Define to equivalent of C99 restrict keyword, or to nothing if this is not - supported. Do not define if restrict is supported directly. */ +/* Define to the equivalent of the C99 'restrict' keyword, or to + nothing if this is not supported. Do not define if restrict is + supported directly. */ #undef restrict +/* Work around a bug in Sun C++: it does not support _Restrict, even + though the corresponding Sun C compiler does, which causes + "#define restrict _Restrict" in the previous line. Perhaps some future + version of Sun C++ will work with _Restrict; if so, it'll probably + define __RESTRICT, just as Sun C does. */ +#if defined __SUNPRO_CC && !defined __RESTRICT +# define _Restrict +#endif /* Define to int if rlim_t is not defined in sys/resource.h */ #undef rlim_t diff -ruNp m4-1.4.10/lib/dup-safer.c m4-1.4.11/lib/dup-safer.c --- m4-1.4.10/lib/dup-safer.c 2007-05-30 19:30:17.000000000 -0600 +++ m4-1.4.11/lib/dup-safer.c 2007-10-09 06:16:22.000000000 -0600 @@ -2,10 +2,10 @@ Copyright (C) 2001, 2004, 2005, 2006 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -13,8 +13,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ diff -ruNp m4-1.4.10/lib/error.c m4-1.4.11/lib/error.c --- m4-1.4.10/lib/error.c 2007-05-30 19:30:17.000000000 -0600 +++ m4-1.4.11/lib/error.c 2007-10-09 06:16:22.000000000 -0600 @@ -1,20 +1,19 @@ /* Error handler for noninteractive utilities - Copyright (C) 1990-1998, 2000-2005, 2006 Free Software Foundation, Inc. + Copyright (C) 1990-1998, 2000-2007 Free Software Foundation, Inc. This file is part of the GNU C Library. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */ @@ -31,6 +30,7 @@ #if !_LIBC && ENABLE_NLS # include "gettext.h" +# define _(msgid) gettext (msgid) #endif #ifdef _LIBC diff -ruNp m4-1.4.10/lib/error.h m4-1.4.11/lib/error.h --- m4-1.4.10/lib/error.h 2007-05-30 19:30:18.000000000 -0600 +++ m4-1.4.11/lib/error.h 2008-01-14 22:04:22.000000000 -0700 @@ -1,27 +1,26 @@ /* Declaration for error-reporting function - Copyright (C) 1995, 1996, 1997, 2003, 2006 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 1997, 2003, 2006, 2008 Free Software Foundation, Inc. This file is part of the GNU C Library. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _ERROR_H #define _ERROR_H 1 #ifndef __attribute__ /* This feature is available in gcc versions 2.5 and later. */ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__ +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) # define __attribute__(Spec) /* empty */ # endif /* The __-protected variants of `format' and `printf' attributes diff -ruNp m4-1.4.10/lib/exitfail.c m4-1.4.11/lib/exitfail.c --- m4-1.4.10/lib/exitfail.c 2007-05-30 19:30:18.000000000 -0600 +++ m4-1.4.11/lib/exitfail.c 2007-10-09 06:16:22.000000000 -0600 @@ -2,10 +2,10 @@ Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -13,9 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. - If not, write to the Free Software Foundation, - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> diff -ruNp m4-1.4.10/lib/exitfail.h m4-1.4.11/lib/exitfail.h --- m4-1.4.10/lib/exitfail.h 2007-05-30 19:30:18.000000000 -0600 +++ m4-1.4.11/lib/exitfail.h 2007-12-01 13:55:19.000000000 -0700 @@ -2,10 +2,10 @@ Copyright (C) 2002 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -13,8 +13,6 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. - If not, write to the Free Software Foundation, - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ extern int volatile exit_failure; diff -ruNp m4-1.4.10/lib/fatal-signal.c m4-1.4.11/lib/fatal-signal.c --- m4-1.4.10/lib/fatal-signal.c 2007-05-30 19:30:18.000000000 -0600 +++ m4-1.4.11/lib/fatal-signal.c 2007-10-09 06:16:23.000000000 -0600 @@ -2,10 +2,10 @@ Copyright (C) 2003-2004, 2006-2007 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -13,8 +13,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> diff -ruNp m4-1.4.10/lib/fatal-signal.h m4-1.4.11/lib/fatal-signal.h --- m4-1.4.10/lib/fatal-signal.h 2007-05-30 19:30:18.000000000 -0600 +++ m4-1.4.11/lib/fatal-signal.h 2007-12-01 13:55:19.000000000 -0700 @@ -2,10 +2,10 @@ Copyright (C) 2003-2004 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -13,8 +13,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifdef __cplusplus diff -ruNp m4-1.4.10/lib/fd-safer.c m4-1.4.11/lib/fd-safer.c --- m4-1.4.10/lib/fd-safer.c 2007-05-30 19:30:18.000000000 -0600 +++ m4-1.4.11/lib/fd-safer.c 2007-10-09 06:16:23.000000000 -0600 @@ -2,10 +2,10 @@ Copyright (C) 2005, 2006 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -13,8 +13,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ diff -ruNp m4-1.4.10/lib/fflush.c m4-1.4.11/lib/fflush.c --- m4-1.4.10/lib/fflush.c 2007-05-30 19:30:18.000000000 -0600 +++ m4-1.4.11/lib/fflush.c 2008-03-10 20:11:20.000000000 -0600 @@ -1,10 +1,10 @@ /* fflush.c -- allow flushing input streams - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007-2008 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -12,8 +12,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Eric Blake. */ @@ -60,6 +59,46 @@ rpl_fflush (FILE *stream) if (stream == NULL || ! freading (stream)) return fflush (stream); + /* Clear the ungetc buffer. + + This is needed before fetching the file-position indicator, because + 1) The file position indicator is incremented by fgetc() and decremented + by ungetc(): + <http://www.opengroup.org/susv3/functions/fgetc.html> + "... the fgetc() function shall ... advance the associated file + position indicator for the stream ..." + <http://www.opengroup.org/susv3/functions/ungetc.html> + "The file-position indicator is decremented by each successful + call to ungetc()..." + 2) <http://www.opengroup.org/susv3/functions/ungetc.html> says: + "The value of the file-position indicator for the stream after + reading or discarding all pushed-back bytes shall be the same + as it was before the bytes were pushed back." + 3) Here we are discarding all pushed-back bytes. + + Unfortunately it is impossible to implement this on platforms with + _IOERR, because an ungetc() on this platform prepends the pushed-back + bytes to the buffer without an indication of the limit between the + pushed-back bytes and the read-ahead bytes. */ +#if defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X, Cygwin */ + { +# if defined __NetBSD__ || defined __OpenBSD__ + struct __sfileext + { + struct __sbuf _ub; /* ungetc buffer */ + /* More fields, not relevant here. */ + }; + if (((struct __sfileext *) stream->_ext._base)->_ub._base != NULL) +# else + if (stream->_ub._base != NULL) +# endif + { + stream->_p += stream->_r; + stream->_r = 0; + } + } +#endif + /* POSIX does not specify fflush behavior for non-seekable input streams. Some implementations purge unread data, some return EBADF, some do nothing. */ @@ -77,15 +116,34 @@ rpl_fflush (FILE *stream) if (result != 0) return result; +#if defined __sferror && defined __SNPT /* FreeBSD, NetBSD, OpenBSD, MacOS X, Cygwin */ + + { + /* Disable seek optimization for the next fseeko call. This tells the + following fseeko call to seek to the desired position directly, rather + than to seek to a block-aligned boundary. */ + int saved_flags = stream->_flags & (__SOPT | __SNPT); + stream->_flags = (stream->_flags & ~__SOPT) | __SNPT; + + result = fseeko (stream, pos, SEEK_SET); + + stream->_flags = (stream->_flags & ~(__SOPT | __SNPT)) | saved_flags; + } + return result; + +#else + pos = lseek (fileno (stream), pos, SEEK_SET); if (pos == -1) return EOF; /* After a successful lseek, update the file descriptor's position cache in the stream. */ -#if defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X, Cygwin */ +# if defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X, Cygwin */ stream->_offset = pos; stream->_flags |= __SOFF; -#endif +# endif return 0; + +#endif } diff -ruNp m4-1.4.10/lib/float+.h m4-1.4.11/lib/float+.h --- m4-1.4.10/lib/float+.h 2007-05-30 19:30:19.000000000 -0600 +++ m4-1.4.11/lib/float+.h 2007-12-01 13:55:19.000000000 -0700 @@ -4,7 +4,7 @@ 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 2, or (at your option) + the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff -ruNp m4-1.4.10/lib/float.in.h m4-1.4.11/lib/float.in.h --- m4-1.4.10/lib/float.in.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/lib/float.in.h 2007-12-11 19:25:31.000000000 -0700 @@ -0,0 +1,58 @@ +/* A correct <float.h>. + + Copyright (C) 2007 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/>. */ + +#ifndef _GL_FLOAT_H + +/* The include_next requires a split double-inclusion guard. */ +#@INCLUDE_NEXT@ @NEXT_FLOAT_H@ + +#ifndef _GL_FLOAT_H +#define _GL_FLOAT_H + +/* 'long double' properties. */ +#if defined __i386__ && (defined __BEOS__ || defined __OpenBSD__) +/* Number of mantissa units, in base FLT_RADIX. */ +# undef LDBL_MANT_DIG +# define LDBL_MANT_DIG 64 +/* Number of decimal digits that is sufficient for representing a number. */ +# undef LDBL_DIG +# define LDBL_DIG 18 +/* x-1 where x is the smallest representable number > 1. */ +# undef LDBL_EPSILON +# define LDBL_EPSILON 1.0842021724855044340E-19L +/* Minimum e such that FLT_RADIX^(e-1) is a normalized number. */ +# undef LDBL_MIN_EXP +# define LDBL_MIN_EXP (-16381) +/* Maximum e such that FLT_RADIX^(e-1) is a representable finite number. */ +# undef LDBL_MAX_EXP +# define LDBL_MAX_EXP 16384 +/* Minimum positive normalized number. */ +# undef LDBL_MIN +# define LDBL_MIN 3.3621031431120935063E-4932L +/* Maximum representable finite number. */ +# undef LDBL_MAX +# define LDBL_MAX 1.1897314953572317650E+4932L +/* Minimum e such that 10^e is in the range of normalized numbers. */ +# undef LDBL_MIN_10_EXP +# define LDBL_MIN_10_EXP (-4931) +/* Maximum e such that 10^e is in the range of representable finite numbers. */ +# undef LDBL_MAX_10_EXP +# define LDBL_MAX_10_EXP 4932 +#endif + +#endif /* _GL_FLOAT_H */ +#endif /* _GL_FLOAT_H */ diff -ruNp m4-1.4.10/lib/float_.h m4-1.4.11/lib/float_.h --- m4-1.4.10/lib/float_.h 2007-07-05 05:47:59.000000000 -0600 +++ m4-1.4.11/lib/float_.h 1969-12-31 17:00:00.000000000 -0700 @@ -1,59 +0,0 @@ -/* A correct <float.h>. - - Copyright (C) 2007 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 2, 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#ifndef _GL_FLOAT_H - -/* The include_next requires a split double-inclusion guard. */ -#@INCLUDE_NEXT@ @NEXT_FLOAT_H@ - -#ifndef _GL_FLOAT_H -#define _GL_FLOAT_H - -/* 'long double' properties. */ -#if defined __i386__ && defined __BEOS__ -/* Number of mantissa units, in base FLT_RADIX. */ -# undef LDBL_MANT_DIG -# define LDBL_MANT_DIG 64 -/* Number of decimal digits that is sufficient for representing a number. */ -# undef LDBL_DIG -# define LDBL_DIG 18 -/* x-1 where x is the smallest representable number > 1. */ -# undef LDBL_EPSILON -# define LDBL_EPSILON 1.0842021724855044340E-19L -/* Minimum e such that FLT_RADIX^(e-1) is a normalized number. */ -# undef LDBL_MIN_EXP -# define LDBL_MIN_EXP (-16381) -/* Maximum e such that FLT_RADIX^(e-1) is a representable finite number. */ -# undef LDBL_MAX_EXP -# define LDBL_MAX_EXP 16384 -/* Minimum positive normalized number. */ -# undef LDBL_MIN -# define LDBL_MIN 3.3621031431120935063E-4932L -/* Maximum representable finite number. */ -# undef LDBL_MAX -# define LDBL_MAX 1.1897314953572317650E+4932L -/* Minimum e such that 10^e is in the range of normalized numbers. */ -# undef LDBL_MIN_10_EXP -# define LDBL_MIN_10_EXP (-4931) -/* Maximum e such that 10^e is in the range of representable finite numbers. */ -# undef LDBL_MAX_10_EXP -# define LDBL_MAX_10_EXP 4932 -#endif - -#endif /* _GL_FLOAT_H */ -#endif /* _GL_FLOAT_H */ diff -ruNp m4-1.4.10/lib/fopen-safer.c m4-1.4.11/lib/fopen-safer.c --- m4-1.4.10/lib/fopen-safer.c 2007-05-30 19:30:19.000000000 -0600 +++ m4-1.4.11/lib/fopen-safer.c 2007-10-09 06:16:24.000000000 -0600 @@ -2,10 +2,10 @@ Copyright (C) 2001, 2004, 2005, 2006 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -13,8 +13,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ diff -ruNp m4-1.4.10/lib/fpending.c m4-1.4.11/lib/fpending.c --- m4-1.4.10/lib/fpending.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/lib/fpending.c 2007-10-09 06:16:24.000000000 -0600 @@ -0,0 +1,29 @@ +/* fpending.c -- return the number of pending output bytes on a stream + Copyright (C) 2000, 2004, 2006, 2007 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/>. */ + +/* Written by Jim Meyering. */ + +#include <config.h> + +#include "fpending.h" + +/* Return the number of pending (aka buffered, unflushed) + bytes on the stream, FP, that is open for writing. */ +size_t +__fpending (FILE *fp) +{ + return PENDING_OUTPUT_N_BYTES; +} diff -ruNp m4-1.4.10/lib/fpending.h m4-1.4.11/lib/fpending.h --- m4-1.4.10/lib/fpending.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/lib/fpending.h 2007-12-01 13:55:20.000000000 -0700 @@ -0,0 +1,33 @@ +/* Declare __fpending. + + Copyright (C) 2000, 2003, 2005, 2006 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/>. + + Written by Jim Meyering. */ + +#include <stddef.h> +#include <stdio.h> + +#ifndef HAVE_DECL___FPENDING +"this configure-time declaration test was not run" +#endif + +#if HAVE_DECL___FPENDING +# if HAVE_STDIO_EXT_H +# include <stdio_ext.h> +# endif +#else +size_t __fpending (FILE *); +#endif diff -ruNp m4-1.4.10/lib/fpucw.h m4-1.4.11/lib/fpucw.h --- m4-1.4.10/lib/fpucw.h 2007-05-30 19:30:19.000000000 -0600 +++ m4-1.4.11/lib/fpucw.h 2007-12-01 13:55:20.000000000 -0700 @@ -2,10 +2,10 @@ Copyright (C) 2007 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2007. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -13,8 +13,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _FPUCW_H #define _FPUCW_H diff -ruNp m4-1.4.10/lib/fpurge.c m4-1.4.11/lib/fpurge.c --- m4-1.4.10/lib/fpurge.c 2007-07-05 05:48:00.000000000 -0600 +++ m4-1.4.11/lib/fpurge.c 2007-11-10 16:24:01.000000000 -0700 @@ -1,19 +1,18 @@ /* Flushing buffers of a FILE stream. Copyright (C) 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> @@ -104,6 +103,16 @@ fpurge (FILE *fp) fp->__bufpos = fp->__bufread; # endif return 0; +# elif defined __QNX__ /* QNX */ + fp->_Rback = fp->_Back + sizeof (fp->_Back); + fp->_Rsave = NULL; + if (fp->_Mode & 0x2000 /* _MWRITE */) + /* fp->_Buf <= fp->_Next <= fp->_Wend */ + fp->_Next = fp->_Buf; + else + /* fp->_Buf <= fp->_Next <= fp->_Rend */ + fp->_Rend = fp->_Next; + return 0; # else #error "Please port gnulib fpurge.c to your platform! Look at the definitions of fflush, setvbuf and ungetc on your system, then report this to bug-gnulib." # endif diff -ruNp m4-1.4.10/lib/fpurge.h m4-1.4.11/lib/fpurge.h --- m4-1.4.10/lib/fpurge.h 2007-05-30 19:30:20.000000000 -0600 +++ m4-1.4.11/lib/fpurge.h 2007-12-01 13:55:20.000000000 -0700 @@ -1,19 +1,18 @@ /* Flushing buffers of a FILE stream. Copyright (C) 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _GL_FPURGE_H #define _GL_FPURGE_H diff -ruNp m4-1.4.10/lib/freadahead.c m4-1.4.11/lib/freadahead.c --- m4-1.4.10/lib/freadahead.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/lib/freadahead.c 2008-03-10 20:11:22.000000000 -0600 @@ -0,0 +1,84 @@ +/* Retrieve information about a FILE stream. + Copyright (C) 2007-2008 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/>. */ + +#include <config.h> + +/* Specification. */ +#include "freadahead.h" + +size_t +freadahead (FILE *fp) +{ +#if defined _IO_ferror_unlocked /* GNU libc, BeOS */ + if (fp->_IO_write_ptr > fp->_IO_write_base) + return 0; + return (fp->_IO_read_end - fp->_IO_read_ptr) + + (fp->_flags & _IO_IN_BACKUP ? fp->_IO_save_end - fp->_IO_save_base : + 0); +#elif defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X, Cygwin */ +# if defined __NetBSD__ || defined __OpenBSD__ + struct __sfileext + { + struct __sbuf _ub; /* ungetc buffer */ + /* More fields, not relevant here. */ + }; +# define HASUB(fp) (((struct __sfileext *) (fp)->_ext._base)->_ub._base != NULL) +# else +# define HASUB(fp) ((fp)->_ub._base != NULL) +# endif + if ((fp->_flags & __SWR) != 0 || fp->_r < 0) + return 0; + return fp->_r + + (HASUB (fp) ? fp->_ur : 0); +#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, mingw */ +# if defined __sun && defined _LP64 /* Solaris/{SPARC,AMD64} 64-bit */ +# define fp_ ((struct { unsigned char *_ptr; \ + unsigned char *_base; \ + unsigned char *_end; \ + long _cnt; \ + int _file; \ + unsigned int _flag; \ + } *) fp) + if ((fp_->_flag & _IOWRT) != 0) + return 0; + return fp_->_cnt; +# else + if ((fp->_flag & _IOWRT) != 0) + return 0; + return fp->_cnt; +# endif +#elif defined __UCLIBC__ /* uClibc */ +# ifdef __STDIO_BUFFERS + if (fp->__modeflags & __FLAG_WRITING) + return 0; + return (fp->__bufread - fp->__bufpos) + + (fp->__modeflags & __FLAG_UNGOT ? 1 : 0); +# else + return 0; +# endif +#elif defined __QNX__ /* QNX */ + if ((fp->_Mode & 0x2000 /* _MWRITE */) != 0) + return 0; + /* fp->_Buf <= fp->_Next <= fp->_Rend, + and fp->_Rend may be overridden by fp->_Rsave. */ + return ((fp->_Rsave ? fp->_Rsave : fp->_Rend) - fp->_Next) + + (fp->_Mode & 0x4000 /* _MBYTE */ + ? (fp->_Back + sizeof (fp->_Back)) - fp->_Rback + : 0); +#else + #error "Please port gnulib freadahead.c to your platform! Look at the definition of fflush, fread, ungetc on your system, then report this to bug-gnulib." +#endif +} diff -ruNp m4-1.4.10/lib/freadahead.h m4-1.4.11/lib/freadahead.h --- m4-1.4.10/lib/freadahead.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/lib/freadahead.h 2008-03-10 20:11:22.000000000 -0600 @@ -0,0 +1,38 @@ +/* Retrieve information about a FILE stream. + Copyright (C) 2007-2008 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/>. */ + +#include <stddef.h> +#include <stdio.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* Assuming the stream STREAM is open for reading: + Return the number of bytes waiting in the input buffer of STREAM. + This includes both the bytes that have been read from the underlying input + source and the bytes that have been pushed back through 'ungetc'. + + If this number is 0 and the stream is not currently writing, + fflush (STREAM) is known to be a no-op. + + STREAM must not be wide-character oriented. */ + +extern size_t freadahead (FILE *stream); + +#ifdef __cplusplus +} +#endif diff -ruNp m4-1.4.10/lib/freading.c m4-1.4.11/lib/freading.c --- m4-1.4.10/lib/freading.c 2007-07-05 05:48:00.000000000 -0600 +++ m4-1.4.11/lib/freading.c 2007-11-10 16:24:02.000000000 -0700 @@ -1,28 +1,27 @@ /* Retrieve information about a FILE stream. Copyright (C) 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> /* Specification. */ #include "freading.h" -/* Don't use glibc's __freading function, see +/* Don't use glibc's __freading function in glibc < 2.7, see <http://sourceware.org/bugzilla/show_bug.cgi?id=4359> */ -#if !(HAVE___FREADING && !defined __GLIBC__) +#if !(HAVE___FREADING && (!defined __GLIBC__ || __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 7))) bool freading (FILE *fp) @@ -40,6 +39,9 @@ freading (FILE *fp) return (fp->_flag & _IOREAD) != 0; #elif defined __UCLIBC__ /* uClibc */ return (fp->__modeflags & (__FLAG_READONLY | __FLAG_READING)) != 0; +#elif defined __QNX__ /* QNX */ + return ((fp->_Mode & 0x2 /* _MOPENW */) == 0 + || (fp->_Mode & 0x1000 /* _MREAD */) != 0); #else #error "Please port gnulib freading.c to your platform!" #endif diff -ruNp m4-1.4.10/lib/freading.h m4-1.4.11/lib/freading.h --- m4-1.4.10/lib/freading.h 2007-05-30 19:30:20.000000000 -0600 +++ m4-1.4.11/lib/freading.h 2007-12-01 13:55:21.000000000 -0700 @@ -1,19 +1,18 @@ /* Retrieve information about a FILE stream. Copyright (C) 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <stdbool.h> #include <stdio.h> @@ -33,7 +32,8 @@ STREAM must not be wide-character oriented. */ -#if HAVE___FREADING && !defined __GLIBC__ /* Solaris >= 7, not glibc >= 2.2 */ +#if HAVE___FREADING && (!defined __GLIBC__ || __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 7)) +/* Solaris >= 7, not glibc >= 2.2, but glibc >= 2.7 */ # include <stdio_ext.h> # define freading(stream) (__freading (stream) != 0) diff -ruNp m4-1.4.10/lib/free.c m4-1.4.11/lib/free.c --- m4-1.4.10/lib/free.c 2007-05-30 19:30:20.000000000 -0600 +++ m4-1.4.11/lib/free.c 1969-12-31 17:00:00.000000000 -0700 @@ -1,31 +0,0 @@ -/* Work around incompatibility on older systems where free (NULL) fails. - - Copyright (C) 2003, 2006 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 2, 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -/* written by Paul Eggert */ - -#include <config.h> -#undef free - -#include <stdlib.h> - -void -rpl_free (void *p) -{ - if (p) - free (p); -} diff -ruNp m4-1.4.10/lib/frexp.c m4-1.4.11/lib/frexp.c --- m4-1.4.10/lib/frexp.c 2007-05-30 19:30:21.000000000 -0600 +++ m4-1.4.11/lib/frexp.c 2008-01-26 16:04:25.000000000 -0700 @@ -1,19 +1,18 @@ /* Split a double into fraction and mantissa. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007-2008 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Paolo Bonzini <bonzini@gnu.org>, 2003, and Bruno Haible <bruno@clisp.org>, 2007. */ @@ -28,7 +27,7 @@ # include "isnanl-nolibm.h" # include "fpucw.h" #else -# include "isnan.h" +# include "isnand.h" #endif /* This file assumes FLT_RADIX = 2. If FLT_RADIX is a power of 2 greater @@ -46,7 +45,7 @@ #else # define FUNC frexp # define DOUBLE double -# define ISNAN isnan +# define ISNAN isnand # define DECL_ROUNDING # define BEGIN_ROUNDING() # define END_ROUNDING() @@ -54,7 +53,7 @@ #endif DOUBLE -FUNC (DOUBLE x, int *exp) +FUNC (DOUBLE x, int *expptr) { int sign; int exponent; @@ -63,7 +62,7 @@ FUNC (DOUBLE x, int *exp) /* Test for NaN, infinity, and zero. */ if (ISNAN (x) || x + x == x) { - *exp = 0; + *expptr = 0; return x; } @@ -162,6 +161,6 @@ FUNC (DOUBLE x, int *exp) END_ROUNDING (); - *exp = exponent; + *expptr = exponent; return x; } diff -ruNp m4-1.4.10/lib/frexpl.c m4-1.4.11/lib/frexpl.c --- m4-1.4.10/lib/frexpl.c 2007-05-30 19:30:21.000000000 -0600 +++ m4-1.4.11/lib/frexpl.c 2007-10-09 06:16:26.000000000 -0600 @@ -1,19 +1,18 @@ /* Split a 'long double' into fraction and mantissa. Copyright (C) 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #define USE_LONG_DOUBLE #include "frexp.c" diff -ruNp m4-1.4.10/lib/fseeko.c m4-1.4.11/lib/fseeko.c --- m4-1.4.10/lib/fseeko.c 2007-07-05 05:48:02.000000000 -0600 +++ m4-1.4.11/lib/fseeko.c 2007-12-17 22:18:34.000000000 -0700 @@ -3,7 +3,7 @@ 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 2, or (at your option) + the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -71,11 +71,13 @@ rpl_fseeko (FILE *fp, off_t offset, int : 0) && fp_ub._base == NULL) #elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, mingw */ -# if defined __sun && defined __sparc && defined _LP64 /* Solaris/SPARC 64-bit */ +# if defined __sun && defined _LP64 /* Solaris/{SPARC,AMD64} 64-bit */ # define fp_ ((struct { unsigned char *_ptr; \ unsigned char *_base; \ unsigned char *_end; \ long _cnt; \ + int _file; \ + unsigned int _flag; \ } *) fp) if (fp_->_ptr == fp_->_base && (fp_->_ptr == NULL || fp_->_cnt == 0)) @@ -88,6 +90,10 @@ rpl_fseeko (FILE *fp, off_t offset, int || fp->__bufpos == fp->__bufstart) && ((fp->__modeflags & (__FLAG_READONLY | __FLAG_READING)) == 0 || fp->__bufpos == fp->__bufread)) +#elif defined __QNX__ /* QNX */ + if ((fp->_Mode & _MWRITE ? fp->_Next == fp->_Buf : fp->_Next == fp->_Rend) + && fp->_Rback == fp->_Back + sizeof (fp->_Back) + && fp->_Rsave == NULL) #else #error "Please port gnulib fseeko.c to your platform! Look at the code in fpurge.c, then report this to bug-gnulib." #endif @@ -105,6 +111,9 @@ rpl_fseeko (FILE *fp, off_t offset, int #if defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X, Cygwin */ fp->_offset = pos; fp->_flags |= __SOFF; + fp->_flags &= ~__SEOF; +#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, mingw */ + fp->_flag &= ~_IOEOF; #endif return 0; } diff -ruNp m4-1.4.10/lib/ftello.c m4-1.4.11/lib/ftello.c --- m4-1.4.10/lib/ftello.c 2007-05-30 19:30:21.000000000 -0600 +++ m4-1.4.11/lib/ftello.c 2007-10-09 06:16:27.000000000 -0600 @@ -1,19 +1,18 @@ /* An ftello() function that works around platform bugs. Copyright (C) 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> diff -ruNp m4-1.4.10/lib/getopt.c m4-1.4.11/lib/getopt.c --- m4-1.4.10/lib/getopt.c 2007-05-30 19:30:21.000000000 -0600 +++ m4-1.4.11/lib/getopt.c 2008-03-10 20:11:24.000000000 -0600 @@ -2,23 +2,22 @@ NOTE: getopt is now part of the C library, so if you don't know what "Keep this file name-space clean" means, talk to drepper@gnu.org before changing it! - Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001,2002,2003,2004,2006 + Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001,2002,2003,2004,2006,2008 Free Software Foundation, Inc. This file is part of the GNU C Library. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _LIBC # include <config.h> @@ -31,10 +30,6 @@ #include <string.h> #include <unistd.h> -#ifdef __VMS -# include <unixlib.h> -#endif - #ifdef _LIBC # include <libintl.h> #else diff -ruNp m4-1.4.10/lib/getopt.in.h m4-1.4.11/lib/getopt.in.h --- m4-1.4.10/lib/getopt.in.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/lib/getopt.in.h 2007-12-01 13:55:22.000000000 -0700 @@ -0,0 +1,225 @@ +/* Declarations for getopt. + Copyright (C) 1989-1994,1996-1999,2001,2003,2004,2005,2006,2007 + Free Software Foundation, Inc. + This file is part of the GNU C Library. + + 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/>. */ + +#ifndef _GETOPT_H + +#ifndef __need_getopt +# define _GETOPT_H 1 +#endif + +/* Standalone applications should #define __GETOPT_PREFIX to an + identifier that prefixes the external functions and variables + defined in this header. When this happens, include the + headers that might declare getopt so that they will not cause + confusion if included after this file. Then systematically rename + identifiers so that they do not collide with the system functions + and variables. Renaming avoids problems with some compilers and + linkers. */ +#if defined __GETOPT_PREFIX && !defined __need_getopt +# include <stdlib.h> +# include <stdio.h> +# include <unistd.h> +# undef __need_getopt +# undef getopt +# undef getopt_long +# undef getopt_long_only +# undef optarg +# undef opterr +# undef optind +# undef optopt +# define __GETOPT_CONCAT(x, y) x ## y +# define __GETOPT_XCONCAT(x, y) __GETOPT_CONCAT (x, y) +# define __GETOPT_ID(y) __GETOPT_XCONCAT (__GETOPT_PREFIX, y) +# define getopt __GETOPT_ID (getopt) +# define getopt_long __GETOPT_ID (getopt_long) +# define getopt_long_only __GETOPT_ID (getopt_long_only) +# define optarg __GETOPT_ID (optarg) +# define opterr __GETOPT_ID (opterr) +# define optind __GETOPT_ID (optind) +# define optopt __GETOPT_ID (optopt) +#endif + +/* Standalone applications get correct prototypes for getopt_long and + getopt_long_only; they declare "char **argv". libc uses prototypes + with "char *const *argv" that are incorrect because getopt_long and + getopt_long_only can permute argv; this is required for backward + compatibility (e.g., for LSB 2.0.1). + + This used to be `#if defined __GETOPT_PREFIX && !defined __need_getopt', + but it caused redefinition warnings if both unistd.h and getopt.h were + included, since unistd.h includes getopt.h having previously defined + __need_getopt. + + The only place where __getopt_argv_const is used is in definitions + of getopt_long and getopt_long_only below, but these are visible + only if __need_getopt is not defined, so it is quite safe to rewrite + the conditional as follows: +*/ +#if !defined __need_getopt +# if defined __GETOPT_PREFIX +# define __getopt_argv_const /* empty */ +# else +# define __getopt_argv_const const +# endif +#endif + +/* If __GNU_LIBRARY__ is not already defined, either we are being used + standalone, or this is the first header included in the source file. + If we are being used with glibc, we need to include <features.h>, but + that does not exist if we are standalone. So: if __GNU_LIBRARY__ is + not defined, include <ctype.h>, which will pull in <features.h> for us + if it's from glibc. (Why ctype.h? It's guaranteed to exist and it + doesn't flood the namespace with stuff the way some other headers do.) */ +#if !defined __GNU_LIBRARY__ +# include <ctype.h> +#endif + +#ifndef __THROW +# ifndef __GNUC_PREREQ +# define __GNUC_PREREQ(maj, min) (0) +# endif +# if defined __cplusplus && __GNUC_PREREQ (2,8) +# define __THROW throw () +# else +# define __THROW +# endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* For communication from `getopt' to the caller. + When `getopt' finds an option that takes an argument, + the argument value is returned here. + Also, when `ordering' is RETURN_IN_ORDER, + each non-option ARGV-element is returned here. */ + +extern char *optarg; + +/* Index in ARGV of the next element to be scanned. + This is used for communication to and from the caller + and for communication between successive calls to `getopt'. + + On entry to `getopt', zero means this is the first call; initialize. + + When `getopt' returns -1, this is the index of the first of the + non-option elements that the caller should itself scan. + + Otherwise, `optind' communicates from one call to the next + how much of ARGV has been scanned so far. */ + +extern int optind; + +/* Callers store zero here to inhibit the error message `getopt' prints + for unrecognized options. */ + +extern int opterr; + +/* Set to an option character which was unrecognized. */ + +extern int optopt; + +#ifndef __need_getopt +/* Describe the long-named options requested by the application. + The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector + of `struct option' terminated by an element containing a name which is + zero. + + The field `has_arg' is: + no_argument (or 0) if the option does not take an argument, + required_argument (or 1) if the option requires an argument, + optional_argument (or 2) if the option takes an optional argument. + + If the field `flag' is not NULL, it points to a variable that is set + to the value given in the field `val' when the option is found, but + left unchanged if the option is not found. + + To have a long-named option do something other than set an `int' to + a compiled-in constant, such as set a value from `optarg', set the + option's `flag' field to zero and its `val' field to a nonzero + value (the equivalent single-letter option character, if there is + one). For long options that have a zero `flag' field, `getopt' + returns the contents of the `val' field. */ + +struct option +{ + const char *name; + /* has_arg can't be an enum because some compilers complain about + type mismatches in all the code that assumes it is an int. */ + int has_arg; + int *flag; + int val; +}; + +/* Names for the values of the `has_arg' field of `struct option'. */ + +# define no_argument 0 +# define required_argument 1 +# define optional_argument 2 +#endif /* need getopt */ + + +/* Get definitions and prototypes for functions to process the + arguments in ARGV (ARGC of them, minus the program name) for + options given in OPTS. + + Return the option character from OPTS just read. Return -1 when + there are no more options. For unrecognized options, or options + missing arguments, `optopt' is set to the option letter, and '?' is + returned. + + The OPTS string is a list of characters which are recognized option + letters, optionally followed by colons, specifying that that letter + takes an argument, to be placed in `optarg'. + + If a letter in OPTS is followed by two colons, its argument is + optional. This behavior is specific to the GNU `getopt'. + + The argument `--' causes premature termination of argument + scanning, explicitly telling `getopt' that there are no more + options. + + If OPTS begins with `-', then non-option arguments are treated as + arguments to the option '\1'. This behavior is specific to the GNU + `getopt'. If OPTS begins with `+', or POSIXLY_CORRECT is set in + the environment, then do not permute arguments. */ + +extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) + __THROW; + +#ifndef __need_getopt +extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv, + const char *__shortopts, + const struct option *__longopts, int *__longind) + __THROW; +extern int getopt_long_only (int ___argc, char *__getopt_argv_const *___argv, + const char *__shortopts, + const struct option *__longopts, int *__longind) + __THROW; + +#endif + +#ifdef __cplusplus +} +#endif + +/* Make sure we later can get all the definitions and declarations. */ +#undef __need_getopt + +#endif /* getopt.h */ diff -ruNp m4-1.4.10/lib/getopt1.c m4-1.4.11/lib/getopt1.c --- m4-1.4.10/lib/getopt1.c 2007-05-30 19:30:21.000000000 -0600 +++ m4-1.4.11/lib/getopt1.c 2007-10-09 07:10:00.000000000 -0600 @@ -3,19 +3,18 @@ Free Software Foundation, Inc. This file is part of the GNU C Library. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifdef _LIBC # include <getopt.h> diff -ruNp m4-1.4.10/lib/getopt_.h m4-1.4.11/lib/getopt_.h --- m4-1.4.10/lib/getopt_.h 2007-05-30 19:30:22.000000000 -0600 +++ m4-1.4.11/lib/getopt_.h 1969-12-31 17:00:00.000000000 -0700 @@ -1,226 +0,0 @@ -/* Declarations for getopt. - Copyright (C) 1989-1994,1996-1999,2001,2003,2004,2005,2006,2007 - Free Software Foundation, Inc. - This file is part of the GNU C Library. - - 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 2, 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#ifndef _GETOPT_H - -#ifndef __need_getopt -# define _GETOPT_H 1 -#endif - -/* Standalone applications should #define __GETOPT_PREFIX to an - identifier that prefixes the external functions and variables - defined in this header. When this happens, include the - headers that might declare getopt so that they will not cause - confusion if included after this file. Then systematically rename - identifiers so that they do not collide with the system functions - and variables. Renaming avoids problems with some compilers and - linkers. */ -#if defined __GETOPT_PREFIX && !defined __need_getopt -# include <stdlib.h> -# include <stdio.h> -# include <unistd.h> -# undef __need_getopt -# undef getopt -# undef getopt_long -# undef getopt_long_only -# undef optarg -# undef opterr -# undef optind -# undef optopt -# define __GETOPT_CONCAT(x, y) x ## y -# define __GETOPT_XCONCAT(x, y) __GETOPT_CONCAT (x, y) -# define __GETOPT_ID(y) __GETOPT_XCONCAT (__GETOPT_PREFIX, y) -# define getopt __GETOPT_ID (getopt) -# define getopt_long __GETOPT_ID (getopt_long) -# define getopt_long_only __GETOPT_ID (getopt_long_only) -# define optarg __GETOPT_ID (optarg) -# define opterr __GETOPT_ID (opterr) -# define optind __GETOPT_ID (optind) -# define optopt __GETOPT_ID (optopt) -#endif - -/* Standalone applications get correct prototypes for getopt_long and - getopt_long_only; they declare "char **argv". libc uses prototypes - with "char *const *argv" that are incorrect because getopt_long and - getopt_long_only can permute argv; this is required for backward - compatibility (e.g., for LSB 2.0.1). - - This used to be `#if defined __GETOPT_PREFIX && !defined __need_getopt', - but it caused redefinition warnings if both unistd.h and getopt.h were - included, since unistd.h includes getopt.h having previously defined - __need_getopt. - - The only place where __getopt_argv_const is used is in definitions - of getopt_long and getopt_long_only below, but these are visible - only if __need_getopt is not defined, so it is quite safe to rewrite - the conditional as follows: -*/ -#if !defined __need_getopt -# if defined __GETOPT_PREFIX -# define __getopt_argv_const /* empty */ -# else -# define __getopt_argv_const const -# endif -#endif - -/* If __GNU_LIBRARY__ is not already defined, either we are being used - standalone, or this is the first header included in the source file. - If we are being used with glibc, we need to include <features.h>, but - that does not exist if we are standalone. So: if __GNU_LIBRARY__ is - not defined, include <ctype.h>, which will pull in <features.h> for us - if it's from glibc. (Why ctype.h? It's guaranteed to exist and it - doesn't flood the namespace with stuff the way some other headers do.) */ -#if !defined __GNU_LIBRARY__ -# include <ctype.h> -#endif - -#ifndef __THROW -# ifndef __GNUC_PREREQ -# define __GNUC_PREREQ(maj, min) (0) -# endif -# if defined __cplusplus && __GNUC_PREREQ (2,8) -# define __THROW throw () -# else -# define __THROW -# endif -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* For communication from `getopt' to the caller. - When `getopt' finds an option that takes an argument, - the argument value is returned here. - Also, when `ordering' is RETURN_IN_ORDER, - each non-option ARGV-element is returned here. */ - -extern char *optarg; - -/* Index in ARGV of the next element to be scanned. - This is used for communication to and from the caller - and for communication between successive calls to `getopt'. - - On entry to `getopt', zero means this is the first call; initialize. - - When `getopt' returns -1, this is the index of the first of the - non-option elements that the caller should itself scan. - - Otherwise, `optind' communicates from one call to the next - how much of ARGV has been scanned so far. */ - -extern int optind; - -/* Callers store zero here to inhibit the error message `getopt' prints - for unrecognized options. */ - -extern int opterr; - -/* Set to an option character which was unrecognized. */ - -extern int optopt; - -#ifndef __need_getopt -/* Describe the long-named options requested by the application. - The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector - of `struct option' terminated by an element containing a name which is - zero. - - The field `has_arg' is: - no_argument (or 0) if the option does not take an argument, - required_argument (or 1) if the option requires an argument, - optional_argument (or 2) if the option takes an optional argument. - - If the field `flag' is not NULL, it points to a variable that is set - to the value given in the field `val' when the option is found, but - left unchanged if the option is not found. - - To have a long-named option do something other than set an `int' to - a compiled-in constant, such as set a value from `optarg', set the - option's `flag' field to zero and its `val' field to a nonzero - value (the equivalent single-letter option character, if there is - one). For long options that have a zero `flag' field, `getopt' - returns the contents of the `val' field. */ - -struct option -{ - const char *name; - /* has_arg can't be an enum because some compilers complain about - type mismatches in all the code that assumes it is an int. */ - int has_arg; - int *flag; - int val; -}; - -/* Names for the values of the `has_arg' field of `struct option'. */ - -# define no_argument 0 -# define required_argument 1 -# define optional_argument 2 -#endif /* need getopt */ - - -/* Get definitions and prototypes for functions to process the - arguments in ARGV (ARGC of them, minus the program name) for - options given in OPTS. - - Return the option character from OPTS just read. Return -1 when - there are no more options. For unrecognized options, or options - missing arguments, `optopt' is set to the option letter, and '?' is - returned. - - The OPTS string is a list of characters which are recognized option - letters, optionally followed by colons, specifying that that letter - takes an argument, to be placed in `optarg'. - - If a letter in OPTS is followed by two colons, its argument is - optional. This behavior is specific to the GNU `getopt'. - - The argument `--' causes premature termination of argument - scanning, explicitly telling `getopt' that there are no more - options. - - If OPTS begins with `-', then non-option arguments are treated as - arguments to the option '\1'. This behavior is specific to the GNU - `getopt'. If OPTS begins with `+', or POSIXLY_CORRECT is set in - the environment, then do not permute arguments. */ - -extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) - __THROW; - -#ifndef __need_getopt -extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv, - const char *__shortopts, - const struct option *__longopts, int *__longind) - __THROW; -extern int getopt_long_only (int ___argc, char *__getopt_argv_const *___argv, - const char *__shortopts, - const struct option *__longopts, int *__longind) - __THROW; - -#endif - -#ifdef __cplusplus -} -#endif - -/* Make sure we later can get all the definitions and declarations. */ -#undef __need_getopt - -#endif /* getopt.h */ diff -ruNp m4-1.4.10/lib/getopt_int.h m4-1.4.11/lib/getopt_int.h --- m4-1.4.10/lib/getopt_int.h 2007-05-30 19:30:22.000000000 -0600 +++ m4-1.4.11/lib/getopt_int.h 2007-12-01 13:55:22.000000000 -0700 @@ -3,19 +3,18 @@ Free Software Foundation, Inc. This file is part of the GNU C Library. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _GETOPT_INT_H #define _GETOPT_INT_H 1 diff -ruNp m4-1.4.10/lib/gettext.h m4-1.4.11/lib/gettext.h --- m4-1.4.10/lib/gettext.h 2007-05-30 19:30:22.000000000 -0600 +++ m4-1.4.11/lib/gettext.h 2007-12-01 13:55:23.000000000 -0700 @@ -3,7 +3,7 @@ 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 2, or (at your option) + the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff -ruNp m4-1.4.10/lib/gettimeofday.c m4-1.4.11/lib/gettimeofday.c --- m4-1.4.10/lib/gettimeofday.c 2007-05-30 19:30:22.000000000 -0600 +++ m4-1.4.11/lib/gettimeofday.c 2007-11-02 12:07:24.000000000 -0600 @@ -5,7 +5,7 @@ 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 2, or (at your option) + the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -48,7 +48,7 @@ static struct tm *localtime_buffer_addr localtime uses for its result. */ struct tm * -localtime (time_t const *timep) +rpl_localtime (time_t const *timep) { #undef localtime extern struct tm *localtime (time_t const *); @@ -62,7 +62,7 @@ localtime (time_t const *timep) /* Same as above, since gmtime and localtime use the same buffer. */ struct tm * -gmtime (time_t const *timep) +rpl_gmtime (time_t const *timep) { #undef gmtime extern struct tm *gmtime (time_t const *); @@ -80,7 +80,7 @@ gmtime (time_t const *timep) /* This is a wrapper for tzset, for systems on which tzset may clobber the static buffer used for localtime's result. */ void -tzset (void) +rpl_tzset (void) { #undef tzset extern void tzset (void); diff -ruNp m4-1.4.10/lib/gl_anyhash_list1.h m4-1.4.11/lib/gl_anyhash_list1.h --- m4-1.4.10/lib/gl_anyhash_list1.h 2007-05-30 19:30:23.000000000 -0600 +++ m4-1.4.11/lib/gl_anyhash_list1.h 2007-12-01 13:55:23.000000000 -0700 @@ -2,10 +2,10 @@ Copyright (C) 2006 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -13,8 +13,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Common code of gl_linkedhash_list.c, gl_avltreehash_list.c, gl_rbtreehash_list.c. */ diff -ruNp m4-1.4.10/lib/gl_anyhash_list2.h m4-1.4.11/lib/gl_anyhash_list2.h --- m4-1.4.10/lib/gl_anyhash_list2.h 2007-05-30 19:30:23.000000000 -0600 +++ m4-1.4.11/lib/gl_anyhash_list2.h 2007-12-01 13:55:23.000000000 -0700 @@ -2,10 +2,10 @@ Copyright (C) 2006 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -13,8 +13,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Common code of gl_linkedhash_list.c, gl_avltreehash_list.c, gl_rbtreehash_list.c. */ diff -ruNp m4-1.4.10/lib/gl_anylinked_list1.h m4-1.4.11/lib/gl_anylinked_list1.h --- m4-1.4.10/lib/gl_anylinked_list1.h 2007-05-30 19:30:23.000000000 -0600 +++ m4-1.4.11/lib/gl_anylinked_list1.h 2007-12-01 13:55:23.000000000 -0700 @@ -2,10 +2,10 @@ Copyright (C) 2006 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -13,8 +13,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Common code of gl_linked_list.c and gl_linkedhash_list.c. */ diff -ruNp m4-1.4.10/lib/gl_anylinked_list2.h m4-1.4.11/lib/gl_anylinked_list2.h --- m4-1.4.10/lib/gl_anylinked_list2.h 2007-05-30 19:30:23.000000000 -0600 +++ m4-1.4.11/lib/gl_anylinked_list2.h 2008-02-12 20:52:05.000000000 -0700 @@ -1,11 +1,11 @@ /* Sequential list data type implemented by a linked list. - Copyright (C) 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2006-2008 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -13,8 +13,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Common code of gl_linked_list.c and gl_linkedhash_list.c. */ @@ -127,6 +126,32 @@ gl_linked_node_value (gl_list_t list, gl return node->value; } +static void +gl_linked_node_set_value (gl_list_t list, gl_list_node_t node, const void *elt) +{ +#if WITH_HASHTABLE + if (elt != node->value) + { + size_t new_hashcode = + (list->base.hashcode_fn != NULL + ? list->base.hashcode_fn (elt) + : (size_t)(uintptr_t) elt); + + if (new_hashcode != node->h.hashcode) + { + remove_from_bucket (list, node); + node->value = elt; + node->h.hashcode = new_hashcode; + add_to_bucket (list, node); + } + else + node->value = elt; + } +#else + node->value = elt; +#endif +} + static gl_list_node_t gl_linked_next_node (gl_list_t list, gl_list_node_t node) { diff -ruNp m4-1.4.10/lib/gl_anytree_oset.h m4-1.4.11/lib/gl_anytree_oset.h --- m4-1.4.10/lib/gl_anytree_oset.h 2007-05-30 19:30:23.000000000 -0600 +++ m4-1.4.11/lib/gl_anytree_oset.h 2007-12-01 13:55:24.000000000 -0700 @@ -2,10 +2,10 @@ Copyright (C) 2006-2007 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -13,8 +13,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Common code of gl_avltree_oset.c and gl_rbtree_oset.c. */ diff -ruNp m4-1.4.10/lib/gl_array_list.c m4-1.4.11/lib/gl_array_list.c --- m4-1.4.10/lib/gl_array_list.c 2007-05-30 19:30:23.000000000 -0600 +++ m4-1.4.11/lib/gl_array_list.c 1969-12-31 17:00:00.000000000 -0700 @@ -1,647 +0,0 @@ -/* Sequential list data type implemented by an array. - Copyright (C) 2006-2007 Free Software Foundation, Inc. - Written by Bruno Haible <bruno@clisp.org>, 2006. - - 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 2, 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#include <config.h> - -/* Specification. */ -#include "gl_array_list.h" - -#include <stdlib.h> -/* Get memcpy. */ -#include <string.h> - -#include "xalloc.h" - -/* Checked size_t computations. */ -#include "xsize.h" - -#ifndef uintptr_t -# define uintptr_t unsigned long -#endif - -/* -------------------------- gl_list_t Data Type -------------------------- */ - -/* Concrete gl_list_impl type, valid for this file only. */ -struct gl_list_impl -{ - struct gl_list_impl_base base; - /* An array of ALLOCATED elements, of which the first COUNT are used. - 0 <= COUNT <= ALLOCATED. */ - const void **elements; - size_t count; - size_t allocated; -}; - -/* struct gl_list_node_impl doesn't exist here. The pointers are actually - indices + 1. */ -#define INDEX_TO_NODE(index) (gl_list_node_t)(uintptr_t)(size_t)((index) + 1) -#define NODE_TO_INDEX(node) ((uintptr_t)(node) - 1) - -static gl_list_t -gl_array_create_empty (gl_list_implementation_t implementation, - gl_listelement_equals_fn equals_fn, - gl_listelement_hashcode_fn hashcode_fn, - gl_listelement_dispose_fn dispose_fn, - bool allow_duplicates) -{ - struct gl_list_impl *list = XMALLOC (struct gl_list_impl); - - list->base.vtable = implementation; - list->base.equals_fn = equals_fn; - list->base.hashcode_fn = hashcode_fn; - list->base.dispose_fn = dispose_fn; - list->base.allow_duplicates = allow_duplicates; - list->elements = NULL; - list->count = 0; - list->allocated = 0; - - return list; -} - -static gl_list_t -gl_array_create (gl_list_implementation_t implementation, - gl_listelement_equals_fn equals_fn, - gl_listelement_hashcode_fn hashcode_fn, - gl_listelement_dispose_fn dispose_fn, - bool allow_duplicates, - size_t count, const void **contents) -{ - struct gl_list_impl *list = XMALLOC (struct gl_list_impl); - - list->base.vtable = implementation; - list->base.equals_fn = equals_fn; - list->base.hashcode_fn = hashcode_fn; - list->base.dispose_fn = dispose_fn; - list->base.allow_duplicates = allow_duplicates; - if (count > 0) - { - list->elements = XNMALLOC (count, const void *); - memcpy (list->elements, contents, count * sizeof (const void *)); - } - else - list->elements = NULL; - list->count = count; - list->allocated = count; - - return list; -} - -static size_t -gl_array_size (gl_list_t list) -{ - return list->count; -} - -static const void * -gl_array_node_value (gl_list_t list, gl_list_node_t node) -{ - uintptr_t index = NODE_TO_INDEX (node); - if (!(index < list->count)) - /* Invalid argument. */ - abort (); - return list->elements[index]; -} - -static gl_list_node_t -gl_array_next_node (gl_list_t list, gl_list_node_t node) -{ - uintptr_t index = NODE_TO_INDEX (node); - if (!(index < list->count)) - /* Invalid argument. */ - abort (); - index++; - if (index < list->count) - return INDEX_TO_NODE (index); - else - return NULL; -} - -static gl_list_node_t -gl_array_previous_node (gl_list_t list, gl_list_node_t node) -{ - uintptr_t index = NODE_TO_INDEX (node); - if (!(index < list->count)) - /* Invalid argument. */ - abort (); - if (index > 0) - return INDEX_TO_NODE (index - 1); - else - return NULL; -} - -static const void * -gl_array_get_at (gl_list_t list, size_t position) -{ - size_t count = list->count; - - if (!(position < count)) - /* Invalid argument. */ - abort (); - return list->elements[position]; -} - -static gl_list_node_t -gl_array_set_at (gl_list_t list, size_t position, const void *elt) -{ - size_t count = list->count; - - if (!(position < count)) - /* Invalid argument. */ - abort (); - list->elements[position] = elt; - return INDEX_TO_NODE (position); -} - -static size_t -gl_array_indexof_from_to (gl_list_t list, size_t start_index, size_t end_index, - const void *elt) -{ - size_t count = list->count; - - if (!(start_index <= end_index && end_index <= count)) - /* Invalid arguments. */ - abort (); - - if (start_index < end_index) - { - gl_listelement_equals_fn equals = list->base.equals_fn; - if (equals != NULL) - { - size_t i; - - for (i = start_index;;) - { - if (equals (elt, list->elements[i])) - return i; - i++; - if (i == end_index) - break; - } - } - else - { - size_t i; - - for (i = start_index;;) - { - if (elt == list->elements[i]) - return i; - i++; - if (i == end_index) - break; - } - } - } - return (size_t)(-1); -} - -static gl_list_node_t -gl_array_search_from_to (gl_list_t list, size_t start_index, size_t end_index, - const void *elt) -{ - size_t index = gl_array_indexof_from_to (list, start_index, end_index, elt); - return INDEX_TO_NODE (index); -} - -/* Ensure that list->allocated > list->count. */ -static void -grow (gl_list_t list) -{ - size_t new_allocated; - size_t memory_size; - const void **memory; - - new_allocated = xtimes (list->allocated, 2); - new_allocated = xsum (new_allocated, 1); - memory_size = xtimes (new_allocated, sizeof (const void *)); - if (size_overflow_p (memory_size)) - /* Overflow, would lead to out of memory. */ - xalloc_die (); - memory = (const void **) xrealloc (list->elements, memory_size); - if (memory == NULL) - /* Out of memory. */ - xalloc_die (); - list->elements = memory; - list->allocated = new_allocated; -} - -static gl_list_node_t -gl_array_add_first (gl_list_t list, const void *elt) -{ - size_t count = list->count; - const void **elements; - size_t i; - - if (count == list->allocated) - grow (list); - elements = list->elements; - for (i = count; i > 0; i--) - elements[i] = elements[i - 1]; - elements[0] = elt; - list->count = count + 1; - return INDEX_TO_NODE (0); -} - -static gl_list_node_t -gl_array_add_last (gl_list_t list, const void *elt) -{ - size_t count = list->count; - - if (count == list->allocated) - grow (list); - list->elements[count] = elt; - list->count = count + 1; - return INDEX_TO_NODE (count); -} - -static gl_list_node_t -gl_array_add_before (gl_list_t list, gl_list_node_t node, const void *elt) -{ - size_t count = list->count; - uintptr_t index = NODE_TO_INDEX (node); - size_t position; - const void **elements; - size_t i; - - if (!(index < count)) - /* Invalid argument. */ - abort (); - position = index; - if (count == list->allocated) - grow (list); - elements = list->elements; - for (i = count; i > position; i--) - elements[i] = elements[i - 1]; - elements[position] = elt; - list->count = count + 1; - return INDEX_TO_NODE (position); -} - -static gl_list_node_t -gl_array_add_after (gl_list_t list, gl_list_node_t node, const void *elt) -{ - size_t count = list->count; - uintptr_t index = NODE_TO_INDEX (node); - size_t position; - const void **elements; - size_t i; - - if (!(index < count)) - /* Invalid argument. */ - abort (); - position = index + 1; - if (count == list->allocated) - grow (list); - elements = list->elements; - for (i = count; i > position; i--) - elements[i] = elements[i - 1]; - elements[position] = elt; - list->count = count + 1; - return INDEX_TO_NODE (position); -} - -static gl_list_node_t -gl_array_add_at (gl_list_t list, size_t position, const void *elt) -{ - size_t count = list->count; - const void **elements; - size_t i; - - if (!(position <= count)) - /* Invalid argument. */ - abort (); - if (count == list->allocated) - grow (list); - elements = list->elements; - for (i = count; i > position; i--) - elements[i] = elements[i - 1]; - elements[position] = elt; - list->count = count + 1; - return INDEX_TO_NODE (position); -} - -static bool -gl_array_remove_node (gl_list_t list, gl_list_node_t node) -{ - size_t count = list->count; - uintptr_t index = NODE_TO_INDEX (node); - size_t position; - const void **elements; - size_t i; - - if (!(index < count)) - /* Invalid argument. */ - abort (); - position = index; - elements = list->elements; - if (list->base.dispose_fn != NULL) - list->base.dispose_fn (elements[position]); - for (i = position + 1; i < count; i++) - elements[i - 1] = elements[i]; - list->count = count - 1; - return true; -} - -static bool -gl_array_remove_at (gl_list_t list, size_t position) -{ - size_t count = list->count; - const void **elements; - size_t i; - - if (!(position < count)) - /* Invalid argument. */ - abort (); - elements = list->elements; - if (list->base.dispose_fn != NULL) - list->base.dispose_fn (elements[position]); - for (i = position + 1; i < count; i++) - elements[i - 1] = elements[i]; - list->count = count - 1; - return true; -} - -static bool -gl_array_remove (gl_list_t list, const void *elt) -{ - size_t position = gl_array_indexof_from_to (list, 0, list->count, elt); - if (position == (size_t)(-1)) - return false; - else - return gl_array_remove_at (list, position); -} - -static void -gl_array_list_free (gl_list_t list) -{ - if (list->elements != NULL) - { - if (list->base.dispose_fn != NULL) - { - size_t count = list->count; - - if (count > 0) - { - gl_listelement_dispose_fn dispose = list->base.dispose_fn; - const void **elements = list->elements; - - do - dispose (*elements++); - while (--count > 0); - } - } - free (list->elements); - } - free (list); -} - -/* --------------------- gl_list_iterator_t Data Type --------------------- */ - -static gl_list_iterator_t -gl_array_iterator (gl_list_t list) -{ - gl_list_iterator_t result; - - result.vtable = list->base.vtable; - result.list = list; - result.count = list->count; - result.p = list->elements + 0; - result.q = list->elements + list->count; -#ifdef lint - result.i = 0; - result.j = 0; -#endif - - return result; -} - -static gl_list_iterator_t -gl_array_iterator_from_to (gl_list_t list, size_t start_index, size_t end_index) -{ - gl_list_iterator_t result; - - if (!(start_index <= end_index && end_index <= list->count)) - /* Invalid arguments. */ - abort (); - result.vtable = list->base.vtable; - result.list = list; - result.count = list->count; - result.p = list->elements + start_index; - result.q = list->elements + end_index; -#ifdef lint - result.i = 0; - result.j = 0; -#endif - - return result; -} - -static bool -gl_array_iterator_next (gl_list_iterator_t *iterator, - const void **eltp, gl_list_node_t *nodep) -{ - gl_list_t list = iterator->list; - if (iterator->count != list->count) - { - if (iterator->count != list->count + 1) - /* Concurrent modifications were done on the list. */ - abort (); - /* The last returned element was removed. */ - iterator->count--; - iterator->p = (const void **) iterator->p - 1; - iterator->q = (const void **) iterator->q - 1; - } - if (iterator->p < iterator->q) - { - const void **p = (const void **) iterator->p; - *eltp = *p; - if (nodep != NULL) - *nodep = INDEX_TO_NODE (p - list->elements); - iterator->p = p + 1; - return true; - } - else - return false; -} - -static void -gl_array_iterator_free (gl_list_iterator_t *iterator) -{ -} - -/* ---------------------- Sorted gl_list_t Data Type ---------------------- */ - -static size_t -gl_array_sortedlist_indexof_from_to (gl_list_t list, - gl_listelement_compar_fn compar, - size_t low, size_t high, - const void *elt) -{ - if (!(low <= high && high <= list->count)) - /* Invalid arguments. */ - abort (); - if (low < high) - { - /* At each loop iteration, low < high; for indices < low the values - are smaller than ELT; for indices >= high the values are greater - than ELT. So, if the element occurs in the list, it is at - low <= position < high. */ - do - { - size_t mid = low + (high - low) / 2; /* low <= mid < high */ - int cmp = compar (list->elements[mid], elt); - - if (cmp < 0) - low = mid + 1; - else if (cmp > 0) - high = mid; - else /* cmp == 0 */ - { - /* We have an element equal to ELT at index MID. But we need - the minimal such index. */ - high = mid; - /* At each loop iteration, low <= high and - compar (list->elements[high], elt) == 0, - and we know that the first occurrence of the element is at - low <= position <= high. */ - while (low < high) - { - size_t mid2 = low + (high - low) / 2; /* low <= mid2 < high */ - int cmp2 = compar (list->elements[mid2], elt); - - if (cmp2 < 0) - low = mid2 + 1; - else if (cmp2 > 0) - /* The list was not sorted. */ - abort (); - else /* cmp2 == 0 */ - { - if (mid2 == low) - break; - high = mid2 - 1; - } - } - return low; - } - } - while (low < high); - /* Here low == high. */ - } - return (size_t)(-1); -} - -static size_t -gl_array_sortedlist_indexof (gl_list_t list, gl_listelement_compar_fn compar, - const void *elt) -{ - return gl_array_sortedlist_indexof_from_to (list, compar, 0, list->count, - elt); -} - -static gl_list_node_t -gl_array_sortedlist_search_from_to (gl_list_t list, - gl_listelement_compar_fn compar, - size_t low, size_t high, - const void *elt) -{ - size_t index = - gl_array_sortedlist_indexof_from_to (list, compar, low, high, elt); - return INDEX_TO_NODE (index); -} - -static gl_list_node_t -gl_array_sortedlist_search (gl_list_t list, gl_listelement_compar_fn compar, - const void *elt) -{ - size_t index = - gl_array_sortedlist_indexof_from_to (list, compar, 0, list->count, elt); - return INDEX_TO_NODE (index); -} - -static gl_list_node_t -gl_array_sortedlist_add (gl_list_t list, gl_listelement_compar_fn compar, - const void *elt) -{ - size_t count = list->count; - size_t low = 0; - size_t high = count; - - /* At each loop iteration, low <= high; for indices < low the values are - smaller than ELT; for indices >= high the values are greater than ELT. */ - while (low < high) - { - size_t mid = low + (high - low) / 2; /* low <= mid < high */ - int cmp = compar (list->elements[mid], elt); - - if (cmp < 0) - low = mid + 1; - else if (cmp > 0) - high = mid; - else /* cmp == 0 */ - { - low = mid; - break; - } - } - return gl_array_add_at (list, low, elt); -} - -static bool -gl_array_sortedlist_remove (gl_list_t list, gl_listelement_compar_fn compar, - const void *elt) -{ - size_t index = gl_array_sortedlist_indexof (list, compar, elt); - if (index == (size_t)(-1)) - return false; - else - return gl_array_remove_at (list, index); -} - - -const struct gl_list_implementation gl_array_list_implementation = - { - gl_array_create_empty, - gl_array_create, - gl_array_size, - gl_array_node_value, - gl_array_next_node, - gl_array_previous_node, - gl_array_get_at, - gl_array_set_at, - gl_array_search_from_to, - gl_array_indexof_from_to, - gl_array_add_first, - gl_array_add_last, - gl_array_add_before, - gl_array_add_after, - gl_array_add_at, - gl_array_remove_node, - gl_array_remove_at, - gl_array_remove, - gl_array_list_free, - gl_array_iterator, - gl_array_iterator_from_to, - gl_array_iterator_next, - gl_array_iterator_free, - gl_array_sortedlist_search, - gl_array_sortedlist_search_from_to, - gl_array_sortedlist_indexof, - gl_array_sortedlist_indexof_from_to, - gl_array_sortedlist_add, - gl_array_sortedlist_remove - }; diff -ruNp m4-1.4.10/lib/gl_array_list.h m4-1.4.11/lib/gl_array_list.h --- m4-1.4.10/lib/gl_array_list.h 2007-05-30 19:30:24.000000000 -0600 +++ m4-1.4.11/lib/gl_array_list.h 1969-12-31 17:00:00.000000000 -0700 @@ -1,35 +0,0 @@ -/* Sequential list data type implemented by an array. - Copyright (C) 2006 Free Software Foundation, Inc. - Written by Bruno Haible <bruno@clisp.org>, 2006. - - 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 2, 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#ifndef _GL_ARRAY_LIST_H -#define _GL_ARRAY_LIST_H - -#include "gl_list.h" - -#ifdef __cplusplus -extern "C" { -#endif - -extern const struct gl_list_implementation gl_array_list_implementation; -#define GL_ARRAY_LIST &gl_array_list_implementation - -#ifdef __cplusplus -} -#endif - -#endif /* _GL_ARRAY_LIST_H */ diff -ruNp m4-1.4.10/lib/gl_array_oset.c m4-1.4.11/lib/gl_array_oset.c --- m4-1.4.10/lib/gl_array_oset.c 2007-05-30 19:30:24.000000000 -0600 +++ m4-1.4.11/lib/gl_array_oset.c 1969-12-31 17:00:00.000000000 -0700 @@ -1,352 +0,0 @@ -/* Ordered set data type implemented by an array. - Copyright (C) 2006-2007 Free Software Foundation, Inc. - Written by Bruno Haible <bruno@clisp.org>, 2006. - - 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 2, 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#include <config.h> - -/* Specification. */ -#include "gl_array_oset.h" - -#include <stdlib.h> - -#include "xalloc.h" - -/* Checked size_t computations. */ -#include "xsize.h" - -/* -------------------------- gl_oset_t Data Type -------------------------- */ - -/* Concrete gl_oset_impl type, valid for this file only. */ -struct gl_oset_impl -{ - struct gl_oset_impl_base base; - /* An array of ALLOCATED elements, of which the first COUNT are used. - 0 <= COUNT <= ALLOCATED. */ - const void **elements; - size_t count; - size_t allocated; -}; - -static gl_oset_t -gl_array_create_empty (gl_oset_implementation_t implementation, - gl_setelement_compar_fn compar_fn, - gl_setelement_dispose_fn dispose_fn) -{ - struct gl_oset_impl *set = XMALLOC (struct gl_oset_impl); - - set->base.vtable = implementation; - set->base.compar_fn = compar_fn; - set->base.dispose_fn = dispose_fn; - set->elements = NULL; - set->count = 0; - set->allocated = 0; - - return set; -} - -static size_t -gl_array_size (gl_oset_t set) -{ - return set->count; -} - -static size_t -gl_array_indexof (gl_oset_t set, const void *elt) -{ - size_t count = set->count; - - if (count > 0) - { - gl_setelement_compar_fn compar = set->base.compar_fn; - size_t low = 0; - size_t high = count; - - /* At each loop iteration, low < high; for indices < low the values - are smaller than ELT; for indices >= high the values are greater - than ELT. So, if the element occurs in the list, it is at - low <= position < high. */ - do - { - size_t mid = low + (high - low) / 2; /* low <= mid < high */ - int cmp = (compar != NULL - ? compar (set->elements[mid], elt) - : (set->elements[mid] > elt ? 1 : - set->elements[mid] < elt ? -1 : 0)); - - if (cmp < 0) - low = mid + 1; - else if (cmp > 0) - high = mid; - else /* cmp == 0 */ - /* We have an element equal to ELT at index MID. */ - return mid; - } - while (low < high); - } - return (size_t)(-1); -} - -static bool -gl_array_search (gl_oset_t set, const void *elt) -{ - return gl_array_indexof (set, elt) != (size_t)(-1); -} - -static bool -gl_array_search_atleast (gl_oset_t set, - gl_setelement_threshold_fn threshold_fn, - const void *threshold, - const void **eltp) -{ - size_t count = set->count; - - if (count > 0) - { - size_t low = 0; - size_t high = count; - - /* At each loop iteration, low < high; for indices < low the values are - smaller than THRESHOLD; for indices >= high the values are nonexistent. - So, if an element >= THRESHOLD occurs in the list, it is at - low <= position < high. */ - do - { - size_t mid = low + (high - low) / 2; /* low <= mid < high */ - - if (! threshold_fn (set->elements[mid], threshold)) - low = mid + 1; - else - { - /* We have an element >= THRESHOLD at index MID. But we need the - minimal such index. */ - high = mid; - /* At each loop iteration, low <= high and - compar (list->elements[high], value) >= 0, - and we know that the first occurrence of the element is at - low <= position <= high. */ - while (low < high) - { - size_t mid2 = low + (high - low) / 2; /* low <= mid2 < high */ - - if (! threshold_fn (set->elements[mid2], threshold)) - low = mid2 + 1; - else - high = mid2; - } - *eltp = set->elements[low]; - return true; - } - } - while (low < high); - } - return false; -} - -/* Ensure that set->allocated > set->count. */ -static void -grow (gl_oset_t set) -{ - size_t new_allocated; - size_t memory_size; - const void **memory; - - new_allocated = xtimes (set->allocated, 2); - new_allocated = xsum (new_allocated, 1); - memory_size = xtimes (new_allocated, sizeof (const void *)); - if (size_overflow_p (memory_size)) - /* Overflow, would lead to out of memory. */ - xalloc_die (); - memory = (const void **) xrealloc (set->elements, memory_size); - if (memory == NULL) - /* Out of memory. */ - xalloc_die (); - set->elements = memory; - set->allocated = new_allocated; -} - -/* Add the given element ELT at the given position, - 0 <= position <= gl_oset_size (set). */ -static inline void -gl_array_add_at (gl_oset_t set, size_t position, const void *elt) -{ - size_t count = set->count; - const void **elements; - size_t i; - - if (count == set->allocated) - grow (set); - elements = set->elements; - for (i = count; i > position; i--) - elements[i] = elements[i - 1]; - elements[position] = elt; - set->count = count + 1; -} - -/* Remove the element at the given position, - 0 <= position < gl_oset_size (set). */ -static inline void -gl_array_remove_at (gl_oset_t set, size_t position) -{ - size_t count = set->count; - const void **elements; - size_t i; - - elements = set->elements; - if (set->base.dispose_fn != NULL) - set->base.dispose_fn (elements[position]); - for (i = position + 1; i < count; i++) - elements[i - 1] = elements[i]; - set->count = count - 1; -} - -static bool -gl_array_add (gl_oset_t set, const void *elt) -{ - size_t count = set->count; - size_t low = 0; - - if (count > 0) - { - gl_setelement_compar_fn compar = set->base.compar_fn; - size_t high = count; - - /* At each loop iteration, low < high; for indices < low the values - are smaller than ELT; for indices >= high the values are greater - than ELT. So, if the element occurs in the list, it is at - low <= position < high. */ - do - { - size_t mid = low + (high - low) / 2; /* low <= mid < high */ - int cmp = (compar != NULL - ? compar (set->elements[mid], elt) - : (set->elements[mid] > elt ? 1 : - set->elements[mid] < elt ? -1 : 0)); - - if (cmp < 0) - low = mid + 1; - else if (cmp > 0) - high = mid; - else /* cmp == 0 */ - return false; - } - while (low < high); - } - gl_array_add_at (set, low, elt); - return true; -} - -static bool -gl_array_remove (gl_oset_t set, const void *elt) -{ - size_t index = gl_array_indexof (set, elt); - if (index != (size_t)(-1)) - { - gl_array_remove_at (set, index); - return true; - } - else - return false; -} - -static void -gl_array_free (gl_oset_t set) -{ - if (set->elements != NULL) - { - if (set->base.dispose_fn != NULL) - { - size_t count = set->count; - - if (count > 0) - { - gl_setelement_dispose_fn dispose = set->base.dispose_fn; - const void **elements = set->elements; - - do - dispose (*elements++); - while (--count > 0); - } - } - free (set->elements); - } - free (set); -} - -/* --------------------- gl_oset_iterator_t Data Type --------------------- */ - -static gl_oset_iterator_t -gl_array_iterator (gl_oset_t set) -{ - gl_oset_iterator_t result; - - result.vtable = set->base.vtable; - result.set = set; - result.count = set->count; - result.p = set->elements + 0; - result.q = set->elements + set->count; -#ifdef lint - result.i = 0; - result.j = 0; -#endif - - return result; -} - -static bool -gl_array_iterator_next (gl_oset_iterator_t *iterator, const void **eltp) -{ - gl_oset_t set = iterator->set; - if (iterator->count != set->count) - { - if (iterator->count != set->count + 1) - /* Concurrent modifications were done on the set. */ - abort (); - /* The last returned element was removed. */ - iterator->count--; - iterator->p = (const void **) iterator->p - 1; - iterator->q = (const void **) iterator->q - 1; - } - if (iterator->p < iterator->q) - { - const void **p = (const void **) iterator->p; - *eltp = *p; - iterator->p = p + 1; - return true; - } - else - return false; -} - -static void -gl_array_iterator_free (gl_oset_iterator_t *iterator) -{ -} - - -const struct gl_oset_implementation gl_array_oset_implementation = - { - gl_array_create_empty, - gl_array_size, - gl_array_search, - gl_array_search_atleast, - gl_array_add, - gl_array_remove, - gl_array_free, - gl_array_iterator, - gl_array_iterator_next, - gl_array_iterator_free - }; diff -ruNp m4-1.4.10/lib/gl_array_oset.h m4-1.4.11/lib/gl_array_oset.h --- m4-1.4.10/lib/gl_array_oset.h 2007-05-30 19:30:24.000000000 -0600 +++ m4-1.4.11/lib/gl_array_oset.h 1969-12-31 17:00:00.000000000 -0700 @@ -1,35 +0,0 @@ -/* Ordered set data type implemented by an array. - Copyright (C) 2006 Free Software Foundation, Inc. - Written by Bruno Haible <bruno@clisp.org>, 2006. - - 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 2, 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#ifndef _GL_ARRAY_OSET_H -#define _GL_ARRAY_OSET_H - -#include "gl_oset.h" - -#ifdef __cplusplus -extern "C" { -#endif - -extern const struct gl_oset_implementation gl_array_oset_implementation; -#define GL_ARRAY_OSET &gl_array_oset_implementation - -#ifdef __cplusplus -} -#endif - -#endif /* _GL_ARRAY_OSET_H */ diff -ruNp m4-1.4.10/lib/gl_avltree_oset.c m4-1.4.11/lib/gl_avltree_oset.c --- m4-1.4.10/lib/gl_avltree_oset.c 2007-05-30 19:30:24.000000000 -0600 +++ m4-1.4.11/lib/gl_avltree_oset.c 2007-10-09 06:16:30.000000000 -0600 @@ -2,10 +2,10 @@ Copyright (C) 2006-2007 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -13,8 +13,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> diff -ruNp m4-1.4.10/lib/gl_avltree_oset.h m4-1.4.11/lib/gl_avltree_oset.h --- m4-1.4.10/lib/gl_avltree_oset.h 2007-05-30 19:30:25.000000000 -0600 +++ m4-1.4.11/lib/gl_avltree_oset.h 2007-12-01 13:55:24.000000000 -0700 @@ -2,10 +2,10 @@ Copyright (C) 2006 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -13,8 +13,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _GL_AVLTREE_OSET_H #define _GL_AVLTREE_OSET_H diff -ruNp m4-1.4.10/lib/gl_linkedhash_list.c m4-1.4.11/lib/gl_linkedhash_list.c --- m4-1.4.10/lib/gl_linkedhash_list.c 2007-05-30 19:30:25.000000000 -0600 +++ m4-1.4.11/lib/gl_linkedhash_list.c 2008-02-12 20:52:06.000000000 -0700 @@ -1,11 +1,11 @@ /* Sequential list data type implemented by a hash table with a linked list. - Copyright (C) 2006 Free Software Foundation, Inc. + Copyright (C) 2006, 2008 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -13,8 +13,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> @@ -95,6 +94,7 @@ const struct gl_list_implementation gl_l gl_linked_create, gl_linked_size, gl_linked_node_value, + gl_linked_node_set_value, gl_linked_next_node, gl_linked_previous_node, gl_linked_get_at, diff -ruNp m4-1.4.10/lib/gl_linkedhash_list.h m4-1.4.11/lib/gl_linkedhash_list.h --- m4-1.4.10/lib/gl_linkedhash_list.h 2007-05-30 19:30:25.000000000 -0600 +++ m4-1.4.11/lib/gl_linkedhash_list.h 2007-12-01 13:55:25.000000000 -0700 @@ -2,10 +2,10 @@ Copyright (C) 2006 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -13,8 +13,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _GL_LINKEDHASH_LIST_H #define _GL_LINKEDHASH_LIST_H diff -ruNp m4-1.4.10/lib/gl_list.c m4-1.4.11/lib/gl_list.c --- m4-1.4.10/lib/gl_list.c 2007-05-30 19:30:25.000000000 -0600 +++ m4-1.4.11/lib/gl_list.c 2008-02-12 20:52:06.000000000 -0700 @@ -1,11 +1,11 @@ /* Abstract sequential list data type. - Copyright (C) 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2006-2008 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -13,8 +13,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> @@ -64,6 +63,13 @@ gl_list_node_value (gl_list_t list, gl_l ->node_value (list, node); } +void +gl_list_node_set_value (gl_list_t list, gl_list_node_t node, const void *elt) +{ + ((const struct gl_list_impl_base *) list)->vtable + ->node_set_value (list, node, elt); +} + gl_list_node_t gl_list_next_node (gl_list_t list, gl_list_node_t node) { diff -ruNp m4-1.4.10/lib/gl_list.h m4-1.4.11/lib/gl_list.h --- m4-1.4.10/lib/gl_list.h 2007-05-30 19:30:25.000000000 -0600 +++ m4-1.4.11/lib/gl_list.h 2008-02-12 20:52:07.000000000 -0700 @@ -1,11 +1,11 @@ /* Abstract sequential list data type. - Copyright (C) 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2006-2008 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -13,8 +13,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _GL_LIST_H #define _GL_LIST_H @@ -63,6 +62,7 @@ extern "C" { gl_list_size O(1) O(1) O(1) O(1) O(1) gl_list_node_value O(1) O(1) O(1) O(1) O(1) + gl_list_node_set_value O(1) O(1) O(1) O(1) O((log n)²)/O(1) gl_list_next_node O(1) O(1) O(log n) O(1) O(log n) gl_list_previous_node O(1) O(1) O(log n) O(1) O(log n) gl_list_get_at O(1) O(n) O(log n) O(n) O(log n) @@ -159,6 +159,10 @@ extern size_t gl_list_size (gl_list_t li /* Return the element value represented by a list node. */ extern const void * gl_list_node_value (gl_list_t list, gl_list_node_t node); +/* Replace the element value represented by a list node. */ +extern void gl_list_node_set_value (gl_list_t list, gl_list_node_t node, + const void *elt); + /* Return the node immediately after the given node in the list, or NULL if the given node is the last (rightmost) one in the list. */ extern gl_list_node_t gl_list_next_node (gl_list_t list, gl_list_node_t node); @@ -382,6 +386,7 @@ struct gl_list_implementation size_t count, const void **contents); size_t (*size) (gl_list_t list); const void * (*node_value) (gl_list_t list, gl_list_node_t node); + void (*node_set_value) (gl_list_t list, gl_list_node_t node, const void *elt); gl_list_node_t (*next_node) (gl_list_t list, gl_list_node_t node); gl_list_node_t (*previous_node) (gl_list_t list, gl_list_node_t node); const void * (*get_at) (gl_list_t list, size_t position); @@ -490,6 +495,14 @@ gl_list_node_value (gl_list_t list, gl_l ->node_value (list, node); } +# define gl_list_node_set_value gl_list_node_set_value_inline +static inline void +gl_list_node_set_value (gl_list_t list, gl_list_node_t node, const void *elt) +{ + ((const struct gl_list_impl_base *) list)->vtable + ->node_set_value (list, node, elt); +} + # define gl_list_next_node gl_list_next_node_inline static inline gl_list_node_t gl_list_next_node (gl_list_t list, gl_list_node_t node) diff -ruNp m4-1.4.10/lib/gl_oset.c m4-1.4.11/lib/gl_oset.c --- m4-1.4.10/lib/gl_oset.c 2007-05-30 19:30:25.000000000 -0600 +++ m4-1.4.11/lib/gl_oset.c 2007-10-09 06:16:31.000000000 -0600 @@ -2,10 +2,10 @@ Copyright (C) 2006-2007 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -13,8 +13,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> diff -ruNp m4-1.4.10/lib/gl_oset.h m4-1.4.11/lib/gl_oset.h --- m4-1.4.10/lib/gl_oset.h 2007-05-30 19:30:26.000000000 -0600 +++ m4-1.4.11/lib/gl_oset.h 2007-12-01 13:55:25.000000000 -0700 @@ -2,10 +2,10 @@ Copyright (C) 2006-2007 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -13,8 +13,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _GL_OSET_H #define _GL_OSET_H diff -ruNp m4-1.4.10/lib/intprops.h m4-1.4.11/lib/intprops.h --- m4-1.4.10/lib/intprops.h 2007-05-30 19:30:26.000000000 -0600 +++ m4-1.4.11/lib/intprops.h 2007-12-01 13:55:26.000000000 -0700 @@ -2,10 +2,10 @@ Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -13,8 +13,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ diff -ruNp m4-1.4.10/lib/isnan.c m4-1.4.11/lib/isnan.c --- m4-1.4.10/lib/isnan.c 2007-07-05 05:48:08.000000000 -0600 +++ m4-1.4.11/lib/isnan.c 2008-04-01 20:22:49.000000000 -0600 @@ -1,19 +1,18 @@ /* Test for NaN that does not need libm. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007-2008 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ @@ -37,7 +36,7 @@ # define SIZE SIZEOF_LDBL # define L_(literal) literal##L #elif ! defined USE_FLOAT -# define FUNC rpl_isnan +# define FUNC rpl_isnand # define DOUBLE double # define MAX_EXP DBL_MAX_EXP # define MIN_EXP DBL_MIN_EXP @@ -141,7 +140,21 @@ FUNC (DOUBLE x) /* The configuration did not find sufficient information. Give up about the signaling NaNs, handle only the quiet NaNs. */ if (x == x) - return 0; + { +# if defined USE_LONG_DOUBLE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) + /* Detect any special bit patterns that pass ==; see comment above. */ + memory_double m1; + memory_double m2; + + memset (&m1.value, 0, SIZE); + memset (&m2.value, 0, SIZE); + m1.value = x; + m2.value = x + (x ? 0.0L : -0.0L); + if (memcmp (&m1.value, &m2.value, SIZE) != 0) + return 1; +# endif + return 0; + } else return 1; #endif diff -ruNp m4-1.4.10/lib/isnan.h m4-1.4.11/lib/isnan.h --- m4-1.4.10/lib/isnan.h 2007-05-30 19:30:26.000000000 -0600 +++ m4-1.4.11/lib/isnan.h 1969-12-31 17:00:00.000000000 -0700 @@ -1,26 +0,0 @@ -/* Test for NaN that does not need libm. - Copyright (C) 2007 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 2, 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#if HAVE_ISNAN_IN_LIBC -/* Get declaration of isnan macro. */ -# include <math.h> -#else -/* Test whether X is a NaN. */ -# undef isnan -# define isnan rpl_isnan -extern int isnan (double x); -#endif diff -ruNp m4-1.4.10/lib/isnand.c m4-1.4.11/lib/isnand.c --- m4-1.4.10/lib/isnand.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/lib/isnand.c 2008-01-26 16:04:11.000000000 -0700 @@ -0,0 +1,19 @@ +/* Test for NaN that does not need libm. + Copyright (C) 2008 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/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2008. */ + +#include "isnan.c" diff -ruNp m4-1.4.10/lib/isnand.h m4-1.4.11/lib/isnand.h --- m4-1.4.10/lib/isnand.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/lib/isnand.h 2008-01-26 16:04:11.000000000 -0700 @@ -0,0 +1,33 @@ +/* Test for NaN that does not need libm. + Copyright (C) 2007-2008 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/>. */ + +#if HAVE_ISNAND_IN_LIBC +/* Get declaration of isnan macro. */ +# include <math.h> +# if __GNUC__ >= 4 + /* GCC 4.0 and newer provides three built-ins for isnan. */ +# undef isnand +# define isnand(x) __builtin_isnan ((double)(x)) +# else +# undef isnand +# define isnand(x) isnan ((double)(x)) +# endif +#else +/* Test whether X is a NaN. */ +# undef isnand +# define isnand rpl_isnand +extern int isnand (double x); +#endif diff -ruNp m4-1.4.10/lib/isnanf.c m4-1.4.11/lib/isnanf.c --- m4-1.4.10/lib/isnanf.c 2007-05-30 19:30:26.000000000 -0600 +++ m4-1.4.11/lib/isnanf.c 2007-10-09 06:16:32.000000000 -0600 @@ -1,19 +1,18 @@ /* Test for NaN that does not need libm. Copyright (C) 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ diff -ruNp m4-1.4.10/lib/isnanf.h m4-1.4.11/lib/isnanf.h --- m4-1.4.10/lib/isnanf.h 2007-05-30 19:30:27.000000000 -0600 +++ m4-1.4.11/lib/isnanf.h 2008-01-26 16:04:33.000000000 -0700 @@ -1,24 +1,27 @@ /* Test for NaN that does not need libm. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007-2008 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #if HAVE_ISNANF_IN_LIBC /* Get declaration of isnan macro or (older) isnanf function. */ # include <math.h> -# ifdef isnan +# if __GNUC__ >= 4 + /* GCC 4.0 and newer provides three built-ins for isnan. */ +# undef isnanf +# define isnanf(x) __builtin_isnanf ((float)(x)) +# elif defined isnan # undef isnanf # define isnanf(x) isnan ((float)(x)) # endif diff -ruNp m4-1.4.10/lib/isnanl-nolibm.h m4-1.4.11/lib/isnanl-nolibm.h --- m4-1.4.10/lib/isnanl-nolibm.h 2007-05-30 19:30:27.000000000 -0600 +++ m4-1.4.11/lib/isnanl-nolibm.h 2008-01-26 16:04:33.000000000 -0700 @@ -1,24 +1,27 @@ /* Test for NaN that does not need libm. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007-2008 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #if HAVE_ISNANL_IN_LIBC /* Get declaration of isnan macro or (older) isnanl function. */ # include <math.h> -# ifdef isnan +# if __GNUC__ >= 4 + /* GCC 4.0 and newer provides three built-ins for isnan. */ +# undef isnanl +# define isnanl(x) __builtin_isnanl ((long double)(x)) +# elif defined isnan # undef isnanl # define isnanl(x) isnan ((long double)(x)) # endif diff -ruNp m4-1.4.10/lib/isnanl.c m4-1.4.11/lib/isnanl.c --- m4-1.4.10/lib/isnanl.c 2007-05-30 19:30:27.000000000 -0600 +++ m4-1.4.11/lib/isnanl.c 2007-10-09 06:16:33.000000000 -0600 @@ -1,19 +1,18 @@ /* Test for NaN that does not need libm. Copyright (C) 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ diff -ruNp m4-1.4.10/lib/localcharset.c m4-1.4.11/lib/localcharset.c --- m4-1.4.10/lib/localcharset.c 2007-05-30 19:30:27.000000000 -0600 +++ m4-1.4.11/lib/localcharset.c 2007-11-02 12:07:27.000000000 -0600 @@ -4,7 +4,7 @@ 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 2, or (at your option) + the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff -ruNp m4-1.4.10/lib/localcharset.h m4-1.4.11/lib/localcharset.h --- m4-1.4.10/lib/localcharset.h 2007-05-30 19:30:27.000000000 -0600 +++ m4-1.4.11/lib/localcharset.h 2007-12-01 13:55:27.000000000 -0700 @@ -4,7 +4,7 @@ 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 2, or (at your option) + the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff -ruNp m4-1.4.10/lib/lseek.c m4-1.4.11/lib/lseek.c --- m4-1.4.10/lib/lseek.c 2007-05-30 19:30:28.000000000 -0600 +++ m4-1.4.11/lib/lseek.c 2007-11-02 12:07:28.000000000 -0600 @@ -3,7 +3,7 @@ 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 2, or (at your option) + the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -20,9 +20,13 @@ /* Specification. */ #include <unistd.h> -/* Get GetFileType. The replacement lseek is only used on mingw, so - this include can be unconditional. */ -#include <windows.h> +#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +/* Windows platforms. */ +/* Get GetFileType. */ +# include <windows.h> +#else +# include <sys/stat.h> +#endif #include <errno.h> #undef lseek @@ -30,6 +34,7 @@ off_t rpl_lseek (int fd, off_t offset, int whence) { +#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ /* mingw lseek mistakenly succeeds on pipes, sockets, and terminals. */ HANDLE h = (HANDLE) _get_osfhandle (fd); if (h == INVALID_HANDLE_VALUE) @@ -42,5 +47,16 @@ rpl_lseek (int fd, off_t offset, int whe errno = ESPIPE; return -1; } +#else + /* BeOS lseek mistakenly succeeds on pipes... */ + struct stat statbuf; + if (fstat (fd, &statbuf) < 0) + return -1; + if (!S_ISREG (statbuf.st_mode)) + { + errno = ESPIPE; + return -1; + } +#endif return lseek (fd, offset, whence); } diff -ruNp m4-1.4.10/lib/malloc.c m4-1.4.11/lib/malloc.c --- m4-1.4.10/lib/malloc.c 2007-05-30 19:30:28.000000000 -0600 +++ m4-1.4.11/lib/malloc.c 2007-11-02 12:07:28.000000000 -0600 @@ -1,10 +1,10 @@ /* malloc() function that is glibc compatible. - Copyright (C) 1997, 1998, 2006 Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 2006, 2007 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 2, or (at your option) + the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -16,20 +16,42 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -/* written by Jim Meyering */ +/* written by Jim Meyering and Bruno Haible */ #include <config.h> -#undef malloc +/* Only the AC_FUNC_MALLOC macro defines 'malloc' already in config.h. */ +#ifdef malloc +# define NEED_MALLOC_GNU +# undef malloc +#endif +/* Specification. */ #include <stdlib.h> +#include <errno.h> + +/* Call the system's malloc below. */ +#undef malloc + /* Allocate an N-byte block of memory from the heap. If N is zero, allocate a 1-byte block. */ void * rpl_malloc (size_t n) { + void *result; + +#ifdef NEED_MALLOC_GNU if (n == 0) n = 1; - return malloc (n); +#endif + + result = malloc (n); + +#if !HAVE_MALLOC_POSIX + if (result == NULL) + errno = ENOMEM; +#endif + + return result; } diff -ruNp m4-1.4.10/lib/malloca.c m4-1.4.11/lib/malloca.c --- m4-1.4.10/lib/malloca.c 2007-07-04 22:02:40.000000000 -0600 +++ m4-1.4.11/lib/malloca.c 2007-11-02 12:07:28.000000000 -0600 @@ -4,7 +4,7 @@ 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 2, or (at your option) + the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff -ruNp m4-1.4.10/lib/malloca.h m4-1.4.11/lib/malloca.h --- m4-1.4.10/lib/malloca.h 2007-07-04 22:02:40.000000000 -0600 +++ m4-1.4.11/lib/malloca.h 2008-01-03 21:46:23.000000000 -0700 @@ -4,7 +4,7 @@ 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 2, or (at your option) + the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -70,9 +70,19 @@ extern void freea (void *p); # define freea free #endif -/* Maybe we should also define a variant - nmalloca (size_t n, size_t s) - behaves like malloca (n * s) - If this would be useful in your application. please speak up. */ +/* nmalloca(N,S) is an overflow-safe variant of malloca (N * S). + It allocates an array of N objects, each with S bytes of memory, + on the stack. S must be positive and N must be nonnegative. + The array must be freed using freea() before the function returns. */ +#if 1 +/* Cf. the definition of xalloc_oversized. */ +# define nmalloca(n, s) \ + ((n) > (size_t) (sizeof (ptrdiff_t) <= sizeof (size_t) ? -1 : -2) / (s) \ + ? NULL \ + : malloca ((n) * (s))) +#else +extern void * nmalloca (size_t n, size_t s); +#endif #ifdef __cplusplus diff -ruNp m4-1.4.10/lib/math.in.h m4-1.4.11/lib/math.in.h --- m4-1.4.10/lib/math.in.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/lib/math.in.h 2008-03-31 20:59:24.000000000 -0600 @@ -0,0 +1,431 @@ +/* A GNU-like <math.h>. + + Copyright (C) 2002-2003, 2007, 2008 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/>. */ + +#ifndef _GL_MATH_H + +/* The include_next requires a split double-inclusion guard. */ +#@INCLUDE_NEXT@ @NEXT_MATH_H@ + +#ifndef _GL_MATH_H +#define _GL_MATH_H + + +/* The definition of GL_LINK_WARNING is copied here. */ + + +#ifdef __cplusplus +extern "C" { +#endif + + +/* POSIX allows platforms that don't support NAN. But all major + machines in the past 15 years have supported something close to + IEEE NaN, so we define this unconditionally. */ +#ifndef NAN + /* The Compaq (ex-DEC) C 6.4 compiler chokes on the expression 0.0 / 0.0. */ +# ifdef __DECC +static float +_NaN () +{ + static float zero = 0.0f; + return zero / zero; +} +# define NAN (_NaN()) +# else +# define NAN (0.0f / 0.0f) +# endif +#endif + +/* Write x as + x = mantissa * 2^exp + where + If x finite and nonzero: 0.5 <= |mantissa| < 1.0. + If x is zero: mantissa = x, exp = 0. + If x is infinite or NaN: mantissa = x, exp unspecified. + Store exp in *EXPPTR and return mantissa. */ +#if @GNULIB_FREXP@ +# if @REPLACE_FREXP@ +# define frexp rpl_frexp +extern double frexp (double x, int *expptr); +# endif +#elif defined GNULIB_POSIXCHECK +# undef frexp +# define frexp(x,e) \ + (GL_LINK_WARNING ("frexp is unportable - " \ + "use gnulib module frexp for portability"), \ + frexp (x, e)) +#endif + + +#if @GNULIB_MATHL@ || !@HAVE_DECL_ACOSL@ +extern long double acosl (long double x); +#endif +#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK +# undef acosl +# define acosl(x) \ + (GL_LINK_WARNING ("acosl is unportable - " \ + "use gnulib module mathl for portability"), \ + acosl (x)) +#endif + + +#if @GNULIB_MATHL@ || !@HAVE_DECL_ASINL@ +extern long double asinl (long double x); +#endif +#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK +# undef asinl +# define asinl(x) \ + (GL_LINK_WARNING ("asinl is unportable - " \ + "use gnulib module mathl for portability"), \ + asinl (x)) +#endif + + +#if @GNULIB_MATHL@ || !@HAVE_DECL_ATANL@ +extern long double atanl (long double x); +#endif +#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK +# undef atanl +# define atanl(x) \ + (GL_LINK_WARNING ("atanl is unportable - " \ + "use gnulib module mathl for portability"), \ + atanl (x)) +#endif + + +#if @GNULIB_CEILF@ +# if @REPLACE_CEILF@ +# define ceilf rpl_ceilf +extern float ceilf (float x); +# endif +#elif defined GNULIB_POSIXCHECK +# undef ceilf +# define ceilf(x) \ + (GL_LINK_WARNING ("ceilf is unportable - " \ + "use gnulib module ceilf for portability"), \ + ceilf (x)) +#endif + +#if @GNULIB_CEILL@ +# if @REPLACE_CEILL@ +# define ceill rpl_ceill +extern long double ceill (long double x); +# endif +#elif defined GNULIB_POSIXCHECK +# undef ceill +# define ceill(x) \ + (GL_LINK_WARNING ("ceill is unportable - " \ + "use gnulib module ceill for portability"), \ + ceill (x)) +#endif + + +#if @GNULIB_MATHL@ || !@HAVE_DECL_COSL@ +extern long double cosl (long double x); +#endif +#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK +# undef cosl +# define cosl(x) \ + (GL_LINK_WARNING ("cosl is unportable - " \ + "use gnulib module mathl for portability"), \ + cosl (x)) +#endif + + +#if @GNULIB_MATHL@ || !@HAVE_DECL_EXPL@ +extern long double expl (long double x); +#endif +#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK +# undef expl +# define expl(x) \ + (GL_LINK_WARNING ("expl is unportable - " \ + "use gnulib module mathl for portability"), \ + expl (x)) +#endif + + +#if @GNULIB_FLOORF@ +# if @REPLACE_FLOORF@ +# define floorf rpl_floorf +extern float floorf (float x); +# endif +#elif defined GNULIB_POSIXCHECK +# undef floorf +# define floorf(x) \ + (GL_LINK_WARNING ("floorf is unportable - " \ + "use gnulib module floorf for portability"), \ + floorf (x)) +#endif + +#if @GNULIB_FLOORL@ +# if @REPLACE_FLOORL@ +# define floorl rpl_floorl +extern long double floorl (long double x); +# endif +#elif defined GNULIB_POSIXCHECK +# undef floorl +# define floorl(x) \ + (GL_LINK_WARNING ("floorl is unportable - " \ + "use gnulib module floorl for portability"), \ + floorl (x)) +#endif + + +/* Write x as + x = mantissa * 2^exp + where + If x finite and nonzero: 0.5 <= |mantissa| < 1.0. + If x is zero: mantissa = x, exp = 0. + If x is infinite or NaN: mantissa = x, exp unspecified. + Store exp in *EXPPTR and return mantissa. */ +#if @GNULIB_FREXPL@ && @REPLACE_FREXPL@ +# define frexpl rpl_frexpl +#endif +#if (@GNULIB_FREXPL@ && @REPLACE_FREXPL@) || !@HAVE_DECL_FREXPL@ +extern long double frexpl (long double x, int *expptr); +#endif +#if !@GNULIB_FREXPL@ && defined GNULIB_POSIXCHECK +# undef frexpl +# define frexpl(x,e) \ + (GL_LINK_WARNING ("frexpl is unportable - " \ + "use gnulib module frexpl for portability"), \ + frexpl (x, e)) +#endif + + +/* Return x * 2^exp. */ +#if @GNULIB_LDEXPL@ && @REPLACE_LDEXPL@ +# define ldexpl rpl_ldexpl +#endif +#if (@GNULIB_LDEXPL@ && @REPLACE_LDEXPL@) || !@HAVE_DECL_LDEXPL@ +extern long double ldexpl (long double x, int exp); +#endif +#if !@GNULIB_LDEXPL@ && defined GNULIB_POSIXCHECK +# undef ldexpl +# define ldexpl(x,e) \ + (GL_LINK_WARNING ("ldexpl is unportable - " \ + "use gnulib module ldexpl for portability"), \ + ldexpl (x, e)) +#endif + + +#if @GNULIB_MATHL@ || !@HAVE_DECL_LOGL@ +extern long double logl (long double x); +#endif +#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK +# undef logl +# define logl(x) \ + (GL_LINK_WARNING ("logl is unportable - " \ + "use gnulib module mathl for portability"), \ + logl (x)) +#endif + + +#if @GNULIB_ROUNDF@ +# if @REPLACE_ROUNDF@ +# undef roundf +# define roundf rpl_roundf +extern float roundf (float x); +# endif +#elif defined GNULIB_POSIXCHECK +# undef roundf +# define roundf(x) \ + (GL_LINK_WARNING ("roundf is unportable - " \ + "use gnulib module roundf for portability"), \ + roundf (x)) +#endif + +#if @GNULIB_ROUND@ +# if @REPLACE_ROUND@ +# undef round +# define round rpl_round +extern double round (double x); +# endif +#elif defined GNULIB_POSIXCHECK +# undef round +# define round(x) \ + (GL_LINK_WARNING ("round is unportable - " \ + "use gnulib module round for portability"), \ + round (x)) +#endif + +#if @GNULIB_ROUNDL@ +# if @REPLACE_ROUNDL@ +# undef roundl +# define roundl rpl_roundl +extern long double roundl (long double x); +# endif +#elif defined GNULIB_POSIXCHECK +# undef roundl +# define roundl(x) \ + (GL_LINK_WARNING ("roundl is unportable - " \ + "use gnulib module roundl for portability"), \ + roundl (x)) +#endif + + +#if @GNULIB_MATHL@ || !@HAVE_DECL_SINL@ +extern long double sinl (long double x); +#endif +#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK +# undef sinl +# define sinl(x) \ + (GL_LINK_WARNING ("sinl is unportable - " \ + "use gnulib module mathl for portability"), \ + sinl (x)) +#endif + + +#if @GNULIB_MATHL@ || !@HAVE_DECL_SQRTL@ +extern long double sqrtl (long double x); +#endif +#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK +# undef sqrtl +# define sqrtl(x) \ + (GL_LINK_WARNING ("sqrtl is unportable - " \ + "use gnulib module mathl for portability"), \ + sqrtl (x)) +#endif + + +#if @GNULIB_MATHL@ || !@HAVE_DECL_TANL@ +extern long double tanl (long double x); +#endif +#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK +# undef tanl +# define tanl(x) \ + (GL_LINK_WARNING ("tanl is unportable - " \ + "use gnulib module mathl for portability"), \ + tanl (x)) +#endif + + +#if @GNULIB_TRUNCF@ +# if !@HAVE_DECL_TRUNCF@ +# define truncf rpl_truncf +extern float truncf (float x); +# endif +#elif defined GNULIB_POSIXCHECK +# undef truncf +# define truncf(x) \ + (GL_LINK_WARNING ("truncf is unportable - " \ + "use gnulib module truncf for portability"), \ + truncf (x)) +#endif + +#if @GNULIB_TRUNC@ +# if !@HAVE_DECL_TRUNC@ +# define trunc rpl_trunc +extern double trunc (double x); +# endif +#elif defined GNULIB_POSIXCHECK +# undef trunc +# define trunc(x) \ + (GL_LINK_WARNING ("trunc is unportable - " \ + "use gnulib module trunc for portability"), \ + trunc (x)) +#endif + +#if @GNULIB_TRUNCL@ +# if !@HAVE_DECL_TRUNCL@ +# define truncl rpl_truncl +extern long double truncl (long double x); +# endif +#elif defined GNULIB_POSIXCHECK +# undef truncl +# define truncl(x) \ + (GL_LINK_WARNING ("truncl is unportable - " \ + "use gnulib module truncl for portability"), \ + truncl (x)) +#endif + + +#if @GNULIB_ISFINITE@ +# if @REPLACE_ISFINITE@ +extern int gl_isfinitef (float x); +extern int gl_isfinited (double x); +extern int gl_isfinitel (long double x); +# undef isfinite +# define isfinite(x) \ + (sizeof (x) == sizeof (long double) ? gl_isfinitel (x) : \ + sizeof (x) == sizeof (double) ? gl_isfinited (x) : \ + gl_isfinitef (x)) +# endif +#elif defined GNULIB_POSIXCHECK + /* How to override a macro? */ +#endif + + +#if @GNULIB_SIGNBIT@ +# if @REPLACE_SIGNBIT_USING_GCC@ +# undef signbit + /* GCC 4.0 and newer provides three built-ins for signbit. */ +# define signbit(x) \ + (sizeof (x) == sizeof (long double) ? __builtin_signbitl (x) : \ + sizeof (x) == sizeof (double) ? __builtin_signbit (x) : \ + __builtin_signbitf (x)) +# endif +# if @REPLACE_SIGNBIT@ +# undef signbit +extern int gl_signbitf (float arg); +extern int gl_signbitd (double arg); +extern int gl_signbitl (long double arg); +# if __GNUC__ >= 2 && !__STRICT_ANSI__ +# if defined FLT_SIGNBIT_WORD && defined FLT_SIGNBIT_BIT +# define gl_signbitf(arg) \ + ({ union { float _value; \ + unsigned int _word[(sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int)]; \ + } _m; \ + _m._value = (arg); \ + (_m._word[FLT_SIGNBIT_WORD] >> FLT_SIGNBIT_BIT) & 1; \ + }) +# endif +# if defined DBL_SIGNBIT_WORD && defined DBL_SIGNBIT_BIT +# define gl_signbitd(arg) \ + ({ union { double _value; \ + unsigned int _word[(sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)]; \ + } _m; \ + _m._value = (arg); \ + (_m._word[DBL_SIGNBIT_WORD] >> DBL_SIGNBIT_BIT) & 1; \ + }) +# endif +# if defined LDBL_SIGNBIT_WORD && defined LDBL_SIGNBIT_BIT +# define gl_signbitl(arg) \ + ({ union { long double _value; \ + unsigned int _word[(sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)]; \ + } _m; \ + _m._value = (arg); \ + (_m._word[LDBL_SIGNBIT_WORD] >> LDBL_SIGNBIT_BIT) & 1; \ + }) +# endif +# endif +# define signbit(x) \ + (sizeof (x) == sizeof (long double) ? gl_signbitl (x) : \ + sizeof (x) == sizeof (double) ? gl_signbitd (x) : \ + gl_signbitf (x)) +# endif +#elif defined GNULIB_POSIXCHECK + /* How to override a macro? */ +#endif + + +#ifdef __cplusplus +} +#endif + +#endif /* _GL_MATH_H */ +#endif /* _GL_MATH_H */ diff -ruNp m4-1.4.10/lib/math_.h m4-1.4.11/lib/math_.h --- m4-1.4.10/lib/math_.h 2007-07-05 05:48:12.000000000 -0600 +++ m4-1.4.11/lib/math_.h 1969-12-31 17:00:00.000000000 -0700 @@ -1,265 +0,0 @@ -/* A GNU-like <math.h>. - - Copyright (C) 2002-2003, 2007 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 2, 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#ifndef _GL_MATH_H - -/* The include_next requires a split double-inclusion guard. */ -#@INCLUDE_NEXT@ @NEXT_MATH_H@ - -#ifndef _GL_MATH_H -#define _GL_MATH_H - - -/* The definition of GL_LINK_WARNING is copied here. */ - - -#ifdef __cplusplus -extern "C" { -#endif - - -/* Write x as - x = mantissa * 2^exp - where - If x finite and nonzero: 0.5 <= |mantissa| < 1.0. - If x is zero: mantissa = x, exp = 0. - If x is infinite or NaN: mantissa = x, exp unspecified. - Store exp and return mantissa. */ -#if @GNULIB_FREXP@ -# if @REPLACE_FREXP@ -# define frexp rpl_frexp -extern double frexp (double x, int *exp); -# endif -#elif defined GNULIB_POSIXCHECK -# undef frexp -# define frexp(x,e) \ - (GL_LINK_WARNING ("frexp is unportable - " \ - "use gnulib module frexp for portability"), \ - frexp (x, e)) -#endif - - -#if @GNULIB_MATHL@ || !@HAVE_DECL_ACOSL@ -extern long double acosl (long double x); -#endif -#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK -# undef acosl -# define acosl(x) \ - (GL_LINK_WARNING ("acosl is unportable - " \ - "use gnulib module mathl for portability"), \ - acosl (x)) -#endif - -#if @GNULIB_MATHL@ || !@HAVE_DECL_ASINL@ -extern long double asinl (long double x); -#endif -#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK -# undef asinl -# define asinl(x) \ - (GL_LINK_WARNING ("asinl is unportable - " \ - "use gnulib module mathl for portability"), \ - asinl (x)) -#endif - -#if @GNULIB_MATHL@ || !@HAVE_DECL_ATANL@ -extern long double atanl (long double x); -#endif -#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK -# undef atanl -# define atanl(x) \ - (GL_LINK_WARNING ("atanl is unportable - " \ - "use gnulib module mathl for portability"), \ - atanl (x)) -#endif - -#if @GNULIB_MATHL@ || !@HAVE_DECL_CEILL@ -extern long double ceill (long double x); -#endif -#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK -# undef ceill -# define ceill(x) \ - (GL_LINK_WARNING ("ceill is unportable - " \ - "use gnulib module mathl for portability"), \ - ceill (x)) -#endif - -#if @GNULIB_MATHL@ || !@HAVE_DECL_COSL@ -extern long double cosl (long double x); -#endif -#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK -# undef cosl -# define cosl(x) \ - (GL_LINK_WARNING ("cosl is unportable - " \ - "use gnulib module mathl for portability"), \ - cosl (x)) -#endif - -#if @GNULIB_MATHL@ || !@HAVE_DECL_EXPL@ -extern long double expl (long double x); -#endif -#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK -# undef expl -# define expl(x) \ - (GL_LINK_WARNING ("expl is unportable - " \ - "use gnulib module mathl for portability"), \ - expl (x)) -#endif - -#if @GNULIB_MATHL@ || !@HAVE_DECL_FLOORL@ -extern long double floorl (long double x); -#endif -#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK -# undef floorl -# define floorl(x) \ - (GL_LINK_WARNING ("floorl is unportable - " \ - "use gnulib module mathl for portability"), \ - floorl (x)) -#endif - -/* Write x as - x = mantissa * 2^exp - where - If x finite and nonzero: 0.5 <= |mantissa| < 1.0. - If x is zero: mantissa = x, exp = 0. - If x is infinite or NaN: mantissa = x, exp unspecified. - Store exp and return mantissa. */ -#if @GNULIB_FREXPL@ && @REPLACE_FREXPL@ -# define frexpl rpl_frexpl -#endif -#if (@GNULIB_FREXPL@ && @REPLACE_FREXPL@) || !@HAVE_DECL_FREXPL@ -extern long double frexpl (long double x, int *exp); -#endif -#if !@GNULIB_FREXPL@ && defined GNULIB_POSIXCHECK -# undef frexpl -# define frexpl(x,e) \ - (GL_LINK_WARNING ("frexpl is unportable - " \ - "use gnulib module frexpl for portability"), \ - frexpl (x, e)) -#endif - -/* Return x * 2^exp. */ -#if @GNULIB_LDEXPL@ && @REPLACE_LDEXPL@ -# define ldexpl rpl_ldexpl -#endif -#if (@GNULIB_LDEXPL@ && @REPLACE_LDEXPL@) || !@HAVE_DECL_LDEXPL@ -extern long double ldexpl (long double x, int exp); -#endif -#if !@GNULIB_LDEXPL@ && defined GNULIB_POSIXCHECK -# undef ldexpl -# define ldexpl(x,e) \ - (GL_LINK_WARNING ("ldexpl is unportable - " \ - "use gnulib module ldexpl for portability"), \ - ldexpl (x, e)) -#endif - -#if @GNULIB_MATHL@ || !@HAVE_DECL_LOGL@ -extern long double logl (long double x); -#endif -#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK -# undef logl -# define logl(x) \ - (GL_LINK_WARNING ("logl is unportable - " \ - "use gnulib module mathl for portability"), \ - logl (x)) -#endif - -#if @GNULIB_MATHL@ || !@HAVE_DECL_SINL@ -extern long double sinl (long double x); -#endif -#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK -# undef sinl -# define sinl(x) \ - (GL_LINK_WARNING ("sinl is unportable - " \ - "use gnulib module mathl for portability"), \ - sinl (x)) -#endif - -#if @GNULIB_MATHL@ || !@HAVE_DECL_SQRTL@ -extern long double sqrtl (long double x); -#endif -#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK -# undef sqrtl -# define sqrtl(x) \ - (GL_LINK_WARNING ("sqrtl is unportable - " \ - "use gnulib module mathl for portability"), \ - sqrtl (x)) -#endif - -#if @GNULIB_MATHL@ || !@HAVE_DECL_TANL@ -extern long double tanl (long double x); -#endif -#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK -# undef tanl -# define tanl(x) \ - (GL_LINK_WARNING ("tanl is unportable - " \ - "use gnulib module mathl for portability"), \ - tanl (x)) -#endif - - -#if @GNULIB_SIGNBIT@ -# if @REPLACE_SIGNBIT@ -# undef signbit -extern int gl_signbitf (float arg); -extern int gl_signbitd (double arg); -extern int gl_signbitl (long double arg); -# if __GNUC__ >= 2 && !__STRICT_ANSI__ -# if defined FLT_SIGNBIT_WORD && defined FLT_SIGNBIT_BIT -# define gl_signbitf(arg) \ - ({ union { float _value; \ - unsigned int _word[(sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int)]; \ - } _m; \ - _m._value = (arg); \ - (_m._word[FLT_SIGNBIT_WORD] >> FLT_SIGNBIT_BIT) & 1; \ - }) -# endif -# if defined DBL_SIGNBIT_WORD && defined DBL_SIGNBIT_BIT -# define gl_signbitd(arg) \ - ({ union { double _value; \ - unsigned int _word[(sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)]; \ - } _m; \ - _m._value = (arg); \ - (_m._word[DBL_SIGNBIT_WORD] >> DBL_SIGNBIT_BIT) & 1; \ - }) -# endif -# if defined LDBL_SIGNBIT_WORD && defined LDBL_SIGNBIT_BIT -# define gl_signbitl(arg) \ - ({ union { long double _value; \ - unsigned int _word[(sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)]; \ - } _m; \ - _m._value = (arg); \ - (_m._word[LDBL_SIGNBIT_WORD] >> LDBL_SIGNBIT_BIT) & 1; \ - }) -# endif -# endif -# define signbit(x) \ - (sizeof (x) == sizeof (long double) ? gl_signbitl (x) : \ - sizeof (x) == sizeof (double) ? gl_signbitd (x) : \ - gl_signbitf (x)) -# endif -#elif defined GNULIB_POSIXCHECK - /* How to override a macro? */ -#endif - - -#ifdef __cplusplus -} -#endif - -#endif /* _GL_MATH_H */ -#endif /* _GL_MATH_H */ diff -ruNp m4-1.4.10/lib/memchr.c m4-1.4.11/lib/memchr.c --- m4-1.4.10/lib/memchr.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/lib/memchr.c 2008-04-01 18:53:57.000000000 -0600 @@ -0,0 +1,200 @@ +/* Copyright (C) 1991, 1993, 1996, 1997, 1999, 2000, 2003, 2004, 2006 Free + Software Foundation, Inc. + + Based on strlen implementation by Torbjorn Granlund (tege@sics.se), + with help from Dan Sahlin (dan@sics.se) and + commentary by Jim Blandy (jimb@ai.mit.edu); + adaptation to memchr suggested by Dick Karpinski (dick@cca.ucsf.edu), + and implemented by Roland McGrath (roland@ai.mit.edu). + +NOTE: The canonical source of this file is maintained with the GNU C Library. +Bugs can be reported to bug-glibc@prep.ai.mit.edu. + +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 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/>. */ + +#ifndef _LIBC +# include <config.h> +#endif + +#include <string.h> + +#include <stddef.h> + +#if defined _LIBC +# include <memcopy.h> +#else +# define reg_char char +#endif + +#include <limits.h> + +#if HAVE_BP_SYM_H || defined _LIBC +# include <bp-sym.h> +#else +# define BP_SYM(sym) sym +#endif + +#undef memchr +#undef __memchr + +/* Search no more than N bytes of S for C. */ +void * +__memchr (void const *s, int c_in, size_t n) +{ + const unsigned char *char_ptr; + const unsigned long int *longword_ptr; + unsigned long int longword, magic_bits, charmask; + unsigned reg_char c; + int i; + + c = (unsigned char) c_in; + + /* Handle the first few characters by reading one character at a time. + Do this until CHAR_PTR is aligned on a longword boundary. */ + for (char_ptr = (const unsigned char *) s; + n > 0 && (size_t) char_ptr % sizeof longword != 0; + --n, ++char_ptr) + if (*char_ptr == c) + return (void *) char_ptr; + + /* All these elucidatory comments refer to 4-byte longwords, + but the theory applies equally well to any size longwords. */ + + longword_ptr = (const unsigned long int *) char_ptr; + + /* Bits 31, 24, 16, and 8 of this number are zero. Call these bits + the "holes." Note that there is a hole just to the left of + each byte, with an extra at the end: + + bits: 01111110 11111110 11111110 11111111 + bytes: AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD + + The 1-bits make sure that carries propagate to the next 0-bit. + The 0-bits provide holes for carries to fall into. */ + + /* Set MAGIC_BITS to be this pattern of 1 and 0 bits. + Set CHARMASK to be a longword, each of whose bytes is C. */ + + magic_bits = 0xfefefefe; + charmask = c | (c << 8); + charmask |= charmask << 16; +#if 0xffffffffU < ULONG_MAX + magic_bits |= magic_bits << 32; + charmask |= charmask << 32; + if (8 < sizeof longword) + for (i = 64; i < sizeof longword * 8; i *= 2) + { + magic_bits |= magic_bits << i; + charmask |= charmask << i; + } +#endif + magic_bits = (ULONG_MAX >> 1) & (magic_bits | 1); + + /* Instead of the traditional loop which tests each character, + we will test a longword at a time. The tricky part is testing + if *any of the four* bytes in the longword in question are zero. */ + while (n >= sizeof longword) + { + /* We tentatively exit the loop if adding MAGIC_BITS to + LONGWORD fails to change any of the hole bits of LONGWORD. + + 1) Is this safe? Will it catch all the zero bytes? + Suppose there is a byte with all zeros. Any carry bits + propagating from its left will fall into the hole at its + least significant bit and stop. Since there will be no + carry from its most significant bit, the LSB of the + byte to the left will be unchanged, and the zero will be + detected. + + 2) Is this worthwhile? Will it ignore everything except + zero bytes? Suppose every byte of LONGWORD has a bit set + somewhere. There will be a carry into bit 8. If bit 8 + is set, this will carry into bit 16. If bit 8 is clear, + one of bits 9-15 must be set, so there will be a carry + into bit 16. Similarly, there will be a carry into bit + 24. If one of bits 24-30 is set, there will be a carry + into bit 31, so all of the hole bits will be changed. + + The one misfire occurs when bits 24-30 are clear and bit + 31 is set; in this case, the hole at bit 31 is not + changed. If we had access to the processor carry flag, + we could close this loophole by putting the fourth hole + at bit 32! + + So it ignores everything except 128's, when they're aligned + properly. + + 3) But wait! Aren't we looking for C, not zero? + Good point. So what we do is XOR LONGWORD with a longword, + each of whose bytes is C. This turns each byte that is C + into a zero. */ + + longword = *longword_ptr++ ^ charmask; + + /* Add MAGIC_BITS to LONGWORD. */ + if ((((longword + magic_bits) + + /* Set those bits that were unchanged by the addition. */ + ^ ~longword) + + /* Look at only the hole bits. If any of the hole bits + are unchanged, most likely one of the bytes was a + zero. */ + & ~magic_bits) != 0) + { + /* Which of the bytes was C? If none of them were, it was + a misfire; continue the search. */ + + const unsigned char *cp = (const unsigned char *) (longword_ptr - 1); + + if (cp[0] == c) + return (void *) cp; + if (cp[1] == c) + return (void *) &cp[1]; + if (cp[2] == c) + return (void *) &cp[2]; + if (cp[3] == c) + return (void *) &cp[3]; + if (4 < sizeof longword && cp[4] == c) + return (void *) &cp[4]; + if (5 < sizeof longword && cp[5] == c) + return (void *) &cp[5]; + if (6 < sizeof longword && cp[6] == c) + return (void *) &cp[6]; + if (7 < sizeof longword && cp[7] == c) + return (void *) &cp[7]; + if (8 < sizeof longword) + for (i = 8; i < sizeof longword; i++) + if (cp[i] == c) + return (void *) &cp[i]; + } + + n -= sizeof longword; + } + + char_ptr = (const unsigned char *) longword_ptr; + + while (n-- > 0) + { + if (*char_ptr == c) + return (void *) char_ptr; + else + ++char_ptr; + } + + return 0; +} +#ifdef weak_alias +weak_alias (__memchr, BP_SYM (memchr)) +#endif diff -ruNp m4-1.4.10/lib/memcmp.c m4-1.4.11/lib/memcmp.c --- m4-1.4.10/lib/memcmp.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/lib/memcmp.c 2008-04-01 18:53:58.000000000 -0600 @@ -0,0 +1,361 @@ +/* Copyright (C) 1991, 1993, 1995, 1997, 1998, 2003, 2006 Free Software + Foundation, Inc. + + Contributed by Torbjorn Granlund (tege@sics.se). + + NOTE: The canonical source of this file is maintained with the GNU C Library. + Bugs can be reported to bug-glibc@prep.ai.mit.edu. + + 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 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/>. */ + +#ifndef _LIBC +# include <config.h> +#endif + +#include <string.h> + +#undef memcmp + +#ifdef _LIBC + +# include <memcopy.h> +# include <endian.h> + +# if __BYTE_ORDER == __BIG_ENDIAN +# define WORDS_BIGENDIAN +# endif + +#else /* Not in the GNU C library. */ + +# include <sys/types.h> + +/* Type to use for aligned memory operations. + This should normally be the biggest type supported by a single load + and store. Must be an unsigned type. */ +# define op_t unsigned long int +# define OPSIZ (sizeof(op_t)) + +/* Threshold value for when to enter the unrolled loops. */ +# define OP_T_THRES 16 + +/* Type to use for unaligned operations. */ +typedef unsigned char byte; + +# ifndef WORDS_BIGENDIAN +# define MERGE(w0, sh_1, w1, sh_2) (((w0) >> (sh_1)) | ((w1) << (sh_2))) +# else +# define MERGE(w0, sh_1, w1, sh_2) (((w0) << (sh_1)) | ((w1) >> (sh_2))) +# endif + +#endif /* In the GNU C library. */ + +#ifdef WORDS_BIGENDIAN +# define CMP_LT_OR_GT(a, b) ((a) > (b) ? 1 : -1) +#else +# define CMP_LT_OR_GT(a, b) memcmp_bytes ((a), (b)) +#endif + +/* BE VERY CAREFUL IF YOU CHANGE THIS CODE! */ + +/* The strategy of this memcmp is: + + 1. Compare bytes until one of the block pointers is aligned. + + 2. Compare using memcmp_common_alignment or + memcmp_not_common_alignment, regarding the alignment of the other + block after the initial byte operations. The maximum number of + full words (of type op_t) are compared in this way. + + 3. Compare the few remaining bytes. */ + +#ifndef WORDS_BIGENDIAN +/* memcmp_bytes -- Compare A and B bytewise in the byte order of the machine. + A and B are known to be different. + This is needed only on little-endian machines. */ + +# ifdef __GNUC__ +__inline +# endif +static int +memcmp_bytes (long unsigned int a, long unsigned int b) +{ + long int srcp1 = (long int) &a; + long int srcp2 = (long int) &b; + op_t a0, b0; + + do + { + a0 = ((byte *) srcp1)[0]; + b0 = ((byte *) srcp2)[0]; + srcp1 += 1; + srcp2 += 1; + } + while (a0 == b0); + return a0 - b0; +} +#endif + +/* memcmp_common_alignment -- Compare blocks at SRCP1 and SRCP2 with LEN `op_t' + objects (not LEN bytes!). Both SRCP1 and SRCP2 should be aligned for + memory operations on `op_t's. */ +#ifdef __GNUC__ +__inline +#endif +static int +memcmp_common_alignment (long int srcp1, long int srcp2, size_t len) +{ + op_t a0, a1; + op_t b0, b1; + + switch (len % 4) + { + default: /* Avoid warning about uninitialized local variables. */ + case 2: + a0 = ((op_t *) srcp1)[0]; + b0 = ((op_t *) srcp2)[0]; + srcp1 -= 2 * OPSIZ; + srcp2 -= 2 * OPSIZ; + len += 2; + goto do1; + case 3: + a1 = ((op_t *) srcp1)[0]; + b1 = ((op_t *) srcp2)[0]; + srcp1 -= OPSIZ; + srcp2 -= OPSIZ; + len += 1; + goto do2; + case 0: + if (OP_T_THRES <= 3 * OPSIZ && len == 0) + return 0; + a0 = ((op_t *) srcp1)[0]; + b0 = ((op_t *) srcp2)[0]; + goto do3; + case 1: + a1 = ((op_t *) srcp1)[0]; + b1 = ((op_t *) srcp2)[0]; + srcp1 += OPSIZ; + srcp2 += OPSIZ; + len -= 1; + if (OP_T_THRES <= 3 * OPSIZ && len == 0) + goto do0; + /* Fall through. */ + } + + do + { + a0 = ((op_t *) srcp1)[0]; + b0 = ((op_t *) srcp2)[0]; + if (a1 != b1) + return CMP_LT_OR_GT (a1, b1); + + do3: + a1 = ((op_t *) srcp1)[1]; + b1 = ((op_t *) srcp2)[1]; + if (a0 != b0) + return CMP_LT_OR_GT (a0, b0); + + do2: + a0 = ((op_t *) srcp1)[2]; + b0 = ((op_t *) srcp2)[2]; + if (a1 != b1) + return CMP_LT_OR_GT (a1, b1); + + do1: + a1 = ((op_t *) srcp1)[3]; + b1 = ((op_t *) srcp2)[3]; + if (a0 != b0) + return CMP_LT_OR_GT (a0, b0); + + srcp1 += 4 * OPSIZ; + srcp2 += 4 * OPSIZ; + len -= 4; + } + while (len != 0); + + /* This is the right position for do0. Please don't move + it into the loop. */ + do0: + if (a1 != b1) + return CMP_LT_OR_GT (a1, b1); + return 0; +} + +/* memcmp_not_common_alignment -- Compare blocks at SRCP1 and SRCP2 with LEN + `op_t' objects (not LEN bytes!). SRCP2 should be aligned for memory + operations on `op_t', but SRCP1 *should be unaligned*. */ +#ifdef __GNUC__ +__inline +#endif +static int +memcmp_not_common_alignment (long int srcp1, long int srcp2, size_t len) +{ + op_t a0, a1, a2, a3; + op_t b0, b1, b2, b3; + op_t x; + int shl, shr; + + /* Calculate how to shift a word read at the memory operation + aligned srcp1 to make it aligned for comparison. */ + + shl = 8 * (srcp1 % OPSIZ); + shr = 8 * OPSIZ - shl; + + /* Make SRCP1 aligned by rounding it down to the beginning of the `op_t' + it points in the middle of. */ + srcp1 &= -OPSIZ; + + switch (len % 4) + { + default: /* Avoid warning about uninitialized local variables. */ + case 2: + a1 = ((op_t *) srcp1)[0]; + a2 = ((op_t *) srcp1)[1]; + b2 = ((op_t *) srcp2)[0]; + srcp1 -= 1 * OPSIZ; + srcp2 -= 2 * OPSIZ; + len += 2; + goto do1; + case 3: + a0 = ((op_t *) srcp1)[0]; + a1 = ((op_t *) srcp1)[1]; + b1 = ((op_t *) srcp2)[0]; + srcp2 -= 1 * OPSIZ; + len += 1; + goto do2; + case 0: + if (OP_T_THRES <= 3 * OPSIZ && len == 0) + return 0; + a3 = ((op_t *) srcp1)[0]; + a0 = ((op_t *) srcp1)[1]; + b0 = ((op_t *) srcp2)[0]; + srcp1 += 1 * OPSIZ; + goto do3; + case 1: + a2 = ((op_t *) srcp1)[0]; + a3 = ((op_t *) srcp1)[1]; + b3 = ((op_t *) srcp2)[0]; + srcp1 += 2 * OPSIZ; + srcp2 += 1 * OPSIZ; + len -= 1; + if (OP_T_THRES <= 3 * OPSIZ && len == 0) + goto do0; + /* Fall through. */ + } + + do + { + a0 = ((op_t *) srcp1)[0]; + b0 = ((op_t *) srcp2)[0]; + x = MERGE(a2, shl, a3, shr); + if (x != b3) + return CMP_LT_OR_GT (x, b3); + + do3: + a1 = ((op_t *) srcp1)[1]; + b1 = ((op_t *) srcp2)[1]; + x = MERGE(a3, shl, a0, shr); + if (x != b0) + return CMP_LT_OR_GT (x, b0); + + do2: + a2 = ((op_t *) srcp1)[2]; + b2 = ((op_t *) srcp2)[2]; + x = MERGE(a0, shl, a1, shr); + if (x != b1) + return CMP_LT_OR_GT (x, b1); + + do1: + a3 = ((op_t *) srcp1)[3]; + b3 = ((op_t *) srcp2)[3]; + x = MERGE(a1, shl, a2, shr); + if (x != b2) + return CMP_LT_OR_GT (x, b2); + + srcp1 += 4 * OPSIZ; + srcp2 += 4 * OPSIZ; + len -= 4; + } + while (len != 0); + + /* This is the right position for do0. Please don't move + it into the loop. */ + do0: + x = MERGE(a2, shl, a3, shr); + if (x != b3) + return CMP_LT_OR_GT (x, b3); + return 0; +} + +int +rpl_memcmp (const void *s1, const void *s2, size_t len) +{ + op_t a0; + op_t b0; + long int srcp1 = (long int) s1; + long int srcp2 = (long int) s2; + op_t res; + + if (len >= OP_T_THRES) + { + /* There are at least some bytes to compare. No need to test + for LEN == 0 in this alignment loop. */ + while (srcp2 % OPSIZ != 0) + { + a0 = ((byte *) srcp1)[0]; + b0 = ((byte *) srcp2)[0]; + srcp1 += 1; + srcp2 += 1; + res = a0 - b0; + if (res != 0) + return res; + len -= 1; + } + + /* SRCP2 is now aligned for memory operations on `op_t'. + SRCP1 alignment determines if we can do a simple, + aligned compare or need to shuffle bits. */ + + if (srcp1 % OPSIZ == 0) + res = memcmp_common_alignment (srcp1, srcp2, len / OPSIZ); + else + res = memcmp_not_common_alignment (srcp1, srcp2, len / OPSIZ); + if (res != 0) + return res; + + /* Number of bytes remaining in the interval [0..OPSIZ-1]. */ + srcp1 += len & -OPSIZ; + srcp2 += len & -OPSIZ; + len %= OPSIZ; + } + + /* There are just a few bytes to compare. Use byte memory operations. */ + while (len != 0) + { + a0 = ((byte *) srcp1)[0]; + b0 = ((byte *) srcp2)[0]; + srcp1 += 1; + srcp2 += 1; + res = a0 - b0; + if (res != 0) + return res; + len -= 1; + } + + return 0; +} + +#ifdef weak_alias +# undef bcmp +weak_alias (memcmp, bcmp) +#endif diff -ruNp m4-1.4.10/lib/mkdtemp.c m4-1.4.11/lib/mkdtemp.c --- m4-1.4.10/lib/mkdtemp.c 2007-05-30 19:30:28.000000000 -0600 +++ m4-1.4.11/lib/mkdtemp.c 2007-10-09 06:16:34.000000000 -0600 @@ -1,19 +1,18 @@ /* Copyright (C) 1999, 2001-2003, 2006-2007 Free Software Foundation, Inc. This file is part of the GNU C Library. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Extracted from misc/mkdtemp.c. */ diff -ruNp m4-1.4.10/lib/mkstemp-safer.c m4-1.4.11/lib/mkstemp-safer.c --- m4-1.4.10/lib/mkstemp-safer.c 2007-05-30 19:30:28.000000000 -0600 +++ m4-1.4.11/lib/mkstemp-safer.c 2007-10-09 06:16:34.000000000 -0600 @@ -2,10 +2,10 @@ Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -13,8 +13,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ diff -ruNp m4-1.4.10/lib/mkstemp.c m4-1.4.11/lib/mkstemp.c --- m4-1.4.10/lib/mkstemp.c 2007-05-30 19:30:28.000000000 -0600 +++ m4-1.4.11/lib/mkstemp.c 2007-10-09 06:16:35.000000000 -0600 @@ -1,19 +1,18 @@ /* Copyright (C) 1998, 1999, 2001, 2005, 2006, 2007 Free Software Foundation, Inc. This file is derived from the one in the GNU C Library. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #if !_LIBC # include <config.h> diff -ruNp m4-1.4.10/lib/obstack.c m4-1.4.11/lib/obstack.c --- m4-1.4.10/lib/obstack.c 2007-05-30 19:30:29.000000000 -0600 +++ m4-1.4.11/lib/obstack.c 2007-10-09 06:16:35.000000000 -0600 @@ -4,19 +4,18 @@ 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifdef _LIBC # include <obstack.h> diff -ruNp m4-1.4.10/lib/obstack.h m4-1.4.11/lib/obstack.h --- m4-1.4.10/lib/obstack.h 2007-05-30 19:30:29.000000000 -0600 +++ m4-1.4.11/lib/obstack.h 2007-12-01 13:55:28.000000000 -0700 @@ -3,19 +3,18 @@ Free Software Foundation, Inc. This file is part of the GNU C Library. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Summary: diff -ruNp m4-1.4.10/lib/pathmax.h m4-1.4.11/lib/pathmax.h --- m4-1.4.10/lib/pathmax.h 2007-05-30 19:30:29.000000000 -0600 +++ m4-1.4.11/lib/pathmax.h 2007-12-01 13:55:29.000000000 -0700 @@ -3,7 +3,7 @@ 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 2, or (at your option) + the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff -ruNp m4-1.4.10/lib/pipe-safer.c m4-1.4.11/lib/pipe-safer.c --- m4-1.4.10/lib/pipe-safer.c 2007-05-30 19:30:30.000000000 -0600 +++ m4-1.4.11/lib/pipe-safer.c 2007-10-09 06:16:35.000000000 -0600 @@ -1,10 +1,10 @@ /* Invoke pipe, but avoid some glitches. Copyright (C) 2005, 2006 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -12,8 +12,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Jim Meyering. */ diff -ruNp m4-1.4.10/lib/printf-args.c m4-1.4.11/lib/printf-args.c --- m4-1.4.10/lib/printf-args.c 2007-07-05 05:48:14.000000000 -0600 +++ m4-1.4.11/lib/printf-args.c 2007-11-02 12:07:30.000000000 -0600 @@ -3,7 +3,7 @@ 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 2, or (at your option) + the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff -ruNp m4-1.4.10/lib/printf-args.h m4-1.4.11/lib/printf-args.h --- m4-1.4.10/lib/printf-args.h 2007-07-05 05:48:14.000000000 -0600 +++ m4-1.4.11/lib/printf-args.h 2007-12-01 13:55:29.000000000 -0700 @@ -3,7 +3,7 @@ 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 2, or (at your option) + the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff -ruNp m4-1.4.10/lib/printf-frexp.c m4-1.4.11/lib/printf-frexp.c --- m4-1.4.10/lib/printf-frexp.c 2007-05-30 19:30:30.000000000 -0600 +++ m4-1.4.11/lib/printf-frexp.c 2007-10-09 06:16:36.000000000 -0600 @@ -1,19 +1,18 @@ /* Split a double into fraction and mantissa, for hexadecimal printf. Copyright (C) 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> @@ -63,7 +62,7 @@ #endif DOUBLE -FUNC (DOUBLE x, int *exp) +FUNC (DOUBLE x, int *expptr) { int exponent; DECL_ROUNDING @@ -184,6 +183,6 @@ FUNC (DOUBLE x, int *exp) END_ROUNDING (); - *exp = exponent; + *expptr = exponent; return x; } diff -ruNp m4-1.4.10/lib/printf-frexp.h m4-1.4.11/lib/printf-frexp.h --- m4-1.4.10/lib/printf-frexp.h 2007-05-30 19:30:31.000000000 -0600 +++ m4-1.4.11/lib/printf-frexp.h 2007-12-01 13:55:29.000000000 -0700 @@ -1,24 +1,23 @@ /* Split a double into fraction and mantissa, for hexadecimal printf. Copyright (C) 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Write a finite, positive number x as x = mantissa * 2^exp where exp >= DBL_MIN_EXP - 1, mantissa < 2.0, if x is not a denormalized number then mantissa >= 1.0. - Store exp and return mantissa. */ -extern double printf_frexp (double x, int *exp); + Store exp in *EXPPTR and return mantissa. */ +extern double printf_frexp (double x, int *expptr); diff -ruNp m4-1.4.10/lib/printf-frexpl.c m4-1.4.11/lib/printf-frexpl.c --- m4-1.4.10/lib/printf-frexpl.c 2007-05-30 19:30:31.000000000 -0600 +++ m4-1.4.11/lib/printf-frexpl.c 2007-10-09 06:16:36.000000000 -0600 @@ -1,19 +1,18 @@ /* Split a 'long double' into fraction and mantissa, for hexadecimal printf. Copyright (C) 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #define USE_LONG_DOUBLE #include "printf-frexp.c" diff -ruNp m4-1.4.10/lib/printf-frexpl.h m4-1.4.11/lib/printf-frexpl.h --- m4-1.4.10/lib/printf-frexpl.h 2007-05-30 19:30:31.000000000 -0600 +++ m4-1.4.11/lib/printf-frexpl.h 2007-12-01 13:55:30.000000000 -0700 @@ -1,24 +1,23 @@ /* Split a 'long double' into fraction and mantissa, for hexadecimal printf. Copyright (C) 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Write a finite, positive number x as x = mantissa * 2^exp where exp >= LDBL_MIN_EXP - 1, mantissa < 2.0, if x is not a denormalized number then mantissa >= 1.0. - Store exp and return mantissa. */ -extern long double printf_frexpl (long double x, int *exp); + Store exp in *EXPPTR and return mantissa. */ +extern long double printf_frexpl (long double x, int *expptr); diff -ruNp m4-1.4.10/lib/printf-parse.c m4-1.4.11/lib/printf-parse.c --- m4-1.4.10/lib/printf-parse.c 2007-07-05 05:48:16.000000000 -0600 +++ m4-1.4.11/lib/printf-parse.c 2008-01-14 22:04:33.000000000 -0700 @@ -1,9 +1,9 @@ /* Formatted output to strings. - Copyright (C) 1999-2000, 2002-2003, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999-2000, 2002-2003, 2006-2008 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 2, or (at your option) + the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -49,7 +49,7 @@ #include <stddef.h> /* Get intmax_t. */ -#ifdef IN_LIBINTL +#if defined IN_LIBINTL || defined IN_LIBASPRINTF # if HAVE_STDINT_H_WITH_UINTMAX # include <stdint.h> # endif @@ -63,6 +63,9 @@ /* malloc(), realloc(), free(). */ #include <stdlib.h> +/* errno. */ +#include <errno.h> + /* Checked size_t computations. */ #include "xsize.h" @@ -89,7 +92,7 @@ PRINTF_PARSE (const CHAR_T *format, DIRE d->dir = (DIRECTIVE *) malloc (d_allocated * sizeof (DIRECTIVE)); if (d->dir == NULL) /* Out of memory. */ - return -1; + goto out_of_memory_1; a->count = 0; a_allocated = 0; @@ -109,13 +112,13 @@ PRINTF_PARSE (const CHAR_T *format, DIRE memory_size = xtimes (a_allocated, sizeof (argument)); \ if (size_overflow_p (memory_size)) \ /* Overflow, would lead to out of memory. */ \ - goto error; \ + goto out_of_memory; \ memory = (argument *) (a->arg \ ? realloc (a->arg, memory_size) \ : malloc (memory_size)); \ if (memory == NULL) \ /* Out of memory. */ \ - goto error; \ + goto out_of_memory; \ a->arg = memory; \ } \ while (a->count <= n) \ @@ -389,6 +392,44 @@ PRINTF_PARSE (const CHAR_T *format, DIRE } cp++; } +#if defined __APPLE__ && defined __MACH__ + /* On MacOS X 10.3, PRIdMAX is defined as "qd". + We cannot change it to "lld" because PRIdMAX must also + be understood by the system's printf routines. */ + else if (*cp == 'q') + { + if (64 / 8 > sizeof (long)) + { + /* int64_t = long long */ + flags += 16; + } + else + { + /* int64_t = long */ + flags += 8; + } + cp++; + } +#endif +#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ + /* On native Win32, PRIdMAX is defined as "I64d". + We cannot change it to "lld" because PRIdMAX must also + be understood by the system's printf routines. */ + else if (*cp == 'I' && cp[1] == '6' && cp[2] == '4') + { + if (64 / 8 > sizeof (long)) + { + /* __int64 = long long */ + flags += 16; + } + else + { + /* __int64 = long */ + flags += 8; + } + cp += 3; + } +#endif else break; } @@ -539,11 +580,11 @@ PRINTF_PARSE (const CHAR_T *format, DIRE memory_size = xtimes (d_allocated, sizeof (DIRECTIVE)); if (size_overflow_p (memory_size)) /* Overflow, would lead to out of memory. */ - goto error; + goto out_of_memory; memory = (DIRECTIVE *) realloc (d->dir, memory_size); if (memory == NULL) /* Out of memory. */ - goto error; + goto out_of_memory; d->dir = memory; } } @@ -566,6 +607,16 @@ error: free (a->arg); if (d->dir) free (d->dir); + errno = EINVAL; + return -1; + +out_of_memory: + if (a->arg) + free (a->arg); + if (d->dir) + free (d->dir); +out_of_memory_1: + errno = ENOMEM; return -1; } diff -ruNp m4-1.4.10/lib/printf-parse.h m4-1.4.11/lib/printf-parse.h --- m4-1.4.10/lib/printf-parse.h 2007-07-05 05:48:16.000000000 -0600 +++ m4-1.4.11/lib/printf-parse.h 2007-12-01 13:55:30.000000000 -0700 @@ -3,7 +3,7 @@ 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 2, or (at your option) + the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff -ruNp m4-1.4.10/lib/progname.c m4-1.4.11/lib/progname.c --- m4-1.4.10/lib/progname.c 2007-05-30 19:30:32.000000000 -0600 +++ m4-1.4.11/lib/progname.c 1969-12-31 17:00:00.000000000 -0700 @@ -1,50 +0,0 @@ -/* Program name management. - Copyright (C) 2001-2003, 2005-2006 Free Software Foundation, Inc. - Written by Bruno Haible <haible@clisp.cons.org>, 2001. - - 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 2, 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - - -#include <config.h> - -/* Specification. */ -#undef ENABLE_RELOCATABLE /* avoid defining set_program_name as a macro */ -#include "progname.h" - -#include <string.h> - - -/* String containing name the program is called with. - To be initialized by main(). */ -const char *program_name = NULL; - -/* Set program_name, based on argv[0]. */ -void -set_program_name (const char *argv0) -{ - /* libtool creates a temporary executable whose name is sometimes prefixed - with "lt-" (depends on the platform). It also makes argv[0] absolute. - Remove this "<dirname>/.libs/" or "<dirname>/.libs/lt-" prefix here. */ - const char *slash; - const char *base; - - slash = strrchr (argv0, '/'); - base = (slash != NULL ? slash + 1 : argv0); - if (base - argv0 >= 7 && memcmp (base - 7, "/.libs/", 7) == 0) - argv0 = base; - if (strncmp (base, "lt-", 3) == 0) - argv0 = base + 3; - program_name = argv0; -} diff -ruNp m4-1.4.10/lib/progname.h m4-1.4.11/lib/progname.h --- m4-1.4.10/lib/progname.h 2007-05-30 19:30:32.000000000 -0600 +++ m4-1.4.11/lib/progname.h 1969-12-31 17:00:00.000000000 -0700 @@ -1,61 +0,0 @@ -/* Program name management. - Copyright (C) 2001-2004, 2006 Free Software Foundation, Inc. - Written by Bruno Haible <haible@clisp.cons.org>, 2001. - - 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 2, 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#ifndef _PROGNAME_H -#define _PROGNAME_H - -/* Programs using this file should do the following in main(): - set_program_name (argv[0]); - */ - - -#ifdef __cplusplus -extern "C" { -#endif - - -/* String containing name the program is called with. */ -extern const char *program_name; - -/* Set program_name, based on argv[0]. */ -extern void set_program_name (const char *argv0); - -#if ENABLE_RELOCATABLE - -/* Set program_name, based on argv[0], and original installation prefix and - directory, for relocatability. */ -extern void set_program_name_and_installdir (const char *argv0, - const char *orig_installprefix, - const char *orig_installdir); -#undef set_program_name -#define set_program_name(ARG0) \ - set_program_name_and_installdir (ARG0, INSTALLPREFIX, INSTALLDIR) - -/* Return the full pathname of the current executable, based on the earlier - call to set_program_name_and_installdir. Return NULL if unknown. */ -extern char *get_full_program_name (void); - -#endif - - -#ifdef __cplusplus -} -#endif - - -#endif /* _PROGNAME_H */ diff -ruNp m4-1.4.10/lib/quotearg.c m4-1.4.11/lib/quotearg.c --- m4-1.4.10/lib/quotearg.c 2007-05-30 19:30:32.000000000 -0600 +++ m4-1.4.11/lib/quotearg.c 2008-02-16 07:53:06.000000000 -0700 @@ -1,12 +1,12 @@ /* quotearg.c - quote arguments for output - Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2006, 2007 Free - Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2006, 2007, + 2008 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -14,8 +14,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Paul Eggert <eggert@twinsun.com> */ @@ -66,6 +65,9 @@ struct quoting_options /* Basic quoting style. */ enum quoting_style style; + /* Additional flags. Bitwise combination of enum quoting_flags. */ + int flags; + /* Quote the characters indicated by this bit vector even if the quoting style would not normally require them to be quoted. */ unsigned int quote_these_too[(UCHAR_MAX / INT_BITS) + 1]; @@ -78,6 +80,7 @@ char const *const quoting_style_args[] = "shell", "shell-always", "c", + "c-maybe", "escape", "locale", "clocale", @@ -91,6 +94,7 @@ enum quoting_style const quoting_style_v shell_quoting_style, shell_always_quoting_style, c_quoting_style, + c_maybe_quoting_style, escape_quoting_style, locale_quoting_style, clocale_quoting_style @@ -144,6 +148,32 @@ set_char_quoting (struct quoting_options return r; } +/* In O (or in the default if O is null), + set the value of the quoting options flag to I, which can be a + bitwise combination of enum quoting_flags, or 0 for default + behavior. Return the old value. */ +int +set_quoting_flags (struct quoting_options *o, int i) +{ + int r; + if (!o) + o = &default_quoting_options; + r = o->flags; + o->flags = i; + return r; +} + +/* Return quoting options for STYLE, with no extra quoting. */ +static struct quoting_options +quoting_options_from_style (enum quoting_style style) +{ + struct quoting_options o; + o.style = style; + o.flags = 0; + memset (o.quote_these_too, 0, sizeof o.quote_these_too); + return o; +} + /* MSGID approximates a quotation mark. Return its translation if it has one; otherwise, return either it or "\"", depending on S. */ static char const * @@ -156,8 +186,8 @@ gettext_quote (char const *msgid, enum q } /* Place into buffer BUFFER (of size BUFFERSIZE) a quoted version of - argument ARG (of size ARGSIZE), using QUOTING_STYLE and the - non-quoting-style part of O to control quoting. + argument ARG (of size ARGSIZE), using QUOTING_STYLE, FLAGS, and + QUOTE_THESE_TOO to control quoting. Terminate the output with a null character, and return the written size of the output, not counting the terminating null. If BUFFERSIZE is too small to store the output string, return the @@ -165,14 +195,14 @@ gettext_quote (char const *msgid, enum q If ARGSIZE is SIZE_MAX, use the string length of the argument for ARGSIZE. This function acts like quotearg_buffer (BUFFER, BUFFERSIZE, ARG, - ARGSIZE, O), except it uses QUOTING_STYLE instead of the quoting - style specified by O, and O may not be null. */ + ARGSIZE, O), except it breaks O into its component pieces and is + not careful about errno. */ static size_t quotearg_buffer_restyled (char *buffer, size_t buffersize, char const *arg, size_t argsize, - enum quoting_style quoting_style, - struct quoting_options const *o) + enum quoting_style quoting_style, int flags, + unsigned int const *quote_these_too) { size_t i; size_t len = 0; @@ -180,6 +210,7 @@ quotearg_buffer_restyled (char *buffer, size_t quote_string_len = 0; bool backslash_escapes = false; bool unibyte_locale = MB_CUR_MAX == 1; + bool elide_outer_quotes = (flags & QA_ELIDE_OUTER_QUOTES) != 0; #define STORE(c) \ do \ @@ -192,8 +223,13 @@ quotearg_buffer_restyled (char *buffer, switch (quoting_style) { + case c_maybe_quoting_style: + quoting_style = c_quoting_style; + elide_outer_quotes = true; + /* Fall through. */ case c_quoting_style: - STORE ('"'); + if (!elide_outer_quotes) + STORE ('"'); backslash_escapes = true; quote_string = "\""; quote_string_len = 1; @@ -201,6 +237,7 @@ quotearg_buffer_restyled (char *buffer, case escape_quoting_style: backslash_escapes = true; + elide_outer_quotes = false; break; case locale_quoting_style: @@ -228,22 +265,32 @@ quotearg_buffer_restyled (char *buffer, char const *left = gettext_quote (N_("`"), quoting_style); char const *right = gettext_quote (N_("'"), quoting_style); - for (quote_string = left; *quote_string; quote_string++) - STORE (*quote_string); + if (!elide_outer_quotes) + for (quote_string = left; *quote_string; quote_string++) + STORE (*quote_string); backslash_escapes = true; quote_string = right; quote_string_len = strlen (quote_string); } break; + case shell_quoting_style: + quoting_style = shell_always_quoting_style; + elide_outer_quotes = true; + /* Fall through. */ case shell_always_quoting_style: - STORE ('\''); + if (!elide_outer_quotes) + STORE ('\''); quote_string = "'"; quote_string_len = 1; break; - default: + case literal_quoting_style: + elide_outer_quotes = false; break; + + default: + abort (); } for (i = 0; ! (argsize == SIZE_MAX ? arg[i] == '\0' : i == argsize); i++) @@ -255,7 +302,11 @@ quotearg_buffer_restyled (char *buffer, && quote_string_len && i + quote_string_len <= argsize && memcmp (arg + i, quote_string, quote_string_len) == 0) - STORE ('\\'); + { + if (elide_outer_quotes) + goto force_outer_quoting_style; + STORE ('\\'); + } c = arg[i]; switch (c) @@ -263,21 +314,31 @@ quotearg_buffer_restyled (char *buffer, case '\0': if (backslash_escapes) { + if (elide_outer_quotes) + goto force_outer_quoting_style; STORE ('\\'); - STORE ('0'); - STORE ('0'); + if (i + 1 < argsize && '0' <= arg[i + 1] && arg[i + 1] <= '9') + { + STORE ('0'); + STORE ('0'); + } c = '0'; } + else if (flags & QA_ELIDE_NULL_BYTES) + continue; break; case '?': switch (quoting_style) { - case shell_quoting_style: - goto use_shell_always_quoting_style; + case shell_always_quoting_style: + if (elide_outer_quotes) + goto force_outer_quoting_style; + break; case c_quoting_style: - if (i + 2 < argsize && arg[i + 1] == '?') + if ((flags & QA_SPLIT_TRIGRAPHS) + && i + 2 < argsize && arg[i + 1] == '?') switch (arg[i + 2]) { case '!': case '\'': @@ -285,10 +346,13 @@ quotearg_buffer_restyled (char *buffer, case '<': case '=': case '>': /* Escape the second '?' in what would otherwise be a trigraph. */ + if (elide_outer_quotes) + goto force_outer_quoting_style; c = arg[i + 2]; i += 2; STORE ('?'); - STORE ('\\'); + STORE ('"'); + STORE ('"'); STORE ('?'); break; @@ -309,11 +373,17 @@ quotearg_buffer_restyled (char *buffer, case '\r': esc = 'r'; goto c_and_shell_escape; case '\t': esc = 't'; goto c_and_shell_escape; case '\v': esc = 'v'; goto c_escape; - case '\\': esc = c; goto c_and_shell_escape; + case '\\': esc = c; + /* No need to escape the escape if we are trying to elide + outer quotes and nothing else is problematic. */ + if (backslash_escapes && elide_outer_quotes && quote_string_len) + goto store_c; c_and_shell_escape: - if (quoting_style == shell_quoting_style) - goto use_shell_always_quoting_style; + if (quoting_style == shell_always_quoting_style + && elide_outer_quotes) + goto force_outer_quoting_style; + /* Fall through. */ c_escape: if (backslash_escapes) { @@ -343,24 +413,19 @@ quotearg_buffer_restyled (char *buffer, be the first bytes of multibyte characters, which means we should check them with mbrtowc, but in practice this doesn't happen so it's not worth worrying about. */ - if (quoting_style == shell_quoting_style) - goto use_shell_always_quoting_style; + if (quoting_style == shell_always_quoting_style + && elide_outer_quotes) + goto force_outer_quoting_style; break; case '\'': - switch (quoting_style) + if (quoting_style == shell_always_quoting_style) { - case shell_quoting_style: - goto use_shell_always_quoting_style; - - case shell_always_quoting_style: + if (elide_outer_quotes) + goto force_outer_quoting_style; STORE ('\''); STORE ('\\'); STORE ('\''); - break; - - default: - break; } break; @@ -432,7 +497,8 @@ quotearg_buffer_restyled (char *buffer, that is really the 2nd byte of a multibyte character. In practice the problem is limited to ASCII chars >= '@' that are shell special chars. */ - if ('[' == 0x5b && quoting_style == shell_quoting_style) + if ('[' == 0x5b && elide_outer_quotes + && quoting_style == shell_always_quoting_style) { size_t j; for (j = 1; j < bytes; j++) @@ -440,7 +506,7 @@ quotearg_buffer_restyled (char *buffer, { case '[': case '\\': case '^': case '`': case '|': - goto use_shell_always_quoting_style; + goto force_outer_quoting_style; default: break; @@ -465,6 +531,8 @@ quotearg_buffer_restyled (char *buffer, { if (backslash_escapes && ! printable) { + if (elide_outer_quotes) + goto force_outer_quoting_style; STORE ('\\'); STORE ('0' + (c >> 6)); STORE ('0' + ((c >> 3) & 7)); @@ -481,21 +549,25 @@ quotearg_buffer_restyled (char *buffer, } } - if (! (backslash_escapes - && o->quote_these_too[c / INT_BITS] & (1 << (c % INT_BITS)))) + if (! ((backslash_escapes || elide_outer_quotes) + && quote_these_too + && quote_these_too[c / INT_BITS] & (1 << (c % INT_BITS)))) goto store_c; store_escape: + if (elide_outer_quotes) + goto force_outer_quoting_style; STORE ('\\'); store_c: STORE (c); } - if (i == 0 && quoting_style == shell_quoting_style) - goto use_shell_always_quoting_style; + if (len == 0 && quoting_style == shell_always_quoting_style + && elide_outer_quotes) + goto force_outer_quoting_style; - if (quote_string) + if (quote_string && !elide_outer_quotes) for (; *quote_string; quote_string++) STORE (*quote_string); @@ -503,9 +575,12 @@ quotearg_buffer_restyled (char *buffer, buffer[len] = '\0'; return len; - use_shell_always_quoting_style: + force_outer_quoting_style: + /* Don't reuse quote_these_too, since the addition of outer quotes + sufficiently quotes the specified characters. */ return quotearg_buffer_restyled (buffer, buffersize, arg, argsize, - shell_always_quoting_style, o); + quoting_style, + flags & ~QA_ELIDE_OUTER_QUOTES, NULL); } /* Place into buffer BUFFER (of size BUFFERSIZE) a quoted version of @@ -525,22 +600,41 @@ quotearg_buffer (char *buffer, size_t bu struct quoting_options const *p = o ? o : &default_quoting_options; int e = errno; size_t r = quotearg_buffer_restyled (buffer, buffersize, arg, argsize, - p->style, p); + p->style, p->flags, p->quote_these_too); errno = e; return r; } -/* Like quotearg_buffer (..., ARG, ARGSIZE, O), except return newly - allocated storage containing the quoted string. */ +/* Equivalent to quotearg_alloc (ARG, ARGSIZE, NULL, O). */ char * quotearg_alloc (char const *arg, size_t argsize, struct quoting_options const *o) { + return quotearg_alloc_mem (arg, argsize, NULL, o); +} + +/* Like quotearg_buffer (..., ARG, ARGSIZE, O), except return newly + allocated storage containing the quoted string, and store the + resulting size into *SIZE, if non-NULL. The result can contain + embedded null bytes only if ARGSIZE is not SIZE_MAX, SIZE is not + NULL, and set_quoting_flags has not set the null byte elision + flag. */ +char * +quotearg_alloc_mem (char const *arg, size_t argsize, size_t *size, + struct quoting_options const *o) +{ + struct quoting_options const *p = o ? o : &default_quoting_options; int e = errno; - size_t bufsize = quotearg_buffer (0, 0, arg, argsize, o) + 1; + /* Elide embedded null bytes if we can't return a size. */ + int flags = p->flags | (size ? 0 : QA_ELIDE_NULL_BYTES); + size_t bufsize = quotearg_buffer_restyled (0, 0, arg, argsize, p->style, + flags, p->quote_these_too) + 1; char *buf = xcharalloc (bufsize); - quotearg_buffer (buf, bufsize, arg, argsize, o); + quotearg_buffer_restyled (buf, bufsize, arg, argsize, p->style, flags, + p->quote_these_too); errno = e; + if (size) + *size = bufsize - 1; return buf; } @@ -622,7 +716,11 @@ quotearg_n_options (int n, char const *a { size_t size = sv[n].size; char *val = sv[n].val; - size_t qsize = quotearg_buffer (val, size, arg, argsize, options); + /* Elide embedded null bytes since we don't return a size. */ + int flags = options->flags | QA_ELIDE_NULL_BYTES; + size_t qsize = quotearg_buffer_restyled (val, size, arg, argsize, + options->style, flags, + options->quote_these_too); if (size <= qsize) { @@ -630,7 +728,8 @@ quotearg_n_options (int n, char const *a if (val != slot0) free (val); sv[n].val = val = xcharalloc (size); - quotearg_buffer (val, size, arg, argsize, options); + quotearg_buffer_restyled (val, size, arg, argsize, options->style, + flags, options->quote_these_too); } errno = e; @@ -645,19 +744,21 @@ quotearg_n (int n, char const *arg) } char * +quotearg_n_mem (int n, char const *arg, size_t argsize) +{ + return quotearg_n_options (n, arg, argsize, &default_quoting_options); +} + +char * quotearg (char const *arg) { return quotearg_n (0, arg); } -/* Return quoting options for STYLE, with no extra quoting. */ -static struct quoting_options -quoting_options_from_style (enum quoting_style style) +char * +quotearg_mem (char const *arg, size_t argsize) { - struct quoting_options o; - o.style = style; - memset (o.quote_these_too, 0, sizeof o.quote_these_too); - return o; + return quotearg_n_mem (0, arg, argsize); } char * @@ -682,12 +783,24 @@ quotearg_style (enum quoting_style s, ch } char * -quotearg_char (char const *arg, char ch) +quotearg_style_mem (enum quoting_style s, char const *arg, size_t argsize) +{ + return quotearg_n_style_mem (0, s, arg, argsize); +} + +char * +quotearg_char_mem (char const *arg, size_t argsize, char ch) { struct quoting_options options; options = default_quoting_options; set_char_quoting (&options, ch, 1); - return quotearg_n_options (0, arg, SIZE_MAX, &options); + return quotearg_n_options (0, arg, argsize, &options); +} + +char * +quotearg_char (char const *arg, char ch) +{ + return quotearg_char_mem (arg, SIZE_MAX, ch); } char * @@ -695,3 +808,9 @@ quotearg_colon (char const *arg) { return quotearg_char (arg, ':'); } + +char * +quotearg_colon_mem (char const *arg, size_t argsize) +{ + return quotearg_char_mem (arg, argsize, ':'); +} diff -ruNp m4-1.4.10/lib/quotearg.h m4-1.4.11/lib/quotearg.h --- m4-1.4.10/lib/quotearg.h 2007-05-30 19:30:32.000000000 -0600 +++ m4-1.4.11/lib/quotearg.h 2008-02-16 07:53:06.000000000 -0700 @@ -1,12 +1,12 @@ /* quotearg.h - quote arguments for output - Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2006 Free + Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2006, 2008 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -14,8 +14,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Paul Eggert <eggert@twinsun.com> */ @@ -24,36 +23,163 @@ # include <stddef.h> -/* Basic quoting styles. */ +/* Basic quoting styles. For each style, an example is given on the + input strings "simple", "\0 \t\n'\"\033?""?/\\", and "a:b", using + quotearg_buffer, quotearg_mem, and quotearg_colon_mem with that + style and the default flags and quoted characters. Note that the + examples are shown here as valid C strings rather than what + displays on a terminal (with "??/" as a trigraph for "\\"). */ enum quoting_style { - /* Output names as-is (ls --quoting-style=literal). */ + /* Output names as-is (ls --quoting-style=literal). Can result in + embedded null bytes if QA_ELIDE_NULL_BYTES is not in + effect. + + quotearg_buffer: + "simple", "\0 \t\n'\"\033??/\\", "a:b" + quotearg: + "simple", " \t\n'\"\033??/\\", "a:b" + quotearg_colon: + "simple", " \t\n'\"\033??/\\", "a:b" + */ literal_quoting_style, /* Quote names for the shell if they contain shell metacharacters - or would cause ambiguous output (ls --quoting-style=shell). */ + or would cause ambiguous output (ls --quoting-style=shell). + Can result in embedded null bytes if QA_ELIDE_NULL_BYTES is not + in effect. + + quotearg_buffer: + "simple", "'\0 \t\n'\\''\"\033??/\\'", "a:b" + quotearg: + "simple", "' \t\n'\\''\"\033??/\\'", "a:b" + quotearg_colon: + "simple", "' \t\n'\\''\"\033??/\\'", "'a:b'" + */ shell_quoting_style, /* Quote names for the shell, even if they would normally not - require quoting (ls --quoting-style=shell-always). */ + require quoting (ls --quoting-style=shell-always). Can result + in embedded null bytes if QA_ELIDE_NULL_BYTES is not in effect. + Behaves like shell_quoting_style if QA_ELIDE_OUTER_QUOTES is in + effect. + + quotearg_buffer: + "'simple'", "'\0 \t\n'\\''\"\033??/\\'", "'a:b'" + quotearg: + "'simple'", "' \t\n'\\''\"\033??/\\'", "'a:b'" + quotearg_colon: + "'simple'", "' \t\n'\\''\"\033??/\\'", "'a:b'" + */ shell_always_quoting_style, - /* Quote names as for a C language string (ls --quoting-style=c). */ + /* Quote names as for a C language string (ls --quoting-style=c). + Behaves like c_maybe_quoting_style if QA_ELIDE_OUTER_QUOTES is + in effect. Split into consecutive strings if + QA_SPLIT_TRIGRAPHS. + + quotearg_buffer: + "\"simple\"", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "\"a:b\"" + quotearg: + "\"simple\"", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "\"a:b\"" + quotearg_colon: + "\"simple\"", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "\"a\\:b\"" + */ c_quoting_style, /* Like c_quoting_style except omit the surrounding double-quote - characters (ls --quoting-style=escape). */ + characters if no quoted characters are encountered. + + quotearg_buffer: + "simple", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "a:b" + quotearg: + "simple", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "a:b" + quotearg_colon: + "simple", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "\"a:b\"" + */ + c_maybe_quoting_style, + + /* Like c_quoting_style except always omit the surrounding + double-quote characters (ls --quoting-style=escape). + + quotearg_buffer: + "simple", "\\0 \\t\\n'\"\\033??/\\\\", "a:b" + quotearg: + "simple", "\\0 \\t\\n'\"\\033??/\\\\", "a:b" + quotearg_colon: + "simple", "\\0 \\t\\n'\"\\033??/\\\\", "a\\:b" + */ escape_quoting_style, /* Like clocale_quoting_style, but quote `like this' instead of - "like this" in the default C locale (ls --quoting-style=locale). */ + "like this" in the default C locale (ls --quoting-style=locale). + + LC_MESSAGES=C + quotearg_buffer: + "`simple'", "`\\0 \\t\\n\\'\"\\033??/\\\\'", "`a:b'" + quotearg: + "`simple'", "`\\0 \\t\\n\\'\"\\033??/\\\\'", "`a:b'" + quotearg_colon: + "`simple'", "`\\0 \\t\\n\\'\"\\033??/\\\\'", "`a\\:b'" + + LC_MESSAGES=pt_PT.utf8 + quotearg_buffer: + "\302\253simple\302\273", + "\302\253\\0 \\t\\n'\"\\033??/\\\\\302\253", "\302\253a:b\302\273" + quotearg: + "\302\253simple\302\273", + "\302\253\\0 \\t\\n'\"\\033??/\\\\\302\253", "\302\253a:b\302\273" + quotearg_colon: + "\302\253simple\302\273", + "\302\253\\0 \\t\\n'\"\\033??/\\\\\302\253", "\302\253a\\:b\302\273" + */ locale_quoting_style, /* Like c_quoting_style except use quotation marks appropriate for - the locale (ls --quoting-style=clocale). */ + the locale (ls --quoting-style=clocale). + + LC_MESSAGES=C + quotearg_buffer: + "\"simple\"", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "\"a:b\"" + quotearg: + "\"simple\"", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "\"a:b\"" + quotearg_colon: + "\"simple\"", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "\"a\\:b\"" + + LC_MESSAGES=pt_PT.utf8 + quotearg_buffer: + "\302\253simple\302\273", + "\302\253\\0 \\t\\n'\"\\033??/\\\\\302\253", "\302\253a:b\302\273" + quotearg: + "\302\253simple\302\273", + "\302\253\\0 \\t\\n'\"\\033??/\\\\\302\253", "\302\253a:b\302\273" + quotearg_colon: + "\302\253simple\302\273", + "\302\253\\0 \\t\\n'\"\\033??/\\\\\302\253", "\302\253a\\:b\302\273" + */ clocale_quoting_style }; +/* Flags for use in set_quoting_flags. */ +enum quoting_flags + { + /* Always elide null bytes from styles that do not quote them, + even when the length of the result is available to the + caller. */ + QA_ELIDE_NULL_BYTES = 0x01, + + /* Omit the surrounding quote characters if no escaped characters + are encountered. Note that if no other character needs + escaping, then neither does the escape character. */ + QA_ELIDE_OUTER_QUOTES = 0x02, + + /* In the c_quoting_style and c_maybe_quoting_style, split ANSI + trigraph sequences into concatenated strings (for example, + "?""?/" rather than "??/", which could be confused with + "\\"). */ + QA_SPLIT_TRIGRAPHS = 0x04 + }; + /* For now, --quoting-style=literal is the default, but this may change. */ # ifndef DEFAULT_QUOTING_STYLE # define DEFAULT_QUOTING_STYLE literal_quoting_style @@ -87,6 +213,12 @@ void set_quoting_style (struct quoting_o it would not otherwise be quoted). */ int set_char_quoting (struct quoting_options *o, char c, int i); +/* In O (or in the default if O is null), + set the value of the quoting options flag to I, which can be a + bitwise combination of enum quoting_flags, or 0 for default + behavior. Return the old value. */ +int set_quoting_flags (struct quoting_options *o, int i); + /* Place into buffer BUFFER (of size BUFFERSIZE) a quoted version of argument ARG (of size ARGSIZE), using O to control quoting. If O is null, use the default. @@ -94,26 +226,49 @@ int set_char_quoting (struct quoting_opt size of the output, not counting the terminating null. If BUFFERSIZE is too small to store the output string, return the value that would have been returned had BUFFERSIZE been large enough. - If ARGSIZE is -1, use the string length of the argument for ARGSIZE. */ + If ARGSIZE is -1, use the string length of the argument for ARGSIZE. + On output, BUFFER might contain embedded null bytes if ARGSIZE was + not -1, the style of O does not use backslash escapes, and the + flags of O do not request elision of null bytes.*/ size_t quotearg_buffer (char *buffer, size_t buffersize, char const *arg, size_t argsize, struct quoting_options const *o); /* Like quotearg_buffer, except return the result in a newly allocated - buffer. It is the caller's responsibility to free the result. */ + buffer. It is the caller's responsibility to free the result. The + result will not contain embedded null bytes. */ char *quotearg_alloc (char const *arg, size_t argsize, struct quoting_options const *o); +/* Like quotearg_alloc, except that the length of the result, + excluding the terminating null byte, is stored into SIZE if it is + non-NULL. The result might contain embedded null bytes if ARGSIZE + was not -1, SIZE was not NULL, the style of O does not use + backslash escapes, and the flags of O do not request elision of + null bytes.*/ +char *quotearg_alloc_mem (char const *arg, size_t argsize, + size_t *size, struct quoting_options const *o); + /* Use storage slot N to return a quoted version of the string ARG. Use the default quoting options. The returned value points to static storage that can be reused by the next call to this function with the same value of N. - N must be nonnegative. */ + N must be nonnegative. The output of all functions in the + quotearg_n family are guaranteed to not contain embedded null + bytes.*/ char *quotearg_n (int n, char const *arg); /* Equivalent to quotearg_n (0, ARG). */ char *quotearg (char const *arg); +/* Use storage slot N to return a quoted version of the argument ARG + of size ARGSIZE. This is like quotearg_n (N, ARG), except it can + quote null bytes. */ +char *quotearg_n_mem (int n, char const *arg, size_t argsize); + +/* Equivalent to quotearg_n_mem (0, ARG, ARGSIZE). */ +char *quotearg_mem (char const *arg, size_t argsize); + /* Use style S and storage slot N to return a quoted version of the string ARG. This is like quotearg_n (N, ARG), except that it uses S with no other options to specify the quoting method. */ @@ -128,12 +283,22 @@ char *quotearg_n_style_mem (int n, enum /* Equivalent to quotearg_n_style (0, S, ARG). */ char *quotearg_style (enum quoting_style s, char const *arg); +/* Equivalent to quotearg_n_style_mem (0, S, ARG, ARGSIZE). */ +char *quotearg_style_mem (enum quoting_style s, + char const *arg, size_t argsize); + /* Like quotearg (ARG), except also quote any instances of CH. */ char *quotearg_char (char const *arg, char ch); +/* Like quotearg_char (ARG, CH), except it can quote null bytes. */ +char *quotearg_char_mem (char const *arg, size_t argsize, char ch); + /* Equivalent to quotearg_char (ARG, ':'). */ char *quotearg_colon (char const *arg); +/* Like quotearg_colon (ARG), except it can quote null bytes. */ +char *quotearg_colon_mem (char const *arg, size_t argsize); + /* Free any dynamically allocated memory. */ void quotearg_free (void); diff -ruNp m4-1.4.10/lib/ref-add.sin m4-1.4.11/lib/ref-add.sin --- m4-1.4.10/lib/ref-add.sin 2007-05-30 19:30:33.000000000 -0600 +++ m4-1.4.11/lib/ref-add.sin 2007-11-02 12:07:32.000000000 -0600 @@ -4,7 +4,7 @@ # # 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 2, or (at your option) +# the Free Software Foundation; either version 3, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, diff -ruNp m4-1.4.10/lib/ref-del.sin m4-1.4.11/lib/ref-del.sin --- m4-1.4.10/lib/ref-del.sin 2007-05-30 19:30:33.000000000 -0600 +++ m4-1.4.11/lib/ref-del.sin 2007-11-02 12:07:32.000000000 -0600 @@ -4,7 +4,7 @@ # # 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 2, or (at your option) +# the Free Software Foundation; either version 3, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, diff -ruNp m4-1.4.10/lib/regcomp.c m4-1.4.11/lib/regcomp.c --- m4-1.4.10/lib/regcomp.c 2007-05-30 19:30:33.000000000 -0600 +++ m4-1.4.11/lib/regcomp.c 2007-12-01 11:58:20.000000000 -0700 @@ -5,7 +5,7 @@ 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 2, or (at your option) + the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -1049,7 +1049,7 @@ optimize_utf8 (re_dfa_t *dfa) mb_chars = true; break; case ANCHOR: - switch (dfa->nodes[node].opr.idx) + switch (dfa->nodes[node].opr.ctx_type) { case LINE_FIRST: case LINE_LAST: diff -ruNp m4-1.4.10/lib/regex.c m4-1.4.11/lib/regex.c --- m4-1.4.10/lib/regex.c 2007-05-30 19:30:34.000000000 -0600 +++ m4-1.4.11/lib/regex.c 2007-11-02 12:07:33.000000000 -0600 @@ -5,7 +5,7 @@ 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 2, or (at your option) + the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff -ruNp m4-1.4.10/lib/regex.h m4-1.4.11/lib/regex.h --- m4-1.4.10/lib/regex.h 2007-05-30 19:30:34.000000000 -0600 +++ m4-1.4.11/lib/regex.h 2007-12-01 13:55:31.000000000 -0700 @@ -6,7 +6,7 @@ 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 2, or (at your option) + the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff -ruNp m4-1.4.10/lib/regex_internal.c m4-1.4.11/lib/regex_internal.c --- m4-1.4.10/lib/regex_internal.c 2007-05-30 19:30:34.000000000 -0600 +++ m4-1.4.11/lib/regex_internal.c 2007-11-02 12:07:33.000000000 -0600 @@ -6,7 +6,7 @@ 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 2, or (at your option) + the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff -ruNp m4-1.4.10/lib/regex_internal.h m4-1.4.11/lib/regex_internal.h --- m4-1.4.10/lib/regex_internal.h 2007-07-05 05:48:20.000000000 -0600 +++ m4-1.4.11/lib/regex_internal.h 2007-12-01 13:55:32.000000000 -0700 @@ -5,7 +5,7 @@ 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 2, or (at your option) + the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff -ruNp m4-1.4.10/lib/regexec.c m4-1.4.11/lib/regexec.c --- m4-1.4.10/lib/regexec.c 2007-05-30 19:30:35.000000000 -0600 +++ m4-1.4.11/lib/regexec.c 2007-11-02 12:07:34.000000000 -0600 @@ -6,7 +6,7 @@ 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 2, or (at your option) + the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff -ruNp m4-1.4.10/lib/signal.in.h m4-1.4.11/lib/signal.in.h --- m4-1.4.10/lib/signal.in.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/lib/signal.in.h 2007-12-01 13:55:32.000000000 -0700 @@ -0,0 +1,97 @@ +/* A GNU-like <signal.h>. + + Copyright (C) 2006-2007 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/>. */ + +#if defined __need_sig_atomic_t || defined __need_sigset_t +/* Special invocation convention inside glibc header files. */ + +# @INCLUDE_NEXT@ @NEXT_SIGNAL_H@ + +#else +/* Normal invocation convention. */ + +#ifndef _GL_SIGNAL_H + +/* The include_next requires a split double-inclusion guard. */ +#@INCLUDE_NEXT@ @NEXT_SIGNAL_H@ + +#ifndef _GL_SIGNAL_H +#define _GL_SIGNAL_H + +/* The definition of GL_LINK_WARNING is copied here. */ + + +#ifdef __cplusplus +extern "C" { +#endif + + +#if !@HAVE_POSIX_SIGNALBLOCKING@ + +/* Mingw defines sigset_t not in <signal.h>, but in <sys/types.h>. */ +# include <sys/types.h> + +/* Maximum signal number + 1. */ +# ifndef NSIG +# define NSIG 32 +# endif + +/* This code supports only 32 signals. */ +typedef int verify_NSIG_constraint[2 * (NSIG <= 32) - 1]; + +/* A set or mask of signals. */ +# if !@HAVE_SIGSET_T@ +typedef unsigned int sigset_t; +# endif + +/* Test whether a given signal is contained in a signal set. */ +extern int sigismember (const sigset_t *set, int sig); + +/* Initialize a signal set to the empty set. */ +extern int sigemptyset (sigset_t *set); + +/* Add a signal to a signal set. */ +extern int sigaddset (sigset_t *set, int sig); + +/* Remove a signal from a signal set. */ +extern int sigdelset (sigset_t *set, int sig); + +/* Fill a signal set with all possible signals. */ +extern int sigfillset (sigset_t *set); + +/* Return the set of those blocked signals that are pending. */ +extern int sigpending (sigset_t *set); + +/* If OLD_SET is not NULL, put the current set of blocked signals in *OLD_SET. + Then, if SET is not NULL, affect the current set of blocked signals by + combining it with *SET as indicated in OPERATION. + In this implementation, you are not allowed to change a signal handler + while the signal is blocked. */ +# define SIG_BLOCK 0 /* blocked_set = blocked_set | *set; */ +# define SIG_SETMASK 1 /* blocked_set = *set; */ +# define SIG_UNBLOCK 2 /* blocked_set = blocked_set & ~*set; */ +extern int sigprocmask (int operation, const sigset_t *set, sigset_t *old_set); + +#endif + + +#ifdef __cplusplus +} +#endif + +#endif /* _GL_SIGNAL_H */ +#endif /* _GL_SIGNAL_H */ +#endif diff -ruNp m4-1.4.10/lib/signal_.h m4-1.4.11/lib/signal_.h --- m4-1.4.10/lib/signal_.h 2007-07-05 05:48:20.000000000 -0600 +++ m4-1.4.11/lib/signal_.h 1969-12-31 17:00:00.000000000 -0700 @@ -1,98 +0,0 @@ -/* A GNU-like <signal.h>. - - Copyright (C) 2006-2007 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 2, 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#if defined __need_sig_atomic_t || defined __need_sigset_t -/* Special invocation convention inside glibc header files. */ - -# @INCLUDE_NEXT@ @NEXT_SIGNAL_H@ - -#else -/* Normal invocation convention. */ - -#ifndef _GL_SIGNAL_H - -/* The include_next requires a split double-inclusion guard. */ -#@INCLUDE_NEXT@ @NEXT_SIGNAL_H@ - -#ifndef _GL_SIGNAL_H -#define _GL_SIGNAL_H - -/* The definition of GL_LINK_WARNING is copied here. */ - - -#ifdef __cplusplus -extern "C" { -#endif - - -#if !@HAVE_POSIX_SIGNALBLOCKING@ - -/* Mingw defines sigset_t not in <signal.h>, but in <sys/types.h>. */ -# include <sys/types.h> - -/* Maximum signal number + 1. */ -# ifndef NSIG -# define NSIG 32 -# endif - -/* This code supports only 32 signals. */ -typedef int verify_NSIG_constraint[2 * (NSIG <= 32) - 1]; - -/* A set or mask of signals. */ -# if !@HAVE_SIGSET_T@ -typedef unsigned int sigset_t; -# endif - -/* Test whether a given signal is contained in a signal set. */ -extern int sigismember (const sigset_t *set, int sig); - -/* Initialize a signal set to the empty set. */ -extern int sigemptyset (sigset_t *set); - -/* Add a signal to a signal set. */ -extern int sigaddset (sigset_t *set, int sig); - -/* Remove a signal from a signal set. */ -extern int sigdelset (sigset_t *set, int sig); - -/* Fill a signal set with all possible signals. */ -extern int sigfillset (sigset_t *set); - -/* Return the set of those blocked signals that are pending. */ -extern int sigpending (sigset_t *set); - -/* If OLD_SET is not NULL, put the current set of blocked signals in *OLD_SET. - Then, if SET is not NULL, affect the current set of blocked signals by - combining it with *SET as indicated in OPERATION. - In this implementation, you are not allowed to change a signal handler - while the signal is blocked. */ -# define SIG_BLOCK 0 /* blocked_set = blocked_set | *set; */ -# define SIG_SETMASK 1 /* blocked_set = *set; */ -# define SIG_UNBLOCK 2 /* blocked_set = blocked_set & ~*set; */ -extern int sigprocmask (int operation, const sigset_t *set, sigset_t *old_set); - -#endif - - -#ifdef __cplusplus -} -#endif - -#endif /* _GL_SIGNAL_H */ -#endif /* _GL_SIGNAL_H */ -#endif diff -ruNp m4-1.4.10/lib/signbitd.c m4-1.4.11/lib/signbitd.c --- m4-1.4.10/lib/signbitd.c 2007-05-30 19:30:35.000000000 -0600 +++ m4-1.4.11/lib/signbitd.c 2008-01-26 16:04:46.000000000 -0700 @@ -1,19 +1,18 @@ /* signbit() macro: Determine the sign bit of a floating-point number. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007-2008 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> @@ -21,7 +20,7 @@ #include <math.h> #include <string.h> -#include "isnan.h" +#include "isnand.h" #include "float+.h" #undef gl_signbitd @@ -46,7 +45,7 @@ gl_signbitd (double arg) #else /* This does not do the right thing for NaN, but this is irrelevant for most use cases. */ - if (isnan (arg)) + if (isnand (arg)) return 0; if (arg < 0.0) return 1; diff -ruNp m4-1.4.10/lib/signbitf.c m4-1.4.11/lib/signbitf.c --- m4-1.4.10/lib/signbitf.c 2007-05-30 19:30:35.000000000 -0600 +++ m4-1.4.11/lib/signbitf.c 2007-10-09 06:16:40.000000000 -0600 @@ -1,19 +1,18 @@ /* signbit() macro: Determine the sign bit of a floating-point number. Copyright (C) 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> diff -ruNp m4-1.4.10/lib/signbitl.c m4-1.4.11/lib/signbitl.c --- m4-1.4.10/lib/signbitl.c 2007-05-30 19:30:36.000000000 -0600 +++ m4-1.4.11/lib/signbitl.c 2007-10-09 06:16:40.000000000 -0600 @@ -1,19 +1,18 @@ /* signbit() macro: Determine the sign bit of a floating-point number. Copyright (C) 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> diff -ruNp m4-1.4.10/lib/sigprocmask.c m4-1.4.11/lib/sigprocmask.c --- m4-1.4.10/lib/sigprocmask.c 2007-05-30 19:30:36.000000000 -0600 +++ m4-1.4.11/lib/sigprocmask.c 2007-10-09 06:16:40.000000000 -0600 @@ -2,10 +2,10 @@ Copyright (C) 2006-2007 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -13,8 +13,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> diff -ruNp m4-1.4.10/lib/size_max.h m4-1.4.11/lib/size_max.h --- m4-1.4.10/lib/size_max.h 2007-05-30 19:30:36.000000000 -0600 +++ m4-1.4.11/lib/size_max.h 2007-12-01 13:55:33.000000000 -0700 @@ -4,7 +4,7 @@ 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 2, or (at your option) + the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff -ruNp m4-1.4.10/lib/stdarg.in.h m4-1.4.11/lib/stdarg.in.h --- m4-1.4.10/lib/stdarg.in.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/lib/stdarg.in.h 2008-03-13 06:40:52.000000000 -0600 @@ -0,0 +1,31 @@ +/* Substitute for and wrapper around <stdarg.h>. + Copyright (C) 2008 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, 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, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef _GL_STDARG_H + +/* The include_next requires a split double-inclusion guard. */ +#@INCLUDE_NEXT@ @NEXT_STDARG_H@ + +#ifndef _GL_STDARG_H +#define _GL_STDARG_H + +#ifndef va_copy +# define va_copy(a,b) ((a) = (b)) +#endif + +#endif /* _GL_STDARG_H */ +#endif /* _GL_STDARG_H */ diff -ruNp m4-1.4.10/lib/stdbool.in.h m4-1.4.11/lib/stdbool.in.h --- m4-1.4.10/lib/stdbool.in.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/lib/stdbool.in.h 2007-12-01 13:55:33.000000000 -0700 @@ -0,0 +1,119 @@ +/* Copyright (C) 2001, 2002, 2003, 2006, 2007 Free Software Foundation, Inc. + Written by Bruno Haible <haible@clisp.cons.org>, 2001. + + 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, 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, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef _GL_STDBOOL_H +#define _GL_STDBOOL_H + +/* ISO C 99 <stdbool.h> for platforms that lack it. */ + +/* Usage suggestions: + + Programs that use <stdbool.h> should be aware of some limitations + and standards compliance issues. + + Standards compliance: + + - <stdbool.h> must be #included before 'bool', 'false', 'true' + can be used. + + - You cannot assume that sizeof (bool) == 1. + + - Programs should not undefine the macros bool, true, and false, + as C99 lists that as an "obsolescent feature". + + Limitations of this substitute, when used in a C89 environment: + + - <stdbool.h> must be #included before the '_Bool' type can be used. + + - You cannot assume that _Bool is a typedef; it might be a macro. + + - Bit-fields of type 'bool' are not supported. Portable code + should use 'unsigned int foo : 1;' rather than 'bool foo : 1;'. + + - In C99, casts and automatic conversions to '_Bool' or 'bool' are + performed in such a way that every nonzero value gets converted + to 'true', and zero gets converted to 'false'. This doesn't work + with this substitute. With this substitute, only the values 0 and 1 + give the expected result when converted to _Bool' or 'bool'. + + Also, it is suggested that programs use 'bool' rather than '_Bool'; + this isn't required, but 'bool' is more common. */ + + +/* 7.16. Boolean type and values */ + +/* BeOS <sys/socket.h> already #defines false 0, true 1. We use the same + definitions below, but temporarily we have to #undef them. */ +#ifdef __BEOS__ +# include <OS.h> /* defines bool but not _Bool */ +# undef false +# undef true +#endif + +/* For the sake of symbolic names in gdb, we define true and false as + enum constants, not only as macros. + It is tempting to write + typedef enum { false = 0, true = 1 } _Bool; + so that gdb prints values of type 'bool' symbolically. But if we do + this, values of type '_Bool' may promote to 'int' or 'unsigned int' + (see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int' + (see ISO C 99 6.3.1.1.(2)). So we add a negative value to the + enum; this ensures that '_Bool' promotes to 'int'. */ +#if defined __cplusplus || defined __BEOS__ + /* A compiler known to have 'bool'. */ + /* If the compiler already has both 'bool' and '_Bool', we can assume they + are the same types. */ +# if !@HAVE__BOOL@ +typedef bool _Bool; +# endif +#else +# if !defined __GNUC__ + /* If @HAVE__BOOL@: + Some HP-UX cc and AIX IBM C compiler versions have compiler bugs when + the built-in _Bool type is used. See + http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html + http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html + http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html + Similar bugs are likely with other compilers as well; this file + wouldn't be used if <stdbool.h> was working. + So we override the _Bool type. + If !@HAVE__BOOL@: + Need to define _Bool ourselves. As 'signed char' or as an enum type? + Use of a typedef, with SunPRO C, leads to a stupid + "warning: _Bool is a keyword in ISO C99". + Use of an enum type, with IRIX cc, leads to a stupid + "warning(1185): enumerated type mixed with another type". + Even the existence of an enum type, without a typedef, + "Invalid enumerator. (badenum)" with HP-UX cc on Tru64. + The only benefit of the enum, debuggability, is not important + with these compilers. So use 'signed char' and no enum. */ +# define _Bool signed char +# else + /* With this compiler, trust the _Bool type if the compiler has it. */ +# if !@HAVE__BOOL@ +typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool; +# endif +# endif +#endif +#define bool _Bool + +/* The other macros must be usable in preprocessor directives. */ +#define false 0 +#define true 1 +#define __bool_true_false_are_defined 1 + +#endif /* _GL_STDBOOL_H */ diff -ruNp m4-1.4.10/lib/stdbool_.h m4-1.4.11/lib/stdbool_.h --- m4-1.4.10/lib/stdbool_.h 2007-05-30 19:30:37.000000000 -0600 +++ m4-1.4.11/lib/stdbool_.h 1969-12-31 17:00:00.000000000 -0700 @@ -1,118 +0,0 @@ -/* Copyright (C) 2001, 2002, 2003, 2006, 2007 Free Software Foundation, Inc. - Written by Bruno Haible <haible@clisp.cons.org>, 2001. - - 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 2, 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#ifndef _GL_STDBOOL_H -#define _GL_STDBOOL_H - -/* ISO C 99 <stdbool.h> for platforms that lack it. */ - -/* Usage suggestions: - - Programs that use <stdbool.h> should be aware of some limitations - and standards compliance issues. - - Standards compliance: - - - <stdbool.h> must be #included before 'bool', 'false', 'true' - can be used. - - - You cannot assume that sizeof (bool) == 1. - - - Programs should not undefine the macros bool, true, and false, - as C99 lists that as an "obsolescent feature". - - Limitations of this substitute, when used in a C89 environment: - - - <stdbool.h> must be #included before the '_Bool' type can be used. - - - You cannot assume that _Bool is a typedef; it might be a macro. - - - Bit-fields of type 'bool' are not supported. Portable code - should use 'unsigned int foo : 1;' rather than 'bool foo : 1;'. - - - In C99, casts and automatic conversions to '_Bool' or 'bool' are - performed in such a way that every nonzero value gets converted - to 'true', and zero gets converted to 'false'. This doesn't work - with this substitute. With this substitute, only the values 0 and 1 - give the expected result when converted to _Bool' or 'bool'. - - Also, it is suggested that programs use 'bool' rather than '_Bool'; - this isn't required, but 'bool' is more common. */ - - -/* 7.16. Boolean type and values */ - -/* BeOS <sys/socket.h> already #defines false 0, true 1. We use the same - definitions below, but temporarily we have to #undef them. */ -#ifdef __BEOS__ -# include <OS.h> /* defines bool but not _Bool */ -# undef false -# undef true -#endif - -/* For the sake of symbolic names in gdb, we define true and false as - enum constants, not only as macros. - It is tempting to write - typedef enum { false = 0, true = 1 } _Bool; - so that gdb prints values of type 'bool' symbolically. But if we do - this, values of type '_Bool' may promote to 'int' or 'unsigned int' - (see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int' - (see ISO C 99 6.3.1.1.(2)). So we add a negative value to the - enum; this ensures that '_Bool' promotes to 'int'. */ -#if defined __cplusplus || defined __BEOS__ - /* A compiler known to have 'bool'. */ - /* If the compiler already has both 'bool' and '_Bool', we can assume they - are the same types. */ -# if !@HAVE__BOOL@ -typedef bool _Bool; -# endif -#else -# if !defined __GNUC__ - /* If @HAVE__BOOL@: - Some HP-UX cc and AIX IBM C compiler versions have compiler bugs when - the built-in _Bool type is used. See - http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html - http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html - http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html - Similar bugs are likely with other compilers as well; this file - wouldn't be used if <stdbool.h> was working. - So we override the _Bool type. - If !@HAVE__BOOL@: - Need to define _Bool ourselves. As 'signed char' or as an enum type? - Use of a typedef, with SunPRO C, leads to a stupid - "warning: _Bool is a keyword in ISO C99". - Use of an enum type, with IRIX cc, leads to a stupid - "warning(1185): enumerated type mixed with another type". - The only benefit of the enum type, debuggability, is not important - with these compilers. So use 'signed char' and no typedef. */ -# define _Bool signed char -enum { false = 0, true = 1 }; -# else - /* With this compiler, trust the _Bool type if the compiler has it. */ -# if !@HAVE__BOOL@ -typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool; -# endif -# endif -#endif -#define bool _Bool - -/* The other macros must be usable in preprocessor directives. */ -#define false 0 -#define true 1 -#define __bool_true_false_are_defined 1 - -#endif /* _GL_STDBOOL_H */ diff -ruNp m4-1.4.10/lib/stdint.in.h m4-1.4.11/lib/stdint.in.h --- m4-1.4.10/lib/stdint.in.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/lib/stdint.in.h 2007-12-20 21:53:36.000000000 -0700 @@ -0,0 +1,522 @@ +/* Copyright (C) 2001-2002, 2004-2007 Free Software Foundation, Inc. + Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood. + This file is part of gnulib. + + 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, 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, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* + * ISO C 99 <stdint.h> for platforms that lack it. + * <http://www.opengroup.org/susv3xbd/stdint.h.html> + */ + +#ifndef _GL_STDINT_H + +/* When including a system file that in turn includes <inttypes.h>, + use the system <inttypes.h>, not our substitute. This avoids + problems with (for example) VMS, whose <sys/bitypes.h> includes + <inttypes.h>. */ +#define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H + +/* Get those types that are already defined in other system include + files, so that we can "#define int8_t signed char" below without + worrying about a later system include file containing a "typedef + signed char int8_t;" that will get messed up by our macro. Our + macros should all be consistent with the system versions, except + for the "fast" types and macros, which we recommend against using + in public interfaces due to compiler differences. */ + +#if @HAVE_STDINT_H@ +# if defined __sgi && ! defined __c99 + /* Bypass IRIX's <stdint.h> if in C89 mode, since it merely annoys users + with "This header file is to be used only for c99 mode compilations" + diagnostics. */ +# define __STDINT_H__ +# endif + /* Other systems may have an incomplete or buggy <stdint.h>. + Include it before <inttypes.h>, since any "#include <stdint.h>" + in <inttypes.h> would reinclude us, skipping our contents because + _GL_STDINT_H is defined. + The include_next requires a split double-inclusion guard. */ +# @INCLUDE_NEXT@ @NEXT_STDINT_H@ +#endif + +#if ! defined _GL_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H +#define _GL_STDINT_H + +/* <sys/types.h> defines some of the stdint.h types as well, on glibc, + IRIX 6.5, and OpenBSD 3.8 (via <machine/types.h>). + AIX 5.2 <sys/types.h> isn't needed and causes troubles. + MacOS X 10.4.6 <sys/types.h> includes <stdint.h> (which is us), but + relies on the system <stdint.h> definitions, so include + <sys/types.h> after @NEXT_STDINT_H@. */ +#if @HAVE_SYS_TYPES_H@ && ! defined _AIX +# include <sys/types.h> +#endif + +/* Get LONG_MIN, LONG_MAX, ULONG_MAX. */ +#include <limits.h> + +#if @HAVE_INTTYPES_H@ + /* In OpenBSD 3.8, <inttypes.h> includes <machine/types.h>, which defines + int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__. + <inttypes.h> also defines intptr_t and uintptr_t. */ +# include <inttypes.h> +#elif @HAVE_SYS_INTTYPES_H@ + /* Solaris 7 <sys/inttypes.h> has the types except the *_fast*_t types, and + the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX. */ +# include <sys/inttypes.h> +#endif + +#if @HAVE_SYS_BITYPES_H@ && ! defined __BIT_TYPES_DEFINED__ + /* Linux libc4 >= 4.6.7 and libc5 have a <sys/bitypes.h> that defines + int{8,16,32,64}_t and __BIT_TYPES_DEFINED__. In libc5 >= 5.2.2 it is + included by <sys/types.h>. */ +# include <sys/bitypes.h> +#endif + +#if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS + +/* Get WCHAR_MIN, WCHAR_MAX. */ +# if ! (defined WCHAR_MIN && defined WCHAR_MAX) +# include <wchar.h> +# endif + +#endif + +#undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H + +/* Minimum and maximum values for a integer type under the usual assumption. + Return an unspecified value if BITS == 0, adding a check to pacify + picky compilers. */ + +#define _STDINT_MIN(signed, bits, zero) \ + ((signed) ? (- ((zero) + 1) << ((bits) ? (bits) - 1 : 0)) : (zero)) + +#define _STDINT_MAX(signed, bits, zero) \ + ((signed) \ + ? ~ _STDINT_MIN (signed, bits, zero) \ + : /* The expression for the unsigned case. The subtraction of (signed) \ + is a nop in the unsigned case and avoids "signed integer overflow" \ + warnings in the signed case. */ \ + ((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1) + +/* 7.18.1.1. Exact-width integer types */ + +/* Here we assume a standard architecture where the hardware integer + types have 8, 16, 32, optionally 64 bits. */ + +#undef int8_t +#undef uint8_t +#define int8_t signed char +#define uint8_t unsigned char + +#undef int16_t +#undef uint16_t +#define int16_t short int +#define uint16_t unsigned short int + +#undef int32_t +#undef uint32_t +#define int32_t int +#define uint32_t unsigned int + +/* Do not undefine int64_t if gnulib is not being used with 64-bit + types, since otherwise it breaks platforms like Tandem/NSK. */ +#if LONG_MAX >> 31 >> 31 == 1 +# undef int64_t +# define int64_t long int +# define GL_INT64_T +#elif defined _MSC_VER +# undef int64_t +# define int64_t __int64 +# define GL_INT64_T +#elif @HAVE_LONG_LONG_INT@ +# undef int64_t +# define int64_t long long int +# define GL_INT64_T +#endif + +#if ULONG_MAX >> 31 >> 31 >> 1 == 1 +# undef uint64_t +# define uint64_t unsigned long int +# define GL_UINT64_T +#elif defined _MSC_VER +# undef uint64_t +# define uint64_t unsigned __int64 +# define GL_UINT64_T +#elif @HAVE_UNSIGNED_LONG_LONG_INT@ +# undef uint64_t +# define uint64_t unsigned long long int +# define GL_UINT64_T +#endif + +/* Avoid collision with Solaris 2.5.1 <pthread.h> etc. */ +#define _UINT8_T +#define _UINT32_T +#define _UINT64_T + + +/* 7.18.1.2. Minimum-width integer types */ + +/* Here we assume a standard architecture where the hardware integer + types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types + are the same as the corresponding N_t types. */ + +#undef int_least8_t +#undef uint_least8_t +#undef int_least16_t +#undef uint_least16_t +#undef int_least32_t +#undef uint_least32_t +#undef int_least64_t +#undef uint_least64_t +#define int_least8_t int8_t +#define uint_least8_t uint8_t +#define int_least16_t int16_t +#define uint_least16_t uint16_t +#define int_least32_t int32_t +#define uint_least32_t uint32_t +#ifdef GL_INT64_T +# define int_least64_t int64_t +#endif +#ifdef GL_UINT64_T +# define uint_least64_t uint64_t +#endif + +/* 7.18.1.3. Fastest minimum-width integer types */ + +/* Note: Other <stdint.h> substitutes may define these types differently. + It is not recommended to use these types in public header files. */ + +/* Here we assume a standard architecture where the hardware integer + types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types + are taken from the same list of types. Assume that 'long int' + is fast enough for all narrower integers. */ + +#undef int_fast8_t +#undef uint_fast8_t +#undef int_fast16_t +#undef uint_fast16_t +#undef int_fast32_t +#undef uint_fast32_t +#undef int_fast64_t +#undef uint_fast64_t +#define int_fast8_t long int +#define uint_fast8_t unsigned int_fast8_t +#define int_fast16_t long int +#define uint_fast16_t unsigned int_fast16_t +#define int_fast32_t long int +#define uint_fast32_t unsigned int_fast32_t +#ifdef GL_INT64_T +# define int_fast64_t int64_t +#endif +#ifdef GL_UINT64_T +# define uint_fast64_t uint64_t +#endif + +/* 7.18.1.4. Integer types capable of holding object pointers */ + +#undef intptr_t +#undef uintptr_t +#define intptr_t long int +#define uintptr_t unsigned long int + +/* 7.18.1.5. Greatest-width integer types */ + +/* Note: These types are compiler dependent. It may be unwise to use them in + public header files. */ + +#undef intmax_t +#if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 +# define intmax_t long long int +#elif defined GL_INT64_T +# define intmax_t int64_t +#else +# define intmax_t long int +#endif + +#undef uintmax_t +#if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 +# define uintmax_t unsigned long long int +#elif defined GL_UINT64_T +# define uintmax_t uint64_t +#else +# define uintmax_t unsigned long int +#endif + +/* Verify that intmax_t and uintmax_t have the same size. Too much code + breaks if this is not the case. If this check fails, the reason is likely + to be found in the autoconf macros. */ +typedef int _verify_intmax_size[2 * (sizeof (intmax_t) == sizeof (uintmax_t)) - 1]; + +/* 7.18.2. Limits of specified-width integer types */ + +#if ! defined __cplusplus || defined __STDC_LIMIT_MACROS + +/* 7.18.2.1. Limits of exact-width integer types */ + +/* Here we assume a standard architecture where the hardware integer + types have 8, 16, 32, optionally 64 bits. */ + +#undef INT8_MIN +#undef INT8_MAX +#undef UINT8_MAX +#define INT8_MIN (~ INT8_MAX) +#define INT8_MAX 127 +#define UINT8_MAX 255 + +#undef INT16_MIN +#undef INT16_MAX +#undef UINT16_MAX +#define INT16_MIN (~ INT16_MAX) +#define INT16_MAX 32767 +#define UINT16_MAX 65535 + +#undef INT32_MIN +#undef INT32_MAX +#undef UINT32_MAX +#define INT32_MIN (~ INT32_MAX) +#define INT32_MAX 2147483647 +#define UINT32_MAX 4294967295U + +#undef INT64_MIN +#undef INT64_MAX +#ifdef GL_INT64_T +/* Prefer (- INTMAX_C (1) << 63) over (~ INT64_MAX) because SunPRO C 5.0 + evaluates the latter incorrectly in preprocessor expressions. */ +# define INT64_MIN (- INTMAX_C (1) << 63) +# define INT64_MAX INTMAX_C (9223372036854775807) +#endif + +#undef UINT64_MAX +#ifdef GL_UINT64_T +# define UINT64_MAX UINTMAX_C (18446744073709551615) +#endif + +/* 7.18.2.2. Limits of minimum-width integer types */ + +/* Here we assume a standard architecture where the hardware integer + types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types + are the same as the corresponding N_t types. */ + +#undef INT_LEAST8_MIN +#undef INT_LEAST8_MAX +#undef UINT_LEAST8_MAX +#define INT_LEAST8_MIN INT8_MIN +#define INT_LEAST8_MAX INT8_MAX +#define UINT_LEAST8_MAX UINT8_MAX + +#undef INT_LEAST16_MIN +#undef INT_LEAST16_MAX +#undef UINT_LEAST16_MAX +#define INT_LEAST16_MIN INT16_MIN +#define INT_LEAST16_MAX INT16_MAX +#define UINT_LEAST16_MAX UINT16_MAX + +#undef INT_LEAST32_MIN +#undef INT_LEAST32_MAX +#undef UINT_LEAST32_MAX +#define INT_LEAST32_MIN INT32_MIN +#define INT_LEAST32_MAX INT32_MAX +#define UINT_LEAST32_MAX UINT32_MAX + +#undef INT_LEAST64_MIN +#undef INT_LEAST64_MAX +#ifdef GL_INT64_T +# define INT_LEAST64_MIN INT64_MIN +# define INT_LEAST64_MAX INT64_MAX +#endif + +#undef UINT_LEAST64_MAX +#ifdef GL_UINT64_T +# define UINT_LEAST64_MAX UINT64_MAX +#endif + +/* 7.18.2.3. Limits of fastest minimum-width integer types */ + +/* Here we assume a standard architecture where the hardware integer + types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types + are taken from the same list of types. */ + +#undef INT_FAST8_MIN +#undef INT_FAST8_MAX +#undef UINT_FAST8_MAX +#define INT_FAST8_MIN LONG_MIN +#define INT_FAST8_MAX LONG_MAX +#define UINT_FAST8_MAX ULONG_MAX + +#undef INT_FAST16_MIN +#undef INT_FAST16_MAX +#undef UINT_FAST16_MAX +#define INT_FAST16_MIN LONG_MIN +#define INT_FAST16_MAX LONG_MAX +#define UINT_FAST16_MAX ULONG_MAX + +#undef INT_FAST32_MIN +#undef INT_FAST32_MAX +#undef UINT_FAST32_MAX +#define INT_FAST32_MIN LONG_MIN +#define INT_FAST32_MAX LONG_MAX +#define UINT_FAST32_MAX ULONG_MAX + +#undef INT_FAST64_MIN +#undef INT_FAST64_MAX +#ifdef GL_INT64_T +# define INT_FAST64_MIN INT64_MIN +# define INT_FAST64_MAX INT64_MAX +#endif + +#undef UINT_FAST64_MAX +#ifdef GL_UINT64_T +# define UINT_FAST64_MAX UINT64_MAX +#endif + +/* 7.18.2.4. Limits of integer types capable of holding object pointers */ + +#undef INTPTR_MIN +#undef INTPTR_MAX +#undef UINTPTR_MAX +#define INTPTR_MIN LONG_MIN +#define INTPTR_MAX LONG_MAX +#define UINTPTR_MAX ULONG_MAX + +/* 7.18.2.5. Limits of greatest-width integer types */ + +#undef INTMAX_MIN +#undef INTMAX_MAX +#ifdef INT64_MAX +# define INTMAX_MIN INT64_MIN +# define INTMAX_MAX INT64_MAX +#else +# define INTMAX_MIN INT32_MIN +# define INTMAX_MAX INT32_MAX +#endif + +#undef UINTMAX_MAX +#ifdef UINT64_MAX +# define UINTMAX_MAX UINT64_MAX +#else +# define UINTMAX_MAX UINT32_MAX +#endif + +/* 7.18.3. Limits of other integer types */ + +/* ptrdiff_t limits */ +#undef PTRDIFF_MIN +#undef PTRDIFF_MAX +#define PTRDIFF_MIN \ + _STDINT_MIN (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@) +#define PTRDIFF_MAX \ + _STDINT_MAX (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@) + +/* sig_atomic_t limits */ +#undef SIG_ATOMIC_MIN +#undef SIG_ATOMIC_MAX +#define SIG_ATOMIC_MIN \ + _STDINT_MIN (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \ + 0@SIG_ATOMIC_T_SUFFIX@) +#define SIG_ATOMIC_MAX \ + _STDINT_MAX (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \ + 0@SIG_ATOMIC_T_SUFFIX@) + + +/* size_t limit */ +#undef SIZE_MAX +#define SIZE_MAX _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@) + +/* wchar_t limits */ +#undef WCHAR_MIN +#undef WCHAR_MAX +#define WCHAR_MIN \ + _STDINT_MIN (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@) +#define WCHAR_MAX \ + _STDINT_MAX (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@) + +/* wint_t limits */ +#undef WINT_MIN +#undef WINT_MAX +#define WINT_MIN \ + _STDINT_MIN (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) +#define WINT_MAX \ + _STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) + +#endif /* !defined __cplusplus || defined __STDC_LIMIT_MACROS */ + +/* 7.18.4. Macros for integer constants */ + +#if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS + +/* 7.18.4.1. Macros for minimum-width integer constants */ +/* According to ISO C 99 Technical Corrigendum 1 */ + +/* Here we assume a standard architecture where the hardware integer + types have 8, 16, 32, optionally 64 bits, and int is 32 bits. */ + +#undef INT8_C +#undef UINT8_C +#define INT8_C(x) x +#define UINT8_C(x) x + +#undef INT16_C +#undef UINT16_C +#define INT16_C(x) x +#define UINT16_C(x) x + +#undef INT32_C +#undef UINT32_C +#define INT32_C(x) x +#define UINT32_C(x) x ## U + +#undef INT64_C +#undef UINT64_C +#if LONG_MAX >> 31 >> 31 == 1 +# define INT64_C(x) x##L +#elif defined _MSC_VER +# define INT64_C(x) x##i64 +#elif @HAVE_LONG_LONG_INT@ +# define INT64_C(x) x##LL +#endif +#if ULONG_MAX >> 31 >> 31 >> 1 == 1 +# define UINT64_C(x) x##UL +#elif defined _MSC_VER +# define UINT64_C(x) x##ui64 +#elif @HAVE_UNSIGNED_LONG_LONG_INT@ +# define UINT64_C(x) x##ULL +#endif + +/* 7.18.4.2. Macros for greatest-width integer constants */ + +#undef INTMAX_C +#if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 +# define INTMAX_C(x) x##LL +#elif defined GL_INT64_T +# define INTMAX_C(x) INT64_C(x) +#else +# define INTMAX_C(x) x##L +#endif + +#undef UINTMAX_C +#if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 +# define UINTMAX_C(x) x##ULL +#elif defined GL_UINT64_T +# define UINTMAX_C(x) UINT64_C(x) +#else +# define UINTMAX_C(x) x##UL +#endif + +#endif /* !defined __cplusplus || defined __STDC_CONSTANT_MACROS */ + +#endif /* _GL_STDINT_H */ +#endif /* !defined _GL_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */ diff -ruNp m4-1.4.10/lib/stdint_.h m4-1.4.11/lib/stdint_.h --- m4-1.4.10/lib/stdint_.h 2007-07-05 05:48:22.000000000 -0600 +++ m4-1.4.11/lib/stdint_.h 1969-12-31 17:00:00.000000000 -0700 @@ -1,508 +0,0 @@ -/* Copyright (C) 2001-2002, 2004-2007 Free Software Foundation, Inc. - Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood. - This file is part of gnulib. - - 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 2, 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -/* - * ISO C 99 <stdint.h> for platforms that lack it. - * <http://www.opengroup.org/susv3xbd/stdint.h.html> - */ - -#ifndef _GL_STDINT_H - -/* Get those types that are already defined in other system include - files, so that we can "#define int8_t signed char" below without - worrying about a later system include file containing a "typedef - signed char int8_t;" that will get messed up by our macro. Our - macros should all be consistent with the system versions, except - for the "fast" types and macros, which we recommend against using - in public interfaces due to compiler differences. */ - -#if @HAVE_STDINT_H@ -# if defined __sgi && ! defined __c99 - /* Bypass IRIX's <stdint.h> if in C89 mode, since it merely annoys users - with "This header file is to be used only for c99 mode compilations" - diagnostics. */ -# define __STDINT_H__ -# endif - /* Other systems may have an incomplete or buggy <stdint.h>. - Include it before <inttypes.h>, since any "#include <stdint.h>" - in <inttypes.h> would reinclude us, skipping our contents because - _GL_STDINT_H is defined. - The include_next requires a split double-inclusion guard. */ -# @INCLUDE_NEXT@ @NEXT_STDINT_H@ -#endif - -#if ! defined _GL_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H -#define _GL_STDINT_H - -/* <sys/types.h> defines some of the stdint.h types as well, on glibc, - IRIX 6.5, and OpenBSD 3.8 (via <machine/types.h>). - AIX 5.2 <sys/types.h> isn't needed and causes troubles. - MacOS X 10.4.6 <sys/types.h> includes <stdint.h> (which is us), but - relies on the system <stdint.h> definitions, so include - <sys/types.h> after @NEXT_STDINT_H@. */ -#if @HAVE_SYS_TYPES_H@ && ! defined _AIX -# include <sys/types.h> -#endif - -/* Get LONG_MIN, LONG_MAX, ULONG_MAX. */ -#include <limits.h> - -#if @HAVE_INTTYPES_H@ - /* In OpenBSD 3.8, <inttypes.h> includes <machine/types.h>, which defines - int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__. - <inttypes.h> also defines intptr_t and uintptr_t. */ -# define _GL_JUST_INCLUDE_ABSOLUTE_INTTYPES_H -# include <inttypes.h> -# undef _GL_JUST_INCLUDE_ABSOLUTE_INTTYPES_H -#elif @HAVE_SYS_INTTYPES_H@ - /* Solaris 7 <sys/inttypes.h> has the types except the *_fast*_t types, and - the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX. */ -# include <sys/inttypes.h> -#endif - -#if @HAVE_SYS_BITYPES_H@ && ! defined __BIT_TYPES_DEFINED__ - /* Linux libc4 >= 4.6.7 and libc5 have a <sys/bitypes.h> that defines - int{8,16,32,64}_t and __BIT_TYPES_DEFINED__. In libc5 >= 5.2.2 it is - included by <sys/types.h>. */ -# include <sys/bitypes.h> -#endif - -#if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS - -/* Get WCHAR_MIN, WCHAR_MAX. */ -# if ! (defined WCHAR_MIN && defined WCHAR_MAX) -# include <wchar.h> -# endif - -#endif - -/* Minimum and maximum values for a integer type under the usual assumption. - Return an unspecified value if BITS == 0, adding a check to pacify - picky compilers. */ - -#define _STDINT_MIN(signed, bits, zero) \ - ((signed) ? (- ((zero) + 1) << ((bits) ? (bits) - 1 : 0)) : (zero)) - -#define _STDINT_MAX(signed, bits, zero) \ - ((signed) \ - ? ~ _STDINT_MIN (signed, bits, zero) \ - : ((((zero) + 1) << ((bits) ? (bits) - 1 : 0)) - 1) * 2 + 1) - -/* 7.18.1.1. Exact-width integer types */ - -/* Here we assume a standard architecture where the hardware integer - types have 8, 16, 32, optionally 64 bits. */ - -#undef int8_t -#undef uint8_t -#define int8_t signed char -#define uint8_t unsigned char - -#undef int16_t -#undef uint16_t -#define int16_t short int -#define uint16_t unsigned short int - -#undef int32_t -#undef uint32_t -#define int32_t int -#define uint32_t unsigned int - -/* Do not undefine int64_t if gnulib is not being used with 64-bit - types, since otherwise it breaks platforms like Tandem/NSK. */ -#if LONG_MAX >> 31 >> 31 == 1 -# undef int64_t -# define int64_t long int -# define GL_INT64_T -#elif defined _MSC_VER -# undef int64_t -# define int64_t __int64 -# define GL_INT64_T -#elif @HAVE_LONG_LONG_INT@ -# undef int64_t -# define int64_t long long int -# define GL_INT64_T -#endif - -#if ULONG_MAX >> 31 >> 31 >> 1 == 1 -# undef uint64_t -# define uint64_t unsigned long int -# define GL_UINT64_T -#elif defined _MSC_VER -# undef uint64_t -# define uint64_t unsigned __int64 -# define GL_UINT64_T -#elif @HAVE_UNSIGNED_LONG_LONG_INT@ -# undef uint64_t -# define uint64_t unsigned long long int -# define GL_UINT64_T -#endif - -/* Avoid collision with Solaris 2.5.1 <pthread.h> etc. */ -#define _UINT8_T -#define _UINT32_T -#define _UINT64_T - - -/* 7.18.1.2. Minimum-width integer types */ - -/* Here we assume a standard architecture where the hardware integer - types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types - are the same as the corresponding N_t types. */ - -#undef int_least8_t -#undef uint_least8_t -#undef int_least16_t -#undef uint_least16_t -#undef int_least32_t -#undef uint_least32_t -#undef int_least64_t -#undef uint_least64_t -#define int_least8_t int8_t -#define uint_least8_t uint8_t -#define int_least16_t int16_t -#define uint_least16_t uint16_t -#define int_least32_t int32_t -#define uint_least32_t uint32_t -#ifdef GL_INT64_T -# define int_least64_t int64_t -#endif -#ifdef GL_UINT64_T -# define uint_least64_t uint64_t -#endif - -/* 7.18.1.3. Fastest minimum-width integer types */ - -/* Note: Other <stdint.h> substitutes may define these types differently. - It is not recommended to use these types in public header files. */ - -/* Here we assume a standard architecture where the hardware integer - types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types - are taken from the same list of types. Assume that 'long int' - is fast enough for all narrower integers. */ - -#undef int_fast8_t -#undef uint_fast8_t -#undef int_fast16_t -#undef uint_fast16_t -#undef int_fast32_t -#undef uint_fast32_t -#undef int_fast64_t -#undef uint_fast64_t -#define int_fast8_t long int -#define uint_fast8_t unsigned int_fast8_t -#define int_fast16_t long int -#define uint_fast16_t unsigned int_fast16_t -#define int_fast32_t long int -#define uint_fast32_t unsigned int_fast32_t -#ifdef GL_INT64_T -# define int_fast64_t int64_t -#endif -#ifdef GL_UINT64_T -# define uint_fast64_t uint64_t -#endif - -/* 7.18.1.4. Integer types capable of holding object pointers */ - -#undef intptr_t -#undef uintptr_t -#define intptr_t long int -#define uintptr_t unsigned long int - -/* 7.18.1.5. Greatest-width integer types */ - -/* Note: These types are compiler dependent. It may be unwise to use them in - public header files. */ - -#undef intmax_t -#if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 -# define intmax_t long long int -#elif defined GL_INT64_T -# define intmax_t int64_t -#else -# define intmax_t long int -#endif - -#undef uintmax_t -#if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 -# define uintmax_t unsigned long long int -#elif defined GL_UINT64_T -# define uintmax_t uint64_t -#else -# define uintmax_t unsigned long int -#endif - -/* 7.18.2. Limits of specified-width integer types */ - -#if ! defined __cplusplus || defined __STDC_LIMIT_MACROS - -/* 7.18.2.1. Limits of exact-width integer types */ - -/* Here we assume a standard architecture where the hardware integer - types have 8, 16, 32, optionally 64 bits. */ - -#undef INT8_MIN -#undef INT8_MAX -#undef UINT8_MAX -#define INT8_MIN (~ INT8_MAX) -#define INT8_MAX 127 -#define UINT8_MAX 255 - -#undef INT16_MIN -#undef INT16_MAX -#undef UINT16_MAX -#define INT16_MIN (~ INT16_MAX) -#define INT16_MAX 32767 -#define UINT16_MAX 65535 - -#undef INT32_MIN -#undef INT32_MAX -#undef UINT32_MAX -#define INT32_MIN (~ INT32_MAX) -#define INT32_MAX 2147483647 -#define UINT32_MAX 4294967295U - -#undef INT64_MIN -#undef INT64_MAX -#ifdef GL_INT64_T -/* Prefer (- INTMAX_C (1) << 63) over (~ INT64_MAX) because SunPRO C 5.0 - evaluates the latter incorrectly in preprocessor expressions. */ -# define INT64_MIN (- INTMAX_C (1) << 63) -# define INT64_MAX INTMAX_C (9223372036854775807) -#endif - -#undef UINT64_MAX -#ifdef GL_UINT64_T -# define UINT64_MAX UINTMAX_C (18446744073709551615) -#endif - -/* 7.18.2.2. Limits of minimum-width integer types */ - -/* Here we assume a standard architecture where the hardware integer - types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types - are the same as the corresponding N_t types. */ - -#undef INT_LEAST8_MIN -#undef INT_LEAST8_MAX -#undef UINT_LEAST8_MAX -#define INT_LEAST8_MIN INT8_MIN -#define INT_LEAST8_MAX INT8_MAX -#define UINT_LEAST8_MAX UINT8_MAX - -#undef INT_LEAST16_MIN -#undef INT_LEAST16_MAX -#undef UINT_LEAST16_MAX -#define INT_LEAST16_MIN INT16_MIN -#define INT_LEAST16_MAX INT16_MAX -#define UINT_LEAST16_MAX UINT16_MAX - -#undef INT_LEAST32_MIN -#undef INT_LEAST32_MAX -#undef UINT_LEAST32_MAX -#define INT_LEAST32_MIN INT32_MIN -#define INT_LEAST32_MAX INT32_MAX -#define UINT_LEAST32_MAX UINT32_MAX - -#undef INT_LEAST64_MIN -#undef INT_LEAST64_MAX -#ifdef GL_INT64_T -# define INT_LEAST64_MIN INT64_MIN -# define INT_LEAST64_MAX INT64_MAX -#endif - -#undef UINT_LEAST64_MAX -#ifdef GL_UINT64_T -# define UINT_LEAST64_MAX UINT64_MAX -#endif - -/* 7.18.2.3. Limits of fastest minimum-width integer types */ - -/* Here we assume a standard architecture where the hardware integer - types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types - are taken from the same list of types. */ - -#undef INT_FAST8_MIN -#undef INT_FAST8_MAX -#undef UINT_FAST8_MAX -#define INT_FAST8_MIN LONG_MIN -#define INT_FAST8_MAX LONG_MAX -#define UINT_FAST8_MAX ULONG_MAX - -#undef INT_FAST16_MIN -#undef INT_FAST16_MAX -#undef UINT_FAST16_MAX -#define INT_FAST16_MIN LONG_MIN -#define INT_FAST16_MAX LONG_MAX -#define UINT_FAST16_MAX ULONG_MAX - -#undef INT_FAST32_MIN -#undef INT_FAST32_MAX -#undef UINT_FAST32_MAX -#define INT_FAST32_MIN LONG_MIN -#define INT_FAST32_MAX LONG_MAX -#define UINT_FAST32_MAX ULONG_MAX - -#undef INT_FAST64_MIN -#undef INT_FAST64_MAX -#ifdef GL_INT64_T -# define INT_FAST64_MIN INT64_MIN -# define INT_FAST64_MAX INT64_MAX -#endif - -#undef UINT_FAST64_MAX -#ifdef GL_UINT64_T -# define UINT_FAST64_MAX UINT64_MAX -#endif - -/* 7.18.2.4. Limits of integer types capable of holding object pointers */ - -#undef INTPTR_MIN -#undef INTPTR_MAX -#undef UINTPTR_MAX -#define INTPTR_MIN LONG_MIN -#define INTPTR_MAX LONG_MAX -#define UINTPTR_MAX ULONG_MAX - -/* 7.18.2.5. Limits of greatest-width integer types */ - -#undef INTMAX_MIN -#undef INTMAX_MAX -#ifdef INT64_MAX -# define INTMAX_MIN INT64_MIN -# define INTMAX_MAX INT64_MAX -#else -# define INTMAX_MIN INT32_MIN -# define INTMAX_MAX INT32_MAX -#endif - -#undef UINTMAX_MAX -#ifdef UINT64_MAX -# define UINTMAX_MAX UINT64_MAX -#else -# define UINTMAX_MAX UINT32_MAX -#endif - -/* 7.18.3. Limits of other integer types */ - -/* ptrdiff_t limits */ -#undef PTRDIFF_MIN -#undef PTRDIFF_MAX -#define PTRDIFF_MIN \ - _STDINT_MIN (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@) -#define PTRDIFF_MAX \ - _STDINT_MAX (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@) - -/* sig_atomic_t limits */ -#undef SIG_ATOMIC_MIN -#undef SIG_ATOMIC_MAX -#define SIG_ATOMIC_MIN \ - _STDINT_MIN (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \ - 0@SIG_ATOMIC_T_SUFFIX@) -#define SIG_ATOMIC_MAX \ - _STDINT_MAX (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \ - 0@SIG_ATOMIC_T_SUFFIX@) - - -/* size_t limit */ -#undef SIZE_MAX -#define SIZE_MAX _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@) - -/* wchar_t limits */ -#undef WCHAR_MIN -#undef WCHAR_MAX -#define WCHAR_MIN \ - _STDINT_MIN (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@) -#define WCHAR_MAX \ - _STDINT_MAX (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@) - -/* wint_t limits */ -#undef WINT_MIN -#undef WINT_MAX -#define WINT_MIN \ - _STDINT_MIN (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) -#define WINT_MAX \ - _STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) - -#endif /* !defined __cplusplus || defined __STDC_LIMIT_MACROS */ - -/* 7.18.4. Macros for integer constants */ - -#if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS - -/* 7.18.4.1. Macros for minimum-width integer constants */ -/* According to ISO C 99 Technical Corrigendum 1 */ - -/* Here we assume a standard architecture where the hardware integer - types have 8, 16, 32, optionally 64 bits, and int is 32 bits. */ - -#undef INT8_C -#undef UINT8_C -#define INT8_C(x) x -#define UINT8_C(x) x - -#undef INT16_C -#undef UINT16_C -#define INT16_C(x) x -#define UINT16_C(x) x - -#undef INT32_C -#undef UINT32_C -#define INT32_C(x) x -#define UINT32_C(x) x ## U - -#undef INT64_C -#undef UINT64_C -#if LONG_MAX >> 31 >> 31 == 1 -# define INT64_C(x) x##L -#elif defined _MSC_VER -# define INT64_C(x) x##i64 -#elif @HAVE_LONG_LONG_INT@ -# define INT64_C(x) x##LL -#endif -#if ULONG_MAX >> 31 >> 31 >> 1 == 1 -# define UINT64_C(x) x##UL -#elif defined _MSC_VER -# define UINT64_C(x) x##ui64 -#elif @HAVE_UNSIGNED_LONG_LONG_INT@ -# define UINT64_C(x) x##ULL -#endif - -/* 7.18.4.2. Macros for greatest-width integer constants */ - -#undef INTMAX_C -#if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 -# define INTMAX_C(x) x##LL -#elif defined GL_INT64_T -# define INTMAX_C(x) INT64_C(x) -#else -# define INTMAX_C(x) x##L -#endif - -#undef UINTMAX_C -#if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 -# define UINTMAX_C(x) x##ULL -#elif defined GL_UINT64_T -# define UINTMAX_C(x) UINT64_C(x) -#else -# define UINTMAX_C(x) x##UL -#endif - -#endif /* !defined __cplusplus || defined __STDC_CONSTANT_MACROS */ - -#endif /* _GL_STDINT_H */ -#endif /* !defined _GL_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */ diff -ruNp m4-1.4.10/lib/stdio--.h m4-1.4.11/lib/stdio--.h --- m4-1.4.10/lib/stdio--.h 2007-05-30 19:30:37.000000000 -0600 +++ m4-1.4.11/lib/stdio--.h 2007-12-01 13:55:34.000000000 -0700 @@ -2,10 +2,10 @@ Copyright (C) 2005, 2006 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -13,8 +13,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ diff -ruNp m4-1.4.10/lib/stdio-safer.h m4-1.4.11/lib/stdio-safer.h --- m4-1.4.10/lib/stdio-safer.h 2007-05-30 19:30:37.000000000 -0600 +++ m4-1.4.11/lib/stdio-safer.h 2007-12-01 13:55:34.000000000 -0700 @@ -2,10 +2,10 @@ Copyright (C) 2001, 2003, 2006 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -13,8 +13,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ diff -ruNp m4-1.4.10/lib/stdio.in.h m4-1.4.11/lib/stdio.in.h --- m4-1.4.10/lib/stdio.in.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/lib/stdio.in.h 2008-01-14 22:04:37.000000000 -0700 @@ -0,0 +1,382 @@ +/* A GNU-like <stdio.h>. + + Copyright (C) 2004, 2007-2008 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, 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, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#if defined __need_FILE || defined __need___FILE +/* Special invocation convention inside glibc header files. */ + +#@INCLUDE_NEXT@ @NEXT_STDIO_H@ + +#else +/* Normal invocation convention. */ + +#ifndef _GL_STDIO_H + +/* The include_next requires a split double-inclusion guard. */ +#@INCLUDE_NEXT@ @NEXT_STDIO_H@ + +#ifndef _GL_STDIO_H +#define _GL_STDIO_H + +#include <stdarg.h> +#include <stddef.h> + +#if (@GNULIB_FSEEKO@ && @REPLACE_FSEEKO@) \ + || (@GNULIB_FTELLO@ && @REPLACE_FTELLO@) \ + || (@GNULIB_GETDELIM@ && !@HAVE_DECL_GETDELIM@) \ + || (@GNULIB_GETLINE@ && (!@HAVE_DECL_GETLINE@ || @REPLACE_GETLINE@)) +/* Get off_t and ssize_t. */ +# include <sys/types.h> +#endif + +#ifndef __attribute__ +/* This feature is available in gcc versions 2.5 and later. */ +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) +# define __attribute__(Spec) /* empty */ +# endif +/* The __-protected variants of `format' and `printf' attributes + are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */ +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) +# define __format__ format +# define __printf__ printf +# endif +#endif + + +/* The definition of GL_LINK_WARNING is copied here. */ + + +#ifdef __cplusplus +extern "C" { +#endif + + +#if @GNULIB_FPRINTF_POSIX@ +# if @REPLACE_FPRINTF@ +# define fprintf rpl_fprintf +extern int fprintf (FILE *fp, const char *format, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); +# endif +#elif defined GNULIB_POSIXCHECK +# undef fprintf +# define fprintf \ + (GL_LINK_WARNING ("fprintf is not always POSIX compliant - " \ + "use gnulib module fprintf-posix for portable " \ + "POSIX compliance"), \ + fprintf) +#endif + +#if @GNULIB_VFPRINTF_POSIX@ +# if @REPLACE_VFPRINTF@ +# define vfprintf rpl_vfprintf +extern int vfprintf (FILE *fp, const char *format, va_list args) + __attribute__ ((__format__ (__printf__, 2, 0))); +# endif +#elif defined GNULIB_POSIXCHECK +# undef vfprintf +# define vfprintf(s,f,a) \ + (GL_LINK_WARNING ("vfprintf is not always POSIX compliant - " \ + "use gnulib module vfprintf-posix for portable " \ + "POSIX compliance"), \ + vfprintf (s, f, a)) +#endif + +#if @GNULIB_PRINTF_POSIX@ +# if @REPLACE_PRINTF@ +/* Don't break __attribute__((format(printf,M,N))). */ +# define printf __printf__ +extern int printf (const char *format, ...) + __attribute__ ((__format__ (__printf__, 1, 2))); +# endif +#elif defined GNULIB_POSIXCHECK +# undef printf +# define printf \ + (GL_LINK_WARNING ("printf is not always POSIX compliant - " \ + "use gnulib module printf-posix for portable " \ + "POSIX compliance"), \ + printf) +/* Don't break __attribute__((format(printf,M,N))). */ +# define format(kind,m,n) format (__##kind##__, m, n) +# define __format__(kind,m,n) __format__ (__##kind##__, m, n) +# define ____printf____ __printf__ +# define ____scanf____ __scanf__ +# define ____strftime____ __strftime__ +# define ____strfmon____ __strfmon__ +#endif + +#if @GNULIB_VPRINTF_POSIX@ +# if @REPLACE_VPRINTF@ +# define vprintf rpl_vprintf +extern int vprintf (const char *format, va_list args) + __attribute__ ((__format__ (__printf__, 1, 0))); +# endif +#elif defined GNULIB_POSIXCHECK +# undef vprintf +# define vprintf(f,a) \ + (GL_LINK_WARNING ("vprintf is not always POSIX compliant - " \ + "use gnulib module vprintf-posix for portable " \ + "POSIX compliance"), \ + vprintf (f, a)) +#endif + +#if @GNULIB_SNPRINTF@ +# if @REPLACE_SNPRINTF@ +# define snprintf rpl_snprintf +# endif +# if @REPLACE_SNPRINTF@ || !@HAVE_DECL_SNPRINTF@ +extern int snprintf (char *str, size_t size, const char *format, ...) + __attribute__ ((__format__ (__printf__, 3, 4))); +# endif +#elif defined GNULIB_POSIXCHECK +# undef snprintf +# define snprintf \ + (GL_LINK_WARNING ("snprintf is unportable - " \ + "use gnulib module snprintf for portability"), \ + snprintf) +#endif + +#if @GNULIB_VSNPRINTF@ +# if @REPLACE_VSNPRINTF@ +# define vsnprintf rpl_vsnprintf +# endif +# if @REPLACE_VSNPRINTF@ || !@HAVE_DECL_VSNPRINTF@ +extern int vsnprintf (char *str, size_t size, const char *format, va_list args) + __attribute__ ((__format__ (__printf__, 3, 0))); +# endif +#elif defined GNULIB_POSIXCHECK +# undef vsnprintf +# define vsnprintf(b,s,f,a) \ + (GL_LINK_WARNING ("vsnprintf is unportable - " \ + "use gnulib module vsnprintf for portability"), \ + vsnprintf (b, s, f, a)) +#endif + +#if @GNULIB_SPRINTF_POSIX@ +# if @REPLACE_SPRINTF@ +# define sprintf rpl_sprintf +extern int sprintf (char *str, const char *format, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); +# endif +#elif defined GNULIB_POSIXCHECK +# undef sprintf +# define sprintf \ + (GL_LINK_WARNING ("sprintf is not always POSIX compliant - " \ + "use gnulib module sprintf-posix for portable " \ + "POSIX compliance"), \ + sprintf) +#endif + +#if @GNULIB_VSPRINTF_POSIX@ +# if @REPLACE_VSPRINTF@ +# define vsprintf rpl_vsprintf +extern int vsprintf (char *str, const char *format, va_list args) + __attribute__ ((__format__ (__printf__, 2, 0))); +# endif +#elif defined GNULIB_POSIXCHECK +# undef vsprintf +# define vsprintf(b,f,a) \ + (GL_LINK_WARNING ("vsprintf is not always POSIX compliant - " \ + "use gnulib module vsprintf-posix for portable " \ + "POSIX compliance"), \ + vsprintf (b, f, a)) +#endif + +#if @GNULIB_VASPRINTF@ +# if @REPLACE_VASPRINTF@ +# define asprintf rpl_asprintf +# define vasprintf rpl_vasprintf +# endif +# if @REPLACE_VASPRINTF@ || !@HAVE_VASPRINTF@ + /* Write formatted output to a string dynamically allocated with malloc(). + If the memory allocation succeeds, store the address of the string in + *RESULT and return the number of resulting bytes, excluding the trailing + NUL. Upon memory allocation error, or some other error, return -1. */ + extern int asprintf (char **result, const char *format, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); + extern int vasprintf (char **result, const char *format, va_list args) + __attribute__ ((__format__ (__printf__, 2, 0))); +# endif +#endif + +#if @GNULIB_FOPEN@ +# if @REPLACE_FOPEN@ +# define fopen rpl_fopen +extern FILE * fopen (const char *filename, const char *mode); +# endif +#elif defined GNULIB_POSIXCHECK +# undef fopen +# define fopen(f,m) \ + (GL_LINK_WARNING ("fopen on Win32 platforms is not POSIX compatible - " \ + "use gnulib module fopen for portability"), \ + fopen (f, m)) +#endif + +#if @GNULIB_FREOPEN@ +# if @REPLACE_FREOPEN@ +# define freopen rpl_freopen +extern FILE * freopen (const char *filename, const char *mode, FILE *stream); +# endif +#elif defined GNULIB_POSIXCHECK +# undef freopen +# define freopen(f,m,s) \ + (GL_LINK_WARNING ("freopen on Win32 platforms is not POSIX compatible - " \ + "use gnulib module freopen for portability"), \ + freopen (f, m, s)) +#endif + +#if @GNULIB_FSEEKO@ +# if @REPLACE_FSEEKO@ +/* Provide fseek, fseeko functions that are aware of a preceding + fflush(), and which detect pipes. */ +# define fseeko rpl_fseeko +extern int fseeko (FILE *fp, off_t offset, int whence); +# define fseek(fp, offset, whence) fseeko (fp, (off_t)(offset), whence) +# endif +#elif defined GNULIB_POSIXCHECK +# undef fseeko +# define fseeko(f,o,w) \ + (GL_LINK_WARNING ("fseeko is unportable - " \ + "use gnulib module fseeko for portability"), \ + fseeko (f, o, w)) +#endif + +#if @GNULIB_FSEEK@ && @REPLACE_FSEEK@ +extern int rpl_fseek (FILE *fp, long offset, int whence); +# undef fseek +# if defined GNULIB_POSIXCHECK +# define fseek(f,o,w) \ + (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \ + "on 32-bit platforms - " \ + "use fseeko function for handling of large files"), \ + rpl_fseek (f, o, w)) +# else +# define fseek rpl_fseek +# endif +#elif defined GNULIB_POSIXCHECK +# ifndef fseek +# define fseek(f,o,w) \ + (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \ + "on 32-bit platforms - " \ + "use fseeko function for handling of large files"), \ + fseek (f, o, w)) +# endif +#endif + +#if @GNULIB_FTELLO@ +# if @REPLACE_FTELLO@ +# define ftello rpl_ftello +extern off_t ftello (FILE *fp); +# define ftell(fp) ftello (fp) +# endif +#elif defined GNULIB_POSIXCHECK +# undef ftello +# define ftello(f) \ + (GL_LINK_WARNING ("ftello is unportable - " \ + "use gnulib module ftello for portability"), \ + ftello (f)) +#endif + +#if @GNULIB_FTELL@ && @REPLACE_FTELL@ +extern long rpl_ftell (FILE *fp); +# undef ftell +# if GNULIB_POSIXCHECK +# define ftell(f) \ + (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \ + "on 32-bit platforms - " \ + "use ftello function for handling of large files"), \ + rpl_ftell (f)) +# else +# define ftell rpl_ftell +# endif +#elif defined GNULIB_POSIXCHECK +# ifndef ftell +# define ftell(f) \ + (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \ + "on 32-bit platforms - " \ + "use ftello function for handling of large files"), \ + ftell (f)) +# endif +#endif + +#if @GNULIB_FFLUSH@ +# if @REPLACE_FFLUSH@ +# define fflush rpl_fflush + /* Flush all pending data on STREAM according to POSIX rules. Both + output and seekable input streams are supported. + Note! LOSS OF DATA can occur if fflush is applied on an input stream + that is _not_seekable_ or on an update stream that is _not_seekable_ + and in which the most recent operation was input. Seekability can + be tested with lseek(fileno(fp),0,SEEK_CUR). */ + extern int fflush (FILE *gl_stream); +# endif +#elif defined GNULIB_POSIXCHECK +# undef fflush +# define fflush(f) \ + (GL_LINK_WARNING ("fflush is not always POSIX compliant - " \ + "use gnulib module fflush for portable " \ + "POSIX compliance"), \ + fflush (f)) +#endif + +#if @GNULIB_GETDELIM@ +# if !@HAVE_DECL_GETDELIM@ +/* Read input, up to (and including) the next occurrence of DELIMITER, from + STREAM, store it in *LINEPTR (and NUL-terminate it). + *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE + bytes of space. It is realloc'd as necessary. + Return the number of bytes read and stored at *LINEPTR (not including the + NUL terminator), or -1 on error or EOF. */ +extern ssize_t getdelim (char **lineptr, size_t *linesize, int delimiter, + FILE *stream); +# endif +#elif defined GNULIB_POSIXCHECK +# undef getdelim +# define getdelim(l, s, d, f) \ + (GL_LINK_WARNING ("getdelim is unportable - " \ + "use gnulib module getdelim for portability"), \ + getdelim (l, s, d, f)) +#endif + +#if @GNULIB_GETLINE@ +# if @REPLACE_GETLINE@ +# undef getline +# define getline rpl_getline +# endif +# if !@HAVE_DECL_GETLINE@ || @REPLACE_GETLINE@ +/* Read a line, up to (and including) the next newline, from STREAM, store it + in *LINEPTR (and NUL-terminate it). + *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE + bytes of space. It is realloc'd as necessary. + Return the number of bytes read and stored at *LINEPTR (not including the + NUL terminator), or -1 on error or EOF. */ +extern ssize_t getline (char **lineptr, size_t *linesize, FILE *stream); +# endif +#elif defined GNULIB_POSIXCHECK +# undef getline +# define getline(l, s, f) \ + (GL_LINK_WARNING ("getline is unportable - " \ + "use gnulib module getline for portability"), \ + getline (l, s, f)) +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _GL_STDIO_H */ +#endif /* _GL_STDIO_H */ +#endif diff -ruNp m4-1.4.10/lib/stdio_.h m4-1.4.11/lib/stdio_.h --- m4-1.4.10/lib/stdio_.h 2007-07-05 05:48:23.000000000 -0600 +++ m4-1.4.11/lib/stdio_.h 1969-12-31 17:00:00.000000000 -0700 @@ -1,312 +0,0 @@ -/* A GNU-like <stdio.h>. - - Copyright (C) 2004, 2007 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 2, 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#if defined __need_FILE || defined __need___FILE -/* Special invocation convention inside glibc header files. */ - -#@INCLUDE_NEXT@ @NEXT_STDIO_H@ - -#else -/* Normal invocation convention. */ - -#ifndef _GL_STDIO_H - -/* The include_next requires a split double-inclusion guard. */ -#@INCLUDE_NEXT@ @NEXT_STDIO_H@ - -#ifndef _GL_STDIO_H -#define _GL_STDIO_H - -#include <stdarg.h> -#include <stddef.h> - -#if (@GNULIB_FSEEKO@ && @REPLACE_FSEEKO@) || (@GNULIB_FTELLO@ && @REPLACE_FTELLO@) -/* Get off_t. */ -# include <sys/types.h> -#endif - -#ifndef __attribute__ -/* This feature is available in gcc versions 2.5 and later. */ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__ -# define __attribute__(Spec) /* empty */ -# endif -/* The __-protected variants of `format' and `printf' attributes - are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) -# define __format__ format -# define __printf__ printf -# endif -#endif - - -/* The definition of GL_LINK_WARNING is copied here. */ - - -#ifdef __cplusplus -extern "C" { -#endif - - -#if @GNULIB_FPRINTF_POSIX@ -# if @REPLACE_FPRINTF@ -# define fprintf rpl_fprintf -extern int fprintf (FILE *fp, const char *format, ...) - __attribute__ ((__format__ (__printf__, 2, 3))); -# endif -#elif defined GNULIB_POSIXCHECK -# undef fprintf -# define fprintf \ - (GL_LINK_WARNING ("fprintf is not always POSIX compliant - " \ - "use gnulib module fprintf-posix for portable " \ - "POSIX compliance"), \ - fprintf) -#endif - -#if @GNULIB_VFPRINTF_POSIX@ -# if @REPLACE_VFPRINTF@ -# define vfprintf rpl_vfprintf -extern int vfprintf (FILE *fp, const char *format, va_list args) - __attribute__ ((__format__ (__printf__, 2, 0))); -# endif -#elif defined GNULIB_POSIXCHECK -# undef vfprintf -# define vfprintf(s,f,a) \ - (GL_LINK_WARNING ("vfprintf is not always POSIX compliant - " \ - "use gnulib module vfprintf-posix for portable " \ - "POSIX compliance"), \ - vfprintf (s, f, a)) -#endif - -#if @GNULIB_PRINTF_POSIX@ -# if @REPLACE_PRINTF@ -/* Don't break __attribute__((format(printf,M,N))). */ -# define printf __printf__ -extern int printf (const char *format, ...) - __attribute__ ((__format__ (__printf__, 1, 2))); -# endif -#elif defined GNULIB_POSIXCHECK -# undef printf -# define printf \ - (GL_LINK_WARNING ("printf is not always POSIX compliant - " \ - "use gnulib module printf-posix for portable " \ - "POSIX compliance"), \ - printf) -/* Don't break __attribute__((format(printf,M,N))). */ -# define format(kind,m,n) format (__##kind##__, m, n) -# define __format__(kind,m,n) __format__ (__##kind##__, m, n) -# define ____printf____ __printf__ -# define ____scanf____ __scanf__ -# define ____strftime____ __strftime__ -# define ____strfmon____ __strfmon__ -#endif - -#if @GNULIB_VPRINTF_POSIX@ -# if @REPLACE_VPRINTF@ -# define vprintf rpl_vprintf -extern int vprintf (const char *format, va_list args) - __attribute__ ((__format__ (__printf__, 1, 0))); -# endif -#elif defined GNULIB_POSIXCHECK -# undef vprintf -# define vprintf(f,a) \ - (GL_LINK_WARNING ("vprintf is not always POSIX compliant - " \ - "use gnulib module vprintf-posix for portable " \ - "POSIX compliance"), \ - vprintf (f, a)) -#endif - -#if @GNULIB_SNPRINTF@ -# if @REPLACE_SNPRINTF@ -# define snprintf rpl_snprintf -# endif -# if @REPLACE_SNPRINTF@ || !@HAVE_DECL_SNPRINTF@ -extern int snprintf (char *str, size_t size, const char *format, ...) - __attribute__ ((__format__ (__printf__, 3, 4))); -# endif -#elif defined GNULIB_POSIXCHECK -# undef snprintf -# define snprintf \ - (GL_LINK_WARNING ("snprintf is unportable - " \ - "use gnulib module snprintf for portability"), \ - snprintf) -#endif - -#if @GNULIB_VSNPRINTF@ -# if @REPLACE_VSNPRINTF@ -# define vsnprintf rpl_vsnprintf -# endif -# if @REPLACE_VSNPRINTF@ || !@HAVE_DECL_VSNPRINTF@ -extern int vsnprintf (char *str, size_t size, const char *format, va_list args) - __attribute__ ((__format__ (__printf__, 3, 0))); -# endif -#elif defined GNULIB_POSIXCHECK -# undef vsnprintf -# define vsnprintf(b,s,f,a) \ - (GL_LINK_WARNING ("vsnprintf is unportable - " \ - "use gnulib module vsnprintf for portability"), \ - vsnprintf (b, s, f, a)) -#endif - -#if @GNULIB_SPRINTF_POSIX@ -# if @REPLACE_SPRINTF@ -# define sprintf rpl_sprintf -extern int sprintf (char *str, const char *format, ...) - __attribute__ ((__format__ (__printf__, 2, 3))); -# endif -#elif defined GNULIB_POSIXCHECK -# undef sprintf -# define sprintf \ - (GL_LINK_WARNING ("sprintf is not always POSIX compliant - " \ - "use gnulib module sprintf-posix for portable " \ - "POSIX compliance"), \ - sprintf) -#endif - -#if @GNULIB_VSPRINTF_POSIX@ -# if @REPLACE_VSPRINTF@ -# define vsprintf rpl_vsprintf -extern int vsprintf (char *str, const char *format, va_list args) - __attribute__ ((__format__ (__printf__, 2, 0))); -# endif -#elif defined GNULIB_POSIXCHECK -# undef vsprintf -# define vsprintf(b,f,a) \ - (GL_LINK_WARNING ("vsprintf is not always POSIX compliant - " \ - "use gnulib module vsprintf-posix for portable " \ - "POSIX compliance"), \ - vsprintf (b, f, a)) -#endif - -#if @GNULIB_VASPRINTF@ -# if @REPLACE_VASPRINTF@ -# define asprintf rpl_asprintf -# define vasprintf rpl_vasprintf -# endif -# if @REPLACE_VASPRINTF@ || !@HAVE_VASPRINTF@ - /* Write formatted output to a string dynamically allocated with malloc(). - If the memory allocation succeeds, store the address of the string in - *RESULT and return the number of resulting bytes, excluding the trailing - NUL. Upon memory allocation error, or some other error, return -1. */ - extern int asprintf (char **result, const char *format, ...) - __attribute__ ((__format__ (__printf__, 2, 3))); - extern int vasprintf (char **result, const char *format, va_list args) - __attribute__ ((__format__ (__printf__, 2, 0))); -# endif -#endif - -#if @GNULIB_FSEEKO@ -# if @REPLACE_FSEEKO@ -/* Provide fseek, fseeko functions that are aware of a preceding - fflush(), and which detect pipes. */ -# define fseeko rpl_fseeko -extern int fseeko (FILE *fp, off_t offset, int whence); -# define fseek(fp, offset, whence) fseeko (fp, (off_t)(offset), whence) -# endif -#elif defined GNULIB_POSIXCHECK -# undef fseeko -# define fseeko(f,o,w) \ - (GL_LINK_WARNING ("fseeko is unportable - " \ - "use gnulib module fseeko for portability"), \ - fseeko (f, o, w)) -#endif - -#if @GNULIB_FSEEK@ && @REPLACE_FSEEK@ -extern int rpl_fseek (FILE *fp, long offset, int whence); -# undef fseek -# if defined GNULIB_POSIXCHECK -# define fseek(f,o,w) \ - (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \ - "on 32-bit platforms - " \ - "use fseeko function for handling of large files"), \ - rpl_fseek (f, o, w)) -# else -# define fseek rpl_fseek -# endif -#elif defined GNULIB_POSIXCHECK -# ifndef fseek -# define fseek(f,o,w) \ - (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \ - "on 32-bit platforms - " \ - "use fseeko function for handling of large files"), \ - fseek (f, o, w)) -# endif -#endif - -#if @GNULIB_FTELLO@ -# if @REPLACE_FTELLO@ -# define ftello rpl_ftello -extern off_t ftello (FILE *fp); -# define ftell(fp) ftello (fp) -# endif -#elif defined GNULIB_POSIXCHECK -# undef ftello -# define ftello(f) \ - (GL_LINK_WARNING ("ftello is unportable - " \ - "use gnulib module ftello for portability"), \ - ftello (f)) -#endif - -#if @GNULIB_FTELL@ && @REPLACE_FTELL@ -extern long rpl_ftell (FILE *fp); -# undef ftell -# if GNULIB_POSIXCHECK -# define ftell(f) \ - (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \ - "on 32-bit platforms - " \ - "use ftello function for handling of large files"), \ - rpl_ftell (f)) -# else -# define ftell rpl_ftell -# endif -#elif defined GNULIB_POSIXCHECK -# ifndef ftell -# define ftell(f) \ - (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \ - "on 32-bit platforms - " \ - "use ftello function for handling of large files"), \ - ftell (f)) -# endif -#endif - -#if @GNULIB_FFLUSH@ -# if @REPLACE_FFLUSH@ -# define fflush rpl_fflush - /* Flush all pending data on STREAM according to POSIX rules. Both - output and seekable input streams are supported. - Note! LOSS OF DATA can occur if fflush is applied on an input stream - that is _not_seekable_ or on an update stream that is _not_seekable_ - and in which the most recent operation was input. Seekability can - be tested with lseek(fileno(fp),0,SEEK_CUR). */ - extern int fflush (FILE *gl_stream); -# endif -#elif defined GNULIB_POSIXCHECK -# undef fflush -# define fflush(f) \ - (GL_LINK_WARNING ("fflush is not always POSIX compliant - " \ - "use gnulib module fflush for portable " \ - "POSIX compliance"), \ - fflush (f)) -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* _GL_STDIO_H */ -#endif /* _GL_STDIO_H */ -#endif diff -ruNp m4-1.4.10/lib/stdlib--.h m4-1.4.11/lib/stdlib--.h --- m4-1.4.10/lib/stdlib--.h 2007-05-30 19:30:38.000000000 -0600 +++ m4-1.4.11/lib/stdlib--.h 2007-12-01 13:55:34.000000000 -0700 @@ -2,10 +2,10 @@ Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -13,8 +13,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ diff -ruNp m4-1.4.10/lib/stdlib-safer.h m4-1.4.11/lib/stdlib-safer.h --- m4-1.4.10/lib/stdlib-safer.h 2007-05-30 19:30:38.000000000 -0600 +++ m4-1.4.11/lib/stdlib-safer.h 2007-12-01 13:55:34.000000000 -0700 @@ -2,10 +2,10 @@ Copyright (C) 2005 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -13,8 +13,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ diff -ruNp m4-1.4.10/lib/stdlib.in.h m4-1.4.11/lib/stdlib.in.h --- m4-1.4.10/lib/stdlib.in.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/lib/stdlib.in.h 2008-03-29 19:19:47.000000000 -0600 @@ -0,0 +1,225 @@ +/* A GNU-like <stdlib.h>. + + Copyright (C) 1995, 2001-2004, 2006-2008 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/>. */ + +#if defined __need_malloc_and_calloc +/* Special invocation convention inside glibc header files. */ + +#@INCLUDE_NEXT@ @NEXT_STDLIB_H@ + +#else +/* Normal invocation convention. */ + +#ifndef _GL_STDLIB_H + +/* The include_next requires a split double-inclusion guard. */ +#@INCLUDE_NEXT@ @NEXT_STDLIB_H@ + +#ifndef _GL_STDLIB_H +#define _GL_STDLIB_H + + +/* The definition of GL_LINK_WARNING is copied here. */ + + +/* Some systems do not define EXIT_*, despite otherwise supporting C89. */ +#ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +#endif +/* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere + with proper operation of xargs. */ +#ifndef EXIT_FAILURE +# define EXIT_FAILURE 1 +#elif EXIT_FAILURE != 1 +# undef EXIT_FAILURE +# define EXIT_FAILURE 1 +#endif + + +#ifdef __cplusplus +extern "C" { +#endif + + +#if @GNULIB_MALLOC_POSIX@ +# if !@HAVE_MALLOC_POSIX@ +# undef malloc +# define malloc rpl_malloc +extern void * malloc (size_t size); +# endif +#elif defined GNULIB_POSIXCHECK +# undef malloc +# define malloc(s) \ + (GL_LINK_WARNING ("malloc is not POSIX compliant everywhere - " \ + "use gnulib module malloc-posix for portability"), \ + malloc (s)) +#endif + + +#if @GNULIB_REALLOC_POSIX@ +# if !@HAVE_REALLOC_POSIX@ +# undef realloc +# define realloc rpl_realloc +extern void * realloc (void *ptr, size_t size); +# endif +#elif defined GNULIB_POSIXCHECK +# undef realloc +# define realloc(p,s) \ + (GL_LINK_WARNING ("realloc is not POSIX compliant everywhere - " \ + "use gnulib module realloc-posix for portability"), \ + realloc (p, s)) +#endif + + +#if @GNULIB_CALLOC_POSIX@ +# if !@HAVE_CALLOC_POSIX@ +# undef calloc +# define calloc rpl_calloc +extern void * calloc (size_t nmemb, size_t size); +# endif +#elif defined GNULIB_POSIXCHECK +# undef calloc +# define calloc(n,s) \ + (GL_LINK_WARNING ("calloc is not POSIX compliant everywhere - " \ + "use gnulib module calloc-posix for portability"), \ + calloc (n, s)) +#endif + + +#if @GNULIB_GETSUBOPT@ +/* Assuming *OPTIONP is a comma separated list of elements of the form + "token" or "token=value", getsubopt parses the first of these elements. + If the first element refers to a "token" that is member of the given + NULL-terminated array of tokens: + - It replaces the comma with a NUL byte, updates *OPTIONP to point past + the first option and the comma, sets *VALUEP to the value of the + element (or NULL if it doesn't contain an "=" sign), + - It returns the index of the "token" in the given array of tokens. + Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined. + For more details see the POSIX:2001 specification. + http://www.opengroup.org/susv3xsh/getsubopt.html */ +# if !@HAVE_GETSUBOPT@ +extern int getsubopt (char **optionp, char *const *tokens, char **valuep); +# endif +#elif defined GNULIB_POSIXCHECK +# undef getsubopt +# define getsubopt(o,t,v) \ + (GL_LINK_WARNING ("getsubopt is unportable - " \ + "use gnulib module getsubopt for portability"), \ + getsubopt (o, t, v)) +#endif + + +#if @GNULIB_MKDTEMP@ +# if !@HAVE_MKDTEMP@ +/* Create a unique temporary directory from TEMPLATE. + The last six characters of TEMPLATE must be "XXXXXX"; + they are replaced with a string that makes the directory name unique. + Returns TEMPLATE, or a null pointer if it cannot get a unique name. + The directory is created mode 700. */ +extern char * mkdtemp (char * /*template*/); +# endif +#elif defined GNULIB_POSIXCHECK +# undef mkdtemp +# define mkdtemp(t) \ + (GL_LINK_WARNING ("mkdtemp is unportable - " \ + "use gnulib module mkdtemp for portability"), \ + mkdtemp (t)) +#endif + + +#if @GNULIB_MKSTEMP@ +# if @REPLACE_MKSTEMP@ +/* Create a unique temporary file from TEMPLATE. + The last six characters of TEMPLATE must be "XXXXXX"; + they are replaced with a string that makes the file name unique. + The file is then created, ensuring it didn't exist before. + The file is created read-write (mask at least 0600 & ~umask), but it may be + world-readable and world-writable (mask 0666 & ~umask), depending on the + implementation. + Returns the open file descriptor if successful, otherwise -1 and errno + set. */ +# define mkstemp rpl_mkstemp +extern int mkstemp (char * /*template*/); +# else +/* On MacOS X 10.3, only <unistd.h> declares mkstemp. */ +# include <unistd.h> +# endif +#elif defined GNULIB_POSIXCHECK +# undef mkstemp +# define mkstemp(t) \ + (GL_LINK_WARNING ("mkstemp is unportable - " \ + "use gnulib module mkstemp for portability"), \ + mkstemp (t)) +#endif + + +#if @GNULIB_PUTENV@ +# if @REPLACE_PUTENV@ +# undef putenv +# define putenv rpl_putenv +extern int putenv (char *string); +# endif +#endif + + +#if @GNULIB_SETENV@ +# if !@HAVE_SETENV@ +/* Set NAME to VALUE in the environment. + If REPLACE is nonzero, overwrite an existing value. */ +extern int setenv (const char *name, const char *value, int replace); +# endif +#endif + + +#if @GNULIB_UNSETENV@ +# if @HAVE_UNSETENV@ +# if @VOID_UNSETENV@ +/* On some systems, unsetenv() returns void. + This is the case for MacOS X 10.3, FreeBSD 4.8, NetBSD 1.6, OpenBSD 3.4. */ +# define unsetenv(name) ((unsetenv)(name), 0) +# endif +# else +/* Remove the variable NAME from the environment. */ +extern int unsetenv (const char *name); +# endif +#endif + + +#if @GNULIB_STRTOD@ +# if @REPLACE_STRTOD@ +# define strtod rpl_strtod +# endif +# if !@HAVE_STRTOD@ || @REPLACE_STRTOD@ + /* Parse a double from STRING, updating ENDP if appropriate. */ +extern double strtod (const char *str, char **endp); +# endif +#elif defined GNULIB_POSIXCHECK +# undef strtod +# define strtod(s, e) \ + (GL_LINK_WARNING ("strtod is unportable - " \ + "use gnulib module strtod for portability"), \ + strtod (s, e)) +#endif + + +#ifdef __cplusplus +} +#endif + +#endif /* _GL_STDLIB_H */ +#endif /* _GL_STDLIB_H */ +#endif diff -ruNp m4-1.4.10/lib/stdlib_.h m4-1.4.11/lib/stdlib_.h --- m4-1.4.10/lib/stdlib_.h 2007-07-05 05:48:24.000000000 -0600 +++ m4-1.4.11/lib/stdlib_.h 1969-12-31 17:00:00.000000000 -0700 @@ -1,132 +0,0 @@ -/* A GNU-like <stdlib.h>. - - Copyright (C) 1995, 2001-2002, 2006-2007 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 2, 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#if defined __need_malloc_and_calloc -/* Special invocation convention inside glibc header files. */ - -#@INCLUDE_NEXT@ @NEXT_STDLIB_H@ - -#else -/* Normal invocation convention. */ - -#ifndef _GL_STDLIB_H - -/* The include_next requires a split double-inclusion guard. */ -#@INCLUDE_NEXT@ @NEXT_STDLIB_H@ - -#ifndef _GL_STDLIB_H -#define _GL_STDLIB_H - - -/* The definition of GL_LINK_WARNING is copied here. */ - - -/* Some systems do not define EXIT_*, despite otherwise supporting C89. */ -#ifndef EXIT_SUCCESS -# define EXIT_SUCCESS 0 -#endif -/* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere - with proper operation of xargs. */ -#ifndef EXIT_FAILURE -# define EXIT_FAILURE 1 -#elif EXIT_FAILURE != 1 -# undef EXIT_FAILURE -# define EXIT_FAILURE 1 -#endif - - -#ifdef __cplusplus -extern "C" { -#endif - - -#if @GNULIB_GETSUBOPT@ -/* Assuming *OPTIONP is a comma separated list of elements of the form - "token" or "token=value", getsubopt parses the first of these elements. - If the first element refers to a "token" that is member of the given - NULL-terminated array of tokens: - - It replaces the comma with a NUL byte, updates *OPTIONP to point past - the first option and the comma, sets *VALUEP to the value of the - element (or NULL if it doesn't contain an "=" sign), - - It returns the index of the "token" in the given array of tokens. - Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined. - For more details see the POSIX:2001 specification. - http://www.opengroup.org/susv3xsh/getsubopt.html */ -# if !@HAVE_GETSUBOPT@ -extern int getsubopt (char **optionp, char *const *tokens, char **valuep); -# endif -#elif defined GNULIB_POSIXCHECK -# undef getsubopt -# define getsubopt(o,t,v) \ - (GL_LINK_WARNING ("getsubopt is unportable - " \ - "use gnulib module getsubopt for portability"), \ - getsubopt (o, t, v)) -#endif - - -#if @GNULIB_MKDTEMP@ -# if !@HAVE_MKDTEMP@ -/* Create a unique temporary directory from TEMPLATE. - The last six characters of TEMPLATE must be "XXXXXX"; - they are replaced with a string that makes the directory name unique. - Returns TEMPLATE, or a null pointer if it cannot get a unique name. - The directory is created mode 700. */ -extern char * mkdtemp (char * /*template*/); -# endif -#elif defined GNULIB_POSIXCHECK -# undef mkdtemp -# define mkdtemp(t) \ - (GL_LINK_WARNING ("mkdtemp is unportable - " \ - "use gnulib module mkdtemp for portability"), \ - mkdtemp (t)) -#endif - - -#if @GNULIB_MKSTEMP@ -# if @REPLACE_MKSTEMP@ -/* Create a unique temporary file from TEMPLATE. - The last six characters of TEMPLATE must be "XXXXXX"; - they are replaced with a string that makes the file name unique. - The file is then created, ensuring it didn't exist before. - The file is created read-write (mask at least 0600 & ~umask), but it may be - world-readable and world-writable (mask 0666 & ~umask), depending on the - implementation. - Returns the open file descriptor if successful, otherwise -1 and errno - set. */ -# define mkstemp rpl_mkstemp -extern int mkstemp (char * /*template*/); -# else -/* On MacOS X 10.3, only <unistd.h> declares mkstemp. */ -# include <unistd.h> -# endif -#elif defined GNULIB_POSIXCHECK -# undef mkstemp -# define mkstemp(t) \ - (GL_LINK_WARNING ("mkstemp is unportable - " \ - "use gnulib module mkstemp for portability"), \ - mkstemp (t)) -#endif - - -#ifdef __cplusplus -} -#endif - -#endif /* _GL_STDLIB_H */ -#endif /* _GL_STDLIB_H */ -#endif diff -ruNp m4-1.4.10/lib/str-two-way.h m4-1.4.11/lib/str-two-way.h --- m4-1.4.10/lib/str-two-way.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/lib/str-two-way.h 2008-04-01 18:53:58.000000000 -0600 @@ -0,0 +1,427 @@ +/* Byte-wise substring search, using the Two-Way algorithm. + Copyright (C) 2008 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Written by Eric Blake <ebb9@byu.net>, 2008. + + 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, 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, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Before including this file, you need to include <config.h> and + <string.h>, and define: + RESULT_TYPE A macro that expands to the return type. + AVAILABLE(h, h_l, j, n_l) + A macro that returns nonzero if there are + at least N_L bytes left starting at H[J]. + H is 'unsigned char *', H_L, J, and N_L + are 'size_t'; H_L is an lvalue. For + NUL-terminated searches, H_L can be + modified each iteration to avoid having + to compute the end of H up front. + + For case-insensitivity, you may optionally define: + CMP_FUNC(p1, p2, l) A macro that returns 0 iff the first L + characters of P1 and P2 are equal. + CANON_ELEMENT(c) A macro that canonicalizes an element right after + it has been fetched from one of the two strings. + The argument is an 'unsigned char'; the result + must be an 'unsigned char' as well. + + This file undefines the macros documented above, and defines + LONG_NEEDLE_THRESHOLD. +*/ + +#include <limits.h> +#include <stdint.h> + +/* We use the Two-Way string matching algorithm, which guarantees + linear complexity with constant space. Additionally, for long + needles, we also use a bad character shift table similar to the + Boyer-Moore algorithm to achieve improved (potentially sub-linear) + performance. + + See http://www-igm.univ-mlv.fr/~lecroq/string/node26.html#SECTION00260 + and http://en.wikipedia.org/wiki/Boyer-Moore_string_search_algorithm +*/ + +/* Point at which computing a bad-byte shift table is likely to be + worthwhile. Small needles should not compute a table, since it + adds (1 << CHAR_BIT) + NEEDLE_LEN computations of preparation for a + speedup no greater than a factor of NEEDLE_LEN. The larger the + needle, the better the potential performance gain. On the other + hand, on non-POSIX systems with CHAR_BIT larger than eight, the + memory required for the table is prohibitive. */ +#if CHAR_BIT < 10 +# define LONG_NEEDLE_THRESHOLD 32U +#else +# define LONG_NEEDLE_THRESHOLD SIZE_MAX +#endif + +#define MAX(a, b) ((a < b) ? (b) : (a)) + +#ifndef CANON_ELEMENT +# define CANON_ELEMENT(c) c +#endif +#ifndef CMP_FUNC +# define CMP_FUNC memcmp +#endif + +/* Perform a critical factorization of NEEDLE, of length NEEDLE_LEN. + Return the index of the first byte in the right half, and set + *PERIOD to the global period of the right half. + + The global period of a string is the smallest index (possibly its + length) at which all remaining bytes in the string are repetitions + of the prefix (the last repetition may be a subset of the prefix). + + When NEEDLE is factored into two halves, a local period is the + length of the smallest word that shares a suffix with the left half + and shares a prefix with the right half. All factorizations of a + non-empty NEEDLE have a local period of at least 1 and no greater + than NEEDLE_LEN. + + A critical factorization has the property that the local period + equals the global period. All strings have at least one critical + factorization with the left half smaller than the global period. + + Given an ordered alphabet, a critical factorization can be computed + in linear time, with 2 * NEEDLE_LEN comparisons, by computing the + larger of two ordered maximal suffixes. The ordered maximal + suffixes are determined by lexicographic comparison of + periodicity. */ +static size_t +critical_factorization (const unsigned char *needle, size_t needle_len, + size_t *period) +{ + /* Index of last byte of left half, or SIZE_MAX. */ + size_t max_suffix, max_suffix_rev; + size_t j; /* Index into NEEDLE for current candidate suffix. */ + size_t k; /* Offset into current period. */ + size_t p; /* Intermediate period. */ + unsigned char a, b; /* Current comparison bytes. */ + + /* Invariants: + 0 <= j < NEEDLE_LEN - 1 + -1 <= max_suffix{,_rev} < j (treating SIZE_MAX as if it were signed) + min(max_suffix, max_suffix_rev) < global period of NEEDLE + 1 <= p <= global period of NEEDLE + p == global period of the substring NEEDLE[max_suffix{,_rev}+1...j] + 1 <= k <= p + */ + + /* Perform lexicographic search. */ + max_suffix = SIZE_MAX; + j = 0; + k = p = 1; + while (j + k < needle_len) + { + a = CANON_ELEMENT (needle[j + k]); + b = CANON_ELEMENT (needle[max_suffix + k]); + if (a < b) + { + /* Suffix is smaller, period is entire prefix so far. */ + j += k; + k = 1; + p = j - max_suffix; + } + else if (a == b) + { + /* Advance through repetition of the current period. */ + if (k != p) + ++k; + else + { + j += p; + k = 1; + } + } + else /* b < a */ + { + /* Suffix is larger, start over from current location. */ + max_suffix = j++; + k = p = 1; + } + } + *period = p; + + /* Perform reverse lexicographic search. */ + max_suffix_rev = SIZE_MAX; + j = 0; + k = p = 1; + while (j + k < needle_len) + { + a = CANON_ELEMENT (needle[j + k]); + b = CANON_ELEMENT (needle[max_suffix_rev + k]); + if (b < a) + { + /* Suffix is smaller, period is entire prefix so far. */ + j += k; + k = 1; + p = j - max_suffix_rev; + } + else if (a == b) + { + /* Advance through repetition of the current period. */ + if (k != p) + ++k; + else + { + j += p; + k = 1; + } + } + else /* a < b */ + { + /* Suffix is larger, start over from current location. */ + max_suffix_rev = j++; + k = p = 1; + } + } + + /* Choose the longer suffix. Return the first byte of the right + half, rather than the last byte of the left half. */ + if (max_suffix_rev + 1 < max_suffix + 1) + return max_suffix + 1; + *period = p; + return max_suffix_rev + 1; +} + +/* Return the first location of non-empty NEEDLE within HAYSTACK, or + NULL. HAYSTACK_LEN is the minimum known length of HAYSTACK. This + method is optimized for NEEDLE_LEN < LONG_NEEDLE_THRESHOLD. + Performance is guaranteed to be linear, with an initialization cost + of 2 * NEEDLE_LEN comparisons. + + If AVAILABLE does not modify HAYSTACK_LEN (as in memmem), then at + most 2 * HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching. + If AVAILABLE modifies HAYSTACK_LEN (as in strstr), then at most 3 * + HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching. */ +static RETURN_TYPE +two_way_short_needle (const unsigned char *haystack, size_t haystack_len, + const unsigned char *needle, size_t needle_len) +{ + size_t i; /* Index into current byte of NEEDLE. */ + size_t j; /* Index into current window of HAYSTACK. */ + size_t period; /* The period of the right half of needle. */ + size_t suffix; /* The index of the right half of needle. */ + + /* Factor the needle into two halves, such that the left half is + smaller than the global period, and the right half is + periodic (with a period as large as NEEDLE_LEN - suffix). */ + suffix = critical_factorization (needle, needle_len, &period); + + /* Perform the search. Each iteration compares the right half + first. */ + if (CMP_FUNC (needle, needle + period, suffix) == 0) + { + /* Entire needle is periodic; a mismatch can only advance by the + period, so use memory to avoid rescanning known occurrences + of the period. */ + size_t memory = 0; + j = 0; + while (AVAILABLE (haystack, haystack_len, j, needle_len)) + { + /* Scan for matches in right half. */ + i = MAX (suffix, memory); + while (i < needle_len && (CANON_ELEMENT (needle[i]) + == CANON_ELEMENT (haystack[i + j]))) + ++i; + if (needle_len <= i) + { + /* Scan for matches in left half. */ + i = suffix - 1; + while (memory < i + 1 && (CANON_ELEMENT (needle[i]) + == CANON_ELEMENT (haystack[i + j]))) + --i; + if (i + 1 < memory + 1) + return (RETURN_TYPE) (haystack + j); + /* No match, so remember how many repetitions of period + on the right half were scanned. */ + j += period; + memory = needle_len - period; + } + else + { + j += i - suffix + 1; + memory = 0; + } + } + } + else + { + /* The two halves of needle are distinct; no extra memory is + required, and any mismatch results in a maximal shift. */ + period = MAX (suffix, needle_len - suffix) + 1; + j = 0; + while (AVAILABLE (haystack, haystack_len, j, needle_len)) + { + /* Scan for matches in right half. */ + i = suffix; + while (i < needle_len && (CANON_ELEMENT (needle[i]) + == CANON_ELEMENT (haystack[i + j]))) + ++i; + if (needle_len <= i) + { + /* Scan for matches in left half. */ + i = suffix - 1; + while (i != SIZE_MAX && (CANON_ELEMENT (needle[i]) + == CANON_ELEMENT (haystack[i + j]))) + --i; + if (i == SIZE_MAX) + return (RETURN_TYPE) (haystack + j); + j += period; + } + else + j += i - suffix + 1; + } + } + return NULL; +} + +/* Return the first location of non-empty NEEDLE within HAYSTACK, or + NULL. HAYSTACK_LEN is the minimum known length of HAYSTACK. This + method is optimized for LONG_NEEDLE_THRESHOLD <= NEEDLE_LEN. + Performance is guaranteed to be linear, with an initialization cost + of 3 * NEEDLE_LEN + (1 << CHAR_BIT) operations. + + If AVAILABLE does not modify HAYSTACK_LEN (as in memmem), then at + most 2 * HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching, + and sublinear performance O(HAYSTACK_LEN / NEEDLE_LEN) is possible. + If AVAILABLE modifies HAYSTACK_LEN (as in strstr), then at most 3 * + HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching, and + sublinear performance is not possible. */ +static RETURN_TYPE +two_way_long_needle (const unsigned char *haystack, size_t haystack_len, + const unsigned char *needle, size_t needle_len) +{ + size_t i; /* Index into current byte of NEEDLE. */ + size_t j; /* Index into current window of HAYSTACK. */ + size_t period; /* The period of the right half of needle. */ + size_t suffix; /* The index of the right half of needle. */ + size_t shift_table[1U << CHAR_BIT]; /* See below. */ + + /* Factor the needle into two halves, such that the left half is + smaller than the global period, and the right half is + periodic (with a period as large as NEEDLE_LEN - suffix). */ + suffix = critical_factorization (needle, needle_len, &period); + + /* Populate shift_table. For each possible byte value c, + shift_table[c] is the distance from the last occurrence of c to + the end of NEEDLE, or NEEDLE_LEN if c is absent from the NEEDLE. + shift_table[NEEDLE[NEEDLE_LEN - 1]] contains the only 0. */ + for (i = 0; i < 1U << CHAR_BIT; i++) + shift_table[i] = needle_len; + for (i = 0; i < needle_len; i++) + shift_table[CANON_ELEMENT (needle[i])] = needle_len - i - 1; + + /* Perform the search. Each iteration compares the right half + first. */ + if (CMP_FUNC (needle, needle + period, suffix) == 0) + { + /* Entire needle is periodic; a mismatch can only advance by the + period, so use memory to avoid rescanning known occurrences + of the period. */ + size_t memory = 0; + size_t shift; + j = 0; + while (AVAILABLE (haystack, haystack_len, j, needle_len)) + { + /* Check the last byte first; if it does not match, then + shift to the next possible match location. */ + shift = shift_table[CANON_ELEMENT (haystack[j + needle_len - 1])]; + if (0 < shift) + { + if (memory && shift < period) + { + /* Since needle is periodic, but the last period has + a byte out of place, there can be no match until + after the mismatch. */ + shift = needle_len - period; + memory = 0; + } + j += shift; + continue; + } + /* Scan for matches in right half. The last byte has + already been matched, by virtue of the shift table. */ + i = MAX (suffix, memory); + while (i < needle_len - 1 && (CANON_ELEMENT (needle[i]) + == CANON_ELEMENT (haystack[i + j]))) + ++i; + if (needle_len - 1 <= i) + { + /* Scan for matches in left half. */ + i = suffix - 1; + while (memory < i + 1 && (CANON_ELEMENT (needle[i]) + == CANON_ELEMENT (haystack[i + j]))) + --i; + if (i + 1 < memory + 1) + return (RETURN_TYPE) (haystack + j); + /* No match, so remember how many repetitions of period + on the right half were scanned. */ + j += period; + memory = needle_len - period; + } + else + { + j += i - suffix + 1; + memory = 0; + } + } + } + else + { + /* The two halves of needle are distinct; no extra memory is + required, and any mismatch results in a maximal shift. */ + size_t shift; + period = MAX (suffix, needle_len - suffix) + 1; + j = 0; + while (AVAILABLE (haystack, haystack_len, j, needle_len)) + { + /* Check the last byte first; if it does not match, then + shift to the next possible match location. */ + shift = shift_table[CANON_ELEMENT (haystack[j + needle_len - 1])]; + if (0 < shift) + { + j += shift; + continue; + } + /* Scan for matches in right half. The last byte has + already been matched, by virtue of the shift table. */ + i = suffix; + while (i < needle_len - 1 && (CANON_ELEMENT (needle[i]) + == CANON_ELEMENT (haystack[i + j]))) + ++i; + if (needle_len - 1 <= i) + { + /* Scan for matches in left half. */ + i = suffix - 1; + while (i != SIZE_MAX && (CANON_ELEMENT (needle[i]) + == CANON_ELEMENT (haystack[i + j]))) + --i; + if (i == SIZE_MAX) + return (RETURN_TYPE) (haystack + j); + j += period; + } + else + j += i - suffix + 1; + } + } + return NULL; +} + +#undef AVAILABLE +#undef CANON_ELEMENT +#undef CMP_FUNC +#undef MAX +#undef RETURN_TYPE diff -ruNp m4-1.4.10/lib/strerror.c m4-1.4.11/lib/strerror.c --- m4-1.4.10/lib/strerror.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/lib/strerror.c 2007-10-26 21:16:06.000000000 -0600 @@ -0,0 +1,49 @@ +/* strerror.c --- POSIX compatible system error routine + + Copyright (C) 2007 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/>. */ + +#include <config.h> + +#include <string.h> + +#if REPLACE_STRERROR + +# include <stdio.h> + +# include "intprops.h" + +# undef strerror +# if ! HAVE_DECL_STRERROR +# define strerror(n) NULL +# endif + +char * +rpl_strerror (int n) +{ + char *result = strerror (n); + + if (result == NULL || result[0] == '\0') + { + static char const fmt[] = "Unknown error (%d)"; + static char mesg[sizeof fmt + INT_STRLEN_BOUND (n)]; + sprintf (mesg, fmt, n); + return mesg; + } + + return result; +} + +#endif diff -ruNp m4-1.4.10/lib/string.in.h m4-1.4.11/lib/string.in.h --- m4-1.4.10/lib/string.in.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/lib/string.in.h 2008-01-14 22:04:38.000000000 -0700 @@ -0,0 +1,569 @@ +/* A GNU-like <string.h>. + + Copyright (C) 1995-1996, 2001-2008 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, 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, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef _GL_STRING_H + +/* The include_next requires a split double-inclusion guard. */ +#@INCLUDE_NEXT@ @NEXT_STRING_H@ + +#ifndef _GL_STRING_H +#define _GL_STRING_H + + +#ifndef __attribute__ +/* This feature is available in gcc versions 2.5 and later. */ +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) +# define __attribute__(Spec) /* empty */ +# endif +/* The attribute __pure__ was added in gcc 2.96. */ +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 96) +# define __pure__ /* empty */ +# endif +#endif + + +/* The definition of GL_LINK_WARNING is copied here. */ + + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Return the first occurrence of NEEDLE in HAYSTACK. */ +#if @GNULIB_MEMMEM@ +# if @REPLACE_MEMMEM@ +# define memmem rpl_memmem +# endif +# if ! @HAVE_DECL_MEMMEM@ || @REPLACE_MEMMEM@ +extern void *memmem (void const *__haystack, size_t __haystack_len, + void const *__needle, size_t __needle_len) + __attribute__ ((__pure__)); +# endif +#elif defined GNULIB_POSIXCHECK +# undef memmem +# define memmem(a,al,b,bl) \ + (GL_LINK_WARNING ("memmem is unportable and often quadratic - " \ + "use gnulib module memmem-simple for portability, " \ + "and module memmem for speed" ), \ + memmem (a, al, b, bl)) +#endif + +/* Copy N bytes of SRC to DEST, return pointer to bytes after the + last written byte. */ +#if @GNULIB_MEMPCPY@ +# if ! @HAVE_MEMPCPY@ +extern void *mempcpy (void *restrict __dest, void const *restrict __src, + size_t __n); +# endif +#elif defined GNULIB_POSIXCHECK +# undef mempcpy +# define mempcpy(a,b,n) \ + (GL_LINK_WARNING ("mempcpy is unportable - " \ + "use gnulib module mempcpy for portability"), \ + mempcpy (a, b, n)) +#endif + +/* Search backwards through a block for a byte (specified as an int). */ +#if @GNULIB_MEMRCHR@ +# if ! @HAVE_DECL_MEMRCHR@ +extern void *memrchr (void const *, int, size_t) + __attribute__ ((__pure__)); +# endif +#elif defined GNULIB_POSIXCHECK +# undef memrchr +# define memrchr(a,b,c) \ + (GL_LINK_WARNING ("memrchr is unportable - " \ + "use gnulib module memrchr for portability"), \ + memrchr (a, b, c)) +#endif + +/* Copy SRC to DST, returning the address of the terminating '\0' in DST. */ +#if @GNULIB_STPCPY@ +# if ! @HAVE_STPCPY@ +extern char *stpcpy (char *restrict __dst, char const *restrict __src); +# endif +#elif defined GNULIB_POSIXCHECK +# undef stpcpy +# define stpcpy(a,b) \ + (GL_LINK_WARNING ("stpcpy is unportable - " \ + "use gnulib module stpcpy for portability"), \ + stpcpy (a, b)) +#endif + +/* Copy no more than N bytes of SRC to DST, returning a pointer past the + last non-NUL byte written into DST. */ +#if @GNULIB_STPNCPY@ +# if ! @HAVE_STPNCPY@ +# define stpncpy gnu_stpncpy +extern char *stpncpy (char *restrict __dst, char const *restrict __src, + size_t __n); +# endif +#elif defined GNULIB_POSIXCHECK +# undef stpncpy +# define stpncpy(a,b,n) \ + (GL_LINK_WARNING ("stpncpy is unportable - " \ + "use gnulib module stpncpy for portability"), \ + stpncpy (a, b, n)) +#endif + +#if defined GNULIB_POSIXCHECK +/* strchr() does not work with multibyte strings if the locale encoding is + GB18030 and the character to be searched is a digit. */ +# undef strchr +# define strchr(s,c) \ + (GL_LINK_WARNING ("strchr cannot work correctly on character strings " \ + "in some multibyte locales - " \ + "use mbschr if you care about internationalization"), \ + strchr (s, c)) +#endif + +/* Find the first occurrence of C in S or the final NUL byte. */ +#if @GNULIB_STRCHRNUL@ +# if ! @HAVE_STRCHRNUL@ +extern char *strchrnul (char const *__s, int __c_in) + __attribute__ ((__pure__)); +# endif +#elif defined GNULIB_POSIXCHECK +# undef strchrnul +# define strchrnul(a,b) \ + (GL_LINK_WARNING ("strchrnul is unportable - " \ + "use gnulib module strchrnul for portability"), \ + strchrnul (a, b)) +#endif + +/* Duplicate S, returning an identical malloc'd string. */ +#if @GNULIB_STRDUP@ +# if ! @HAVE_DECL_STRDUP@ && ! defined strdup +extern char *strdup (char const *__s); +# endif +#elif defined GNULIB_POSIXCHECK +# undef strdup +# define strdup(a) \ + (GL_LINK_WARNING ("strdup is unportable - " \ + "use gnulib module strdup for portability"), \ + strdup (a)) +#endif + +/* Return a newly allocated copy of at most N bytes of STRING. */ +#if @GNULIB_STRNDUP@ +# if ! @HAVE_STRNDUP@ +# undef strndup +# define strndup rpl_strndup +# endif +# if ! @HAVE_STRNDUP@ || ! @HAVE_DECL_STRNDUP@ +extern char *strndup (char const *__string, size_t __n); +# endif +#elif defined GNULIB_POSIXCHECK +# undef strndup +# define strndup(a,n) \ + (GL_LINK_WARNING ("strndup is unportable - " \ + "use gnulib module strndup for portability"), \ + strndup (a, n)) +#endif + +/* Find the length (number of bytes) of STRING, but scan at most + MAXLEN bytes. If no '\0' terminator is found in that many bytes, + return MAXLEN. */ +#if @GNULIB_STRNLEN@ +# if ! @HAVE_DECL_STRNLEN@ +extern size_t strnlen (char const *__string, size_t __maxlen) + __attribute__ ((__pure__)); +# endif +#elif defined GNULIB_POSIXCHECK +# undef strnlen +# define strnlen(a,n) \ + (GL_LINK_WARNING ("strnlen is unportable - " \ + "use gnulib module strnlen for portability"), \ + strnlen (a, n)) +#endif + +#if defined GNULIB_POSIXCHECK +/* strcspn() assumes the second argument is a list of single-byte characters. + Even in this simple case, it does not work with multibyte strings if the + locale encoding is GB18030 and one of the characters to be searched is a + digit. */ +# undef strcspn +# define strcspn(s,a) \ + (GL_LINK_WARNING ("strcspn cannot work correctly on character strings " \ + "in multibyte locales - " \ + "use mbscspn if you care about internationalization"), \ + strcspn (s, a)) +#endif + +/* Find the first occurrence in S of any character in ACCEPT. */ +#if @GNULIB_STRPBRK@ +# if ! @HAVE_STRPBRK@ +extern char *strpbrk (char const *__s, char const *__accept) + __attribute__ ((__pure__)); +# endif +# if defined GNULIB_POSIXCHECK +/* strpbrk() assumes the second argument is a list of single-byte characters. + Even in this simple case, it does not work with multibyte strings if the + locale encoding is GB18030 and one of the characters to be searched is a + digit. */ +# undef strpbrk +# define strpbrk(s,a) \ + (GL_LINK_WARNING ("strpbrk cannot work correctly on character strings " \ + "in multibyte locales - " \ + "use mbspbrk if you care about internationalization"), \ + strpbrk (s, a)) +# endif +#elif defined GNULIB_POSIXCHECK +# undef strpbrk +# define strpbrk(s,a) \ + (GL_LINK_WARNING ("strpbrk is unportable - " \ + "use gnulib module strpbrk for portability"), \ + strpbrk (s, a)) +#endif + +#if defined GNULIB_POSIXCHECK +/* strspn() assumes the second argument is a list of single-byte characters. + Even in this simple case, it cannot work with multibyte strings. */ +# undef strspn +# define strspn(s,a) \ + (GL_LINK_WARNING ("strspn cannot work correctly on character strings " \ + "in multibyte locales - " \ + "use mbsspn if you care about internationalization"), \ + strspn (s, a)) +#endif + +#if defined GNULIB_POSIXCHECK +/* strrchr() does not work with multibyte strings if the locale encoding is + GB18030 and the character to be searched is a digit. */ +# undef strrchr +# define strrchr(s,c) \ + (GL_LINK_WARNING ("strrchr cannot work correctly on character strings " \ + "in some multibyte locales - " \ + "use mbsrchr if you care about internationalization"), \ + strrchr (s, c)) +#endif + +/* Search the next delimiter (char listed in DELIM) starting at *STRINGP. + If one is found, overwrite it with a NUL, and advance *STRINGP + to point to the next char after it. Otherwise, set *STRINGP to NULL. + If *STRINGP was already NULL, nothing happens. + Return the old value of *STRINGP. + + This is a variant of strtok() that is multithread-safe and supports + empty fields. + + Caveat: It modifies the original string. + Caveat: These functions cannot be used on constant strings. + Caveat: The identity of the delimiting character is lost. + Caveat: It doesn't work with multibyte strings unless all of the delimiter + characters are ASCII characters < 0x30. + + See also strtok_r(). */ +#if @GNULIB_STRSEP@ +# if ! @HAVE_STRSEP@ +extern char *strsep (char **restrict __stringp, char const *restrict __delim); +# endif +# if defined GNULIB_POSIXCHECK +# undef strsep +# define strsep(s,d) \ + (GL_LINK_WARNING ("strsep cannot work correctly on character strings " \ + "in multibyte locales - " \ + "use mbssep if you care about internationalization"), \ + strsep (s, d)) +# endif +#elif defined GNULIB_POSIXCHECK +# undef strsep +# define strsep(s,d) \ + (GL_LINK_WARNING ("strsep is unportable - " \ + "use gnulib module strsep for portability"), \ + strsep (s, d)) +#endif + +#if @GNULIB_STRSTR@ +# if @REPLACE_STRSTR@ +# define strstr rpl_strstr +char *strstr (const char *haystack, const char *needle) + __attribute__ ((__pure__)); +# endif +#elif defined GNULIB_POSIXCHECK +/* strstr() does not work with multibyte strings if the locale encoding is + different from UTF-8: + POSIX says that it operates on "strings", and "string" in POSIX is defined + as a sequence of bytes, not of characters. */ +# undef strstr +# define strstr(a,b) \ + (GL_LINK_WARNING ("strstr is quadratic on many systems, and cannot " \ + "work correctly on character strings in most " \ + "multibyte locales - " \ + "use mbsstr if you care about internationalization, " \ + "or use strstr if you care about speed"), \ + strstr (a, b)) +#endif + +/* Find the first occurrence of NEEDLE in HAYSTACK, using case-insensitive + comparison. */ +#if @GNULIB_STRCASESTR@ +# if @REPLACE_STRCASESTR@ +# define strcasestr rpl_strcasestr +# endif +# if ! @HAVE_STRCASESTR@ || @REPLACE_STRCASESTR@ +extern char *strcasestr (const char *haystack, const char *needle) + __attribute__ ((__pure__)); +# endif +#elif defined GNULIB_POSIXCHECK +/* strcasestr() does not work with multibyte strings: + It is a glibc extension, and glibc implements it only for unibyte + locales. */ +# undef strcasestr +# define strcasestr(a,b) \ + (GL_LINK_WARNING ("strcasestr does work correctly on character strings " \ + "in multibyte locales - " \ + "use mbscasestr if you care about " \ + "internationalization, or use c-strcasestr if you want " \ + "a locale independent function"), \ + strcasestr (a, b)) +#endif + +/* Parse S into tokens separated by characters in DELIM. + If S is NULL, the saved pointer in SAVE_PTR is used as + the next starting point. For example: + char s[] = "-abc-=-def"; + char *sp; + x = strtok_r(s, "-", &sp); // x = "abc", sp = "=-def" + x = strtok_r(NULL, "-=", &sp); // x = "def", sp = NULL + x = strtok_r(NULL, "=", &sp); // x = NULL + // s = "abc\0-def\0" + + This is a variant of strtok() that is multithread-safe. + + For the POSIX documentation for this function, see: + http://www.opengroup.org/susv3xsh/strtok.html + + Caveat: It modifies the original string. + Caveat: These functions cannot be used on constant strings. + Caveat: The identity of the delimiting character is lost. + Caveat: It doesn't work with multibyte strings unless all of the delimiter + characters are ASCII characters < 0x30. + + See also strsep(). */ +#if @GNULIB_STRTOK_R@ +# if ! @HAVE_DECL_STRTOK_R@ +extern char *strtok_r (char *restrict s, char const *restrict delim, + char **restrict save_ptr); +# endif +# if defined GNULIB_POSIXCHECK +# undef strtok_r +# define strtok_r(s,d,p) \ + (GL_LINK_WARNING ("strtok_r cannot work correctly on character strings " \ + "in multibyte locales - " \ + "use mbstok_r if you care about internationalization"), \ + strtok_r (s, d, p)) +# endif +#elif defined GNULIB_POSIXCHECK +# undef strtok_r +# define strtok_r(s,d,p) \ + (GL_LINK_WARNING ("strtok_r is unportable - " \ + "use gnulib module strtok_r for portability"), \ + strtok_r (s, d, p)) +#endif + + +/* The following functions are not specified by POSIX. They are gnulib + extensions. */ + +#if @GNULIB_MBSLEN@ +/* Return the number of multibyte characters in the character string STRING. + This considers multibyte characters, unlike strlen, which counts bytes. */ +extern size_t mbslen (const char *string); +#endif + +#if @GNULIB_MBSNLEN@ +/* Return the number of multibyte characters in the character string starting + at STRING and ending at STRING + LEN. */ +extern size_t mbsnlen (const char *string, size_t len); +#endif + +#if @GNULIB_MBSCHR@ +/* Locate the first single-byte character C in the character string STRING, + and return a pointer to it. Return NULL if C is not found in STRING. + Unlike strchr(), this function works correctly in multibyte locales with + encodings such as GB18030. */ +# define mbschr rpl_mbschr /* avoid collision with HP-UX function */ +extern char * mbschr (const char *string, int c); +#endif + +#if @GNULIB_MBSRCHR@ +/* Locate the last single-byte character C in the character string STRING, + and return a pointer to it. Return NULL if C is not found in STRING. + Unlike strrchr(), this function works correctly in multibyte locales with + encodings such as GB18030. */ +# define mbsrchr rpl_mbsrchr /* avoid collision with HP-UX function */ +extern char * mbsrchr (const char *string, int c); +#endif + +#if @GNULIB_MBSSTR@ +/* Find the first occurrence of the character string NEEDLE in the character + string HAYSTACK. Return NULL if NEEDLE is not found in HAYSTACK. + Unlike strstr(), this function works correctly in multibyte locales with + encodings different from UTF-8. */ +extern char * mbsstr (const char *haystack, const char *needle); +#endif + +#if @GNULIB_MBSCASECMP@ +/* Compare the character strings S1 and S2, ignoring case, returning less than, + equal to or greater than zero if S1 is lexicographically less than, equal to + or greater than S2. + Note: This function may, in multibyte locales, return 0 for strings of + different lengths! + Unlike strcasecmp(), this function works correctly in multibyte locales. */ +extern int mbscasecmp (const char *s1, const char *s2); +#endif + +#if @GNULIB_MBSNCASECMP@ +/* Compare the initial segment of the character string S1 consisting of at most + N characters with the initial segment of the character string S2 consisting + of at most N characters, ignoring case, returning less than, equal to or + greater than zero if the initial segment of S1 is lexicographically less + than, equal to or greater than the initial segment of S2. + Note: This function may, in multibyte locales, return 0 for initial segments + of different lengths! + Unlike strncasecmp(), this function works correctly in multibyte locales. + But beware that N is not a byte count but a character count! */ +extern int mbsncasecmp (const char *s1, const char *s2, size_t n); +#endif + +#if @GNULIB_MBSPCASECMP@ +/* Compare the initial segment of the character string STRING consisting of + at most mbslen (PREFIX) characters with the character string PREFIX, + ignoring case, returning less than, equal to or greater than zero if this + initial segment is lexicographically less than, equal to or greater than + PREFIX. + Note: This function may, in multibyte locales, return 0 if STRING is of + smaller length than PREFIX! + Unlike strncasecmp(), this function works correctly in multibyte + locales. */ +extern char * mbspcasecmp (const char *string, const char *prefix); +#endif + +#if @GNULIB_MBSCASESTR@ +/* Find the first occurrence of the character string NEEDLE in the character + string HAYSTACK, using case-insensitive comparison. + Note: This function may, in multibyte locales, return success even if + strlen (haystack) < strlen (needle) ! + Unlike strcasestr(), this function works correctly in multibyte locales. */ +extern char * mbscasestr (const char *haystack, const char *needle); +#endif + +#if @GNULIB_MBSCSPN@ +/* Find the first occurrence in the character string STRING of any character + in the character string ACCEPT. Return the number of bytes from the + beginning of the string to this occurrence, or to the end of the string + if none exists. + Unlike strcspn(), this function works correctly in multibyte locales. */ +extern size_t mbscspn (const char *string, const char *accept); +#endif + +#if @GNULIB_MBSPBRK@ +/* Find the first occurrence in the character string STRING of any character + in the character string ACCEPT. Return the pointer to it, or NULL if none + exists. + Unlike strpbrk(), this function works correctly in multibyte locales. */ +# define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */ +extern char * mbspbrk (const char *string, const char *accept); +#endif + +#if @GNULIB_MBSSPN@ +/* Find the first occurrence in the character string STRING of any character + not in the character string REJECT. Return the number of bytes from the + beginning of the string to this occurrence, or to the end of the string + if none exists. + Unlike strspn(), this function works correctly in multibyte locales. */ +extern size_t mbsspn (const char *string, const char *reject); +#endif + +#if @GNULIB_MBSSEP@ +/* Search the next delimiter (multibyte character listed in the character + string DELIM) starting at the character string *STRINGP. + If one is found, overwrite it with a NUL, and advance *STRINGP to point + to the next multibyte character after it. Otherwise, set *STRINGP to NULL. + If *STRINGP was already NULL, nothing happens. + Return the old value of *STRINGP. + + This is a variant of mbstok_r() that supports empty fields. + + Caveat: It modifies the original string. + Caveat: These functions cannot be used on constant strings. + Caveat: The identity of the delimiting character is lost. + + See also mbstok_r(). */ +extern char * mbssep (char **stringp, const char *delim); +#endif + +#if @GNULIB_MBSTOK_R@ +/* Parse the character string STRING into tokens separated by characters in + the character string DELIM. + If STRING is NULL, the saved pointer in SAVE_PTR is used as + the next starting point. For example: + char s[] = "-abc-=-def"; + char *sp; + x = mbstok_r(s, "-", &sp); // x = "abc", sp = "=-def" + x = mbstok_r(NULL, "-=", &sp); // x = "def", sp = NULL + x = mbstok_r(NULL, "=", &sp); // x = NULL + // s = "abc\0-def\0" + + Caveat: It modifies the original string. + Caveat: These functions cannot be used on constant strings. + Caveat: The identity of the delimiting character is lost. + + See also mbssep(). */ +extern char * mbstok_r (char *string, const char *delim, char **save_ptr); +#endif + +/* Map any int, typically from errno, into an error message. */ +#if @GNULIB_STRERROR@ +# if @REPLACE_STRERROR@ +# undef strerror +# define strerror rpl_strerror +extern char *strerror (int); +# endif +#elif defined GNULIB_POSIXCHECK +# undef strerror +# define strerror(e) \ + (GL_LINK_WARNING ("strerror is unportable - " \ + "use gnulib module strerror to guarantee non-NULL result"), \ + strerror (e)) +#endif + +#if @GNULIB_STRSIGNAL@ +# if @REPLACE_STRSIGNAL@ +# define strsignal rpl_strsignal +# endif +# if ! @HAVE_DECL_STRSIGNAL@ || @REPLACE_STRSIGNAL@ +extern char *strsignal (int __sig); +# endif +#elif defined GNULIB_POSIXCHECK +# undef strsignal +# define strsignal(a) \ + (GL_LINK_WARNING ("strsignal is unportable - " \ + "use gnulib module strsignal for portability"), \ + strsignal (a)) +#endif + + +#ifdef __cplusplus +} +#endif + +#endif /* _GL_STRING_H */ +#endif /* _GL_STRING_H */ diff -ruNp m4-1.4.10/lib/strstr.c m4-1.4.11/lib/strstr.c --- m4-1.4.10/lib/strstr.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/lib/strstr.c 2008-04-01 18:53:58.000000000 -0600 @@ -0,0 +1,83 @@ +/* Copyright (C) 1991,92,93,94,96,97,98,2000,2004,2007,2008 Free Software + Foundation, Inc. + This file is part of the GNU C Library. + + 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, 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, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* This particular implementation was written by Eric Blake, 2008. */ + +#ifndef _LIBC +# include <config.h> +#endif + +/* Specification of strstr. */ +#include <string.h> + +#include <stdbool.h> + +#ifndef _LIBC +# define __builtin_expect(expr, val) (expr) +#endif + +#define RETURN_TYPE char * +#define AVAILABLE(h, h_l, j, n_l) \ + (!memchr ((h) + (h_l), '\0', (j) + (n_l) - (h_l)) \ + && ((h_l) = (j) + (n_l))) +#include "str-two-way.h" + +/* Return the first occurrence of NEEDLE in HAYSTACK. Return HAYSTACK + if NEEDLE is empty, otherwise NULL if NEEDLE is not found in + HAYSTACK. */ +char * +strstr (const char *haystack_start, const char *needle_start) +{ + const char *haystack = haystack_start; + const char *needle = needle_start; + size_t needle_len; /* Length of NEEDLE. */ + size_t haystack_len; /* Known minimum length of HAYSTACK. */ + bool ok = true; /* True if NEEDLE is prefix of HAYSTACK. */ + + /* Determine length of NEEDLE, and in the process, make sure + HAYSTACK is at least as long (no point processing all of a long + NEEDLE if HAYSTACK is too short). */ + while (*haystack && *needle) + ok &= *haystack++ == *needle++; + if (*needle) + return NULL; + if (ok) + return (char *) haystack_start; + + /* Reduce the size of haystack using strchr, since it has a smaller + linear coefficient than the Two-Way algorithm. */ + needle_len = needle - needle_start; + haystack = strchr (haystack_start + 1, *needle_start); + if (!haystack || __builtin_expect (needle_len == 1, 0)) + return (char *) haystack; + needle -= needle_len; + haystack_len = (haystack > haystack_start + needle_len ? 1 + : needle_len + haystack_start - haystack); + + /* Perform the search. Abstract memory is considered to be an array + of 'unsigned char' values, not an array of 'char' values. See + ISO C 99 section 6.2.6.1. */ + if (needle_len < LONG_NEEDLE_THRESHOLD) + return two_way_short_needle ((const unsigned char *) haystack, + haystack_len, + (const unsigned char *) needle, needle_len); + return two_way_long_needle ((const unsigned char *) haystack, haystack_len, + (const unsigned char *) needle, needle_len); +} + +#undef LONG_NEEDLE_THRESHOLD diff -ruNp m4-1.4.10/lib/strtod.c m4-1.4.11/lib/strtod.c --- m4-1.4.10/lib/strtod.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/lib/strtod.c 2008-03-30 16:07:14.000000000 -0600 @@ -0,0 +1,272 @@ +/* Copyright (C) 1991, 1992, 1997, 1999, 2003, 2006, 2008 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/>. */ + +#include <config.h> + +#include <stdlib.h> + +#include <ctype.h> +#include <errno.h> +#include <float.h> +#include <math.h> +#include <stdbool.h> +#include <string.h> + +#include "c-ctype.h" + +/* Convert NPTR to a double. If ENDPTR is not NULL, a pointer to the + character after the last one used in the number is put in *ENDPTR. */ +double +strtod (const char *nptr, char **endptr) +{ + const unsigned char *s; + bool negative = false; + + /* The number so far. */ + double num; + + bool got_dot; /* Found a decimal point. */ + bool got_digit; /* Seen any digits. */ + bool hex = false; /* Look for hex float exponent. */ + + /* The exponent of the number. */ + long int exponent; + + if (nptr == NULL) + { + errno = EINVAL; + goto noconv; + } + + /* Use unsigned char for the ctype routines. */ + s = (unsigned char *) nptr; + + /* Eat whitespace. */ + while (isspace (*s)) + ++s; + + /* Get the sign. */ + negative = *s == '-'; + if (*s == '-' || *s == '+') + ++s; + + num = 0.0; + got_dot = false; + got_digit = false; + exponent = 0; + + /* Check for hex float. */ + if (*s == '0' && c_tolower (s[1]) == 'x' + && (c_isxdigit (s[2]) || ('.' == s[2] && c_isxdigit (s[3])))) + { + hex = true; + s += 2; + for (;; ++s) + { + if (c_isxdigit (*s)) + { + got_digit = true; + + /* Make sure that multiplication by 16 will not overflow. */ + if (num > DBL_MAX / 16) + /* The value of the digit doesn't matter, since we have already + gotten as many digits as can be represented in a `double'. + This doesn't necessarily mean the result will overflow. + The exponent may reduce it to within range. + + We just need to record that there was another + digit so that we can multiply by 16 later. */ + ++exponent; + else + num = ((num * 16.0) + + (c_tolower (*s) - (c_isdigit (*s) ? '0' : 'a' - 10))); + + /* Keep track of the number of digits after the decimal point. + If we just divided by 16 here, we would lose precision. */ + if (got_dot) + --exponent; + } + else if (!got_dot && *s == '.') + /* Record that we have found the decimal point. */ + got_dot = true; + else + /* Any other character terminates the number. */ + break; + } + } + + /* Not a hex float. */ + else + { + for (;; ++s) + { + if (c_isdigit (*s)) + { + got_digit = true; + + /* Make sure that multiplication by 10 will not overflow. */ + if (num > DBL_MAX * 0.1) + /* The value of the digit doesn't matter, since we have already + gotten as many digits as can be represented in a `double'. + This doesn't necessarily mean the result will overflow. + The exponent may reduce it to within range. + + We just need to record that there was another + digit so that we can multiply by 10 later. */ + ++exponent; + else + num = (num * 10.0) + (*s - '0'); + + /* Keep track of the number of digits after the decimal point. + If we just divided by 10 here, we would lose precision. */ + if (got_dot) + --exponent; + } + else if (!got_dot && *s == '.') + /* Record that we have found the decimal point. */ + got_dot = true; + else + /* Any other character terminates the number. */ + break; + } + } + + if (!got_digit) + { + /* Check for infinities and NaNs. */ + if (c_tolower (*s) == 'i' + && c_tolower (s[1]) == 'n' + && c_tolower (s[2]) == 'f') + { + s += 3; + num = HUGE_VAL; + if (c_tolower (*s) == 'i' + && c_tolower (s[1]) == 'n' + && c_tolower (s[2]) == 'i' + && c_tolower (s[3]) == 't' + && c_tolower (s[4]) == 'y') + s += 5; + goto valid; + } +#ifdef NAN + else if (c_tolower (*s) == 'n' + && c_tolower (s[1]) == 'a' + && c_tolower (s[2]) == 'n') + { + s += 3; + num = NAN; + /* Since nan(<n-char-sequence>) is implementation-defined, + we define it by ignoring <n-char-sequence>. A nicer + implementation would populate the bits of the NaN + according to interpreting n-char-sequence as a + hexadecimal number, but the result is still a NaN. */ + if (*s == '(') + { + const unsigned char *p = s + 1; + while (c_isalnum (*p)) + p++; + if (*p == ')') + s = p + 1; + } + goto valid; + } +#endif + goto noconv; + } + + if (c_tolower (*s) == (hex ? 'p' : 'e') && !isspace (s[1])) + { + /* Get the exponent specified after the `e' or `E'. */ + int save = errno; + char *end; + long int value; + + errno = 0; + ++s; + value = strtol ((char *) s, &end, 10); + if (errno == ERANGE && num) + { + /* The exponent overflowed a `long int'. It is probably a safe + assumption that an exponent that cannot be represented by + a `long int' exceeds the limits of a `double'. */ + if (endptr != NULL) + *endptr = end; + if (value < 0) + goto underflow; + else + goto overflow; + } + else if (end == (char *) s) + /* There was no exponent. Reset END to point to + the 'e' or 'E', so *ENDPTR will be set there. */ + end = (char *) s - 1; + errno = save; + s = (unsigned char *) end; + exponent += value; + } + + if (num == 0.0) + goto valid; + + if (hex) + { + /* ldexp takes care of range errors. */ + num = ldexp (num, exponent); + goto valid; + } + + /* Multiply NUM by 10 to the EXPONENT power, + checking for overflow and underflow. */ + + if (exponent < 0) + { + if (num < DBL_MIN * pow (10.0, (double) -exponent)) + goto underflow; + } + else if (exponent > 0) + { + if (num > DBL_MAX * pow (10.0, (double) -exponent)) + goto overflow; + } + + num *= pow (10.0, (double) exponent); + + valid: + if (endptr != NULL) + *endptr = (char *) s; + return negative ? -num : num; + + overflow: + /* Return an overflow error. */ + if (endptr != NULL) + *endptr = (char *) s; + errno = ERANGE; + return negative ? -HUGE_VAL : HUGE_VAL; + + underflow: + /* Return an underflow error. */ + if (endptr != NULL) + *endptr = (char *) s; + errno = ERANGE; + return negative ? -0.0 : 0.0; + + noconv: + /* There was no number. */ + if (endptr != NULL) + *endptr = (char *) nptr; + errno = EINVAL; + return 0.0; +} diff -ruNp m4-1.4.10/lib/strtol.c m4-1.4.11/lib/strtol.c --- m4-1.4.10/lib/strtol.c 2007-05-30 19:30:39.000000000 -0600 +++ m4-1.4.11/lib/strtol.c 2007-10-09 06:16:42.000000000 -0600 @@ -7,9 +7,9 @@ NOTE: The canonical source of this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@gnu.org. - This program is free software; you can redistribute it and/or modify it + 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 2, or (at your option) any + Free Software Foundation; either version 3 of the License, or any later version. This program is distributed in the hope that it will be useful, @@ -18,8 +18,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifdef _LIBC # define USE_NUMBER_GROUPING diff -ruNp m4-1.4.10/lib/sys_stat.in.h m4-1.4.11/lib/sys_stat.in.h --- m4-1.4.10/lib/sys_stat.in.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/lib/sys_stat.in.h 2007-12-01 13:55:35.000000000 -0700 @@ -0,0 +1,280 @@ +/* Provide a more complete sys/stat header file. + Copyright (C) 2006, 2007 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, 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, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Eric Blake, Paul Eggert, and Jim Meyering. */ + +/* This file is supposed to be used on platforms where <sys/stat.h> is + incomplete. It is intended to provide definitions and prototypes + needed by an application. Start with what the system provides. */ + +#ifndef _GL_SYS_STAT_H + +/* The include_next requires a split double-inclusion guard. */ +#@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@ + +#ifndef _GL_SYS_STAT_H +#define _GL_SYS_STAT_H + +#ifndef S_IFMT +# define S_IFMT 0170000 +#endif + +#if STAT_MACROS_BROKEN +# undef S_ISBLK +# undef S_ISCHR +# undef S_ISDIR +# undef S_ISFIFO +# undef S_ISLNK +# undef S_ISNAM +# undef S_ISMPB +# undef S_ISMPC +# undef S_ISNWK +# undef S_ISREG +# undef S_ISSOCK +#endif + +#ifndef S_ISBLK +# ifdef S_IFBLK +# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) +# else +# define S_ISBLK(m) 0 +# endif +#endif + +#ifndef S_ISCHR +# ifdef S_IFCHR +# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) +# else +# define S_ISCHR(m) 0 +# endif +#endif + +#ifndef S_ISDIR +# ifdef S_IFDIR +# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) +# else +# define S_ISDIR(m) 0 +# endif +#endif + +#ifndef S_ISDOOR /* Solaris 2.5 and up */ +# define S_ISDOOR(m) 0 +#endif + +#ifndef S_ISFIFO +# ifdef S_IFIFO +# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) +# else +# define S_ISFIFO(m) 0 +# endif +#endif + +#ifndef S_ISLNK +# ifdef S_IFLNK +# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) +# else +# define S_ISLNK(m) 0 +# endif +#endif + +#ifndef S_ISMPB /* V7 */ +# ifdef S_IFMPB +# define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB) +# define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC) +# else +# define S_ISMPB(m) 0 +# define S_ISMPC(m) 0 +# endif +#endif + +#ifndef S_ISNAM /* Xenix */ +# ifdef S_IFNAM +# define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM) +# else +# define S_ISNAM(m) 0 +# endif +#endif + +#ifndef S_ISNWK /* HP/UX */ +# ifdef S_IFNWK +# define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK) +# else +# define S_ISNWK(m) 0 +# endif +#endif + +#ifndef S_ISPORT /* Solaris 10 and up */ +# define S_ISPORT(m) 0 +#endif + +#ifndef S_ISREG +# ifdef S_IFREG +# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) +# else +# define S_ISREG(m) 0 +# endif +#endif + +#ifndef S_ISSOCK +# ifdef S_IFSOCK +# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) +# else +# define S_ISSOCK(m) 0 +# endif +#endif + + +#ifndef S_TYPEISMQ +# define S_TYPEISMQ(p) 0 +#endif + +#ifndef S_TYPEISTMO +# define S_TYPEISTMO(p) 0 +#endif + + +#ifndef S_TYPEISSEM +# ifdef S_INSEM +# define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM) +# else +# define S_TYPEISSEM(p) 0 +# endif +#endif + +#ifndef S_TYPEISSHM +# ifdef S_INSHD +# define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD) +# else +# define S_TYPEISSHM(p) 0 +# endif +#endif + +/* high performance ("contiguous data") */ +#ifndef S_ISCTG +# define S_ISCTG(p) 0 +#endif + +/* Cray DMF (data migration facility): off line, with data */ +#ifndef S_ISOFD +# define S_ISOFD(p) 0 +#endif + +/* Cray DMF (data migration facility): off line, with no data */ +#ifndef S_ISOFL +# define S_ISOFL(p) 0 +#endif + +/* 4.4BSD whiteout */ +#ifndef S_ISWHT +# define S_ISWHT(m) 0 +#endif + +/* If any of the following are undefined, + define them to their de facto standard values. */ +#if !S_ISUID +# define S_ISUID 04000 +#endif +#if !S_ISGID +# define S_ISGID 02000 +#endif + +/* S_ISVTX is a common extension to POSIX. */ +#ifndef S_ISVTX +# define S_ISVTX 01000 +#endif + +#if !S_IRUSR && S_IREAD +# define S_IRUSR S_IREAD +#endif +#if !S_IRUSR +# define S_IRUSR 00400 +#endif +#if !S_IRGRP +# define S_IRGRP (S_IRUSR >> 3) +#endif +#if !S_IROTH +# define S_IROTH (S_IRUSR >> 6) +#endif + +#if !S_IWUSR && S_IWRITE +# define S_IWUSR S_IWRITE +#endif +#if !S_IWUSR +# define S_IWUSR 00200 +#endif +#if !S_IWGRP +# define S_IWGRP (S_IWUSR >> 3) +#endif +#if !S_IWOTH +# define S_IWOTH (S_IWUSR >> 6) +#endif + +#if !S_IXUSR && S_IEXEC +# define S_IXUSR S_IEXEC +#endif +#if !S_IXUSR +# define S_IXUSR 00100 +#endif +#if !S_IXGRP +# define S_IXGRP (S_IXUSR >> 3) +#endif +#if !S_IXOTH +# define S_IXOTH (S_IXUSR >> 6) +#endif + +#if !S_IRWXU +# define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR) +#endif +#if !S_IRWXG +# define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP) +#endif +#if !S_IRWXO +# define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH) +#endif + +/* S_IXUGO is a common extension to POSIX. */ +#if !S_IXUGO +# define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH) +#endif + +#ifndef S_IRWXUGO +# define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO) +#endif + +/* mingw does not support symlinks, therefore it does not have lstat. But + without links, stat does just fine. */ +#if ! @HAVE_LSTAT@ +# define lstat stat +#endif + +/* mingw's _mkdir() function has 1 argument, but we pass 2 arguments. + Additionally, it declares _mkdir (and depending on compile flags, an + alias mkdir), only in the nonstandard io.h. */ +#if ! @HAVE_DECL_MKDIR@ && @HAVE_IO_H@ +# include <io.h> + +static inline int +rpl_mkdir (char const *name, mode_t mode) +{ + return _mkdir (name); +} + +# define mkdir rpl_mkdir +#endif + +#endif /* _GL_SYS_STAT_H */ +#endif /* _GL_SYS_STAT_H */ diff -ruNp m4-1.4.10/lib/sys_stat_.h m4-1.4.11/lib/sys_stat_.h --- m4-1.4.10/lib/sys_stat_.h 2007-07-05 05:48:25.000000000 -0600 +++ m4-1.4.11/lib/sys_stat_.h 1969-12-31 17:00:00.000000000 -0700 @@ -1,280 +0,0 @@ -/* Provide a more complete sys/stat header file. - Copyright (C) 2006, 2007 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 2, 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -/* Written by Eric Blake, Paul Eggert, and Jim Meyering. */ - -/* This file is supposed to be used on platforms where <sys/stat.h> is - incomplete. It is intended to provide definitions and prototypes - needed by an application. Start with what the system provides. */ - -#ifndef _GL_SYS_STAT_H - -/* The include_next requires a split double-inclusion guard. */ -#@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@ - -#ifndef _GL_SYS_STAT_H -#define _GL_SYS_STAT_H - -#ifndef S_IFMT -# define S_IFMT 0170000 -#endif - -#if STAT_MACROS_BROKEN -# undef S_ISBLK -# undef S_ISCHR -# undef S_ISDIR -# undef S_ISFIFO -# undef S_ISLNK -# undef S_ISNAM -# undef S_ISMPB -# undef S_ISMPC -# undef S_ISNWK -# undef S_ISREG -# undef S_ISSOCK -#endif - -#ifndef S_ISBLK -# ifdef S_IFBLK -# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) -# else -# define S_ISBLK(m) 0 -# endif -#endif - -#ifndef S_ISCHR -# ifdef S_IFCHR -# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) -# else -# define S_ISCHR(m) 0 -# endif -#endif - -#ifndef S_ISDIR -# ifdef S_IFDIR -# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) -# else -# define S_ISDIR(m) 0 -# endif -#endif - -#ifndef S_ISDOOR /* Solaris 2.5 and up */ -# define S_ISDOOR(m) 0 -#endif - -#ifndef S_ISFIFO -# ifdef S_IFIFO -# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) -# else -# define S_ISFIFO(m) 0 -# endif -#endif - -#ifndef S_ISLNK -# ifdef S_IFLNK -# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) -# else -# define S_ISLNK(m) 0 -# endif -#endif - -#ifndef S_ISMPB /* V7 */ -# ifdef S_IFMPB -# define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB) -# define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC) -# else -# define S_ISMPB(m) 0 -# define S_ISMPC(m) 0 -# endif -#endif - -#ifndef S_ISNAM /* Xenix */ -# ifdef S_IFNAM -# define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM) -# else -# define S_ISNAM(m) 0 -# endif -#endif - -#ifndef S_ISNWK /* HP/UX */ -# ifdef S_IFNWK -# define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK) -# else -# define S_ISNWK(m) 0 -# endif -#endif - -#ifndef S_ISPORT /* Solaris 10 and up */ -# define S_ISPORT(m) 0 -#endif - -#ifndef S_ISREG -# ifdef S_IFREG -# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) -# else -# define S_ISREG(m) 0 -# endif -#endif - -#ifndef S_ISSOCK -# ifdef S_IFSOCK -# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) -# else -# define S_ISSOCK(m) 0 -# endif -#endif - - -#ifndef S_TYPEISMQ -# define S_TYPEISMQ(p) 0 -#endif - -#ifndef S_TYPEISTMO -# define S_TYPEISTMO(p) 0 -#endif - - -#ifndef S_TYPEISSEM -# ifdef S_INSEM -# define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM) -# else -# define S_TYPEISSEM(p) 0 -# endif -#endif - -#ifndef S_TYPEISSHM -# ifdef S_INSHD -# define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD) -# else -# define S_TYPEISSHM(p) 0 -# endif -#endif - -/* high performance ("contiguous data") */ -#ifndef S_ISCTG -# define S_ISCTG(p) 0 -#endif - -/* Cray DMF (data migration facility): off line, with data */ -#ifndef S_ISOFD -# define S_ISOFD(p) 0 -#endif - -/* Cray DMF (data migration facility): off line, with no data */ -#ifndef S_ISOFL -# define S_ISOFL(p) 0 -#endif - -/* 4.4BSD whiteout */ -#ifndef S_ISWHT -# define S_ISWHT(m) 0 -#endif - -/* If any of the following are undefined, - define them to their de facto standard values. */ -#if !S_ISUID -# define S_ISUID 04000 -#endif -#if !S_ISGID -# define S_ISGID 02000 -#endif - -/* S_ISVTX is a common extension to POSIX. */ -#ifndef S_ISVTX -# define S_ISVTX 01000 -#endif - -#if !S_IRUSR && S_IREAD -# define S_IRUSR S_IREAD -#endif -#if !S_IRUSR -# define S_IRUSR 00400 -#endif -#if !S_IRGRP -# define S_IRGRP (S_IRUSR >> 3) -#endif -#if !S_IROTH -# define S_IROTH (S_IRUSR >> 6) -#endif - -#if !S_IWUSR && S_IWRITE -# define S_IWUSR S_IWRITE -#endif -#if !S_IWUSR -# define S_IWUSR 00200 -#endif -#if !S_IWGRP -# define S_IWGRP (S_IWUSR >> 3) -#endif -#if !S_IWOTH -# define S_IWOTH (S_IWUSR >> 6) -#endif - -#if !S_IXUSR && S_IEXEC -# define S_IXUSR S_IEXEC -#endif -#if !S_IXUSR -# define S_IXUSR 00100 -#endif -#if !S_IXGRP -# define S_IXGRP (S_IXUSR >> 3) -#endif -#if !S_IXOTH -# define S_IXOTH (S_IXUSR >> 6) -#endif - -#if !S_IRWXU -# define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR) -#endif -#if !S_IRWXG -# define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP) -#endif -#if !S_IRWXO -# define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH) -#endif - -/* S_IXUGO is a common extension to POSIX. */ -#if !S_IXUGO -# define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH) -#endif - -#ifndef S_IRWXUGO -# define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO) -#endif - -/* mingw does not support symlinks, therefore it does not have lstat. But - without links, stat does just fine. */ -#if ! @HAVE_LSTAT@ -# define lstat stat -#endif - -/* mingw's _mkdir() function has 1 argument, but we pass 2 arguments. - Additionally, it declares _mkdir (and depending on compile flags, an - alias mkdir), only in the nonstandard io.h. */ -#if ! @HAVE_DECL_MKDIR@ && @HAVE_IO_H@ -# include <io.h> - -static inline int -rpl_mkdir (char const *name, mode_t mode) -{ - return _mkdir (name); -} - -# define mkdir rpl_mkdir -#endif - -#endif /* _GL_SYS_STAT_H */ -#endif /* _GL_SYS_STAT_H */ diff -ruNp m4-1.4.10/lib/sys_time.in.h m4-1.4.11/lib/sys_time.in.h --- m4-1.4.10/lib/sys_time.in.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/lib/sys_time.in.h 2007-12-01 13:55:35.000000000 -0700 @@ -0,0 +1,52 @@ +/* Provide a more complete sys/time.h. + + Copyright (C) 2007 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, 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, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Paul Eggert. */ + +#if defined _GL_SYS_TIME_H + +/* Simply delegate to the system's header, without adding anything. */ +# if @HAVE_SYS_TIME_H@ +# @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@ +# endif + +#else + +# define _GL_SYS_TIME_H + +# if @HAVE_SYS_TIME_H@ +# @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@ +# else +# include <time.h> +# endif + +# if ! @HAVE_STRUCT_TIMEVAL@ +struct timeval +{ + time_t tv_sec; + long int tv_usec; +}; +# endif + +# if @REPLACE_GETTIMEOFDAY@ +# undef gettimeofday +# define gettimeofday rpl_gettimeofday +int gettimeofday (struct timeval *restrict, void *restrict); +# endif + +#endif /* _GL_SYS_TIME_H */ diff -ruNp m4-1.4.10/lib/sys_time_.h m4-1.4.11/lib/sys_time_.h --- m4-1.4.10/lib/sys_time_.h 2007-07-09 21:12:29.000000000 -0600 +++ m4-1.4.11/lib/sys_time_.h 1969-12-31 17:00:00.000000000 -0700 @@ -1,52 +0,0 @@ -/* Provide a more complete sys/time.h. - - Copyright (C) 2007 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 2, 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -/* Written by Paul Eggert. */ - -#if defined _GL_SYS_TIME_H - -/* Simply delegate to the system's header, without adding anything. */ -# if @HAVE_SYS_TIME_H@ -# @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@ -# endif - -#else - -# define _GL_SYS_TIME_H - -# if @HAVE_SYS_TIME_H@ -# @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@ -# else -# include <time.h> -# endif - -# if ! @HAVE_STRUCT_TIMEVAL@ -struct timeval -{ - time_t tv_sec; - long int tv_usec; -}; -# endif - -# if @REPLACE_GETTIMEOFDAY@ -# undef gettimeofday -# define gettimeofday rpl_gettimeofday -int gettimeofday (struct timeval *restrict, void *restrict); -# endif - -#endif /* _GL_SYS_TIME_H */ diff -ruNp m4-1.4.10/lib/tempname.c m4-1.4.11/lib/tempname.c --- m4-1.4.10/lib/tempname.c 2007-05-30 19:30:40.000000000 -0600 +++ m4-1.4.11/lib/tempname.c 2007-10-09 06:16:43.000000000 -0600 @@ -4,19 +4,18 @@ 2000, 2001, 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Extracted from glibc sysdeps/posix/tempname.c. See also tmpdir.c. */ diff -ruNp m4-1.4.10/lib/tempname.h m4-1.4.11/lib/tempname.h --- m4-1.4.10/lib/tempname.h 2007-05-30 19:30:40.000000000 -0600 +++ m4-1.4.11/lib/tempname.h 2007-12-01 13:55:36.000000000 -0700 @@ -2,10 +2,10 @@ Copyright (C) 2006 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -13,8 +13,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* header written by Eric Blake */ diff -ruNp m4-1.4.10/lib/tmpdir.c m4-1.4.11/lib/tmpdir.c --- m4-1.4.10/lib/tmpdir.c 2007-05-30 19:30:40.000000000 -0600 +++ m4-1.4.11/lib/tmpdir.c 2007-10-09 06:16:43.000000000 -0600 @@ -1,10 +1,10 @@ /* Copyright (C) 1999, 2001-2002, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -12,8 +12,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Extracted from sysdeps/posix/tempname.c. */ diff -ruNp m4-1.4.10/lib/tmpdir.h m4-1.4.11/lib/tmpdir.h --- m4-1.4.10/lib/tmpdir.h 2007-05-30 19:30:40.000000000 -0600 +++ m4-1.4.11/lib/tmpdir.h 2007-12-01 13:55:36.000000000 -0700 @@ -1,10 +1,10 @@ /* Determine a temporary directory. Copyright (C) 2001-2002 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -12,8 +12,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <stdbool.h> #include <stddef.h> diff -ruNp m4-1.4.10/lib/unistd--.h m4-1.4.11/lib/unistd--.h --- m4-1.4.10/lib/unistd--.h 2007-05-30 19:30:41.000000000 -0600 +++ m4-1.4.11/lib/unistd--.h 2007-12-01 13:55:36.000000000 -0700 @@ -2,10 +2,10 @@ Copyright (C) 2005 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -13,8 +13,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ diff -ruNp m4-1.4.10/lib/unistd-safer.h m4-1.4.11/lib/unistd-safer.h --- m4-1.4.10/lib/unistd-safer.h 2007-05-30 19:30:41.000000000 -0600 +++ m4-1.4.11/lib/unistd-safer.h 2007-12-01 13:55:36.000000000 -0700 @@ -2,10 +2,10 @@ Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -13,8 +13,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ diff -ruNp m4-1.4.10/lib/unistd.in.h m4-1.4.11/lib/unistd.in.h --- m4-1.4.10/lib/unistd.in.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/lib/unistd.in.h 2008-03-01 09:05:52.000000000 -0700 @@ -0,0 +1,340 @@ +/* Substitute for and wrapper around <unistd.h>. + Copyright (C) 2004-2008 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, 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, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef _GL_UNISTD_H + +/* The include_next requires a split double-inclusion guard. */ +#if @HAVE_UNISTD_H@ +# @INCLUDE_NEXT@ @NEXT_UNISTD_H@ +#endif + +#ifndef _GL_UNISTD_H +#define _GL_UNISTD_H + +/* mingw doesn't define the SEEK_* macros in <unistd.h>. */ +#if !(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) +# include <stdio.h> +#endif + +/* mingw fails to declare _exit in <unistd.h>. */ +#include <stdlib.h> + +/* The definition of GL_LINK_WARNING is copied here. */ + + +/* Declare overridden functions. */ + +#ifdef __cplusplus +extern "C" { +#endif + + +#if @GNULIB_CHOWN@ +# if @REPLACE_CHOWN@ +# ifndef REPLACE_CHOWN +# define REPLACE_CHOWN 1 +# endif +# if REPLACE_CHOWN +/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE + to GID (if GID is not -1). Follow symbolic links. + Return 0 if successful, otherwise -1 and errno set. + See the POSIX:2001 specification + <http://www.opengroup.org/susv3xsh/chown.html>. */ +# define chown rpl_chown +extern int chown (const char *file, uid_t uid, gid_t gid); +# endif +# endif +#elif defined GNULIB_POSIXCHECK +# undef chown +# define chown(f,u,g) \ + (GL_LINK_WARNING ("chown fails to follow symlinks on some systems and " \ + "doesn't treat a uid or gid of -1 on some systems - " \ + "use gnulib module chown for portability"), \ + chown (f, u, g)) +#endif + + +#if @GNULIB_DUP2@ +# if !@HAVE_DUP2@ +/* Copy the file descriptor OLDFD into file descriptor NEWFD. Do nothing if + NEWFD = OLDFD, otherwise close NEWFD first if it is open. + Return 0 if successful, otherwise -1 and errno set. + See the POSIX:2001 specification + <http://www.opengroup.org/susv3xsh/dup2.html>. */ +extern int dup2 (int oldfd, int newfd); +# endif +#elif defined GNULIB_POSIXCHECK +# undef dup2 +# define dup2(o,n) \ + (GL_LINK_WARNING ("dup2 is unportable - " \ + "use gnulib module dup2 for portability"), \ + dup2 (o, n)) +#endif + + +#if @GNULIB_ENVIRON@ +# if !@HAVE_DECL_ENVIRON@ +/* Set of environment variables and values. An array of strings of the form + "VARIABLE=VALUE", terminated with a NULL. */ +# if defined __APPLE__ && defined __MACH__ +# include <crt_externs.h> +# define environ (*_NSGetEnviron ()) +# else +extern char **environ; +# endif +# endif +#elif defined GNULIB_POSIXCHECK +# undef environ +# define environ \ + (GL_LINK_WARNING ("environ is unportable - " \ + "use gnulib module environ for portability"), \ + environ) +#endif + + +#if @GNULIB_FCHDIR@ +# if @REPLACE_FCHDIR@ + +/* Change the process' current working directory to the directory on which + the given file descriptor is open. + Return 0 if successful, otherwise -1 and errno set. + See the POSIX:2001 specification + <http://www.opengroup.org/susv3xsh/fchdir.html>. */ +extern int fchdir (int /*fd*/); + +# define close rpl_close +extern int close (int); +# define dup rpl_dup +extern int dup (int); +# define dup2 rpl_dup2 +extern int dup2 (int, int); + +# endif +#elif defined GNULIB_POSIXCHECK +# undef fchdir +# define fchdir(f) \ + (GL_LINK_WARNING ("fchdir is unportable - " \ + "use gnulib module fchdir for portability"), \ + fchdir (f)) +#endif + + +#if @GNULIB_FTRUNCATE@ +# if !@HAVE_FTRUNCATE@ +/* Change the size of the file to which FD is opened to become equal to LENGTH. + Return 0 if successful, otherwise -1 and errno set. + See the POSIX:2001 specification + <http://www.opengroup.org/susv3xsh/ftruncate.html>. */ +extern int ftruncate (int fd, off_t length); +# endif +#elif defined GNULIB_POSIXCHECK +# undef ftruncate +# define ftruncate(f,l) \ + (GL_LINK_WARNING ("ftruncate is unportable - " \ + "use gnulib module ftruncate for portability"), \ + ftruncate (f, l)) +#endif + + +#if @GNULIB_GETCWD@ +/* Include the headers that might declare getcwd so that they will not + cause confusion if included after this file. */ +# include <stdlib.h> +# if @REPLACE_GETCWD@ +/* Get the name of the current working directory, and put it in SIZE bytes + of BUF. + Return BUF if successful, or NULL if the directory couldn't be determined + or SIZE was too small. + See the POSIX:2001 specification + <http://www.opengroup.org/susv3xsh/getcwd.html>. + Additionally, the gnulib module 'getcwd' guarantees the following GNU + extension: If BUF is NULL, an array is allocated with 'malloc'; the array + is SIZE bytes long, unless SIZE == 0, in which case it is as big as + necessary. */ +# define getcwd rpl_getcwd +extern char * getcwd (char *buf, size_t size); +# endif +#elif defined GNULIB_POSIXCHECK +# undef getcwd +# define getcwd(b,s) \ + (GL_LINK_WARNING ("getcwd is unportable - " \ + "use gnulib module getcwd for portability"), \ + getcwd (b, s)) +#endif + + +#if @GNULIB_GETLOGIN_R@ +/* Copies the user's login name to NAME. + The array pointed to by NAME has room for SIZE bytes. + + Returns 0 if successful. Upon error, an error number is returned, or -1 in + the case that the login name cannot be found but no specific error is + provided (this case is hopefully rare but is left open by the POSIX spec). + + See <http://www.opengroup.org/susv3xsh/getlogin.html>. + */ +# if !@HAVE_DECL_GETLOGIN_R@ +# include <stddef.h> +extern int getlogin_r (char *name, size_t size); +# endif +#elif defined GNULIB_POSIXCHECK +# undef getlogin_r +# define getlogin_r(n,s) \ + (GL_LINK_WARNING ("getlogin_r is unportable - " \ + "use gnulib module getlogin_r for portability"), \ + getlogin_r (n, s)) +#endif + + +#if @GNULIB_GETPAGESIZE@ +# if @REPLACE_GETPAGESIZE@ +# define getpagesize rpl_getpagesize +extern int getpagesize (void); +# elif !@HAVE_GETPAGESIZE@ +/* This is for POSIX systems. */ +# if !defined getpagesize && defined _SC_PAGESIZE +# if ! (defined __VMS && __VMS_VER < 70000000) +# define getpagesize() sysconf (_SC_PAGESIZE) +# endif +# endif +/* This is for older VMS. */ +# if !defined getpagesize && defined __VMS +# ifdef __ALPHA +# define getpagesize() 8192 +# else +# define getpagesize() 512 +# endif +# endif +/* This is for BeOS. */ +# if !defined getpagesize && @HAVE_OS_H@ +# include <OS.h> +# if defined B_PAGE_SIZE +# define getpagesize() B_PAGE_SIZE +# endif +# endif +/* This is for AmigaOS4.0. */ +# if !defined getpagesize && defined __amigaos4__ +# define getpagesize() 2048 +# endif +/* This is for older Unix systems. */ +# if !defined getpagesize && @HAVE_SYS_PARAM_H@ +# include <sys/param.h> +# ifdef EXEC_PAGESIZE +# define getpagesize() EXEC_PAGESIZE +# else +# ifdef NBPG +# ifndef CLSIZE +# define CLSIZE 1 +# endif +# define getpagesize() (NBPG * CLSIZE) +# else +# ifdef NBPC +# define getpagesize() NBPC +# endif +# endif +# endif +# endif +# endif +#elif defined GNULIB_POSIXCHECK +# undef getpagesize +# define getpagesize() \ + (GL_LINK_WARNING ("getpagesize is unportable - " \ + "use gnulib module getpagesize for portability"), \ + getpagesize ()) +#endif + + +#if @GNULIB_LCHOWN@ +# if @REPLACE_LCHOWN@ +/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE + to GID (if GID is not -1). Do not follow symbolic links. + Return 0 if successful, otherwise -1 and errno set. + See the POSIX:2001 specification + <http://www.opengroup.org/susv3xsh/lchown.html>. */ +# define lchown rpl_lchown +extern int lchown (char const *file, uid_t owner, gid_t group); +# endif +#elif defined GNULIB_POSIXCHECK +# undef lchown +# define lchown(f,u,g) \ + (GL_LINK_WARNING ("lchown is unportable to pre-POSIX.1-2001 " \ + "systems - use gnulib module lchown for portability"), \ + lchown (f, u, g)) +#endif + + +#if @GNULIB_LSEEK@ +# if @REPLACE_LSEEK@ +/* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END. + Return the new offset if successful, otherwise -1 and errno set. + See the POSIX:2001 specification + <http://www.opengroup.org/susv3xsh/lseek.html>. */ +# define lseek rpl_lseek + extern off_t lseek (int fd, off_t offset, int whence); +# endif +#elif defined GNULIB_POSIXCHECK +# undef lseek +# define lseek(f,o,w) \ + (GL_LINK_WARNING ("lseek does not fail with ESPIPE on pipes on some " \ + "systems - use gnulib module lseek for portability"), \ + lseek (f, o, w)) +#endif + + +#if @GNULIB_READLINK@ +/* Read the contents of the symbolic link FILE and place the first BUFSIZE + bytes of it into BUF. Return the number of bytes placed into BUF if + successful, otherwise -1 and errno set. + See the POSIX:2001 specification + <http://www.opengroup.org/susv3xsh/readlink.html>. */ +# if !@HAVE_READLINK@ +# include <stddef.h> +extern int readlink (const char *file, char *buf, size_t bufsize); +# endif +#elif defined GNULIB_POSIXCHECK +# undef readlink +# define readlink(f,b,s) \ + (GL_LINK_WARNING ("readlink is unportable - " \ + "use gnulib module readlink for portability"), \ + readlink (f, b, s)) +#endif + + +#if @GNULIB_SLEEP@ +/* Pause the execution of the current thread for N seconds. + Returns the number of seconds left to sleep. + See the POSIX:2001 specification + <http://www.opengroup.org/susv3xsh/sleep.html>. */ +# if !@HAVE_SLEEP@ +extern unsigned int sleep (unsigned int n); +# endif +#elif defined GNULIB_POSIXCHECK +# undef sleep +# define sleep(n) \ + (GL_LINK_WARNING ("sleep is unportable - " \ + "use gnulib module sleep for portability"), \ + sleep (n)) +#endif + + +#ifdef __cplusplus +} +#endif + + +#endif /* _GL_UNISTD_H */ +#endif /* _GL_UNISTD_H */ diff -ruNp m4-1.4.10/lib/unistd_.h m4-1.4.11/lib/unistd_.h --- m4-1.4.10/lib/unistd_.h 2007-07-05 05:48:26.000000000 -0600 +++ m4-1.4.11/lib/unistd_.h 1969-12-31 17:00:00.000000000 -0700 @@ -1,262 +0,0 @@ -/* Substitute for and wrapper around <unistd.h>. - Copyright (C) 2004-2007 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 2, 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#ifndef _GL_UNISTD_H - -/* The include_next requires a split double-inclusion guard. */ -#if @HAVE_UNISTD_H@ -# @INCLUDE_NEXT@ @NEXT_UNISTD_H@ -#endif - -#ifndef _GL_UNISTD_H -#define _GL_UNISTD_H - -/* mingw doesn't define the SEEK_* macros in <unistd.h>. */ -#if !(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) -# include <stdio.h> -#endif - -/* mingw fails to declare _exit in <unistd.h>. */ -#include <stdlib.h> - -/* The definition of GL_LINK_WARNING is copied here. */ - - -/* Declare overridden functions. */ - -#ifdef __cplusplus -extern "C" { -#endif - - -#if @GNULIB_CHOWN@ -# if @REPLACE_CHOWN@ -# ifndef REPLACE_CHOWN -# define REPLACE_CHOWN 1 -# endif -# if REPLACE_CHOWN -/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE - to GID (if GID is not -1). Follow symbolic links. - Return 0 if successful, otherwise -1 and errno set. - See the POSIX:2001 specification - <http://www.opengroup.org/susv3xsh/chown.html>. */ -# define chown rpl_chown -extern int chown (const char *file, uid_t uid, gid_t gid); -# endif -# endif -#elif defined GNULIB_POSIXCHECK -# undef chown -# define chown(f,u,g) \ - (GL_LINK_WARNING ("chown fails to follow symlinks on some systems and " \ - "doesn't treat a uid or gid of -1 on some systems - " \ - "use gnulib module chown for portability"), \ - chown (f, u, g)) -#endif - - -#if @GNULIB_DUP2@ -# if !@HAVE_DUP2@ -/* Copy the file descriptor OLDFD into file descriptor NEWFD. Do nothing if - NEWFD = OLDFD, otherwise close NEWFD first if it is open. - Return 0 if successful, otherwise -1 and errno set. - See the POSIX:2001 specification - <http://www.opengroup.org/susv3xsh/dup2.html>. */ -extern int dup2 (int oldfd, int newfd); -# endif -#elif defined GNULIB_POSIXCHECK -# undef dup2 -# define dup2(o,n) \ - (GL_LINK_WARNING ("dup2 is unportable - " \ - "use gnulib module dup2 for portability"), \ - dup2 (o, n)) -#endif - - -#if @GNULIB_FCHDIR@ -# if @REPLACE_FCHDIR@ - -/* Change the process' current working directory to the directory on which - the given file descriptor is open. - Return 0 if successful, otherwise -1 and errno set. - See the POSIX:2001 specification - <http://www.opengroup.org/susv3xsh/fchdir.html>. */ -extern int fchdir (int /*fd*/); - -# define close rpl_close -extern int close (int); -# define dup rpl_dup -extern int dup (int); -# define dup2 rpl_dup2 -extern int dup2 (int, int); - -# endif -#elif defined GNULIB_POSIXCHECK -# undef fchdir -# define fchdir(f) \ - (GL_LINK_WARNING ("fchdir is unportable - " \ - "use gnulib module fchdir for portability"), \ - fchdir (f)) -#endif - - -#if @GNULIB_FTRUNCATE@ -# if !@HAVE_FTRUNCATE@ -/* Change the size of the file to which FD is opened to become equal to LENGTH. - Return 0 if successful, otherwise -1 and errno set. - See the POSIX:2001 specification - <http://www.opengroup.org/susv3xsh/ftruncate.html>. */ -extern int ftruncate (int fd, off_t length); -# endif -#elif defined GNULIB_POSIXCHECK -# undef ftruncate -# define ftruncate(f,l) \ - (GL_LINK_WARNING ("ftruncate is unportable - " \ - "use gnulib module ftruncate for portability"), \ - ftruncate (f, l)) -#endif - - -#if @GNULIB_GETCWD@ -/* Include the headers that might declare getcwd so that they will not - cause confusion if included after this file. */ -# include <stdlib.h> -# if @REPLACE_GETCWD@ -/* Get the name of the current working directory, and put it in SIZE bytes - of BUF. - Return BUF if successful, or NULL if the directory couldn't be determined - or SIZE was too small. - See the POSIX:2001 specification - <http://www.opengroup.org/susv3xsh/getcwd.html>. - Additionally, the gnulib module 'getcwd' guarantees the following GNU - extension: If BUF is NULL, an array is allocated with 'malloc'; the array - is SIZE bytes long, unless SIZE == 0, in which case it is as big as - necessary. */ -# define getcwd rpl_getcwd -extern char * getcwd (char *buf, size_t size); -# endif -#elif defined GNULIB_POSIXCHECK -# undef getcwd -# define getcwd(b,s) \ - (GL_LINK_WARNING ("getcwd is unportable - " \ - "use gnulib module getcwd for portability"), \ - getcwd (b, s)) -#endif - - -#if @GNULIB_GETLOGIN_R@ -/* Copies the user's login name to NAME. - The array pointed to by NAME has room for SIZE bytes. - - Returns 0 if successful. Upon error, an error number is returned, or -1 in - the case that the login name cannot be found but no specific error is - provided (this case is hopefully rare but is left open by the POSIX spec). - - See <http://www.opengroup.org/susv3xsh/getlogin.html>. - */ -# if !@HAVE_DECL_GETLOGIN_R@ -# include <stddef.h> -extern int getlogin_r (char *name, size_t size); -# endif -#elif defined GNULIB_POSIXCHECK -# undef getlogin_r -# define getlogin_r(n,s) \ - (GL_LINK_WARNING ("getlogin_r is unportable - " \ - "use gnulib module getlogin_r for portability"), \ - getlogin_r (n, s)) -#endif - - -#if @GNULIB_LCHOWN@ -# if @REPLACE_LCHOWN@ -/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE - to GID (if GID is not -1). Do not follow symbolic links. - Return 0 if successful, otherwise -1 and errno set. - See the POSIX:2001 specification - <http://www.opengroup.org/susv3xsh/lchown.html>. */ -# define lchown rpl_lchown -extern int lchown (char const *file, uid_t owner, gid_t group); -# endif -#elif defined GNULIB_POSIXCHECK -# undef lchown -# define lchown(f,u,g) \ - (GL_LINK_WARNING ("lchown is unportable to pre-POSIX.1-2001 " \ - "systems - use gnulib module lchown for portability"), \ - lchown (f, u, g)) -#endif - - -#if @GNULIB_LSEEK@ -# if @REPLACE_LSEEK@ -/* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END. - Return the new offset if successful, otherwise -1 and errno set. - See the POSIX:2001 specification - <http://www.opengroup.org/susv3xsh/lseek.html>. */ -# define lseek rpl_lseek - extern off_t lseek (int fd, off_t offset, int whence); -# endif -#elif defined GNULIB_POSIXCHECK -# undef lseek -# define lseek(f,o,w) \ - (GL_LINK_WARNING ("lseek does not fail with ESPIPE on pipes on some " \ - "systems - use gnulib module lseek for portability"), \ - lseek (f, o, w)) -#endif - - -#if @GNULIB_READLINK@ -/* Read the contents of the symbolic link FILE and place the first BUFSIZE - bytes of it into BUF. Return the number of bytes placed into BUF if - successful, otherwise -1 and errno set. - See the POSIX:2001 specification - <http://www.opengroup.org/susv3xsh/readlink.html>. */ -# if !@HAVE_READLINK@ -# include <stddef.h> -extern int readlink (const char *file, char *buf, size_t bufsize); -# endif -#elif defined GNULIB_POSIXCHECK -# undef readlink -# define readlink(f,b,s) \ - (GL_LINK_WARNING ("readlink is unportable - " \ - "use gnulib module readlink for portability"), \ - readlink (f, b, s)) -#endif - - -#if @GNULIB_SLEEP@ -/* Pause the execution of the current thread for N seconds. - Returns the number of seconds left to sleep. - See the POSIX:2001 specification - <http://www.opengroup.org/susv3xsh/sleep.html>. */ -# if !@HAVE_SLEEP@ -extern unsigned int sleep (unsigned int n); -# endif -#elif defined GNULIB_POSIXCHECK -# undef sleep -# define sleep(n) \ - (GL_LINK_WARNING ("sleep is unportable - " \ - "use gnulib module sleep for portability"), \ - sleep (n)) -#endif - - -#ifdef __cplusplus -} -#endif - - -#endif /* _GL_UNISTD_H */ -#endif /* _GL_UNISTD_H */ diff -ruNp m4-1.4.10/lib/unlocked-io.h m4-1.4.11/lib/unlocked-io.h --- m4-1.4.10/lib/unlocked-io.h 2007-05-30 19:30:41.000000000 -0600 +++ m4-1.4.11/lib/unlocked-io.h 2007-12-01 13:55:37.000000000 -0700 @@ -2,19 +2,18 @@ Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Jim Meyering. */ diff -ruNp m4-1.4.10/lib/vasnprintf.c m4-1.4.11/lib/vasnprintf.c --- m4-1.4.10/lib/vasnprintf.c 2007-07-05 05:48:27.000000000 -0600 +++ m4-1.4.11/lib/vasnprintf.c 2008-03-30 16:07:17.000000000 -0600 @@ -1,9 +1,9 @@ /* vsprintf with automatic memory allocation. - Copyright (C) 1999, 2002-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002-2008 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 2, or (at your option) + the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -88,37 +88,35 @@ /* Checked size_t computations. */ #include "xsize.h" -#if NEED_PRINTF_LONG_DOUBLE && !defined IN_LIBINTL +#if (NEED_PRINTF_DOUBLE || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL # include <math.h> # include "float+.h" -# include "fpucw.h" #endif -#if NEED_PRINTF_INFINITE_DOUBLE && !defined IN_LIBINTL +#if (NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && !defined IN_LIBINTL # include <math.h> -# include "isnan.h" +# include "isnand.h" #endif -#if NEED_PRINTF_INFINITE_LONG_DOUBLE && !defined IN_LIBINTL +#if (NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE) && !defined IN_LIBINTL # include <math.h> # include "isnanl-nolibm.h" # include "fpucw.h" #endif -#if NEED_PRINTF_DIRECTIVE_A && !defined IN_LIBINTL +#if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_DOUBLE) && !defined IN_LIBINTL # include <math.h> -# include "isnan.h" +# include "isnand.h" # include "printf-frexp.h" +#endif + +#if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL +# include <math.h> # include "isnanl-nolibm.h" # include "printf-frexpl.h" # include "fpucw.h" #endif -/* Some systems, like OSF/1 4.0 and Woe32, don't have EOVERFLOW. */ -#ifndef EOVERFLOW -# define EOVERFLOW E2BIG -#endif - #if HAVE_WCHAR_T # if HAVE_WCSLEN # define local_wcslen wcslen @@ -200,7 +198,7 @@ local_wcslen (const wchar_t *s) /* Here we need to call the native sprintf, not rpl_sprintf. */ #undef sprintf -#if NEED_PRINTF_DIRECTIVE_A && !defined IN_LIBINTL +#if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && !defined IN_LIBINTL /* Determine the decimal-point character according to the current locale. */ # ifndef decimal_point_char_defined # define decimal_point_char_defined 1 @@ -227,18 +225,18 @@ decimal_point_char () # endif #endif -#if NEED_PRINTF_INFINITE_DOUBLE && !defined IN_LIBINTL +#if NEED_PRINTF_INFINITE_DOUBLE && !NEED_PRINTF_DOUBLE && !defined IN_LIBINTL /* Equivalent to !isfinite(x) || x == 0, but does not require libm. */ static int is_infinite_or_zero (double x) { - return isnan (x) || x + x == x; + return isnand (x) || x + x == x; } #endif -#if NEED_PRINTF_INFINITE_LONG_DOUBLE && !defined IN_LIBINTL +#if NEED_PRINTF_INFINITE_LONG_DOUBLE && !NEED_PRINTF_LONG_DOUBLE && !defined IN_LIBINTL /* Equivalent to !isfinite(x), but does not require libm. */ static int @@ -249,7 +247,7 @@ is_infinitel (long double x) #endif -#if NEED_PRINTF_LONG_DOUBLE && !defined IN_LIBINTL +#if (NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE) && !defined IN_LIBINTL /* Converting 'long double' to decimal without rare rounding bugs requires real bignums. We use the naming conventions of GNU gmp, but vastly simpler @@ -795,6 +793,8 @@ convert_to_decimal (mpn_t a, size_t extr return c_ptr; } +# if NEED_PRINTF_LONG_DOUBLE + /* Assuming x is finite and >= 0: write x as x = 2^e * m, where m is a bignum. Return the allocated memory in case of success, NULL in case of memory @@ -823,8 +823,8 @@ decode_long_double (long double x, int * 2^31 and 2^32 to 'unsigned int', therefore play safe and cast only 'long double' values between 0 and 2^16 (to 'unsigned int' or 'int', doesn't matter). */ -# if (LDBL_MANT_BIT % GMP_LIMB_BITS) != 0 -# if (LDBL_MANT_BIT % GMP_LIMB_BITS) > GMP_LIMB_BITS / 2 +# if (LDBL_MANT_BIT % GMP_LIMB_BITS) != 0 +# if (LDBL_MANT_BIT % GMP_LIMB_BITS) > GMP_LIMB_BITS / 2 { mp_limb_t hi, lo; y *= (mp_limb_t) 1 << (LDBL_MANT_BIT % (GMP_LIMB_BITS / 2)); @@ -839,7 +839,7 @@ decode_long_double (long double x, int * abort (); m.limbs[LDBL_MANT_BIT / GMP_LIMB_BITS] = (hi << (GMP_LIMB_BITS / 2)) | lo; } -# else +# else { mp_limb_t d; y *= (mp_limb_t) 1 << (LDBL_MANT_BIT % GMP_LIMB_BITS); @@ -849,8 +849,8 @@ decode_long_double (long double x, int * abort (); m.limbs[LDBL_MANT_BIT / GMP_LIMB_BITS] = d; } +# endif # endif -# endif for (i = LDBL_MANT_BIT / GMP_LIMB_BITS; i > 0; ) { mp_limb_t hi, lo; @@ -866,8 +866,11 @@ decode_long_double (long double x, int * abort (); m.limbs[--i] = (hi << (GMP_LIMB_BITS / 2)) | lo; } +#if 0 /* On FreeBSD 6.1/x86, 'long double' numbers sometimes have excess + precision. */ if (!(y == 0.0L)) abort (); +#endif /* Normalise. */ while (m.nlimbs > 0 && m.limbs[m.nlimbs - 1] == 0) m.nlimbs--; @@ -876,17 +879,101 @@ decode_long_double (long double x, int * return m.limbs; } -/* Assuming x is finite and >= 0, and n is an integer: +# endif + +# if NEED_PRINTF_DOUBLE + +/* Assuming x is finite and >= 0: + write x as x = 2^e * m, where m is a bignum. + Return the allocated memory in case of success, NULL in case of memory + allocation failure. */ +static void * +decode_double (double x, int *ep, mpn_t *mp) +{ + mpn_t m; + int exp; + double y; + size_t i; + + /* Allocate memory for result. */ + m.nlimbs = (DBL_MANT_BIT + GMP_LIMB_BITS - 1) / GMP_LIMB_BITS; + m.limbs = (mp_limb_t *) malloc (m.nlimbs * sizeof (mp_limb_t)); + if (m.limbs == NULL) + return NULL; + /* Split into exponential part and mantissa. */ + y = frexp (x, &exp); + if (!(y >= 0.0 && y < 1.0)) + abort (); + /* x = 2^exp * y = 2^(exp - DBL_MANT_BIT) * (y * DBL_MANT_BIT), and the + latter is an integer. */ + /* Convert the mantissa (y * DBL_MANT_BIT) to a sequence of limbs. + I'm not sure whether it's safe to cast a 'double' value between + 2^31 and 2^32 to 'unsigned int', therefore play safe and cast only + 'double' values between 0 and 2^16 (to 'unsigned int' or 'int', + doesn't matter). */ +# if (DBL_MANT_BIT % GMP_LIMB_BITS) != 0 +# if (DBL_MANT_BIT % GMP_LIMB_BITS) > GMP_LIMB_BITS / 2 + { + mp_limb_t hi, lo; + y *= (mp_limb_t) 1 << (DBL_MANT_BIT % (GMP_LIMB_BITS / 2)); + hi = (int) y; + y -= hi; + if (!(y >= 0.0 && y < 1.0)) + abort (); + y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2); + lo = (int) y; + y -= lo; + if (!(y >= 0.0 && y < 1.0)) + abort (); + m.limbs[DBL_MANT_BIT / GMP_LIMB_BITS] = (hi << (GMP_LIMB_BITS / 2)) | lo; + } +# else + { + mp_limb_t d; + y *= (mp_limb_t) 1 << (DBL_MANT_BIT % GMP_LIMB_BITS); + d = (int) y; + y -= d; + if (!(y >= 0.0 && y < 1.0)) + abort (); + m.limbs[DBL_MANT_BIT / GMP_LIMB_BITS] = d; + } +# endif +# endif + for (i = DBL_MANT_BIT / GMP_LIMB_BITS; i > 0; ) + { + mp_limb_t hi, lo; + y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2); + hi = (int) y; + y -= hi; + if (!(y >= 0.0 && y < 1.0)) + abort (); + y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2); + lo = (int) y; + y -= lo; + if (!(y >= 0.0 && y < 1.0)) + abort (); + m.limbs[--i] = (hi << (GMP_LIMB_BITS / 2)) | lo; + } + if (!(y == 0.0)) + abort (); + /* Normalise. */ + while (m.nlimbs > 0 && m.limbs[m.nlimbs - 1] == 0) + m.nlimbs--; + *mp = m; + *ep = exp - DBL_MANT_BIT; + return m.limbs; +} + +# endif + +/* Assuming x = 2^e * m is finite and >= 0, and n is an integer: Returns the decimal representation of round (x * 10^n). Return the allocated memory - containing the decimal digits in low-to-high order, terminated with a NUL character - in case of success, NULL in case of memory allocation failure. */ static char * -scale10_round_decimal_long_double (long double x, int n) +scale10_round_decimal_decoded (int e, mpn_t m, void *memory, int n) { - int e; - mpn_t m; - void *memory = decode_long_double (x, &e, &m); int s; size_t extra_zeroes; unsigned int abs_n; @@ -1066,7 +1153,7 @@ scale10_round_decimal_long_double (long size_t count; for (count = m.nlimbs; count > 0; count--) { - accu += (mp_twolimb_t) *sourceptr++ << s; + accu += (mp_twolimb_t) *sourceptr++ << s_bits; *destptr++ = (mp_limb_t) accu; accu = accu >> GMP_LIMB_BITS; } @@ -1099,6 +1186,44 @@ scale10_round_decimal_long_double (long return digits; } +# if NEED_PRINTF_LONG_DOUBLE + +/* Assuming x is finite and >= 0, and n is an integer: + Returns the decimal representation of round (x * 10^n). + Return the allocated memory - containing the decimal digits in low-to-high + order, terminated with a NUL character - in case of success, NULL in case + of memory allocation failure. */ +static char * +scale10_round_decimal_long_double (long double x, int n) +{ + int e; + mpn_t m; + void *memory = decode_long_double (x, &e, &m); + return scale10_round_decimal_decoded (e, m, memory, n); +} + +# endif + +# if NEED_PRINTF_DOUBLE + +/* Assuming x is finite and >= 0, and n is an integer: + Returns the decimal representation of round (x * 10^n). + Return the allocated memory - containing the decimal digits in low-to-high + order, terminated with a NUL character - in case of success, NULL in case + of memory allocation failure. */ +static char * +scale10_round_decimal_double (double x, int n) +{ + int e; + mpn_t m; + void *memory = decode_double (x, &e, &m); + return scale10_round_decimal_decoded (e, m, memory, n); +} + +# endif + +# if NEED_PRINTF_LONG_DOUBLE + /* Assuming x is finite and > 0: Return an approximation for n with 10^n <= x < 10^(n+1). The approximation is usually the right n, but may be off by 1 sometimes. */ @@ -1186,6 +1311,99 @@ floorlog10l (long double x) return (int) l + (l < 0 ? -1 : 0); } +# endif + +# if NEED_PRINTF_DOUBLE + +/* Assuming x is finite and > 0: + Return an approximation for n with 10^n <= x < 10^(n+1). + The approximation is usually the right n, but may be off by 1 sometimes. */ +static int +floorlog10 (double x) +{ + int exp; + double y; + double z; + double l; + + /* Split into exponential part and mantissa. */ + y = frexp (x, &exp); + if (!(y >= 0.0 && y < 1.0)) + abort (); + if (y == 0.0) + return INT_MIN; + if (y < 0.5) + { + while (y < (1.0 / (1 << (GMP_LIMB_BITS / 2)) / (1 << (GMP_LIMB_BITS / 2)))) + { + y *= 1.0 * (1 << (GMP_LIMB_BITS / 2)) * (1 << (GMP_LIMB_BITS / 2)); + exp -= GMP_LIMB_BITS; + } + if (y < (1.0 / (1 << 16))) + { + y *= 1.0 * (1 << 16); + exp -= 16; + } + if (y < (1.0 / (1 << 8))) + { + y *= 1.0 * (1 << 8); + exp -= 8; + } + if (y < (1.0 / (1 << 4))) + { + y *= 1.0 * (1 << 4); + exp -= 4; + } + if (y < (1.0 / (1 << 2))) + { + y *= 1.0 * (1 << 2); + exp -= 2; + } + if (y < (1.0 / (1 << 1))) + { + y *= 1.0 * (1 << 1); + exp -= 1; + } + } + if (!(y >= 0.5 && y < 1.0)) + abort (); + /* Compute an approximation for l = log2(x) = exp + log2(y). */ + l = exp; + z = y; + if (z < 0.70710678118654752444) + { + z *= 1.4142135623730950488; + l -= 0.5; + } + if (z < 0.8408964152537145431) + { + z *= 1.1892071150027210667; + l -= 0.25; + } + if (z < 0.91700404320467123175) + { + z *= 1.0905077326652576592; + l -= 0.125; + } + if (z < 0.9576032806985736469) + { + z *= 1.0442737824274138403; + l -= 0.0625; + } + /* Now 0.95 <= z <= 1.01. */ + z = 1 - z; + /* log(1-z) = - z - z^2/2 - z^3/3 - z^4/4 - ... + Four terms are enough to get an approximation with error < 10^-7. */ + l -= z * (1.0 + z * (0.5 + z * ((1.0 / 3) + z * 0.25))); + /* Finally multiply with log(2)/log(10), yields an approximation for + log10(x). */ + l *= 0.30102999566398119523; + /* Round down to the next integer. */ + return (int) l + (l < 0 ? -1 : 0); +} + +# endif + #endif DCHAR_T * @@ -1196,10 +1414,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * arguments a; if (PRINTF_PARSE (format, &d, &a) < 0) - { - errno = EINVAL; - return NULL; - } + /* errno is already set. */ + return NULL; #define CLEANUP() \ free (d.dir); \ @@ -1819,8 +2035,19 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * } } #endif -#if NEED_PRINTF_DIRECTIVE_A && !defined IN_LIBINTL - else if (dp->conversion == 'a' || dp->conversion == 'A') +#if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE) && !defined IN_LIBINTL + else if ((dp->conversion == 'a' || dp->conversion == 'A') +# if !(NEED_PRINTF_DIRECTIVE_A || (NEED_PRINTF_LONG_DOUBLE && NEED_PRINTF_DOUBLE)) + && (0 +# if NEED_PRINTF_DOUBLE + || a.arg[dp->arg_index].type == TYPE_DOUBLE +# endif +# if NEED_PRINTF_LONG_DOUBLE + || a.arg[dp->arg_index].type == TYPE_LONGDOUBLE +# endif + ) +# endif + ) { arg_type type = a.arg[dp->arg_index].type; int flags = dp->flags; @@ -1938,6 +2165,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * p = tmp; if (type == TYPE_LONGDOUBLE) { +# if NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE long double arg = a.arg[dp->arg_index].a.a_longdouble; if (isnanl (arg)) @@ -2057,7 +2285,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * } } *p++ = dp->conversion - 'A' + 'P'; -# if WIDE_CHAR_VERSION +# if WIDE_CHAR_VERSION { static const wchar_t decimal_format[] = { '%', '+', 'd', '\0' }; @@ -2065,7 +2293,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * } while (*p != '\0') p++; -# else +# else if (sizeof (DCHAR_T) == 1) { sprintf ((char *) p, "%+d", exponent); @@ -2080,17 +2308,21 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * for (ep = expbuf; (*p = *ep) != '\0'; ep++) p++; } -# endif +# endif } END_LONG_DOUBLE_ROUNDING (); } +# else + abort (); +# endif } else { +# if NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_DOUBLE double arg = a.arg[dp->arg_index].a.a_double; - if (isnan (arg)) + if (isnand (arg)) { if (dp->conversion == 'A') { @@ -2204,7 +2436,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * } } *p++ = dp->conversion - 'A' + 'P'; -# if WIDE_CHAR_VERSION +# if WIDE_CHAR_VERSION { static const wchar_t decimal_format[] = { '%', '+', 'd', '\0' }; @@ -2212,7 +2444,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * } while (*p != '\0') p++; -# else +# else if (sizeof (DCHAR_T) == 1) { sprintf ((char *) p, "%+d", exponent); @@ -2227,9 +2459,12 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * for (ep = expbuf; (*p = *ep) != '\0'; ep++) p++; } -# endif +# endif } } +# else + abort (); +# endif } /* The generated string now extends from tmp to p, with the zero padding insertion point being at pad_ptr. */ @@ -2292,13 +2527,15 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * } } #endif -#if (NEED_PRINTF_INFINITE_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL +#if (NEED_PRINTF_INFINITE_DOUBLE || NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL else if ((dp->conversion == 'f' || dp->conversion == 'F' || dp->conversion == 'e' || dp->conversion == 'E' || dp->conversion == 'g' || dp->conversion == 'G' || dp->conversion == 'a' || dp->conversion == 'A') && (0 -# if NEED_PRINTF_INFINITE_DOUBLE +# if NEED_PRINTF_DOUBLE + || a.arg[dp->arg_index].type == TYPE_DOUBLE +# elif NEED_PRINTF_INFINITE_DOUBLE || (a.arg[dp->arg_index].type == TYPE_DOUBLE /* The systems (mingw) which produce wrong output for Inf, -Inf, and NaN also do so for -0.0. @@ -2315,7 +2552,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * # endif )) { -# if NEED_PRINTF_INFINITE_DOUBLE && (NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE) +# if (NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && (NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE) arg_type type = a.arg[dp->arg_index].type; # endif int flags = dp->flags; @@ -2398,17 +2635,21 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * precision = 6; /* Allocate a temporary buffer of sufficient size. */ -# if NEED_PRINTF_INFINITE_DOUBLE && NEED_PRINTF_LONG_DOUBLE +# if NEED_PRINTF_DOUBLE && NEED_PRINTF_LONG_DOUBLE + tmp_length = (type == TYPE_LONGDOUBLE ? LDBL_DIG + 1 : DBL_DIG + 1); +# elif NEED_PRINTF_INFINITE_DOUBLE && NEED_PRINTF_LONG_DOUBLE tmp_length = (type == TYPE_LONGDOUBLE ? LDBL_DIG + 1 : 0); # elif NEED_PRINTF_LONG_DOUBLE tmp_length = LDBL_DIG + 1; +# elif NEED_PRINTF_DOUBLE + tmp_length = DBL_DIG + 1; # else tmp_length = 0; # endif if (tmp_length < precision) tmp_length = precision; # if NEED_PRINTF_LONG_DOUBLE -# if NEED_PRINTF_INFINITE_DOUBLE +# if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE if (type == TYPE_LONGDOUBLE) # endif if (dp->conversion == 'f' || dp->conversion == 'F') @@ -2423,6 +2664,22 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * } } # endif +# if NEED_PRINTF_DOUBLE +# if NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE + if (type == TYPE_DOUBLE) +# endif + if (dp->conversion == 'f' || dp->conversion == 'F') + { + double arg = a.arg[dp->arg_index].a.a_double; + if (!(isnand (arg) || arg + arg == arg)) + { + /* arg is finite and nonzero. */ + int exponent = floorlog10 (arg < 0 ? -arg : arg); + if (exponent >= 0 && tmp_length < exponent + precision) + tmp_length = exponent + precision; + } + } +# endif /* Account for sign, decimal point etc. */ tmp_length = xsum (tmp_length, 12); @@ -2450,7 +2707,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * p = tmp; # if NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE -# if NEED_PRINTF_INFINITE_DOUBLE +# if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE if (type == TYPE_LONGDOUBLE) # endif { @@ -2810,16 +3067,15 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * END_LONG_DOUBLE_ROUNDING (); } } -# if NEED_PRINTF_INFINITE_DOUBLE +# if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE else # endif # endif -# if NEED_PRINTF_INFINITE_DOUBLE +# if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE { - /* Simpler than above: handle only NaN, Infinity, zero. */ double arg = a.arg[dp->arg_index].a.a_double; - if (isnan (arg)) + if (isnand (arg)) { if (dp->conversion >= 'A' && dp->conversion <= 'Z') { @@ -2834,7 +3090,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * { int sign = 0; - if (signbit (arg)) /* arg < 0.0L or negative zero */ + if (signbit (arg)) /* arg < 0.0 or negative zero */ { sign = -1; arg = -arg; @@ -2860,18 +3116,344 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * } else { - if (!(arg == 0.0)) - abort (); - +# if NEED_PRINTF_DOUBLE pad_ptr = p; if (dp->conversion == 'f' || dp->conversion == 'F') { - *p++ = '0'; + char *digits; + size_t ndigits; + + digits = + scale10_round_decimal_double (arg, precision); + if (digits == NULL) + goto out_of_memory; + ndigits = strlen (digits); + + if (ndigits > precision) + do + { + --ndigits; + *p++ = digits[ndigits]; + } + while (ndigits > precision); + else + *p++ = '0'; + /* Here ndigits <= precision. */ if ((flags & FLAG_ALT) || precision > 0) { *p++ = decimal_point_char (); - for (; precision > 0; precision--) + for (; precision > ndigits; precision--) + *p++ = '0'; + while (ndigits > 0) + { + --ndigits; + *p++ = digits[ndigits]; + } + } + + free (digits); + } + else if (dp->conversion == 'e' || dp->conversion == 'E') + { + int exponent; + + if (arg == 0.0) + { + exponent = 0; + *p++ = '0'; + if ((flags & FLAG_ALT) || precision > 0) + { + *p++ = decimal_point_char (); + for (; precision > 0; precision--) + *p++ = '0'; + } + } + else + { + /* arg > 0.0. */ + int adjusted; + char *digits; + size_t ndigits; + + exponent = floorlog10 (arg); + adjusted = 0; + for (;;) + { + digits = + scale10_round_decimal_double (arg, + (int)precision - exponent); + if (digits == NULL) + goto out_of_memory; + ndigits = strlen (digits); + + if (ndigits == precision + 1) + break; + if (ndigits < precision + || ndigits > precision + 2) + /* The exponent was not guessed + precisely enough. */ + abort (); + if (adjusted) + /* None of two values of exponent is + the right one. Prevent an endless + loop. */ + abort (); + free (digits); + if (ndigits == precision) + exponent -= 1; + else + exponent += 1; + adjusted = 1; + } + + /* Here ndigits = precision+1. */ + *p++ = digits[--ndigits]; + if ((flags & FLAG_ALT) || precision > 0) + { + *p++ = decimal_point_char (); + while (ndigits > 0) + { + --ndigits; + *p++ = digits[ndigits]; + } + } + + free (digits); + } + + *p++ = dp->conversion; /* 'e' or 'E' */ +# if WIDE_CHAR_VERSION + { + static const wchar_t decimal_format[] = + /* Produce the same number of exponent digits + as the native printf implementation. */ +# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ + { '%', '+', '.', '3', 'd', '\0' }; +# else + { '%', '+', '.', '2', 'd', '\0' }; +# endif + SNPRINTF (p, 6 + 1, decimal_format, exponent); + } + while (*p != '\0') + p++; +# else + { + static const char decimal_format[] = + /* Produce the same number of exponent digits + as the native printf implementation. */ +# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ + "%+.3d"; +# else + "%+.2d"; +# endif + if (sizeof (DCHAR_T) == 1) + { + sprintf ((char *) p, decimal_format, exponent); + while (*p != '\0') + p++; + } + else + { + char expbuf[6 + 1]; + const char *ep; + sprintf (expbuf, decimal_format, exponent); + for (ep = expbuf; (*p = *ep) != '\0'; ep++) + p++; + } + } +# endif + } + else if (dp->conversion == 'g' || dp->conversion == 'G') + { + if (precision == 0) + precision = 1; + /* precision >= 1. */ + + if (arg == 0.0) + /* The exponent is 0, >= -4, < precision. + Use fixed-point notation. */ + { + size_t ndigits = precision; + /* Number of trailing zeroes that have to be + dropped. */ + size_t nzeroes = + (flags & FLAG_ALT ? 0 : precision - 1); + + --ndigits; + *p++ = '0'; + if ((flags & FLAG_ALT) || ndigits > nzeroes) + { + *p++ = decimal_point_char (); + while (ndigits > nzeroes) + { + --ndigits; + *p++ = '0'; + } + } + } + else + { + /* arg > 0.0. */ + int exponent; + int adjusted; + char *digits; + size_t ndigits; + size_t nzeroes; + + exponent = floorlog10 (arg); + adjusted = 0; + for (;;) + { + digits = + scale10_round_decimal_double (arg, + (int)(precision - 1) - exponent); + if (digits == NULL) + goto out_of_memory; + ndigits = strlen (digits); + + if (ndigits == precision) + break; + if (ndigits < precision - 1 + || ndigits > precision + 1) + /* The exponent was not guessed + precisely enough. */ + abort (); + if (adjusted) + /* None of two values of exponent is + the right one. Prevent an endless + loop. */ + abort (); + free (digits); + if (ndigits < precision) + exponent -= 1; + else + exponent += 1; + adjusted = 1; + } + /* Here ndigits = precision. */ + + /* Determine the number of trailing zeroes + that have to be dropped. */ + nzeroes = 0; + if ((flags & FLAG_ALT) == 0) + while (nzeroes < ndigits + && digits[nzeroes] == '0') + nzeroes++; + + /* The exponent is now determined. */ + if (exponent >= -4 + && exponent < (long)precision) + { + /* Fixed-point notation: + max(exponent,0)+1 digits, then the + decimal point, then the remaining + digits without trailing zeroes. */ + if (exponent >= 0) + { + size_t count = exponent + 1; + /* Note: count <= precision = ndigits. */ + for (; count > 0; count--) + *p++ = digits[--ndigits]; + if ((flags & FLAG_ALT) || ndigits > nzeroes) + { + *p++ = decimal_point_char (); + while (ndigits > nzeroes) + { + --ndigits; + *p++ = digits[ndigits]; + } + } + } + else + { + size_t count = -exponent - 1; + *p++ = '0'; + *p++ = decimal_point_char (); + for (; count > 0; count--) + *p++ = '0'; + while (ndigits > nzeroes) + { + --ndigits; + *p++ = digits[ndigits]; + } + } + } + else + { + /* Exponential notation. */ + *p++ = digits[--ndigits]; + if ((flags & FLAG_ALT) || ndigits > nzeroes) + { + *p++ = decimal_point_char (); + while (ndigits > nzeroes) + { + --ndigits; + *p++ = digits[ndigits]; + } + } + *p++ = dp->conversion - 'G' + 'E'; /* 'e' or 'E' */ +# if WIDE_CHAR_VERSION + { + static const wchar_t decimal_format[] = + /* Produce the same number of exponent digits + as the native printf implementation. */ +# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ + { '%', '+', '.', '3', 'd', '\0' }; +# else + { '%', '+', '.', '2', 'd', '\0' }; +# endif + SNPRINTF (p, 6 + 1, decimal_format, exponent); + } + while (*p != '\0') + p++; +# else + { + static const char decimal_format[] = + /* Produce the same number of exponent digits + as the native printf implementation. */ +# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ + "%+.3d"; +# else + "%+.2d"; +# endif + if (sizeof (DCHAR_T) == 1) + { + sprintf ((char *) p, decimal_format, exponent); + while (*p != '\0') + p++; + } + else + { + char expbuf[6 + 1]; + const char *ep; + sprintf (expbuf, decimal_format, exponent); + for (ep = expbuf; (*p = *ep) != '\0'; ep++) + p++; + } + } +# endif + } + + free (digits); + } + } + else + abort (); +# else + /* arg is finite. */ + if (!(arg == 0.0)) + abort (); + + pad_ptr = p; + + if (dp->conversion == 'f' || dp->conversion == 'F') + { + *p++ = '0'; + if ((flags & FLAG_ALT) || precision > 0) + { + *p++ = decimal_point_char (); + for (; precision > 0; precision--) *p++ = '0'; } } @@ -2888,9 +3470,9 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * *p++ = '+'; /* Produce the same number of exponent digits as the native printf implementation. */ -# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ *p++ = '0'; -# endif +# endif *p++ = '0'; *p++ = '0'; } @@ -2908,6 +3490,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * } else abort (); +# endif } } } @@ -2978,11 +3561,22 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * { arg_type type = a.arg[dp->arg_index].type; int flags = dp->flags; -#if !USE_SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO +#if !USE_SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION int has_width; size_t width; #endif -#if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO +#if !USE_SNPRINTF || NEED_PRINTF_UNBOUNDED_PRECISION + int has_precision; + size_t precision; +#endif +#if NEED_PRINTF_UNBOUNDED_PRECISION + int prec_ourselves; +#else +# define prec_ourselves 0 +#endif +#if NEED_PRINTF_FLAG_LEFTADJUST +# define pad_ourselves 1 +#elif !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION int pad_ourselves; #else # define pad_ourselves 0 @@ -2996,7 +3590,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * TCHAR_T *tmp; #endif -#if !USE_SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO +#if !USE_SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION has_width = 0; width = 0; if (dp->width_start != dp->width_end) @@ -3030,34 +3624,80 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * } #endif -#if !USE_SNPRINTF - /* Allocate a temporary buffer of sufficient size for calling - sprintf. */ - { - size_t precision; +#if !USE_SNPRINTF || NEED_PRINTF_UNBOUNDED_PRECISION + has_precision = 0; + precision = 6; + if (dp->precision_start != dp->precision_end) + { + if (dp->precision_arg_index != ARG_NONE) + { + int arg; - precision = 6; - if (dp->precision_start != dp->precision_end) - { - if (dp->precision_arg_index != ARG_NONE) - { - int arg; + if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) + abort (); + arg = a.arg[dp->precision_arg_index].a.a_int; + /* "A negative precision is taken as if the precision + were omitted." */ + if (arg >= 0) + { + precision = arg; + has_precision = 1; + } + } + else + { + const FCHAR_T *digitp = dp->precision_start + 1; - if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) - abort (); - arg = a.arg[dp->precision_arg_index].a.a_int; - precision = (arg < 0 ? 0 : arg); - } - else - { - const FCHAR_T *digitp = dp->precision_start + 1; + precision = 0; + while (digitp != dp->precision_end) + precision = xsum (xtimes (precision, 10), *digitp++ - '0'); + has_precision = 1; + } + } +#endif - precision = 0; - while (digitp != dp->precision_end) - precision = xsum (xtimes (precision, 10), *digitp++ - '0'); - } - } + /* Decide whether to handle the precision ourselves. */ +#if NEED_PRINTF_UNBOUNDED_PRECISION + switch (dp->conversion) + { + case 'd': case 'i': case 'u': + case 'o': + case 'x': case 'X': case 'p': + prec_ourselves = has_precision && (precision > 0); + break; + default: + prec_ourselves = 0; + break; + } +#endif + + /* Decide whether to perform the padding ourselves. */ +#if !NEED_PRINTF_FLAG_LEFTADJUST && (!DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION) + switch (dp->conversion) + { +# if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO + /* If we need conversion from TCHAR_T[] to DCHAR_T[], we need + to perform the padding after this conversion. Functions + with unistdio extensions perform the padding based on + character count rather than element count. */ + case 'c': case 's': +# endif +# if NEED_PRINTF_FLAG_ZERO + case 'f': case 'F': case 'e': case 'E': case 'g': case 'G': + case 'a': case 'A': +# endif + pad_ourselves = 1; + break; + default: + pad_ourselves = prec_ourselves; + break; + } +#endif +#if !USE_SNPRINTF + /* Allocate a temporary buffer of sufficient size for calling + sprintf. */ + { switch (dp->conversion) { @@ -3230,18 +3870,22 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * abort (); } + if (!pad_ourselves) + { # if ENABLE_UNISTDIO - /* Padding considers the number of characters, therefore the - number of elements after padding may be - > max (tmp_length, width) - but is certainly - <= tmp_length + width. */ - tmp_length = xsum (tmp_length, width); -# else - /* Padding considers the number of elements, says POSIX. */ - if (tmp_length < width) - tmp_length = width; + /* Padding considers the number of characters, therefore + the number of elements after padding may be + > max (tmp_length, width) + but is certainly + <= tmp_length + width. */ + tmp_length = xsum (tmp_length, width); +# else + /* Padding considers the number of elements, + says POSIX. */ + if (tmp_length < width) + tmp_length = width; # endif + } tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */ } @@ -3262,29 +3906,6 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * } #endif - /* Decide whether to perform the padding ourselves. */ -#if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO - switch (dp->conversion) - { -# if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO - /* If we need conversion from TCHAR_T[] to DCHAR_T[], we need - to perform the padding after this conversion. Functions - with unistdio extensions perform the padding based on - character count rather than element count. */ - case 'c': case 's': -# endif -# if NEED_PRINTF_FLAG_ZERO - case 'f': case 'F': case 'e': case 'E': case 'g': case 'G': - case 'a': case 'A': -# endif - pad_ourselves = 1; - break; - default: - pad_ourselves = 0; - break; - } -#endif - /* Construct the format string for calling snprintf or sprintf. */ fbp = buf; @@ -3328,22 +3949,25 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * } } } - if (dp->precision_start != dp->precision_end) + if (!prec_ourselves) { - size_t n = dp->precision_end - dp->precision_start; - /* The precision specification is known to consist only - of standard ASCII characters. */ - if (sizeof (FCHAR_T) == sizeof (TCHAR_T)) + if (dp->precision_start != dp->precision_end) { - memcpy (fbp, dp->precision_start, n * sizeof (TCHAR_T)); - fbp += n; - } - else - { - const FCHAR_T *mp = dp->precision_start; - do - *fbp++ = (unsigned char) *mp++; - while (--n > 0); + size_t n = dp->precision_end - dp->precision_start; + /* The precision specification is known to consist only + of standard ASCII characters. */ + if (sizeof (FCHAR_T) == sizeof (TCHAR_T)) + { + memcpy (fbp, dp->precision_start, n * sizeof (TCHAR_T)); + fbp += n; + } + else + { + const FCHAR_T *mp = dp->precision_start; + do + *fbp++ = (unsigned char) *mp++; + while (--n > 0); + } } } @@ -3385,9 +4009,36 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * #endif *fbp = dp->conversion; #if USE_SNPRINTF +# if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3) || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) fbp[1] = '%'; fbp[2] = 'n'; fbp[3] = '\0'; +# else + /* On glibc2 systems from glibc >= 2.3 - probably also older + ones - we know that snprintf's returns value conforms to + ISO C 99: the gl_SNPRINTF_DIRECTIVE_N test passes. + Therefore we can avoid using %n in this situation. + On glibc2 systems from 2004-10-18 or newer, the use of %n + in format strings in writable memory may crash the program + (if compiled with _FORTIFY_SOURCE=2), so we should avoid it + in this situation. */ + /* On native Win32 systems (such as mingw), we can avoid using + %n because: + - Although the gl_SNPRINTF_TRUNCATION_C99 test fails, + snprintf does not write more than the specified number + of bytes. (snprintf (buf, 3, "%d %d", 4567, 89) writes + '4', '5', '6' into buf, not '4', '5', '\0'.) + - Although the gl_SNPRINTF_RETVAL_C99 test fails, snprintf + allows us to recognize the case of an insufficient + buffer size: it returns -1 in this case. + On native Win32 systems (such as mingw) where the OS is + Windows Vista, the use of %n in format strings by default + crashes the program. See + <http://gcc.gnu.org/ml/gcc/2007-06/msg00122.html> and + <http://msdn2.microsoft.com/en-us/library/ms175782(VS.80).aspx> + So we should avoid %n in this situation. */ + fbp[1] = '\0'; +# endif #else fbp[1] = '\0'; #endif @@ -3414,9 +4065,13 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * sizeof (TCHAR_T) divides sizeof (DCHAR_T) and alignof (TCHAR_T) <= alignof (DCHAR_T). */ # define TCHARS_PER_DCHAR (sizeof (DCHAR_T) / sizeof (TCHAR_T)) + /* Ensure that maxlen below will be >= 2. Needed on BeOS, + where an snprintf() with maxlen==1 acts like sprintf(). */ + ENSURE_ALLOCATION (xsum (length, + (2 + TCHARS_PER_DCHAR - 1) + / TCHARS_PER_DCHAR)); /* Prepare checking whether snprintf returns the count via %n. */ - ENSURE_ALLOCATION (xsum (length, 1)); *(TCHAR_T *) (result + length) = '\0'; #endif @@ -3430,7 +4085,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * /* SNPRINTF can fail if its second argument is > INT_MAX. */ if (maxlen > INT_MAX / TCHARS_PER_DCHAR) - goto overflow; + maxlen = INT_MAX / TCHARS_PER_DCHAR; maxlen = maxlen * TCHARS_PER_DCHAR; # define SNPRINTF_BUF(arg) \ switch (prefix_count) \ @@ -3648,31 +4303,113 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * } #if USE_SNPRINTF - /* Handle overflow of the allocated buffer. */ - if (count >= maxlen) + /* Handle overflow of the allocated buffer. + If such an overflow occurs, a C99 compliant snprintf() + returns a count >= maxlen. However, a non-compliant + snprintf() function returns only count = maxlen - 1. To + cover both cases, test whether count >= maxlen - 1. */ + if ((unsigned int) count + 1 >= maxlen) + { + /* If maxlen already has attained its allowed maximum, + allocating more memory will not increase maxlen. + Instead of looping, bail out. */ + if (maxlen == INT_MAX / TCHARS_PER_DCHAR) + goto overflow; + else + { + /* Need at least (count + 1) * sizeof (TCHAR_T) + bytes. (The +1 is for the trailing NUL.) + But ask for (count + 2) * sizeof (TCHAR_T) + bytes, so that in the next round, we likely get + maxlen > (unsigned int) count + 1 + and so we don't get here again. + And allocate proportionally, to avoid looping + eternally if snprintf() reports a too small + count. */ + size_t n = + xmax (xsum (length, + ((unsigned int) count + 2 + + TCHARS_PER_DCHAR - 1) + / TCHARS_PER_DCHAR), + xtimes (allocated, 2)); + + ENSURE_ALLOCATION (n); + continue; + } + } +#endif + +#if NEED_PRINTF_UNBOUNDED_PRECISION + if (prec_ourselves) { - /* Need at least count * sizeof (TCHAR_T) bytes. But - allocate proportionally, to avoid looping eternally - if snprintf() reports a too small count. */ - size_t n = - xmax (xsum (length, - (count + TCHARS_PER_DCHAR - 1) - / TCHARS_PER_DCHAR), - xtimes (allocated, 2)); + /* Handle the precision. */ + TCHAR_T *prec_ptr = +# if USE_SNPRINTF + (TCHAR_T *) (result + length); +# else + tmp; +# endif + size_t prefix_count; + size_t move; - ENSURE_ALLOCATION (n); - continue; + prefix_count = 0; + /* Put the additional zeroes after the sign. */ + if (count >= 1 + && (*prec_ptr == '-' || *prec_ptr == '+' + || *prec_ptr == ' ')) + prefix_count = 1; + /* Put the additional zeroes after the 0x prefix if + (flags & FLAG_ALT) || (dp->conversion == 'p'). */ + else if (count >= 2 + && prec_ptr[0] == '0' + && (prec_ptr[1] == 'x' || prec_ptr[1] == 'X')) + prefix_count = 2; + + move = count - prefix_count; + if (precision > move) + { + /* Insert zeroes. */ + size_t insert = precision - move; + TCHAR_T *prec_end; + +# if USE_SNPRINTF + size_t n = + xsum (length, + (count + insert + TCHARS_PER_DCHAR - 1) + / TCHARS_PER_DCHAR); + length += (count + TCHARS_PER_DCHAR - 1) / TCHARS_PER_DCHAR; + ENSURE_ALLOCATION (n); + length -= (count + TCHARS_PER_DCHAR - 1) / TCHARS_PER_DCHAR; + prec_ptr = (TCHAR_T *) (result + length); +# endif + + prec_end = prec_ptr + count; + prec_ptr += prefix_count; + + while (prec_end > prec_ptr) + { + prec_end--; + prec_end[insert] = prec_end[0]; + } + + prec_end += insert; + do + *--prec_end = '0'; + while (prec_end > prec_ptr); + + count += insert; + } } #endif -#if !DCHAR_IS_TCHAR -# if !USE_SNPRINTF +#if !USE_SNPRINTF if (count >= tmp_length) /* tmp_length was incorrectly calculated - fix the code above! */ abort (); -# endif +#endif +#if !DCHAR_IS_TCHAR /* Convert from TCHAR_T[] to DCHAR_T[]. */ if (dp->conversion == 'c' || dp->conversion == 's') { @@ -3773,7 +4510,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * /* Here count <= allocated - length. */ /* Perform padding. */ -#if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO +#if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION if (pad_ourselves && has_width) { size_t w; @@ -3790,7 +4527,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * if (w < width) { size_t pad = width - w; -# if USE_SNPRINTF + /* Make room for the result. */ if (xsum (count, pad) > allocated - length) { @@ -3800,12 +4537,16 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * xmax (xsum3 (length, count, pad), xtimes (allocated, 2)); +# if USE_SNPRINTF length += count; ENSURE_ALLOCATION (n); length -= count; +# else + ENSURE_ALLOCATION (n); +# endif } /* Here count + pad <= allocated - length. */ -# endif + { # if !DCHAR_IS_TCHAR || USE_SNPRINTF DCHAR_T * const rp = result + length; @@ -3814,15 +4555,14 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * # endif DCHAR_T *p = rp + count; DCHAR_T *end = p + pad; -# if NEED_PRINTF_FLAG_ZERO DCHAR_T *pad_ptr; -# if !DCHAR_IS_TCHAR +# if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO if (dp->conversion == 'c' || dp->conversion == 's') /* No zero-padding for string directives. */ pad_ptr = NULL; else -# endif +# endif { pad_ptr = (*rp == '-' ? rp + 1 : rp); /* No zero-padding of "inf" and "nan". */ @@ -3830,7 +4570,6 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * || (*pad_ptr >= 'a' && *pad_ptr <= 'z')) pad_ptr = NULL; } -# endif /* The generated string now extends from rp to p, with the zero padding insertion point being at pad_ptr. */ @@ -3843,7 +4582,6 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * for (; pad > 0; pad--) *p++ = ' '; } -# if NEED_PRINTF_FLAG_ZERO else if ((flags & FLAG_ZERO) && pad_ptr != NULL) { /* Pad with zeroes. */ @@ -3854,7 +4592,6 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * for (; pad > 0; pad--) *p++ = '0'; } -# endif else { /* Pad with spaces on the left. */ @@ -3870,13 +4607,6 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * } #endif -#if DCHAR_IS_TCHAR && !USE_SNPRINTF - if (count >= tmp_length) - /* tmp_length was incorrectly calculated - fix the - code above! */ - abort (); -#endif - /* Here still count <= allocated - length. */ #if !DCHAR_IS_TCHAR || USE_SNPRINTF @@ -3933,6 +4663,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * not have this limitation. */ return result; +#if USE_SNPRINTF overflow: if (!(result == resultbuf || result == NULL)) free (result); @@ -3941,6 +4672,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * CLEANUP (); errno = EOVERFLOW; return NULL; +#endif out_of_memory: if (!(result == resultbuf || result == NULL)) @@ -3957,9 +4689,11 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * #undef TCHARS_PER_DCHAR #undef SNPRINTF #undef USE_SNPRINTF +#undef DCHAR_CPY #undef PRINTF_PARSE #undef DIRECTIVES #undef DIRECTIVE +#undef DCHAR_IS_TCHAR #undef TCHAR_T #undef DCHAR_T #undef FCHAR_T diff -ruNp m4-1.4.10/lib/vasnprintf.h m4-1.4.11/lib/vasnprintf.h --- m4-1.4.10/lib/vasnprintf.h 2007-05-30 19:30:42.000000000 -0600 +++ m4-1.4.11/lib/vasnprintf.h 2008-01-14 22:04:40.000000000 -0700 @@ -1,9 +1,9 @@ /* vsprintf with automatic memory allocation. - Copyright (C) 2002-2004, 2007 Free Software Foundation, Inc. + Copyright (C) 2002-2004, 2007-2008 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 2, or (at your option) + the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -26,7 +26,7 @@ #ifndef __attribute__ /* This feature is available in gcc versions 2.5 and later. */ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__ +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) # define __attribute__(Spec) /* empty */ # endif /* The __-protected variants of `format' and `printf' attributes diff -ruNp m4-1.4.10/lib/vasprintf.c m4-1.4.11/lib/vasprintf.c --- m4-1.4.10/lib/vasprintf.c 2007-05-30 19:30:42.000000000 -0600 +++ m4-1.4.11/lib/vasprintf.c 2008-03-30 16:07:17.000000000 -0600 @@ -1,9 +1,9 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2008 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 2, or (at your option) + the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -30,11 +30,6 @@ #include "vasnprintf.h" -/* Some systems, like OSF/1 4.0 and Woe32, don't have EOVERFLOW. */ -#ifndef EOVERFLOW -# define EOVERFLOW E2BIG -#endif - int vasprintf (char **resultp, const char *format, va_list args) { diff -ruNp m4-1.4.10/lib/verify.h m4-1.4.11/lib/verify.h --- m4-1.4.10/lib/verify.h 2007-05-30 19:30:43.000000000 -0600 +++ m4-1.4.11/lib/verify.h 1969-12-31 17:00:00.000000000 -0700 @@ -1,141 +0,0 @@ -/* Compile-time assert-like macros. - - Copyright (C) 2005, 2006 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 2, 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -/* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */ - -#ifndef VERIFY_H -# define VERIFY_H 1 - -/* Each of these macros verifies that its argument R is nonzero. To - be portable, R should be an integer constant expression. Unlike - assert (R), there is no run-time overhead. - - There are two macros, since no single macro can be used in all - contexts in C. verify_true (R) is for scalar contexts, including - integer constant expression contexts. verify (R) is for declaration - contexts, e.g., the top level. - - Symbols ending in "__" are private to this header. - - The code below uses several ideas. - - * The first step is ((R) ? 1 : -1). Given an expression R, of - integral or boolean or floating-point type, this yields an - expression of integral type, whose value is later verified to be - constant and nonnegative. - - * Next this expression W is wrapped in a type - struct verify_type__ { unsigned int verify_error_if_negative_size__: W; }. - If W is negative, this yields a compile-time error. No compiler can - deal with a bit-field of negative size. - - One might think that an array size check would have the same - effect, that is, that the type struct { unsigned int dummy[W]; } - would work as well. However, inside a function, some compilers - (such as C++ compilers and GNU C) allow local parameters and - variables inside array size expressions. With these compilers, - an array size check would not properly diagnose this misuse of - the verify macro: - - void function (int n) { verify (n < 0); } - - * For the verify macro, the struct verify_type__ will need to - somehow be embedded into a declaration. To be portable, this - declaration must declare an object, a constant, a function, or a - typedef name. If the declared entity uses the type directly, - such as in - - struct dummy {...}; - typedef struct {...} dummy; - extern struct {...} *dummy; - extern void dummy (struct {...} *); - extern struct {...} *dummy (void); - - two uses of the verify macro would yield colliding declarations - if the entity names are not disambiguated. A workaround is to - attach the current line number to the entity name: - - #define GL_CONCAT0(x, y) x##y - #define GL_CONCAT(x, y) GL_CONCAT0 (x, y) - extern struct {...} * GL_CONCAT(dummy,__LINE__); - - But this has the problem that two invocations of verify from - within the same macro would collide, since the __LINE__ value - would be the same for both invocations. - - A solution is to use the sizeof operator. It yields a number, - getting rid of the identity of the type. Declarations like - - extern int dummy [sizeof (struct {...})]; - extern void dummy (int [sizeof (struct {...})]); - extern int (*dummy (void)) [sizeof (struct {...})]; - - can be repeated. - - * Should the implementation use a named struct or an unnamed struct? - Which of the following alternatives can be used? - - extern int dummy [sizeof (struct {...})]; - extern int dummy [sizeof (struct verify_type__ {...})]; - extern void dummy (int [sizeof (struct {...})]); - extern void dummy (int [sizeof (struct verify_type__ {...})]); - extern int (*dummy (void)) [sizeof (struct {...})]; - extern int (*dummy (void)) [sizeof (struct verify_type__ {...})]; - - In the second and sixth case, the struct type is exported to the - outer scope; two such declarations therefore collide. GCC warns - about the first, third, and fourth cases. So the only remaining - possibility is the fifth case: - - extern int (*dummy (void)) [sizeof (struct {...})]; - - * This implementation exploits the fact that GCC does not warn about - the last declaration mentioned above. If a future version of GCC - introduces a warning for this, the problem could be worked around - by using code specialized to GCC, e.g.,: - - #if 4 <= __GNUC__ - # define verify(R) \ - extern int (* verify_function__ (void)) \ - [__builtin_constant_p (R) && (R) ? 1 : -1] - #endif - - * In C++, any struct definition inside sizeof is invalid. - Use a template type to work around the problem. */ - - -/* Verify requirement R at compile-time, as an integer constant expression. - Return 1. */ - -# ifdef __cplusplus -template <int w> - struct verify_type__ { unsigned int verify_error_if_negative_size__: w; }; -# define verify_true(R) \ - (!!sizeof (verify_type__<(R) ? 1 : -1>)) -# else -# define verify_true(R) \ - (!!sizeof \ - (struct { unsigned int verify_error_if_negative_size__: (R) ? 1 : -1; })) -# endif - -/* Verify requirement R at compile-time, as a declaration without a - trailing ';'. */ - -# define verify(R) extern int (* verify_function__ (void)) [verify_true (R)] - -#endif diff -ruNp m4-1.4.10/lib/verror.c m4-1.4.11/lib/verror.c --- m4-1.4.10/lib/verror.c 2007-05-30 19:30:43.000000000 -0600 +++ m4-1.4.11/lib/verror.c 2007-10-09 06:16:45.000000000 -0600 @@ -1,19 +1,18 @@ /* va_list error handler for noninteractive utilities - Copyright (C) 2006 Free Software Foundation, Inc. + Copyright (C) 2006-2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Eric Blake. */ @@ -28,6 +27,7 @@ #if ENABLE_NLS # include "gettext.h" +# define _(msgid) gettext (msgid) #endif #ifndef _ diff -ruNp m4-1.4.10/lib/verror.h m4-1.4.11/lib/verror.h --- m4-1.4.10/lib/verror.h 2007-05-30 19:30:43.000000000 -0600 +++ m4-1.4.11/lib/verror.h 2007-12-01 13:55:37.000000000 -0700 @@ -1,19 +1,18 @@ /* Declaration for va_list error-reporting function Copyright (C) 2006-2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _VERROR_H #define _VERROR_H 1 diff -ruNp m4-1.4.10/lib/version-etc-fsf.c m4-1.4.11/lib/version-etc-fsf.c --- m4-1.4.10/lib/version-etc-fsf.c 2007-05-30 19:30:43.000000000 -0600 +++ m4-1.4.11/lib/version-etc-fsf.c 2007-10-09 06:16:46.000000000 -0600 @@ -1,10 +1,10 @@ /* Variable with FSF copyright information, for version-etc. Copyright (C) 1999-2006 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -12,8 +12,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Jim Meyering. */ diff -ruNp m4-1.4.10/lib/version-etc.c m4-1.4.11/lib/version-etc.c --- m4-1.4.10/lib/version-etc.c 2007-07-05 05:48:29.000000000 -0600 +++ m4-1.4.11/lib/version-etc.c 2008-01-03 21:46:36.000000000 -0700 @@ -1,10 +1,10 @@ /* Utility to help print --version output in a consistent format. - Copyright (C) 1999-2007 Free Software Foundation, Inc. + Copyright (C) 1999-2008 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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, or (at your option) - any later version. + 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 @@ -12,8 +12,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Jim Meyering. */ @@ -33,7 +32,7 @@ #include "gettext.h" #define _(msgid) gettext (msgid) -enum { COPYRIGHT_YEAR = 2007 }; +enum { COPYRIGHT_YEAR = 2008 }; /* Like version_etc, below, but with the NULL-terminated author list provided via a variable of type va_list. */ diff -ruNp m4-1.4.10/lib/version-etc.h m4-1.4.11/lib/version-etc.h --- m4-1.4.10/lib/version-etc.h 2007-05-30 19:30:44.000000000 -0600 +++ m4-1.4.11/lib/version-etc.h 2007-12-01 13:55:38.000000000 -0700 @@ -1,10 +1,10 @@ /* Utility to help print --version output in a consistent format. Copyright (C) 1999, 2003, 2005 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -12,8 +12,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Jim Meyering. */ diff -ruNp m4-1.4.10/lib/wchar.in.h m4-1.4.11/lib/wchar.in.h --- m4-1.4.10/lib/wchar.in.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/lib/wchar.in.h 2008-03-31 20:59:32.000000000 -0600 @@ -0,0 +1,91 @@ +/* A substitute for ISO C99 <wchar.h>, for platforms that have issues. + + Copyright (C) 2007 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, 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, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Eric Blake. */ + +/* + * ISO C 99 <wchar.h> for platforms that have issues. + * <http://www.opengroup.org/susv3xbd/wchar.h.html> + * + * For now, this just ensures proper prerequisite inclusion order and + * the declaration of wcwidth(). + */ + +#ifdef __need_mbstate_t +/* Special invocation convention inside glibc header files. */ + +#@INCLUDE_NEXT@ @NEXT_WCHAR_H@ + +#else +/* Normal invocation convention. */ + +#ifndef _GL_WCHAR_H + +/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before + <wchar.h>. + BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be + included before <wchar.h>. */ +#include <stddef.h> +#include <stdio.h> +#include <time.h> + +/* Include the original <wchar.h> if it exists. + Some builds of uClibc lack it. */ +/* The include_next requires a split double-inclusion guard. */ +#if @HAVE_WCHAR_H@ +# @INCLUDE_NEXT@ @NEXT_WCHAR_H@ +#endif + +#ifndef _GL_WCHAR_H +#define _GL_WCHAR_H + +/* The definition of GL_LINK_WARNING is copied here. */ + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Return the number of screen columns needed for WC. */ +#if @GNULIB_WCWIDTH@ +# if @REPLACE_WCWIDTH@ +# undef wcwidth +# define wcwidth rpl_wcwidth +extern int wcwidth (wchar_t); +# else +# if !defined wcwidth && !@HAVE_DECL_WCWIDTH@ +/* wcwidth exists but is not declared. */ +extern int wcwidth (int /* actually wchar_t */); +# endif +# endif +#elif defined GNULIB_POSIXCHECK +# undef wcwidth +# define wcwidth(w) \ + (GL_LINK_WARNING ("wcwidth is unportable - " \ + "use gnulib module wcwidth for portability"), \ + wcwidth (w)) +#endif + + +#ifdef __cplusplus +} +#endif + +#endif /* _GL_WCHAR_H */ +#endif /* _GL_WCHAR_H */ +#endif diff -ruNp m4-1.4.10/lib/wchar_.h m4-1.4.11/lib/wchar_.h --- m4-1.4.10/lib/wchar_.h 2007-07-09 21:12:32.000000000 -0600 +++ m4-1.4.11/lib/wchar_.h 1969-12-31 17:00:00.000000000 -0700 @@ -1,82 +0,0 @@ -/* A substitute for ISO C99 <wchar.h>, for platforms that have issues. - - Copyright (C) 2007 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 2, 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -/* Written by Eric Blake. */ - -/* - * ISO C 99 <wchar.h> for platforms that have issues. - * <http://www.opengroup.org/susv3xbd/wchar.h.html> - * - * For now, this just ensures proper prerequisite inclusion order and - * the declaration of wcwidth(). - */ - -#ifndef _GL_WCHAR_H - -/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before - <wchar.h>. - BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be - included before <wchar.h>. */ -#include <stddef.h> -#include <stdio.h> -#include <time.h> - -/* Include the original <wchar.h> if it exists. - Some builds of uClibc lack it. */ -/* The include_next requires a split double-inclusion guard. */ -#if @HAVE_WCHAR_H@ -# @INCLUDE_NEXT@ @NEXT_WCHAR_H@ -#endif - -#ifndef _GL_WCHAR_H -#define _GL_WCHAR_H - -/* The definition of GL_LINK_WARNING is copied here. */ - -#ifdef __cplusplus -extern "C" { -#endif - - -/* Return the number of screen columns needed for WC. */ -#if @GNULIB_WCWIDTH@ -# if @REPLACE_WCWIDTH@ -# undef wcwidth -# define wcwidth rpl_wcwidth -extern int wcwidth (wchar_t); -# else -# if !defined wcwidth && !@HAVE_DECL_WCWIDTH@ -/* wcwidth exists but is not declared. */ -extern int wcwidth (int /* actually wchar_t */); -# endif -# endif -#elif defined GNULIB_POSIXCHECK -# undef wcwidth -# define wcwidth(w) \ - (GL_LINK_WARNING ("wcwidth is unportable - " \ - "use gnulib module wcwidth for portability"), \ - wcwidth (w)) -#endif - - -#ifdef __cplusplus -} -#endif - -#endif /* _GL_WCHAR_H */ -#endif /* _GL_WCHAR_H */ diff -ruNp m4-1.4.10/lib/wctype.in.h m4-1.4.11/lib/wctype.in.h --- m4-1.4.10/lib/wctype.in.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/lib/wctype.in.h 2007-12-01 13:55:38.000000000 -0700 @@ -0,0 +1,161 @@ +/* A substitute for ISO C99 <wctype.h>, for platforms that lack it. + + Copyright (C) 2006, 2007 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, 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, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Bruno Haible and Paul Eggert. */ + +/* + * ISO C 99 <wctype.h> for platforms that lack it. + * <http://www.opengroup.org/susv3xbd/wctype.h.html> + * + * iswctype, towctrans, towlower, towupper, wctrans, wctype, + * wctrans_t, and wctype_t are not yet implemented. + */ + +#ifndef _GL_WCTYPE_H + +#if @HAVE_WINT_T@ +/* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>. + Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before + <wchar.h>. + BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be + included before <wchar.h>. */ +# include <stddef.h> +# include <stdio.h> +# include <time.h> +# include <wchar.h> +#endif + +/* Include the original <wctype.h> if it exists. + BeOS 5 has the functions but no <wctype.h>. */ +/* The include_next requires a split double-inclusion guard. */ +#if @HAVE_WCTYPE_H@ +# @INCLUDE_NEXT@ @NEXT_WCTYPE_H@ +#endif + +#ifndef _GL_WCTYPE_H +#define _GL_WCTYPE_H + +#if @HAVE_WINT_T@ +typedef wint_t __wctype_wint_t; +#else +typedef int __wctype_wint_t; +#endif + +/* FreeBSD 4.4 to 4.11 has <wctype.h> but lacks the functions. + Assume all 12 functions are implemented the same way, or not at all. */ +#if ! @HAVE_ISWCNTRL@ + +/* IRIX 5.3 has macros but no functions, its isw* macros refer to an + undefined variable _ctmp_ and to <ctype.h> macros like _P, and they + refer to system functions like _iswctype that are not in the + standard C library. Rather than try to get ancient buggy + implementations like this to work, just disable them. */ +# undef iswalnum +# undef iswalpha +# undef iswblank +# undef iswcntrl +# undef iswdigit +# undef iswgraph +# undef iswlower +# undef iswprint +# undef iswpunct +# undef iswspace +# undef iswupper +# undef iswxdigit + +static inline int +iswalnum (__wctype_wint_t wc) +{ + return ((wc >= '0' && wc <= '9') + || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z')); +} + +static inline int +iswalpha (__wctype_wint_t wc) +{ + return (wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'; +} + +static inline int +iswblank (__wctype_wint_t wc) +{ + return wc == ' ' || wc == '\t'; +} + +static inline int +iswcntrl (__wctype_wint_t wc) +{ + return (wc & ~0x1f) == 0 || wc == 0x7f; +} + +static inline int +iswdigit (__wctype_wint_t wc) +{ + return wc >= '0' && wc <= '9'; +} + +static inline int +iswgraph (__wctype_wint_t wc) +{ + return wc >= '!' && wc <= '~'; +} + +static inline int +iswlower (__wctype_wint_t wc) +{ + return wc >= 'a' && wc <= 'z'; +} + +static inline int +iswprint (__wctype_wint_t wc) +{ + return wc >= ' ' && wc <= '~'; +} + +static inline int +iswpunct (__wctype_wint_t wc) +{ + return (wc >= '!' && wc <= '~' + && !((wc >= '0' && wc <= '9') + || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'))); +} + +static inline int +iswspace (__wctype_wint_t wc) +{ + return (wc == ' ' || wc == '\t' + || wc == '\n' || wc == '\v' || wc == '\f' || wc == '\r'); +} + +static inline int +iswupper (__wctype_wint_t wc) +{ + return wc >= 'A' && wc <= 'Z'; +} + +static inline int +iswxdigit (__wctype_wint_t wc) +{ + return ((wc >= '0' && wc <= '9') + || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F')); +} + +# endif /* ! HAVE_ISWCNTRL */ + +#endif /* _GL_WCTYPE_H */ +#endif /* _GL_WCTYPE_H */ diff -ruNp m4-1.4.10/lib/wctype_.h m4-1.4.11/lib/wctype_.h --- m4-1.4.10/lib/wctype_.h 2007-07-05 05:48:30.000000000 -0600 +++ m4-1.4.11/lib/wctype_.h 1969-12-31 17:00:00.000000000 -0700 @@ -1,161 +0,0 @@ -/* A substitute for ISO C99 <wctype.h>, for platforms that lack it. - - Copyright (C) 2006, 2007 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 2, 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -/* Written by Bruno Haible and Paul Eggert. */ - -/* - * ISO C 99 <wctype.h> for platforms that lack it. - * <http://www.opengroup.org/susv3xbd/wctype.h.html> - * - * iswctype, towctrans, towlower, towupper, wctrans, wctype, - * wctrans_t, and wctype_t are not yet implemented. - */ - -#ifndef _GL_WCTYPE_H - -#if @HAVE_WINT_T@ -/* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>. - Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before - <wchar.h>. - BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be - included before <wchar.h>. */ -# include <stddef.h> -# include <stdio.h> -# include <time.h> -# include <wchar.h> -#endif - -/* Include the original <wctype.h> if it exists. - BeOS 5 has the functions but no <wctype.h>. */ -/* The include_next requires a split double-inclusion guard. */ -#if @HAVE_WCTYPE_H@ -# @INCLUDE_NEXT@ @NEXT_WCTYPE_H@ -#endif - -#ifndef _GL_WCTYPE_H -#define _GL_WCTYPE_H - -#if @HAVE_WINT_T@ -typedef wint_t __wctype_wint_t; -#else -typedef int __wctype_wint_t; -#endif - -/* FreeBSD 4.4 to 4.11 has <wctype.h> but lacks the functions. - Assume all 12 functions are implemented the same way, or not at all. */ -#if ! @HAVE_ISWCNTRL@ - -/* IRIX 5.3 has macros but no functions, its isw* macros refer to an - undefined variable _ctmp_ and to <ctype.h> macros like _P, and they - refer to system functions like _iswctype that are not in the - standard C library. Rather than try to get ancient buggy - implementations like this to work, just disable them. */ -# undef iswalnum -# undef iswalpha -# undef iswblank -# undef iswcntrl -# undef iswdigit -# undef iswgraph -# undef iswlower -# undef iswprint -# undef iswpunct -# undef iswspace -# undef iswupper -# undef iswxdigit - -static inline int -iswalnum (__wctype_wint_t wc) -{ - return ((wc >= '0' && wc <= '9') - || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z')); -} - -static inline int -iswalpha (__wctype_wint_t wc) -{ - return (wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'; -} - -static inline int -iswblank (__wctype_wint_t wc) -{ - return wc == ' ' || wc == '\t'; -} - -static inline int -iswcntrl (__wctype_wint_t wc) -{ - return (wc & ~0x1f) == 0 || wc == 0x7f; -} - -static inline int -iswdigit (__wctype_wint_t wc) -{ - return wc >= '0' && wc <= '9'; -} - -static inline int -iswgraph (__wctype_wint_t wc) -{ - return wc >= '!' && wc <= '~'; -} - -static inline int -iswlower (__wctype_wint_t wc) -{ - return wc >= 'a' && wc <= 'z'; -} - -static inline int -iswprint (__wctype_wint_t wc) -{ - return wc >= ' ' && wc <= '~'; -} - -static inline int -iswpunct (__wctype_wint_t wc) -{ - return (wc >= '!' && wc <= '~' - && !((wc >= '0' && wc <= '9') - || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'))); -} - -static inline int -iswspace (__wctype_wint_t wc) -{ - return (wc == ' ' || wc == '\t' - || wc == '\n' || wc == '\v' || wc == '\f' || wc == '\r'); -} - -static inline int -iswupper (__wctype_wint_t wc) -{ - return wc >= 'A' && wc <= 'Z'; -} - -static inline int -iswxdigit (__wctype_wint_t wc) -{ - return ((wc >= '0' && wc <= '9') - || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F')); -} - -# endif /* ! HAVE_ISWCNTRL */ - -#endif /* _GL_WCTYPE_H */ -#endif /* _GL_WCTYPE_H */ diff -ruNp m4-1.4.10/lib/xalloc-die.c m4-1.4.11/lib/xalloc-die.c --- m4-1.4.10/lib/xalloc-die.c 2007-05-30 19:30:44.000000000 -0600 +++ m4-1.4.11/lib/xalloc-die.c 2007-10-09 06:16:46.000000000 -0600 @@ -3,10 +3,10 @@ Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2006 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -14,8 +14,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> diff -ruNp m4-1.4.10/lib/xalloc.h m4-1.4.11/lib/xalloc.h --- m4-1.4.10/lib/xalloc.h 2007-05-30 19:30:45.000000000 -0600 +++ m4-1.4.11/lib/xalloc.h 2008-01-14 22:04:42.000000000 -0700 @@ -1,12 +1,12 @@ /* xalloc.h -- malloc with out-of-memory checking Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2003, 2004, 2006, 2007 Free Software Foundation, Inc. + 1999, 2000, 2003, 2004, 2006, 2007, 2008 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -14,8 +14,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef XALLOC_H_ # define XALLOC_H_ @@ -29,7 +28,7 @@ extern "C" { # ifndef __attribute__ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__ +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) # define __attribute__(x) # endif # endif diff -ruNp m4-1.4.10/lib/xasprintf.c m4-1.4.11/lib/xasprintf.c --- m4-1.4.10/lib/xasprintf.c 2007-05-30 19:30:45.000000000 -0600 +++ m4-1.4.11/lib/xasprintf.c 2007-10-09 06:16:47.000000000 -0600 @@ -1,19 +1,18 @@ /* vasprintf and asprintf with out-of-memory checking. Copyright (C) 1999, 2002-2004, 2006 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> diff -ruNp m4-1.4.10/lib/xmalloc.c m4-1.4.11/lib/xmalloc.c --- m4-1.4.10/lib/xmalloc.c 2007-05-30 19:30:46.000000000 -0600 +++ m4-1.4.11/lib/xmalloc.c 2007-10-09 06:16:47.000000000 -0600 @@ -4,10 +4,10 @@ 1999, 2000, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -15,8 +15,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> diff -ruNp m4-1.4.10/lib/xmalloca.c m4-1.4.11/lib/xmalloca.c --- m4-1.4.10/lib/xmalloca.c 2007-07-04 22:02:40.000000000 -0600 +++ m4-1.4.11/lib/xmalloca.c 2008-01-03 21:46:37.000000000 -0700 @@ -2,10 +2,10 @@ Copyright (C) 2003, 2006-2007 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -13,8 +13,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> @@ -23,6 +22,8 @@ #include "xalloc.h" +#if HAVE_ALLOCA + void * xmmalloca (size_t n) { @@ -33,3 +34,5 @@ xmmalloca (size_t n) xalloc_die (); return p; } + +#endif diff -ruNp m4-1.4.10/lib/xmalloca.h m4-1.4.11/lib/xmalloca.h --- m4-1.4.10/lib/xmalloca.h 2007-07-04 22:02:41.000000000 -0600 +++ m4-1.4.11/lib/xmalloca.h 2008-01-03 21:46:38.000000000 -0700 @@ -2,10 +2,10 @@ Copyright (C) 2003, 2005, 2007 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -13,13 +13,13 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _XMALLOCA_H #define _XMALLOCA_H #include "malloca.h" +#include "xalloc.h" #ifdef __cplusplus @@ -28,7 +28,7 @@ extern "C" { /* xmalloca(N) is a checking safe variant of alloca(N). It allocates N bytes - of memory allocated on the stack, that must be freed using freesa() before + of memory allocated on the stack, that must be freed using freea() before the function returns. Upon failure, it exits with an error message. */ #if HAVE_ALLOCA # define xmalloca(N) \ @@ -41,9 +41,19 @@ extern void * xmmalloca (size_t n); xmalloc (N) #endif -/* Maybe we should also define a variant - xnmalloca (size_t n, size_t s) - behaves like xmalloca (n * s) - If this would be useful in your application. please speak up. */ +/* xnmalloca(N,S) is an overflow-safe variant of xmalloca (N * S). + It allocates an array of N objects, each with S bytes of memory, + on the stack. S must be positive and N must be nonnegative. + The array must be freed using freea() before the function returns. + Upon failure, it exits with an error message. */ +#if HAVE_ALLOCA +/* Rely on xmalloca (SIZE_MAX) calling xalloc_die (). */ +# define xnmalloca(n, s) \ + xmalloca (xalloc_oversized ((n), (s)) ? (size_t) (-1) : (n) * (s)) +#else +# define xnmalloca(n, s) \ + xnmalloc ((n), (s)) +#endif #ifdef __cplusplus diff -ruNp m4-1.4.10/lib/xprintf.c m4-1.4.11/lib/xprintf.c --- m4-1.4.10/lib/xprintf.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/lib/xprintf.c 2007-10-26 21:16:12.000000000 -0600 @@ -0,0 +1,79 @@ +/* printf wrappers that fail immediately for non-file-related errors + Copyright (C) 2007 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/>. */ + +#include <config.h> + +#include "xprintf.h" + +#include <errno.h> + +#include "error.h" +#include "exitfail.h" +#include "gettext.h" + +/* written by Jim Meyering */ + +/* Just like printf, but call error if it fails without setting the + stream's error indicator. */ +int +xprintf (char const *restrict format, ...) +{ + va_list args; + int retval; + va_start (args, format); + retval = xvprintf (format, args); + va_end (args); + + return retval; +} + +/* Just like vprintf, but call error if it fails without setting the + stream's error indicator. */ +int +xvprintf (char const *restrict format, va_list args) +{ + int retval = vprintf (format, args); + if (retval < 0 && ! ferror (stdout)) + error (exit_failure, errno, gettext ("cannot perform formatted output")); + + return retval; +} + +/* Just like fprintf, but call error if it fails without setting the + stream's error indicator. */ +int +xfprintf (FILE *restrict stream, char const *restrict format, ...) +{ + va_list args; + int retval; + va_start (args, format); + retval = xvfprintf (stream, format, args); + va_end (args); + + return retval; +} + +/* Just like vfprintf, but call error if it fails without setting the + stream's error indicator. */ +int +xvfprintf (FILE *restrict stream, char const *restrict format, va_list args) +{ + int retval = vfprintf (stream, format, args); + if (retval < 0 && ! ferror (stream)) + error (exit_failure, errno, gettext ("cannot perform formatted output")); + + return retval; +} diff -ruNp m4-1.4.10/lib/xprintf.h m4-1.4.11/lib/xprintf.h --- m4-1.4.10/lib/xprintf.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/lib/xprintf.h 2008-01-14 22:04:43.000000000 -0700 @@ -0,0 +1,46 @@ +/* printf wrappers that fail immediately for non-file-related errors + Copyright (C) 2007-2008 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/>. */ + +#ifndef _XPRINTF_H +#define _XPRINTF_H + +#include <stdarg.h> +#include <stdio.h> + +#ifndef __attribute__ +/* This feature is available in gcc versions 2.5 and later. */ +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) +# define __attribute__(Spec) /* empty */ +# endif +/* The __-protected variants of `format' and `printf' attributes + are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */ +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) +# define __format__ format +# define __printf__ printf +# endif +#endif + +extern int xprintf (char const *restrict format, ...) + __attribute__ ((__format__ (__printf__, 1, 2))); +extern int xvprintf (char const *restrict format, va_list args) + __attribute__ ((__format__ (__printf__, 1, 0))); +extern int xfprintf (FILE *restrict stream, char const *restrict format, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); +extern int xvfprintf (FILE *restrict stream, char const *restrict format, + va_list args) + __attribute__ ((__format__ (__printf__, 2, 0))); + +#endif diff -ruNp m4-1.4.10/lib/xsize.h m4-1.4.11/lib/xsize.h --- m4-1.4.10/lib/xsize.h 2007-05-30 19:30:46.000000000 -0600 +++ m4-1.4.11/lib/xsize.h 2008-03-01 09:05:55.000000000 -0700 @@ -1,10 +1,10 @@ /* xsize.h -- Checked size_t computations. - Copyright (C) 2003 Free Software Foundation, Inc. + Copyright (C) 2003, 2008 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 2, or (at your option) + the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -94,7 +94,7 @@ xmax (size_t size1, size_t size2) /* Multiplication of a count with an element size, with overflow check. The count must be >= 0 and the element size must be > 0. This is a macro, not an inline function, so that it works correctly even - when N is of a wider tupe and N > SIZE_MAX. */ + when N is of a wider type and N > SIZE_MAX. */ #define xtimes(N, ELSIZE) \ ((N) <= SIZE_MAX / (ELSIZE) ? (size_t) (N) * (ELSIZE) : SIZE_MAX) diff -ruNp m4-1.4.10/lib/xvasprintf.c m4-1.4.11/lib/xvasprintf.c --- m4-1.4.10/lib/xvasprintf.c 2007-05-30 19:30:46.000000000 -0600 +++ m4-1.4.11/lib/xvasprintf.c 2008-03-30 16:07:19.000000000 -0600 @@ -1,19 +1,18 @@ /* vasprintf and asprintf with out-of-memory checking. - Copyright (C) 1999, 2002-2004, 2006, 2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002-2004, 2006-2008 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> @@ -30,11 +29,6 @@ /* Checked size_t computations. */ #include "xsize.h" -/* Some systems, like OSF/1 4.0 and Woe32, don't have EOVERFLOW. */ -#ifndef EOVERFLOW -# define EOVERFLOW E2BIG -#endif - static inline char * xstrcat (size_t argcount, va_list args) { diff -ruNp m4-1.4.10/lib/xvasprintf.h m4-1.4.11/lib/xvasprintf.h --- m4-1.4.10/lib/xvasprintf.h 2007-05-30 19:30:46.000000000 -0600 +++ m4-1.4.11/lib/xvasprintf.h 2008-01-14 22:04:43.000000000 -0700 @@ -1,19 +1,18 @@ /* vasprintf and asprintf with out-of-memory checking. - Copyright (C) 2002-2004, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002-2004, 2006-2008 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _XVASPRINTF_H #define _XVASPRINTF_H @@ -23,7 +22,7 @@ #ifndef __attribute__ /* This feature is available in gcc versions 2.5 and later. */ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__ +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) # define __attribute__(Spec) /* empty */ # endif /* The __-protected variants of `format' and `printf' attributes diff -ruNp m4-1.4.10/local/doc/gpl-3.0.texi.diff m4-1.4.11/local/doc/gpl-3.0.texi.diff --- m4-1.4.10/local/doc/gpl-3.0.texi.diff 2007-07-05 05:45:22.000000000 -0600 +++ m4-1.4.11/local/doc/gpl-3.0.texi.diff 1969-12-31 17:00:00.000000000 -0700 @@ -1,36 +0,0 @@ ---- ../gnulib/doc/gpl-3.0.texi 2007-07-04 11:50:35.890625000 -0600 -+++ doc/gpl-3.0.texi 2007-07-04 20:58:11.468750000 -0600 -@@ -1,5 +1,5 @@ - @node Copying --@unnumbered GNU General Public License -+@appendixsec GNU General Public License - @center Version 3, 29 June 2007 - - @c This file is intended to be included in another file. -@@ -222,7 +222,7 @@ - conditions: - - @enumerate a --@item -+@item - The work must carry prominent notices stating that you modified it, - and giving a relevant date. - -@@ -670,7 +670,7 @@ - the ``copyright'' line and a pointer to where the full notice is found. - - @smallexample --@var{one line to give the program's name and a brief idea of what it does.} -+@var{one line to give the program's name and a brief idea of what it does.} - Copyright (C) @var{year} @var{name of author} - - This program is free software: you can redistribute it and/or modify -@@ -693,7 +693,7 @@ - notice like this when it starts in an interactive mode: - - @smallexample --@var{program} Copyright (C) @var{year} @var{name of author} -+@var{program} Copyright (C) @var{year} @var{name of author} - This program comes with ABSOLUTELY NO WARRANTY; for details type @samp{show w}. - This is free software, and you are welcome to redistribute it - under certain conditions; type @samp{show c} for details. diff -ruNp m4-1.4.10/local/lib/version-etc.c.diff m4-1.4.11/local/lib/version-etc.c.diff --- m4-1.4.10/local/lib/version-etc.c.diff 2007-07-05 05:45:23.000000000 -0600 +++ m4-1.4.11/local/lib/version-etc.c.diff 1969-12-31 17:00:00.000000000 -0700 @@ -1,20 +0,0 @@ ---- ../gnulib/lib/version-etc.c 2007-03-24 07:08:51.698250000 -0600 -+++ lib/version-etc.c 2007-07-04 20:26:39.296875000 -0600 -@@ -3,7 +3,7 @@ - - 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 2, or (at your option) -+ the Free Software Foundation; either version 3, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, -@@ -67,7 +67,7 @@ - - fputs (_("\ - \n\ --License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>\n\ -+License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n\ - This is free software: you are free to change and redistribute it.\n\ - There is NO WARRANTY, to the extent permitted by law.\n\ - \n\ diff -ruNp m4-1.4.10/m4/alloca.m4 m4-1.4.11/m4/alloca.m4 --- m4-1.4.10/m4/alloca.m4 2007-05-30 19:30:47.000000000 -0600 +++ m4-1.4.11/m4/alloca.m4 2008-01-14 22:04:43.000000000 -0700 @@ -1,5 +1,5 @@ -# alloca.m4 serial 7 -dnl Copyright (C) 2002-2004, 2006 Free Software Foundation, Inc. +# alloca.m4 serial 8 +dnl Copyright (C) 2002-2004, 2006, 2007 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -39,10 +39,6 @@ AC_DEFUN([gl_FUNC_ALLOCA], ALLOCA_H=alloca.h fi AC_SUBST([ALLOCA_H]) - - AC_DEFINE(HAVE_ALLOCA_H, 1, - [Define HAVE_ALLOCA_H for backward compatibility with older code - that includes <alloca.h> only if HAVE_ALLOCA_H is defined.]) ]) # Prerequisites of lib/alloca.c. diff -ruNp m4-1.4.10/m4/extensions.m4 m4-1.4.11/m4/extensions.m4 --- m4-1.4.10/m4/extensions.m4 2007-05-30 19:30:49.000000000 -0600 +++ m4-1.4.11/m4/extensions.m4 2007-10-09 06:16:50.000000000 -0600 @@ -1,14 +1,14 @@ -# serial 4 -*- Autoconf -*- +# serial 5 -*- Autoconf -*- # Enable extensions on systems that normally disable them. -# Copyright (C) 2003, 2006 Free Software Foundation, Inc. +# Copyright (C) 2003, 2006, 2007 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from CVS # Autoconf. Perhaps we can remove this once we can assume Autoconf -# 2.61 or later everywhere, but since CVS Autoconf mutates rapidly +# 2.62 or later everywhere, but since CVS Autoconf mutates rapidly # enough in this area it's likely we'll need to redefine # AC_USE_SYSTEM_EXTENSIONS for quite some time. @@ -16,26 +16,48 @@ # ------------------------ # Enable extensions on systems that normally disable them, # typically due to standards-conformance issues. +# Remember that #undef in AH_VERBATIM gets replaced with #define by +# AC_DEFINE. The goal here is to define all known feature-enabling +# macros, then, if reports of conflicts are made, disable macros that +# cause problems on some platforms (such as __EXTENSIONS__). AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS], -[ - AC_BEFORE([$0], [AC_COMPILE_IFELSE]) - AC_BEFORE([$0], [AC_RUN_IFELSE]) - - AC_REQUIRE([AC_GNU_SOURCE]) - AC_REQUIRE([AC_AIX]) - AC_REQUIRE([AC_MINIX]) +[AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl +AC_BEFORE([$0], [AC_RUN_IFELSE])dnl + + AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=]) + if test "$MINIX" = yes; then + AC_DEFINE([_POSIX_SOURCE], [1], + [Define to 1 if you need to in order for `stat' and other + things to work.]) + AC_DEFINE([_POSIX_1_SOURCE], [2], + [Define to 2 if the system does not provide POSIX.1 features + except with this defined.]) + AC_DEFINE([_MINIX], [1], + [Define to 1 if on MINIX.]) + fi AH_VERBATIM([__EXTENSIONS__], -[/* Enable extensions on Solaris. */ -#ifndef __EXTENSIONS__ -# undef __EXTENSIONS__ +[/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE #endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# undef _GNU_SOURCE +#endif +/* Enable threading extensions on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # undef _POSIX_PTHREAD_SEMANTICS #endif +/* Enable extensions on HP NonStop. */ #ifndef _TANDEM_SOURCE # undef _TANDEM_SOURCE -#endif]) +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# undef __EXTENSIONS__ +#endif +]) AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__], [ac_cv_safe_to_define___extensions__], [AC_COMPILE_IFELSE( @@ -46,9 +68,11 @@ AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS], [ac_cv_safe_to_define___extensions__=no])]) test $ac_cv_safe_to_define___extensions__ = yes && AC_DEFINE([__EXTENSIONS__]) + AC_DEFINE([_ALL_SOURCE]) + AC_DEFINE([_GNU_SOURCE]) AC_DEFINE([_POSIX_PTHREAD_SEMANTICS]) AC_DEFINE([_TANDEM_SOURCE]) -]) +])# AC_USE_SYSTEM_EXTENSIONS # gl_USE_SYSTEM_EXTENSIONS # ------------------------ diff -ruNp m4-1.4.10/m4/fflush.m4 m4-1.4.11/m4/fflush.m4 --- m4-1.4.10/m4/fflush.m4 2007-05-30 19:30:49.000000000 -0600 +++ m4-1.4.11/m4/fflush.m4 2008-03-29 07:26:41.000000000 -0600 @@ -1,6 +1,6 @@ -# fflush.m4 serial 4 +# fflush.m4 serial 5 -# Copyright (C) 2007 Free Software Foundation, Inc. +# Copyright (C) 2007-2008 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -21,8 +21,11 @@ AC_DEFUN([gl_FUNC_FFLUSH], #include <unistd.h> ]], [[FILE *f = fopen ("conftest.txt", "r"); char buffer[10]; - int fd = fileno (f); - if (!f || 0 > fd || fread (buffer, 1, 5, f) != 5) + int fd; + if (f == NULL) + return 1; + fd = fileno (f); + if (fd < 0 || fread (buffer, 1, 5, f) != 5) return 2; /* For deterministic results, ensure f read a bigger buffer. */ if (lseek (fd, 0, SEEK_CUR) == 5) @@ -30,7 +33,11 @@ AC_DEFUN([gl_FUNC_FFLUSH], /* POSIX requires fflush-fseek to set file offset of fd. */ if (fflush (f) != 0 || fseek (f, 0, SEEK_CUR) != 0) return 4; - return !(lseek (fd, 0, SEEK_CUR) == 5); + if (lseek (fd, 0, SEEK_CUR) != 5) + return 5; + /* TODO: Verify behaviour of fflush after ungetc, see + <http://lists.gnu.org/archive/html/bug-gnulib/2008-03/msg00131.html>. */ + return 0; ]])], [gl_cv_func_fflush_stdin=yes], [gl_cv_func_fflush_stdin=no], [dnl Pessimistically assume fflush is broken. This is wrong for dnl at least glibc and cygwin; but lib/fflush.c takes this into account. diff -ruNp m4-1.4.10/m4/float_h.m4 m4-1.4.11/m4/float_h.m4 --- m4-1.4.10/m4/float_h.m4 2007-07-05 05:48:34.000000000 -0600 +++ m4-1.4.11/m4/float_h.m4 2007-12-11 19:26:07.000000000 -0700 @@ -1,4 +1,4 @@ -# float_h.m4 serial 2 +# float_h.m4 serial 3 dnl Copyright (C) 2007 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -10,7 +10,7 @@ AC_DEFUN([gl_FLOAT_H], AC_REQUIRE([AC_CANONICAL_HOST]) FLOAT_H= case "$host_os" in - beos*) + beos* | openbsd*) FLOAT_H=float.h gl_CHECK_NEXT_HEADERS([float.h]) ;; diff -ruNp m4-1.4.10/m4/fpending.m4 m4-1.4.11/m4/fpending.m4 --- m4-1.4.10/m4/fpending.m4 2007-05-30 19:30:50.000000000 -0600 +++ m4-1.4.11/m4/fpending.m4 2007-11-10 16:24:23.000000000 -0700 @@ -1,6 +1,7 @@ -#serial 10 +#serial 12 -# Copyright (C) 2000, 2001, 2004, 2005, 2006 Free Software Foundation, Inc. +# Copyright (C) 2000, 2001, 2004, 2005, 2006, 2007 Free Software +# Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -16,7 +17,7 @@ dnl we have to grub around in the FILE s AC_DEFUN([gl_FUNC_FPENDING], [ AC_CHECK_HEADERS_ONCE(stdio_ext.h) - AC_REPLACE_FUNCS([__fpending]) + AC_CHECK_FUNCS_ONCE([__fpending]) fp_headers=' # include <stdio.h> # if HAVE_STDIO_EXT_H @@ -29,31 +30,34 @@ AC_DEFUN([gl_FUNC_FPENDING], [how to determine the number of pending output bytes on a stream], ac_cv_sys_pending_output_n_bytes, [ - for ac_expr in \ - \ - '# glibc2' \ - 'fp->_IO_write_ptr - fp->_IO_write_base' \ - \ - '# traditional Unix' \ - 'fp->_ptr - fp->_base' \ - \ - '# BSD' \ - 'fp->_p - fp->_bf._base' \ - \ - '# SCO, Unixware' \ - '(fp->__ptr ? fp->__ptr - fp->__base : 0)' \ - \ - '# old glibc?' \ - 'fp->__bufp - fp->__buffer' \ - \ - '# old glibc iostream?' \ - 'fp->_pptr - fp->_pbase' \ - \ - '# VMS' \ - '(*fp)->_ptr - (*fp)->_base' \ - \ - '# e.g., DGUX R4.11; the info is not available' \ - 1 \ + for ac_expr in \ + \ + '# glibc2' \ + 'fp->_IO_write_ptr - fp->_IO_write_base' \ + \ + '# traditional Unix' \ + 'fp->_ptr - fp->_base' \ + \ + '# BSD' \ + 'fp->_p - fp->_bf._base' \ + \ + '# SCO, Unixware' \ + '(fp->__ptr ? fp->__ptr - fp->__base : 0)' \ + \ + '# QNX' \ + '(fp->_Mode & 0x2000 /*_MWRITE*/ ? fp->_Next - fp->_Buf : 0)' \ + \ + '# old glibc?' \ + 'fp->__bufp - fp->__buffer' \ + \ + '# old glibc iostream?' \ + 'fp->_pptr - fp->_pbase' \ + \ + '# VMS' \ + '(*fp)->_ptr - (*fp)->_base' \ + \ + '# e.g., DGUX R4.11; the info is not available' \ + 1 \ ; do # Skip each embedded comment. @@ -74,5 +78,6 @@ AC_DEFUN([gl_FUNC_FPENDING], AC_DEFINE_UNQUOTED(PENDING_OUTPUT_N_BYTES, $ac_cv_sys_pending_output_n_bytes, [the number of pending output bytes on stream `fp']) + AC_LIBOBJ([fpending]) fi ]) diff -ruNp m4-1.4.10/m4/free.m4 m4-1.4.11/m4/free.m4 --- m4-1.4.10/m4/free.m4 2007-05-30 19:30:50.000000000 -0600 +++ m4-1.4.11/m4/free.m4 1969-12-31 17:00:00.000000000 -0700 @@ -1,40 +0,0 @@ -# Check whether free (NULL) is supposed to work. - -# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# Written by Paul Eggert. - -# We can't test for free (NULL) even at runtime, since it might -# happen to "work" for our test program, but not in general. So, be -# conservative and use feature tests for relatively modern hosts, -# where free (NULL) is known to work. This costs a bit of -# performance on some older hosts, but we can fix that later if -# needed. - -AC_DEFUN([gl_FUNC_FREE], -[ - AC_CACHE_CHECK([whether free (NULL) is known to work], - [gl_cv_func_free], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[@%:@include <unistd.h>]], - [[@%:@if _POSIX_VERSION < 199009L && \ - (defined unix || defined _unix || defined _unix_ \ - || defined __unix || defined __unix__) - @%:@error "'free (NULL)' is not known to work" - @%:@endif]])], - [gl_cv_func_free=yes], - [gl_cv_func_free=no])]) - - if test $gl_cv_func_free = no; then - AC_LIBOBJ(free) - AC_DEFINE(free, rpl_free, - [Define to rpl_free if the replacement function should be used.]) - fi -]) - -# Prerequisites of lib/free.c. -AC_DEFUN([gl_PREREQ_FREE], [:]) diff -ruNp m4-1.4.10/m4/frexp.m4 m4-1.4.11/m4/frexp.m4 --- m4-1.4.10/m4/frexp.m4 2007-05-30 19:30:51.000000000 -0600 +++ m4-1.4.11/m4/frexp.m4 2007-12-11 19:26:08.000000000 -0700 @@ -1,4 +1,4 @@ -# frexp.m4 serial 3 +# frexp.m4 serial 5 dnl Copyright (C) 2007 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -56,8 +56,39 @@ AC_DEFUN([gl_FUNC_FREXP], AC_SUBST([FREXP_LIBM]) ]) +AC_DEFUN([gl_FUNC_FREXP_NO_LIBM], +[ + AC_REQUIRE([gl_MATH_H_DEFAULTS]) + AC_CACHE_CHECK([whether frexp() can be used without linking with libm], + [gl_cv_func_frexp_no_libm], + [ + AC_TRY_LINK([#include <math.h> + double x;], + [int e; return frexp (x, &e) > 0;], + [gl_cv_func_frexp_no_libm=yes], + [gl_cv_func_frexp_no_libm=no]) + ]) + if test $gl_cv_func_frexp_no_libm = yes; then + gl_FUNC_FREXP_WORKS + case "$gl_cv_func_frexp_works" in + *yes) gl_func_frexp_no_libm=yes ;; + *) gl_func_frexp_no_libm=no; REPLACE_FREXP=1 ;; + esac + else + gl_func_frexp_no_libm=no + dnl Set REPLACE_FREXP here because the system may have frexp in libm. + REPLACE_FREXP=1 + fi + if test $gl_func_frexp_no_libm = yes; then + AC_DEFINE([HAVE_FREXP_IN_LIBC], 1, + [Define if the frexp() function is available in libc.]) + else + AC_LIBOBJ([frexp]) + fi +]) + dnl Test whether frexp() works also on denormalized numbers (this fails e.g. on -dnl NetBSD 3.0) and on infinite numbers (this fails e.g. on IRIX 6.5). +dnl NetBSD 3.0) and on infinite numbers (this fails e.g. on IRIX 6.5 and mingw). AC_DEFUN([gl_FUNC_FREXP_WORKS], [ AC_REQUIRE([AC_PROG_CC]) @@ -94,8 +125,8 @@ int main() return 0; }], [gl_cv_func_frexp_works=yes], [gl_cv_func_frexp_works=no], [case "$host_os" in - netbsd* | irix*) gl_cv_func_frexp_works="guessing no";; - *) gl_cv_func_frexp_works="guessing yes";; + netbsd* | irix* | mingw*) gl_cv_func_frexp_works="guessing no";; + *) gl_cv_func_frexp_works="guessing yes";; esac ]) ]) diff -ruNp m4-1.4.10/m4/frexpl.m4 m4-1.4.11/m4/frexpl.m4 --- m4-1.4.10/m4/frexpl.m4 2007-07-05 05:48:36.000000000 -0600 +++ m4-1.4.11/m4/frexpl.m4 2008-02-07 22:02:40.000000000 -0700 @@ -1,5 +1,5 @@ -# frexpl.m4 serial 6 -dnl Copyright (C) 2007 Free Software Foundation, Inc. +# frexpl.m4 serial 8 +dnl Copyright (C) 2007-2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -96,8 +96,9 @@ AC_DEFUN([gl_FUNC_FREXPL_NO_LIBM], ]) dnl Test whether frexpl() works on finite numbers (this fails on -dnl MacOS X 10.4/PowerPC, on AIX 5.1, and on BeOS) and also on infinite numbers -dnl (this fails e.g. on IRIX 6.5 and mingw). +dnl MacOS X 10.4/PowerPC, on AIX 5.1, and on BeOS), on denormalized numbers +dnl (this fails on MacOS X 10.5/i386), and also on infinite numbers (this +dnl fails e.g. on IRIX 6.5 and mingw). AC_DEFUN([gl_FUNC_FREXPL_WORKS], [ AC_REQUIRE([AC_PROG_CC]) @@ -105,7 +106,13 @@ AC_DEFUN([gl_FUNC_FREXPL_WORKS], AC_CACHE_CHECK([whether frexpl works], [gl_cv_func_frexpl_works], [ AC_TRY_RUN([ +#include <float.h> #include <math.h> +/* Override the values of <float.h>, like done in float.in.h. */ +#if defined __i386__ && (defined __BEOS__ || defined __OpenBSD__) +# undef LDBL_MIN_EXP +# define LDBL_MIN_EXP (-16381) +#endif extern long double frexpl (long double, int *); int main() { @@ -144,6 +151,21 @@ int main() return 1; } } + /* Test on denormalized numbers. */ + { + int i; + for (i = 1, x = 1.0L; i >= LDBL_MIN_EXP; i--, x *= 0.5L) + ; + if (x > 0.0L) + { + int exp; + long double y = frexpl (x, &exp); + /* On machines with IEEE854 arithmetic: x = 1.68105e-4932, + exp = -16382, y = 0.5. On MacOS X 10.5: exp = -16384, y = 0.5. */ + if (exp != LDBL_MIN_EXP - 1) + return 1; + } + } /* Test on infinite numbers. */ x = 1.0L / 0.0L; { diff -ruNp m4-1.4.10/m4/fseeko.m4 m4-1.4.11/m4/fseeko.m4 --- m4-1.4.10/m4/fseeko.m4 2007-05-30 19:30:51.000000000 -0600 +++ m4-1.4.11/m4/fseeko.m4 2008-03-10 20:11:46.000000000 -0600 @@ -1,5 +1,5 @@ -# fseeko.m4 serial 3 -dnl Copyright (C) 2007 Free Software Foundation, Inc. +# fseeko.m4 serial 4 +dnl Copyright (C) 2007-2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -9,6 +9,10 @@ AC_DEFUN([gl_FUNC_FSEEKO], AC_REQUIRE([gl_STDIO_H_DEFAULTS]) AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([gl_STDIN_LARGE_OFFSET]) + + dnl Persuade glibc <stdio.h> to declare fseeko(). + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + AC_CACHE_CHECK([for fseeko], [gl_cv_func_fseeko], [ AC_TRY_LINK([#include <stdio.h>], [fseeko (stdin, 0, 0);], diff -ruNp m4-1.4.10/m4/ftello.m4 m4-1.4.11/m4/ftello.m4 --- m4-1.4.10/m4/ftello.m4 2007-05-30 19:30:51.000000000 -0600 +++ m4-1.4.11/m4/ftello.m4 2008-03-10 20:11:46.000000000 -0600 @@ -1,5 +1,5 @@ -# ftello.m4 serial 3 -dnl Copyright (C) 2007 Free Software Foundation, Inc. +# ftello.m4 serial 4 +dnl Copyright (C) 2007, 2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -9,6 +9,10 @@ AC_DEFUN([gl_FUNC_FTELLO], AC_REQUIRE([gl_STDIO_H_DEFAULTS]) AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([gl_STDIN_LARGE_OFFSET]) + + dnl Persuade glibc <stdio.h> to declare fseeko(). + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + AC_CACHE_CHECK([for ftello], [gl_cv_func_ftello], [ AC_TRY_LINK([#include <stdio.h>], [ftello (stdin);], diff -ruNp m4-1.4.10/m4/gnulib-cache.m4 m4-1.4.11/m4/gnulib-cache.m4 --- m4-1.4.10/m4/gnulib-cache.m4 2007-07-05 05:45:51.000000000 -0600 +++ m4-1.4.11/m4/gnulib-cache.m4 2008-04-01 18:56:19.000000000 -0600 @@ -1,4 +1,4 @@ -# Copyright (C) 2004-2007 Free Software Foundation, Inc. +# Copyright (C) 2002-2008 Free Software Foundation, Inc. # # This file is free software, distributed under the terms of the GNU # General Public License. As a special exception to the GNU General @@ -15,17 +15,19 @@ # Specification in the form of a command-line invocation: -# gnulib-tool --import --dir=. --local-dir=local --lib=libm4 --source-base=lib --m4-base=m4 --doc-base=doc --aux-dir=. --with-tests --no-libtool --macro-prefix=M4 assert avltree-oset binary-io clean-temp cloexec close-stream closein config-h error fdl fflush fopen-safer free fseeko gendocs getopt gnupload gpl-3.0 mkstemp obstack regex stdbool stdint stdlib-safer strtol unlocked-io vasprintf-posix verror version-etc version-etc-fsf xalloc xvasprintf +# gnulib-tool --import --dir=. --local-dir=local --lib=libm4 --source-base=lib --m4-base=m4 --doc-base=doc --aux-dir=build-aux --with-tests --no-libtool --macro-prefix=M4 announce-gen assert avltree-oset binary-io clean-temp cloexec close-stream closein config-h error fdl fflush fopen-safer fseeko gendocs getopt git-version-gen gnumakefile gnupload gpl-3.0 intprops mkstemp obstack regex stdbool stdint stdlib-safer strstr strtod strtol unlocked-io verror version-etc version-etc-fsf xalloc xprintf xvasprintf-posix # Specification in the form of a few gnulib-tool.m4 macro invocations: gl_LOCAL_DIR([local]) -gl_MODULES([assert avltree-oset binary-io clean-temp cloexec close-stream closein config-h error fdl fflush fopen-safer free fseeko gendocs getopt gnupload gpl-3.0 mkstemp obstack regex stdbool stdint stdlib-safer strtol unlocked-io vasprintf-posix verror version-etc version-etc-fsf xalloc xvasprintf]) +gl_MODULES([announce-gen assert avltree-oset binary-io clean-temp cloexec close-stream closein config-h error fdl fflush fopen-safer fseeko gendocs getopt git-version-gen gnumakefile gnupload gpl-3.0 intprops mkstemp obstack regex stdbool stdint stdlib-safer strstr strtod strtol unlocked-io verror version-etc version-etc-fsf xalloc xprintf xvasprintf-posix]) gl_AVOID([]) gl_SOURCE_BASE([lib]) gl_M4_BASE([m4]) +gl_PO_BASE([]) gl_DOC_BASE([doc]) gl_TESTS_BASE([tests]) gl_WITH_TESTS gl_LIB([libm4]) gl_MAKEFILE_NAME([]) gl_MACRO_PREFIX([M4]) +gl_PO_DOMAIN([]) diff -ruNp m4-1.4.10/m4/gnulib-common.m4 m4-1.4.11/m4/gnulib-common.m4 --- m4-1.4.10/m4/gnulib-common.m4 2007-05-30 19:30:52.000000000 -0600 +++ m4-1.4.11/m4/gnulib-common.m4 2007-10-26 21:16:16.000000000 -0600 @@ -1,4 +1,4 @@ -# gnulib-common.m4 serial 2 +# gnulib-common.m4 serial 3 dnl Copyright (C) 2007 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -20,3 +20,46 @@ m4_ifdef([AC_PROG_MKDIR_P], [], [ [AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake MKDIR_P='$(mkdir_p)' AC_SUBST([MKDIR_P])])]) + +# AC_C_RESTRICT +# This definition overrides the AC_C_RESTRICT macro from autoconf 2.60..2.61, +# so that mixed use of GNU C and GNU C++ and mixed use of Sun C and Sun C++ +# works. +# This definition can be removed once autoconf >= 2.62 can be assumed. +AC_DEFUN([AC_C_RESTRICT], +[AC_CACHE_CHECK([for C/C++ restrict keyword], ac_cv_c_restrict, + [ac_cv_c_restrict=no + # The order here caters to the fact that C++ does not require restrict. + for ac_kw in __restrict __restrict__ _Restrict restrict; do + AC_COMPILE_IFELSE([AC_LANG_PROGRAM( + [[typedef int * int_ptr; + int foo (int_ptr $ac_kw ip) { + return ip[0]; + }]], + [[int s[1]; + int * $ac_kw t = s; + t[0] = 0; + return foo(t)]])], + [ac_cv_c_restrict=$ac_kw]) + test "$ac_cv_c_restrict" != no && break + done + ]) + AH_VERBATIM([restrict], +[/* Define to the equivalent of the C99 'restrict' keyword, or to + nothing if this is not supported. Do not define if restrict is + supported directly. */ +#undef restrict +/* Work around a bug in Sun C++: it does not support _Restrict, even + though the corresponding Sun C compiler does, which causes + "#define restrict _Restrict" in the previous line. Perhaps some future + version of Sun C++ will work with _Restrict; if so, it'll probably + define __RESTRICT, just as Sun C does. */ +#if defined __SUNPRO_CC && !defined __RESTRICT +# define _Restrict +#endif]) + case $ac_cv_c_restrict in + restrict) ;; + no) AC_DEFINE([restrict], []) ;; + *) AC_DEFINE_UNQUOTED([restrict], [$ac_cv_c_restrict]) ;; + esac +]) diff -ruNp m4-1.4.10/m4/gnulib-comp.m4 m4-1.4.11/m4/gnulib-comp.m4 --- m4-1.4.10/m4/gnulib-comp.m4 2007-07-04 22:05:58.000000000 -0600 +++ m4-1.4.11/m4/gnulib-comp.m4 2008-04-01 20:25:17.000000000 -0600 @@ -1,5 +1,5 @@ # DO NOT EDIT! GENERATED AUTOMATICALLY! -# Copyright (C) 2004-2007 Free Software Foundation, Inc. +# Copyright (C) 2002-2008 Free Software Foundation, Inc. # # This file is free software, distributed under the terms of the GNU # General Public License. As a special exception to the GNU General @@ -25,7 +25,6 @@ AC_DEFUN([M4_EARLY], m4_pattern_allow([^gl_LIBOBJS$])dnl a variable m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable AC_REQUIRE([AC_PROG_RANLIB]) - AC_REQUIRE([AC_GNU_SOURCE]) AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) AC_REQUIRE([AC_FUNC_FSEEKO]) AC_REQUIRE([gl_FP_IEEE]) @@ -42,14 +41,15 @@ AC_DEFUN([M4_EARLY], # "Check for header files, types and library functions". AC_DEFUN([M4_INIT], [ - m4_pushdef([AC_LIBOBJ], m4_defn([M4_LIBOBJ])) - m4_pushdef([AC_REPLACE_FUNCS], m4_defn([M4_REPLACE_FUNCS])) - m4_pushdef([AC_LIBSOURCES], m4_defn([M4_LIBSOURCES])) AM_CONDITIONAL([GL_COND_LIBTOOL], [false]) gl_cond_libtool=false gl_libdeps= gl_ltlibdeps= + m4_pushdef([AC_LIBOBJ], m4_defn([M4_LIBOBJ])) + m4_pushdef([AC_REPLACE_FUNCS], m4_defn([M4_REPLACE_FUNCS])) + m4_pushdef([AC_LIBSOURCES], m4_defn([M4_LIBSOURCES])) gl_source_base='lib' + gl_EOVERFLOW gl_FUNC_ALLOCA gl_ASSERT AC_DEFINE([SIGNAL_SAFE_LIST], [1], [Define if lists must be signal-safe.]) @@ -60,6 +60,9 @@ AC_DEFUN([M4_INIT], gl_CLOSEOUT gl_CONFIG_H gl_ERROR + m4_ifdef([AM_XGETTEXT_OPTION], + [AM_XGETTEXT_OPTION([--flag=error:3:c-format]) + AM_XGETTEXT_OPTION([--flag=error_at_line:5:c-format])]) gl_EXITFAIL gl_FATAL_SIGNAL gl_FUNC_FFLUSH @@ -70,7 +73,8 @@ AC_DEFUN([M4_INIT], gl_FUNC_FPENDING gl_FUNC_FPURGE gl_FUNC_FREADING - gl_FUNC_FREE + gl_FUNC_FREXP_NO_LIBM + gl_MATH_MODULE_INDICATOR([frexp]) gl_FUNC_FREXPL_NO_LIBM gl_MATH_MODULE_INDICATOR([frexpl]) gl_FUNC_FSEEKO @@ -81,20 +85,34 @@ AC_DEFUN([M4_INIT], AC_SUBST([LIBINTL]) AC_SUBST([LTLIBINTL]) gl_FUNC_GETTIMEOFDAY + # Autoconf 2.61a.99 and earlier don't support linking a file only + # in VPATH builds. But since GNUmakefile is for maintainer use + # only, it does not matter if we skip the link with older autoconf. + # Automake 1.10.1 and earlier try to remove GNUmakefile in non-VPATH + # builds, so use a shell variable to bypass this. + GNUmakefile=GNUmakefile + m4_if(m4_version_compare([2.61a.100], + m4_defn([m4_PACKAGE_VERSION])), [1], [], + [AC_CONFIG_LINKS([$GNUmakefile:$GNUmakefile], [], + [GNUmakefile=$GNUmakefile])]) gl_INLINE - gl_FUNC_ISNAN_NO_LIBM - gl_DOUBLE_EXPONENT_LOCATION + gl_FUNC_ISNAND_NO_LIBM gl_FUNC_ISNANF_NO_LIBM - gl_FLOAT_EXPONENT_LOCATION gl_FUNC_ISNANL_NO_LIBM - gl_LONG_DOUBLE_EXPONENT_LOCATION gl_LIST gl_LOCALCHARSET + LOCALCHARSET_TESTS_ENVIRONMENT="CHARSETALIASDIR=\"\$(top_builddir)/$gl_source_base\"" + AC_SUBST([LOCALCHARSET_TESTS_ENVIRONMENT]) gl_FUNC_LSEEK gl_UNISTD_MODULE_INDICATOR([lseek]) AC_FUNC_MALLOC + AC_DEFINE([GNULIB_MALLOC_GNU], 1, [Define to indicate the 'malloc' module.]) + gl_FUNC_MALLOC_POSIX + gl_STDLIB_MODULE_INDICATOR([malloc-posix]) gl_MALLOCA gl_MATH_H + gl_FUNC_MEMCHR + gl_FUNC_MEMCMP gt_FUNC_MKDTEMP gl_STDLIB_MODULE_INDICATOR([mkdtemp]) gl_FUNC_MKSTEMP @@ -111,9 +129,6 @@ AC_DEFUN([M4_INIT], gl_SIGNAL_H gl_SIGNBIT gl_MATH_MODULE_INDICATOR([signbit]) - AC_REQUIRE([gl_FLOAT_EXPONENT_LOCATION]) - AC_REQUIRE([gl_DOUBLE_EXPONENT_LOCATION]) - AC_REQUIRE([gl_LONG_DOUBLE_EXPONENT_LOCATION]) gl_SIGNALBLOCKING gl_SIGNAL_MODULE_INDICATOR([sigprocmask]) gl_SIZE_MAX @@ -121,11 +136,16 @@ AC_DEFUN([M4_INIT], gl_STDARG_H AM_STDBOOL_H gl_STDINT_H - gt_TYPE_WCHAR_T - gt_TYPE_WINT_T gl_STDIO_H gl_STDLIB_H gl_STDLIB_SAFER + gl_FUNC_STRERROR + gl_STRING_MODULE_INDICATOR([strerror]) + gl_HEADER_STRING_H + gl_FUNC_STRSTR + gl_STRING_MODULE_INDICATOR([strstr]) + gl_FUNC_STRTOD + gl_STDLIB_MODULE_INDICATOR([strtod]) gl_FUNC_STRTOL gl_HEADER_SYS_STAT_H AC_PROG_MKDIR_P @@ -139,16 +159,25 @@ AC_DEFUN([M4_INIT], gl_FUNC_VASNPRINTF gl_FUNC_VASPRINTF gl_STDIO_MODULE_INDICATOR([vasprintf]) + m4_ifdef([AM_XGETTEXT_OPTION], + [AM_XGETTEXT_OPTION([--flag=asprintf:2:c-format]) + AM_XGETTEXT_OPTION([--flag=vasprintf:2:c-format])]) gl_FUNC_VASPRINTF_POSIX + m4_ifdef([AM_XGETTEXT_OPTION], + [AM_XGETTEXT_OPTION([--flag=verror:3:c-format]) + AM_XGETTEXT_OPTION([--flag=verror_at_line:5:c-format])]) gl_WCHAR_H gl_WCTYPE_H gl_XALLOC + m4_ifdef([AM_XGETTEXT_OPTION], + [AM_XGETTEXT_OPTION([--flag=xprintf:1:c-format]) + AM_XGETTEXT_OPTION([--flag=xvprintf:1:c-format]) + AM_XGETTEXT_OPTION([--flag=xfprintf:2:c-format]) + AM_XGETTEXT_OPTION([--flag=xvfprintf:2:c-format])]) gl_XSIZE gl_XVASPRINTF - LIBM4_LIBDEPS="$gl_libdeps" - AC_SUBST([LIBM4_LIBDEPS]) - LIBM4_LTLIBDEPS="$gl_ltlibdeps" - AC_SUBST([LIBM4_LTLIBDEPS]) + m4_ifdef([AM_XGETTEXT_OPTION], + [AM_XGETTEXT_OPTION([--flag=xasprintf:1:c-format])]) m4_popdef([AC_LIBSOURCES]) m4_popdef([AC_REPLACE_FUNCS]) m4_popdef([AC_LIBOBJ]) @@ -166,39 +195,134 @@ AC_DEFUN([M4_INIT], AC_SUBST([M4_LIBOBJS], [$M4_libobjs]) AC_SUBST([M4_LTLIBOBJS], [$M4_ltlibobjs]) ]) + gltests_libdeps= + gltests_ltlibdeps= + m4_pushdef([AC_LIBOBJ], m4_defn([M4tests_LIBOBJ])) + m4_pushdef([AC_REPLACE_FUNCS], m4_defn([M4tests_REPLACE_FUNCS])) + m4_pushdef([AC_LIBSOURCES], m4_defn([M4tests_LIBSOURCES])) + gl_source_base='tests' + gl_DOUBLE_EXPONENT_LOCATION + gl_FLOAT_EXPONENT_LOCATION + gl_LONG_DOUBLE_EXPONENT_LOCATION + AC_REQUIRE([gl_FLOAT_EXPONENT_LOCATION]) + AC_REQUIRE([gl_DOUBLE_EXPONENT_LOCATION]) + AC_REQUIRE([gl_LONG_DOUBLE_EXPONENT_LOCATION]) + gt_TYPE_WCHAR_T + gt_TYPE_WINT_T + AC_CHECK_DECLS_ONCE([alarm]) + m4_popdef([AC_LIBSOURCES]) + m4_popdef([AC_REPLACE_FUNCS]) + m4_popdef([AC_LIBOBJ]) + AC_CONFIG_COMMANDS_PRE([ + M4tests_libobjs= + M4tests_ltlibobjs= + if test -n "$M4tests_LIBOBJS"; then + # Remove the extension. + sed_drop_objext='s/\.o$//;s/\.obj$//' + for i in `for i in $M4tests_LIBOBJS; do echo "$i"; done | sed "$sed_drop_objext" | sort | uniq`; do + M4tests_libobjs="$M4tests_libobjs $i.$ac_objext" + M4tests_ltlibobjs="$M4tests_ltlibobjs $i.lo" + done + fi + AC_SUBST([M4tests_LIBOBJS], [$M4tests_libobjs]) + AC_SUBST([M4tests_LTLIBOBJS], [$M4tests_ltlibobjs]) + ]) + LIBM4_LIBDEPS="$gl_libdeps" + AC_SUBST([LIBM4_LIBDEPS]) + LIBM4_LTLIBDEPS="$gl_ltlibdeps" + AC_SUBST([LIBM4_LTLIBDEPS]) + LIBTESTS_LIBDEPS="$gltests_libdeps" + AC_SUBST([LIBTESTS_LIBDEPS]) ]) # Like AC_LIBOBJ, except that the module name goes # into M4_LIBOBJS instead of into LIBOBJS. -AC_DEFUN([M4_LIBOBJ], - [M4_LIBOBJS="$M4_LIBOBJS $1.$ac_objext"]) +AC_DEFUN([M4_LIBOBJ], [ + AS_LITERAL_IF([$1], [M4_LIBSOURCES([$1.c])])dnl + M4_LIBOBJS="$M4_LIBOBJS $1.$ac_objext" +]) + +# m4_foreach_w is provided by autoconf-2.59c and later. +# This definition is to accommodate developers using versions +# of autoconf older than that. +m4_ifndef([m4_foreach_w], + [m4_define([m4_foreach_w], + [m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])]) # Like AC_REPLACE_FUNCS, except that the module name goes # into M4_LIBOBJS instead of into LIBOBJS. -AC_DEFUN([M4_REPLACE_FUNCS], - [AC_CHECK_FUNCS([$1], , [M4_LIBOBJ($ac_func)])]) +AC_DEFUN([M4_REPLACE_FUNCS], [ + m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl + AC_CHECK_FUNCS([$1], , [M4_LIBOBJ($ac_func)]) +]) + +# Like AC_LIBSOURCES, except the directory where the source file is +# expected is derived from the gnulib-tool parametrization, +# and alloca is special cased (for the alloca-opt module). +# We could also entirely rely on EXTRA_lib..._SOURCES. +AC_DEFUN([M4_LIBSOURCES], [ + m4_foreach([_gl_NAME], [$1], [ + m4_if(_gl_NAME, [alloca.c], [], [ + m4_syscmd([test -r lib/]_gl_NAME[ || test ! -d lib])dnl + m4_if(m4_sysval, [0], [], + [AC_FATAL([missing lib/]_gl_NAME)]) + ]) + ]) +]) + +# Like AC_LIBOBJ, except that the module name goes +# into M4tests_LIBOBJS instead of into LIBOBJS. +AC_DEFUN([M4tests_LIBOBJ], [ + AS_LITERAL_IF([$1], [M4tests_LIBSOURCES([$1.c])])dnl + M4tests_LIBOBJS="$M4tests_LIBOBJS $1.$ac_objext" +]) -# Like AC_LIBSOURCES, except that it does nothing. -# We rely on EXTRA_lib..._SOURCES instead. -AC_DEFUN([M4_LIBSOURCES], - []) +# m4_foreach_w is provided by autoconf-2.59c and later. +# This definition is to accommodate developers using versions +# of autoconf older than that. +m4_ifndef([m4_foreach_w], + [m4_define([m4_foreach_w], + [m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])]) + +# Like AC_REPLACE_FUNCS, except that the module name goes +# into M4tests_LIBOBJS instead of into LIBOBJS. +AC_DEFUN([M4tests_REPLACE_FUNCS], [ + m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl + AC_CHECK_FUNCS([$1], , [M4tests_LIBOBJ($ac_func)]) +]) + +# Like AC_LIBSOURCES, except the directory where the source file is +# expected is derived from the gnulib-tool parametrization, +# and alloca is special cased (for the alloca-opt module). +# We could also entirely rely on EXTRA_lib..._SOURCES. +AC_DEFUN([M4tests_LIBSOURCES], [ + m4_foreach([_gl_NAME], [$1], [ + m4_if(_gl_NAME, [alloca.c], [], [ + m4_syscmd([test -r tests/]_gl_NAME[ || test ! -d tests])dnl + m4_if(m4_sysval, [0], [], + [AC_FATAL([missing tests/]_gl_NAME)]) + ]) + ]) +]) # This macro records the list of files which have been installed by # gnulib-tool and may be removed by future gnulib-tool invocations. AC_DEFUN([M4_FILE_LIST], [ + build-aux/announce-gen build-aux/gendocs.sh + build-aux/git-version-gen build-aux/gnupload build-aux/link-warning.h doc/fdl.texi doc/gendocs_template doc/gpl-3.0.texi - lib/__fpending.c - lib/__fpending.h lib/alloca.c - lib/alloca_.h + lib/alloca.in.h lib/asnprintf.c lib/asprintf.c lib/binary-io.h + lib/c-ctype.c + lib/c-ctype.h lib/clean-temp.c lib/clean-temp.h lib/cloexec.c @@ -220,21 +344,24 @@ AC_DEFUN([M4_FILE_LIST], [ lib/fd-safer.c lib/fflush.c lib/float+.h - lib/float_.h + lib/float.in.h lib/fopen-safer.c + lib/fpending.c + lib/fpending.h lib/fpucw.h lib/fpurge.c lib/fpurge.h + lib/freadahead.c + lib/freadahead.h lib/freading.c lib/freading.h - lib/free.c lib/frexp.c lib/frexpl.c lib/fseeko.c lib/ftello.c lib/getopt.c + lib/getopt.in.h lib/getopt1.c - lib/getopt_.h lib/getopt_int.h lib/gettext.h lib/gettimeofday.c @@ -243,10 +370,6 @@ AC_DEFUN([M4_FILE_LIST], [ lib/gl_anylinked_list1.h lib/gl_anylinked_list2.h lib/gl_anytree_oset.h - lib/gl_array_list.c - lib/gl_array_list.h - lib/gl_array_oset.c - lib/gl_array_oset.h lib/gl_avltree_oset.c lib/gl_avltree_oset.h lib/gl_linkedhash_list.c @@ -257,7 +380,8 @@ AC_DEFUN([M4_FILE_LIST], [ lib/gl_oset.h lib/intprops.h lib/isnan.c - lib/isnan.h + lib/isnand.c + lib/isnand.h lib/isnanf.c lib/isnanf.h lib/isnanl-nolibm.h @@ -269,7 +393,9 @@ AC_DEFUN([M4_FILE_LIST], [ lib/malloca.c lib/malloca.h lib/malloca.valgrind - lib/math_.h + lib/math.in.h + lib/memchr.c + lib/memcmp.c lib/mkdtemp.c lib/mkstemp-safer.c lib/mkstemp.c @@ -285,8 +411,6 @@ AC_DEFUN([M4_FILE_LIST], [ lib/printf-frexpl.h lib/printf-parse.c lib/printf-parse.h - lib/progname.c - lib/progname.h lib/quotearg.c lib/quotearg.h lib/ref-add.sin @@ -297,52 +421,58 @@ AC_DEFUN([M4_FILE_LIST], [ lib/regex_internal.c lib/regex_internal.h lib/regexec.c - lib/signal_.h + lib/signal.in.h lib/signbitd.c lib/signbitf.c lib/signbitl.c lib/sigprocmask.c lib/size_max.h - lib/stdbool_.h - lib/stdint_.h + lib/stdarg.in.h + lib/stdbool.in.h + lib/stdint.in.h lib/stdio--.h lib/stdio-safer.h - lib/stdio_.h + lib/stdio.in.h lib/stdlib--.h lib/stdlib-safer.h - lib/stdlib_.h + lib/stdlib.in.h + lib/str-two-way.h + lib/strerror.c + lib/string.in.h + lib/strstr.c + lib/strtod.c lib/strtol.c - lib/sys_stat_.h - lib/sys_time_.h + lib/sys_stat.in.h + lib/sys_time.in.h lib/tempname.c lib/tempname.h lib/tmpdir.c lib/tmpdir.h lib/unistd--.h lib/unistd-safer.h - lib/unistd_.h + lib/unistd.in.h lib/unlocked-io.h lib/vasnprintf.c lib/vasnprintf.h lib/vasprintf.c - lib/verify.h lib/verror.c lib/verror.h lib/version-etc-fsf.c lib/version-etc.c lib/version-etc.h - lib/wchar_.h - lib/wctype_.h + lib/wchar.in.h + lib/wctype.in.h lib/xalloc-die.c lib/xalloc.h lib/xasprintf.c lib/xmalloc.c lib/xmalloca.c lib/xmalloca.h + lib/xprintf.c + lib/xprintf.h lib/xsize.h lib/xvasprintf.c lib/xvasprintf.h - m4/absolute-header.m4 m4/alloca.m4 m4/assert.m4 m4/cloexec.m4 @@ -363,7 +493,6 @@ AC_DEFUN([M4_FILE_LIST], [ m4/fpieee.m4 m4/fpurge.m4 m4/freading.m4 - m4/free.m4 m4/frexp.m4 m4/frexpl.m4 m4/fseeko.m4 @@ -377,19 +506,23 @@ AC_DEFUN([M4_FILE_LIST], [ m4/inline.m4 m4/intmax_t.m4 m4/inttypes_h.m4 - m4/isnan.m4 + m4/isnand.m4 m4/isnanf.m4 m4/isnanl.m4 m4/ldexpl.m4 m4/localcharset.m4 m4/longlong.m4 m4/lseek.m4 + m4/malloc.m4 m4/malloca.m4 m4/math_h.m4 m4/mbrtowc.m4 m4/mbstate_t.m4 + m4/memchr.m4 + m4/memcmp.m4 m4/mkdtemp.m4 m4/mkstemp.m4 + m4/nocrash.m4 m4/pathmax.m4 m4/printf-frexp.m4 m4/printf-frexpl.m4 @@ -410,12 +543,15 @@ AC_DEFUN([M4_FILE_LIST], [ m4/stdio_h.m4 m4/stdlib-safer.m4 m4/stdlib_h.m4 + m4/strerror.m4 + m4/string_h.m4 + m4/strstr.m4 + m4/strtod.m4 m4/strtol.m4 m4/sys_stat_h.m4 m4/sys_time_h.m4 m4/tempname.m4 m4/tmpdir.m4 - m4/ulonglong.m4 m4/unistd-safer.m4 m4/unistd_h.m4 m4/unlocked-io.m4 @@ -429,24 +565,34 @@ AC_DEFUN([M4_FILE_LIST], [ m4/xalloc.m4 m4/xsize.m4 m4/xvasprintf.m4 + tests/nan.h + tests/test-EOVERFLOW.c tests/test-alloca-opt.c tests/test-array_list.c tests/test-array_oset.c tests/test-avltree_oset.c tests/test-binary-io.c tests/test-binary-io.sh + tests/test-c-ctype.c tests/test-closein.c tests/test-closein.sh tests/test-fflush.c + tests/test-fflush2.c + tests/test-fflush2.sh + tests/test-fpending.c + tests/test-fpending.sh tests/test-fpurge.c + tests/test-freadahead.c + tests/test-freadahead.sh tests/test-freading.c + tests/test-frexp.c tests/test-frexpl.c tests/test-fseeko.c tests/test-fseeko.sh tests/test-ftello.c tests/test-ftello.sh tests/test-gettimeofday.c - tests/test-isnan.c + tests/test-isnand.c tests/test-isnanf.c tests/test-isnanl-nolibm.c tests/test-isnanl.h @@ -457,11 +603,16 @@ AC_DEFUN([M4_FILE_LIST], [ tests/test-math.c tests/test-printf-frexp.c tests/test-printf-frexpl.c + tests/test-quotearg.c tests/test-signbit.c tests/test-stdbool.c tests/test-stdint.c tests/test-stdio.c tests/test-stdlib.c + tests/test-strerror.c + tests/test-string.c + tests/test-strstr.c + tests/test-strtod.c tests/test-sys_stat.c tests/test-sys_time.c tests/test-unistd.c @@ -471,4 +622,12 @@ AC_DEFUN([M4_FILE_LIST], [ tests/test-wchar.c tests/test-wctype.c tests/test-xvasprintf.c + tests=lib/gl_array_list.c + tests=lib/gl_array_list.h + tests=lib/gl_array_oset.c + tests=lib/gl_array_oset.h + tests=lib/progname.c + tests=lib/progname.h + tests=lib/verify.h + top/GNUmakefile ]) diff -ruNp m4-1.4.10/m4/include_next.m4 m4-1.4.11/m4/include_next.m4 --- m4-1.4.10/m4/include_next.m4 2007-07-04 22:02:41.000000000 -0600 +++ m4-1.4.11/m4/include_next.m4 2008-03-13 06:41:24.000000000 -0600 @@ -1,5 +1,5 @@ -# include_next.m4 serial 3 -dnl Copyright (C) 2006, 2007 Free Software Foundation, Inc. +# include_next.m4 serial 5 +dnl Copyright (C) 2006-2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -11,9 +11,31 @@ AC_DEFUN([gl_INCLUDE_NEXT], AC_LANG_PREPROC_REQUIRE() AC_CACHE_CHECK([whether the preprocessor supports include_next], [gl_cv_have_include_next], - [AC_PREPROC_IFELSE([#include_next <stddef.h>], + [rm -rf conftestd1 conftestd2 + mkdir conftestd1 conftestd2 + cat <<EOF > conftestd1/conftest.h +#define DEFINED_IN_CONFTESTD1 +#include_next <conftest.h> +#ifdef DEFINED_IN_CONFTESTD2 +int foo; +#else +#error "include_next doesn't work" +#endif +EOF + cat <<EOF > conftestd2/conftest.h +#ifndef DEFINED_IN_CONFTESTD1 +#error "include_next test doesn't work" +#endif +#define DEFINED_IN_CONFTESTD2 +EOF + save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS -Iconftestd1 -Iconftestd2" + AC_COMPILE_IFELSE([#include <conftest.h>], [gl_cv_have_include_next=yes], - [gl_cv_have_include_next=no])]) + [gl_cv_have_include_next=no]) + CPPFLAGS="$save_CPPFLAGS" + rm -rf conftestd1 conftestd2 + ]) if test $gl_cv_have_include_next = yes; then dnl FIXME: Remove HAVE_INCLUDE_NEXT and update everything that uses it @@ -41,6 +63,9 @@ AC_DEFUN([gl_INCLUDE_NEXT], # The three "///" are to pacify Sun C 5.8, which otherwise would say # "warning: #include of /usr/include/... may be non-portable". # Use `""', not `<>', so that the /// cannot be confused with a C99 comment. +# Note: This macro assumes that the header file is not empty after +# preprocessing, i.e. it does not only define preprocessor macros but also +# provides some type/enum definitions or function/variable declarations. AC_DEFUN([gl_CHECK_NEXT_HEADERS], [ AC_REQUIRE([gl_INCLUDE_NEXT]) diff -ruNp m4-1.4.10/m4/intmax_t.m4 m4-1.4.11/m4/intmax_t.m4 --- m4-1.4.10/m4/intmax_t.m4 2007-05-30 19:30:53.000000000 -0600 +++ m4-1.4.11/m4/intmax_t.m4 2007-11-02 12:07:45.000000000 -0600 @@ -1,5 +1,5 @@ -# intmax_t.m4 serial 5 -dnl Copyright (C) 1997-2004, 2006 Free Software Foundation, Inc. +# intmax_t.m4 serial 6 +dnl Copyright (C) 1997-2004, 2006-2007 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -18,8 +18,8 @@ AC_DEFUN([gl_AC_TYPE_INTMAX_T], AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) AC_REQUIRE([gl_AC_HEADER_STDINT_H]) if test $gl_cv_header_inttypes_h = no && test $gl_cv_header_stdint_h = no; then - AC_REQUIRE([gl_AC_TYPE_LONG_LONG]) - test $ac_cv_type_long_long = yes \ + AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) + test $ac_cv_type_long_long_int = yes \ && ac_type='long long' \ || ac_type='long' AC_DEFINE_UNQUOTED(intmax_t, $ac_type, @@ -51,8 +51,8 @@ AC_DEFUN([gt_AC_TYPE_INTMAX_T], AC_DEFINE(HAVE_INTMAX_T, 1, [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.]) else - AC_REQUIRE([gl_AC_TYPE_LONG_LONG]) - test $ac_cv_type_long_long = yes \ + AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) + test $ac_cv_type_long_long_int = yes \ && ac_type='long long' \ || ac_type='long' AC_DEFINE_UNQUOTED(intmax_t, $ac_type, diff -ruNp m4-1.4.10/m4/isnan.m4 m4-1.4.11/m4/isnan.m4 --- m4-1.4.10/m4/isnan.m4 2007-05-30 19:30:53.000000000 -0600 +++ m4-1.4.11/m4/isnan.m4 1969-12-31 17:00:00.000000000 -0700 @@ -1,137 +0,0 @@ -# isnan.m4 serial 2 -dnl Copyright (C) 2007 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl Check how to get or define isnan() without linking with libm. - -AC_DEFUN([gl_FUNC_ISNAN_NO_LIBM], -[ - AC_CACHE_CHECK([whether isnan(double) can be used without linking with libm], - [gl_cv_func_isnan_no_libm], - [ - AC_TRY_LINK([#include <math.h> - double x;], - [return isnan (x);], - [gl_cv_func_isnan_no_libm=yes], - [gl_cv_func_isnan_no_libm=no]) - ]) - if test $gl_cv_func_isnan_no_libm = yes; then - AC_DEFINE([HAVE_ISNAN_IN_LIBC], 1, - [Define if the isnan(double) function is available in libc.]) - else - AC_LIBOBJ([isnan]) - gl_DOUBLE_EXPONENT_LOCATION - fi -]) - -AC_DEFUN([gl_DOUBLE_EXPONENT_LOCATION], -[ - AC_CACHE_CHECK([where to find the exponent in a 'double'], - [gl_cv_cc_double_expbit0], - [ - AC_TRY_RUN([ -#include <float.h> -#include <stddef.h> -#include <stdio.h> -#include <string.h> -#define NWORDS \ - ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) -typedef union { double value; unsigned int word[NWORDS]; } memory_double; -static unsigned int ored_words[NWORDS]; -static unsigned int anded_words[NWORDS]; -static void add_to_ored_words (double x) -{ - memory_double m; - size_t i; - /* Clear it first, in case sizeof (double) < sizeof (memory_double). */ - memset (&m, 0, sizeof (memory_double)); - m.value = x; - for (i = 0; i < NWORDS; i++) - { - ored_words[i] |= m.word[i]; - anded_words[i] &= m.word[i]; - } -} -int main () -{ - size_t j; - FILE *fp = fopen ("conftest.out", "w"); - if (fp == NULL) - return 1; - for (j = 0; j < NWORDS; j++) - anded_words[j] = ~ (unsigned int) 0; - add_to_ored_words (0.25); - add_to_ored_words (0.5); - add_to_ored_words (1.0); - add_to_ored_words (2.0); - add_to_ored_words (4.0); - /* Remove bits that are common (e.g. if representation of the first mantissa - bit is explicit). */ - for (j = 0; j < NWORDS; j++) - ored_words[j] &= ~anded_words[j]; - /* Now find the nonzero word. */ - for (j = 0; j < NWORDS; j++) - if (ored_words[j] != 0) - break; - if (j < NWORDS) - { - size_t i; - for (i = j + 1; i < NWORDS; i++) - if (ored_words[i] != 0) - { - fprintf (fp, "unknown"); - return (fclose (fp) != 0); - } - for (i = 0; ; i++) - if ((ored_words[j] >> i) & 1) - { - fprintf (fp, "word %d bit %d", (int) j, (int) i); - return (fclose (fp) != 0); - } - } - fprintf (fp, "unknown"); - return (fclose (fp) != 0); -} - ], - [gl_cv_cc_double_expbit0=`cat conftest.out`], - [gl_cv_cc_double_expbit0="unknown"], - [ - dnl On ARM, there are two 'double' floating-point formats, used by - dnl different sets of instructions: The older FPA instructions assume - dnl that they are stored in big-endian word order, while the words - dnl (like integer types) are stored in little-endian byte order. - dnl The newer VFP instructions assume little-endian order consistenly. - AC_EGREP_CPP([mixed_endianness], [ -#if defined arm || defined __arm || defined __arm__ - mixed_endianness -#endif - ], - [gl_cv_cc_double_expbit0="unknown"], - [ - pushdef([AC_MSG_CHECKING],[:])dnl - pushdef([AC_MSG_RESULT],[:])dnl - pushdef([AC_MSG_RESULT_UNQUOTED],[:])dnl - AC_C_BIGENDIAN( - [gl_cv_cc_double_expbit0="word 0 bit 20"], - [gl_cv_cc_double_expbit0="word 1 bit 20"], - [gl_cv_cc_double_expbit0="unknown"]) - popdef([AC_MSG_RESULT_UNQUOTED])dnl - popdef([AC_MSG_RESULT])dnl - popdef([AC_MSG_CHECKING])dnl - ]) - ]) - rm -f conftest.out - ]) - case "$gl_cv_cc_double_expbit0" in - word*bit*) - word=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word //' -e 's/ bit.*//'` - bit=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word.*bit //'` - AC_DEFINE_UNQUOTED([DBL_EXPBIT0_WORD], [$word], - [Define as the word index where to find the exponent of 'double'.]) - AC_DEFINE_UNQUOTED([DBL_EXPBIT0_BIT], [$bit], - [Define as the bit index in the word where to find bit 0 of the exponent of 'double'.]) - ;; - esac -]) diff -ruNp m4-1.4.10/m4/isnand.m4 m4-1.4.11/m4/isnand.m4 --- m4-1.4.10/m4/isnand.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/m4/isnand.m4 2008-01-26 16:04:11.000000000 -0700 @@ -0,0 +1,144 @@ +# isnand.m4 serial 2 +dnl Copyright (C) 2007-2008 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl Check how to get or define isnand() without linking with libm. + +AC_DEFUN([gl_FUNC_ISNAND_NO_LIBM], +[ + AC_CACHE_CHECK([whether isnan(double) can be used without linking with libm], + [gl_cv_func_isnand_no_libm], + [ + AC_TRY_LINK([#include <math.h> + #if __GNUC__ >= 4 + # undef isnand + # define isnand(x) __builtin_isnan ((double)(x)) + #else + # undef isnand + # define isnand(x) isnan ((double)(x)) + #endif + double x;], + [return isnand (x);], + [gl_cv_func_isnand_no_libm=yes], + [gl_cv_func_isnand_no_libm=no]) + ]) + if test $gl_cv_func_isnand_no_libm = yes; then + AC_DEFINE([HAVE_ISNAND_IN_LIBC], 1, + [Define if the isnan(double) function is available in libc.]) + else + AC_LIBOBJ([isnand]) + gl_DOUBLE_EXPONENT_LOCATION + fi +]) + +AC_DEFUN([gl_DOUBLE_EXPONENT_LOCATION], +[ + AC_CACHE_CHECK([where to find the exponent in a 'double'], + [gl_cv_cc_double_expbit0], + [ + AC_TRY_RUN([ +#include <float.h> +#include <stddef.h> +#include <stdio.h> +#include <string.h> +#define NWORDS \ + ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) +typedef union { double value; unsigned int word[NWORDS]; } memory_double; +static unsigned int ored_words[NWORDS]; +static unsigned int anded_words[NWORDS]; +static void add_to_ored_words (double x) +{ + memory_double m; + size_t i; + /* Clear it first, in case sizeof (double) < sizeof (memory_double). */ + memset (&m, 0, sizeof (memory_double)); + m.value = x; + for (i = 0; i < NWORDS; i++) + { + ored_words[i] |= m.word[i]; + anded_words[i] &= m.word[i]; + } +} +int main () +{ + size_t j; + FILE *fp = fopen ("conftest.out", "w"); + if (fp == NULL) + return 1; + for (j = 0; j < NWORDS; j++) + anded_words[j] = ~ (unsigned int) 0; + add_to_ored_words (0.25); + add_to_ored_words (0.5); + add_to_ored_words (1.0); + add_to_ored_words (2.0); + add_to_ored_words (4.0); + /* Remove bits that are common (e.g. if representation of the first mantissa + bit is explicit). */ + for (j = 0; j < NWORDS; j++) + ored_words[j] &= ~anded_words[j]; + /* Now find the nonzero word. */ + for (j = 0; j < NWORDS; j++) + if (ored_words[j] != 0) + break; + if (j < NWORDS) + { + size_t i; + for (i = j + 1; i < NWORDS; i++) + if (ored_words[i] != 0) + { + fprintf (fp, "unknown"); + return (fclose (fp) != 0); + } + for (i = 0; ; i++) + if ((ored_words[j] >> i) & 1) + { + fprintf (fp, "word %d bit %d", (int) j, (int) i); + return (fclose (fp) != 0); + } + } + fprintf (fp, "unknown"); + return (fclose (fp) != 0); +} + ], + [gl_cv_cc_double_expbit0=`cat conftest.out`], + [gl_cv_cc_double_expbit0="unknown"], + [ + dnl On ARM, there are two 'double' floating-point formats, used by + dnl different sets of instructions: The older FPA instructions assume + dnl that they are stored in big-endian word order, while the words + dnl (like integer types) are stored in little-endian byte order. + dnl The newer VFP instructions assume little-endian order consistenly. + AC_EGREP_CPP([mixed_endianness], [ +#if defined arm || defined __arm || defined __arm__ + mixed_endianness +#endif + ], + [gl_cv_cc_double_expbit0="unknown"], + [ + pushdef([AC_MSG_CHECKING],[:])dnl + pushdef([AC_MSG_RESULT],[:])dnl + pushdef([AC_MSG_RESULT_UNQUOTED],[:])dnl + AC_C_BIGENDIAN( + [gl_cv_cc_double_expbit0="word 0 bit 20"], + [gl_cv_cc_double_expbit0="word 1 bit 20"], + [gl_cv_cc_double_expbit0="unknown"]) + popdef([AC_MSG_RESULT_UNQUOTED])dnl + popdef([AC_MSG_RESULT])dnl + popdef([AC_MSG_CHECKING])dnl + ]) + ]) + rm -f conftest.out + ]) + case "$gl_cv_cc_double_expbit0" in + word*bit*) + word=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word //' -e 's/ bit.*//'` + bit=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word.*bit //'` + AC_DEFINE_UNQUOTED([DBL_EXPBIT0_WORD], [$word], + [Define as the word index where to find the exponent of 'double'.]) + AC_DEFINE_UNQUOTED([DBL_EXPBIT0_BIT], [$bit], + [Define as the bit index in the word where to find bit 0 of the exponent of 'double'.]) + ;; + esac +]) diff -ruNp m4-1.4.10/m4/isnanf.m4 m4-1.4.11/m4/isnanf.m4 --- m4-1.4.10/m4/isnanf.m4 2007-05-30 19:30:53.000000000 -0600 +++ m4-1.4.11/m4/isnanf.m4 2008-01-26 16:05:09.000000000 -0700 @@ -1,5 +1,5 @@ -# isnanf.m4 serial 4 -dnl Copyright (C) 2007 Free Software Foundation, Inc. +# isnanf.m4 serial 5 +dnl Copyright (C) 2007-2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -33,7 +33,10 @@ AC_DEFUN([gl_HAVE_ISNANF_NO_LIBM], [gl_cv_func_isnanf_no_libm], [ AC_TRY_LINK([#include <math.h> - #ifdef isnan + #if __GNUC__ >= 4 + # undef isnanf + # define isnanf(x) __builtin_isnanf ((float)(x)) + #elif defined isnan # undef isnanf # define isnanf(x) isnan ((float)(x)) #endif @@ -54,7 +57,10 @@ AC_DEFUN([gl_ISNANF_WORKS], [ AC_TRY_RUN([ #include <math.h> -#ifdef isnan +#if __GNUC__ >= 4 +# undef isnanf +# define isnanf(x) __builtin_isnanf ((float)(x)) +#elif defined isnan # undef isnanf # define isnanf(x) isnan ((float)(x)) #endif diff -ruNp m4-1.4.10/m4/isnanl.m4 m4-1.4.11/m4/isnanl.m4 --- m4-1.4.10/m4/isnanl.m4 2007-07-05 05:48:40.000000000 -0600 +++ m4-1.4.11/m4/isnanl.m4 2008-01-26 16:05:09.000000000 -0700 @@ -1,5 +1,5 @@ -# isnanl.m4 serial 5 -dnl Copyright (C) 2007 Free Software Foundation, Inc. +# isnanl.m4 serial 6 +dnl Copyright (C) 2007-2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -64,7 +64,10 @@ AC_DEFUN([gl_HAVE_ISNANL_NO_LIBM], [gl_cv_func_isnanl_no_libm], [ AC_TRY_LINK([#include <math.h> - #ifdef isnan + #if __GNUC__ >= 4 + # undef isnanl + # define isnanl(x) __builtin_isnanl ((long double)(x)) + #elif defined isnan # undef isnanl # define isnanl(x) isnan ((long double)(x)) #endif @@ -84,7 +87,10 @@ AC_DEFUN([gl_HAVE_ISNANL_IN_LIBM], save_LIBS="$LIBS" LIBS="$LIBS -lm" AC_TRY_LINK([#include <math.h> - #ifdef isnan + #if __GNUC__ >= 4 + # undef isnanl + # define isnanl(x) __builtin_isnanl ((long double)(x)) + #elif defined isnan # undef isnanl # define isnanl(x) isnan ((long double)(x)) #endif @@ -98,6 +104,9 @@ AC_DEFUN([gl_HAVE_ISNANL_IN_LIBM], dnl Test whether isnanl() recognizes all numbers which are neither finite nor dnl infinite. This test fails e.g. on NetBSD/i386 and on glibc/ia64. +dnl Also, the GCC >= 4.0 built-in __builtin_isnanl does not pass the tests +dnl - for pseudo-denormals on i686 and x86_64, +dnl - for pseudo-zeroes, unnormalized numbers, and pseudo-denormals on ia64. AC_DEFUN([gl_FUNC_ISNANL_WORKS], [ AC_REQUIRE([AC_PROG_CC]) @@ -109,7 +118,10 @@ AC_DEFUN([gl_FUNC_ISNANL_WORKS], #include <float.h> #include <limits.h> #include <math.h> -#ifdef isnan +#if __GNUC__ >= 4 +# undef isnanl +# define isnanl(x) __builtin_isnanl ((long double)(x)) +#elif defined isnan # undef isnanl # define isnanl(x) isnan ((long double)(x)) #endif diff -ruNp m4-1.4.10/m4/longlong.m4 m4-1.4.11/m4/longlong.m4 --- m4-1.4.10/m4/longlong.m4 2007-05-30 19:30:54.000000000 -0600 +++ m4-1.4.11/m4/longlong.m4 2007-11-21 06:35:51.000000000 -0700 @@ -1,5 +1,5 @@ -# longlong.m4 serial 10 -dnl Copyright (C) 1999-2006 Free Software Foundation, Inc. +# longlong.m4 serial 13 +dnl Copyright (C) 1999-2007 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -7,8 +7,8 @@ dnl with or without modifications, as lo dnl From Paul Eggert. # Define HAVE_LONG_LONG_INT if 'long long int' works. -# This fixes a bug in Autoconf 2.60, but can be removed once we -# assume 2.61 everywhere. +# This fixes a bug in Autoconf 2.61, but can be removed once we +# assume 2.62 everywhere. # Note: If the type 'long long int' exists but is only 32 bits large # (as on some very old compilers), HAVE_LONG_LONG_INT will not be @@ -18,20 +18,11 @@ AC_DEFUN([AC_TYPE_LONG_LONG_INT], [ AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int], [AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[long long int ll = 9223372036854775807ll; - long long int nll = -9223372036854775807LL; - typedef int a[((-9223372036854775807LL < 0 - && 0 < 9223372036854775807ll) - ? 1 : -1)]; - int i = 63;]], - [[long long int llmax = 9223372036854775807ll; - return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i) - | (llmax / ll) | (llmax % ll));]])], + [_AC_TYPE_LONG_LONG_SNIPPET], [dnl This catches a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004. dnl If cross compiling, assume the bug isn't important, since dnl nobody cross compiles for this platform as far as we know. - AC_RUN_IFELSE( + AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[@%:@include <limits.h> @%:@ifndef LLONG_MAX @@ -60,13 +51,56 @@ AC_DEFUN([AC_TYPE_LONG_LONG_INT], fi ]) -# This macro is obsolescent and should go away soon. -AC_DEFUN([gl_AC_TYPE_LONG_LONG], +# Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works. +# This fixes a bug in Autoconf 2.61, but can be removed once we +# assume 2.62 everywhere. + +# Note: If the type 'unsigned long long int' exists but is only 32 bits +# large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT +# will not be defined. In this case you can treat 'unsigned long long int' +# like 'unsigned long int'. + +AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT], [ - AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) - ac_cv_type_long_long=$ac_cv_type_long_long_int - if test $ac_cv_type_long_long = yes; then - AC_DEFINE(HAVE_LONG_LONG, 1, - [Define if you have the 'long long' type.]) + AC_CACHE_CHECK([for unsigned long long int], + [ac_cv_type_unsigned_long_long_int], + [AC_LINK_IFELSE( + [_AC_TYPE_LONG_LONG_SNIPPET], + [ac_cv_type_unsigned_long_long_int=yes], + [ac_cv_type_unsigned_long_long_int=no])]) + if test $ac_cv_type_unsigned_long_long_int = yes; then + AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], 1, + [Define to 1 if the system has the type `unsigned long long int'.]) fi ]) + +# Expands to a C program that can be used to test for simultaneous support +# of 'long long' and 'unsigned long long'. We don't want to say that +# 'long long' is available if 'unsigned long long' is not, or vice versa, +# because too many programs rely on the symmetry between signed and unsigned +# integer types (excluding 'bool'). +AC_DEFUN([_AC_TYPE_LONG_LONG_SNIPPET], +[ + AC_LANG_PROGRAM( + [[/* For now, do not test the preprocessor; as of 2007 there are too many + implementations with broken preprocessors. Perhaps this can + be revisited in 2012. In the meantime, code should not expect + #if to work with literals wider than 32 bits. */ + /* Test literals. */ + long long int ll = 9223372036854775807ll; + long long int nll = -9223372036854775807LL; + unsigned long long int ull = 18446744073709551615ULL; + /* Test constant expressions. */ + typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll) + ? 1 : -1)]; + typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1 + ? 1 : -1)]; + int i = 63;]], + [[/* Test availability of runtime routines for shift and division. */ + long long int llmax = 9223372036854775807ll; + unsigned long long int ullmax = 18446744073709551615ull; + return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i) + | (llmax / ll) | (llmax % ll) + | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i) + | (ullmax / ull) | (ullmax % ull));]]) +]) diff -ruNp m4-1.4.10/m4/lseek.m4 m4-1.4.11/m4/lseek.m4 --- m4-1.4.10/m4/lseek.m4 2007-07-05 05:48:41.000000000 -0600 +++ m4-1.4.11/m4/lseek.m4 2007-10-09 06:16:53.000000000 -0600 @@ -1,4 +1,4 @@ -# lseek.m4 serial 3 +# lseek.m4 serial 4 dnl Copyright (C) 2007 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -29,8 +29,8 @@ int main () [gl_cv_func_lseek_pipe=no]) else AC_COMPILE_IFELSE([ -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ -/* mingw mistakenly returns 0 when trying to seek on pipes. */ +#if ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) || defined __BEOS__ +/* mingw and BeOS mistakenly return 0 when trying to seek on pipes. */ Choke me. #endif], [gl_cv_func_lseek_pipe=yes], [gl_cv_func_lseek_pipe=no]) diff -ruNp m4-1.4.10/m4/malloc.m4 m4-1.4.11/m4/malloc.m4 --- m4-1.4.10/m4/malloc.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/m4/malloc.m4 2007-10-09 06:16:53.000000000 -0600 @@ -0,0 +1,41 @@ +# malloc.m4 serial 8 +dnl Copyright (C) 2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +# gl_FUNC_MALLOC_POSIX +# -------------------- +# Test whether 'malloc' is POSIX compliant (sets errno to ENOMEM when it +# fails), and replace malloc if it is not. +AC_DEFUN([gl_FUNC_MALLOC_POSIX], +[ + AC_REQUIRE([gl_CHECK_MALLOC_POSIX]) + if test $gl_cv_func_malloc_posix = yes; then + HAVE_MALLOC_POSIX=1 + AC_DEFINE([HAVE_MALLOC_POSIX], 1, + [Define if the 'malloc' function is POSIX compliant.]) + else + AC_LIBOBJ([malloc]) + HAVE_MALLOC_POSIX=0 + fi + AC_SUBST([HAVE_MALLOC_POSIX]) +]) + +# Test whether malloc, realloc, calloc are POSIX compliant, +# Set gl_cv_func_malloc_posix to yes or no accordingly. +AC_DEFUN([gl_CHECK_MALLOC_POSIX], +[ + AC_CACHE_CHECK([whether malloc, realloc, calloc are POSIX compliant], + [gl_cv_func_malloc_posix], + [ + dnl It is too dangerous to try to allocate a large amount of memory: + dnl some systems go to their knees when you do that. So assume that + dnl all Unix implementations of the function are POSIX compliant. + AC_TRY_COMPILE([], + [#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ + choke me + #endif + ], [gl_cv_func_malloc_posix=yes], [gl_cv_func_malloc_posix=no]) + ]) +]) diff -ruNp m4-1.4.10/m4/math_h.m4 m4-1.4.11/m4/math_h.m4 --- m4-1.4.10/m4/math_h.m4 2007-07-05 05:48:41.000000000 -0600 +++ m4-1.4.11/m4/math_h.m4 2008-01-26 16:05:11.000000000 -0700 @@ -1,5 +1,5 @@ -# math_h.m4 serial 5 -dnl Copyright (C) 2007 Free Software Foundation, Inc. +# math_h.m4 serial 9 +dnl Copyright (C) 2007-2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -19,27 +19,48 @@ AC_DEFUN([gl_MATH_MODULE_INDICATOR], AC_DEFUN([gl_MATH_H_DEFAULTS], [ - GNULIB_FREXP=0; AC_SUBST([GNULIB_FREXP]) - GNULIB_FREXPL=0; AC_SUBST([GNULIB_FREXPL]) - GNULIB_LDEXPL=0; AC_SUBST([GNULIB_LDEXPL]) - GNULIB_MATHL=0; AC_SUBST([GNULIB_MATHL]) - GNULIB_SIGNBIT=0; AC_SUBST([GNULIB_SIGNBIT]) + GNULIB_CEILF=0; AC_SUBST([GNULIB_CEILF]) + GNULIB_CEILL=0; AC_SUBST([GNULIB_CEILL]) + GNULIB_FLOORF=0; AC_SUBST([GNULIB_FLOORF]) + GNULIB_FLOORL=0; AC_SUBST([GNULIB_FLOORL]) + GNULIB_FREXP=0; AC_SUBST([GNULIB_FREXP]) + GNULIB_FREXPL=0; AC_SUBST([GNULIB_FREXPL]) + GNULIB_ISFINITE=0; AC_SUBST([GNULIB_ISFINITE]) + GNULIB_LDEXPL=0; AC_SUBST([GNULIB_LDEXPL]) + GNULIB_MATHL=0; AC_SUBST([GNULIB_MATHL]) + GNULIB_ROUND=0; AC_SUBST([GNULIB_ROUND]) + GNULIB_ROUNDF=0; AC_SUBST([GNULIB_ROUNDF]) + GNULIB_ROUNDL=0; AC_SUBST([GNULIB_ROUNDL]) + GNULIB_SIGNBIT=0; AC_SUBST([GNULIB_SIGNBIT]) + GNULIB_TRUNC=0; AC_SUBST([GNULIB_TRUNC]) + GNULIB_TRUNCF=0; AC_SUBST([GNULIB_TRUNCF]) + GNULIB_TRUNCL=0; AC_SUBST([GNULIB_TRUNCL]) dnl Assume proper GNU behavior unless another module says otherwise. - HAVE_DECL_ACOSL=1; AC_SUBST([HAVE_DECL_ACOSL]) - HAVE_DECL_ASINL=1; AC_SUBST([HAVE_DECL_ASINL]) - HAVE_DECL_ATANL=1; AC_SUBST([HAVE_DECL_ATANL]) - HAVE_DECL_CEILL=1; AC_SUBST([HAVE_DECL_CEILL]) - HAVE_DECL_COSL=1; AC_SUBST([HAVE_DECL_COSL]) - HAVE_DECL_EXPL=1; AC_SUBST([HAVE_DECL_EXPL]) - HAVE_DECL_FLOORL=1; AC_SUBST([HAVE_DECL_FLOORL]) - HAVE_DECL_FREXPL=1; AC_SUBST([HAVE_DECL_FREXPL]) - HAVE_DECL_LDEXPL=1; AC_SUBST([HAVE_DECL_LDEXPL]) - HAVE_DECL_LOGL=1; AC_SUBST([HAVE_DECL_LOGL]) - HAVE_DECL_SINL=1; AC_SUBST([HAVE_DECL_SINL]) - HAVE_DECL_SQRTL=1; AC_SUBST([HAVE_DECL_SQRTL]) - HAVE_DECL_TANL=1; AC_SUBST([HAVE_DECL_TANL]) - REPLACE_FREXP=0; AC_SUBST([REPLACE_FREXP]) - REPLACE_FREXPL=0; AC_SUBST([REPLACE_FREXPL]) - REPLACE_LDEXPL=0; AC_SUBST([REPLACE_LDEXPL]) - REPLACE_SIGNBIT=0; AC_SUBST([REPLACE_SIGNBIT]) + HAVE_DECL_ACOSL=1; AC_SUBST([HAVE_DECL_ACOSL]) + HAVE_DECL_ASINL=1; AC_SUBST([HAVE_DECL_ASINL]) + HAVE_DECL_ATANL=1; AC_SUBST([HAVE_DECL_ATANL]) + HAVE_DECL_COSL=1; AC_SUBST([HAVE_DECL_COSL]) + HAVE_DECL_EXPL=1; AC_SUBST([HAVE_DECL_EXPL]) + HAVE_DECL_FREXPL=1; AC_SUBST([HAVE_DECL_FREXPL]) + HAVE_DECL_LDEXPL=1; AC_SUBST([HAVE_DECL_LDEXPL]) + HAVE_DECL_LOGL=1; AC_SUBST([HAVE_DECL_LOGL]) + HAVE_DECL_SINL=1; AC_SUBST([HAVE_DECL_SINL]) + HAVE_DECL_SQRTL=1; AC_SUBST([HAVE_DECL_SQRTL]) + HAVE_DECL_TANL=1; AC_SUBST([HAVE_DECL_TANL]) + HAVE_DECL_TRUNC=1; AC_SUBST([HAVE_DECL_TRUNC]) + HAVE_DECL_TRUNCF=1; AC_SUBST([HAVE_DECL_TRUNCF]) + HAVE_DECL_TRUNCL=1; AC_SUBST([HAVE_DECL_TRUNCL]) + REPLACE_CEILF=0; AC_SUBST([REPLACE_CEILF]) + REPLACE_CEILL=0; AC_SUBST([REPLACE_CEILL]) + REPLACE_FLOORF=0; AC_SUBST([REPLACE_FLOORF]) + REPLACE_FLOORL=0; AC_SUBST([REPLACE_FLOORL]) + REPLACE_FREXP=0; AC_SUBST([REPLACE_FREXP]) + REPLACE_FREXPL=0; AC_SUBST([REPLACE_FREXPL]) + REPLACE_ISFINITE=0; AC_SUBST([REPLACE_ISFINITE]) + REPLACE_LDEXPL=0; AC_SUBST([REPLACE_LDEXPL]) + REPLACE_ROUND=0; AC_SUBST([REPLACE_ROUND]) + REPLACE_ROUNDF=0; AC_SUBST([REPLACE_ROUNDF]) + REPLACE_ROUNDL=0; AC_SUBST([REPLACE_ROUNDL]) + REPLACE_SIGNBIT=0; AC_SUBST([REPLACE_SIGNBIT]) + REPLACE_SIGNBIT_USING_GCC=0; AC_SUBST([REPLACE_SIGNBIT_USING_GCC]) ]) diff -ruNp m4-1.4.10/m4/memchr.m4 m4-1.4.11/m4/memchr.m4 --- m4-1.4.10/m4/memchr.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/m4/memchr.m4 2008-04-01 18:53:58.000000000 -0600 @@ -0,0 +1,18 @@ +# memchr.m4 serial 4 +dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_MEMCHR], +[ + AC_REPLACE_FUNCS(memchr) + if test $ac_cv_func_memchr = no; then + gl_PREREQ_MEMCHR + fi +]) + +# Prerequisites of lib/memchr.c. +AC_DEFUN([gl_PREREQ_MEMCHR], [ + AC_CHECK_HEADERS(bp-sym.h) +]) diff -ruNp m4-1.4.10/m4/memcmp.m4 m4-1.4.11/m4/memcmp.m4 --- m4-1.4.10/m4/memcmp.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/m4/memcmp.m4 2008-04-01 18:53:58.000000000 -0600 @@ -0,0 +1,19 @@ +# memcmp.m4 serial 12 +dnl Copyright (C) 2002, 2003, 2004, 2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_MEMCMP], +[ + AC_FUNC_MEMCMP + dnl Note: AC_FUNC_MEMCMP does AC_LIBOBJ(memcmp). + if test $ac_cv_func_memcmp_working = no; then + AC_DEFINE(memcmp, rpl_memcmp, + [Define to rpl_memcmp if the replacement function should be used.]) + gl_PREREQ_MEMCMP + fi +]) + +# Prerequisites of lib/memcmp.c. +AC_DEFUN([gl_PREREQ_MEMCMP], [:]) diff -ruNp m4-1.4.10/m4/nocrash.m4 m4-1.4.11/m4/nocrash.m4 --- m4-1.4.10/m4/nocrash.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/m4/nocrash.m4 2007-11-05 20:43:44.000000000 -0700 @@ -0,0 +1,102 @@ +# nocrash.m4 serial 1 +dnl Copyright (C) 2005 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl Based on libsigsegv, from Bruno Haible and Paolo Bonzini. + +AC_PREREQ(2.13) + +dnl Expands to some code for use in .c programs that will cause the configure +dnl test to exit instead of crashing. This is useful to avoid triggering +dnl action from a background debugger and to avoid core dumps. +dnl Usage: ... +dnl ]GL_NOCRASH[ +dnl ... +dnl int main() { nocrash_init(); ... } +AC_DEFUN([GL_NOCRASH],[[ +#include <stdlib.h> +#if defined __MACH__ && defined __APPLE__ +/* Avoid a crash on MacOS X. */ +#include <mach/mach.h> +#include <mach/mach_error.h> +#include <mach/thread_status.h> +#include <mach/exception.h> +#include <mach/task.h> +#include <pthread.h> +/* The exception port on which our thread listens. */ +static mach_port_t our_exception_port; +/* The main function of the thread listening for exceptions of type + EXC_BAD_ACCESS. */ +static void * +mach_exception_thread (void *arg) +{ + /* Buffer for a message to be received. */ + struct { + mach_msg_header_t head; + mach_msg_body_t msgh_body; + char data[1024]; + } msg; + mach_msg_return_t retval; + /* Wait for a message on the exception port. */ + retval = mach_msg (&msg.head, MACH_RCV_MSG | MACH_RCV_LARGE, 0, sizeof (msg), + our_exception_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + if (retval != MACH_MSG_SUCCESS) + abort (); + exit (1); +} +static void +nocrash_init (void) +{ + mach_port_t self = mach_task_self (); + /* Allocate a port on which the thread shall listen for exceptions. */ + if (mach_port_allocate (self, MACH_PORT_RIGHT_RECEIVE, &our_exception_port) + == KERN_SUCCESS) { + /* See http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/mach_port_insert_right.html. */ + if (mach_port_insert_right (self, our_exception_port, our_exception_port, + MACH_MSG_TYPE_MAKE_SEND) + == KERN_SUCCESS) { + /* The exceptions we want to catch. Only EXC_BAD_ACCESS is interesting + for us. */ + exception_mask_t mask = EXC_MASK_BAD_ACCESS; + /* Create the thread listening on the exception port. */ + pthread_attr_t attr; + pthread_t thread; + if (pthread_attr_init (&attr) == 0 + && pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED) == 0 + && pthread_create (&thread, &attr, mach_exception_thread, NULL) == 0) { + pthread_attr_destroy (&attr); + /* Replace the exception port info for these exceptions with our own. + Note that we replace the exception port for the entire task, not only + for a particular thread. This has the effect that when our exception + port gets the message, the thread specific exception port has already + been asked, and we don't need to bother about it. + See http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/task_set_exception_ports.html. */ + task_set_exception_ports (self, mask, our_exception_port, + EXCEPTION_DEFAULT, MACHINE_THREAD_STATE); + } + } + } +} +#else +/* Avoid a crash on POSIX systems. */ +#include <signal.h> +/* A POSIX signal handler. */ +static void +exception_handler (int sig) +{ + exit (1); +} +static void +nocrash_init (void) +{ +#ifdef SIGSEGV + signal (SIGSEGV, exception_handler); +#endif +#ifdef SIGBUS + signal (SIGBUS, exception_handler); +#endif +} +#endif +]]) diff -ruNp m4-1.4.10/m4/printf.m4 m4-1.4.11/m4/printf.m4 --- m4-1.4.10/m4/printf.m4 2007-07-05 05:48:43.000000000 -0600 +++ m4-1.4.11/m4/printf.m4 2008-02-07 22:02:44.000000000 -0700 @@ -1,5 +1,5 @@ -# printf.m4 serial 15 -dnl Copyright (C) 2003, 2007 Free Software Foundation, Inc. +# printf.m4 serial 22 +dnl Copyright (C) 2003, 2007-2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -95,7 +95,7 @@ AC_DEFUN([gl_PRINTF_LONG_DOUBLE], AC_TRY_RUN([ #include <stdio.h> #include <string.h> -static char buf[100]; +static char buf[10000]; int main () { buf[0] = '\0'; @@ -156,7 +156,7 @@ strisnan (const char *string, size_t sta } return 0; } -static char buf[100]; +static char buf[10000]; static double zero = 0.0; int main () { @@ -240,6 +240,7 @@ AC_DEFUN([gl_PRINTF_INFINITE_LONG_DOUBLE [gl_cv_func_printf_infinite_long_double], [ AC_TRY_RUN([ +]GL_NOCRASH[ #include <float.h> #include <stdio.h> #include <string.h> @@ -261,10 +262,11 @@ strisnan (const char *string, size_t sta } return 0; } -static char buf[100]; +static char buf[10000]; static long double zeroL = 0.0L; int main () { + nocrash_init(); if (sprintf (buf, "%Lf", 1.0L / 0.0L) < 0 || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) return 1; @@ -585,11 +587,16 @@ AC_DEFUN([gl_PRINTF_DIRECTIVE_N], AC_TRY_RUN([ #include <stdio.h> #include <string.h> +static char fmtstring[10]; static char buf[100]; int main () { int count = -1; - if (sprintf (buf, "%d %n", 123, &count, 33, 44, 55) < 0 + /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2) + support %n in format strings in read-only memory but not in writable + memory. */ + strcpy (fmtstring, "%d %n"); + if (sprintf (buf, fmtstring, 123, &count, 33, 44, 55) < 0 || strcmp (buf, "123 ") != 0 || count != 4) return 1; @@ -677,6 +684,47 @@ changequote([,])dnl ]) ]) +dnl Test whether the *printf family of functions supports the - flag correctly. +dnl (ISO C99.) See +dnl <http://lists.gnu.org/archive/html/bug-coreutils/2008-02/msg00035.html> +dnl Result is gl_cv_func_printf_flag_leftadjust. + +AC_DEFUN([gl_PRINTF_FLAG_LEFTADJUST], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CACHE_CHECK([whether printf supports the left-adjust flag correctly], + [gl_cv_func_printf_flag_leftadjust], + [ + AC_TRY_RUN([ +#include <stdio.h> +#include <string.h> +static char buf[100]; +int main () +{ + /* Check that a '-' flag is not annihilated by a negative width. */ + if (sprintf (buf, "a%-*sc", -3, "b") < 0 + || strcmp (buf, "ab c") != 0) + return 1; + return 0; +}], + [gl_cv_func_printf_flag_leftadjust=yes], + [gl_cv_func_printf_flag_leftadjust=no], + [ +changequote(,)dnl + case "$host_os" in + # Guess yes on HP-UX 11. + hpux11*) gl_cv_func_printf_flag_leftadjust="guessing yes";; + # Guess no on HP-UX 10 and older. + hpux*) gl_cv_func_printf_flag_leftadjust="guessing no";; + # Guess yes otherwise. + *) gl_cv_func_printf_flag_leftadjust="guessing yes";; + esac +changequote([,])dnl + ]) + ]) +]) + dnl Test whether the *printf family of functions supports padding of non-finite dnl values with the 0 flag correctly. (ISO C99 + TC1 + TC2.) See dnl <http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> @@ -716,6 +764,151 @@ changequote([,])dnl ]) ]) +dnl Test whether the *printf family of functions supports large precisions. +dnl On mingw, precisions larger than 512 are treated like 512, in integer, +dnl floating-point or pointer output. On BeOS, precisions larger than 1044 +dnl crash the program. +dnl Result is gl_cv_func_printf_precision. + +AC_DEFUN([gl_PRINTF_PRECISION], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CACHE_CHECK([whether printf supports large precisions], + [gl_cv_func_printf_precision], + [ + AC_TRY_RUN([ +#include <stdio.h> +#include <string.h> +static char buf[5000]; +int main () +{ +#ifdef __BEOS__ + /* On BeOS, this would crash and show a dialog box. Avoid the crash. */ + return 1; +#endif + if (sprintf (buf, "%.4000d %d", 1, 33, 44) < 4000 + 3) + return 1; + return 0; +}], [gl_cv_func_printf_precision=yes], [gl_cv_func_printf_precision=no], + [ +changequote(,)dnl + case "$host_os" in + # Guess no only on native Win32 and BeOS systems. + mingw* | pw*) gl_cv_func_printf_precision="guessing no" ;; + beos*) gl_cv_func_printf_precision="guessing no" ;; + *) gl_cv_func_printf_precision="guessing yes" ;; + esac +changequote([,])dnl + ]) + ]) +]) + +dnl Test whether the *printf family of functions recovers gracefully in case +dnl of an out-of-memory condition, or whether it crashes the entire program. +dnl Result is gl_cv_func_printf_enomem. + +AC_DEFUN([gl_PRINTF_ENOMEM], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CACHE_CHECK([whether printf survives out-of-memory conditions], + [gl_cv_func_printf_enomem], + [ + if test "$cross_compiling" = no; then + AC_LANG_CONFTEST([AC_LANG_SOURCE([ +]GL_NOCRASH[ +changequote(,)dnl +#include <stdio.h> +#include <sys/types.h> +#include <sys/time.h> +#include <sys/resource.h> +#include <errno.h> +int main() +{ + struct rlimit limit; + int ret; + nocrash_init (); + /* Some printf implementations allocate temporary space with malloc. */ + /* On BSD systems, malloc() is limited by RLIMIT_DATA. */ +#ifdef RLIMIT_DATA + if (getrlimit (RLIMIT_DATA, &limit) < 0) + return 77; + if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000) + limit.rlim_max = 5000000; + limit.rlim_cur = limit.rlim_max; + if (setrlimit (RLIMIT_DATA, &limit) < 0) + return 77; +#endif + /* On Linux systems, malloc() is limited by RLIMIT_AS. */ +#ifdef RLIMIT_AS + if (getrlimit (RLIMIT_AS, &limit) < 0) + return 77; + if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000) + limit.rlim_max = 5000000; + limit.rlim_cur = limit.rlim_max; + if (setrlimit (RLIMIT_AS, &limit) < 0) + return 77; +#endif + /* Some printf implementations allocate temporary space on the stack. */ +#ifdef RLIMIT_STACK + if (getrlimit (RLIMIT_STACK, &limit) < 0) + return 77; + if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000) + limit.rlim_max = 5000000; + limit.rlim_cur = limit.rlim_max; + if (setrlimit (RLIMIT_STACK, &limit) < 0) + return 77; +#endif + ret = printf ("%.5000000f", 1.0); + return !(ret == 5000002 || (ret < 0 && errno == ENOMEM)); +} +changequote([,])dnl + ])]) + if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then + (./conftest + result=$? + if test $result != 0 && test $result != 77; then result=1; fi + exit $result + ) >/dev/null 2>/dev/null + case $? in + 0) gl_cv_func_printf_enomem="yes" ;; + 77) gl_cv_func_printf_enomem="guessing no" ;; + *) gl_cv_func_printf_enomem="no" ;; + esac + else + gl_cv_func_printf_enomem="guessing no" + fi + rm -fr conftest* + else +changequote(,)dnl + case "$host_os" in + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_printf_enomem="guessing yes";; + # Guess yes on Solaris. + solaris*) gl_cv_func_printf_enomem="guessing yes";; + # Guess yes on AIX. + aix*) gl_cv_func_printf_enomem="guessing yes";; + # Guess yes on HP-UX/hppa. + hpux*) case "$host_cpu" in + hppa*) gl_cv_func_printf_enomem="guessing yes";; + *) gl_cv_func_printf_enomem="guessing no";; + esac + ;; + # Guess yes on IRIX. + irix*) gl_cv_func_printf_enomem="guessing yes";; + # Guess yes on OSF/1. + osf*) gl_cv_func_printf_enomem="guessing yes";; + # Guess yes on BeOS. + beos*) gl_cv_func_printf_enomem="guessing yes";; + # If we don't know, assume the worst. + *) gl_cv_func_printf_enomem="guessing no";; + esac +changequote([,])dnl + fi + ]) +]) + dnl Test whether the snprintf function exists. (ISO C99, POSIX:2001) dnl Result is ac_cv_func_snprintf. @@ -872,11 +1065,16 @@ AC_DEFUN([gl_SNPRINTF_DIRECTIVE_N], AC_TRY_RUN([ #include <stdio.h> #include <string.h> +static char fmtstring[10]; static char buf[100]; int main () { int count = -1; - snprintf (buf, 4, "%d %n", 12345, &count, 33, 44, 55); + /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2) + support %n in format strings in read-only memory but not in writable + memory. */ + strcpy (fmtstring, "%d %n"); + snprintf (buf, 4, fmtstring, 12345, &count, 33, 44, 55); if (count != 6) return 1; return 0; @@ -1028,12 +1226,15 @@ dnl 6 = gl_PRINTF_DIRECTIVE_F dnl 7 = gl_PRINTF_DIRECTIVE_N dnl 8 = gl_PRINTF_POSITIONS dnl 9 = gl_PRINTF_FLAG_GROUPING -dnl 10 = gl_PRINTF_FLAG_ZERO -dnl 11 = gl_SNPRINTF_PRESENCE -dnl 12 = gl_SNPRINTF_TRUNCATION_C99 -dnl 13 = gl_SNPRINTF_RETVAL_C99 -dnl 14 = gl_SNPRINTF_DIRECTIVE_N -dnl 15 = gl_VSNPRINTF_ZEROSIZE_C99 +dnl 10 = gl_PRINTF_FLAG_LEFTADJUST +dnl 11 = gl_PRINTF_FLAG_ZERO +dnl 12 = gl_PRINTF_PRECISION +dnl 13 = gl_PRINTF_ENOMEM +dnl 14 = gl_SNPRINTF_PRESENCE +dnl 15 = gl_SNPRINTF_TRUNCATION_C99 +dnl 16 = gl_SNPRINTF_RETVAL_C99 +dnl 17 = gl_SNPRINTF_DIRECTIVE_N +dnl 18 = gl_VSNPRINTF_ZEROSIZE_C99 dnl dnl 1 = checking whether printf supports size specifiers as in C99... dnl 2 = checking whether printf supports 'long double' arguments... @@ -1044,34 +1245,38 @@ dnl 6 = checking whether printf supports dnl 7 = checking whether printf supports the 'n' directive... dnl 8 = checking whether printf supports POSIX/XSI format strings with positions... dnl 9 = checking whether printf supports the grouping flag... -dnl 10 = checking whether printf supports the zero flag correctly... -dnl 11 = checking for snprintf... -dnl 12 = checking whether snprintf truncates the result as in C99... -dnl 13 = checking whether snprintf returns a byte count as in C99... -dnl 14 = checking whether snprintf fully supports the 'n' directive... -dnl 15 = checking whether vsnprintf respects a zero size as in C99... +dnl 10 = checking whether printf supports the left-adjust flag correctly... +dnl 11 = checking whether printf supports the zero flag correctly... +dnl 12 = checking whether printf supports large precisions... +dnl 13 = checking whether printf survives out-of-memory conditions... +dnl 14 = checking for snprintf... +dnl 15 = checking whether snprintf truncates the result as in C99... +dnl 16 = checking whether snprintf returns a byte count as in C99... +dnl 17 = checking whether snprintf fully supports the 'n' directive... +dnl 18 = checking whether vsnprintf respects a zero size as in C99... dnl dnl . = yes, # = no. dnl -dnl 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 -dnl glibc 2.5 . . . . . . . . . . . . . . . -dnl glibc 2.3.6 . . . . # . . . . . . . . . . -dnl FreeBSD 5.4, 6.1 . . . . # . . . . # . . . . . -dnl MacOS X 10.3.9 . . . . # . . . . # . . . . . -dnl OpenBSD 3.9, 4.0 . ? ? ? # ? . . ? ? . . . ? ? -dnl Cygwin 2007 (= Cygwin 1.5.24) . . . . # # . . . # . . . . . -dnl Cygwin 2006 (= Cygwin 1.5.19) # . . . # # . . # # . . . . . -dnl Solaris 10 . . # # # . . . . # . . . . . -dnl Solaris 2.6 ... 9 # . # # # # . . . # . . . . . -dnl Solaris 2.5.1 # . # # # # . . . # # # # # # -dnl AIX 5.2 . . # # # . . . . # . . . . . -dnl AIX 4.3.2, 5.1 # . # # # # . . . # . . . . . -dnl HP-UX 11.31 . . . . # . . . . # . . # # . -dnl HP-UX 10.20, 11.{00,11,23} # . . . # # . . . # . . # # # -dnl IRIX 6.5 # . # # # # . . . # . . # . . -dnl OSF/1 5.1 # . # # # # . . . # . . # . # -dnl OSF/1 4.0d # . # # # # . . . # # # # # # -dnl NetBSD 4.0 . ? ? ? ? ? . . ? ? . . . ? ? -dnl NetBSD 3.0 . . . . # # . # # # . . . . . -dnl BeOS # # . # # # . # . . . . . . . -dnl mingw # # # # # # . # # # . # # # . +dnl 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 +dnl glibc 2.5 . . . . . . . . . . . . . . . . . . +dnl glibc 2.3.6 . . . . # . . . . . . . . . . . . . +dnl FreeBSD 5.4, 6.1 . . . . # . . . . . # . # . . . . . +dnl MacOS X 10.3.9 . . . . # . . . . . # . # . . . . . +dnl OpenBSD 3.9, 4.0 . . # # # # . . # . # . # . . . . . +dnl Cygwin 2007 (= Cygwin 1.5.24) . . . . # # . . . ? # ? ? . . . . . +dnl Cygwin 2006 (= Cygwin 1.5.19) # . . . # # . . # ? # ? ? . . . . . +dnl Solaris 10 . . # # # . . . . . # . . . . . . . +dnl Solaris 2.6 ... 9 # . # # # # . . . . # . . . . . . . +dnl Solaris 2.5.1 # . # # # # . . . . # . . # # # # # +dnl AIX 5.2 . . # # # . . . . . # . . . . . . . +dnl AIX 4.3.2, 5.1 # . # # # # . . . . # . . . . . . . +dnl HP-UX 11.31 . . . . # . . . . . # . . . . # # . +dnl HP-UX 11.{00,11,23} # . . . # # . . . . # . . . . # # # +dnl HP-UX 10.20 # . . . # # . . . # # . . . . # # # +dnl IRIX 6.5 # . # # # # . . . . # . . . . # . . +dnl OSF/1 5.1 # . # # # # . . . . # . . . . # . # +dnl OSF/1 4.0d # . # # # # . . . . # . . # # # # # +dnl NetBSD 4.0 . ? ? ? ? ? . . ? ? ? ? ? . . . ? ? +dnl NetBSD 3.0 . . . . # # . # # ? # . # . . . . . +dnl BeOS # # . # # # . # . ? . # ? . . . . . +dnl mingw # # # # # # . # # . # # ? . # # # . diff -ruNp m4-1.4.10/m4/regex.m4 m4-1.4.11/m4/regex.m4 --- m4-1.4.10/m4/regex.m4 2007-07-05 05:48:43.000000000 -0600 +++ m4-1.4.11/m4/regex.m4 2008-03-23 21:14:34.000000000 -0600 @@ -1,7 +1,7 @@ -#serial 47 +#serial 49 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007 Free Software Foundation, Inc. +# 2006, 2007, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -215,8 +215,9 @@ AC_DEFUN([gl_REGEX], # Prerequisites of lib/regex.c and lib/regex_internal.c. AC_DEFUN([gl_PREREQ_REGEX], [ - AC_REQUIRE([AC_GNU_SOURCE]) + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) AC_REQUIRE([AC_C_RESTRICT]) + AC_REQUIRE([AC_TYPE_MBSTATE_T]) AC_CHECK_FUNCS_ONCE([isblank iswctype mbrtowc wcrtomb wcscoll]) AC_CHECK_DECLS([isblank], [], [], [#include <ctype.h>]) ]) diff -ruNp m4-1.4.10/m4/signalblocking.m4 m4-1.4.11/m4/signalblocking.m4 --- m4-1.4.10/m4/signalblocking.m4 2007-05-30 19:30:58.000000000 -0600 +++ m4-1.4.11/m4/signalblocking.m4 2007-10-09 06:16:55.000000000 -0600 @@ -1,4 +1,4 @@ -# signalblocking.m4 serial 5 +# signalblocking.m4 serial 6 dnl Copyright (C) 2001-2002, 2006-2007 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -24,7 +24,7 @@ AC_DEFUN([gl_SIGNALBLOCKING], fi ]) -# Prerequisites of the part of lib/signal_.h and of lib/sigprocmask.c. +# Prerequisites of the part of lib/signal.in.h and of lib/sigprocmask.c. AC_DEFUN([gl_PREREQ_SIGPROCMASK], [ AC_REQUIRE([gl_SIGNAL_H_DEFAULTS]) diff -ruNp m4-1.4.10/m4/signbit.m4 m4-1.4.11/m4/signbit.m4 --- m4-1.4.10/m4/signbit.m4 2007-05-30 19:30:58.000000000 -0600 +++ m4-1.4.11/m4/signbit.m4 2008-01-26 16:05:15.000000000 -0700 @@ -1,5 +1,5 @@ -# signbit.m4 serial 2 -dnl Copyright (C) 2007 Free Software Foundation, Inc. +# signbit.m4 serial 3 +dnl Copyright (C) 2007-2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -11,7 +11,119 @@ AC_DEFUN([gl_SIGNBIT], [ AC_TRY_RUN([ #include <math.h> +/* If signbit is defined as a function, don't use it, since calling it for + 'float' or 'long double' arguments would involve conversions. + If signbit is not declared at all but exists as a library function, don't + use it, since the prototype may not match. + If signbit is not declared at all but exists as a compiler built-in, don't + use it, since it's preferable to use __builtin_signbit* (no warnings, + no conversions). */ +#ifndef signbit +# error "signbit should be a macro" +#endif #include <string.h> +]gl_SIGNBIT_TEST_PROGRAM +, [gl_cv_func_signbit=yes], [gl_cv_func_signbit=no], + [gl_cv_func_signbit="guessing no"]) + ]) + dnl GCC 4.0 and newer provides three built-ins for signbit. + dnl They can be used without warnings, also in C++, regardless of <math.h>. + dnl But they may expand to calls to functions, which may or may not be in + dnl libc. + AC_CACHE_CHECK([for signbit compiler built-ins], [gl_cv_func_signbit_gcc], + [ + AC_TRY_RUN([ +#if __GNUC__ >= 4 +# define signbit(x) \ + (sizeof (x) == sizeof (long double) ? __builtin_signbitl (x) : \ + sizeof (x) == sizeof (double) ? __builtin_signbit (x) : \ + __builtin_signbitf (x)) +#else +# error "signbit should be three compiler built-ins" +#endif +#include <string.h> +]gl_SIGNBIT_TEST_PROGRAM +, [gl_cv_func_signbit_gcc=yes], [gl_cv_func_signbit_gcc=no], + [gl_cv_func_signbit_gcc="guessing no"]) + ]) + dnl Use the compiler built-ins whenever possible, because they are more + dnl efficient than the system library functions (if they exist). + if test "$gl_cv_func_signbit_gcc" = yes; then + REPLACE_SIGNBIT_USING_GCC=1 + else + if test "$gl_cv_func_signbit" != yes; then + REPLACE_SIGNBIT=1 + AC_LIBOBJ([signbitf]) + AC_LIBOBJ([signbitd]) + AC_LIBOBJ([signbitl]) + gl_FLOAT_SIGN_LOCATION + gl_DOUBLE_SIGN_LOCATION + gl_LONG_DOUBLE_SIGN_LOCATION + if test "$gl_cv_cc_float_signbit" = unknown; then + dnl Test whether copysignf() is declared. + AC_CHECK_DECLS([copysignf], , , [#include <math.h>]) + if test "$ac_cv_have_decl_copysignf" = yes; then + dnl Test whether copysignf() can be used without libm. + AC_CACHE_CHECK([whether copysignf can be used without linking with libm], + [gl_cv_func_copysignf_no_libm], + [ + AC_TRY_LINK([#include <math.h> + float x, y;], + [return copysignf (x, y) < 0;], + [gl_cv_func_copysignf_no_libm=yes], + [gl_cv_func_copysignf_no_libm=no]) + ]) + if test $gl_cv_func_copysignf_no_libm = yes; then + AC_DEFINE([HAVE_COPYSIGNF_IN_LIBC], 1, + [Define if the copysignf function is declared in <math.h> and available in libc.]) + fi + fi + fi + if test "$gl_cv_cc_double_signbit" = unknown; then + dnl Test whether copysign() is declared. + AC_CHECK_DECLS([copysign], , , [#include <math.h>]) + if test "$ac_cv_have_decl_copysign" = yes; then + dnl Test whether copysign() can be used without libm. + AC_CACHE_CHECK([whether copysign can be used without linking with libm], + [gl_cv_func_copysign_no_libm], + [ + AC_TRY_LINK([#include <math.h> + double x, y;], + [return copysign (x, y) < 0;], + [gl_cv_func_copysign_no_libm=yes], + [gl_cv_func_copysign_no_libm=no]) + ]) + if test $gl_cv_func_copysign_no_libm = yes; then + AC_DEFINE([HAVE_COPYSIGN_IN_LIBC], 1, + [Define if the copysign function is declared in <math.h> and available in libc.]) + fi + fi + fi + if test "$gl_cv_cc_long_double_signbit" = unknown; then + dnl Test whether copysignl() is declared. + AC_CHECK_DECLS([copysignl], , , [#include <math.h>]) + if test "$ac_cv_have_decl_copysignl" = yes; then + dnl Test whether copysignl() can be used without libm. + AC_CACHE_CHECK([whether copysignl can be used without linking with libm], + [gl_cv_func_copysignl_no_libm], + [ + AC_TRY_LINK([#include <math.h> + long double x, y;], + [return copysignl (x, y) < 0;], + [gl_cv_func_copysignl_no_libm=yes], + [gl_cv_func_copysignl_no_libm=no]) + ]) + if test $gl_cv_func_copysignl_no_libm = yes; then + AC_DEFINE([HAVE_COPYSIGNL_IN_LIBC], 1, + [Define if the copysignl function is declared in <math.h> and available in libc.]) + fi + fi + fi + fi + fi +]) + +AC_DEFUN([gl_SIGNBIT_TEST_PROGRAM], [ float p0f = 0.0f; float m0f = -0.0f; double p0d = 0.0; @@ -54,78 +166,7 @@ int main () return 1; } return 0; -}], [gl_cv_func_signbit=yes], [gl_cv_func_signbit=no], - [gl_cv_func_signbit="guessing no"]) - ]) - if test "$gl_cv_func_signbit" != yes; then - REPLACE_SIGNBIT=1 - AC_LIBOBJ([signbitf]) - AC_LIBOBJ([signbitd]) - AC_LIBOBJ([signbitl]) - gl_FLOAT_SIGN_LOCATION - gl_DOUBLE_SIGN_LOCATION - gl_LONG_DOUBLE_SIGN_LOCATION - if test "$gl_cv_cc_float_signbit" = unknown; then - dnl Test whether copysignf() is declared. - AC_CHECK_DECLS([copysignf], , , [#include <math.h>]) - if test "$ac_cv_have_decl_copysignf" = yes; then - dnl Test whether copysignf() can be used without libm. - AC_CACHE_CHECK([whether copysignf can be used without linking with libm], - [gl_cv_func_copysignf_no_libm], - [ - AC_TRY_LINK([#include <math.h> - float x, y;], - [return copysignf (x, y) < 0;], - [gl_cv_func_copysignf_no_libm=yes], - [gl_cv_func_copysignf_no_libm=no]) - ]) - if test $gl_cv_func_copysignf_no_libm = yes; then - AC_DEFINE([HAVE_COPYSIGNF_IN_LIBC], 1, - [Define if the copysignf function is declared in <math.h> and available in libc.]) - fi - fi - fi - if test "$gl_cv_cc_double_signbit" = unknown; then - dnl Test whether copysign() is declared. - AC_CHECK_DECLS([copysign], , , [#include <math.h>]) - if test "$ac_cv_have_decl_copysign" = yes; then - dnl Test whether copysign() can be used without libm. - AC_CACHE_CHECK([whether copysign can be used without linking with libm], - [gl_cv_func_copysign_no_libm], - [ - AC_TRY_LINK([#include <math.h> - double x, y;], - [return copysign (x, y) < 0;], - [gl_cv_func_copysign_no_libm=yes], - [gl_cv_func_copysign_no_libm=no]) - ]) - if test $gl_cv_func_copysign_no_libm = yes; then - AC_DEFINE([HAVE_COPYSIGN_IN_LIBC], 1, - [Define if the copysign function is declared in <math.h> and available in libc.]) - fi - fi - fi - if test "$gl_cv_cc_long_double_signbit" = unknown; then - dnl Test whether copysignl() is declared. - AC_CHECK_DECLS([copysignl], , , [#include <math.h>]) - if test "$ac_cv_have_decl_copysignl" = yes; then - dnl Test whether copysignl() can be used without libm. - AC_CACHE_CHECK([whether copysignl can be used without linking with libm], - [gl_cv_func_copysignl_no_libm], - [ - AC_TRY_LINK([#include <math.h> - long double x, y;], - [return copysignl (x, y) < 0;], - [gl_cv_func_copysignl_no_libm=yes], - [gl_cv_func_copysignl_no_libm=no]) - ]) - if test $gl_cv_func_copysignl_no_libm = yes; then - AC_DEFINE([HAVE_COPYSIGNL_IN_LIBC], 1, - [Define if the copysignl function is declared in <math.h> and available in libc.]) - fi - fi - fi - fi +} ]) AC_DEFUN([gl_FLOAT_SIGN_LOCATION], diff -ruNp m4-1.4.10/m4/stdarg.m4 m4-1.4.11/m4/stdarg.m4 --- m4-1.4.10/m4/stdarg.m4 2007-05-30 19:30:58.000000000 -0600 +++ m4-1.4.11/m4/stdarg.m4 2008-03-13 06:41:29.000000000 -0600 @@ -1,5 +1,5 @@ -# stdarg.m4 serial 1 -dnl Copyright (C) 2006 Free Software Foundation, Inc. +# stdarg.m4 serial 2 +dnl Copyright (C) 2006, 2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -9,6 +9,8 @@ dnl Provide a working va_copy in combina AC_DEFUN([gl_STDARG_H], [ + STDARG_H=''; AC_SUBST([STDARG_H]) + NEXT_STDARG_H='<stdarg.h>'; AC_SUBST([NEXT_STDARG_H]) AC_MSG_CHECKING([for va_copy]) AC_CACHE_VAL([gl_cv_func_va_copy], [ AC_TRY_COMPILE([#include <stdarg.h>], [ @@ -19,22 +21,47 @@ void (*func) (va_list, va_list) = va_cop [gl_cv_func_va_copy=yes], [gl_cv_func_va_copy=no])]) AC_MSG_RESULT([$gl_cv_func_va_copy]) if test $gl_cv_func_va_copy = no; then - # Provide a substitute, either __va_copy or as a simple assignment. - AC_CACHE_VAL([gl_cv_func___va_copy], [ - AC_TRY_COMPILE([#include <stdarg.h>], [ + dnl Provide a substitute. + dnl Usually a simple definition in <config.h> is enough. Not so on AIX 5 + dnl with some versions of the /usr/vac/bin/cc compiler. It has an <stdarg.h> + dnl which does '#undef va_copy', leading to a missing va_copy symbol. For + dnl this platform, we use an <stdarg.h> substitute. But we cannot use this + dnl approach on other platforms, because <stdarg.h> often defines only + dnl preprocessor macros and gl_ABSOLUTE_HEADER, gl_CHECK_NEXT_HEADERS do + dnl not work in this situation. + AC_EGREP_CPP([vaccine], + [#if defined _AIX && !defined __GNUC__ + AIX vaccine + #endif + ], [gl_aixcc=yes], [gl_aixcc=no]) + if test $gl_aixcc = yes; then + dnl Provide a substitute <stdarg.h> file. + STDARG_H=stdarg.h + gl_CHECK_NEXT_HEADERS([stdarg.h]) + dnl Fallback for the case when <stdarg.h> contains only macro definitions. + if test "$gl_cv_next_stdarg_h" = '""'; then + gl_cv_next_stdarg_h='"///usr/include/stdarg.h"' + NEXT_STDARG_H="$gl_cv_next_stdarg_h" + fi + else + dnl Provide a substitute in <config.h>, either __va_copy or as a simple + dnl assignment. + AC_CACHE_VAL([gl_cv_func___va_copy], [ + AC_TRY_COMPILE([#include <stdarg.h>], [ #ifndef __va_copy error, bail out #endif ], - [gl_cv_func___va_copy=yes], [gl_cv_func___va_copy=no])]) - if test $gl_cv_func___va_copy = yes; then - AC_DEFINE([va_copy], [__va_copy], - [Define as a macro for copying va_list variables.]) - else - AH_VERBATIM([gl_VA_COPY], [/* A replacement for va_copy, if needed. */ + [gl_cv_func___va_copy=yes], [gl_cv_func___va_copy=no])]) + if test $gl_cv_func___va_copy = yes; then + AC_DEFINE([va_copy], [__va_copy], + [Define as a macro for copying va_list variables.]) + else + AH_VERBATIM([gl_VA_COPY], [/* A replacement for va_copy, if needed. */ #define gl_va_copy(a,b) ((a) = (b))]) - AC_DEFINE([va_copy], [gl_va_copy], - [Define as a macro for copying va_list variables.]) + AC_DEFINE([va_copy], [gl_va_copy], + [Define as a macro for copying va_list variables.]) + fi fi fi ]) diff -ruNp m4-1.4.10/m4/stdint.m4 m4-1.4.11/m4/stdint.m4 --- m4-1.4.10/m4/stdint.m4 2007-07-05 05:48:46.000000000 -0600 +++ m4-1.4.11/m4/stdint.m4 2007-12-01 14:57:00.000000000 -0700 @@ -1,4 +1,4 @@ -# stdint.m4 serial 27 +# stdint.m4 serial 29 dnl Copyright (C) 2001-2007 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -59,12 +59,18 @@ AC_DEFUN([gl_STDINT_H], [gl_cv_header_working_stdint_h], [gl_cv_header_working_stdint_h=no AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([gl_STDINT_INCLUDES - [ + AC_LANG_PROGRAM([[ #define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */ #define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */ #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ #include <stdint.h> +/* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in <wchar.h>. */ +#if !(defined WCHAR_MIN && defined WCHAR_MAX) +#error "WCHAR_MIN, WCHAR_MAX not defined in <stdint.h>" +#endif +] +gl_STDINT_INCLUDES +[ #ifdef INT8_MAX int8_t a1 = INT8_MAX; int8_t a1min = INT8_MIN; @@ -364,7 +370,7 @@ AC_DEFUN([gl_STDINT_INCLUDES], dnl gl_STDINT_TYPE_PROPERTIES dnl Compute HAVE_SIGNED_t, BITSIZEOF_t and t_SUFFIX, for all the types t -dnl of interest to stdint_.h. +dnl of interest to stdint.in.h. AC_DEFUN([gl_STDINT_TYPE_PROPERTIES], [ gl_STDINT_BITSIZEOF([ptrdiff_t sig_atomic_t size_t wchar_t wint_t], diff -ruNp m4-1.4.10/m4/stdio_h.m4 m4-1.4.11/m4/stdio_h.m4 --- m4-1.4.10/m4/stdio_h.m4 2007-07-05 05:48:47.000000000 -0600 +++ m4-1.4.11/m4/stdio_h.m4 2007-12-11 19:26:17.000000000 -0700 @@ -1,4 +1,4 @@ -# stdio_h.m4 serial 7 +# stdio_h.m4 serial 9 dnl Copyright (C) 2007 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -28,11 +28,15 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS], GNULIB_VSNPRINTF=0; AC_SUBST([GNULIB_VSNPRINTF]) GNULIB_VSPRINTF_POSIX=0; AC_SUBST([GNULIB_VSPRINTF_POSIX]) GNULIB_VASPRINTF=0; AC_SUBST([GNULIB_VASPRINTF]) + GNULIB_FOPEN=0; AC_SUBST([GNULIB_FOPEN]) + GNULIB_FREOPEN=0; AC_SUBST([GNULIB_FREOPEN]) GNULIB_FSEEK=0; AC_SUBST([GNULIB_FSEEK]) GNULIB_FSEEKO=0; AC_SUBST([GNULIB_FSEEKO]) GNULIB_FTELL=0; AC_SUBST([GNULIB_FTELL]) GNULIB_FTELLO=0; AC_SUBST([GNULIB_FTELLO]) GNULIB_FFLUSH=0; AC_SUBST([GNULIB_FFLUSH]) + GNULIB_GETDELIM=0; AC_SUBST([GNULIB_GETDELIM]) + GNULIB_GETLINE=0; AC_SUBST([GNULIB_GETLINE]) dnl Assume proper GNU behavior unless another module says otherwise. REPLACE_FPRINTF=0; AC_SUBST([REPLACE_FPRINTF]) REPLACE_VFPRINTF=0; AC_SUBST([REPLACE_VFPRINTF]) @@ -46,6 +50,8 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS], REPLACE_VSPRINTF=0; AC_SUBST([REPLACE_VSPRINTF]) HAVE_VASPRINTF=1; AC_SUBST([HAVE_VASPRINTF]) REPLACE_VASPRINTF=0; AC_SUBST([REPLACE_VASPRINTF]) + REPLACE_FOPEN=0; AC_SUBST([REPLACE_FOPEN]) + REPLACE_FREOPEN=0; AC_SUBST([REPLACE_FREOPEN]) HAVE_FSEEKO=1; AC_SUBST([HAVE_FSEEKO]) REPLACE_FSEEKO=0; AC_SUBST([REPLACE_FSEEKO]) REPLACE_FSEEK=0; AC_SUBST([REPLACE_FSEEK]) @@ -53,6 +59,9 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS], REPLACE_FTELLO=0; AC_SUBST([REPLACE_FTELLO]) REPLACE_FTELL=0; AC_SUBST([REPLACE_FTELL]) REPLACE_FFLUSH=0; AC_SUBST([REPLACE_FFLUSH]) + HAVE_DECL_GETDELIM=1; AC_SUBST([HAVE_DECL_GETDELIM]) + HAVE_DECL_GETLINE=1; AC_SUBST([HAVE_DECL_GETLINE]) + REPLACE_GETLINE=0; AC_SUBST([REPLACE_GETLINE]) ]) dnl Code shared by fseeko and ftello. Determine if large files are supported, @@ -64,13 +73,12 @@ AC_DEFUN([gl_STDIN_LARGE_OFFSET], [AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <stdio.h>], [#if defined __SL64 && defined __SCLE /* cygwin */ /* Cygwin 1.5.24 and earlier fail to put stdin in 64-bit mode, making - fseeko/ftello needlessly fail. This bug was fixed at the same time - that cygwin started exporting asnprintf (cygwin 1.7.0), so we use - that as a link-time test for cross-compiles rather than building - a runtime test. */ - size_t s; - if (asnprintf (NULL, &s, "")) - return 0; + fseeko/ftello needlessly fail. This bug was fixed in 1.5.25, and + it is easier to do a version check than building a runtime test. */ +# include <cygwin/version.h> +# if CYGWIN_VERSION_DLL_COMBINED < CYGWIN_VERSION_DLL_MAKE_COMBINED (1005, 25) + choke me +# endif #endif])], [gl_cv_var_stdin_large_offset=yes], [gl_cv_var_stdin_large_offset=no])]) diff -ruNp m4-1.4.10/m4/stdlib_h.m4 m4-1.4.11/m4/stdlib_h.m4 --- m4-1.4.10/m4/stdlib_h.m4 2007-07-05 05:48:48.000000000 -0600 +++ m4-1.4.11/m4/stdlib_h.m4 2008-03-29 19:19:58.000000000 -0600 @@ -1,5 +1,5 @@ -# stdlib_h.m4 serial 2 -dnl Copyright (C) 2007 Free Software Foundation, Inc. +# stdlib_h.m4 serial 6 +dnl Copyright (C) 2007, 2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -19,11 +19,27 @@ AC_DEFUN([gl_STDLIB_MODULE_INDICATOR], AC_DEFUN([gl_STDLIB_H_DEFAULTS], [ - GNULIB_GETSUBOPT=0; AC_SUBST([GNULIB_GETSUBOPT]) - GNULIB_MKDTEMP=0; AC_SUBST([GNULIB_MKDTEMP]) - GNULIB_MKSTEMP=0; AC_SUBST([GNULIB_MKSTEMP]) + GNULIB_MALLOC_POSIX=0; AC_SUBST([GNULIB_MALLOC_POSIX]) + GNULIB_REALLOC_POSIX=0; AC_SUBST([GNULIB_REALLOC_POSIX]) + GNULIB_CALLOC_POSIX=0; AC_SUBST([GNULIB_CALLOC_POSIX]) + GNULIB_GETSUBOPT=0; AC_SUBST([GNULIB_GETSUBOPT]) + GNULIB_MKDTEMP=0; AC_SUBST([GNULIB_MKDTEMP]) + GNULIB_MKSTEMP=0; AC_SUBST([GNULIB_MKSTEMP]) + GNULIB_PUTENV=0; AC_SUBST([GNULIB_PUTENV]) + GNULIB_SETENV=0; AC_SUBST([GNULIB_SETENV]) + GNULIB_STRTOD=0; AC_SUBST([GNULIB_STRTOD]) + GNULIB_UNSETENV=0; AC_SUBST([GNULIB_UNSETENV]) dnl Assume proper GNU behavior unless another module says otherwise. - HAVE_GETSUBOPT=1; AC_SUBST([HAVE_GETSUBOPT]) - HAVE_MKDTEMP=1; AC_SUBST([HAVE_MKDTEMP]) - REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP]) + HAVE_CALLOC_POSIX=1; AC_SUBST([HAVE_CALLOC_POSIX]) + HAVE_GETSUBOPT=1; AC_SUBST([HAVE_GETSUBOPT]) + HAVE_MALLOC_POSIX=1; AC_SUBST([HAVE_MALLOC_POSIX]) + HAVE_MKDTEMP=1; AC_SUBST([HAVE_MKDTEMP]) + HAVE_REALLOC_POSIX=1; AC_SUBST([HAVE_REALLOC_POSIX]) + HAVE_SETENV=1; AC_SUBST([HAVE_SETENV]) + HAVE_STRTOD=1; AC_SUBST([HAVE_STRTOD]) + HAVE_UNSETENV=1; AC_SUBST([HAVE_UNSETENV]) + REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP]) + REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV]) + REPLACE_STRTOD=0; AC_SUBST([REPLACE_STRTOD]) + VOID_UNSETENV=0; AC_SUBST([VOID_UNSETENV]) ]) diff -ruNp m4-1.4.10/m4/strerror.m4 m4-1.4.11/m4/strerror.m4 --- m4-1.4.10/m4/strerror.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/m4/strerror.m4 2007-12-11 19:26:18.000000000 -0700 @@ -0,0 +1,47 @@ +# strerror.m4 serial 7 +dnl Copyright (C) 2002, 2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_STRERROR], +[ + AC_REQUIRE([gl_FUNC_STRERROR_SEPARATE]) + if test $gl_cv_func_working_strerror = no; then + AC_LIBOBJ([strerror]) + AC_DEFINE_UNQUOTED([REPLACE_STRERROR], [$REPLACE_STRERROR], + [Define this to 1 if strerror is broken.]) + fi +]) + +# Like gl_FUNC_STRERROR, except prepare for separate compilation (no AC_LIBOBJ). +AC_DEFUN([gl_FUNC_STRERROR_SEPARATE], +[ + AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) + AC_CACHE_CHECK([for working strerror function], + [gl_cv_func_working_strerror], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [#include <string.h> + ], + [return !*strerror (-2);])], + [gl_cv_func_working_strerror=yes], + [gl_cv_func_working_strerror=no], + [dnl Assume crossbuild works if it compiles. + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [#include <string.h> + ], + [return !*strerror (-2);])], + [gl_cv_func_working_strerror=yes], + [gl_cv_func_working_strerror=no])])]) + if test $gl_cv_func_working_strerror = no ; then + REPLACE_STRERROR=1 + gl_PREREQ_STRERROR + fi +]) + +# Prerequisites of lib/strerror.c. +AC_DEFUN([gl_PREREQ_STRERROR], [ + AC_CHECK_DECLS([strerror]) +]) diff -ruNp m4-1.4.10/m4/string_h.m4 m4-1.4.11/m4/string_h.m4 --- m4-1.4.10/m4/string_h.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/m4/string_h.m4 2008-01-14 22:04:51.000000000 -0700 @@ -0,0 +1,87 @@ +# Configure a GNU-like replacement for <string.h>. + +# Copyright (C) 2007, 2008 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +# Written by Paul Eggert. + +AC_DEFUN([gl_HEADER_STRING_H], +[ + dnl Use AC_REQUIRE here, so that the default behavior below is expanded + dnl once only, before all statements that occur in other macros. + AC_REQUIRE([gl_HEADER_STRING_H_BODY]) +]) + +AC_DEFUN([gl_HEADER_STRING_H_BODY], +[ + AC_REQUIRE([AC_C_RESTRICT]) + AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) + gl_CHECK_NEXT_HEADERS([string.h]) +]) + +AC_DEFUN([gl_STRING_MODULE_INDICATOR], +[ + dnl Use AC_REQUIRE here, so that the default settings are expanded once only. + AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) + GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 +]) + +AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS], +[ + GNULIB_MEMMEM=0; AC_SUBST([GNULIB_MEMMEM]) + GNULIB_MEMPCPY=0; AC_SUBST([GNULIB_MEMPCPY]) + GNULIB_MEMRCHR=0; AC_SUBST([GNULIB_MEMRCHR]) + GNULIB_STPCPY=0; AC_SUBST([GNULIB_STPCPY]) + GNULIB_STPNCPY=0; AC_SUBST([GNULIB_STPNCPY]) + GNULIB_STRCHRNUL=0; AC_SUBST([GNULIB_STRCHRNUL]) + GNULIB_STRDUP=0; AC_SUBST([GNULIB_STRDUP]) + GNULIB_STRNDUP=0; AC_SUBST([GNULIB_STRNDUP]) + GNULIB_STRNLEN=0; AC_SUBST([GNULIB_STRNLEN]) + GNULIB_STRPBRK=0; AC_SUBST([GNULIB_STRPBRK]) + GNULIB_STRSEP=0; AC_SUBST([GNULIB_STRSEP]) + GNULIB_STRSTR=0; AC_SUBST([GNULIB_STRSTR]) + GNULIB_STRCASESTR=0; AC_SUBST([GNULIB_STRCASESTR]) + GNULIB_STRTOK_R=0; AC_SUBST([GNULIB_STRTOK_R]) + GNULIB_MBSLEN=0; AC_SUBST([GNULIB_MBSLEN]) + GNULIB_MBSNLEN=0; AC_SUBST([GNULIB_MBSNLEN]) + GNULIB_MBSCHR=0; AC_SUBST([GNULIB_MBSCHR]) + GNULIB_MBSRCHR=0; AC_SUBST([GNULIB_MBSRCHR]) + GNULIB_MBSSTR=0; AC_SUBST([GNULIB_MBSSTR]) + GNULIB_MBSCASECMP=0; AC_SUBST([GNULIB_MBSCASECMP]) + GNULIB_MBSNCASECMP=0; AC_SUBST([GNULIB_MBSNCASECMP]) + GNULIB_MBSPCASECMP=0; AC_SUBST([GNULIB_MBSPCASECMP]) + GNULIB_MBSCASESTR=0; AC_SUBST([GNULIB_MBSCASESTR]) + GNULIB_MBSCSPN=0; AC_SUBST([GNULIB_MBSCSPN]) + GNULIB_MBSPBRK=0; AC_SUBST([GNULIB_MBSPBRK]) + GNULIB_MBSSPN=0; AC_SUBST([GNULIB_MBSSPN]) + GNULIB_MBSSEP=0; AC_SUBST([GNULIB_MBSSEP]) + GNULIB_MBSTOK_R=0; AC_SUBST([GNULIB_MBSTOK_R]) + GNULIB_STRERROR=0; AC_SUBST([GNULIB_STRERROR]) + GNULIB_STRSIGNAL=0; AC_SUBST([GNULIB_STRSIGNAL]) + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM]) + HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY]) + HAVE_DECL_MEMRCHR=1; AC_SUBST([HAVE_DECL_MEMRCHR]) + HAVE_STPCPY=1; AC_SUBST([HAVE_STPCPY]) + HAVE_STPNCPY=1; AC_SUBST([HAVE_STPNCPY]) + HAVE_STRCHRNUL=1; AC_SUBST([HAVE_STRCHRNUL]) + HAVE_DECL_STRDUP=1; AC_SUBST([HAVE_DECL_STRDUP]) + HAVE_STRNDUP=1; AC_SUBST([HAVE_STRNDUP]) + HAVE_DECL_STRNDUP=1; AC_SUBST([HAVE_DECL_STRNDUP]) + HAVE_DECL_STRNLEN=1; AC_SUBST([HAVE_DECL_STRNLEN]) + HAVE_STRPBRK=1; AC_SUBST([HAVE_STRPBRK]) + HAVE_STRSEP=1; AC_SUBST([HAVE_STRSEP]) + HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR]) + HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R]) + HAVE_DECL_STRERROR=1; AC_SUBST([HAVE_DECL_STRERROR]) + HAVE_DECL_STRSIGNAL=1; AC_SUBST([HAVE_DECL_STRSIGNAL]) + REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR]) + REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL]) + REPLACE_MEMMEM=0; AC_SUBST([REPLACE_MEMMEM]) + REPLACE_STRCASESTR=0; AC_SUBST([REPLACE_STRCASESTR]) + REPLACE_STRSTR=0; AC_SUBST([REPLACE_STRSTR]) +]) diff -ruNp m4-1.4.10/m4/strstr.m4 m4-1.4.11/m4/strstr.m4 --- m4-1.4.10/m4/strstr.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/m4/strstr.m4 2008-04-01 18:53:58.000000000 -0600 @@ -0,0 +1,44 @@ +# strstr.m4 serial 1 +dnl Copyright (C) 2008 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl Check that strstr is efficient. +AC_DEFUN([gl_FUNC_STRSTR], +[ + AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) + AC_CACHE_CHECK([whether strstr works in linear time], + [gl_cv_func_strstr_linear], + [AC_RUN_IFELSE([AC_LANG_PROGRAM([ +#include <string.h> /* for memmem */ +#include <stdlib.h> /* for malloc */ +#include <unistd.h> /* for alarm */ +], [[size_t m = 1000000; + char *haystack = (char *) malloc (2 * m + 2); + char *needle = (char *) malloc (m + 2); + void *result = 0; + /* Failure to compile this test due to missing alarm is okay, + since all such platforms (mingw) also have quadratic strstr. */ + alarm (5); + /* Check for quadratic performance. */ + if (haystack && needle) + { + memset (haystack, 'A', 2 * m); + haystack[2 * m] = 'B'; + haystack[2 * m + 1] = 0; + memset (needle, 'A', m); + needle[m] = 'B'; + needle[m + 1] = 0; + result = strstr (haystack, needle); + } + return !result;]])], + [gl_cv_func_strstr_linear=yes], [gl_cv_func_strstr_linear=no], + [dnl pessimistically assume the worst, since even glibc 2.6.1 + dnl has quadratic complexity in its strstr + gl_cv_func_strstr_linear="guessing no"])]) + if test "$gl_cv_func_strstr_linear" != yes; then + REPLACE_STRSTR=1 + AC_LIBOBJ([strstr]) + fi +]) # gl_FUNC_STRSTR diff -ruNp m4-1.4.10/m4/strtod.m4 m4-1.4.11/m4/strtod.m4 --- m4-1.4.10/m4/strtod.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/m4/strtod.m4 2008-03-29 19:19:58.000000000 -0600 @@ -0,0 +1,54 @@ +# strtod.m4 serial 7 +dnl Copyright (C) 2002, 2003, 2006, 2007, 2008 Free Software +dnl Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_STRTOD], +[ + AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) + AC_FUNC_STRTOD + dnl Note: AC_FUNC_STRTOD does AC_LIBOBJ(strtod). + if test $ac_cv_func_strtod = no; then + HAVE_STRTOD=0 + REPLACE_STRTOD=1 + gl_PREREQ_STRTOD + else + AC_CACHE_CHECK([whether strtod obeys C99], [gl_cv_func_strtod_works], + [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ +#include <stdlib.h> +#include <math.h> +]], [[ + { + /* Older glibc and Cygwin mis-parse "-0x". */ + char *string = "-0x"; + char *term; + double value = strtod (string, &term); + if (1 / value != -HUGE_VAL || term != (string + 2)) + return 1; + } + { + /* Many platforms do not parse infinities. */ + char *string = "inf"; + char *term; + double value = strtod (string, &term); + if (value != HUGE_VAL || term != (string + 3)) + return 1; + } +]])], + [gl_cv_func_strtod_works=yes], + [gl_cv_func_strtod_works=no], + [gl_cv_func_strtod_works="guessing no"])]) + if test "$gl_cv_func_strtod_works" != yes; then + REPLACE_STRTOD=1 + gl_PREREQ_STRTOD + dnl Use undocumented macro to set POW_LIB correctly. + _AC_LIBOBJ_STRTOD + fi + fi +]) + +# Prerequisites of lib/strtod.c. +# The need for pow() is already handled by AC_FUNC_STRTOD. +AC_DEFUN([gl_PREREQ_STRTOD], [:]) diff -ruNp m4-1.4.10/m4/ulonglong.m4 m4-1.4.11/m4/ulonglong.m4 --- m4-1.4.10/m4/ulonglong.m4 2007-05-30 19:31:01.000000000 -0600 +++ m4-1.4.11/m4/ulonglong.m4 1969-12-31 17:00:00.000000000 -0700 @@ -1,48 +0,0 @@ -# ulonglong.m4 serial 6 -dnl Copyright (C) 1999-2006 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl From Paul Eggert. - -# Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works. -# This fixes a bug in Autoconf 2.60, but can be removed once we -# assume 2.61 everywhere. - -# Note: If the type 'unsigned long long int' exists but is only 32 bits -# large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT -# will not be defined. In this case you can treat 'unsigned long long int' -# like 'unsigned long int'. - -AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT], -[ - AC_CACHE_CHECK([for unsigned long long int], - [ac_cv_type_unsigned_long_long_int], - [AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[unsigned long long int ull = 18446744073709551615ULL; - typedef int a[(18446744073709551615ULL <= (unsigned long long int) -1 - ? 1 : -1)]; - int i = 63;]], - [[unsigned long long int ullmax = 18446744073709551615ull; - return (ull << 63 | ull >> 63 | ull << i | ull >> i - | ullmax / ull | ullmax % ull);]])], - [ac_cv_type_unsigned_long_long_int=yes], - [ac_cv_type_unsigned_long_long_int=no])]) - if test $ac_cv_type_unsigned_long_long_int = yes; then - AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], 1, - [Define to 1 if the system has the type `unsigned long long int'.]) - fi -]) - -# This macro is obsolescent and should go away soon. -AC_DEFUN([gl_AC_TYPE_UNSIGNED_LONG_LONG], -[ - AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT]) - ac_cv_type_unsigned_long_long=$ac_cv_type_unsigned_long_long_int - if test $ac_cv_type_unsigned_long_long = yes; then - AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1, - [Define if you have the 'unsigned long long' type.]) - fi -]) diff -ruNp m4-1.4.10/m4/unistd_h.m4 m4-1.4.11/m4/unistd_h.m4 --- m4-1.4.10/m4/unistd_h.m4 2007-07-05 05:48:50.000000000 -0600 +++ m4-1.4.11/m4/unistd_h.m4 2008-03-01 09:06:05.000000000 -0700 @@ -1,5 +1,5 @@ -# unistd_h.m4 serial 9 -dnl Copyright (C) 2006-2007 Free Software Foundation, Inc. +# unistd_h.m4 serial 11 +dnl Copyright (C) 2006-2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -34,10 +34,12 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], [ GNULIB_CHOWN=0; AC_SUBST([GNULIB_CHOWN]) GNULIB_DUP2=0; AC_SUBST([GNULIB_DUP2]) + GNULIB_ENVIRON=0; AC_SUBST([GNULIB_ENVIRON]) GNULIB_FCHDIR=0; AC_SUBST([GNULIB_FCHDIR]) GNULIB_FTRUNCATE=0; AC_SUBST([GNULIB_FTRUNCATE]) GNULIB_GETCWD=0; AC_SUBST([GNULIB_GETCWD]) GNULIB_GETLOGIN_R=0; AC_SUBST([GNULIB_GETLOGIN_R]) + GNULIB_GETPAGESIZE=0; AC_SUBST([GNULIB_GETPAGESIZE]) GNULIB_LCHOWN=0; AC_SUBST([GNULIB_LCHOWN]) GNULIB_LSEEK=0; AC_SUBST([GNULIB_LSEEK]) GNULIB_READLINK=0; AC_SUBST([GNULIB_READLINK]) @@ -45,12 +47,17 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], dnl Assume proper GNU behavior unless another module says otherwise. HAVE_DUP2=1; AC_SUBST([HAVE_DUP2]) HAVE_FTRUNCATE=1; AC_SUBST([HAVE_FTRUNCATE]) + HAVE_GETPAGESIZE=1; AC_SUBST([HAVE_GETPAGESIZE]) HAVE_READLINK=1; AC_SUBST([HAVE_READLINK]) HAVE_SLEEP=1; AC_SUBST([HAVE_SLEEP]) + HAVE_DECL_ENVIRON=1; AC_SUBST([HAVE_DECL_ENVIRON]) HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R]) + HAVE_OS_H=0; AC_SUBST([HAVE_OS_H]) + HAVE_SYS_PARAM_H=0; AC_SUBST([HAVE_SYS_PARAM_H]) REPLACE_CHOWN=0; AC_SUBST([REPLACE_CHOWN]) REPLACE_FCHDIR=0; AC_SUBST([REPLACE_FCHDIR]) REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD]) + REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE]) REPLACE_LCHOWN=0; AC_SUBST([REPLACE_LCHOWN]) REPLACE_LSEEK=0; AC_SUBST([REPLACE_LSEEK]) ]) diff -ruNp m4-1.4.10/m4/vasnprintf.m4 m4-1.4.11/m4/vasnprintf.m4 --- m4-1.4.10/m4/vasnprintf.m4 2007-07-05 05:48:50.000000000 -0600 +++ m4-1.4.11/m4/vasnprintf.m4 2008-03-30 16:07:28.000000000 -0600 @@ -1,12 +1,11 @@ -# vasnprintf.m4 serial 20 -dnl Copyright (C) 2002-2004, 2006-2007 Free Software Foundation, Inc. +# vasnprintf.m4 serial 25 +dnl Copyright (C) 2002-2004, 2006-2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_VASNPRINTF], [ - AC_REQUIRE([gl_EOVERFLOW]) AC_CHECK_FUNCS_ONCE([vasnprintf]) if test $ac_cv_func_vasnprintf = no; then gl_REPLACE_VASNPRINTF @@ -45,7 +44,10 @@ AC_DEFUN([gl_PREREQ_PRINTF_PARSE], AC_REQUIRE([gt_TYPE_WCHAR_T]) AC_REQUIRE([gt_TYPE_WINT_T]) AC_REQUIRE([AC_TYPE_SIZE_T]) - AC_CHECK_TYPES(ptrdiff_t) + AC_CHECK_TYPE([ptrdiff_t], , + [AC_DEFINE([ptrdiff_t], [long], + [Define as the type of the result of subtracting two pointers, if the system doesn't define it.]) + ]) AC_REQUIRE([gt_AC_TYPE_INTMAX_T]) ]) @@ -163,6 +165,21 @@ AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_GROU esac ]) +# Extra prerequisites of lib/vasnprintf.c for supporting the '-' flag. +AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST], +[ + AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST]) + case "$gl_cv_func_printf_flag_leftadjust" in + *yes) + ;; + *) + AC_DEFINE([NEED_PRINTF_FLAG_LEFTADJUST], 1, + [Define if the vasnprintf implementation needs special code for the + '-' flag.]) + ;; + esac +]) + # Extra prerequisites of lib/vasnprintf.c for supporting the 0 flag. AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_ZERO], [ @@ -178,6 +195,49 @@ AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_ZERO esac ]) +# Extra prerequisites of lib/vasnprintf.c for supporting large precisions. +AC_DEFUN([gl_PREREQ_VASNPRINTF_PRECISION], +[ + AC_REQUIRE([gl_PRINTF_PRECISION]) + case "$gl_cv_func_printf_precision" in + *yes) + ;; + *) + AC_DEFINE([NEED_PRINTF_UNBOUNDED_PRECISION], 1, + [Define if the vasnprintf implementation needs special code for + supporting large precisions without arbitrary bounds.]) + AC_DEFINE([NEED_PRINTF_DOUBLE], 1, + [Define if the vasnprintf implementation needs special code for + 'double' arguments.]) + AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], 1, + [Define if the vasnprintf implementation needs special code for + 'long double' arguments.]) + ;; + esac +]) + +# Extra prerequisites of lib/vasnprintf.c for surviving out-of-memory +# conditions. +AC_DEFUN([gl_PREREQ_VASNPRINTF_ENOMEM], +[ + AC_REQUIRE([gl_PRINTF_ENOMEM]) + case "$gl_cv_func_printf_enomem" in + *yes) + ;; + *) + AC_DEFINE([NEED_PRINTF_ENOMEM], 1, + [Define if the vasnprintf implementation needs special code for + surviving out-of-memory conditions.]) + AC_DEFINE([NEED_PRINTF_DOUBLE], 1, + [Define if the vasnprintf implementation needs special code for + 'double' arguments.]) + AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], 1, + [Define if the vasnprintf implementation needs special code for + 'long double' arguments.]) + ;; + esac +]) + # Prerequisites of lib/vasnprintf.c including all extras for POSIX compliance. AC_DEFUN([gl_PREREQ_VASNPRINTF_WITH_EXTRAS], [ @@ -188,7 +248,10 @@ AC_DEFUN([gl_PREREQ_VASNPRINTF_WITH_EXTR gl_PREREQ_VASNPRINTF_DIRECTIVE_A gl_PREREQ_VASNPRINTF_DIRECTIVE_F gl_PREREQ_VASNPRINTF_FLAG_GROUPING + gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST gl_PREREQ_VASNPRINTF_FLAG_ZERO + gl_PREREQ_VASNPRINTF_PRECISION + gl_PREREQ_VASNPRINTF_ENOMEM ]) # Prerequisites of lib/asnprintf.c. diff -ruNp m4-1.4.10/m4/vasprintf-posix.m4 m4-1.4.11/m4/vasprintf-posix.m4 --- m4-1.4.10/m4/vasprintf-posix.m4 2007-05-30 19:31:02.000000000 -0600 +++ m4-1.4.11/m4/vasprintf-posix.m4 2008-03-30 16:07:28.000000000 -0600 @@ -1,12 +1,11 @@ -# vasprintf-posix.m4 serial 8 -dnl Copyright (C) 2007 Free Software Foundation, Inc. +# vasprintf-posix.m4 serial 12 +dnl Copyright (C) 2007-2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_VASPRINTF_POSIX], [ - AC_REQUIRE([gl_EOVERFLOW]) AC_REQUIRE([gl_PRINTF_SIZES_C99]) AC_REQUIRE([gl_PRINTF_LONG_DOUBLE]) AC_REQUIRE([gl_PRINTF_INFINITE]) @@ -16,7 +15,10 @@ AC_DEFUN([gl_FUNC_VASPRINTF_POSIX], AC_REQUIRE([gl_PRINTF_DIRECTIVE_N]) AC_REQUIRE([gl_PRINTF_POSITIONS]) AC_REQUIRE([gl_PRINTF_FLAG_GROUPING]) + AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST]) AC_REQUIRE([gl_PRINTF_FLAG_ZERO]) + AC_REQUIRE([gl_PRINTF_PRECISION]) + AC_REQUIRE([gl_PRINTF_ENOMEM]) gl_cv_func_vasprintf_posix=no AC_CHECK_FUNCS([vasprintf]) case "$gl_cv_func_printf_sizes_c99" in @@ -37,13 +39,25 @@ AC_DEFUN([gl_FUNC_VASPRINTF_POSIX], *yes) case "$gl_cv_func_printf_flag_grouping" in *yes) - case "$gl_cv_func_printf_flag_zero" in + case "$gl_cv_func_printf_flag_leftadjust" in *yes) - if test $ac_cv_func_vasprintf = yes; then - # vasprintf exists and is already - # POSIX compliant. - gl_cv_func_vasprintf_posix=yes - fi + case "$gl_cv_func_printf_flag_zero" in + *yes) + case "$gl_cv_func_printf_precision" in + *yes) + case "$gl_cv_func_printf_enomem" in + *yes) + if test $ac_cv_func_vasprintf = yes; then + # vasprintf exists and is + # already POSIX compliant. + gl_cv_func_vasprintf_posix=yes + fi + ;; + esac + ;; + esac + ;; + esac ;; esac ;; @@ -71,7 +85,10 @@ AC_DEFUN([gl_FUNC_VASPRINTF_POSIX], gl_PREREQ_VASNPRINTF_DIRECTIVE_A gl_PREREQ_VASNPRINTF_DIRECTIVE_F gl_PREREQ_VASNPRINTF_FLAG_GROUPING + gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST gl_PREREQ_VASNPRINTF_FLAG_ZERO + gl_PREREQ_VASNPRINTF_PRECISION + gl_PREREQ_VASNPRINTF_ENOMEM gl_REPLACE_VASNPRINTF gl_REPLACE_VASPRINTF fi diff -ruNp m4-1.4.10/m4/vasprintf.m4 m4-1.4.11/m4/vasprintf.m4 --- m4-1.4.10/m4/vasprintf.m4 2007-05-30 19:31:02.000000000 -0600 +++ m4-1.4.11/m4/vasprintf.m4 2007-10-09 06:16:58.000000000 -0600 @@ -1,4 +1,4 @@ -# vasprintf.m4 serial 5 +# vasprintf.m4 serial 6 dnl Copyright (C) 2002-2003, 2006-2007 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -31,7 +31,7 @@ AC_DEFUN([gl_REPLACE_VASPRINTF], AC_DEFUN([gl_PREREQ_VASPRINTF_H], [ dnl Persuade glibc <stdio.h> to declare asprintf() and vasprintf(). - AC_REQUIRE([AC_GNU_SOURCE]) + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) ]) # Prerequisites of lib/vasprintf.c. diff -ruNp m4-1.4.10/m4/wint_t.m4 m4-1.4.11/m4/wint_t.m4 --- m4-1.4.10/m4/wint_t.m4 2007-05-30 19:31:03.000000000 -0600 +++ m4-1.4.11/m4/wint_t.m4 2007-11-10 16:24:31.000000000 -0700 @@ -1,4 +1,4 @@ -# wint_t.m4 serial 2 (gettext-0.16.2) +# wint_t.m4 serial 2 (gettext-0.17) dnl Copyright (C) 2003, 2007 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, diff -ruNp m4-1.4.10/maint.mk m4-1.4.11/maint.mk --- m4-1.4.10/maint.mk 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/maint.mk 2008-04-02 06:10:58.000000000 -0600 @@ -0,0 +1,222 @@ +## maint.mk -- Makefile rules for m4 maintainers -*-Makefile-*- +## +## Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation +## +## This file is part of GNU M4. +## +## GNU M4 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. +## +## GNU M4 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/>. + +# This is reported not to work with make-3.79.1 +# ME := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) +ME := maint.mk + +# Do not save the original name or timestamp in the .tar.gz file. +# Use --rsyncable if available. +gzip_rsyncable := \ + $(shell gzip --help 2>/dev/null|grep rsyncable >/dev/null && echo --rsyncable) +GZIP_ENV = '--no-name --best $(gzip_rsyncable)' + +GIT = git +VC = $(GIT) +VC-tag = git tag -s -m '$(VERSION)' -u $(gpg_key_ID) + +VERSION_REGEXP = $(subst .,\.,$(VERSION)) +my_distdir = $(PACKAGE)-$(VERSION) + +# Ensure that we use only the standard $(VAR) notation, +# not @...@ in Makefile.am, now that we can rely on automake +# to emit a definition for each substituted variable. +makefile-check: + grep -nE '@[A-Z_0-9]+@' `find $(srcdir) -name Makefile.am` \ + && { echo '$(ME): use $$(...), not @...@' 1>&2; exit 1; } || : + +news-date-check: NEWS version-check + today=`date +%Y-%m-%d`; \ + if head $(srcdir)/NEWS | grep '^\*.* $(VERSION_REGEXP) ('$$today')' \ + >/dev/null; then \ + :; \ + else \ + echo "version or today's date is not in NEWS" 1>&2; \ + exit 1; \ + fi + +changelog-check: + if head $(srcdir)/ChangeLog | grep 'Version $(VERSION_REGEXP)\.$$' \ + >/dev/null; then \ + :; \ + else \ + echo "$(VERSION) not in ChangeLog" 1>&2; \ + exit 1; \ + fi + +m4-check: + @grep -n 'AC_DEFUN([^[]' $(srcdir)/m4/*.m4 \ + && { echo '$(ME): quote the first arg to AC_DEFUN' 1>&2; \ + exit 1; } || : + +vc-diff-check: + (CDPATH=; cd $(srcdir) && $(VC) diff) > vc-diffs || : + if test -s vc-diffs; then \ + cat vc-diffs; \ + echo "Some files are locally modified:" 1>&2; \ + exit 1; \ + else \ + rm vc-diffs; \ + fi + +maintainer-distcheck: + $(MAKE) distcheck + $(MAKE) my-distcheck + +# Don't make a distribution if checks fail. +# Also, make sure the NEWS file is up-to-date. +vc-dist: $(local-check) vc-diff-check maintainer-distcheck + $(MAKE) dist + +# Use this to make sure we don't run these programs when building +# from a virgin tgz file, below. +null_AM_MAKEFLAGS = \ + ACLOCAL=false \ + AUTOCONF=false \ + AUTOMAKE=false \ + AUTOHEADER=false \ + MAKEINFO=false + +# Use -Wformat -Werror to detect format-string/arg-list mismatches. +# Also, check for shadowing problems with -Wshadow, and for pointer +# arithmetic problems with -Wpointer-arith. +# These CFLAGS are pretty strict. If you build this target, you probably +# have to have a recent version of gcc and glibc headers. +TMPDIR ?= /tmp +t=$(TMPDIR)/$(PACKAGE)/test +my-distcheck: $(local-check) check + -rm -rf $(t) + mkdir -p $(t) + GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz + cd $(t)/$(distdir) \ + && ./configure \ + && $(MAKE) CFLAGS='$(warn_cflags)' \ + AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)' \ + && $(MAKE) dvi \ + && $(MAKE) check \ + && $(MAKE) distclean + (cd $(t) && mv $(distdir) $(distdir).old \ + && $(AMTAR) -zxf - ) < $(distdir).tar.gz + diff -ur $(t)/$(distdir).old $(t)/$(distdir) + -rm -rf $(t) + @echo "========================"; \ + echo "$(distdir).tar.gz is ready for distribution"; \ + echo "========================" + +gnulib-version = $$(cd $(gnulib_dir) && git describe) + +announcement: NEWS ChangeLog $(rel-files) + @$(srcdir)/build-aux/announce-gen \ + --release-type=$(RELEASE_TYPE) \ + --package=$(PACKAGE) \ + --prev=$(PREV_VERSION) \ + --curr=$(VERSION) \ + --gpg-key-id=$(gpg_key_ID) \ + --news=$(srcdir)/NEWS \ + --bootstrap-tools=autoconf,automake,gnulib \ + --gnulib-version=$(gnulib-version) \ + $(addprefix --url-dir=, $(url_dir_list)) + +.PHONY: alpha beta major +alpha beta major: $(local-check) version-check + test $@ = major \ + && { echo $(VERSION) | grep -E '^[0-9]+(\.[0-9]+)+$$' \ + || { echo "invalid version string: $(VERSION)" 1>&2; exit 1;};}\ + || : + $(MAKE) vc-dist + $(MAKE) news-date-check changelog-check + $(MAKE) deltas + $(MAKE) -s announcement RELEASE_TYPE=$@ > /tmp/announce-$(my_distdir) + +.PHONY: version-check +version-check: + @case $(VERSION) in \ + *[acegikmoqsuwy]) \ + echo "Version \`$(VERSION)' is not a releasable version, please read:"; \ + echo " http://www.gnu.org/software/libtool/contribute.html"; \ + exit 1; \ + ;; \ + esac + @if test -z "$(PREV_VERSION)"; \ + then echo "PREV_VERSION is not set"; exit 1; fi + +.PHONY: prev-tarball +prev-tarball: version-check +## Make sure we have the previous release tarball in the tree. + @ofile="$(PACKAGE)-$(PREV_VERSION).tar.gz"; \ + if test -f $$ofile; then :; \ + else echo "Cannot make deltas without $$ofile"; exit 1; fi + +.PHONY: new-tarball +new-tarball: +## Make sure we have the new release tarball in the tree. + @ofile="$(PACKAGE)-$(VERSION).tar.gz"; \ + if test -f $$ofile; then :; \ + else echo "Cannot make deltas without $$ofile"; exit 1; fi + +.PHONY: got-xdelta +got-xdelta: +## Make sure xdelta exists; + @if ($(XDELTA) --version 2>&1 | grep version)>/dev/null 2>/dev/null; \ + then :;\ + else \ + echo "Get xdelta from http://sourceforge.net/projects/xdelta."; \ + exit 1; \ + fi + +.PHONY: deltas +deltas: delta-diff delta-xdelta + +DIFF = diff +DIFF_OPTIONS = -ruNp + +.PHONY: delta-diff +delta-diff: prev-tarball new-tarball +## Unpack the tarballs somewhere to diff them + rm -rf delta-diff + mkdir delta-diff + ofile="../$(PACKAGE)-$(PREV_VERSION)-$(VERSION).diff.gz"; \ + cd delta-diff \ + && tar xzf "../$(PACKAGE)-$(PREV_VERSION).tar.gz" \ + && tar xzf "../$(PACKAGE)-$(VERSION).tar.gz" \ + && $(DIFF) $(DIFF_OPTIONS) \ + $(PACKAGE)-$(PREV_VERSION) $(PACKAGE)-$(VERSION) \ + | GZIP=$(GZIP_ENV) gzip -c > $$ofile + rm -rf delta-diff + +XDELTA = xdelta +XDELTA_OPTIONS = -9 + +.PHONY: delta-xdelta +delta-xdelta: prev-tarball new-tarball got-xdelta +## Generate the delta file (xdelta has weird exit statuses, so we need to +## add some shell code to keep make happy), and then generate the signatures +## for FSF ftp-upload: + ofile="$(PACKAGE)-$(PREV_VERSION)-$(VERSION).xdelta"; \ + ( test -z `$(XDELTA) delta $(XDELTA_OPTIONS) \ + $(PACKAGE)-$(PREV_VERSION).tar.gz $(PACKAGE)-$(VERSION).tar.gz \ + $$ofile 2>&1` \ + && : ) + +.PHONY: web-manual +web-manual: + @cd ./doc ; \ + $(SHELL) $(srcdir)/build-aux/gendocs.sh $(PACKAGE) \ + "GNU $(PACKAGE)- GNU macro processor" + @echo " *** Upload the doc/manual directory to web-cvs." diff -ruNp m4-1.4.10/src/Makefile.am m4-1.4.11/src/Makefile.am --- m4-1.4.10/src/Makefile.am 2007-07-04 21:56:05.000000000 -0600 +++ m4-1.4.11/src/Makefile.am 2008-03-29 21:25:26.000000000 -0600 @@ -1,21 +1,21 @@ -## This file is part of GNU M4. +## Makefile.am - template for generating Makefile via Automake +## +## Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc. ## -## Copyright (C) 2006, 2007 Free Software Foundation, Inc. +## This file is part of GNU M4. ## -## This program is free software; you can redistribute it and/or modify +## GNU M4 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 +## 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, +## GNU M4 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; see the file COPYING. If not, write to -## the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -## Boston, MA 02110-1301, USA. +## along with this program. If not, see <http://www.gnu.org/licenses/>. ## ## This file written by Eric Blake <ebb9@byu.net> @@ -27,4 +27,4 @@ macro.c output.c path.c symtab.c if STACKOVF m4_SOURCES += stackovf.c endif -m4_LDADD = ../lib/libm4.a $(LIBM4_LIBDEPS) +m4_LDADD = ../lib/libm4.a $(LIBM4_LIBDEPS) $(POW_LIB) diff -ruNp m4-1.4.10/src/Makefile.in m4-1.4.11/src/Makefile.in --- m4-1.4.10/src/Makefile.in 2007-07-09 21:15:33.000000000 -0600 +++ m4-1.4.11/src/Makefile.in 2008-04-02 06:45:29.000000000 -0600 @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.10 from Makefile.am. +# Makefile.in generated by automake 1.10.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -47,22 +47,23 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/a $(top_srcdir)/m4/fatal-signal.m4 $(top_srcdir)/m4/fflush.m4 \ $(top_srcdir)/m4/float_h.m4 $(top_srcdir)/m4/fpending.m4 \ $(top_srcdir)/m4/fpieee.m4 $(top_srcdir)/m4/fpurge.m4 \ - $(top_srcdir)/m4/freading.m4 $(top_srcdir)/m4/free.m4 \ - $(top_srcdir)/m4/frexp.m4 $(top_srcdir)/m4/frexpl.m4 \ - $(top_srcdir)/m4/fseeko.m4 $(top_srcdir)/m4/ftello.m4 \ - $(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gettimeofday.m4 \ - $(top_srcdir)/m4/gl_list.m4 $(top_srcdir)/m4/glibc21.m4 \ - $(top_srcdir)/m4/gnulib-common.m4 \ + $(top_srcdir)/m4/freading.m4 $(top_srcdir)/m4/frexp.m4 \ + $(top_srcdir)/m4/frexpl.m4 $(top_srcdir)/m4/fseeko.m4 \ + $(top_srcdir)/m4/ftello.m4 $(top_srcdir)/m4/getopt.m4 \ + $(top_srcdir)/m4/gettimeofday.m4 $(top_srcdir)/m4/gl_list.m4 \ + $(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/gnulib-common.m4 \ $(top_srcdir)/m4/gnulib-comp.m4 \ $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/inline.m4 \ $(top_srcdir)/m4/intmax_t.m4 $(top_srcdir)/m4/inttypes_h.m4 \ - $(top_srcdir)/m4/isnan.m4 $(top_srcdir)/m4/isnanf.m4 \ + $(top_srcdir)/m4/isnand.m4 $(top_srcdir)/m4/isnanf.m4 \ $(top_srcdir)/m4/isnanl.m4 $(top_srcdir)/m4/ldexpl.m4 \ $(top_srcdir)/m4/localcharset.m4 $(top_srcdir)/m4/longlong.m4 \ - $(top_srcdir)/m4/lseek.m4 $(top_srcdir)/m4/malloca.m4 \ - $(top_srcdir)/m4/math_h.m4 $(top_srcdir)/m4/mbrtowc.m4 \ - $(top_srcdir)/m4/mbstate_t.m4 $(top_srcdir)/m4/mkdtemp.m4 \ - $(top_srcdir)/m4/mkstemp.m4 $(top_srcdir)/m4/pathmax.m4 \ + $(top_srcdir)/m4/lseek.m4 $(top_srcdir)/m4/malloc.m4 \ + $(top_srcdir)/m4/malloca.m4 $(top_srcdir)/m4/math_h.m4 \ + $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbstate_t.m4 \ + $(top_srcdir)/m4/memchr.m4 $(top_srcdir)/m4/memcmp.m4 \ + $(top_srcdir)/m4/mkdtemp.m4 $(top_srcdir)/m4/mkstemp.m4 \ + $(top_srcdir)/m4/nocrash.m4 $(top_srcdir)/m4/pathmax.m4 \ $(top_srcdir)/m4/printf-frexp.m4 \ $(top_srcdir)/m4/printf-frexpl.m4 $(top_srcdir)/m4/printf.m4 \ $(top_srcdir)/m4/quotearg.m4 $(top_srcdir)/m4/regex.m4 \ @@ -73,11 +74,13 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/a $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdint_h.m4 \ $(top_srcdir)/m4/stdio-safer.m4 $(top_srcdir)/m4/stdio_h.m4 \ $(top_srcdir)/m4/stdlib-safer.m4 $(top_srcdir)/m4/stdlib_h.m4 \ + $(top_srcdir)/m4/strerror.m4 $(top_srcdir)/m4/string_h.m4 \ + $(top_srcdir)/m4/strstr.m4 $(top_srcdir)/m4/strtod.m4 \ $(top_srcdir)/m4/strtol.m4 $(top_srcdir)/m4/sys_stat_h.m4 \ $(top_srcdir)/m4/sys_time_h.m4 $(top_srcdir)/m4/tempname.m4 \ - $(top_srcdir)/m4/tmpdir.m4 $(top_srcdir)/m4/ulonglong.m4 \ - $(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/unistd_h.m4 \ - $(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/vasnprintf.m4 \ + $(top_srcdir)/m4/tmpdir.m4 $(top_srcdir)/m4/unistd-safer.m4 \ + $(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/unlocked-io.m4 \ + $(top_srcdir)/m4/vasnprintf.m4 \ $(top_srcdir)/m4/vasprintf-posix.m4 \ $(top_srcdir)/m4/vasprintf.m4 $(top_srcdir)/m4/wchar.m4 \ $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wctype.m4 \ @@ -101,9 +104,10 @@ am_m4_OBJECTS = m4.$(OBJEXT) builtin.$(O path.$(OBJEXT) symtab.$(OBJEXT) $(am__objects_1) m4_OBJECTS = $(am_m4_OBJECTS) am__DEPENDENCIES_1 = -m4_DEPENDENCIES = ../lib/libm4.a $(am__DEPENDENCIES_1) +m4_DEPENDENCIES = ../lib/libm4.a $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) DEFAULT_INCLUDES = -depcomp = $(SHELL) $(top_srcdir)/depcomp +depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -144,11 +148,19 @@ EXEEXT = @EXEEXT@ FLOAT_H = @FLOAT_H@ GETOPT_H = @GETOPT_H@ GLIBC21 = @GLIBC21@ +GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@ +GNULIB_CEILF = @GNULIB_CEILF@ +GNULIB_CEILL = @GNULIB_CEILL@ GNULIB_CHOWN = @GNULIB_CHOWN@ GNULIB_DUP2 = @GNULIB_DUP2@ +GNULIB_ENVIRON = @GNULIB_ENVIRON@ GNULIB_FCHDIR = @GNULIB_FCHDIR@ GNULIB_FFLUSH = @GNULIB_FFLUSH@ +GNULIB_FLOORF = @GNULIB_FLOORF@ +GNULIB_FLOORL = @GNULIB_FLOORL@ +GNULIB_FOPEN = @GNULIB_FOPEN@ GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@ +GNULIB_FREOPEN = @GNULIB_FREOPEN@ GNULIB_FREXP = @GNULIB_FREXP@ GNULIB_FREXPL = @GNULIB_FREXPL@ GNULIB_FSEEK = @GNULIB_FSEEK@ @@ -157,21 +169,67 @@ GNULIB_FTELL = @GNULIB_FTELL@ GNULIB_FTELLO = @GNULIB_FTELLO@ GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@ GNULIB_GETCWD = @GNULIB_GETCWD@ +GNULIB_GETDELIM = @GNULIB_GETDELIM@ +GNULIB_GETLINE = @GNULIB_GETLINE@ GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@ +GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@ GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@ +GNULIB_ISFINITE = @GNULIB_ISFINITE@ GNULIB_LCHOWN = @GNULIB_LCHOWN@ GNULIB_LDEXPL = @GNULIB_LDEXPL@ GNULIB_LSEEK = @GNULIB_LSEEK@ +GNULIB_MALLOC_POSIX = @GNULIB_MALLOC_POSIX@ GNULIB_MATHL = @GNULIB_MATHL@ +GNULIB_MBSCASECMP = @GNULIB_MBSCASECMP@ +GNULIB_MBSCASESTR = @GNULIB_MBSCASESTR@ +GNULIB_MBSCHR = @GNULIB_MBSCHR@ +GNULIB_MBSCSPN = @GNULIB_MBSCSPN@ +GNULIB_MBSLEN = @GNULIB_MBSLEN@ +GNULIB_MBSNCASECMP = @GNULIB_MBSNCASECMP@ +GNULIB_MBSNLEN = @GNULIB_MBSNLEN@ +GNULIB_MBSPBRK = @GNULIB_MBSPBRK@ +GNULIB_MBSPCASECMP = @GNULIB_MBSPCASECMP@ +GNULIB_MBSRCHR = @GNULIB_MBSRCHR@ +GNULIB_MBSSEP = @GNULIB_MBSSEP@ +GNULIB_MBSSPN = @GNULIB_MBSSPN@ +GNULIB_MBSSTR = @GNULIB_MBSSTR@ +GNULIB_MBSTOK_R = @GNULIB_MBSTOK_R@ +GNULIB_MEMMEM = @GNULIB_MEMMEM@ +GNULIB_MEMPCPY = @GNULIB_MEMPCPY@ +GNULIB_MEMRCHR = @GNULIB_MEMRCHR@ GNULIB_MKDTEMP = @GNULIB_MKDTEMP@ GNULIB_MKSTEMP = @GNULIB_MKSTEMP@ GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@ +GNULIB_PUTENV = @GNULIB_PUTENV@ GNULIB_READLINK = @GNULIB_READLINK@ +GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@ +GNULIB_ROUND = @GNULIB_ROUND@ +GNULIB_ROUNDF = @GNULIB_ROUNDF@ +GNULIB_ROUNDL = @GNULIB_ROUNDL@ +GNULIB_SETENV = @GNULIB_SETENV@ GNULIB_SIGNBIT = @GNULIB_SIGNBIT@ GNULIB_SIGPROCMASK = @GNULIB_SIGPROCMASK@ GNULIB_SLEEP = @GNULIB_SLEEP@ GNULIB_SNPRINTF = @GNULIB_SNPRINTF@ GNULIB_SPRINTF_POSIX = @GNULIB_SPRINTF_POSIX@ +GNULIB_STPCPY = @GNULIB_STPCPY@ +GNULIB_STPNCPY = @GNULIB_STPNCPY@ +GNULIB_STRCASESTR = @GNULIB_STRCASESTR@ +GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@ +GNULIB_STRDUP = @GNULIB_STRDUP@ +GNULIB_STRERROR = @GNULIB_STRERROR@ +GNULIB_STRNDUP = @GNULIB_STRNDUP@ +GNULIB_STRNLEN = @GNULIB_STRNLEN@ +GNULIB_STRPBRK = @GNULIB_STRPBRK@ +GNULIB_STRSEP = @GNULIB_STRSEP@ +GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@ +GNULIB_STRSTR = @GNULIB_STRSTR@ +GNULIB_STRTOD = @GNULIB_STRTOD@ +GNULIB_STRTOK_R = @GNULIB_STRTOK_R@ +GNULIB_TRUNC = @GNULIB_TRUNC@ +GNULIB_TRUNCF = @GNULIB_TRUNCF@ +GNULIB_TRUNCL = @GNULIB_TRUNCL@ +GNULIB_UNSETENV = @GNULIB_UNSETENV@ GNULIB_VASPRINTF = @GNULIB_VASPRINTF@ GNULIB_VFPRINTF_POSIX = @GNULIB_VFPRINTF_POSIX@ GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@ @@ -179,49 +237,78 @@ GNULIB_VSNPRINTF = @GNULIB_VSNPRINTF@ GNULIB_VSPRINTF_POSIX = @GNULIB_VSPRINTF_POSIX@ GNULIB_WCWIDTH = @GNULIB_WCWIDTH@ GREP = @GREP@ +HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@ HAVE_DECL_ACOSL = @HAVE_DECL_ACOSL@ HAVE_DECL_ASINL = @HAVE_DECL_ASINL@ HAVE_DECL_ATANL = @HAVE_DECL_ATANL@ -HAVE_DECL_CEILL = @HAVE_DECL_CEILL@ HAVE_DECL_COSL = @HAVE_DECL_COSL@ +HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@ HAVE_DECL_EXPL = @HAVE_DECL_EXPL@ -HAVE_DECL_FLOORL = @HAVE_DECL_FLOORL@ HAVE_DECL_FREXPL = @HAVE_DECL_FREXPL@ +HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@ +HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@ HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ HAVE_DECL_LDEXPL = @HAVE_DECL_LDEXPL@ HAVE_DECL_LOGL = @HAVE_DECL_LOGL@ +HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@ +HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@ HAVE_DECL_MKDIR = @HAVE_DECL_MKDIR@ HAVE_DECL_SINL = @HAVE_DECL_SINL@ HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@ HAVE_DECL_SQRTL = @HAVE_DECL_SQRTL@ +HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@ +HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@ +HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@ +HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@ +HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@ +HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@ HAVE_DECL_TANL = @HAVE_DECL_TANL@ +HAVE_DECL_TRUNC = @HAVE_DECL_TRUNC@ +HAVE_DECL_TRUNCF = @HAVE_DECL_TRUNCF@ +HAVE_DECL_TRUNCL = @HAVE_DECL_TRUNCL@ HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@ HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@ HAVE_DUP2 = @HAVE_DUP2@ HAVE_FSEEKO = @HAVE_FSEEKO@ HAVE_FTELLO = @HAVE_FTELLO@ HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ +HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@ HAVE_GETSUBOPT = @HAVE_GETSUBOPT@ HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ HAVE_IO_H = @HAVE_IO_H@ HAVE_ISWCNTRL = @HAVE_ISWCNTRL@ HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ HAVE_LSTAT = @HAVE_LSTAT@ +HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@ +HAVE_MEMPCPY = @HAVE_MEMPCPY@ HAVE_MKDTEMP = @HAVE_MKDTEMP@ +HAVE_OS_H = @HAVE_OS_H@ HAVE_POSIX_SIGNALBLOCKING = @HAVE_POSIX_SIGNALBLOCKING@ HAVE_READLINK = @HAVE_READLINK@ +HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@ +HAVE_SETENV = @HAVE_SETENV@ HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@ HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@ HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@ HAVE_SIGSET_T = @HAVE_SIGSET_T@ HAVE_SLEEP = @HAVE_SLEEP@ HAVE_STDINT_H = @HAVE_STDINT_H@ +HAVE_STPCPY = @HAVE_STPCPY@ +HAVE_STPNCPY = @HAVE_STPNCPY@ +HAVE_STRCASESTR = @HAVE_STRCASESTR@ +HAVE_STRCHRNUL = @HAVE_STRCHRNUL@ +HAVE_STRNDUP = @HAVE_STRNDUP@ +HAVE_STRPBRK = @HAVE_STRPBRK@ +HAVE_STRSEP = @HAVE_STRSEP@ +HAVE_STRTOD = @HAVE_STRTOD@ HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@ HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@ HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@ +HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ HAVE_UNISTD_H = @HAVE_UNISTD_H@ +HAVE_UNSETENV = @HAVE_UNSETENV@ HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@ HAVE_VASPRINTF = @HAVE_VASPRINTF@ HAVE_WCHAR_H = @HAVE_WCHAR_H@ @@ -240,18 +327,24 @@ LIBM4_LIBDEPS = @LIBM4_LIBDEPS@ LIBM4_LTLIBDEPS = @LIBM4_LTLIBDEPS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ +LIBTESTS_LIBDEPS = @LIBTESTS_LIBDEPS@ +LOCALCHARSET_TESTS_ENVIRONMENT = @LOCALCHARSET_TESTS_ENVIRONMENT@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ M4_LIBOBJS = @M4_LIBOBJS@ M4_LTLIBOBJS = @M4_LTLIBOBJS@ +M4tests_LIBOBJS = @M4tests_LIBOBJS@ +M4tests_LTLIBOBJS = @M4tests_LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ NEXT_FLOAT_H = @NEXT_FLOAT_H@ NEXT_MATH_H = @NEXT_MATH_H@ NEXT_SIGNAL_H = @NEXT_SIGNAL_H@ +NEXT_STDARG_H = @NEXT_STDARG_H@ NEXT_STDINT_H = @NEXT_STDINT_H@ NEXT_STDIO_H = @NEXT_STDIO_H@ NEXT_STDLIB_H = @NEXT_STDLIB_H@ +NEXT_STRING_H = @NEXT_STRING_H@ NEXT_SYS_STAT_H = @NEXT_SYS_STAT_H@ NEXT_SYS_TIME_H = @NEXT_SYS_TIME_H@ NEXT_UNISTD_H = @NEXT_UNISTD_H@ @@ -265,12 +358,19 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +POW_LIB = @POW_LIB@ PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@ RANLIB = @RANLIB@ +REPLACE_CEILF = @REPLACE_CEILF@ +REPLACE_CEILL = @REPLACE_CEILL@ REPLACE_CHOWN = @REPLACE_CHOWN@ REPLACE_FCHDIR = @REPLACE_FCHDIR@ REPLACE_FFLUSH = @REPLACE_FFLUSH@ +REPLACE_FLOORF = @REPLACE_FLOORF@ +REPLACE_FLOORL = @REPLACE_FLOORL@ +REPLACE_FOPEN = @REPLACE_FOPEN@ REPLACE_FPRINTF = @REPLACE_FPRINTF@ +REPLACE_FREOPEN = @REPLACE_FREOPEN@ REPLACE_FREXP = @REPLACE_FREXP@ REPLACE_FREXPL = @REPLACE_FREXPL@ REPLACE_FSEEK = @REPLACE_FSEEK@ @@ -278,15 +378,29 @@ REPLACE_FSEEKO = @REPLACE_FSEEKO@ REPLACE_FTELL = @REPLACE_FTELL@ REPLACE_FTELLO = @REPLACE_FTELLO@ REPLACE_GETCWD = @REPLACE_GETCWD@ +REPLACE_GETLINE = @REPLACE_GETLINE@ +REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@ REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@ +REPLACE_ISFINITE = @REPLACE_ISFINITE@ REPLACE_LCHOWN = @REPLACE_LCHOWN@ REPLACE_LDEXPL = @REPLACE_LDEXPL@ REPLACE_LSEEK = @REPLACE_LSEEK@ +REPLACE_MEMMEM = @REPLACE_MEMMEM@ REPLACE_MKSTEMP = @REPLACE_MKSTEMP@ REPLACE_PRINTF = @REPLACE_PRINTF@ +REPLACE_PUTENV = @REPLACE_PUTENV@ +REPLACE_ROUND = @REPLACE_ROUND@ +REPLACE_ROUNDF = @REPLACE_ROUNDF@ +REPLACE_ROUNDL = @REPLACE_ROUNDL@ REPLACE_SIGNBIT = @REPLACE_SIGNBIT@ +REPLACE_SIGNBIT_USING_GCC = @REPLACE_SIGNBIT_USING_GCC@ REPLACE_SNPRINTF = @REPLACE_SNPRINTF@ REPLACE_SPRINTF = @REPLACE_SPRINTF@ +REPLACE_STRCASESTR = @REPLACE_STRCASESTR@ +REPLACE_STRERROR = @REPLACE_STRERROR@ +REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@ +REPLACE_STRSTR = @REPLACE_STRSTR@ +REPLACE_STRTOD = @REPLACE_STRTOD@ REPLACE_VASPRINTF = @REPLACE_VASPRINTF@ REPLACE_VFPRINTF = @REPLACE_VFPRINTF@ REPLACE_VPRINTF = @REPLACE_VPRINTF@ @@ -297,12 +411,14 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@ SIZE_T_SUFFIX = @SIZE_T_SUFFIX@ +STDARG_H = @STDARG_H@ STDBOOL_H = @STDBOOL_H@ STDINT_H = @STDINT_H@ STRIP = @STRIP@ SYS_STAT_H = @SYS_STAT_H@ SYS_TIME_H = @SYS_TIME_H@ VERSION = @VERSION@ +VOID_UNSETENV = @VOID_UNSETENV@ WCHAR_H = @WCHAR_H@ WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ WCTYPE_H = @WCTYPE_H@ @@ -360,7 +476,7 @@ AUTOMAKE_OPTIONS = nostdinc AM_CPPFLAGS = -I$(top_srcdir)/lib -I../lib m4_SOURCES = m4.h m4.c builtin.c debug.c eval.c format.c freeze.c \ input.c macro.c output.c path.c symtab.c $(am__append_1) -m4_LDADD = ../lib/libm4.a $(LIBM4_LIBDEPS) +m4_LDADD = ../lib/libm4.a $(LIBM4_LIBDEPS) $(POW_LIB) all: all-am .SUFFIXES: @@ -459,8 +575,8 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS @@ -472,8 +588,8 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEP unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ @@ -483,13 +599,12 @@ ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ - here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique diff -ruNp m4-1.4.10/src/builtin.c m4-1.4.11/src/builtin.c --- m4-1.4.10/src/builtin.c 2007-07-04 21:56:05.000000000 -0600 +++ m4-1.4.11/src/builtin.c 2008-03-29 16:33:27.000000000 -0600 @@ -1,22 +1,22 @@ /* GNU m4 -- A simple macro processor - Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 2000, 2004, 2006, 2007 - Free Software Foundation, Inc. + Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 2000, 2004, 2006, + 2007, 2008 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + This file is part of GNU M4. + + GNU M4 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 + 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, + GNU M4 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, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Code for all builtin macros, initialization of symbol table, and @@ -450,7 +450,7 @@ numeric_arg (token_data *macro, const ch /* Digits for number to ascii conversions. */ static char const digits[] = "0123456789abcdefghijklmnopqrstuvwxyz"; -static const char * +const char * ntoa (int32_t value, int radix) { bool negative; @@ -890,38 +890,43 @@ m4_defn (struct obstack *obs, int argc, { symbol *s; builtin_func *b; + int i; - if (bad_argc (argv[0], argc, 2, 2)) - return; - - s = lookup_symbol (ARG (1), SYMBOL_LOOKUP); - if (s == NULL) + if (bad_argc (argv[0], argc, 2, -1)) return; - switch (SYMBOL_TYPE (s)) + for (i = 1; i < argc; i++) { - case TOKEN_TEXT: - obstack_grow (obs, lquote.string, lquote.length); - obstack_grow (obs, SYMBOL_TEXT (s), strlen (SYMBOL_TEXT (s))); - obstack_grow (obs, rquote.string, rquote.length); - break; + s = lookup_symbol (ARG (i), SYMBOL_LOOKUP); + if (s == NULL) + continue; - case TOKEN_FUNC: - b = SYMBOL_FUNC (s); - if (b == m4_placeholder) - M4ERROR ((warning_status, 0, "\ -builtin `%s' requested by frozen file is not supported", ARG (1))); - else - push_macro (b); - break; + switch (SYMBOL_TYPE (s)) + { + case TOKEN_TEXT: + obstack_grow (obs, lquote.string, lquote.length); + obstack_grow (obs, SYMBOL_TEXT (s), strlen (SYMBOL_TEXT (s))); + obstack_grow (obs, rquote.string, rquote.length); + break; - case TOKEN_VOID: - break; + case TOKEN_FUNC: + b = SYMBOL_FUNC (s); + if (b == m4_placeholder) + M4ERROR ((warning_status, 0, "\ +builtin `%s' requested by frozen file is not supported", ARG (i))); + else if (argc != 2) + M4ERROR ((warning_status, 0, + "Warning: cannot concatenate builtin `%s'", + ARG (i))); + else + push_macro (b); + break; - default: - M4ERROR ((warning_status, 0, - "INTERNAL ERROR: bad symbol type in m4_defn ()")); - abort (); + default: + M4ERROR ((warning_status, 0, + "INTERNAL ERROR: bad symbol type in m4_defn ()")); + abort (); + } } } @@ -1339,35 +1344,42 @@ m4_sinclude (struct obstack *obs, int ar | Use the first argument as at template for a temporary file name. | `------------------------------------------------------------------*/ -/* Add trailing 'X' to NAME if necessary, securely create the file, - and place the new file name on OBS. */ +/* Add trailing 'X' to PATTERN of length LEN as necessary, then + securely create the file, and place the quoted new file name on + OBS. Report errors on behalf of ME. */ static void -mkstemp_helper (struct obstack *obs, const char *name) +mkstemp_helper (struct obstack *obs, const char *me, const char *pattern, + size_t len) { int fd; - int len; int i; + char *name; /* Guarantee that there are six trailing 'X' characters, even if the - user forgot to supply them. */ - len = strlen (name); - obstack_grow (obs, name, len); + user forgot to supply them. Output must be quoted if + successful. */ + obstack_grow (obs, lquote.string, lquote.length); + obstack_grow (obs, pattern, len); for (i = 0; len > 0 && i < 6; i++) - if (name[--len] != 'X') + if (pattern[len - i - 1] != 'X') break; - for (; i < 6; i++) - obstack_1grow (obs, 'X'); - obstack_1grow (obs, '\0'); + obstack_grow0 (obs, "XXXXXX", 6 - i); + name = (char *) obstack_base (obs) + lquote.length; errno = 0; - fd = mkstemp ((char *) obstack_base (obs)); + fd = mkstemp (name); if (fd < 0) { - M4ERROR ((0, errno, "cannot create tempfile `%s'", name)); + M4ERROR ((0, errno, "cannot create tempfile `%s'", pattern)); obstack_free (obs, obstack_finish (obs)); } else - close (fd); + { + close (fd); + /* Remove NUL, then finish quote. */ + obstack_blank (obs, -1); + obstack_grow (obs, rquote.string, rquote.length); + } } static void @@ -1410,7 +1422,7 @@ m4_maketemp (struct obstack *obs, int ar } } else - mkstemp_helper (obs, ARG (1)); + mkstemp_helper (obs, ARG (0), ARG (1), strlen (ARG (1))); } static void @@ -1418,7 +1430,7 @@ m4_mkstemp (struct obstack *obs, int arg { if (bad_argc (argv[0], argc, 2, 2)) return; - mkstemp_helper (obs, ARG (1)); + mkstemp_helper (obs, ARG (0), ARG (1), strlen (ARG (1))); } /*----------------------------------------. @@ -1433,7 +1445,7 @@ m4_errprint (struct obstack *obs, int ar dump_args (obs, argc, argv, " ", false); obstack_1grow (obs, '\0'); debug_flush_files (); - fprintf (stderr, "%s", (char *) obstack_finish (obs)); + xfprintf (stderr, "%s", (char *) obstack_finish (obs)); fflush (stderr); } @@ -1898,16 +1910,16 @@ Warning: \\0 will disappear, use \\& ins case '7': case '8': case '9': ch -= '0'; if (regs->num_regs - 1 <= ch) - M4ERROR ((warning_status, 0, "\ -Warning: sub-expression %d not present", ch)); + M4ERROR ((warning_status, 0, + "Warning: sub-expression %d not present", ch)); else if (regs->end[ch] > 0) obstack_grow (obs, victim + regs->start[ch], regs->end[ch] - regs->start[ch]); break; case '\0': - M4ERROR ((warning_status, 0, "\ -Warning: trailing \\ ignored in replacement")); + M4ERROR ((warning_status, 0, + "Warning: trailing \\ ignored in replacement")); return; default: diff -ruNp m4-1.4.10/src/debug.c m4-1.4.11/src/debug.c --- m4-1.4.10/src/debug.c 2007-07-04 21:56:05.000000000 -0600 +++ m4-1.4.11/src/debug.c 2008-03-29 16:33:27.000000000 -0600 @@ -3,20 +3,20 @@ Copyright (C) 1991, 1992, 1993, 1994, 2004, 2006, 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + This file is part of GNU M4. + + GNU M4 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 + 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, + GNU M4 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, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "m4.h" @@ -231,13 +231,13 @@ debug_set_output (const char *name) void debug_message_prefix (void) { - fprintf (debug, "m4debug:"); + xfprintf (debug, "m4debug:"); if (current_line) { if (debug_level & DEBUG_TRACE_FILE) - fprintf (debug, "%s:", current_file); + xfprintf (debug, "%s:", current_file); if (debug_level & DEBUG_TRACE_LINE) - fprintf (debug, "%d:", current_line); + xfprintf (debug, "%d:", current_line); } putc (' ', debug); } @@ -261,7 +261,6 @@ trace_format (const char *fmt, ...) char ch; int d; - char nbuf[32]; const char *s; int slen; int maxlen; @@ -297,8 +296,7 @@ trace_format (const char *fmt, ...) case 'd': d = va_arg (args, int); - sprintf (nbuf, "%d", d); - s = nbuf; + s = ntoa (d, 10); break; default: diff -ruNp m4-1.4.10/src/eval.c m4-1.4.11/src/eval.c --- m4-1.4.10/src/eval.c 2007-07-04 21:56:05.000000000 -0600 +++ m4-1.4.11/src/eval.c 2008-03-29 16:33:27.000000000 -0600 @@ -3,20 +3,20 @@ Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 2006, 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + This file is part of GNU M4. + + GNU M4 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 + 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, + GNU M4 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, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* This file contains the functions to evaluate integer expressions for diff -ruNp m4-1.4.10/src/format.c m4-1.4.11/src/format.c --- m4-1.4.10/src/format.c 2007-07-09 21:07:04.000000000 -0600 +++ m4-1.4.11/src/format.c 2008-03-29 19:14:35.000000000 -0600 @@ -1,22 +1,22 @@ /* GNU m4 -- A simple macro processor - Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 2006, 2007 + Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 2006, 2007, 2008 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + This file is part of GNU M4. + + GNU M4 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 + 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, + GNU M4 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, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* printf like formatting for m4. */ @@ -41,7 +41,7 @@ #define ARG_DOUBLE(argc, argv) \ ((argc == 0) ? 0 : \ - (--argc, argv++, atof (TOKEN_DATA_TEXT (argv[-1])))) + (--argc, argv++, strtod (TOKEN_DATA_TEXT (argv[-1]), NULL))) /*------------------------------------------------------------------. diff -ruNp m4-1.4.10/src/freeze.c m4-1.4.11/src/freeze.c --- m4-1.4.10/src/freeze.c 2007-07-04 21:56:05.000000000 -0600 +++ m4-1.4.11/src/freeze.c 2008-03-29 16:33:27.000000000 -0600 @@ -1,22 +1,22 @@ /* GNU m4 -- A simple macro processor - Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 2006, 2007 + Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 2006, 2007, 2008 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + This file is part of GNU M4. + + GNU M4 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 + 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, + GNU M4 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, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* This module handles frozen files. */ @@ -58,21 +58,21 @@ produce_frozen_state (const char *name) if (file = fopen (name, O_BINARY ? "wb" : "w"), !file) { - M4ERROR ((warning_status, errno, name)); + M4ERROR ((warning_status, errno, "%s", name)); return; } /* Write a recognizable header. */ - fprintf (file, "# This is a frozen state file generated by %s\n", + xfprintf (file, "# This is a frozen state file generated by %s\n", PACKAGE_STRING); - fprintf (file, "V1\n"); + xfprintf (file, "V1\n"); /* Dump quote delimiters. */ if (strcmp (lquote.string, DEF_LQUOTE) || strcmp (rquote.string, DEF_RQUOTE)) { - fprintf (file, "Q%d,%d\n", (int) lquote.length, (int) rquote.length); + xfprintf (file, "Q%d,%d\n", (int) lquote.length, (int) rquote.length); fputs (lquote.string, file); fputs (rquote.string, file); fputc ('\n', file); @@ -82,7 +82,7 @@ produce_frozen_state (const char *name) if (strcmp (bcomm.string, DEF_BCOMM) || strcmp (ecomm.string, DEF_ECOMM)) { - fprintf (file, "C%d,%d\n", (int) bcomm.length, (int) ecomm.length); + xfprintf (file, "C%d,%d\n", (int) bcomm.length, (int) ecomm.length); fputs (bcomm.string, file); fputs (ecomm.string, file); fputc ('\n', file); @@ -103,9 +103,9 @@ produce_frozen_state (const char *name) switch (SYMBOL_TYPE (sym)) { case TOKEN_TEXT: - fprintf (file, "T%d,%d\n", - (int) strlen (SYMBOL_NAME (sym)), - (int) strlen (SYMBOL_TEXT (sym))); + xfprintf (file, "T%d,%d\n", + (int) strlen (SYMBOL_NAME (sym)), + (int) strlen (SYMBOL_TEXT (sym))); fputs (SYMBOL_NAME (sym), file); fputs (SYMBOL_TEXT (sym), file); fputc ('\n', file); @@ -119,14 +119,18 @@ produce_frozen_state (const char *name) INTERNAL ERROR: builtin not found in builtin table!")); abort (); } - fprintf (file, "F%d,%d\n", - (int) strlen (SYMBOL_NAME (sym)), - (int) strlen (bp->name)); + xfprintf (file, "F%d,%d\n", + (int) strlen (SYMBOL_NAME (sym)), + (int) strlen (bp->name)); fputs (SYMBOL_NAME (sym), file); fputs (bp->name, file); fputc ('\n', file); break; + case TOKEN_VOID: + /* Ignore placeholder tokens that exist due to traceon. */ + break; + default: M4ERROR ((warning_status, 0, "\ INTERNAL ERROR: bad token data type in freeze_one_symbol ()")); @@ -210,16 +214,16 @@ reload_frozen_state (const char *name) character to the next directive or to EOF. */ #define GET_DIRECTIVE \ - do \ - { \ - GET_CHARACTER; \ - if (character == '#') \ - { \ - while (character != EOF && character != '\n') \ - GET_CHARACTER; \ - VALIDATE ('\n'); \ - } \ - } \ + do \ + { \ + GET_CHARACTER; \ + if (character == '#') \ + { \ + while (character != EOF && character != '\n') \ + GET_CHARACTER; \ + VALIDATE ('\n'); \ + } \ + } \ while (character == '\n') file = m4_path_search (name, NULL); @@ -238,131 +242,131 @@ reload_frozen_state (const char *name) GET_NUMBER (number[0]); if (number[0] > 1) M4ERROR ((EXIT_MISMATCH, 0, - "frozen file version %d greater than max supported of 1", + "frozen file version %d greater than max supported of 1", number[0])); else if (number[0] < 1) M4ERROR ((EXIT_FAILURE, 0, - "ill-formed frozen file, version directive expected")); + "ill-formed frozen file, version directive expected")); VALIDATE ('\n'); GET_DIRECTIVE; while (character != EOF) { switch (character) - { - default: - M4ERROR ((EXIT_FAILURE, 0, "ill-formed frozen file")); + { + default: + M4ERROR ((EXIT_FAILURE, 0, "ill-formed frozen file")); - case 'C': - case 'D': - case 'F': - case 'T': - case 'Q': - operation = character; - GET_CHARACTER; + case 'C': + case 'D': + case 'F': + case 'T': + case 'Q': + operation = character; + GET_CHARACTER; - /* Get string lengths. Accept a negative diversion number. */ + /* Get string lengths. Accept a negative diversion number. */ - if (operation == 'D' && character == '-') - { - GET_CHARACTER; - GET_NUMBER (number[0]); - number[0] = -number[0]; - } - else - GET_NUMBER (number[0]); - VALIDATE (','); - GET_CHARACTER; - GET_NUMBER (number[1]); - VALIDATE ('\n'); + if (operation == 'D' && character == '-') + { + GET_CHARACTER; + GET_NUMBER (number[0]); + number[0] = -number[0]; + } + else + GET_NUMBER (number[0]); + VALIDATE (','); + GET_CHARACTER; + GET_NUMBER (number[1]); + VALIDATE ('\n'); - if (operation != 'D') - { + if (operation != 'D') + { - /* Get first string contents. */ + /* Get first string contents. */ - if (number[0] + 1 > allocated[0]) - { - free (string[0]); - allocated[0] = number[0] + 1; - string[0] = xcharalloc ((size_t) allocated[0]); - } + if (number[0] + 1 > allocated[0]) + { + free (string[0]); + allocated[0] = number[0] + 1; + string[0] = xcharalloc ((size_t) allocated[0]); + } - if (number[0] > 0) - if (!fread (string[0], (size_t) number[0], 1, file)) - M4ERROR ((EXIT_FAILURE, 0, "premature end of frozen file")); + if (number[0] > 0) + if (!fread (string[0], (size_t) number[0], 1, file)) + M4ERROR ((EXIT_FAILURE, 0, "premature end of frozen file")); - string[0][number[0]] = '\0'; - } + string[0][number[0]] = '\0'; + } - /* Get second string contents. */ + /* Get second string contents. */ - if (number[1] + 1 > allocated[1]) - { - free (string[1]); - allocated[1] = number[1] + 1; - string[1] = xcharalloc ((size_t) allocated[1]); - } + if (number[1] + 1 > allocated[1]) + { + free (string[1]); + allocated[1] = number[1] + 1; + string[1] = xcharalloc ((size_t) allocated[1]); + } - if (number[1] > 0) - if (!fread (string[1], (size_t) number[1], 1, file)) - M4ERROR ((EXIT_FAILURE, 0, "premature end of frozen file")); + if (number[1] > 0) + if (!fread (string[1], (size_t) number[1], 1, file)) + M4ERROR ((EXIT_FAILURE, 0, "premature end of frozen file")); - string[1][number[1]] = '\0'; - GET_CHARACTER; - VALIDATE ('\n'); + string[1][number[1]] = '\0'; + GET_CHARACTER; + VALIDATE ('\n'); - /* Act according to operation letter. */ + /* Act according to operation letter. */ - switch (operation) - { - case 'C': + switch (operation) + { + case 'C': - /* Change comment strings. */ + /* Change comment strings. */ - set_comment (string[0], string[1]); - break; + set_comment (string[0], string[1]); + break; - case 'D': + case 'D': - /* Select a diversion and add a string to it. */ + /* Select a diversion and add a string to it. */ - make_diversion (number[0]); - if (number[1] > 0) - output_text (string[1], number[1]); - break; + make_diversion (number[0]); + if (number[1] > 0) + output_text (string[1], number[1]); + break; - case 'F': + case 'F': - /* Enter a macro having a builtin function as a definition. */ + /* Enter a macro having a builtin function as a definition. */ - bp = find_builtin_by_name (string[1]); - define_builtin (string[0], bp, SYMBOL_PUSHDEF); - break; + bp = find_builtin_by_name (string[1]); + define_builtin (string[0], bp, SYMBOL_PUSHDEF); + break; - case 'T': + case 'T': - /* Enter a macro having an expansion text as a definition. */ + /* Enter a macro having an expansion text as a definition. */ - define_user_macro (string[0], string[1], SYMBOL_PUSHDEF); - break; + define_user_macro (string[0], string[1], SYMBOL_PUSHDEF); + break; - case 'Q': + case 'Q': - /* Change quote strings. */ + /* Change quote strings. */ - set_quotes (string[0], string[1]); - break; + set_quotes (string[0], string[1]); + break; - default: + default: - /* Cannot happen. */ + /* Cannot happen. */ - break; - } - break; + break; + } + break; - } + } GET_DIRECTIVE; } diff -ruNp m4-1.4.10/src/input.c m4-1.4.11/src/input.c --- m4-1.4.10/src/input.c 2007-07-04 21:56:05.000000000 -0600 +++ m4-1.4.11/src/input.c 2008-03-29 16:33:27.000000000 -0600 @@ -3,20 +3,20 @@ Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + This file is part of GNU M4. + + GNU M4 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 + 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, + GNU M4 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, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Handling of different input sources, and lexical analysis. */ @@ -845,7 +845,7 @@ next_token (token_data *td, int *line) if (ch == CHAR_EOF) { #ifdef DEBUG_INPUT - fprintf (stderr, "next_token -> EOF\n"); + xfprintf (stderr, "next_token -> EOF\n"); #endif next_char (); return TOKEN_EOF; @@ -855,8 +855,8 @@ next_token (token_data *td, int *line) init_macro_token (td); next_char (); #ifdef DEBUG_INPUT - fprintf (stderr, "next_token -> MACDEF (%s)\n", - find_builtin_by_addr (TOKEN_DATA_FUNC (td))->name); + xfprintf (stderr, "next_token -> MACDEF (%s)\n", + find_builtin_by_addr (TOKEN_DATA_FUNC (td))->name); #endif return TOKEN_MACDEF; } @@ -988,8 +988,8 @@ next_token (token_data *td, int *line) TOKEN_DATA_ORIG_TEXT (td) = orig_text; #endif #ifdef DEBUG_INPUT - fprintf (stderr, "next_token -> %s (%s)\n", - token_type_string (type), TOKEN_DATA_TEXT (td)); + xfprintf (stderr, "next_token -> %s (%s)\n", + token_type_string (type), TOKEN_DATA_TEXT (td)); #endif return type; } @@ -1045,7 +1045,7 @@ peek_token (void) } #ifdef DEBUG_INPUT - fprintf (stderr, "peek_token -> %s\n", token_type_string (result)); + xfprintf (stderr, "peek_token -> %s\n", token_type_string (result)); #endif /* DEBUG_INPUT */ return result; } @@ -1082,33 +1082,33 @@ token_type_string (token_type t) static void print_token (const char *s, token_type t, token_data *td) { - fprintf (stderr, "%s: ", s); + xfprintf (stderr, "%s: ", s); switch (t) { /* TOKSW */ case TOKEN_OPEN: case TOKEN_COMMA: case TOKEN_CLOSE: case TOKEN_SIMPLE: - fprintf (stderr, "char:"); + xfprintf (stderr, "char:"); break; case TOKEN_WORD: - fprintf (stderr, "word:"); + xfprintf (stderr, "word:"); break; case TOKEN_STRING: - fprintf (stderr, "string:"); + xfprintf (stderr, "string:"); break; case TOKEN_MACDEF: - fprintf (stderr, "macro: %p\n", TOKEN_DATA_FUNC (td)); + xfprintf (stderr, "macro: %p\n", TOKEN_DATA_FUNC (td)); break; case TOKEN_EOF: - fprintf (stderr, "eof\n"); + xfprintf (stderr, "eof\n"); break; } - fprintf (stderr, "\t\"%s\"\n", TOKEN_DATA_TEXT (td)); + xfprintf (stderr, "\t\"%s\"\n", TOKEN_DATA_TEXT (td)); } static void M4_GNUC_UNUSED diff -ruNp m4-1.4.10/src/m4.c m4-1.4.11/src/m4.c --- m4-1.4.10/src/m4.c 2007-07-04 21:56:05.000000000 -0600 +++ m4-1.4.11/src/m4.c 2008-03-29 16:33:27.000000000 -0600 @@ -3,20 +3,20 @@ Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + This file is part of GNU M4. + + GNU M4 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 + 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, + GNU M4 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, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "m4.h" @@ -137,10 +137,10 @@ static void usage (int status) { if (status != EXIT_SUCCESS) - fprintf (stderr, "Try `%s --help' for more information.\n", program_name); + xfprintf (stderr, "Try `%s --help' for more information.\n", program_name); else { - printf ("Usage: %s [OPTION]... [FILE]...\n", program_name); + xprintf ("Usage: %s [OPTION]... [FILE]...\n", program_name); fputs ("\ Process macros in FILEs. If no FILE or if FILE is `-', standard input\n\ is read.\n\ @@ -154,7 +154,7 @@ Operation modes:\n\ --help display this help and exit\n\ --version output version information and exit\n\ ", stdout); - printf ("\ + xprintf ("\ -E, --fatal-warnings once: warnings become errors, twice: stop\n\ execution at first error\n\ -i, --interactive unbuffer output, ignore interrupts\n\ @@ -223,7 +223,7 @@ of directories included after any specif Exit status is 0 for success, 1 for failure, 63 for frozen file version\n\ mismatch, or whatever value was passed to the m4exit macro.\n\ ", stdout); - printf ("\nReport bugs to <%s>.\n", PACKAGE_BUGREPORT); + xprintf ("\nReport bugs to <%s>.\n", PACKAGE_BUGREPORT); } exit (status); } diff -ruNp m4-1.4.10/src/m4.h m4-1.4.11/src/m4.h --- m4-1.4.10/src/m4.h 2007-07-04 21:56:05.000000000 -0600 +++ m4-1.4.11/src/m4.h 2008-03-29 16:33:27.000000000 -0600 @@ -1,22 +1,22 @@ /* GNU m4 -- A simple macro processor - Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 2004, 2005, 2006, 2007 - Free Software Foundation, Inc. + Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 2004, 2005, 2006, + 2007, 2008 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + This file is part of GNU M4. + + GNU M4 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 + 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, + GNU M4 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, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* We use <config.h> instead of "config.h" so that a compilation @@ -45,6 +45,7 @@ #include "unistd--.h" #include "verror.h" #include "xalloc.h" +#include "xprintf.h" #include "xvasprintf.h" /* Canonicalize UNIX recognition macros. */ @@ -128,14 +129,14 @@ extern const char *program_name; void m4_error (int, int, const char *, ...) M4_GNUC_PRINTF(3, 4); void m4_error_at_line (int, int, const char *, int, - const char *, ...) M4_GNUC_PRINTF(5, 6); + const char *, ...) M4_GNUC_PRINTF(5, 6); #define M4ERROR(Arglist) (m4_error Arglist) #define M4ERROR_AT_LINE(Arglist) (m4_error_at_line Arglist) #ifdef USE_STACKOVF void setup_stackovf_trap (char *const *, char *const *, - void (*handler) (void)); + void (*handler) (void)); #endif /* File: debug.c --- debugging and tracing function. */ @@ -174,7 +175,7 @@ extern FILE *debug; do \ { \ if (debug != NULL) \ - fprintf (debug, Fmt, Arg1); \ + xfprintf (debug, Fmt, Arg1); \ } \ while (0) @@ -182,7 +183,7 @@ extern FILE *debug; do \ { \ if (debug != NULL) \ - fprintf (debug, Fmt, Arg1, Arg2, Arg3); \ + xfprintf (debug, Fmt, Arg1, Arg2, Arg3); \ } \ while (0) @@ -192,7 +193,7 @@ extern FILE *debug; if (debug != NULL) \ { \ debug_message_prefix (); \ - fprintf (debug, Fmt); \ + xfprintf (debug, Fmt); \ putc ('\n', debug); \ } \ } \ @@ -204,7 +205,7 @@ extern FILE *debug; if (debug != NULL) \ { \ debug_message_prefix (); \ - fprintf (debug, Fmt, Arg1); \ + xfprintf (debug, Fmt, Arg1); \ putc ('\n', debug); \ } \ } \ @@ -216,7 +217,7 @@ extern FILE *debug; if (debug != NULL) \ { \ debug_message_prefix (); \ - fprintf (debug, Fmt, Arg1, Arg2); \ + xfprintf (debug, Fmt, Arg1, Arg2); \ putc ('\n', debug); \ } \ } \ @@ -422,6 +423,7 @@ void undivert_all (void); void expand_user_macro (struct obstack *, symbol *, int, token_data **); void m4_placeholder (struct obstack *, int, token_data **); void init_pattern_buffer (struct re_pattern_buffer *, struct re_registers *); +const char *ntoa (int32_t, int); const builtin *find_builtin_by_addr (builtin_func *); const builtin *find_builtin_by_name (const char *); diff -ruNp m4-1.4.10/src/macro.c m4-1.4.11/src/macro.c --- m4-1.4.10/src/macro.c 2007-07-04 21:56:05.000000000 -0600 +++ m4-1.4.11/src/macro.c 2008-03-29 16:33:27.000000000 -0600 @@ -3,20 +3,20 @@ Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 2006, 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + This file is part of GNU M4. + + GNU M4 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 + 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, + GNU M4 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, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* This file contains the functions, that performs the basic argument diff -ruNp m4-1.4.10/src/output.c m4-1.4.11/src/output.c --- m4-1.4.10/src/output.c 2007-07-04 21:56:06.000000000 -0600 +++ m4-1.4.11/src/output.c 2008-03-29 16:33:27.000000000 -0600 @@ -3,20 +3,20 @@ Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + This file is part of GNU M4. + + GNU M4 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 + 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, + GNU M4 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, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "m4.h" @@ -252,6 +252,11 @@ m4_tmpopen (int divnum) else if (set_cloexec_flag (fileno (file), true) != 0) M4ERROR ((warning_status, errno, "Warning: cannot protect diversion across forks")); + /* POSIX states that it is undefined whether an append stream starts + at offset 0 or at the end. We want the beginning. */ + else if (fseeko (file, 0, SEEK_SET) != 0) + M4ERROR ((EXIT_FAILURE, errno, + "cannot seek to beginning of diversion")); return file; } @@ -463,7 +468,6 @@ void shipout_text (struct obstack *obs, const char *text, int length, int line) { static bool start_of_output_line = true; - char linebuf[20]; const char *cursor; /* If output goes to an obstack, merely add TEXT to it. */ @@ -514,7 +518,7 @@ shipout_text (struct obstack *obs, const start_of_output_line = false; output_current_line++; #ifdef DEBUG_OUTPUT - fprintf (stderr, "DEBUG: line %d, cur %d, cur out %d\n", + xfprintf (stderr, "DEBUG: line %d, cur %d, cur out %d\n", line, current_line, output_current_line); #endif @@ -524,8 +528,13 @@ shipout_text (struct obstack *obs, const if (output_current_line != line) { - sprintf (linebuf, "#line %d", line); - for (cursor = linebuf; *cursor; cursor++) + OUTPUT_CHARACTER ('#'); + OUTPUT_CHARACTER ('l'); + OUTPUT_CHARACTER ('i'); + OUTPUT_CHARACTER ('n'); + OUTPUT_CHARACTER ('e'); + OUTPUT_CHARACTER (' '); + for (cursor = ntoa (line, 10); *cursor; cursor++) OUTPUT_CHARACTER (*cursor); if (output_current_line < 1 && current_file[0] != '\0') { @@ -548,7 +557,7 @@ shipout_text (struct obstack *obs, const start_of_output_line = false; output_current_line++; #ifdef DEBUG_OUTPUT - fprintf (stderr, "DEBUG: line %d, cur %d, cur out %d\n", + xfprintf (stderr, "DEBUG: line %d, cur %d, cur out %d\n", line, current_line, output_current_line); #endif } @@ -802,7 +811,7 @@ freeze_diversions (FILE *file) if (diversion->size || diversion->used) { if (diversion->size) - fprintf (file, "D%d,%d\n", diversion->divnum, diversion->used); + xfprintf (file, "D%d,%d\n", diversion->divnum, diversion->used); else { struct stat file_stat; @@ -812,8 +821,8 @@ freeze_diversions (FILE *file) if (file_stat.st_size < 0 || file_stat.st_size != (unsigned long int) file_stat.st_size) M4ERROR ((EXIT_FAILURE, 0, "diversion too large")); - fprintf (file, "D%d,%lu\n", diversion->divnum, - (unsigned long int) file_stat.st_size); + xfprintf (file, "D%d,%lu\n", diversion->divnum, + (unsigned long int) file_stat.st_size); } insert_diversion_helper (diversion); @@ -827,5 +836,5 @@ freeze_diversions (FILE *file) /* Save the active diversion number, if not already. */ if (saved_number != last_inserted) - fprintf (file, "D%d,0\n\n", saved_number); + xfprintf (file, "D%d,0\n\n", saved_number); } diff -ruNp m4-1.4.10/src/path.c m4-1.4.11/src/path.c --- m4-1.4.10/src/path.c 2007-07-04 21:56:06.000000000 -0600 +++ m4-1.4.11/src/path.c 2008-03-29 16:33:27.000000000 -0600 @@ -3,20 +3,20 @@ Copyright (C) 1989, 1990, 1991, 1992, 1993, 2004, 2006, 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + This file is part of GNU M4. + + GNU M4 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 + 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, + GNU M4 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, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Handling of path search of included files via the builtins "include" @@ -101,7 +101,7 @@ add_include_directory (const char *dir) dir_list_end = incl; #ifdef DEBUG_INCL - fprintf (stderr, "add_include_directory (%s);\n", dir); + xfprintf (stderr, "add_include_directory (%s);\n", dir); #endif } @@ -154,7 +154,7 @@ m4_path_search (const char *file, char * strcpy (name + incl->len + 1, file); #ifdef DEBUG_INCL - fprintf (stderr, "m4_path_search (%s) -- trying %s\n", file, name); + xfprintf (stderr, "m4_path_search (%s) -- trying %s\n", file, name); #endif fp = fopen (name, "r"); @@ -185,9 +185,9 @@ include_dump (void) { includes *incl; - fprintf (stderr, "include_dump:\n"); + xfprintf (stderr, "include_dump:\n"); for (incl = dir_list; incl != NULL; incl = incl->next) - fprintf (stderr, "\t%s\n", incl->dir); + xfprintf (stderr, "\t%s\n", incl->dir); } #endif /* DEBUG_INCL */ diff -ruNp m4-1.4.10/src/stackovf.c m4-1.4.11/src/stackovf.c --- m4-1.4.10/src/stackovf.c 2007-07-04 21:56:06.000000000 -0600 +++ m4-1.4.11/src/stackovf.c 2008-03-28 07:03:20.000000000 -0600 @@ -1,21 +1,22 @@ /* Detect stack overflow (when getrlimit and sigaction or sigvec are available) + Copyright (C) 1993, 1994, 2006, 2007 Free Software Foundation, Inc. Jim Avera <jima@netcom.com>, October 1993. - This program is free software; you can redistribute it and/or modify + This file is part of GNU M4. + + GNU M4 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 + 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, + GNU M4 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, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Compiled only when USE_STACKOVF is defined, which itself requires @@ -153,8 +154,9 @@ process_sigsegv (int signo, const char * { char buf[140]; - sprintf (buf, "process_sigsegv: p=%#lx stackend=%#lx diff=%ld bot=%#lx\n", - (long) p, (long) stackend, (long) diff, (long) stackbot); + snprintf (buf, sizeof buf, + "process_sigsegv: p=%#lx stackend=%#lx diff=%ld bot=%#lx\n", + (long) p, (long) stackend, (long) diff, (long) stackbot); write (2, buf, strlen (buf)); } #endif diff -ruNp m4-1.4.10/src/symtab.c m4-1.4.11/src/symtab.c --- m4-1.4.10/src/symtab.c 2007-07-04 21:56:06.000000000 -0600 +++ m4-1.4.11/src/symtab.c 2008-03-29 16:33:27.000000000 -0600 @@ -3,20 +3,20 @@ Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 2003, 2006, 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + This file is part of GNU M4. + + GNU M4 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 + 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, + GNU M4 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, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* This file handles all the low level work around the symbol table. The @@ -56,10 +56,10 @@ show_profile (void) int i; for (i = 0; i < 5; i++) { - fprintf(stderr, "m4: lookup mode %d called %d times, %d compares, " - "%d misses, %lld bytes\n", - i, profiles[i].entry, profiles[i].comparisons, - profiles[i].misses, profiles[i].bytes); + xfprintf(stderr, "m4: lookup mode %d called %d times, %d compares, " + "%d misses, %lld bytes\n", + i, profiles[i].entry, profiles[i].comparisons, + profiles[i].misses, profiles[i].bytes); } } @@ -371,7 +371,7 @@ symtab_debug (void) s = lookup_symbol (text, SYMBOL_LOOKUP); if (s == NULL) - printf ("Name `%s' is unknown\n", text); + xprintf ("Name `%s' is unknown\n", text); if (delete) (void) lookup_symbol (text, SYMBOL_DELETE); @@ -387,17 +387,17 @@ symtab_print_list (int i) symbol *sym; size_t h; - printf ("Symbol dump #%d:\n", i); + xprintf ("Symbol dump #%d:\n", i); for (h = 0; h < hash_table_size; h++) for (sym = symtab[h]; sym != NULL; sym = sym->next) - printf ("\tname %s, bucket %lu, addr %p, next %p, " - "flags%s%s%s, pending %d\n", - SYMBOL_NAME (sym), - (unsigned long int) h, sym, SYMBOL_NEXT (sym), - SYMBOL_TRACED (sym) ? " traced" : "", - SYMBOL_SHADOWED (sym) ? " shadowed" : "", - SYMBOL_DELETED (sym) ? " deleted" : "", - SYMBOL_PENDING_EXPANSIONS (sym)); + xprintf ("\tname %s, bucket %lu, addr %p, next %p, " + "flags%s%s%s, pending %d\n", + SYMBOL_NAME (sym), + (unsigned long int) h, sym, SYMBOL_NEXT (sym), + SYMBOL_TRACED (sym) ? " traced" : "", + SYMBOL_SHADOWED (sym) ? " shadowed" : "", + SYMBOL_DELETED (sym) ? " deleted" : "", + SYMBOL_PENDING_EXPANSIONS (sym)); } #endif /* DEBUG_SYM */ diff -ruNp m4-1.4.10/tests/Makefile.am m4-1.4.11/tests/Makefile.am --- m4-1.4.10/tests/Makefile.am 2007-07-04 22:06:07.000000000 -0600 +++ m4-1.4.11/tests/Makefile.am 2008-04-01 20:25:40.000000000 -0600 @@ -1,6 +1,6 @@ ## DO NOT EDIT! GENERATED AUTOMATICALLY! ## Process this file with automake to produce Makefile.in. -# Copyright (C) 2004-2007 Free Software Foundation, Inc. +# Copyright (C) 2002-2008 Free Software Foundation, Inc. # # This file is free software, distributed under the terms of the GNU # General Public License. As a special exception to the GNU General @@ -12,14 +12,14 @@ AUTOMAKE_OPTIONS = 1.5 foreign -ACLOCAL_AMFLAGS = -I ../m4 - SUBDIRS = TESTS = TESTS_ENVIRONMENT = noinst_PROGRAMS = check_PROGRAMS = noinst_HEADERS = +noinst_LIBRARIES = +check_LIBRARIES = libtests.a EXTRA_DIST = BUILT_SOURCES = SUFFIXES = @@ -34,29 +34,61 @@ AM_CPPFLAGS = \ -I.. -I$(srcdir)/.. \ -I../lib -I$(srcdir)/../lib -LDADD = ../lib/libm4.a +LDADD = libtests.a ../lib/libm4.a libtests.a $(LIBTESTS_LIBDEPS) + +libtests_a_SOURCES = +libtests_a_LIBADD = $(M4tests_LIBOBJS) +libtests_a_DEPENDENCIES = $(M4tests_LIBOBJS) +EXTRA_libtests_a_SOURCES = +AM_LIBTOOLFLAGS = --preserve-dup-deps + +## begin gnulib module EOVERFLOW-tests + +TESTS += test-EOVERFLOW +check_PROGRAMS += test-EOVERFLOW +EXTRA_DIST += test-EOVERFLOW.c + +## end gnulib module EOVERFLOW-tests ## begin gnulib module alloca-opt-tests TESTS += test-alloca-opt check_PROGRAMS += test-alloca-opt +EXTRA_DIST += test-alloca-opt.c + ## end gnulib module alloca-opt-tests +## begin gnulib module array-list + +libtests_a_SOURCES += gl_array_list.h gl_array_list.c + +## end gnulib module array-list + ## begin gnulib module array-list-tests TESTS += test-array_list check_PROGRAMS += test-array_list test_array_list_LDADD = $(LDADD) @LIBINTL@ +EXTRA_DIST += test-array_list.c + ## end gnulib module array-list-tests +## begin gnulib module array-oset + +libtests_a_SOURCES += gl_array_oset.h gl_array_oset.c + +## end gnulib module array-oset + ## begin gnulib module array-oset-tests TESTS += test-array_oset check_PROGRAMS += test-array_oset test_array_oset_LDADD = $(LDADD) @LIBINTL@ +EXTRA_DIST += test-array_oset.c + ## end gnulib module array-oset-tests ## begin gnulib module avltree-oset-tests @@ -64,52 +96,102 @@ test_array_oset_LDADD = $(LDADD) @LIBINT TESTS += test-avltree_oset check_PROGRAMS += test-avltree_oset test_avltree_oset_LDADD = $(LDADD) @LIBINTL@ +EXTRA_DIST += test-avltree_oset.c + ## end gnulib module avltree-oset-tests ## begin gnulib module binary-io-tests TESTS += test-binary-io.sh TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' -EXTRA_DIST += test-binary-io.sh check_PROGRAMS += test-binary-io +EXTRA_DIST += test-binary-io.sh test-binary-io.c + ## end gnulib module binary-io-tests +## begin gnulib module c-ctype-tests + +TESTS += test-c-ctype +check_PROGRAMS += test-c-ctype + +EXTRA_DIST += test-c-ctype.c + +## end gnulib module c-ctype-tests + ## begin gnulib module closein-tests TESTS += test-closein.sh TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' check_PROGRAMS += test-closein -EXTRA_DIST += test-closein.sh test_closein_LDADD = $(LDADD) @LIBINTL@ +EXTRA_DIST += test-closein.sh test-closein.c + ## end gnulib module closein-tests ## begin gnulib module fflush-tests -TESTS += test-fflush -check_PROGRAMS += test-fflush +TESTS += test-fflush test-fflush2.sh +TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)' +check_PROGRAMS += test-fflush test-fflush2 MOSTLYCLEANFILES += test-fflush.txt +EXTRA_DIST += test-fflush.c test-fflush2.sh test-fflush2.c + ## end gnulib module fflush-tests +## begin gnulib module fpending-tests + +TESTS += test-fpending.sh +TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' +check_PROGRAMS += test-fpending +MOSTLYCLEANFILES += test-fpending.t +EXTRA_DIST += test-fpending.c test-fpending.sh + +## end gnulib module fpending-tests + ## begin gnulib module fpurge-tests TESTS += test-fpurge check_PROGRAMS += test-fpurge MOSTLYCLEANFILES += t-fpurge.tmp +EXTRA_DIST += test-fpurge.c + ## end gnulib module fpurge-tests +## begin gnulib module freadahead-tests + +TESTS += test-freadahead.sh +TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)' +check_PROGRAMS += test-freadahead +EXTRA_DIST += test-freadahead.c test-freadahead.sh + +## end gnulib module freadahead-tests + ## begin gnulib module freading-tests TESTS += test-freading check_PROGRAMS += test-freading MOSTLYCLEANFILES += t-freading.tmp +EXTRA_DIST += test-freading.c + ## end gnulib module freading-tests +## begin gnulib module frexp-nolibm-tests + +TESTS += test-frexp +check_PROGRAMS += test-frexp + +EXTRA_DIST += test-frexp.c + +## end gnulib module frexp-nolibm-tests + ## begin gnulib module frexpl-nolibm-tests TESTS += test-frexpl check_PROGRAMS += test-frexpl +EXTRA_DIST += test-frexpl.c + ## end gnulib module frexpl-nolibm-tests ## begin gnulib module fseeko-tests @@ -117,7 +199,8 @@ check_PROGRAMS += test-frexpl TESTS += test-fseeko.sh TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)' check_PROGRAMS += test-fseeko -EXTRA_DIST += test-fseeko.sh +EXTRA_DIST += test-fseeko.c test-fseeko.sh + ## end gnulib module fseeko-tests ## begin gnulib module ftello-tests @@ -125,7 +208,8 @@ EXTRA_DIST += test-fseeko.sh TESTS += test-ftello.sh TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)' check_PROGRAMS += test-ftello -EXTRA_DIST += test-ftello.sh +EXTRA_DIST += test-ftello.c test-ftello.sh + ## end gnulib module ftello-tests ## begin gnulib module gettimeofday-tests @@ -133,27 +217,34 @@ EXTRA_DIST += test-ftello.sh TESTS += test-gettimeofday check_PROGRAMS += test-gettimeofday +EXTRA_DIST += test-gettimeofday.c + ## end gnulib module gettimeofday-tests -## begin gnulib module isnan-nolibm-tests +## begin gnulib module isnand-nolibm-tests + +TESTS += test-isnand +check_PROGRAMS += test-isnand -TESTS += test-isnan -check_PROGRAMS += test-isnan +EXTRA_DIST += test-isnand.c nan.h -## end gnulib module isnan-nolibm-tests +## end gnulib module isnand-nolibm-tests ## begin gnulib module isnanf-nolibm-tests TESTS += test-isnanf check_PROGRAMS += test-isnanf +EXTRA_DIST += test-isnanf.c nan.h + ## end gnulib module isnanf-nolibm-tests ## begin gnulib module isnanl-nolibm-tests TESTS += test-isnanl-nolibm check_PROGRAMS += test-isnanl-nolibm -EXTRA_DIST += test-isnanl.h + +EXTRA_DIST += test-isnanl-nolibm.c test-isnanl.h ## end gnulib module isnanl-nolibm-tests @@ -162,6 +253,8 @@ EXTRA_DIST += test-isnanl.h TESTS += test-linkedhash_list check_PROGRAMS += test-linkedhash_list test_linkedhash_list_LDADD = $(LDADD) @LIBINTL@ +EXTRA_DIST += test-linkedhash_list.c + ## end gnulib module linkedhash-list-tests ## begin gnulib module lseek-tests @@ -169,7 +262,8 @@ test_linkedhash_list_LDADD = $(LDADD) @L TESTS += test-lseek.sh TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)' check_PROGRAMS += test-lseek -EXTRA_DIST += test-lseek.sh +EXTRA_DIST += test-lseek.c test-lseek.sh + ## end gnulib module lseek-tests ## begin gnulib module malloca-tests @@ -177,6 +271,8 @@ EXTRA_DIST += test-lseek.sh TESTS += test-malloca check_PROGRAMS += test-malloca +EXTRA_DIST += test-malloca.c + ## end gnulib module malloca-tests ## begin gnulib module math-tests @@ -184,6 +280,8 @@ check_PROGRAMS += test-malloca TESTS += test-math check_PROGRAMS += test-math +EXTRA_DIST += test-math.c + ## end gnulib module math-tests ## begin gnulib module printf-frexp-tests @@ -191,6 +289,8 @@ check_PROGRAMS += test-math TESTS += test-printf-frexp check_PROGRAMS += test-printf-frexp +EXTRA_DIST += test-printf-frexp.c + ## end gnulib module printf-frexp-tests ## begin gnulib module printf-frexpl-tests @@ -198,13 +298,31 @@ check_PROGRAMS += test-printf-frexp TESTS += test-printf-frexpl check_PROGRAMS += test-printf-frexpl +EXTRA_DIST += test-printf-frexpl.c + ## end gnulib module printf-frexpl-tests +## begin gnulib module progname + +libtests_a_SOURCES += progname.h progname.c + +## end gnulib module progname + +## begin gnulib module quotearg-tests + +TESTS += test-quotearg +check_PROGRAMS += test-quotearg +EXTRA_DIST += test-quotearg.c + +## end gnulib module quotearg-tests + ## begin gnulib module signbit-tests TESTS += test-signbit check_PROGRAMS += test-signbit +EXTRA_DIST += test-signbit.c + ## end gnulib module signbit-tests ## begin gnulib module stdbool-tests @@ -212,6 +330,8 @@ check_PROGRAMS += test-signbit TESTS += test-stdbool check_PROGRAMS += test-stdbool +EXTRA_DIST += test-stdbool.c + ## end gnulib module stdbool-tests ## begin gnulib module stdint-tests @@ -219,6 +339,8 @@ check_PROGRAMS += test-stdbool TESTS += test-stdint check_PROGRAMS += test-stdint +EXTRA_DIST += test-stdint.c + ## end gnulib module stdint-tests ## begin gnulib module stdio-tests @@ -226,6 +348,8 @@ check_PROGRAMS += test-stdint TESTS += test-stdio check_PROGRAMS += test-stdio +EXTRA_DIST += test-stdio.c + ## end gnulib module stdio-tests ## begin gnulib module stdlib-tests @@ -233,13 +357,52 @@ check_PROGRAMS += test-stdio TESTS += test-stdlib check_PROGRAMS += test-stdlib +EXTRA_DIST += test-stdlib.c + ## end gnulib module stdlib-tests +## begin gnulib module strerror-tests + +TESTS += test-strerror +check_PROGRAMS += test-strerror +EXTRA_DIST += test-strerror.c + +## end gnulib module strerror-tests + +## begin gnulib module string-tests + +TESTS += test-string +check_PROGRAMS += test-string + +EXTRA_DIST += test-string.c + +## end gnulib module string-tests + +## begin gnulib module strstr-tests + +TESTS += test-strstr +check_PROGRAMS += test-strstr + +EXTRA_DIST += test-strstr.c + +## end gnulib module strstr-tests + +## begin gnulib module strtod-tests + +LIBS += $(POW_LIB) +TESTS += test-strtod +check_PROGRAMS += test-strtod +EXTRA_DIST += test-strtod.c + +## end gnulib module strtod-tests + ## begin gnulib module sys_stat-tests TESTS += test-sys_stat check_PROGRAMS += test-sys_stat +EXTRA_DIST += test-sys_stat.c + ## end gnulib module sys_stat-tests ## begin gnulib module sys_time-tests @@ -247,6 +410,8 @@ check_PROGRAMS += test-sys_stat TESTS += test-sys_time check_PROGRAMS += test-sys_time +EXTRA_DIST += test-sys_time.c + ## end gnulib module sys_time-tests ## begin gnulib module unistd-tests @@ -254,6 +419,8 @@ check_PROGRAMS += test-sys_time TESTS += test-unistd check_PROGRAMS += test-unistd +EXTRA_DIST += test-unistd.c + ## end gnulib module unistd-tests ## begin gnulib module vasnprintf-tests @@ -261,6 +428,8 @@ check_PROGRAMS += test-unistd TESTS += test-vasnprintf check_PROGRAMS += test-vasnprintf +EXTRA_DIST += test-vasnprintf.c + ## end gnulib module vasnprintf-tests ## begin gnulib module vasprintf-posix-tests @@ -268,6 +437,8 @@ check_PROGRAMS += test-vasnprintf TESTS += test-vasprintf-posix check_PROGRAMS += test-vasprintf-posix +EXTRA_DIST += test-vasprintf-posix.c nan.h + ## end gnulib module vasprintf-posix-tests ## begin gnulib module vasprintf-tests @@ -275,13 +446,23 @@ check_PROGRAMS += test-vasprintf-posix TESTS += test-vasprintf check_PROGRAMS += test-vasprintf +EXTRA_DIST += test-vasprintf.c + ## end gnulib module vasprintf-tests +## begin gnulib module verify + +libtests_a_SOURCES += verify.h + +## end gnulib module verify + ## begin gnulib module wchar-tests TESTS += test-wchar check_PROGRAMS += test-wchar +EXTRA_DIST += test-wchar.c + ## end gnulib module wchar-tests ## begin gnulib module wctype-tests @@ -289,6 +470,8 @@ check_PROGRAMS += test-wchar TESTS += test-wctype check_PROGRAMS += test-wctype +EXTRA_DIST += test-wctype.c + ## end gnulib module wctype-tests ## begin gnulib module xvasprintf-tests @@ -297,6 +480,8 @@ TESTS += test-xvasprintf check_PROGRAMS += test-xvasprintf test_xvasprintf_LDADD = $(LDADD) @LIBINTL@ +EXTRA_DIST += test-xvasprintf.c + ## end gnulib module xvasprintf-tests # Clean up after Solaris cc. diff -ruNp m4-1.4.10/tests/Makefile.in m4-1.4.11/tests/Makefile.in --- m4-1.4.10/tests/Makefile.in 2007-07-09 21:15:34.000000000 -0600 +++ m4-1.4.11/tests/Makefile.in 2008-04-02 06:45:30.000000000 -0600 @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.10 from Makefile.am. +# Makefile.in generated by automake 1.10.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -14,7 +14,7 @@ @SET_MAKE@ -# Copyright (C) 2004-2007 Free Software Foundation, Inc. +# Copyright (C) 2002-2008 Free Software Foundation, Inc. # # This file is free software, distributed under the terms of the GNU # General Public License. As a special exception to the GNU General @@ -25,6 +25,7 @@ # Generated by gnulib-tool. + VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -43,37 +44,45 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -TESTS = test-alloca-opt$(EXEEXT) test-array_list$(EXEEXT) \ - test-array_oset$(EXEEXT) test-avltree_oset$(EXEEXT) \ - test-binary-io.sh test-closein.sh test-fflush$(EXEEXT) \ - test-fpurge$(EXEEXT) test-freading$(EXEEXT) \ +TESTS = test-EOVERFLOW$(EXEEXT) test-alloca-opt$(EXEEXT) \ + test-array_list$(EXEEXT) test-array_oset$(EXEEXT) \ + test-avltree_oset$(EXEEXT) test-binary-io.sh \ + test-c-ctype$(EXEEXT) test-closein.sh test-fflush$(EXEEXT) \ + test-fflush2.sh test-fpending.sh test-fpurge$(EXEEXT) \ + test-freadahead.sh test-freading$(EXEEXT) test-frexp$(EXEEXT) \ test-frexpl$(EXEEXT) test-fseeko.sh test-ftello.sh \ - test-gettimeofday$(EXEEXT) test-isnan$(EXEEXT) \ + test-gettimeofday$(EXEEXT) test-isnand$(EXEEXT) \ test-isnanf$(EXEEXT) test-isnanl-nolibm$(EXEEXT) \ test-linkedhash_list$(EXEEXT) test-lseek.sh \ test-malloca$(EXEEXT) test-math$(EXEEXT) \ test-printf-frexp$(EXEEXT) test-printf-frexpl$(EXEEXT) \ - test-signbit$(EXEEXT) test-stdbool$(EXEEXT) \ - test-stdint$(EXEEXT) test-stdio$(EXEEXT) test-stdlib$(EXEEXT) \ + test-quotearg$(EXEEXT) test-signbit$(EXEEXT) \ + test-stdbool$(EXEEXT) test-stdint$(EXEEXT) test-stdio$(EXEEXT) \ + test-stdlib$(EXEEXT) test-strerror$(EXEEXT) \ + test-string$(EXEEXT) test-strstr$(EXEEXT) test-strtod$(EXEEXT) \ test-sys_stat$(EXEEXT) test-sys_time$(EXEEXT) \ test-unistd$(EXEEXT) test-vasnprintf$(EXEEXT) \ test-vasprintf-posix$(EXEEXT) test-vasprintf$(EXEEXT) \ test-wchar$(EXEEXT) test-wctype$(EXEEXT) \ test-xvasprintf$(EXEEXT) noinst_PROGRAMS = -check_PROGRAMS = test-alloca-opt$(EXEEXT) test-array_list$(EXEEXT) \ - test-array_oset$(EXEEXT) test-avltree_oset$(EXEEXT) \ - test-binary-io$(EXEEXT) test-closein$(EXEEXT) \ - test-fflush$(EXEEXT) test-fpurge$(EXEEXT) \ - test-freading$(EXEEXT) test-frexpl$(EXEEXT) \ - test-fseeko$(EXEEXT) test-ftello$(EXEEXT) \ - test-gettimeofday$(EXEEXT) test-isnan$(EXEEXT) \ - test-isnanf$(EXEEXT) test-isnanl-nolibm$(EXEEXT) \ - test-linkedhash_list$(EXEEXT) test-lseek$(EXEEXT) \ - test-malloca$(EXEEXT) test-math$(EXEEXT) \ +check_PROGRAMS = test-EOVERFLOW$(EXEEXT) test-alloca-opt$(EXEEXT) \ + test-array_list$(EXEEXT) test-array_oset$(EXEEXT) \ + test-avltree_oset$(EXEEXT) test-binary-io$(EXEEXT) \ + test-c-ctype$(EXEEXT) test-closein$(EXEEXT) \ + test-fflush$(EXEEXT) test-fflush2$(EXEEXT) \ + test-fpending$(EXEEXT) test-fpurge$(EXEEXT) \ + test-freadahead$(EXEEXT) test-freading$(EXEEXT) \ + test-frexp$(EXEEXT) test-frexpl$(EXEEXT) test-fseeko$(EXEEXT) \ + test-ftello$(EXEEXT) test-gettimeofday$(EXEEXT) \ + test-isnand$(EXEEXT) test-isnanf$(EXEEXT) \ + test-isnanl-nolibm$(EXEEXT) test-linkedhash_list$(EXEEXT) \ + test-lseek$(EXEEXT) test-malloca$(EXEEXT) test-math$(EXEEXT) \ test-printf-frexp$(EXEEXT) test-printf-frexpl$(EXEEXT) \ - test-signbit$(EXEEXT) test-stdbool$(EXEEXT) \ - test-stdint$(EXEEXT) test-stdio$(EXEEXT) test-stdlib$(EXEEXT) \ + test-quotearg$(EXEEXT) test-signbit$(EXEEXT) \ + test-stdbool$(EXEEXT) test-stdint$(EXEEXT) test-stdio$(EXEEXT) \ + test-stdlib$(EXEEXT) test-strerror$(EXEEXT) \ + test-string$(EXEEXT) test-strstr$(EXEEXT) test-strtod$(EXEEXT) \ test-sys_stat$(EXEEXT) test-sys_time$(EXEEXT) \ test-unistd$(EXEEXT) test-vasnprintf$(EXEEXT) \ test-vasprintf-posix$(EXEEXT) test-vasprintf$(EXEEXT) \ @@ -93,22 +102,23 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/a $(top_srcdir)/m4/fatal-signal.m4 $(top_srcdir)/m4/fflush.m4 \ $(top_srcdir)/m4/float_h.m4 $(top_srcdir)/m4/fpending.m4 \ $(top_srcdir)/m4/fpieee.m4 $(top_srcdir)/m4/fpurge.m4 \ - $(top_srcdir)/m4/freading.m4 $(top_srcdir)/m4/free.m4 \ - $(top_srcdir)/m4/frexp.m4 $(top_srcdir)/m4/frexpl.m4 \ - $(top_srcdir)/m4/fseeko.m4 $(top_srcdir)/m4/ftello.m4 \ - $(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gettimeofday.m4 \ - $(top_srcdir)/m4/gl_list.m4 $(top_srcdir)/m4/glibc21.m4 \ - $(top_srcdir)/m4/gnulib-common.m4 \ + $(top_srcdir)/m4/freading.m4 $(top_srcdir)/m4/frexp.m4 \ + $(top_srcdir)/m4/frexpl.m4 $(top_srcdir)/m4/fseeko.m4 \ + $(top_srcdir)/m4/ftello.m4 $(top_srcdir)/m4/getopt.m4 \ + $(top_srcdir)/m4/gettimeofday.m4 $(top_srcdir)/m4/gl_list.m4 \ + $(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/gnulib-common.m4 \ $(top_srcdir)/m4/gnulib-comp.m4 \ $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/inline.m4 \ $(top_srcdir)/m4/intmax_t.m4 $(top_srcdir)/m4/inttypes_h.m4 \ - $(top_srcdir)/m4/isnan.m4 $(top_srcdir)/m4/isnanf.m4 \ + $(top_srcdir)/m4/isnand.m4 $(top_srcdir)/m4/isnanf.m4 \ $(top_srcdir)/m4/isnanl.m4 $(top_srcdir)/m4/ldexpl.m4 \ $(top_srcdir)/m4/localcharset.m4 $(top_srcdir)/m4/longlong.m4 \ - $(top_srcdir)/m4/lseek.m4 $(top_srcdir)/m4/malloca.m4 \ - $(top_srcdir)/m4/math_h.m4 $(top_srcdir)/m4/mbrtowc.m4 \ - $(top_srcdir)/m4/mbstate_t.m4 $(top_srcdir)/m4/mkdtemp.m4 \ - $(top_srcdir)/m4/mkstemp.m4 $(top_srcdir)/m4/pathmax.m4 \ + $(top_srcdir)/m4/lseek.m4 $(top_srcdir)/m4/malloc.m4 \ + $(top_srcdir)/m4/malloca.m4 $(top_srcdir)/m4/math_h.m4 \ + $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbstate_t.m4 \ + $(top_srcdir)/m4/memchr.m4 $(top_srcdir)/m4/memcmp.m4 \ + $(top_srcdir)/m4/mkdtemp.m4 $(top_srcdir)/m4/mkstemp.m4 \ + $(top_srcdir)/m4/nocrash.m4 $(top_srcdir)/m4/pathmax.m4 \ $(top_srcdir)/m4/printf-frexp.m4 \ $(top_srcdir)/m4/printf-frexpl.m4 $(top_srcdir)/m4/printf.m4 \ $(top_srcdir)/m4/quotearg.m4 $(top_srcdir)/m4/regex.m4 \ @@ -119,11 +129,13 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/a $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdint_h.m4 \ $(top_srcdir)/m4/stdio-safer.m4 $(top_srcdir)/m4/stdio_h.m4 \ $(top_srcdir)/m4/stdlib-safer.m4 $(top_srcdir)/m4/stdlib_h.m4 \ + $(top_srcdir)/m4/strerror.m4 $(top_srcdir)/m4/string_h.m4 \ + $(top_srcdir)/m4/strstr.m4 $(top_srcdir)/m4/strtod.m4 \ $(top_srcdir)/m4/strtol.m4 $(top_srcdir)/m4/sys_stat_h.m4 \ $(top_srcdir)/m4/sys_time_h.m4 $(top_srcdir)/m4/tempname.m4 \ - $(top_srcdir)/m4/tmpdir.m4 $(top_srcdir)/m4/ulonglong.m4 \ - $(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/unistd_h.m4 \ - $(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/vasnprintf.m4 \ + $(top_srcdir)/m4/tmpdir.m4 $(top_srcdir)/m4/unistd-safer.m4 \ + $(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/unlocked-io.m4 \ + $(top_srcdir)/m4/vasnprintf.m4 \ $(top_srcdir)/m4/vasprintf-posix.m4 \ $(top_srcdir)/m4/vasprintf.m4 $(top_srcdir)/m4/wchar.m4 \ $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wctype.m4 \ @@ -135,174 +147,277 @@ am__configure_deps = $(am__aclocal_m4_de mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/lib/config.h CONFIG_CLEAN_FILES = +LIBRARIES = $(noinst_LIBRARIES) +AR = ar +ARFLAGS = cru +libtests_a_AR = $(AR) $(ARFLAGS) +am__DEPENDENCIES_1 = +am_libtests_a_OBJECTS = gl_array_list.$(OBJEXT) \ + gl_array_oset.$(OBJEXT) progname.$(OBJEXT) +libtests_a_OBJECTS = $(am_libtests_a_OBJECTS) PROGRAMS = $(noinst_PROGRAMS) +test_EOVERFLOW_SOURCES = test-EOVERFLOW.c +test_EOVERFLOW_OBJECTS = test-EOVERFLOW.$(OBJEXT) +test_EOVERFLOW_LDADD = $(LDADD) +test_EOVERFLOW_DEPENDENCIES = libtests.a ../lib/libm4.a libtests.a \ + $(am__DEPENDENCIES_1) test_alloca_opt_SOURCES = test-alloca-opt.c test_alloca_opt_OBJECTS = test-alloca-opt.$(OBJEXT) test_alloca_opt_LDADD = $(LDADD) -test_alloca_opt_DEPENDENCIES = ../lib/libm4.a +test_alloca_opt_DEPENDENCIES = libtests.a ../lib/libm4.a libtests.a \ + $(am__DEPENDENCIES_1) test_array_list_SOURCES = test-array_list.c test_array_list_OBJECTS = test-array_list.$(OBJEXT) -test_array_list_DEPENDENCIES = $(LDADD) +am__DEPENDENCIES_2 = libtests.a ../lib/libm4.a libtests.a \ + $(am__DEPENDENCIES_1) +test_array_list_DEPENDENCIES = $(am__DEPENDENCIES_2) test_array_oset_SOURCES = test-array_oset.c test_array_oset_OBJECTS = test-array_oset.$(OBJEXT) -test_array_oset_DEPENDENCIES = $(LDADD) +test_array_oset_DEPENDENCIES = $(am__DEPENDENCIES_2) test_avltree_oset_SOURCES = test-avltree_oset.c test_avltree_oset_OBJECTS = test-avltree_oset.$(OBJEXT) -test_avltree_oset_DEPENDENCIES = $(LDADD) +test_avltree_oset_DEPENDENCIES = $(am__DEPENDENCIES_2) test_binary_io_SOURCES = test-binary-io.c test_binary_io_OBJECTS = test-binary-io.$(OBJEXT) test_binary_io_LDADD = $(LDADD) -test_binary_io_DEPENDENCIES = ../lib/libm4.a +test_binary_io_DEPENDENCIES = libtests.a ../lib/libm4.a libtests.a \ + $(am__DEPENDENCIES_1) +test_c_ctype_SOURCES = test-c-ctype.c +test_c_ctype_OBJECTS = test-c-ctype.$(OBJEXT) +test_c_ctype_LDADD = $(LDADD) +test_c_ctype_DEPENDENCIES = libtests.a ../lib/libm4.a libtests.a \ + $(am__DEPENDENCIES_1) test_closein_SOURCES = test-closein.c test_closein_OBJECTS = test-closein.$(OBJEXT) -test_closein_DEPENDENCIES = $(LDADD) +test_closein_DEPENDENCIES = $(am__DEPENDENCIES_2) test_fflush_SOURCES = test-fflush.c test_fflush_OBJECTS = test-fflush.$(OBJEXT) test_fflush_LDADD = $(LDADD) -test_fflush_DEPENDENCIES = ../lib/libm4.a +test_fflush_DEPENDENCIES = libtests.a ../lib/libm4.a libtests.a \ + $(am__DEPENDENCIES_1) +test_fflush2_SOURCES = test-fflush2.c +test_fflush2_OBJECTS = test-fflush2.$(OBJEXT) +test_fflush2_LDADD = $(LDADD) +test_fflush2_DEPENDENCIES = libtests.a ../lib/libm4.a libtests.a \ + $(am__DEPENDENCIES_1) +test_fpending_SOURCES = test-fpending.c +test_fpending_OBJECTS = test-fpending.$(OBJEXT) +test_fpending_LDADD = $(LDADD) +test_fpending_DEPENDENCIES = libtests.a ../lib/libm4.a libtests.a \ + $(am__DEPENDENCIES_1) test_fpurge_SOURCES = test-fpurge.c test_fpurge_OBJECTS = test-fpurge.$(OBJEXT) test_fpurge_LDADD = $(LDADD) -test_fpurge_DEPENDENCIES = ../lib/libm4.a +test_fpurge_DEPENDENCIES = libtests.a ../lib/libm4.a libtests.a \ + $(am__DEPENDENCIES_1) +test_freadahead_SOURCES = test-freadahead.c +test_freadahead_OBJECTS = test-freadahead.$(OBJEXT) +test_freadahead_LDADD = $(LDADD) +test_freadahead_DEPENDENCIES = libtests.a ../lib/libm4.a libtests.a \ + $(am__DEPENDENCIES_1) test_freading_SOURCES = test-freading.c test_freading_OBJECTS = test-freading.$(OBJEXT) test_freading_LDADD = $(LDADD) -test_freading_DEPENDENCIES = ../lib/libm4.a +test_freading_DEPENDENCIES = libtests.a ../lib/libm4.a libtests.a \ + $(am__DEPENDENCIES_1) +test_frexp_SOURCES = test-frexp.c +test_frexp_OBJECTS = test-frexp.$(OBJEXT) +test_frexp_LDADD = $(LDADD) +test_frexp_DEPENDENCIES = libtests.a ../lib/libm4.a libtests.a \ + $(am__DEPENDENCIES_1) test_frexpl_SOURCES = test-frexpl.c test_frexpl_OBJECTS = test-frexpl.$(OBJEXT) test_frexpl_LDADD = $(LDADD) -test_frexpl_DEPENDENCIES = ../lib/libm4.a +test_frexpl_DEPENDENCIES = libtests.a ../lib/libm4.a libtests.a \ + $(am__DEPENDENCIES_1) test_fseeko_SOURCES = test-fseeko.c test_fseeko_OBJECTS = test-fseeko.$(OBJEXT) test_fseeko_LDADD = $(LDADD) -test_fseeko_DEPENDENCIES = ../lib/libm4.a +test_fseeko_DEPENDENCIES = libtests.a ../lib/libm4.a libtests.a \ + $(am__DEPENDENCIES_1) test_ftello_SOURCES = test-ftello.c test_ftello_OBJECTS = test-ftello.$(OBJEXT) test_ftello_LDADD = $(LDADD) -test_ftello_DEPENDENCIES = ../lib/libm4.a +test_ftello_DEPENDENCIES = libtests.a ../lib/libm4.a libtests.a \ + $(am__DEPENDENCIES_1) test_gettimeofday_SOURCES = test-gettimeofday.c test_gettimeofday_OBJECTS = test-gettimeofday.$(OBJEXT) test_gettimeofday_LDADD = $(LDADD) -test_gettimeofday_DEPENDENCIES = ../lib/libm4.a -test_isnan_SOURCES = test-isnan.c -test_isnan_OBJECTS = test-isnan.$(OBJEXT) -test_isnan_LDADD = $(LDADD) -test_isnan_DEPENDENCIES = ../lib/libm4.a +test_gettimeofday_DEPENDENCIES = libtests.a ../lib/libm4.a libtests.a \ + $(am__DEPENDENCIES_1) +test_isnand_SOURCES = test-isnand.c +test_isnand_OBJECTS = test-isnand.$(OBJEXT) +test_isnand_LDADD = $(LDADD) +test_isnand_DEPENDENCIES = libtests.a ../lib/libm4.a libtests.a \ + $(am__DEPENDENCIES_1) test_isnanf_SOURCES = test-isnanf.c test_isnanf_OBJECTS = test-isnanf.$(OBJEXT) test_isnanf_LDADD = $(LDADD) -test_isnanf_DEPENDENCIES = ../lib/libm4.a +test_isnanf_DEPENDENCIES = libtests.a ../lib/libm4.a libtests.a \ + $(am__DEPENDENCIES_1) test_isnanl_nolibm_SOURCES = test-isnanl-nolibm.c test_isnanl_nolibm_OBJECTS = test-isnanl-nolibm.$(OBJEXT) test_isnanl_nolibm_LDADD = $(LDADD) -test_isnanl_nolibm_DEPENDENCIES = ../lib/libm4.a +test_isnanl_nolibm_DEPENDENCIES = libtests.a ../lib/libm4.a libtests.a \ + $(am__DEPENDENCIES_1) test_linkedhash_list_SOURCES = test-linkedhash_list.c test_linkedhash_list_OBJECTS = test-linkedhash_list.$(OBJEXT) -test_linkedhash_list_DEPENDENCIES = $(LDADD) +test_linkedhash_list_DEPENDENCIES = $(am__DEPENDENCIES_2) test_lseek_SOURCES = test-lseek.c test_lseek_OBJECTS = test-lseek.$(OBJEXT) test_lseek_LDADD = $(LDADD) -test_lseek_DEPENDENCIES = ../lib/libm4.a +test_lseek_DEPENDENCIES = libtests.a ../lib/libm4.a libtests.a \ + $(am__DEPENDENCIES_1) test_malloca_SOURCES = test-malloca.c test_malloca_OBJECTS = test-malloca.$(OBJEXT) test_malloca_LDADD = $(LDADD) -test_malloca_DEPENDENCIES = ../lib/libm4.a +test_malloca_DEPENDENCIES = libtests.a ../lib/libm4.a libtests.a \ + $(am__DEPENDENCIES_1) test_math_SOURCES = test-math.c test_math_OBJECTS = test-math.$(OBJEXT) test_math_LDADD = $(LDADD) -test_math_DEPENDENCIES = ../lib/libm4.a +test_math_DEPENDENCIES = libtests.a ../lib/libm4.a libtests.a \ + $(am__DEPENDENCIES_1) test_printf_frexp_SOURCES = test-printf-frexp.c test_printf_frexp_OBJECTS = test-printf-frexp.$(OBJEXT) test_printf_frexp_LDADD = $(LDADD) -test_printf_frexp_DEPENDENCIES = ../lib/libm4.a +test_printf_frexp_DEPENDENCIES = libtests.a ../lib/libm4.a libtests.a \ + $(am__DEPENDENCIES_1) test_printf_frexpl_SOURCES = test-printf-frexpl.c test_printf_frexpl_OBJECTS = test-printf-frexpl.$(OBJEXT) test_printf_frexpl_LDADD = $(LDADD) -test_printf_frexpl_DEPENDENCIES = ../lib/libm4.a +test_printf_frexpl_DEPENDENCIES = libtests.a ../lib/libm4.a libtests.a \ + $(am__DEPENDENCIES_1) +test_quotearg_SOURCES = test-quotearg.c +test_quotearg_OBJECTS = test-quotearg.$(OBJEXT) +test_quotearg_LDADD = $(LDADD) +test_quotearg_DEPENDENCIES = libtests.a ../lib/libm4.a libtests.a \ + $(am__DEPENDENCIES_1) test_signbit_SOURCES = test-signbit.c test_signbit_OBJECTS = test-signbit.$(OBJEXT) test_signbit_LDADD = $(LDADD) -test_signbit_DEPENDENCIES = ../lib/libm4.a +test_signbit_DEPENDENCIES = libtests.a ../lib/libm4.a libtests.a \ + $(am__DEPENDENCIES_1) test_stdbool_SOURCES = test-stdbool.c test_stdbool_OBJECTS = test-stdbool.$(OBJEXT) test_stdbool_LDADD = $(LDADD) -test_stdbool_DEPENDENCIES = ../lib/libm4.a +test_stdbool_DEPENDENCIES = libtests.a ../lib/libm4.a libtests.a \ + $(am__DEPENDENCIES_1) test_stdint_SOURCES = test-stdint.c test_stdint_OBJECTS = test-stdint.$(OBJEXT) test_stdint_LDADD = $(LDADD) -test_stdint_DEPENDENCIES = ../lib/libm4.a +test_stdint_DEPENDENCIES = libtests.a ../lib/libm4.a libtests.a \ + $(am__DEPENDENCIES_1) test_stdio_SOURCES = test-stdio.c test_stdio_OBJECTS = test-stdio.$(OBJEXT) test_stdio_LDADD = $(LDADD) -test_stdio_DEPENDENCIES = ../lib/libm4.a +test_stdio_DEPENDENCIES = libtests.a ../lib/libm4.a libtests.a \ + $(am__DEPENDENCIES_1) test_stdlib_SOURCES = test-stdlib.c test_stdlib_OBJECTS = test-stdlib.$(OBJEXT) test_stdlib_LDADD = $(LDADD) -test_stdlib_DEPENDENCIES = ../lib/libm4.a +test_stdlib_DEPENDENCIES = libtests.a ../lib/libm4.a libtests.a \ + $(am__DEPENDENCIES_1) +test_strerror_SOURCES = test-strerror.c +test_strerror_OBJECTS = test-strerror.$(OBJEXT) +test_strerror_LDADD = $(LDADD) +test_strerror_DEPENDENCIES = libtests.a ../lib/libm4.a libtests.a \ + $(am__DEPENDENCIES_1) +test_string_SOURCES = test-string.c +test_string_OBJECTS = test-string.$(OBJEXT) +test_string_LDADD = $(LDADD) +test_string_DEPENDENCIES = libtests.a ../lib/libm4.a libtests.a \ + $(am__DEPENDENCIES_1) +test_strstr_SOURCES = test-strstr.c +test_strstr_OBJECTS = test-strstr.$(OBJEXT) +test_strstr_LDADD = $(LDADD) +test_strstr_DEPENDENCIES = libtests.a ../lib/libm4.a libtests.a \ + $(am__DEPENDENCIES_1) +test_strtod_SOURCES = test-strtod.c +test_strtod_OBJECTS = test-strtod.$(OBJEXT) +test_strtod_LDADD = $(LDADD) +test_strtod_DEPENDENCIES = libtests.a ../lib/libm4.a libtests.a \ + $(am__DEPENDENCIES_1) test_sys_stat_SOURCES = test-sys_stat.c test_sys_stat_OBJECTS = test-sys_stat.$(OBJEXT) test_sys_stat_LDADD = $(LDADD) -test_sys_stat_DEPENDENCIES = ../lib/libm4.a +test_sys_stat_DEPENDENCIES = libtests.a ../lib/libm4.a libtests.a \ + $(am__DEPENDENCIES_1) test_sys_time_SOURCES = test-sys_time.c test_sys_time_OBJECTS = test-sys_time.$(OBJEXT) test_sys_time_LDADD = $(LDADD) -test_sys_time_DEPENDENCIES = ../lib/libm4.a +test_sys_time_DEPENDENCIES = libtests.a ../lib/libm4.a libtests.a \ + $(am__DEPENDENCIES_1) test_unistd_SOURCES = test-unistd.c test_unistd_OBJECTS = test-unistd.$(OBJEXT) test_unistd_LDADD = $(LDADD) -test_unistd_DEPENDENCIES = ../lib/libm4.a +test_unistd_DEPENDENCIES = libtests.a ../lib/libm4.a libtests.a \ + $(am__DEPENDENCIES_1) test_vasnprintf_SOURCES = test-vasnprintf.c test_vasnprintf_OBJECTS = test-vasnprintf.$(OBJEXT) test_vasnprintf_LDADD = $(LDADD) -test_vasnprintf_DEPENDENCIES = ../lib/libm4.a +test_vasnprintf_DEPENDENCIES = libtests.a ../lib/libm4.a libtests.a \ + $(am__DEPENDENCIES_1) test_vasprintf_SOURCES = test-vasprintf.c test_vasprintf_OBJECTS = test-vasprintf.$(OBJEXT) test_vasprintf_LDADD = $(LDADD) -test_vasprintf_DEPENDENCIES = ../lib/libm4.a +test_vasprintf_DEPENDENCIES = libtests.a ../lib/libm4.a libtests.a \ + $(am__DEPENDENCIES_1) test_vasprintf_posix_SOURCES = test-vasprintf-posix.c test_vasprintf_posix_OBJECTS = test-vasprintf-posix.$(OBJEXT) test_vasprintf_posix_LDADD = $(LDADD) -test_vasprintf_posix_DEPENDENCIES = ../lib/libm4.a +test_vasprintf_posix_DEPENDENCIES = libtests.a ../lib/libm4.a \ + libtests.a $(am__DEPENDENCIES_1) test_wchar_SOURCES = test-wchar.c test_wchar_OBJECTS = test-wchar.$(OBJEXT) test_wchar_LDADD = $(LDADD) -test_wchar_DEPENDENCIES = ../lib/libm4.a +test_wchar_DEPENDENCIES = libtests.a ../lib/libm4.a libtests.a \ + $(am__DEPENDENCIES_1) test_wctype_SOURCES = test-wctype.c test_wctype_OBJECTS = test-wctype.$(OBJEXT) test_wctype_LDADD = $(LDADD) -test_wctype_DEPENDENCIES = ../lib/libm4.a +test_wctype_DEPENDENCIES = libtests.a ../lib/libm4.a libtests.a \ + $(am__DEPENDENCIES_1) test_xvasprintf_SOURCES = test-xvasprintf.c test_xvasprintf_OBJECTS = test-xvasprintf.$(OBJEXT) -test_xvasprintf_DEPENDENCIES = $(LDADD) -DEFAULT_INCLUDES = -I. -I$(top_builddir)/lib@am__isrc@ -depcomp = $(SHELL) $(top_srcdir)/depcomp +test_xvasprintf_DEPENDENCIES = $(am__DEPENDENCIES_2) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/lib +depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = test-alloca-opt.c test-array_list.c test-array_oset.c \ - test-avltree_oset.c test-binary-io.c test-closein.c \ - test-fflush.c test-fpurge.c test-freading.c test-frexpl.c \ - test-fseeko.c test-ftello.c test-gettimeofday.c test-isnan.c \ - test-isnanf.c test-isnanl-nolibm.c test-linkedhash_list.c \ - test-lseek.c test-malloca.c test-math.c test-printf-frexp.c \ - test-printf-frexpl.c test-signbit.c test-stdbool.c \ - test-stdint.c test-stdio.c test-stdlib.c test-sys_stat.c \ - test-sys_time.c test-unistd.c test-vasnprintf.c \ - test-vasprintf.c test-vasprintf-posix.c test-wchar.c \ - test-wctype.c test-xvasprintf.c -DIST_SOURCES = test-alloca-opt.c test-array_list.c test-array_oset.c \ - test-avltree_oset.c test-binary-io.c test-closein.c \ - test-fflush.c test-fpurge.c test-freading.c test-frexpl.c \ - test-fseeko.c test-ftello.c test-gettimeofday.c test-isnan.c \ - test-isnanf.c test-isnanl-nolibm.c test-linkedhash_list.c \ - test-lseek.c test-malloca.c test-math.c test-printf-frexp.c \ - test-printf-frexpl.c test-signbit.c test-stdbool.c \ - test-stdint.c test-stdio.c test-stdlib.c test-sys_stat.c \ - test-sys_time.c test-unistd.c test-vasnprintf.c \ - test-vasprintf.c test-vasprintf-posix.c test-wchar.c \ - test-wctype.c test-xvasprintf.c +SOURCES = $(libtests_a_SOURCES) $(EXTRA_libtests_a_SOURCES) \ + test-EOVERFLOW.c test-alloca-opt.c test-array_list.c \ + test-array_oset.c test-avltree_oset.c test-binary-io.c \ + test-c-ctype.c test-closein.c test-fflush.c test-fflush2.c \ + test-fpending.c test-fpurge.c test-freadahead.c \ + test-freading.c test-frexp.c test-frexpl.c test-fseeko.c \ + test-ftello.c test-gettimeofday.c test-isnand.c test-isnanf.c \ + test-isnanl-nolibm.c test-linkedhash_list.c test-lseek.c \ + test-malloca.c test-math.c test-printf-frexp.c \ + test-printf-frexpl.c test-quotearg.c test-signbit.c \ + test-stdbool.c test-stdint.c test-stdio.c test-stdlib.c \ + test-strerror.c test-string.c test-strstr.c test-strtod.c \ + test-sys_stat.c test-sys_time.c test-unistd.c \ + test-vasnprintf.c test-vasprintf.c test-vasprintf-posix.c \ + test-wchar.c test-wctype.c test-xvasprintf.c +DIST_SOURCES = $(libtests_a_SOURCES) $(EXTRA_libtests_a_SOURCES) \ + test-EOVERFLOW.c test-alloca-opt.c test-array_list.c \ + test-array_oset.c test-avltree_oset.c test-binary-io.c \ + test-c-ctype.c test-closein.c test-fflush.c test-fflush2.c \ + test-fpending.c test-fpurge.c test-freadahead.c \ + test-freading.c test-frexp.c test-frexpl.c test-fseeko.c \ + test-ftello.c test-gettimeofday.c test-isnand.c test-isnanf.c \ + test-isnanl-nolibm.c test-linkedhash_list.c test-lseek.c \ + test-malloca.c test-math.c test-printf-frexp.c \ + test-printf-frexpl.c test-quotearg.c test-signbit.c \ + test-stdbool.c test-stdint.c test-stdio.c test-stdlib.c \ + test-strerror.c test-string.c test-strstr.c test-strtod.c \ + test-sys_stat.c test-sys_time.c test-unistd.c \ + test-vasnprintf.c test-vasprintf.c test-vasprintf-posix.c \ + test-wchar.c test-wctype.c test-xvasprintf.c RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ @@ -347,11 +462,19 @@ EXEEXT = @EXEEXT@ FLOAT_H = @FLOAT_H@ GETOPT_H = @GETOPT_H@ GLIBC21 = @GLIBC21@ +GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@ +GNULIB_CEILF = @GNULIB_CEILF@ +GNULIB_CEILL = @GNULIB_CEILL@ GNULIB_CHOWN = @GNULIB_CHOWN@ GNULIB_DUP2 = @GNULIB_DUP2@ +GNULIB_ENVIRON = @GNULIB_ENVIRON@ GNULIB_FCHDIR = @GNULIB_FCHDIR@ GNULIB_FFLUSH = @GNULIB_FFLUSH@ +GNULIB_FLOORF = @GNULIB_FLOORF@ +GNULIB_FLOORL = @GNULIB_FLOORL@ +GNULIB_FOPEN = @GNULIB_FOPEN@ GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@ +GNULIB_FREOPEN = @GNULIB_FREOPEN@ GNULIB_FREXP = @GNULIB_FREXP@ GNULIB_FREXPL = @GNULIB_FREXPL@ GNULIB_FSEEK = @GNULIB_FSEEK@ @@ -360,21 +483,67 @@ GNULIB_FTELL = @GNULIB_FTELL@ GNULIB_FTELLO = @GNULIB_FTELLO@ GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@ GNULIB_GETCWD = @GNULIB_GETCWD@ +GNULIB_GETDELIM = @GNULIB_GETDELIM@ +GNULIB_GETLINE = @GNULIB_GETLINE@ GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@ +GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@ GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@ +GNULIB_ISFINITE = @GNULIB_ISFINITE@ GNULIB_LCHOWN = @GNULIB_LCHOWN@ GNULIB_LDEXPL = @GNULIB_LDEXPL@ GNULIB_LSEEK = @GNULIB_LSEEK@ +GNULIB_MALLOC_POSIX = @GNULIB_MALLOC_POSIX@ GNULIB_MATHL = @GNULIB_MATHL@ +GNULIB_MBSCASECMP = @GNULIB_MBSCASECMP@ +GNULIB_MBSCASESTR = @GNULIB_MBSCASESTR@ +GNULIB_MBSCHR = @GNULIB_MBSCHR@ +GNULIB_MBSCSPN = @GNULIB_MBSCSPN@ +GNULIB_MBSLEN = @GNULIB_MBSLEN@ +GNULIB_MBSNCASECMP = @GNULIB_MBSNCASECMP@ +GNULIB_MBSNLEN = @GNULIB_MBSNLEN@ +GNULIB_MBSPBRK = @GNULIB_MBSPBRK@ +GNULIB_MBSPCASECMP = @GNULIB_MBSPCASECMP@ +GNULIB_MBSRCHR = @GNULIB_MBSRCHR@ +GNULIB_MBSSEP = @GNULIB_MBSSEP@ +GNULIB_MBSSPN = @GNULIB_MBSSPN@ +GNULIB_MBSSTR = @GNULIB_MBSSTR@ +GNULIB_MBSTOK_R = @GNULIB_MBSTOK_R@ +GNULIB_MEMMEM = @GNULIB_MEMMEM@ +GNULIB_MEMPCPY = @GNULIB_MEMPCPY@ +GNULIB_MEMRCHR = @GNULIB_MEMRCHR@ GNULIB_MKDTEMP = @GNULIB_MKDTEMP@ GNULIB_MKSTEMP = @GNULIB_MKSTEMP@ GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@ +GNULIB_PUTENV = @GNULIB_PUTENV@ GNULIB_READLINK = @GNULIB_READLINK@ +GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@ +GNULIB_ROUND = @GNULIB_ROUND@ +GNULIB_ROUNDF = @GNULIB_ROUNDF@ +GNULIB_ROUNDL = @GNULIB_ROUNDL@ +GNULIB_SETENV = @GNULIB_SETENV@ GNULIB_SIGNBIT = @GNULIB_SIGNBIT@ GNULIB_SIGPROCMASK = @GNULIB_SIGPROCMASK@ GNULIB_SLEEP = @GNULIB_SLEEP@ GNULIB_SNPRINTF = @GNULIB_SNPRINTF@ GNULIB_SPRINTF_POSIX = @GNULIB_SPRINTF_POSIX@ +GNULIB_STPCPY = @GNULIB_STPCPY@ +GNULIB_STPNCPY = @GNULIB_STPNCPY@ +GNULIB_STRCASESTR = @GNULIB_STRCASESTR@ +GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@ +GNULIB_STRDUP = @GNULIB_STRDUP@ +GNULIB_STRERROR = @GNULIB_STRERROR@ +GNULIB_STRNDUP = @GNULIB_STRNDUP@ +GNULIB_STRNLEN = @GNULIB_STRNLEN@ +GNULIB_STRPBRK = @GNULIB_STRPBRK@ +GNULIB_STRSEP = @GNULIB_STRSEP@ +GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@ +GNULIB_STRSTR = @GNULIB_STRSTR@ +GNULIB_STRTOD = @GNULIB_STRTOD@ +GNULIB_STRTOK_R = @GNULIB_STRTOK_R@ +GNULIB_TRUNC = @GNULIB_TRUNC@ +GNULIB_TRUNCF = @GNULIB_TRUNCF@ +GNULIB_TRUNCL = @GNULIB_TRUNCL@ +GNULIB_UNSETENV = @GNULIB_UNSETENV@ GNULIB_VASPRINTF = @GNULIB_VASPRINTF@ GNULIB_VFPRINTF_POSIX = @GNULIB_VFPRINTF_POSIX@ GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@ @@ -382,49 +551,78 @@ GNULIB_VSNPRINTF = @GNULIB_VSNPRINTF@ GNULIB_VSPRINTF_POSIX = @GNULIB_VSPRINTF_POSIX@ GNULIB_WCWIDTH = @GNULIB_WCWIDTH@ GREP = @GREP@ +HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@ HAVE_DECL_ACOSL = @HAVE_DECL_ACOSL@ HAVE_DECL_ASINL = @HAVE_DECL_ASINL@ HAVE_DECL_ATANL = @HAVE_DECL_ATANL@ -HAVE_DECL_CEILL = @HAVE_DECL_CEILL@ HAVE_DECL_COSL = @HAVE_DECL_COSL@ +HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@ HAVE_DECL_EXPL = @HAVE_DECL_EXPL@ -HAVE_DECL_FLOORL = @HAVE_DECL_FLOORL@ HAVE_DECL_FREXPL = @HAVE_DECL_FREXPL@ +HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@ +HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@ HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ HAVE_DECL_LDEXPL = @HAVE_DECL_LDEXPL@ HAVE_DECL_LOGL = @HAVE_DECL_LOGL@ +HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@ +HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@ HAVE_DECL_MKDIR = @HAVE_DECL_MKDIR@ HAVE_DECL_SINL = @HAVE_DECL_SINL@ HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@ HAVE_DECL_SQRTL = @HAVE_DECL_SQRTL@ +HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@ +HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@ +HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@ +HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@ +HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@ +HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@ HAVE_DECL_TANL = @HAVE_DECL_TANL@ +HAVE_DECL_TRUNC = @HAVE_DECL_TRUNC@ +HAVE_DECL_TRUNCF = @HAVE_DECL_TRUNCF@ +HAVE_DECL_TRUNCL = @HAVE_DECL_TRUNCL@ HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@ HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@ HAVE_DUP2 = @HAVE_DUP2@ HAVE_FSEEKO = @HAVE_FSEEKO@ HAVE_FTELLO = @HAVE_FTELLO@ HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ +HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@ HAVE_GETSUBOPT = @HAVE_GETSUBOPT@ HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ HAVE_IO_H = @HAVE_IO_H@ HAVE_ISWCNTRL = @HAVE_ISWCNTRL@ HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ HAVE_LSTAT = @HAVE_LSTAT@ +HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@ +HAVE_MEMPCPY = @HAVE_MEMPCPY@ HAVE_MKDTEMP = @HAVE_MKDTEMP@ +HAVE_OS_H = @HAVE_OS_H@ HAVE_POSIX_SIGNALBLOCKING = @HAVE_POSIX_SIGNALBLOCKING@ HAVE_READLINK = @HAVE_READLINK@ +HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@ +HAVE_SETENV = @HAVE_SETENV@ HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@ HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@ HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@ HAVE_SIGSET_T = @HAVE_SIGSET_T@ HAVE_SLEEP = @HAVE_SLEEP@ HAVE_STDINT_H = @HAVE_STDINT_H@ +HAVE_STPCPY = @HAVE_STPCPY@ +HAVE_STPNCPY = @HAVE_STPNCPY@ +HAVE_STRCASESTR = @HAVE_STRCASESTR@ +HAVE_STRCHRNUL = @HAVE_STRCHRNUL@ +HAVE_STRNDUP = @HAVE_STRNDUP@ +HAVE_STRPBRK = @HAVE_STRPBRK@ +HAVE_STRSEP = @HAVE_STRSEP@ +HAVE_STRTOD = @HAVE_STRTOD@ HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@ HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@ HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@ +HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ HAVE_UNISTD_H = @HAVE_UNISTD_H@ +HAVE_UNSETENV = @HAVE_UNSETENV@ HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@ HAVE_VASPRINTF = @HAVE_VASPRINTF@ HAVE_WCHAR_H = @HAVE_WCHAR_H@ @@ -442,19 +640,25 @@ LIBINTL = @LIBINTL@ LIBM4_LIBDEPS = @LIBM4_LIBDEPS@ LIBM4_LTLIBDEPS = @LIBM4_LTLIBDEPS@ LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ +LIBS = @LIBS@ $(POW_LIB) +LIBTESTS_LIBDEPS = @LIBTESTS_LIBDEPS@ +LOCALCHARSET_TESTS_ENVIRONMENT = @LOCALCHARSET_TESTS_ENVIRONMENT@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ M4_LIBOBJS = @M4_LIBOBJS@ M4_LTLIBOBJS = @M4_LTLIBOBJS@ +M4tests_LIBOBJS = @M4tests_LIBOBJS@ +M4tests_LTLIBOBJS = @M4tests_LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ NEXT_FLOAT_H = @NEXT_FLOAT_H@ NEXT_MATH_H = @NEXT_MATH_H@ NEXT_SIGNAL_H = @NEXT_SIGNAL_H@ +NEXT_STDARG_H = @NEXT_STDARG_H@ NEXT_STDINT_H = @NEXT_STDINT_H@ NEXT_STDIO_H = @NEXT_STDIO_H@ NEXT_STDLIB_H = @NEXT_STDLIB_H@ +NEXT_STRING_H = @NEXT_STRING_H@ NEXT_SYS_STAT_H = @NEXT_SYS_STAT_H@ NEXT_SYS_TIME_H = @NEXT_SYS_TIME_H@ NEXT_UNISTD_H = @NEXT_UNISTD_H@ @@ -468,12 +672,19 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +POW_LIB = @POW_LIB@ PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@ RANLIB = @RANLIB@ +REPLACE_CEILF = @REPLACE_CEILF@ +REPLACE_CEILL = @REPLACE_CEILL@ REPLACE_CHOWN = @REPLACE_CHOWN@ REPLACE_FCHDIR = @REPLACE_FCHDIR@ REPLACE_FFLUSH = @REPLACE_FFLUSH@ +REPLACE_FLOORF = @REPLACE_FLOORF@ +REPLACE_FLOORL = @REPLACE_FLOORL@ +REPLACE_FOPEN = @REPLACE_FOPEN@ REPLACE_FPRINTF = @REPLACE_FPRINTF@ +REPLACE_FREOPEN = @REPLACE_FREOPEN@ REPLACE_FREXP = @REPLACE_FREXP@ REPLACE_FREXPL = @REPLACE_FREXPL@ REPLACE_FSEEK = @REPLACE_FSEEK@ @@ -481,15 +692,29 @@ REPLACE_FSEEKO = @REPLACE_FSEEKO@ REPLACE_FTELL = @REPLACE_FTELL@ REPLACE_FTELLO = @REPLACE_FTELLO@ REPLACE_GETCWD = @REPLACE_GETCWD@ +REPLACE_GETLINE = @REPLACE_GETLINE@ +REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@ REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@ +REPLACE_ISFINITE = @REPLACE_ISFINITE@ REPLACE_LCHOWN = @REPLACE_LCHOWN@ REPLACE_LDEXPL = @REPLACE_LDEXPL@ REPLACE_LSEEK = @REPLACE_LSEEK@ +REPLACE_MEMMEM = @REPLACE_MEMMEM@ REPLACE_MKSTEMP = @REPLACE_MKSTEMP@ REPLACE_PRINTF = @REPLACE_PRINTF@ +REPLACE_PUTENV = @REPLACE_PUTENV@ +REPLACE_ROUND = @REPLACE_ROUND@ +REPLACE_ROUNDF = @REPLACE_ROUNDF@ +REPLACE_ROUNDL = @REPLACE_ROUNDL@ REPLACE_SIGNBIT = @REPLACE_SIGNBIT@ +REPLACE_SIGNBIT_USING_GCC = @REPLACE_SIGNBIT_USING_GCC@ REPLACE_SNPRINTF = @REPLACE_SNPRINTF@ REPLACE_SPRINTF = @REPLACE_SPRINTF@ +REPLACE_STRCASESTR = @REPLACE_STRCASESTR@ +REPLACE_STRERROR = @REPLACE_STRERROR@ +REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@ +REPLACE_STRSTR = @REPLACE_STRSTR@ +REPLACE_STRTOD = @REPLACE_STRTOD@ REPLACE_VASPRINTF = @REPLACE_VASPRINTF@ REPLACE_VFPRINTF = @REPLACE_VFPRINTF@ REPLACE_VPRINTF = @REPLACE_VPRINTF@ @@ -500,12 +725,14 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@ SIZE_T_SUFFIX = @SIZE_T_SUFFIX@ +STDARG_H = @STDARG_H@ STDBOOL_H = @STDBOOL_H@ STDINT_H = @STDINT_H@ STRIP = @STRIP@ SYS_STAT_H = @SYS_STAT_H@ SYS_TIME_H = @SYS_TIME_H@ VERSION = @VERSION@ +VOID_UNSETENV = @VOID_UNSETENV@ WCHAR_H = @WCHAR_H@ WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ WCTYPE_H = @WCTYPE_H@ @@ -560,18 +787,35 @@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = 1.5 foreign -ACLOCAL_AMFLAGS = -I ../m4 SUBDIRS = TESTS_ENVIRONMENT = EXEEXT='@EXEEXT@' EXEEXT='@EXEEXT@' \ EXEEXT='@EXEEXT@' srcdir='$(srcdir)' EXEEXT='@EXEEXT@' \ - srcdir='$(srcdir)' EXEEXT='@EXEEXT@' srcdir='$(srcdir)' + EXEEXT='@EXEEXT@' srcdir='$(srcdir)' EXEEXT='@EXEEXT@' \ + srcdir='$(srcdir)' EXEEXT='@EXEEXT@' srcdir='$(srcdir)' \ + EXEEXT='@EXEEXT@' srcdir='$(srcdir)' noinst_HEADERS = -EXTRA_DIST = test-binary-io.sh test-closein.sh test-fseeko.sh \ - test-ftello.sh test-isnanl.h test-lseek.sh +noinst_LIBRARIES = +check_LIBRARIES = libtests.a +EXTRA_DIST = test-EOVERFLOW.c test-alloca-opt.c test-array_list.c \ + test-array_oset.c test-avltree_oset.c test-binary-io.sh \ + test-binary-io.c test-c-ctype.c test-closein.sh test-closein.c \ + test-fflush.c test-fflush2.sh test-fflush2.c test-fpending.c \ + test-fpending.sh test-fpurge.c test-freadahead.c \ + test-freadahead.sh test-freading.c test-frexp.c test-frexpl.c \ + test-fseeko.c test-fseeko.sh test-ftello.c test-ftello.sh \ + test-gettimeofday.c test-isnand.c nan.h test-isnanf.c nan.h \ + test-isnanl-nolibm.c test-isnanl.h test-linkedhash_list.c \ + test-lseek.c test-lseek.sh test-malloca.c test-math.c \ + test-printf-frexp.c test-printf-frexpl.c test-quotearg.c \ + test-signbit.c test-stdbool.c test-stdint.c test-stdio.c \ + test-stdlib.c test-strerror.c test-string.c test-strstr.c \ + test-strtod.c test-sys_stat.c test-sys_time.c test-unistd.c \ + test-vasnprintf.c test-vasprintf-posix.c nan.h \ + test-vasprintf.c test-wchar.c test-wctype.c test-xvasprintf.c BUILT_SOURCES = SUFFIXES = -MOSTLYCLEANFILES = core *.stackdump test-fflush.txt t-fpurge.tmp \ - t-freading.tmp +MOSTLYCLEANFILES = core *.stackdump test-fflush.txt test-fpending.t \ + t-fpurge.tmp t-freading.tmp MOSTLYCLEANDIRS = CLEANFILES = DISTCLEANFILES = @@ -581,7 +825,13 @@ AM_CPPFLAGS = \ -I.. -I$(srcdir)/.. \ -I../lib -I$(srcdir)/../lib -LDADD = ../lib/libm4.a +LDADD = libtests.a ../lib/libm4.a libtests.a $(LIBTESTS_LIBDEPS) +libtests_a_SOURCES = gl_array_list.h gl_array_list.c gl_array_oset.h \ + gl_array_oset.c progname.h progname.c verify.h +libtests_a_LIBADD = $(M4tests_LIBOBJS) +libtests_a_DEPENDENCIES = $(M4tests_LIBOBJS) +EXTRA_libtests_a_SOURCES = +AM_LIBTOOLFLAGS = --preserve-dup-deps test_array_list_LDADD = $(LDADD) @LIBINTL@ test_array_oset_LDADD = $(LDADD) @LIBINTL@ test_avltree_oset_LDADD = $(LDADD) @LIBINTL@ @@ -623,11 +873,24 @@ $(top_srcdir)/configure: $(am__configur $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +clean-checkLIBRARIES: + -test -z "$(check_LIBRARIES)" || rm -f $(check_LIBRARIES) + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +libtests.a: $(libtests_a_OBJECTS) $(libtests_a_DEPENDENCIES) + -rm -f libtests.a + $(libtests_a_AR) libtests.a $(libtests_a_OBJECTS) $(libtests_a_LIBADD) + $(RANLIB) libtests.a + clean-checkPROGRAMS: -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS) clean-noinstPROGRAMS: -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) +test-EOVERFLOW$(EXEEXT): $(test_EOVERFLOW_OBJECTS) $(test_EOVERFLOW_DEPENDENCIES) + @rm -f test-EOVERFLOW$(EXEEXT) + $(LINK) $(test_EOVERFLOW_OBJECTS) $(test_EOVERFLOW_LDADD) $(LIBS) test-alloca-opt$(EXEEXT): $(test_alloca_opt_OBJECTS) $(test_alloca_opt_DEPENDENCIES) @rm -f test-alloca-opt$(EXEEXT) $(LINK) $(test_alloca_opt_OBJECTS) $(test_alloca_opt_LDADD) $(LIBS) @@ -643,18 +906,33 @@ test-avltree_oset$(EXEEXT): $(test_avltr test-binary-io$(EXEEXT): $(test_binary_io_OBJECTS) $(test_binary_io_DEPENDENCIES) @rm -f test-binary-io$(EXEEXT) $(LINK) $(test_binary_io_OBJECTS) $(test_binary_io_LDADD) $(LIBS) +test-c-ctype$(EXEEXT): $(test_c_ctype_OBJECTS) $(test_c_ctype_DEPENDENCIES) + @rm -f test-c-ctype$(EXEEXT) + $(LINK) $(test_c_ctype_OBJECTS) $(test_c_ctype_LDADD) $(LIBS) test-closein$(EXEEXT): $(test_closein_OBJECTS) $(test_closein_DEPENDENCIES) @rm -f test-closein$(EXEEXT) $(LINK) $(test_closein_OBJECTS) $(test_closein_LDADD) $(LIBS) test-fflush$(EXEEXT): $(test_fflush_OBJECTS) $(test_fflush_DEPENDENCIES) @rm -f test-fflush$(EXEEXT) $(LINK) $(test_fflush_OBJECTS) $(test_fflush_LDADD) $(LIBS) +test-fflush2$(EXEEXT): $(test_fflush2_OBJECTS) $(test_fflush2_DEPENDENCIES) + @rm -f test-fflush2$(EXEEXT) + $(LINK) $(test_fflush2_OBJECTS) $(test_fflush2_LDADD) $(LIBS) +test-fpending$(EXEEXT): $(test_fpending_OBJECTS) $(test_fpending_DEPENDENCIES) + @rm -f test-fpending$(EXEEXT) + $(LINK) $(test_fpending_OBJECTS) $(test_fpending_LDADD) $(LIBS) test-fpurge$(EXEEXT): $(test_fpurge_OBJECTS) $(test_fpurge_DEPENDENCIES) @rm -f test-fpurge$(EXEEXT) $(LINK) $(test_fpurge_OBJECTS) $(test_fpurge_LDADD) $(LIBS) +test-freadahead$(EXEEXT): $(test_freadahead_OBJECTS) $(test_freadahead_DEPENDENCIES) + @rm -f test-freadahead$(EXEEXT) + $(LINK) $(test_freadahead_OBJECTS) $(test_freadahead_LDADD) $(LIBS) test-freading$(EXEEXT): $(test_freading_OBJECTS) $(test_freading_DEPENDENCIES) @rm -f test-freading$(EXEEXT) $(LINK) $(test_freading_OBJECTS) $(test_freading_LDADD) $(LIBS) +test-frexp$(EXEEXT): $(test_frexp_OBJECTS) $(test_frexp_DEPENDENCIES) + @rm -f test-frexp$(EXEEXT) + $(LINK) $(test_frexp_OBJECTS) $(test_frexp_LDADD) $(LIBS) test-frexpl$(EXEEXT): $(test_frexpl_OBJECTS) $(test_frexpl_DEPENDENCIES) @rm -f test-frexpl$(EXEEXT) $(LINK) $(test_frexpl_OBJECTS) $(test_frexpl_LDADD) $(LIBS) @@ -667,9 +945,9 @@ test-ftello$(EXEEXT): $(test_ftello_OBJE test-gettimeofday$(EXEEXT): $(test_gettimeofday_OBJECTS) $(test_gettimeofday_DEPENDENCIES) @rm -f test-gettimeofday$(EXEEXT) $(LINK) $(test_gettimeofday_OBJECTS) $(test_gettimeofday_LDADD) $(LIBS) -test-isnan$(EXEEXT): $(test_isnan_OBJECTS) $(test_isnan_DEPENDENCIES) - @rm -f test-isnan$(EXEEXT) - $(LINK) $(test_isnan_OBJECTS) $(test_isnan_LDADD) $(LIBS) +test-isnand$(EXEEXT): $(test_isnand_OBJECTS) $(test_isnand_DEPENDENCIES) + @rm -f test-isnand$(EXEEXT) + $(LINK) $(test_isnand_OBJECTS) $(test_isnand_LDADD) $(LIBS) test-isnanf$(EXEEXT): $(test_isnanf_OBJECTS) $(test_isnanf_DEPENDENCIES) @rm -f test-isnanf$(EXEEXT) $(LINK) $(test_isnanf_OBJECTS) $(test_isnanf_LDADD) $(LIBS) @@ -694,6 +972,9 @@ test-printf-frexp$(EXEEXT): $(test_print test-printf-frexpl$(EXEEXT): $(test_printf_frexpl_OBJECTS) $(test_printf_frexpl_DEPENDENCIES) @rm -f test-printf-frexpl$(EXEEXT) $(LINK) $(test_printf_frexpl_OBJECTS) $(test_printf_frexpl_LDADD) $(LIBS) +test-quotearg$(EXEEXT): $(test_quotearg_OBJECTS) $(test_quotearg_DEPENDENCIES) + @rm -f test-quotearg$(EXEEXT) + $(LINK) $(test_quotearg_OBJECTS) $(test_quotearg_LDADD) $(LIBS) test-signbit$(EXEEXT): $(test_signbit_OBJECTS) $(test_signbit_DEPENDENCIES) @rm -f test-signbit$(EXEEXT) $(LINK) $(test_signbit_OBJECTS) $(test_signbit_LDADD) $(LIBS) @@ -709,6 +990,18 @@ test-stdio$(EXEEXT): $(test_stdio_OBJECT test-stdlib$(EXEEXT): $(test_stdlib_OBJECTS) $(test_stdlib_DEPENDENCIES) @rm -f test-stdlib$(EXEEXT) $(LINK) $(test_stdlib_OBJECTS) $(test_stdlib_LDADD) $(LIBS) +test-strerror$(EXEEXT): $(test_strerror_OBJECTS) $(test_strerror_DEPENDENCIES) + @rm -f test-strerror$(EXEEXT) + $(LINK) $(test_strerror_OBJECTS) $(test_strerror_LDADD) $(LIBS) +test-string$(EXEEXT): $(test_string_OBJECTS) $(test_string_DEPENDENCIES) + @rm -f test-string$(EXEEXT) + $(LINK) $(test_string_OBJECTS) $(test_string_LDADD) $(LIBS) +test-strstr$(EXEEXT): $(test_strstr_OBJECTS) $(test_strstr_DEPENDENCIES) + @rm -f test-strstr$(EXEEXT) + $(LINK) $(test_strstr_OBJECTS) $(test_strstr_LDADD) $(LIBS) +test-strtod$(EXEEXT): $(test_strtod_OBJECTS) $(test_strtod_DEPENDENCIES) + @rm -f test-strtod$(EXEEXT) + $(LINK) $(test_strtod_OBJECTS) $(test_strtod_LDADD) $(LIBS) test-sys_stat$(EXEEXT): $(test_sys_stat_OBJECTS) $(test_sys_stat_DEPENDENCIES) @rm -f test-sys_stat$(EXEEXT) $(LINK) $(test_sys_stat_OBJECTS) $(test_sys_stat_LDADD) $(LIBS) @@ -743,20 +1036,29 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gl_array_list.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gl_array_oset.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/progname.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-EOVERFLOW.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-alloca-opt.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-array_list.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-array_oset.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-avltree_oset.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-binary-io.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-c-ctype.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-closein.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-fflush.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-fflush2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-fpending.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-fpurge.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-freadahead.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-freading.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-frexp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-frexpl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-fseeko.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-ftello.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-gettimeofday.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-isnan.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-isnand.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-isnanf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-isnanl-nolibm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-linkedhash_list.Po@am__quote@ @@ -765,11 +1067,16 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-math.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-printf-frexp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-printf-frexpl.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-quotearg.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-signbit.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-stdbool.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-stdint.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-stdio.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-stdlib.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-strerror.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-string.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-strstr.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-strtod.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-sys_stat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-sys_time.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-unistd.Po@am__quote@ @@ -869,8 +1176,8 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS @@ -895,8 +1202,8 @@ TAGS: tags-recursive $(HEADERS) $(SOURCE unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ @@ -906,13 +1213,12 @@ ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ - here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique @@ -1042,11 +1348,11 @@ distdir: $(DISTFILES) fi; \ done check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) + $(MAKE) $(AM_MAKEFLAGS) $(check_LIBRARIES) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-recursive -all-am: Makefile $(PROGRAMS) $(HEADERS) +all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(HEADERS) installdirs: installdirs-recursive installdirs-am: install: $(BUILT_SOURCES) @@ -1081,8 +1387,9 @@ maintainer-clean-generic: -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-recursive -clean-am: clean-checkPROGRAMS clean-generic clean-local \ - clean-noinstPROGRAMS mostlyclean-am +clean-am: clean-checkLIBRARIES clean-checkPROGRAMS clean-generic \ + clean-local clean-noinstLIBRARIES clean-noinstPROGRAMS \ + mostlyclean-am distclean: distclean-recursive -rm -rf ./$(DEPDIR) @@ -1143,18 +1450,19 @@ uninstall-am: .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-TESTS check-am clean \ - clean-checkPROGRAMS clean-generic clean-local \ - clean-noinstPROGRAMS ctags ctags-recursive distclean \ - distclean-compile distclean-generic distclean-tags distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs installdirs-am \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-local pdf \ - pdf-am ps ps-am tags tags-recursive uninstall uninstall-am + clean-checkLIBRARIES clean-checkPROGRAMS clean-generic \ + clean-local clean-noinstLIBRARIES clean-noinstPROGRAMS ctags \ + ctags-recursive distclean distclean-compile distclean-generic \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-local pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am # Clean up after Solaris cc. diff -ruNp m4-1.4.10/tests/gl_array_list.c m4-1.4.11/tests/gl_array_list.c --- m4-1.4.10/tests/gl_array_list.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/tests/gl_array_list.c 2008-02-12 20:52:33.000000000 -0700 @@ -0,0 +1,657 @@ +/* Sequential list data type implemented by an array. + Copyright (C) 2006-2008 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2006. + + 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/>. */ + +#include <config.h> + +/* Specification. */ +#include "gl_array_list.h" + +#include <stdlib.h> +/* Get memcpy. */ +#include <string.h> + +#include "xalloc.h" + +/* Checked size_t computations. */ +#include "xsize.h" + +#ifndef uintptr_t +# define uintptr_t unsigned long +#endif + +/* -------------------------- gl_list_t Data Type -------------------------- */ + +/* Concrete gl_list_impl type, valid for this file only. */ +struct gl_list_impl +{ + struct gl_list_impl_base base; + /* An array of ALLOCATED elements, of which the first COUNT are used. + 0 <= COUNT <= ALLOCATED. */ + const void **elements; + size_t count; + size_t allocated; +}; + +/* struct gl_list_node_impl doesn't exist here. The pointers are actually + indices + 1. */ +#define INDEX_TO_NODE(index) (gl_list_node_t)(uintptr_t)(size_t)((index) + 1) +#define NODE_TO_INDEX(node) ((uintptr_t)(node) - 1) + +static gl_list_t +gl_array_create_empty (gl_list_implementation_t implementation, + gl_listelement_equals_fn equals_fn, + gl_listelement_hashcode_fn hashcode_fn, + gl_listelement_dispose_fn dispose_fn, + bool allow_duplicates) +{ + struct gl_list_impl *list = XMALLOC (struct gl_list_impl); + + list->base.vtable = implementation; + list->base.equals_fn = equals_fn; + list->base.hashcode_fn = hashcode_fn; + list->base.dispose_fn = dispose_fn; + list->base.allow_duplicates = allow_duplicates; + list->elements = NULL; + list->count = 0; + list->allocated = 0; + + return list; +} + +static gl_list_t +gl_array_create (gl_list_implementation_t implementation, + gl_listelement_equals_fn equals_fn, + gl_listelement_hashcode_fn hashcode_fn, + gl_listelement_dispose_fn dispose_fn, + bool allow_duplicates, + size_t count, const void **contents) +{ + struct gl_list_impl *list = XMALLOC (struct gl_list_impl); + + list->base.vtable = implementation; + list->base.equals_fn = equals_fn; + list->base.hashcode_fn = hashcode_fn; + list->base.dispose_fn = dispose_fn; + list->base.allow_duplicates = allow_duplicates; + if (count > 0) + { + list->elements = XNMALLOC (count, const void *); + memcpy (list->elements, contents, count * sizeof (const void *)); + } + else + list->elements = NULL; + list->count = count; + list->allocated = count; + + return list; +} + +static size_t +gl_array_size (gl_list_t list) +{ + return list->count; +} + +static const void * +gl_array_node_value (gl_list_t list, gl_list_node_t node) +{ + uintptr_t index = NODE_TO_INDEX (node); + if (!(index < list->count)) + /* Invalid argument. */ + abort (); + return list->elements[index]; +} + +static void +gl_array_node_set_value (gl_list_t list, gl_list_node_t node, const void *elt) +{ + uintptr_t index = NODE_TO_INDEX (node); + if (!(index < list->count)) + /* Invalid argument. */ + abort (); + list->elements[index] = elt; +} + +static gl_list_node_t +gl_array_next_node (gl_list_t list, gl_list_node_t node) +{ + uintptr_t index = NODE_TO_INDEX (node); + if (!(index < list->count)) + /* Invalid argument. */ + abort (); + index++; + if (index < list->count) + return INDEX_TO_NODE (index); + else + return NULL; +} + +static gl_list_node_t +gl_array_previous_node (gl_list_t list, gl_list_node_t node) +{ + uintptr_t index = NODE_TO_INDEX (node); + if (!(index < list->count)) + /* Invalid argument. */ + abort (); + if (index > 0) + return INDEX_TO_NODE (index - 1); + else + return NULL; +} + +static const void * +gl_array_get_at (gl_list_t list, size_t position) +{ + size_t count = list->count; + + if (!(position < count)) + /* Invalid argument. */ + abort (); + return list->elements[position]; +} + +static gl_list_node_t +gl_array_set_at (gl_list_t list, size_t position, const void *elt) +{ + size_t count = list->count; + + if (!(position < count)) + /* Invalid argument. */ + abort (); + list->elements[position] = elt; + return INDEX_TO_NODE (position); +} + +static size_t +gl_array_indexof_from_to (gl_list_t list, size_t start_index, size_t end_index, + const void *elt) +{ + size_t count = list->count; + + if (!(start_index <= end_index && end_index <= count)) + /* Invalid arguments. */ + abort (); + + if (start_index < end_index) + { + gl_listelement_equals_fn equals = list->base.equals_fn; + if (equals != NULL) + { + size_t i; + + for (i = start_index;;) + { + if (equals (elt, list->elements[i])) + return i; + i++; + if (i == end_index) + break; + } + } + else + { + size_t i; + + for (i = start_index;;) + { + if (elt == list->elements[i]) + return i; + i++; + if (i == end_index) + break; + } + } + } + return (size_t)(-1); +} + +static gl_list_node_t +gl_array_search_from_to (gl_list_t list, size_t start_index, size_t end_index, + const void *elt) +{ + size_t index = gl_array_indexof_from_to (list, start_index, end_index, elt); + return INDEX_TO_NODE (index); +} + +/* Ensure that list->allocated > list->count. */ +static void +grow (gl_list_t list) +{ + size_t new_allocated; + size_t memory_size; + const void **memory; + + new_allocated = xtimes (list->allocated, 2); + new_allocated = xsum (new_allocated, 1); + memory_size = xtimes (new_allocated, sizeof (const void *)); + if (size_overflow_p (memory_size)) + /* Overflow, would lead to out of memory. */ + xalloc_die (); + memory = (const void **) xrealloc (list->elements, memory_size); + if (memory == NULL) + /* Out of memory. */ + xalloc_die (); + list->elements = memory; + list->allocated = new_allocated; +} + +static gl_list_node_t +gl_array_add_first (gl_list_t list, const void *elt) +{ + size_t count = list->count; + const void **elements; + size_t i; + + if (count == list->allocated) + grow (list); + elements = list->elements; + for (i = count; i > 0; i--) + elements[i] = elements[i - 1]; + elements[0] = elt; + list->count = count + 1; + return INDEX_TO_NODE (0); +} + +static gl_list_node_t +gl_array_add_last (gl_list_t list, const void *elt) +{ + size_t count = list->count; + + if (count == list->allocated) + grow (list); + list->elements[count] = elt; + list->count = count + 1; + return INDEX_TO_NODE (count); +} + +static gl_list_node_t +gl_array_add_before (gl_list_t list, gl_list_node_t node, const void *elt) +{ + size_t count = list->count; + uintptr_t index = NODE_TO_INDEX (node); + size_t position; + const void **elements; + size_t i; + + if (!(index < count)) + /* Invalid argument. */ + abort (); + position = index; + if (count == list->allocated) + grow (list); + elements = list->elements; + for (i = count; i > position; i--) + elements[i] = elements[i - 1]; + elements[position] = elt; + list->count = count + 1; + return INDEX_TO_NODE (position); +} + +static gl_list_node_t +gl_array_add_after (gl_list_t list, gl_list_node_t node, const void *elt) +{ + size_t count = list->count; + uintptr_t index = NODE_TO_INDEX (node); + size_t position; + const void **elements; + size_t i; + + if (!(index < count)) + /* Invalid argument. */ + abort (); + position = index + 1; + if (count == list->allocated) + grow (list); + elements = list->elements; + for (i = count; i > position; i--) + elements[i] = elements[i - 1]; + elements[position] = elt; + list->count = count + 1; + return INDEX_TO_NODE (position); +} + +static gl_list_node_t +gl_array_add_at (gl_list_t list, size_t position, const void *elt) +{ + size_t count = list->count; + const void **elements; + size_t i; + + if (!(position <= count)) + /* Invalid argument. */ + abort (); + if (count == list->allocated) + grow (list); + elements = list->elements; + for (i = count; i > position; i--) + elements[i] = elements[i - 1]; + elements[position] = elt; + list->count = count + 1; + return INDEX_TO_NODE (position); +} + +static bool +gl_array_remove_node (gl_list_t list, gl_list_node_t node) +{ + size_t count = list->count; + uintptr_t index = NODE_TO_INDEX (node); + size_t position; + const void **elements; + size_t i; + + if (!(index < count)) + /* Invalid argument. */ + abort (); + position = index; + elements = list->elements; + if (list->base.dispose_fn != NULL) + list->base.dispose_fn (elements[position]); + for (i = position + 1; i < count; i++) + elements[i - 1] = elements[i]; + list->count = count - 1; + return true; +} + +static bool +gl_array_remove_at (gl_list_t list, size_t position) +{ + size_t count = list->count; + const void **elements; + size_t i; + + if (!(position < count)) + /* Invalid argument. */ + abort (); + elements = list->elements; + if (list->base.dispose_fn != NULL) + list->base.dispose_fn (elements[position]); + for (i = position + 1; i < count; i++) + elements[i - 1] = elements[i]; + list->count = count - 1; + return true; +} + +static bool +gl_array_remove (gl_list_t list, const void *elt) +{ + size_t position = gl_array_indexof_from_to (list, 0, list->count, elt); + if (position == (size_t)(-1)) + return false; + else + return gl_array_remove_at (list, position); +} + +static void +gl_array_list_free (gl_list_t list) +{ + if (list->elements != NULL) + { + if (list->base.dispose_fn != NULL) + { + size_t count = list->count; + + if (count > 0) + { + gl_listelement_dispose_fn dispose = list->base.dispose_fn; + const void **elements = list->elements; + + do + dispose (*elements++); + while (--count > 0); + } + } + free (list->elements); + } + free (list); +} + +/* --------------------- gl_list_iterator_t Data Type --------------------- */ + +static gl_list_iterator_t +gl_array_iterator (gl_list_t list) +{ + gl_list_iterator_t result; + + result.vtable = list->base.vtable; + result.list = list; + result.count = list->count; + result.p = list->elements + 0; + result.q = list->elements + list->count; +#ifdef lint + result.i = 0; + result.j = 0; +#endif + + return result; +} + +static gl_list_iterator_t +gl_array_iterator_from_to (gl_list_t list, size_t start_index, size_t end_index) +{ + gl_list_iterator_t result; + + if (!(start_index <= end_index && end_index <= list->count)) + /* Invalid arguments. */ + abort (); + result.vtable = list->base.vtable; + result.list = list; + result.count = list->count; + result.p = list->elements + start_index; + result.q = list->elements + end_index; +#ifdef lint + result.i = 0; + result.j = 0; +#endif + + return result; +} + +static bool +gl_array_iterator_next (gl_list_iterator_t *iterator, + const void **eltp, gl_list_node_t *nodep) +{ + gl_list_t list = iterator->list; + if (iterator->count != list->count) + { + if (iterator->count != list->count + 1) + /* Concurrent modifications were done on the list. */ + abort (); + /* The last returned element was removed. */ + iterator->count--; + iterator->p = (const void **) iterator->p - 1; + iterator->q = (const void **) iterator->q - 1; + } + if (iterator->p < iterator->q) + { + const void **p = (const void **) iterator->p; + *eltp = *p; + if (nodep != NULL) + *nodep = INDEX_TO_NODE (p - list->elements); + iterator->p = p + 1; + return true; + } + else + return false; +} + +static void +gl_array_iterator_free (gl_list_iterator_t *iterator) +{ +} + +/* ---------------------- Sorted gl_list_t Data Type ---------------------- */ + +static size_t +gl_array_sortedlist_indexof_from_to (gl_list_t list, + gl_listelement_compar_fn compar, + size_t low, size_t high, + const void *elt) +{ + if (!(low <= high && high <= list->count)) + /* Invalid arguments. */ + abort (); + if (low < high) + { + /* At each loop iteration, low < high; for indices < low the values + are smaller than ELT; for indices >= high the values are greater + than ELT. So, if the element occurs in the list, it is at + low <= position < high. */ + do + { + size_t mid = low + (high - low) / 2; /* low <= mid < high */ + int cmp = compar (list->elements[mid], elt); + + if (cmp < 0) + low = mid + 1; + else if (cmp > 0) + high = mid; + else /* cmp == 0 */ + { + /* We have an element equal to ELT at index MID. But we need + the minimal such index. */ + high = mid; + /* At each loop iteration, low <= high and + compar (list->elements[high], elt) == 0, + and we know that the first occurrence of the element is at + low <= position <= high. */ + while (low < high) + { + size_t mid2 = low + (high - low) / 2; /* low <= mid2 < high */ + int cmp2 = compar (list->elements[mid2], elt); + + if (cmp2 < 0) + low = mid2 + 1; + else if (cmp2 > 0) + /* The list was not sorted. */ + abort (); + else /* cmp2 == 0 */ + { + if (mid2 == low) + break; + high = mid2 - 1; + } + } + return low; + } + } + while (low < high); + /* Here low == high. */ + } + return (size_t)(-1); +} + +static size_t +gl_array_sortedlist_indexof (gl_list_t list, gl_listelement_compar_fn compar, + const void *elt) +{ + return gl_array_sortedlist_indexof_from_to (list, compar, 0, list->count, + elt); +} + +static gl_list_node_t +gl_array_sortedlist_search_from_to (gl_list_t list, + gl_listelement_compar_fn compar, + size_t low, size_t high, + const void *elt) +{ + size_t index = + gl_array_sortedlist_indexof_from_to (list, compar, low, high, elt); + return INDEX_TO_NODE (index); +} + +static gl_list_node_t +gl_array_sortedlist_search (gl_list_t list, gl_listelement_compar_fn compar, + const void *elt) +{ + size_t index = + gl_array_sortedlist_indexof_from_to (list, compar, 0, list->count, elt); + return INDEX_TO_NODE (index); +} + +static gl_list_node_t +gl_array_sortedlist_add (gl_list_t list, gl_listelement_compar_fn compar, + const void *elt) +{ + size_t count = list->count; + size_t low = 0; + size_t high = count; + + /* At each loop iteration, low <= high; for indices < low the values are + smaller than ELT; for indices >= high the values are greater than ELT. */ + while (low < high) + { + size_t mid = low + (high - low) / 2; /* low <= mid < high */ + int cmp = compar (list->elements[mid], elt); + + if (cmp < 0) + low = mid + 1; + else if (cmp > 0) + high = mid; + else /* cmp == 0 */ + { + low = mid; + break; + } + } + return gl_array_add_at (list, low, elt); +} + +static bool +gl_array_sortedlist_remove (gl_list_t list, gl_listelement_compar_fn compar, + const void *elt) +{ + size_t index = gl_array_sortedlist_indexof (list, compar, elt); + if (index == (size_t)(-1)) + return false; + else + return gl_array_remove_at (list, index); +} + + +const struct gl_list_implementation gl_array_list_implementation = + { + gl_array_create_empty, + gl_array_create, + gl_array_size, + gl_array_node_value, + gl_array_node_set_value, + gl_array_next_node, + gl_array_previous_node, + gl_array_get_at, + gl_array_set_at, + gl_array_search_from_to, + gl_array_indexof_from_to, + gl_array_add_first, + gl_array_add_last, + gl_array_add_before, + gl_array_add_after, + gl_array_add_at, + gl_array_remove_node, + gl_array_remove_at, + gl_array_remove, + gl_array_list_free, + gl_array_iterator, + gl_array_iterator_from_to, + gl_array_iterator_next, + gl_array_iterator_free, + gl_array_sortedlist_search, + gl_array_sortedlist_search_from_to, + gl_array_sortedlist_indexof, + gl_array_sortedlist_indexof_from_to, + gl_array_sortedlist_add, + gl_array_sortedlist_remove + }; diff -ruNp m4-1.4.10/tests/gl_array_list.h m4-1.4.11/tests/gl_array_list.h --- m4-1.4.10/tests/gl_array_list.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/tests/gl_array_list.h 2007-12-11 19:25:21.000000000 -0700 @@ -0,0 +1,34 @@ +/* Sequential list data type implemented by an array. + Copyright (C) 2006 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2006. + + 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/>. */ + +#ifndef _GL_ARRAY_LIST_H +#define _GL_ARRAY_LIST_H + +#include "gl_list.h" + +#ifdef __cplusplus +extern "C" { +#endif + +extern const struct gl_list_implementation gl_array_list_implementation; +#define GL_ARRAY_LIST &gl_array_list_implementation + +#ifdef __cplusplus +} +#endif + +#endif /* _GL_ARRAY_LIST_H */ diff -ruNp m4-1.4.10/tests/gl_array_oset.c m4-1.4.11/tests/gl_array_oset.c --- m4-1.4.10/tests/gl_array_oset.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/tests/gl_array_oset.c 2007-12-11 19:25:21.000000000 -0700 @@ -0,0 +1,351 @@ +/* Ordered set data type implemented by an array. + Copyright (C) 2006-2007 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2006. + + 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/>. */ + +#include <config.h> + +/* Specification. */ +#include "gl_array_oset.h" + +#include <stdlib.h> + +#include "xalloc.h" + +/* Checked size_t computations. */ +#include "xsize.h" + +/* -------------------------- gl_oset_t Data Type -------------------------- */ + +/* Concrete gl_oset_impl type, valid for this file only. */ +struct gl_oset_impl +{ + struct gl_oset_impl_base base; + /* An array of ALLOCATED elements, of which the first COUNT are used. + 0 <= COUNT <= ALLOCATED. */ + const void **elements; + size_t count; + size_t allocated; +}; + +static gl_oset_t +gl_array_create_empty (gl_oset_implementation_t implementation, + gl_setelement_compar_fn compar_fn, + gl_setelement_dispose_fn dispose_fn) +{ + struct gl_oset_impl *set = XMALLOC (struct gl_oset_impl); + + set->base.vtable = implementation; + set->base.compar_fn = compar_fn; + set->base.dispose_fn = dispose_fn; + set->elements = NULL; + set->count = 0; + set->allocated = 0; + + return set; +} + +static size_t +gl_array_size (gl_oset_t set) +{ + return set->count; +} + +static size_t +gl_array_indexof (gl_oset_t set, const void *elt) +{ + size_t count = set->count; + + if (count > 0) + { + gl_setelement_compar_fn compar = set->base.compar_fn; + size_t low = 0; + size_t high = count; + + /* At each loop iteration, low < high; for indices < low the values + are smaller than ELT; for indices >= high the values are greater + than ELT. So, if the element occurs in the list, it is at + low <= position < high. */ + do + { + size_t mid = low + (high - low) / 2; /* low <= mid < high */ + int cmp = (compar != NULL + ? compar (set->elements[mid], elt) + : (set->elements[mid] > elt ? 1 : + set->elements[mid] < elt ? -1 : 0)); + + if (cmp < 0) + low = mid + 1; + else if (cmp > 0) + high = mid; + else /* cmp == 0 */ + /* We have an element equal to ELT at index MID. */ + return mid; + } + while (low < high); + } + return (size_t)(-1); +} + +static bool +gl_array_search (gl_oset_t set, const void *elt) +{ + return gl_array_indexof (set, elt) != (size_t)(-1); +} + +static bool +gl_array_search_atleast (gl_oset_t set, + gl_setelement_threshold_fn threshold_fn, + const void *threshold, + const void **eltp) +{ + size_t count = set->count; + + if (count > 0) + { + size_t low = 0; + size_t high = count; + + /* At each loop iteration, low < high; for indices < low the values are + smaller than THRESHOLD; for indices >= high the values are nonexistent. + So, if an element >= THRESHOLD occurs in the list, it is at + low <= position < high. */ + do + { + size_t mid = low + (high - low) / 2; /* low <= mid < high */ + + if (! threshold_fn (set->elements[mid], threshold)) + low = mid + 1; + else + { + /* We have an element >= THRESHOLD at index MID. But we need the + minimal such index. */ + high = mid; + /* At each loop iteration, low <= high and + compar (list->elements[high], value) >= 0, + and we know that the first occurrence of the element is at + low <= position <= high. */ + while (low < high) + { + size_t mid2 = low + (high - low) / 2; /* low <= mid2 < high */ + + if (! threshold_fn (set->elements[mid2], threshold)) + low = mid2 + 1; + else + high = mid2; + } + *eltp = set->elements[low]; + return true; + } + } + while (low < high); + } + return false; +} + +/* Ensure that set->allocated > set->count. */ +static void +grow (gl_oset_t set) +{ + size_t new_allocated; + size_t memory_size; + const void **memory; + + new_allocated = xtimes (set->allocated, 2); + new_allocated = xsum (new_allocated, 1); + memory_size = xtimes (new_allocated, sizeof (const void *)); + if (size_overflow_p (memory_size)) + /* Overflow, would lead to out of memory. */ + xalloc_die (); + memory = (const void **) xrealloc (set->elements, memory_size); + if (memory == NULL) + /* Out of memory. */ + xalloc_die (); + set->elements = memory; + set->allocated = new_allocated; +} + +/* Add the given element ELT at the given position, + 0 <= position <= gl_oset_size (set). */ +static inline void +gl_array_add_at (gl_oset_t set, size_t position, const void *elt) +{ + size_t count = set->count; + const void **elements; + size_t i; + + if (count == set->allocated) + grow (set); + elements = set->elements; + for (i = count; i > position; i--) + elements[i] = elements[i - 1]; + elements[position] = elt; + set->count = count + 1; +} + +/* Remove the element at the given position, + 0 <= position < gl_oset_size (set). */ +static inline void +gl_array_remove_at (gl_oset_t set, size_t position) +{ + size_t count = set->count; + const void **elements; + size_t i; + + elements = set->elements; + if (set->base.dispose_fn != NULL) + set->base.dispose_fn (elements[position]); + for (i = position + 1; i < count; i++) + elements[i - 1] = elements[i]; + set->count = count - 1; +} + +static bool +gl_array_add (gl_oset_t set, const void *elt) +{ + size_t count = set->count; + size_t low = 0; + + if (count > 0) + { + gl_setelement_compar_fn compar = set->base.compar_fn; + size_t high = count; + + /* At each loop iteration, low < high; for indices < low the values + are smaller than ELT; for indices >= high the values are greater + than ELT. So, if the element occurs in the list, it is at + low <= position < high. */ + do + { + size_t mid = low + (high - low) / 2; /* low <= mid < high */ + int cmp = (compar != NULL + ? compar (set->elements[mid], elt) + : (set->elements[mid] > elt ? 1 : + set->elements[mid] < elt ? -1 : 0)); + + if (cmp < 0) + low = mid + 1; + else if (cmp > 0) + high = mid; + else /* cmp == 0 */ + return false; + } + while (low < high); + } + gl_array_add_at (set, low, elt); + return true; +} + +static bool +gl_array_remove (gl_oset_t set, const void *elt) +{ + size_t index = gl_array_indexof (set, elt); + if (index != (size_t)(-1)) + { + gl_array_remove_at (set, index); + return true; + } + else + return false; +} + +static void +gl_array_free (gl_oset_t set) +{ + if (set->elements != NULL) + { + if (set->base.dispose_fn != NULL) + { + size_t count = set->count; + + if (count > 0) + { + gl_setelement_dispose_fn dispose = set->base.dispose_fn; + const void **elements = set->elements; + + do + dispose (*elements++); + while (--count > 0); + } + } + free (set->elements); + } + free (set); +} + +/* --------------------- gl_oset_iterator_t Data Type --------------------- */ + +static gl_oset_iterator_t +gl_array_iterator (gl_oset_t set) +{ + gl_oset_iterator_t result; + + result.vtable = set->base.vtable; + result.set = set; + result.count = set->count; + result.p = set->elements + 0; + result.q = set->elements + set->count; +#ifdef lint + result.i = 0; + result.j = 0; +#endif + + return result; +} + +static bool +gl_array_iterator_next (gl_oset_iterator_t *iterator, const void **eltp) +{ + gl_oset_t set = iterator->set; + if (iterator->count != set->count) + { + if (iterator->count != set->count + 1) + /* Concurrent modifications were done on the set. */ + abort (); + /* The last returned element was removed. */ + iterator->count--; + iterator->p = (const void **) iterator->p - 1; + iterator->q = (const void **) iterator->q - 1; + } + if (iterator->p < iterator->q) + { + const void **p = (const void **) iterator->p; + *eltp = *p; + iterator->p = p + 1; + return true; + } + else + return false; +} + +static void +gl_array_iterator_free (gl_oset_iterator_t *iterator) +{ +} + + +const struct gl_oset_implementation gl_array_oset_implementation = + { + gl_array_create_empty, + gl_array_size, + gl_array_search, + gl_array_search_atleast, + gl_array_add, + gl_array_remove, + gl_array_free, + gl_array_iterator, + gl_array_iterator_next, + gl_array_iterator_free + }; diff -ruNp m4-1.4.10/tests/gl_array_oset.h m4-1.4.11/tests/gl_array_oset.h --- m4-1.4.10/tests/gl_array_oset.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/tests/gl_array_oset.h 2007-12-11 19:25:21.000000000 -0700 @@ -0,0 +1,34 @@ +/* Ordered set data type implemented by an array. + Copyright (C) 2006 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2006. + + 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/>. */ + +#ifndef _GL_ARRAY_OSET_H +#define _GL_ARRAY_OSET_H + +#include "gl_oset.h" + +#ifdef __cplusplus +extern "C" { +#endif + +extern const struct gl_oset_implementation gl_array_oset_implementation; +#define GL_ARRAY_OSET &gl_array_oset_implementation + +#ifdef __cplusplus +} +#endif + +#endif /* _GL_ARRAY_OSET_H */ diff -ruNp m4-1.4.10/tests/nan.h m4-1.4.11/tests/nan.h --- m4-1.4.10/tests/nan.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/tests/nan.h 2008-04-01 20:22:37.000000000 -0600 @@ -0,0 +1,50 @@ +/* Macros for not-a-number. + Copyright (C) 2007-2008 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/>. */ + + +/* NaNf () returns a 'float' not-a-number. */ + +/* The Compaq (ex-DEC) C 6.4 compiler chokes on the expression 0.0 / 0.0. */ +#ifdef __DECC +static float +NaNf () +{ + static float zero = 0.0f; + return zero / zero; +} +#else +# define NaNf() (0.0f / 0.0f) +#endif + + +/* NaNd () returns a 'double' not-a-number. */ + +/* The Compaq (ex-DEC) C 6.4 compiler chokes on the expression 0.0 / 0.0. */ +#ifdef __DECC +static double +NaNd () +{ + static double zero = 0.0; + return zero / zero; +} +#else +# define NaNd() (0.0 / 0.0) +#endif + + +/* NaNl () returns a 'long double' not-a-number. */ + +#define NaNl() (0.0L / 0.0L) diff -ruNp m4-1.4.10/tests/progname.c m4-1.4.11/tests/progname.c --- m4-1.4.10/tests/progname.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/tests/progname.c 2008-01-14 22:04:54.000000000 -0700 @@ -0,0 +1,51 @@ +/* Program name management. + Copyright (C) 2001-2003, 2005-2008 Free Software Foundation, Inc. + Written by Bruno Haible <haible@clisp.cons.org>, 2001. + + 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/>. */ + + +#include <config.h> + +/* Specification. */ +#undef ENABLE_RELOCATABLE /* avoid defining set_program_name as a macro */ +#include "progname.h" + +#include <string.h> + + +/* String containing name the program is called with. + To be initialized by main(). */ +const char *program_name = NULL; + +/* Set program_name, based on argv[0]. */ +void +set_program_name (const char *argv0) +{ + /* libtool creates a temporary executable whose name is sometimes prefixed + with "lt-" (depends on the platform). It also makes argv[0] absolute. + Remove this "<dirname>/.libs/" or "<dirname>/.libs/lt-" prefix here. */ + const char *slash; + const char *base; + + slash = strrchr (argv0, '/'); + base = (slash != NULL ? slash + 1 : argv0); + if (base - argv0 >= 7 && strncmp (base - 7, "/.libs/", 7) == 0) + { + argv0 = base; + if (strncmp (base, "lt-", 3) == 0) + argv0 = base + 3; + } + program_name = argv0; +} diff -ruNp m4-1.4.10/tests/progname.h m4-1.4.11/tests/progname.h --- m4-1.4.10/tests/progname.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/tests/progname.h 2007-12-11 19:25:22.000000000 -0700 @@ -0,0 +1,60 @@ +/* Program name management. + Copyright (C) 2001-2004, 2006 Free Software Foundation, Inc. + Written by Bruno Haible <haible@clisp.cons.org>, 2001. + + 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/>. */ + +#ifndef _PROGNAME_H +#define _PROGNAME_H + +/* Programs using this file should do the following in main(): + set_program_name (argv[0]); + */ + + +#ifdef __cplusplus +extern "C" { +#endif + + +/* String containing name the program is called with. */ +extern const char *program_name; + +/* Set program_name, based on argv[0]. */ +extern void set_program_name (const char *argv0); + +#if ENABLE_RELOCATABLE + +/* Set program_name, based on argv[0], and original installation prefix and + directory, for relocatability. */ +extern void set_program_name_and_installdir (const char *argv0, + const char *orig_installprefix, + const char *orig_installdir); +#undef set_program_name +#define set_program_name(ARG0) \ + set_program_name_and_installdir (ARG0, INSTALLPREFIX, INSTALLDIR) + +/* Return the full pathname of the current executable, based on the earlier + call to set_program_name_and_installdir. Return NULL if unknown. */ +extern char *get_full_program_name (void); + +#endif + + +#ifdef __cplusplus +} +#endif + + +#endif /* _PROGNAME_H */ diff -ruNp m4-1.4.10/tests/test-EOVERFLOW.c m4-1.4.11/tests/test-EOVERFLOW.c --- m4-1.4.10/tests/test-EOVERFLOW.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/tests/test-EOVERFLOW.c 2008-03-30 16:06:54.000000000 -0600 @@ -0,0 +1,32 @@ +/* Test of EOVERFLOW macro. + Copyright (C) 2008 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/>. */ + +#include <config.h> + +#include <errno.h> + +/* Check that it can be used as an initializer outside of a function. */ +static int err = EOVERFLOW; + +int +main () +{ + /* snprintf() callers want to distinguish EINVAL and EOVERFLOW. */ + if (err == EINVAL) + return 1; + + return 0; +} diff -ruNp m4-1.4.10/tests/test-alloca-opt.c m4-1.4.11/tests/test-alloca-opt.c --- m4-1.4.10/tests/test-alloca-opt.c 2007-05-30 19:31:04.000000000 -0600 +++ m4-1.4.11/tests/test-alloca-opt.c 2007-10-09 06:16:59.000000000 -0600 @@ -1,10 +1,10 @@ /* Test of optional automatic memory allocation. Copyright (C) 2005, 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -12,8 +12,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ diff -ruNp m4-1.4.10/tests/test-array_list.c m4-1.4.11/tests/test-array_list.c --- m4-1.4.10/tests/test-array_list.c 2007-05-30 19:31:05.000000000 -0600 +++ m4-1.4.11/tests/test-array_list.c 2007-10-09 06:17:00.000000000 -0600 @@ -2,10 +2,10 @@ Copyright (C) 2006-2007 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2007. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -13,8 +13,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> diff -ruNp m4-1.4.10/tests/test-array_oset.c m4-1.4.11/tests/test-array_oset.c --- m4-1.4.10/tests/test-array_oset.c 2007-05-30 19:31:05.000000000 -0600 +++ m4-1.4.11/tests/test-array_oset.c 2007-10-09 06:17:00.000000000 -0600 @@ -2,10 +2,10 @@ Copyright (C) 2006-2007 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2007. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -13,8 +13,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> diff -ruNp m4-1.4.10/tests/test-avltree_oset.c m4-1.4.11/tests/test-avltree_oset.c --- m4-1.4.10/tests/test-avltree_oset.c 2007-05-30 19:31:05.000000000 -0600 +++ m4-1.4.11/tests/test-avltree_oset.c 2007-10-09 06:17:00.000000000 -0600 @@ -2,10 +2,10 @@ Copyright (C) 2006-2007 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -13,8 +13,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> diff -ruNp m4-1.4.10/tests/test-binary-io.c m4-1.4.11/tests/test-binary-io.c --- m4-1.4.10/tests/test-binary-io.c 2007-07-05 05:48:53.000000000 -0600 +++ m4-1.4.11/tests/test-binary-io.c 2007-10-09 06:17:00.000000000 -0600 @@ -1,10 +1,10 @@ /* Test of binary mode I/O. Copyright (C) 2005, 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -12,8 +12,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2005. */ diff -ruNp m4-1.4.10/tests/test-c-ctype.c m4-1.4.11/tests/test-c-ctype.c --- m4-1.4.10/tests/test-c-ctype.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/tests/test-c-ctype.c 2008-03-29 20:30:57.000000000 -0600 @@ -0,0 +1,397 @@ +/* Test of character handling in C locale. + Copyright (C) 2005, 2007 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/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2005. */ + +#include <config.h> + +#include "c-ctype.h" + +#include <locale.h> +#include <stdio.h> +#include <stdlib.h> + +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) + +static void +test_all (void) +{ + int c; + + for (c = -0x80; c < 0x100; c++) + { + ASSERT (c_isascii (c) == (c >= 0 && c < 0x80)); + + switch (c) + { + case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': + case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': + case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': + case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': + case 'Y': case 'Z': + case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': + case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': + case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': + case 's': case 't': case 'u': case 'v': case 'w': case 'x': + case 'y': case 'z': + case '0': case '1': case '2': case '3': case '4': case '5': + case '6': case '7': case '8': case '9': + ASSERT (c_isalnum (c) == 1); + break; + default: + ASSERT (c_isalnum (c) == 0); + break; + } + + switch (c) + { + case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': + case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': + case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': + case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': + case 'Y': case 'Z': + case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': + case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': + case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': + case 's': case 't': case 'u': case 'v': case 'w': case 'x': + case 'y': case 'z': + ASSERT (c_isalpha (c) == 1); + break; + default: + ASSERT (c_isalpha (c) == 0); + break; + } + + switch (c) + { + case '\t': case ' ': + ASSERT (c_isblank (c) == 1); + break; + default: + ASSERT (c_isblank (c) == 0); + break; + } + + ASSERT (c_iscntrl (c) == ((c >= 0 && c < 0x20) || c == 0x7f)); + + switch (c) + { + case '0': case '1': case '2': case '3': case '4': case '5': + case '6': case '7': case '8': case '9': + ASSERT (c_isdigit (c) == 1); + break; + default: + ASSERT (c_isdigit (c) == 0); + break; + } + + switch (c) + { + case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': + case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': + case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': + case 's': case 't': case 'u': case 'v': case 'w': case 'x': + case 'y': case 'z': + ASSERT (c_islower (c) == 1); + break; + default: + ASSERT (c_islower (c) == 0); + break; + } + + ASSERT (c_isgraph (c) == ((c >= 0x20 && c < 0x7f) && c != ' ')); + + ASSERT (c_isprint (c) == (c >= 0x20 && c < 0x7f)); + + ASSERT (c_ispunct (c) == (c_isgraph (c) && !c_isalnum (c))); + + switch (c) + { + case ' ': case '\t': case '\n': case '\v': case '\f': case '\r': + ASSERT (c_isspace (c) == 1); + break; + default: + ASSERT (c_isspace (c) == 0); + break; + } + + switch (c) + { + case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': + case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': + case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': + case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': + case 'Y': case 'Z': + ASSERT (c_isupper (c) == 1); + break; + default: + ASSERT (c_isupper (c) == 0); + break; + } + + switch (c) + { + case '0': case '1': case '2': case '3': case '4': case '5': + case '6': case '7': case '8': case '9': + case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': + case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': + ASSERT (c_isxdigit (c) == 1); + break; + default: + ASSERT (c_isxdigit (c) == 0); + break; + } + + switch (c) + { + case 'A': + ASSERT (c_tolower (c) == 'a'); + ASSERT (c_toupper (c) == c); + break; + case 'B': + ASSERT (c_tolower (c) == 'b'); + ASSERT (c_toupper (c) == c); + break; + case 'C': + ASSERT (c_tolower (c) == 'c'); + ASSERT (c_toupper (c) == c); + break; + case 'D': + ASSERT (c_tolower (c) == 'd'); + ASSERT (c_toupper (c) == c); + break; + case 'E': + ASSERT (c_tolower (c) == 'e'); + ASSERT (c_toupper (c) == c); + break; + case 'F': + ASSERT (c_tolower (c) == 'f'); + ASSERT (c_toupper (c) == c); + break; + case 'G': + ASSERT (c_tolower (c) == 'g'); + ASSERT (c_toupper (c) == c); + break; + case 'H': + ASSERT (c_tolower (c) == 'h'); + ASSERT (c_toupper (c) == c); + break; + case 'I': + ASSERT (c_tolower (c) == 'i'); + ASSERT (c_toupper (c) == c); + break; + case 'J': + ASSERT (c_tolower (c) == 'j'); + ASSERT (c_toupper (c) == c); + break; + case 'K': + ASSERT (c_tolower (c) == 'k'); + ASSERT (c_toupper (c) == c); + break; + case 'L': + ASSERT (c_tolower (c) == 'l'); + ASSERT (c_toupper (c) == c); + break; + case 'M': + ASSERT (c_tolower (c) == 'm'); + ASSERT (c_toupper (c) == c); + break; + case 'N': + ASSERT (c_tolower (c) == 'n'); + ASSERT (c_toupper (c) == c); + break; + case 'O': + ASSERT (c_tolower (c) == 'o'); + ASSERT (c_toupper (c) == c); + break; + case 'P': + ASSERT (c_tolower (c) == 'p'); + ASSERT (c_toupper (c) == c); + break; + case 'Q': + ASSERT (c_tolower (c) == 'q'); + ASSERT (c_toupper (c) == c); + break; + case 'R': + ASSERT (c_tolower (c) == 'r'); + ASSERT (c_toupper (c) == c); + break; + case 'S': + ASSERT (c_tolower (c) == 's'); + ASSERT (c_toupper (c) == c); + break; + case 'T': + ASSERT (c_tolower (c) == 't'); + ASSERT (c_toupper (c) == c); + break; + case 'U': + ASSERT (c_tolower (c) == 'u'); + ASSERT (c_toupper (c) == c); + break; + case 'V': + ASSERT (c_tolower (c) == 'v'); + ASSERT (c_toupper (c) == c); + break; + case 'W': + ASSERT (c_tolower (c) == 'w'); + ASSERT (c_toupper (c) == c); + break; + case 'X': + ASSERT (c_tolower (c) == 'x'); + ASSERT (c_toupper (c) == c); + break; + case 'Y': + ASSERT (c_tolower (c) == 'y'); + ASSERT (c_toupper (c) == c); + break; + case 'Z': + ASSERT (c_tolower (c) == 'z'); + ASSERT (c_toupper (c) == c); + break; + case 'a': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'A'); + break; + case 'b': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'B'); + break; + case 'c': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'C'); + break; + case 'd': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'D'); + break; + case 'e': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'E'); + break; + case 'f': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'F'); + break; + case 'g': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'G'); + break; + case 'h': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'H'); + break; + case 'i': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'I'); + break; + case 'j': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'J'); + break; + case 'k': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'K'); + break; + case 'l': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'L'); + break; + case 'm': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'M'); + break; + case 'n': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'N'); + break; + case 'o': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'O'); + break; + case 'p': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'P'); + break; + case 'q': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'Q'); + break; + case 'r': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'R'); + break; + case 's': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'S'); + break; + case 't': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'T'); + break; + case 'u': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'U'); + break; + case 'v': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'V'); + break; + case 'w': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'W'); + break; + case 'x': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'X'); + break; + case 'y': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'Y'); + break; + case 'z': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'Z'); + break; + default: + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == c); + break; + } + } +} + +int +main () +{ + test_all (); + + setlocale (LC_ALL, "de_DE"); + test_all (); + + setlocale (LC_ALL, "ja_JP.EUC-JP"); + test_all (); + + return 0; +} diff -ruNp m4-1.4.10/tests/test-closein.c m4-1.4.11/tests/test-closein.c --- m4-1.4.10/tests/test-closein.c 2007-05-30 19:31:05.000000000 -0600 +++ m4-1.4.11/tests/test-closein.c 2007-10-09 06:17:00.000000000 -0600 @@ -3,7 +3,7 @@ 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 2, or (at your option) + the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -23,6 +23,7 @@ #include <stdio.h> #include <stdlib.h> +#include <unistd.h> #include "binary-io.h" @@ -43,6 +44,9 @@ main (int argc, char **argv) unreliable on text mode input. */ SET_BINARY (0); + if (argc > 2) + close (0); + if (argc > 1) i = fread (buf, 1, 6, stdin); return 0; diff -ruNp m4-1.4.10/tests/test-closein.sh m4-1.4.11/tests/test-closein.sh --- m4-1.4.10/tests/test-closein.sh 2007-05-30 19:31:06.000000000 -0600 +++ m4-1.4.11/tests/test-closein.sh 2007-10-09 06:17:01.000000000 -0600 @@ -30,7 +30,7 @@ cat ${p}in.tmp | ./test-closein${EXEEXT} ./test-closein${EXEEXT} consume </dev/null || exit 1 # Test for error when read fails because no file available -./test-closein${EXEEXT} consume <&- 2>/dev/null && exit 1 +./test-closein${EXEEXT} consume close <&- 2>/dev/null && exit 1 # Cleanup rm -fr $tmpfiles diff -ruNp m4-1.4.10/tests/test-fflush.c m4-1.4.11/tests/test-fflush.c --- m4-1.4.10/tests/test-fflush.c 2007-07-05 05:48:54.000000000 -0600 +++ m4-1.4.11/tests/test-fflush.c 2007-10-09 06:17:01.000000000 -0600 @@ -1,10 +1,10 @@ /* Test of POSIX compatible fflush() function. Copyright (C) 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -12,8 +12,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Eric Blake, 2007. */ diff -ruNp m4-1.4.10/tests/test-fflush2.c m4-1.4.11/tests/test-fflush2.c --- m4-1.4.10/tests/test-fflush2.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/tests/test-fflush2.c 2008-03-29 07:27:05.000000000 -0600 @@ -0,0 +1,88 @@ +/* Test of POSIX compatible fflush() function. + Copyright (C) 2008 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/>. */ + +#include <config.h> + +#include <stdio.h> + +#include <stdlib.h> + +/* This test can only be made to work on specific platforms. */ +#if defined _IO_ferror_unlocked || defined __sferror /* GNU libc, BeOS; FreeBSD, NetBSD, OpenBSD, MacOS X, Cygwin */ +# define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) +#else +# define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + printf ("Skipping test: expected failure on this platform\n"); \ + exit (77); \ + } \ + } \ + while (0) +#endif + +int +main (int argc, char **argv) +{ +#if 0 + /* Check fflush after a backup ungetc() call. This is case 1 in terms of + <http://lists.gnu.org/archive/html/bug-gnulib/2008-03/msg00131.html>. + The Austin Group has not yet decided how this should behave. */ +#endif +#if 0 + /* Check fflush after a non-backup ungetc() call. This is case 2 in terms of + <http://lists.gnu.org/archive/html/bug-gnulib/2008-03/msg00131.html>. + The Austin Group has not yet decided how this should behave. */ + /* Check that fflush after a non-backup ungetc() call discards the ungetc + buffer. This is mandated by POSIX + <http://www.opengroup.org/susv3/functions/ungetc.html>: + "The value of the file-position indicator for the stream after + reading or discarding all pushed-back bytes shall be the same + as it was before the bytes were pushed back." */ + int c; + + c = fgetc (stdin); + ASSERT (c == '#'); + + c = fgetc (stdin); + ASSERT (c == '!'); + + /* Here the file-position indicator must be 2. */ + + c = ungetc ('@', stdin); + ASSERT (c == '@'); + + fflush (stdin); + + /* Here the file-position indicator must be 2 again. */ + + c = fgetc (stdin); + ASSERT (c == '/'); +#endif + + return 0; +} diff -ruNp m4-1.4.10/tests/test-fflush2.sh m4-1.4.11/tests/test-fflush2.sh --- m4-1.4.10/tests/test-fflush2.sh 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/tests/test-fflush2.sh 2008-03-10 20:11:15.000000000 -0600 @@ -0,0 +1,8 @@ +#!/bin/sh + +# Execute the test only with seekable input stream. +# The behaviour of fflush() on a non-seekable input stream is undefined. +./test-fflush2${EXEEXT} < "$srcdir/test-fflush2.sh" || exit $? +#cat "$srcdir/test-fflush2.sh" | ./test-fflush2${EXEEXT} || exit $? + +exit 0 diff -ruNp m4-1.4.10/tests/test-fpending.c m4-1.4.11/tests/test-fpending.c --- m4-1.4.10/tests/test-fpending.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/tests/test-fpending.c 2007-10-09 06:17:01.000000000 -0600 @@ -0,0 +1,50 @@ +/* Ensure that __fpending works. + + Copyright (C) 2004, 2007 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/>. + + Written by Jim Meyering. */ + +#include <config.h> + +#include "fpending.h" + +#include <stdio.h> +#include <stdlib.h> + +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) + +int +main () +{ + ASSERT (__fpending (stdout) == 0); + + fputs ("foo", stdout); + ASSERT (__fpending (stdout) == 3); + + fflush (stdout); + ASSERT (__fpending (stdout) == 0); + + exit (0); +} diff -ruNp m4-1.4.10/tests/test-fpending.sh m4-1.4.11/tests/test-fpending.sh --- m4-1.4.10/tests/test-fpending.sh 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/tests/test-fpending.sh 2007-10-15 18:56:41.000000000 -0600 @@ -0,0 +1,12 @@ +#!/bin/sh + +tmpfile= +trap 'rm -fr $tmpfile' 1 2 3 15 + +tmpfile=test-fpending.t + +./test-fpending${EXEEXT} > $tmpfile || exit 1 + +rm -fr $tmpfile + +exit 0 diff -ruNp m4-1.4.10/tests/test-fpurge.c m4-1.4.11/tests/test-fpurge.c --- m4-1.4.10/tests/test-fpurge.c 2007-05-30 19:31:06.000000000 -0600 +++ m4-1.4.11/tests/test-fpurge.c 2007-10-09 06:17:01.000000000 -0600 @@ -1,10 +1,10 @@ /* Test of fpurge() function. Copyright (C) 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -12,8 +12,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ diff -ruNp m4-1.4.10/tests/test-freadahead.c m4-1.4.11/tests/test-freadahead.c --- m4-1.4.10/tests/test-freadahead.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/tests/test-freadahead.c 2008-03-10 20:11:57.000000000 -0600 @@ -0,0 +1,83 @@ +/* Test of freadahead() function. + Copyright (C) 2007-2008 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/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2007. */ + +#include <config.h> + +#include "freadahead.h" + +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) + +int +main (int argc, char **argv) +{ + int nbytes = atoi (argv[1]); + if (nbytes > 0) + { + void *buf = malloc (nbytes); + ASSERT (fread (buf, 1, nbytes, stdin) == nbytes); + } + + if (nbytes == 0) + ASSERT (freadahead (stdin) == 0); + else + { + if (lseek (0, 0, SEEK_CUR) == nbytes) + /* An unbuffered stdio, such as BeOS or on uClibc compiled without + __STDIO_BUFFERS. */ + ASSERT (freadahead (stdin) == 0); + else + { + /* Normal buffered stdio. */ + size_t buffered; + int c, c2; + + ASSERT (freadahead (stdin) != 0); + buffered = freadahead (stdin); + + c = fgetc (stdin); + ASSERT (freadahead (stdin) == buffered - 1); + ungetc (c, stdin); + ASSERT (freadahead (stdin) == buffered); + c2 = fgetc (stdin); + ASSERT (c2 == c); + ASSERT (freadahead (stdin) == buffered - 1); + + c = '@'; + ungetc (c, stdin); + ASSERT (freadahead (stdin) == buffered); + c2 = fgetc (stdin); + ASSERT (c2 == c); + ASSERT (freadahead (stdin) == buffered - 1); + } + } + + return 0; +} diff -ruNp m4-1.4.10/tests/test-freadahead.sh m4-1.4.11/tests/test-freadahead.sh --- m4-1.4.10/tests/test-freadahead.sh 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/tests/test-freadahead.sh 2007-09-22 18:59:03.000000000 -0600 @@ -0,0 +1,5 @@ +#!/bin/sh + +./test-freadahead${EXEEXT} 0 < "$srcdir/test-freadahead.sh" || exit 1 +./test-freadahead${EXEEXT} 5 < "$srcdir/test-freadahead.sh" || exit 1 +exit 0 diff -ruNp m4-1.4.10/tests/test-freading.c m4-1.4.11/tests/test-freading.c --- m4-1.4.10/tests/test-freading.c 2007-05-30 19:31:06.000000000 -0600 +++ m4-1.4.11/tests/test-freading.c 2007-10-09 06:17:02.000000000 -0600 @@ -1,10 +1,10 @@ /* Test of freading() function. Copyright (C) 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -12,8 +12,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ diff -ruNp m4-1.4.10/tests/test-frexp.c m4-1.4.11/tests/test-frexp.c --- m4-1.4.10/tests/test-frexp.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/tests/test-frexp.c 2008-04-01 20:23:18.000000000 -0600 @@ -0,0 +1,199 @@ +/* Test of splitting a double into fraction and mantissa. + Copyright (C) 2007-2008 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/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2007. */ + +#include <config.h> + +#include <math.h> + +#include <float.h> +#include <stdio.h> +#include <stdlib.h> + +#include "isnand.h" +#include "nan.h" + +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) + +static double +my_ldexp (double x, int d) +{ + for (; d > 0; d--) + x *= 2.0; + for (; d < 0; d++) + x *= 0.5; + return x; +} + +int +main () +{ + int i; + /* The use of 'volatile' guarantees that excess precision bits are dropped + when dealing with denormalized numbers. It is necessary on x86 systems + where double-floats are not IEEE compliant by default, to avoid that the + results become platform and compiler option dependent. 'volatile' is a + portable alternative to gcc's -ffloat-store option. */ + volatile double x; + + { /* NaN. */ + int exp = -9999; + double mantissa; + x = NaNd (); + mantissa = frexp (x, &exp); + ASSERT (isnand (mantissa)); + } + + { /* Positive infinity. */ + int exp = -9999; + double mantissa; + x = 1.0 / 0.0; + mantissa = frexp (x, &exp); + ASSERT (mantissa == x); + } + + { /* Negative infinity. */ + int exp = -9999; + double mantissa; + x = -1.0 / 0.0; + mantissa = frexp (x, &exp); + ASSERT (mantissa == x); + } + + { /* Positive zero. */ + int exp = -9999; + double mantissa; + x = 0.0; + mantissa = frexp (x, &exp); + ASSERT (exp == 0); + ASSERT (mantissa == x); + ASSERT (!signbit (mantissa)); + } + + { /* Negative zero. */ + int exp = -9999; + double mantissa; + x = -0.0; + mantissa = frexp (x, &exp); + ASSERT (exp == 0); + ASSERT (mantissa == x); + ASSERT (signbit (mantissa)); + } + + for (i = 1, x = 1.0; i <= DBL_MAX_EXP; i++, x *= 2.0) + { + int exp = -9999; + double mantissa = frexp (x, &exp); + ASSERT (exp == i); + ASSERT (mantissa == 0.5); + } + for (i = 1, x = 1.0; i >= DBL_MIN_EXP; i--, x *= 0.5) + { + int exp = -9999; + double mantissa = frexp (x, &exp); + ASSERT (exp == i); + ASSERT (mantissa == 0.5); + } + for (; i >= DBL_MIN_EXP - 100 && x > 0.0; i--, x *= 0.5) + { + int exp = -9999; + double mantissa = frexp (x, &exp); + ASSERT (exp == i); + ASSERT (mantissa == 0.5); + } + + for (i = 1, x = -1.0; i <= DBL_MAX_EXP; i++, x *= 2.0) + { + int exp = -9999; + double mantissa = frexp (x, &exp); + ASSERT (exp == i); + ASSERT (mantissa == -0.5); + } + for (i = 1, x = -1.0; i >= DBL_MIN_EXP; i--, x *= 0.5) + { + int exp = -9999; + double mantissa = frexp (x, &exp); + ASSERT (exp == i); + ASSERT (mantissa == -0.5); + } + for (; i >= DBL_MIN_EXP - 100 && x < 0.0; i--, x *= 0.5) + { + int exp = -9999; + double mantissa = frexp (x, &exp); + ASSERT (exp == i); + ASSERT (mantissa == -0.5); + } + + for (i = 1, x = 1.01; i <= DBL_MAX_EXP; i++, x *= 2.0) + { + int exp = -9999; + double mantissa = frexp (x, &exp); + ASSERT (exp == i); + ASSERT (mantissa == 0.505); + } + for (i = 1, x = 1.01; i >= DBL_MIN_EXP; i--, x *= 0.5) + { + int exp = -9999; + double mantissa = frexp (x, &exp); + ASSERT (exp == i); + ASSERT (mantissa == 0.505); + } + for (; i >= DBL_MIN_EXP - 100 && x > 0.0; i--, x *= 0.5) + { + int exp = -9999; + double mantissa = frexp (x, &exp); + ASSERT (exp == i); + ASSERT (mantissa >= 0.5); + ASSERT (mantissa < 1.0); + ASSERT (mantissa == my_ldexp (x, - exp)); + } + + for (i = 1, x = 1.73205; i <= DBL_MAX_EXP; i++, x *= 2.0) + { + int exp = -9999; + double mantissa = frexp (x, &exp); + ASSERT (exp == i); + ASSERT (mantissa == 0.866025); + } + for (i = 1, x = 1.73205; i >= DBL_MIN_EXP; i--, x *= 0.5) + { + int exp = -9999; + double mantissa = frexp (x, &exp); + ASSERT (exp == i); + ASSERT (mantissa == 0.866025); + } + for (; i >= DBL_MIN_EXP - 100 && x > 0.0; i--, x *= 0.5) + { + int exp = -9999; + double mantissa = frexp (x, &exp); + ASSERT (exp == i || exp == i + 1); + ASSERT (mantissa >= 0.5); + ASSERT (mantissa < 1.0); + ASSERT (mantissa == my_ldexp (x, - exp)); + } + + return 0; +} diff -ruNp m4-1.4.10/tests/test-frexpl.c m4-1.4.11/tests/test-frexpl.c --- m4-1.4.10/tests/test-frexpl.c 2007-07-05 05:48:55.000000000 -0600 +++ m4-1.4.11/tests/test-frexpl.c 2007-10-09 06:17:02.000000000 -0600 @@ -1,10 +1,10 @@ /* Test of splitting a 'long double' into fraction and mantissa. Copyright (C) 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -12,8 +12,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ diff -ruNp m4-1.4.10/tests/test-fseeko.c m4-1.4.11/tests/test-fseeko.c --- m4-1.4.10/tests/test-fseeko.c 2007-05-30 19:31:07.000000000 -0600 +++ m4-1.4.11/tests/test-fseeko.c 2007-12-17 22:19:30.000000000 -0700 @@ -1,10 +1,10 @@ /* Test of fseeko() function. Copyright (C) 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -12,8 +12,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ @@ -27,10 +26,32 @@ int main (int argc, char **argv) { - /* Assume stdin is seekable iff argc > 1. */ + /* Assume stdin is non-empty and seekable iff argc > 1. */ int expected = argc > 1 ? 0 : -1; /* Exit with success only if fseek/fseeko agree. */ int r1 = fseeko (stdin, (off_t)0, SEEK_CUR); int r2 = fseek (stdin, (long)0, SEEK_CUR); - return ! (r1 == r2 && r1 == expected); + if (r1 != r2 || r1 != expected) + return 1; + if (argc > 1) + { + /* Test that fseek discards ungetc data. */ + int ch = fgetc (stdin); + if (ch == EOF) + return 1; + if (ungetc (ch ^ 0xff, stdin) != (ch ^ 0xff)) + return 1; + if (fseeko (stdin, (off_t) 0, SEEK_END)) + return 1; + if (fgetc (stdin) != EOF) + return 1; + /* Test that fseek resets end-of-file marker. */ + if (!feof (stdin)) + return 1; + if (fseeko (stdin, (off_t) 0, SEEK_END)) + return 1; + if (feof (stdin)) + return 1; + } + return 0; } diff -ruNp m4-1.4.10/tests/test-ftello.c m4-1.4.11/tests/test-ftello.c --- m4-1.4.10/tests/test-ftello.c 2007-05-30 19:31:07.000000000 -0600 +++ m4-1.4.11/tests/test-ftello.c 2008-03-29 19:20:03.000000000 -0600 @@ -1,10 +1,10 @@ /* Test of ftello() function. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2008 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -12,25 +12,97 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ #include <config.h> #include <stdio.h> +#include <stdlib.h> -/* Get off_t. */ -#include <sys/types.h> +#include "binary-io.h" + +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) int main (int argc, char **argv) { + int ch; /* Assume stdin is seekable iff argc > 1. */ - int expected = argc > 1 ? 0 : -1; - /* Exit with success only if ftell/ftello agree. */ - off_t pos1 = ftello (stdin); - long pos2 = ftell (stdin); - return ! (pos1 == pos2 && pos1 == expected); + if (argc == 1) + { + ASSERT (ftell (stdin) == -1); + ASSERT (ftello (stdin) == -1); + return 0; + } + + /* mingw ftell is unreliable on text mode input. */ + SET_BINARY (0); + + /* Simple tests. For each test, make sure ftell and ftello agree. */ + ASSERT (ftell (stdin) == 0); + ASSERT (ftello (stdin) == 0); + + ch = fgetc (stdin); + ASSERT (ch == '#'); + ASSERT (ftell (stdin) == 1); + ASSERT (ftello (stdin) == 1); + + /* Test ftell after ungetc of read input. */ + ch = ungetc ('#', stdin); + ASSERT (ch == '#'); + ASSERT (ftell (stdin) == 0); + ASSERT (ftello (stdin) == 0); + + ch = fgetc (stdin); + ASSERT (ch == '#'); + ASSERT (ftell (stdin) == 1); + ASSERT (ftello (stdin) == 1); + + /* Test ftell after fseek. */ + ASSERT (fseek (stdin, 2, SEEK_SET) == 0); + ASSERT (ftell (stdin) == 2); + ASSERT (ftello (stdin) == 2); + + /* Test ftell after random ungetc. */ + ch = fgetc (stdin); + ASSERT (ch == '/'); + ch = ungetc ('@', stdin); + ASSERT (ch == '@'); + ASSERT (ftell (stdin) == 2); + ASSERT (ftello (stdin) == 2); + + ch = fgetc (stdin); + ASSERT (ch == '@'); + ASSERT (ftell (stdin) == 3); + ASSERT (ftello (stdin) == 3); + + /* Test ftell after ungetc without read. */ + ASSERT (fseek (stdin, 0, SEEK_CUR) == 0); + ASSERT (ftell (stdin) == 3); + ASSERT (ftello (stdin) == 3); + + ch = ungetc ('~', stdin); + ASSERT (ch == '~'); + ASSERT (ftell (stdin) == 2); + ASSERT (ftello (stdin) == 2); + + /* Test ftell beyond end of file. */ + ASSERT (fseek (stdin, 0, SEEK_END) == 0); + ch = ftello (stdin); + ASSERT (fseek (stdin, 10, SEEK_END) == 0); + ASSERT (ftell (stdin) == ch + 10); + ASSERT (ftello (stdin) == ch + 10); + + return 0; } diff -ruNp m4-1.4.10/tests/test-gettimeofday.c m4-1.4.11/tests/test-gettimeofday.c --- m4-1.4.10/tests/test-gettimeofday.c 2007-05-30 19:31:08.000000000 -0600 +++ m4-1.4.11/tests/test-gettimeofday.c 2007-10-09 06:17:03.000000000 -0600 @@ -2,10 +2,10 @@ * Copyright (C) 2005, 2007 Free Software Foundation * Written by Jim Meyering. * - * This program is free software; you can redistribute it and/or modify + * 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 2, or (at your option) - * any later version. + * 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 @@ -13,9 +13,7 @@ * 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, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. */ + * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> diff -ruNp m4-1.4.10/tests/test-isnan.c m4-1.4.11/tests/test-isnan.c --- m4-1.4.10/tests/test-isnan.c 2007-05-30 19:31:08.000000000 -0600 +++ m4-1.4.11/tests/test-isnan.c 1969-12-31 17:00:00.000000000 -0700 @@ -1,86 +0,0 @@ -/* Test of isnan() substitute. - Copyright (C) 2007 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 2, 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -/* Written by Bruno Haible <bruno@clisp.org>, 2007. */ - -#include <config.h> - -#include "isnan.h" - -#include <limits.h> -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - abort (); \ - } \ - } \ - while (0) - -/* The Compaq (ex-DEC) C 6.4 compiler chokes on the expression 0.0 / 0.0. */ -#ifdef __DECC -static double -NaN () -{ - static double zero = 0.0; - return zero / zero; -} -#else -# define NaN() (0.0 / 0.0) -#endif - -int -main () -{ - /* Finite values. */ - ASSERT (!isnan (3.141)); - ASSERT (!isnan (3.141e30)); - ASSERT (!isnan (3.141e-30)); - ASSERT (!isnan (-2.718)); - ASSERT (!isnan (-2.718e30)); - ASSERT (!isnan (-2.718e-30)); - /* Infinite values. */ - ASSERT (!isnan (1.0 / 0.0)); - ASSERT (!isnan (-1.0 / 0.0)); - /* Quiet NaN. */ - ASSERT (isnan (NaN ())); -#if defined DBL_EXPBIT0_WORD && defined DBL_EXPBIT0_BIT - /* Signalling NaN. */ - { - #define NWORDS \ - ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) - typedef union { double value; unsigned int word[NWORDS]; } memory_double; - memory_double m; - m.value = NaN (); -# if DBL_EXPBIT0_BIT > 0 - m.word[DBL_EXPBIT0_WORD] ^= (unsigned int) 1 << (DBL_EXPBIT0_BIT - 1); -# else - m.word[DBL_EXPBIT0_WORD + (DBL_EXPBIT0_WORD < NWORDS / 2 ? 1 : - 1)] - ^= (unsigned int) 1 << (sizeof (unsigned int) * CHAR_BIT - 1); -# endif - m.word[DBL_EXPBIT0_WORD + (DBL_EXPBIT0_WORD < NWORDS / 2 ? 1 : - 1)] - |= (unsigned int) 1 << DBL_EXPBIT0_BIT; - ASSERT (isnan (m.value)); - } -#endif - return 0; -} diff -ruNp m4-1.4.10/tests/test-isnand.c m4-1.4.11/tests/test-isnand.c --- m4-1.4.10/tests/test-isnand.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/tests/test-isnand.c 2008-04-01 20:23:18.000000000 -0600 @@ -0,0 +1,77 @@ +/* Test of isnand() substitute. + Copyright (C) 2007-2008 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/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2007. */ + +#include <config.h> + +#include "isnand.h" + +#include <limits.h> +#include <stdio.h> +#include <stdlib.h> + +#include "nan.h" + +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) + +int +main () +{ + /* Finite values. */ + ASSERT (!isnand (3.141)); + ASSERT (!isnand (3.141e30)); + ASSERT (!isnand (3.141e-30)); + ASSERT (!isnand (-2.718)); + ASSERT (!isnand (-2.718e30)); + ASSERT (!isnand (-2.718e-30)); + ASSERT (!isnand (0.0)); + ASSERT (!isnand (-0.0)); + /* Infinite values. */ + ASSERT (!isnand (1.0 / 0.0)); + ASSERT (!isnand (-1.0 / 0.0)); + /* Quiet NaN. */ + ASSERT (isnand (NaNd ())); +#if defined DBL_EXPBIT0_WORD && defined DBL_EXPBIT0_BIT + /* Signalling NaN. */ + { + #define NWORDS \ + ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) + typedef union { double value; unsigned int word[NWORDS]; } memory_double; + memory_double m; + m.value = NaNd (); +# if DBL_EXPBIT0_BIT > 0 + m.word[DBL_EXPBIT0_WORD] ^= (unsigned int) 1 << (DBL_EXPBIT0_BIT - 1); +# else + m.word[DBL_EXPBIT0_WORD + (DBL_EXPBIT0_WORD < NWORDS / 2 ? 1 : - 1)] + ^= (unsigned int) 1 << (sizeof (unsigned int) * CHAR_BIT - 1); +# endif + m.word[DBL_EXPBIT0_WORD + (DBL_EXPBIT0_WORD < NWORDS / 2 ? 1 : - 1)] + |= (unsigned int) 1 << DBL_EXPBIT0_BIT; + ASSERT (isnand (m.value)); + } +#endif + return 0; +} diff -ruNp m4-1.4.10/tests/test-isnanf.c m4-1.4.11/tests/test-isnanf.c --- m4-1.4.10/tests/test-isnanf.c 2007-05-30 19:31:08.000000000 -0600 +++ m4-1.4.11/tests/test-isnanf.c 2008-04-01 20:23:19.000000000 -0600 @@ -1,10 +1,10 @@ /* Test of isnanf() substitute. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007-2008 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -12,8 +12,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ @@ -25,6 +24,8 @@ #include <stdio.h> #include <stdlib.h> +#include "nan.h" + #define ASSERT(expr) \ do \ { \ @@ -36,18 +37,6 @@ } \ while (0) -/* The Compaq (ex-DEC) C 6.4 compiler chokes on the expression 0.0 / 0.0. */ -#ifdef __DECC -static float -NaN () -{ - static float zero = 0.0f; - return zero / zero; -} -#else -# define NaN() (0.0f / 0.0f) -#endif - int main () { @@ -58,11 +47,13 @@ main () ASSERT (!isnanf (-2.718f)); ASSERT (!isnanf (-2.718e30f)); ASSERT (!isnanf (-2.718e-30f)); + ASSERT (!isnanf (0.0f)); + ASSERT (!isnanf (-0.0f)); /* Infinite values. */ ASSERT (!isnanf (1.0f / 0.0f)); ASSERT (!isnanf (-1.0f / 0.0f)); /* Quiet NaN. */ - ASSERT (isnanf (NaN ())); + ASSERT (isnanf (NaNf ())); #if defined FLT_EXPBIT0_WORD && defined FLT_EXPBIT0_BIT /* Signalling NaN. */ { @@ -70,7 +61,7 @@ main () ((sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) typedef union { float value; unsigned int word[NWORDS]; } memory_float; memory_float m; - m.value = NaN (); + m.value = NaNf (); # if FLT_EXPBIT0_BIT > 0 m.word[FLT_EXPBIT0_WORD] ^= (unsigned int) 1 << (FLT_EXPBIT0_BIT - 1); # else diff -ruNp m4-1.4.10/tests/test-isnanl-nolibm.c m4-1.4.11/tests/test-isnanl-nolibm.c --- m4-1.4.10/tests/test-isnanl-nolibm.c 2007-05-30 19:31:08.000000000 -0600 +++ m4-1.4.11/tests/test-isnanl-nolibm.c 2007-10-09 06:17:03.000000000 -0600 @@ -1,10 +1,10 @@ /* Test of isnanl() substitute. Copyright (C) 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -12,8 +12,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ diff -ruNp m4-1.4.10/tests/test-isnanl.h m4-1.4.11/tests/test-isnanl.h --- m4-1.4.10/tests/test-isnanl.h 2007-07-05 05:48:56.000000000 -0600 +++ m4-1.4.11/tests/test-isnanl.h 2007-12-11 19:26:27.000000000 -0700 @@ -1,10 +1,10 @@ /* Test of isnanl() substitute. Copyright (C) 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -12,8 +12,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ @@ -48,6 +47,8 @@ main () ASSERT (!isnanl (-2.718L)); ASSERT (!isnanl (-2.718e30L)); ASSERT (!isnanl (-2.718e-30L)); + ASSERT (!isnanl (0.0L)); + ASSERT (!isnanl (-0.0L)); /* Infinite values. */ ASSERT (!isnanl (1.0L / 0.0L)); ASSERT (!isnanl (-1.0L / 0.0L)); diff -ruNp m4-1.4.10/tests/test-linkedhash_list.c m4-1.4.11/tests/test-linkedhash_list.c --- m4-1.4.10/tests/test-linkedhash_list.c 2007-05-30 19:31:09.000000000 -0600 +++ m4-1.4.11/tests/test-linkedhash_list.c 2007-10-09 06:17:03.000000000 -0600 @@ -2,10 +2,10 @@ Copyright (C) 2006-2007 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -13,8 +13,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> diff -ruNp m4-1.4.10/tests/test-lseek.c m4-1.4.11/tests/test-lseek.c --- m4-1.4.10/tests/test-lseek.c 2007-07-05 05:48:57.000000000 -0600 +++ m4-1.4.11/tests/test-lseek.c 2007-10-09 06:17:04.000000000 -0600 @@ -1,10 +1,10 @@ /* Test of lseek() function. Copyright (C) 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -12,8 +12,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Eric Blake, 2007. */ @@ -49,7 +48,11 @@ main (int argc, char **argv) ASSERT (lseek (0, (off_t)-4, SEEK_CUR) == -1); ASSERT (errno == EINVAL); errno = 0; +#if ! defined __BEOS__ + /* POSIX says that the last lseek call, when failing, does not change + the current offset. But BeOS sets it to 0. */ ASSERT (lseek (0, (off_t)0, SEEK_CUR) == 2); +#endif #if 0 /* leads to SIGSYS on IRIX 6.5 */ ASSERT (lseek (0, (off_t)0, (SEEK_SET | SEEK_CUR | SEEK_END) + 1) == -1); ASSERT (errno == EINVAL); @@ -59,7 +62,11 @@ main (int argc, char **argv) ASSERT (lseek (1, (off_t)-4, SEEK_CUR) == -1); ASSERT (errno == EINVAL); errno = 0; +#if ! defined __BEOS__ + /* POSIX says that the last lseek call, when failing, does not change + the current offset. But BeOS sets it to 0. */ ASSERT (lseek (1, (off_t)0, SEEK_CUR) == 2); +#endif #if 0 /* leads to SIGSYS on IRIX 6.5 */ ASSERT (lseek (1, (off_t)0, (SEEK_SET | SEEK_CUR | SEEK_END) + 1) == -1); ASSERT (errno == EINVAL); diff -ruNp m4-1.4.10/tests/test-malloca.c m4-1.4.11/tests/test-malloca.c --- m4-1.4.10/tests/test-malloca.c 2007-07-04 22:02:42.000000000 -0600 +++ m4-1.4.11/tests/test-malloca.c 2007-10-09 06:17:04.000000000 -0600 @@ -1,10 +1,10 @@ /* Test of safe automatic memory allocation. Copyright (C) 2005, 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -12,8 +12,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2005. */ diff -ruNp m4-1.4.10/tests/test-math.c m4-1.4.11/tests/test-math.c --- m4-1.4.10/tests/test-math.c 2007-05-30 19:31:09.000000000 -0600 +++ m4-1.4.11/tests/test-math.c 2008-04-01 20:23:20.000000000 -0600 @@ -1,10 +1,10 @@ /* Test of <math.h> substitute. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2008 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -12,8 +12,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ @@ -21,8 +20,30 @@ #include <math.h> +#ifndef NAN +# error NAN should be defined +choke me +#endif + +#if 0 +/* Check that NAN expands into a constant expression. */ +static float n = NAN; +#endif + +/* Compare two numbers with ==. + This is a separate function because IRIX 6.5 "cc -O" miscompiles an + 'x == x' test. */ +static int +numeric_equal (double x, double y) +{ + return x == y; +} + int main () { + double d = NAN; + if (numeric_equal (d, d)) + return 1; return 0; } diff -ruNp m4-1.4.10/tests/test-printf-frexp.c m4-1.4.11/tests/test-printf-frexp.c --- m4-1.4.10/tests/test-printf-frexp.c 2007-05-30 19:31:09.000000000 -0600 +++ m4-1.4.11/tests/test-printf-frexp.c 2007-10-09 06:17:04.000000000 -0600 @@ -1,10 +1,10 @@ /* Test of splitting a double into fraction and mantissa. Copyright (C) 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -12,8 +12,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ diff -ruNp m4-1.4.10/tests/test-printf-frexpl.c m4-1.4.11/tests/test-printf-frexpl.c --- m4-1.4.10/tests/test-printf-frexpl.c 2007-07-05 05:48:58.000000000 -0600 +++ m4-1.4.11/tests/test-printf-frexpl.c 2007-10-09 06:17:04.000000000 -0600 @@ -1,10 +1,10 @@ /* Test of splitting a 'long double' into fraction and mantissa. Copyright (C) 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -12,8 +12,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ diff -ruNp m4-1.4.10/tests/test-quotearg.c m4-1.4.11/tests/test-quotearg.c --- m4-1.4.10/tests/test-quotearg.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/tests/test-quotearg.c 2008-02-16 07:53:56.000000000 -0700 @@ -0,0 +1,342 @@ +/* Test of quotearg family of functions. + Copyright (C) 2008 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, 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, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Eric Blake <ebb9@byu.net>, 2008. */ + +#include <config.h> + +#include "quotearg.h" + +#include <ctype.h> +#include <stdbool.h> +#include <stdint.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#if ENABLE_NLS +/* On Linux, gettext is optionally defined as a forwarding macro, + which would cause syntax errors in our definition below. But on + platforms that require -lintl, we cannot #undef gettext, since we + want to provide the entry point libintl_gettext. So we disable + optimizations to avoid the Linux macros. */ +# undef __OPTIMIZE__ +# include <libintl.h> + +/* These quotes are borrowed from a pt_PT.utf8 translation. */ +# define LQ "\302\253" +# define RQ "\302\273" +#endif + +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) + +struct result_strings { + char const *str1; /* Translation of "". */ + char const *str2; /* Translation of "\0""1\0". */ + size_t len2; /* Length of str2. */ + char const *str3; /* Translation of "simple". */ + char const *str4; /* Translation of " \t\n'\"\033?""?/\\". */ + char const *str5; /* Translation of "a:b". */ + char const *str6; /* Translation of "a\\b". */ +}; + +struct result_groups { + struct result_strings group1; /* Via quotearg_buffer. */ + struct result_strings group2; /* Via quotearg{,_mem}. */ + struct result_strings group3; /* Via quotearg_colon{,_mem}. */ +}; + +static struct result_strings inputs = { + "", "\0001\0", 3, "simple", " \t\n'\"\033?""?/\\", "a:b", "a\\b" +}; + +static struct result_groups results_g[] = { + /* literal_quoting_style */ + { { "", "\0""1\0", 3, "simple", " \t\n'\"\033?""?/\\", "a:b", "a\\b" }, + { "", "1", 1, "simple", " \t\n'\"\033?""?/\\", "a:b", "a\\b" }, + { "", "1", 1, "simple", " \t\n'\"\033?""?/\\", "a:b", "a\\b" } }, + + /* shell_quoting_style */ + { { "''", "\0""1\0", 3, "simple", "' \t\n'\\''\"\033?""?/\\'", "a:b", + "'a\\b'" }, + { "''", "1", 1, "simple", "' \t\n'\\''\"\033?""?/\\'", "a:b", + "'a\\b'" }, + { "''", "1", 1, "simple", "' \t\n'\\''\"\033?""?/\\'", "'a:b'", + "'a\\b'" } }, + + /* shell_always_quoting_style */ + { { "''", "'\0""1\0'", 5, "'simple'", "' \t\n'\\''\"\033?""?/\\'", "'a:b'", + "'a\\b'" }, + { "''", "'1'", 3, "'simple'", "' \t\n'\\''\"\033?""?/\\'", "'a:b'", + "'a\\b'" }, + { "''", "'1'", 3, "'simple'", "' \t\n'\\''\"\033?""?/\\'", "'a:b'", + "'a\\b'" } }, + + /* c_quoting_style */ + { { "\"\"", "\"\\0001\\0\"", 9, "\"simple\"", + "\" \\t\\n'\\\"\\033?""?/\\\\\"", "\"a:b\"", "\"a\\\\b\"" }, + { "\"\"", "\"\\0001\\0\"", 9, "\"simple\"", + "\" \\t\\n'\\\"\\033?""?/\\\\\"", "\"a:b\"", "\"a\\\\b\"" }, + { "\"\"", "\"\\0001\\0\"", 9, "\"simple\"", + "\" \\t\\n'\\\"\\033?""?/\\\\\"", "\"a\\:b\"", "\"a\\\\b\"" } }, + + /* c_maybe_quoting_style */ + { { "", "\"\\0001\\0\"", 9, "simple", "\" \\t\\n'\\\"\\033?""?/\\\\\"", + "a:b", "a\\b" }, + { "", "\"\\0001\\0\"", 9, "simple", "\" \\t\\n'\\\"\\033?""?/\\\\\"", + "a:b", "a\\b" }, + { "", "\"\\0001\\0\"", 9, "simple", "\" \\t\\n'\\\"\\033?""?/\\\\\"", + "\"a:b\"", "a\\b" } }, + + /* escape_quoting_style */ + { { "", "\\0001\\0", 7, "simple", " \\t\\n'\"\\033?""?/\\\\", "a:b", + "a\\\\b" }, + { "", "\\0001\\0", 7, "simple", " \\t\\n'\"\\033?""?/\\\\", "a:b", + "a\\\\b" }, + { "", "\\0001\\0", 7, "simple", " \\t\\n'\"\\033?""?/\\\\", "a\\:b", + "a\\\\b" } }, + + /* locale_quoting_style */ + { { "`'", "`\\0001\\0'", 9, "`simple'", "` \\t\\n\\'\"\\033?""?/\\\\'", + "`a:b'", "`a\\\\b'" }, + { "`'", "`\\0001\\0'", 9, "`simple'", "` \\t\\n\\'\"\\033?""?/\\\\'", + "`a:b'", "`a\\\\b'" }, + { "`'", "`\\0001\\0'", 9, "`simple'", "` \\t\\n\\'\"\\033?""?/\\\\'", + "`a\\:b'", "`a\\\\b'" } }, + + /* clocale_quoting_style */ + { { "\"\"", "\"\\0001\\0\"", 9, "\"simple\"", + "\" \\t\\n'\\\"\\033?""?/\\\\\"", "\"a:b\"", "\"a\\\\b\"" }, + { "\"\"", "\"\\0001\\0\"", 9, "\"simple\"", + "\" \\t\\n'\\\"\\033?""?/\\\\\"", "\"a:b\"", "\"a\\\\b\"" }, + { "\"\"", "\"\\0001\\0\"", 9, "\"simple\"", + "\" \\t\\n'\\\"\\033?""?/\\\\\"", "\"a\\:b\"", "\"a\\\\b\"" } } +}; + +static struct result_groups flag_results[] = { + /* literal_quoting_style and QA_ELIDE_NULL_BYTES */ + { { "", "1", 1, "simple", " \t\n'\"\033?""?/\\", "a:b", "a\\b" }, + { "", "1", 1, "simple", " \t\n'\"\033?""?/\\", "a:b", "a\\b" }, + { "", "1", 1, "simple", " \t\n'\"\033?""?/\\", "a:b", "a\\b" } }, + + /* c_quoting_style and QA_ELIDE_OUTER_QUOTES */ + { { "", "\"\\0001\\0\"", 9, "simple", "\" \\t\\n'\\\"\\033?""?/\\\\\"", + "a:b", "a\\b" }, + { "", "\"\\0001\\0\"", 9, "simple", "\" \\t\\n'\\\"\\033?""?/\\\\\"", + "a:b", "a\\b" }, + { "", "\"\\0001\\0\"", 9, "simple", "\" \\t\\n'\\\"\\033?""?/\\\\\"", + "\"a:b\"", "a\\b" } }, + + /* c_quoting_style and QA_SPLIT_TRIGRAPHS */ + { { "\"\"", "\"\\0001\\0\"", 9, "\"simple\"", + "\" \\t\\n'\\\"\\033?\"\"?/\\\\\"", "\"a:b\"", "\"a\\\\b\"" }, + { "\"\"", "\"\\0001\\0\"", 9, "\"simple\"", + "\" \\t\\n'\\\"\\033?\"\"?/\\\\\"", "\"a:b\"", "\"a\\\\b\"" }, + { "\"\"", "\"\\0001\\0\"", 9, "\"simple\"", + "\" \\t\\n'\\\"\\033?\"\"?/\\\\\"", "\"a\\:b\"", "\"a\\\\b\"" } } +}; + +#if ENABLE_NLS +static struct result_groups locale_results[] = { + /* locale_quoting_style */ + { { LQ RQ, LQ "\\0001\\0" RQ, 11, LQ "simple" RQ, + LQ " \\t\\n'\"\\033?""?/\\\\" RQ, LQ "a:b" RQ, LQ "a\\\\b" RQ }, + { LQ RQ, LQ "\\0001\\0" RQ, 11, LQ "simple" RQ, + LQ " \\t\\n'\"\\033?""?/\\\\" RQ, LQ "a:b" RQ, LQ "a\\\\b" RQ }, + { LQ RQ, LQ "\\0001\\0" RQ, 11, LQ "simple" RQ, + LQ " \\t\\n'\"\\033?""?/\\\\" RQ, LQ "a\\:b" RQ, LQ "a\\\\b" RQ } }, + + /* clocale_quoting_style */ + { { LQ RQ, LQ "\\0001\\0" RQ, 11, LQ "simple" RQ, + LQ " \\t\\n'\"\\033?""?/\\\\" RQ, LQ "a:b" RQ, LQ "a\\\\b" RQ }, + { LQ RQ, LQ "\\0001\\0" RQ, 11, LQ "simple" RQ, + LQ " \\t\\n'\"\\033?""?/\\\\" RQ, LQ "a:b" RQ, LQ "a\\\\b" RQ }, + { LQ RQ, LQ "\\0001\\0" RQ, 11, LQ "simple" RQ, + LQ " \\t\\n'\"\\033?""?/\\\\" RQ, LQ "a\\:b" RQ, LQ "a\\\\b" RQ } } +}; +#endif /* ENABLE_NLS */ + +static void +compare (char const *a, size_t la, char const *b, size_t lb) +{ + ASSERT (la == lb); + ASSERT (memcmp (a, b, la) == 0); + ASSERT (b[lb] == '\0'); +} + +static void +compare_strings (char *(func) (char const *, size_t *), + struct result_strings *results) +{ + size_t len; + char *p; + + len = 0; + p = func (inputs.str1, &len); + compare (results->str1, strlen (results->str1), p, len); + + len = inputs.len2; + p = func (inputs.str2, &len); + compare (results->str2, results->len2, p, len); + + len = SIZE_MAX; + p = func (inputs.str3, &len); + compare (results->str3, strlen (results->str3), p, len); + + len = strlen (inputs.str4); + p = func (inputs.str4, &len); + compare (results->str4, strlen (results->str4), p, len); + + len = SIZE_MAX; + p = func (inputs.str5, &len); + compare (results->str5, strlen (results->str5), p, len); + + len = strlen (inputs.str6); + p = func (inputs.str6, &len); + compare (results->str6, strlen (results->str6), p, len); +} + +static char * +use_quotearg_buffer (const char *str, size_t *len) +{ + static char buf[100]; + size_t size; + memset (buf, 0xa5, 100); + size = quotearg_buffer (buf, 100, str, *len, NULL); + *len = size; + ASSERT ((unsigned char) buf[size + 1] == 0xa5); + return buf; +} + +static char * +use_quotearg (const char *str, size_t *len) +{ + char *p = *len == SIZE_MAX ? quotearg (str) : quotearg_mem (str, *len); + *len = strlen (p); + return p; +} + +static char * +use_quotearg_colon (const char *str, size_t *len) +{ + char *p = (*len == SIZE_MAX ? quotearg_colon (str) + : quotearg_colon_mem (str, *len)); + *len = strlen (p); + return p; +} + +#if ENABLE_NLS +/* True if the locale should be faked. */ +static bool fake_locale; + +/* A replacement gettext that allows testing of locale quotes without + requiring a locale. */ +char * +gettext (char const *str) +{ + if (fake_locale) + { + static char lq[] = LQ; + static char rq[] = RQ; + if (strcmp (str, "`") == 0) + return lq; + if (strcmp (str, "'") == 0) + return rq; + } + return (char *) str; +} + +char * +dgettext (char const *d, char const *str) +{ + return gettext (str); +} + +char * +dcgettext (char const *d, char const *str, int c) +{ + return gettext (str); +} +#endif /* ENABLE_NLS */ + +int +main () +{ + int i; + + /* This program is hard-wired to the C locale since it does not call + setlocale. */ + ASSERT (!isprint ('\033')); + for (i = literal_quoting_style; i <= clocale_quoting_style; i++) + { + set_quoting_style (NULL, i); + compare_strings (use_quotearg_buffer, &results_g[i].group1); + compare_strings (use_quotearg, &results_g[i].group2); + compare_strings (use_quotearg_colon, &results_g[i].group3); + } + + set_quoting_style (NULL, literal_quoting_style); + ASSERT (set_quoting_flags (NULL, QA_ELIDE_NULL_BYTES) == 0); + compare_strings (use_quotearg_buffer, &flag_results[0].group1); + compare_strings (use_quotearg, &flag_results[0].group2); + compare_strings (use_quotearg_colon, &flag_results[0].group3); + + set_quoting_style (NULL, c_quoting_style); + ASSERT (set_quoting_flags (NULL, QA_ELIDE_OUTER_QUOTES) + == QA_ELIDE_NULL_BYTES); + compare_strings (use_quotearg_buffer, &flag_results[1].group1); + compare_strings (use_quotearg, &flag_results[1].group2); + compare_strings (use_quotearg_colon, &flag_results[1].group3); + + ASSERT (set_quoting_flags (NULL, QA_SPLIT_TRIGRAPHS) + == QA_ELIDE_OUTER_QUOTES); + compare_strings (use_quotearg_buffer, &flag_results[2].group1); + compare_strings (use_quotearg, &flag_results[2].group2); + compare_strings (use_quotearg_colon, &flag_results[2].group3); + + ASSERT (set_quoting_flags (NULL, 0) == QA_SPLIT_TRIGRAPHS); + +#if ENABLE_NLS + /* Rather than change locales, and require a .gmo file with + translations for "`" and "'" that match our expectations, we + merely override the gettext function to satisfy the link + dependencies of quotearg.c. */ + fake_locale = true; + + set_quoting_style (NULL, locale_quoting_style); + compare_strings (use_quotearg_buffer, &locale_results[0].group1); + compare_strings (use_quotearg, &locale_results[0].group2); + compare_strings (use_quotearg_colon, &locale_results[0].group3); + + set_quoting_style (NULL, clocale_quoting_style); + compare_strings (use_quotearg_buffer, &locale_results[1].group1); + compare_strings (use_quotearg, &locale_results[1].group2); + compare_strings (use_quotearg_colon, &locale_results[1].group3); +#endif /* ENABLE_NLS */ + + quotearg_free (); + return 0; +} diff -ruNp m4-1.4.10/tests/test-signbit.c m4-1.4.11/tests/test-signbit.c --- m4-1.4.10/tests/test-signbit.c 2007-05-30 19:31:10.000000000 -0600 +++ m4-1.4.11/tests/test-signbit.c 2008-03-30 16:46:08.000000000 -0600 @@ -1,10 +1,10 @@ /* Test of signbit() substitute. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2008 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -12,8 +12,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ @@ -50,6 +49,12 @@ test_signbitf () ASSERT (signbit (-2.718f)); ASSERT (signbit (-2.718e30f)); ASSERT (signbit (-2.718e-30f)); + /* Zeros. */ + ASSERT (!signbit (0.0f)); + if (1.0f / -zerof < 0) + ASSERT (signbit (-0.0f)); + else + ASSERT (!signbit (-0.0f)); /* Infinite values. */ ASSERT (!signbit (1.0f / 0.0f)); ASSERT (signbit (-1.0f / 0.0f)); @@ -89,6 +94,12 @@ test_signbitd () ASSERT (signbit (-2.718)); ASSERT (signbit (-2.718e30)); ASSERT (signbit (-2.718e-30)); + /* Zeros. */ + ASSERT (!signbit (0.0)); + if (1.0 / -zerod < 0) + ASSERT (signbit (-0.0)); + else + ASSERT (!signbit (-0.0)); /* Infinite values. */ ASSERT (!signbit (1.0 / 0.0)); ASSERT (signbit (-1.0 / 0.0)); @@ -126,6 +137,12 @@ test_signbitl () ASSERT (signbit (-2.718L)); ASSERT (signbit (-2.718e30L)); ASSERT (signbit (-2.718e-30L)); + /* Zeros. */ + ASSERT (!signbit (0.0L)); + if (1.0L / -zerol < 0) + ASSERT (signbit (-0.0L)); + else + ASSERT (!signbit (-0.0L)); /* Infinite values. */ ASSERT (!signbit (1.0L / 0.0L)); ASSERT (signbit (-1.0L / 0.0L)); diff -ruNp m4-1.4.10/tests/test-stdbool.c m4-1.4.11/tests/test-stdbool.c --- m4-1.4.10/tests/test-stdbool.c 2007-05-30 19:31:10.000000000 -0600 +++ m4-1.4.11/tests/test-stdbool.c 2007-10-09 06:17:05.000000000 -0600 @@ -1,10 +1,10 @@ /* Test of <stdbool.h> substitute. Copyright (C) 2002-2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -12,8 +12,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ diff -ruNp m4-1.4.10/tests/test-stdint.c m4-1.4.11/tests/test-stdint.c --- m4-1.4.10/tests/test-stdint.c 2007-05-30 19:31:10.000000000 -0600 +++ m4-1.4.11/tests/test-stdint.c 2007-10-09 06:17:05.000000000 -0600 @@ -1,10 +1,10 @@ /* Test of <stdint.h> substitute. Copyright (C) 2006, 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -12,8 +12,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2006. */ diff -ruNp m4-1.4.10/tests/test-stdio.c m4-1.4.11/tests/test-stdio.c --- m4-1.4.10/tests/test-stdio.c 2007-05-30 19:31:11.000000000 -0600 +++ m4-1.4.11/tests/test-stdio.c 2007-10-09 06:17:05.000000000 -0600 @@ -1,10 +1,10 @@ /* Test of <stdio.h> substitute. Copyright (C) 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -12,8 +12,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ diff -ruNp m4-1.4.10/tests/test-stdlib.c m4-1.4.11/tests/test-stdlib.c --- m4-1.4.10/tests/test-stdlib.c 2007-05-30 19:31:11.000000000 -0600 +++ m4-1.4.11/tests/test-stdlib.c 2007-10-09 06:17:05.000000000 -0600 @@ -1,10 +1,10 @@ /* Test of <stdlib.h> substitute. Copyright (C) 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -12,8 +12,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ diff -ruNp m4-1.4.10/tests/test-strerror.c m4-1.4.11/tests/test-strerror.c --- m4-1.4.10/tests/test-strerror.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/tests/test-strerror.c 2007-09-25 21:03:49.000000000 -0600 @@ -0,0 +1,55 @@ +/* Test of strerror() function. + Copyright (C) 2007 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, 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, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Eric Blake <ebb9@byu.net>, 2007. */ + +#include <config.h> + +#include <errno.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) + +int +main (int argc, char **argv) +{ + char *str; + str = strerror (EACCES); + ASSERT (str); + ASSERT (*str); + + str = strerror (0); + ASSERT (str); + ASSERT (*str); + + str = strerror (-3); + ASSERT (str); + ASSERT (*str); + + return 0; +} diff -ruNp m4-1.4.10/tests/test-string.c m4-1.4.11/tests/test-string.c --- m4-1.4.10/tests/test-string.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/tests/test-string.c 2007-10-09 06:17:06.000000000 -0600 @@ -0,0 +1,27 @@ +/* Test of <string.h> substitute. + Copyright (C) 2007 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/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2007. */ + +#include <config.h> + +#include <string.h> + +int +main () +{ + return 0; +} diff -ruNp m4-1.4.10/tests/test-strstr.c m4-1.4.11/tests/test-strstr.c --- m4-1.4.10/tests/test-strstr.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/tests/test-strstr.c 2008-04-01 18:53:58.000000000 -0600 @@ -0,0 +1,153 @@ +/* + * Copyright (C) 2004, 2007, 2008 Free Software Foundation + * Written by Bruno Haible and Eric Blake + * + * 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/>. */ + +#include <config.h> + +#include <string.h> + +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) + +int +main (int argc, char *argv[]) +{ +#if HAVE_DECL_ALARM + /* Declare failure if test takes too long, by using default abort + caused by SIGALRM. All known platforms that lack alarm also have + a quadratic strstr, and the replacement strstr is known to not + take too long. */ + alarm (50); +#endif + + { + const char input[] = "foo"; + const char *result = strstr (input, ""); + ASSERT (result == input); + } + + { + const char input[] = "foo"; + const char *result = strstr (input, "o"); + ASSERT (result == input + 1); + } + + { + const char input[] = "ABC ABCDAB ABCDABCDABDE"; + const char *result = strstr (input, "ABCDABD"); + ASSERT (result == input + 15); + } + + { + const char input[] = "ABC ABCDAB ABCDABCDABDE"; + const char *result = strstr (input, "ABCDABE"); + ASSERT (result == NULL); + } + + { + const char input[] = "ABC ABCDAB ABCDABCDABDE"; + const char *result = strstr (input, "ABCDABCD"); + ASSERT (result == input + 11); + } + + /* Check that a very long haystack is handled quickly if the needle is + short and occurs near the beginning. */ + { + size_t repeat = 10000; + size_t m = 1000000; + char *needle = + "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; + char *haystack = (char *) malloc (m + 1); + if (haystack != NULL) + { + memset (haystack, 'A', m); + haystack[0] = 'B'; + haystack[m] = '\0'; + + for (; repeat > 0; repeat--) + { + ASSERT (strstr (haystack, needle) == haystack + 1); + } + + free (haystack); + } + } + + /* Check that a very long needle is discarded quickly if the haystack is + short. */ + { + size_t repeat = 10000; + size_t m = 1000000; + char *haystack = + "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + "ABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABAB"; + char *needle = (char *) malloc (m + 1); + if (needle != NULL) + { + memset (needle, 'A', m); + needle[m] = '\0'; + + for (; repeat > 0; repeat--) + { + ASSERT (strstr (haystack, needle) == NULL); + } + + free (needle); + } + } + + /* Check that the asymptotic worst-case complexity is not quadratic. */ + { + size_t m = 1000000; + char *haystack = (char *) malloc (2 * m + 2); + char *needle = (char *) malloc (m + 2); + if (haystack != NULL && needle != NULL) + { + const char *result; + + memset (haystack, 'A', 2 * m); + haystack[2 * m] = 'B'; + haystack[2 * m + 1] = '\0'; + + memset (needle, 'A', m); + needle[m] = 'B'; + needle[m + 1] = '\0'; + + result = strstr (haystack, needle); + ASSERT (result == haystack + m); + } + free (needle); + free (haystack); + } + + /* Sublinear speed is only possible in memmem; strstr must examine + every character of haystack to find its length. */ + + return 0; +} diff -ruNp m4-1.4.10/tests/test-strtod.c m4-1.4.11/tests/test-strtod.c --- m4-1.4.10/tests/test-strtod.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/tests/test-strtod.c 2008-04-01 18:54:43.000000000 -0600 @@ -0,0 +1,917 @@ +/* + * Copyright (C) 2008 Free Software Foundation + * Written by Eric Blake + * + * 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/>. */ + +#include <config.h> + +#include <stdlib.h> + +#include <errno.h> +#include <float.h> +#include <math.h> +#include <stdio.h> +#include <string.h> + +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + /* FIXME abort ();*/status = 1; \ + } \ + } \ + while (0) + +int +main () +{ + int status = 0; + /* Subject sequence empty or invalid. */ + { + const char input[] = ""; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == 0.0); + ASSERT (!signbit (result)); + ASSERT (ptr == input); + ASSERT (errno == 0 || errno == EINVAL); + } + { + const char input[] = " "; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == 0.0); + ASSERT (!signbit (result)); + ASSERT (ptr == input); + ASSERT (errno == 0 || errno == EINVAL); + } + { + const char input[] = " +"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == 0.0); + ASSERT (!signbit (result)); + ASSERT (ptr == input); + ASSERT (errno == 0 || errno == EINVAL); + } + { + const char input[] = " ."; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == 0.0); + ASSERT (!signbit (result)); + ASSERT (ptr == input); + ASSERT (errno == 0 || errno == EINVAL); + } + { + const char input[] = " .e0"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == 0.0); + ASSERT (!signbit (result)); + ASSERT (ptr == input); /* IRIX 6.5, OSF/1 5.1 */ + ASSERT (errno == 0 || errno == EINVAL); + } + { + const char input[] = " +.e-0"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == 0.0); + ASSERT (!signbit (result)); + ASSERT (ptr == input); /* IRIX 6.5, OSF/1 5.1 */ + ASSERT (errno == 0 || errno == EINVAL); + } + { + const char input[] = " in"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == 0.0); + ASSERT (!signbit (result)); + ASSERT (ptr == input); + ASSERT (errno == 0 || errno == EINVAL); + } + { + const char input[] = " na"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == 0.0); + ASSERT (!signbit (result)); + ASSERT (ptr == input); + ASSERT (errno == 0 || errno == EINVAL); + } + + /* Simple floating point values. */ + { + const char input[] = "1"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == 1.0); + ASSERT (ptr == input + 1); + ASSERT (errno == 0); + } + { + const char input[] = "1."; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == 1.0); + ASSERT (ptr == input + 2); + ASSERT (errno == 0); + } + { + const char input[] = ".5"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + /* FIXME - gnulib's version is rather inaccurate. It would be + nice to guarantee an exact result, but for now, we settle for a + 1-ulp error. */ + ASSERT (abs (result - 0.5) < DBL_EPSILON); + ASSERT (ptr == input + 2); + ASSERT (errno == 0); + } + { + const char input[] = " 1"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == 1.0); + ASSERT (ptr == input + 2); + ASSERT (errno == 0); + } + { + const char input[] = "+1"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == 1.0); + ASSERT (ptr == input + 2); + ASSERT (errno == 0); + } + { + const char input[] = "-1"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == -1.0); + ASSERT (ptr == input + 2); + ASSERT (errno == 0); + } + { + const char input[] = "1e0"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == 1.0); + ASSERT (ptr == input + 3); + ASSERT (errno == 0); + } + { + const char input[] = "1e+0"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == 1.0); + ASSERT (ptr == input + 4); + ASSERT (errno == 0); + } + { + const char input[] = "1e-0"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == 1.0); + ASSERT (ptr == input + 4); + ASSERT (errno == 0); + } + { + const char input[] = "1e1"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == 10.0); + ASSERT (ptr == input + 3); + ASSERT (errno == 0); + } + { + const char input[] = "5e-1"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + /* FIXME - gnulib's version is rather inaccurate. It would be + nice to guarantee an exact result, but for now, we settle for a + 1-ulp error. */ + ASSERT (abs (result - 0.5) < DBL_EPSILON); + ASSERT (ptr == input + 4); + ASSERT (errno == 0); + } + + /* Zero. */ + { + const char input[] = "0"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == 0.0); + ASSERT (!signbit (result)); + ASSERT (ptr == input + 1); + ASSERT (errno == 0); + } + { + const char input[] = ".0"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == 0.0); + ASSERT (!signbit (result)); + ASSERT (ptr == input + 2); + ASSERT (errno == 0); + } + { + const char input[] = "0e0"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == 0.0); + ASSERT (!signbit (result)); + ASSERT (ptr == input + 3); + ASSERT (errno == 0); + } + { + const char input[] = "0e+9999999"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == 0.0); + ASSERT (!signbit (result)); + ASSERT (ptr == input + 10); + ASSERT (errno == 0); + } + { + const char input[] = "0e-9999999"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == 0.0); + ASSERT (!signbit (result)); + ASSERT (ptr == input + 10); + ASSERT (errno == 0); + } + { + const char input[] = "-0"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == 0.0); + ASSERT (!!signbit (result) == !!signbit (-0.0)); /* IRIX 6.5, OSF/1 4.0 */ + ASSERT (ptr == input + 2); + ASSERT (errno == 0); + } + + /* Suffixes. */ + { + const char input[] = "1f"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == 1.0); + ASSERT (ptr == input + 1); + ASSERT (errno == 0); + } + { + const char input[] = "1.f"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == 1.0); + ASSERT (ptr == input + 2); + ASSERT (errno == 0); + } + { + const char input[] = "1e"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == 1.0); + ASSERT (ptr == input + 1); + ASSERT (errno == 0); + } + { + const char input[] = "1e+"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == 1.0); + ASSERT (ptr == input + 1); + ASSERT (errno == 0); + } + { + const char input[] = "1e-"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == 1.0); + ASSERT (ptr == input + 1); + ASSERT (errno == 0); + } + { + const char input[] = "1E 2"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == 1.0); /* HP-UX 11.11, IRIX 6.5, OSF/1 4.0 */ + ASSERT (ptr == input + 1); /* HP-UX 11.11, IRIX 6.5 */ + ASSERT (errno == 0); + } + { + const char input[] = "0x"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == 0.0); + ASSERT (!signbit (result)); + ASSERT (ptr == input + 1); /* glibc-2.3.6, MacOS X 10.3, FreeBSD 6.2 */ + ASSERT (errno == 0); + } + { + const char input[] = "00x1"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == 0.0); + ASSERT (!signbit (result)); + ASSERT (ptr == input + 2); + ASSERT (errno == 0); + } + { + const char input[] = "-0x"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == 0.0); + ASSERT (!!signbit (result) == !!signbit (-0.0)); /* MacOS X 10.3, FreeBSD 6.2, IRIX 6.5, OSF/1 4.0 */ + ASSERT (ptr == input + 2); /* glibc-2.3.6, MacOS X 10.3, FreeBSD 6.2 */ + ASSERT (errno == 0); + } + { + const char input[] = "0xg"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == 0.0); + ASSERT (!signbit (result)); + ASSERT (ptr == input + 1); /* glibc-2.3.6, MacOS X 10.3, FreeBSD 6.2 */ + ASSERT (errno == 0); + } + { + const char input[] = "0xp"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == 0.0); + ASSERT (!signbit (result)); + ASSERT (ptr == input + 1); /* glibc-2.3.6, MacOS X 10.3, FreeBSD 6.2 */ + ASSERT (errno == 0); + } + { + const char input[] = "0x."; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == 0.0); + ASSERT (!signbit (result)); + ASSERT (ptr == input + 1); /* glibc-2.3.6, MacOS X 10.3, FreeBSD 6.2 */ + ASSERT (errno == 0); + } + { + const char input[] = "0xp+"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == 0.0); + ASSERT (!signbit (result)); + ASSERT (ptr == input + 1); /* glibc-2.3.6, MacOS X 10.3, FreeBSD 6.2 */ + ASSERT (errno == 0); + } + { + const char input[] = "0xp+1"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == 0.0); + ASSERT (!signbit (result)); + ASSERT (ptr == input + 1); /* glibc-2.3.6, MacOS X 10.3, FreeBSD 6.2 */ + ASSERT (errno == 0); + } + { + const char input[] = "0x.p+1"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == 0.0); + ASSERT (!signbit (result)); + ASSERT (ptr == input + 1); /* glibc-2.3.6, MacOS X 10.3, FreeBSD 6.2 */ + ASSERT (errno == 0); + } + { + const char input[] = "1p+1"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == 1.0); + ASSERT (ptr == input + 1); + ASSERT (errno == 0); + } + + /* Overflow/underflow. */ + { + const char input[] = "1E1000000"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == HUGE_VAL); + ASSERT (ptr == input + 9); /* OSF/1 5.1 */ + ASSERT (errno == ERANGE); + } + { + const char input[] = "-1E1000000"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == -HUGE_VAL); + ASSERT (ptr == input + 10); + ASSERT (errno == ERANGE); + } + { + const char input[] = "1E-100000"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (0.0 <= result && result <= DBL_MIN); + ASSERT (!signbit (result)); + ASSERT (ptr == input + 9); + ASSERT (errno == ERANGE); + } + { + const char input[] = "-1E-100000"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (-DBL_MIN <= result && result <= 0.0); +#if 0 + /* FIXME - this is glibc bug 5995; POSIX allows returning positive + 0 on negative underflow, even though quality of implementation + demands preserving the sign. Disable this test until fixed + glibc is more prevalent. */ + ASSERT (!!signbit (result) == !!signbit (-0.0)); /* glibc-2.3.6, mingw */ +#endif + ASSERT (ptr == input + 10); + ASSERT (errno == ERANGE); + } + + /* Infinity. */ + { + const char input[] = "iNf"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == HUGE_VAL); /* OpenBSD 4.0, IRIX 6.5, OSF/1 5.1, mingw */ + ASSERT (ptr == input + 3); /* OpenBSD 4.0, HP-UX 11.00, IRIX 6.5, OSF/1 5.1, Solaris 9, mingw */ + ASSERT (errno == 0); /* HP-UX 11.11, OSF/1 4.0 */ + } + { + const char input[] = "-InF"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == -HUGE_VAL); /* OpenBSD 4.0, IRIX 6.5, OSF/1 5.1, mingw */ + ASSERT (ptr == input + 4); /* OpenBSD 4.0, HP-UX 11.00, IRIX 6.5, OSF/1 4.0, Solaris 9, mingw */ + ASSERT (errno == 0); /* HP-UX 11.11, OSF/1 4.0 */ + } + { + const char input[] = "infinite"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == HUGE_VAL); /* OpenBSD 4.0, HP-UX 11.11, IRIX 6.5, OSF/1 5.1, mingw */ + ASSERT (ptr == input + 3); /* OpenBSD 4.0, HP-UX 11.11, IRIX 6.5, OSF/1 5.1, mingw */ + ASSERT (errno == 0); /* OSF/1 4.0 */ + } + { + const char input[] = "infinitY"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == HUGE_VAL); /* OpenBSD 4.0, IRIX 6.5, OSF/1 5.1, mingw */ + ASSERT (ptr == input + 8); /* OpenBSD 4.0, HP-UX 11.00, IRIX 6.5, OSF/1 5.1, Solaris 9, mingw */ + ASSERT (errno == 0); /* HP-UX 11.11, OSF/1 4.0 */ + } + { + const char input[] = "infinitY."; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == HUGE_VAL); /* OpenBSD 4.0, HP-UX 11.11, IRIX 6.5, OSF/1 5.1, mingw */ + ASSERT (ptr == input + 8); /* OpenBSD 4.0, HP-UX 11.11, IRIX 6.5, OSF/1 5.1, mingw */ + ASSERT (errno == 0); /* OSF/1 4.0 */ + } + + /* NaN. Some processors set the sign bit of the default NaN, so all + we check is that using a sign changes the result. */ + { + const char input[] = "-nan"; + char *ptr1; + char *ptr2; + double result1; + double result2; + errno = 0; + result1 = strtod (input, &ptr1); + result2 = strtod (input + 1, &ptr2); +#if 1 /* All known CPUs support NaNs. */ + ASSERT (isnan (result1)); /* OpenBSD 4.0, IRIX 6.5, OSF/1 5.1, mingw */ + ASSERT (isnan (result2)); /* OpenBSD 4.0, IRIX 6.5, OSF/1 5.1, mingw */ +# if 0 + /* Sign bits of NaN is a portability sticking point, not worth + worrying about. */ + ASSERT (!!signbit (result1) != !!signbit (result2)); /* glibc-2.3.6, IRIX 6.5, OSF/1 5.1, mingw */ +# endif + ASSERT (ptr1 == input + 4); /* OpenBSD 4.0, IRIX 6.5, OSF/1 5.1, Solaris 2.5.1, mingw */ + ASSERT (ptr2 == input + 4); /* OpenBSD 4.0, IRIX 6.5, OSF/1 5.1, Solaris 2.5.1, mingw */ + ASSERT (errno == 0); /* HP-UX 11.11 */ +#else + ASSERT (result1 == 0.0); + ASSERT (result2 == 0.0); + ASSERT (!signbit (result1)); + ASSERT (!signbit (result2)); + ASSERT (ptr1 == input); + ASSERT (ptr2 == input + 1); + ASSERT (errno == 0 || errno == EINVAL); +#endif + } + { + const char input[] = "+nan("; + char *ptr1; + char *ptr2; + double result1; + double result2; + errno = 0; + result1 = strtod (input, &ptr1); + result2 = strtod (input + 1, &ptr2); +#if 1 /* All known CPUs support NaNs. */ + ASSERT (isnan (result1)); /* OpenBSD 4.0, HP-UX 11.11, IRIX 6.5, OSF/1 5.1, mingw */ + ASSERT (isnan (result2)); /* OpenBSD 4.0, HP-UX 11.11, IRIX 6.5, OSF/1 5.1, mingw */ + ASSERT (!!signbit (result1) == !!signbit (result2)); + ASSERT (ptr1 == input + 4); /* OpenBSD 4.0, HP-UX 11.11, IRIX 6.5, OSF/1 5.1, Solaris 2.5.1, mingw */ + ASSERT (ptr2 == input + 4); /* OpenBSD 4.0, HP-UX 11.11, IRIX 6.5, OSF/1 5.1, Solaris 2.5.1, mingw */ + ASSERT (errno == 0); +#else + ASSERT (result1 == 0.0); + ASSERT (result2 == 0.0); + ASSERT (!signbit (result1)); + ASSERT (!signbit (result2)); + ASSERT (ptr1 == input); + ASSERT (ptr2 == input + 1); + ASSERT (errno == 0 || errno == EINVAL); +#endif + } + { + const char input[] = "-nan()"; + char *ptr1; + char *ptr2; + double result1; + double result2; + errno = 0; + result1 = strtod (input, &ptr1); + result2 = strtod (input + 1, &ptr2); +#if 1 /* All known CPUs support NaNs. */ + ASSERT (isnan (result1)); /* OpenBSD 4.0, HP-UX 11.11, IRIX 6.5, OSF/1 5.1, mingw */ + ASSERT (isnan (result2)); /* OpenBSD 4.0, HP-UX 11.11, IRIX 6.5, OSF/1 5.1, mingw */ +# if 0 + /* Sign bits of NaN is a portability sticking point, not worth + worrying about. */ + ASSERT (!!signbit (result1) != !!signbit (result2)); /* glibc-2.3.6, IRIX 6.5, OSF/1 5.1, mingw */ +# endif + ASSERT (ptr1 == input + 6); /* glibc-2.3.6, MacOS X 10.3, FreeBSD 6.2, OpenBSD 4.0, AIX 5.1, HP-UX 11.11, IRIX 6.5, OSF/1 5.1, mingw */ + ASSERT (ptr2 == input + 6); /* glibc-2.3.6, MacOS X 10.3, FreeBSD 6.2, OpenBSD 4.0, AIX 5.1, HP-UX 11.11, IRIX 6.5, OSF/1 5.1, mingw */ + ASSERT (errno == 0); +#else + ASSERT (result1 == 0.0); + ASSERT (result2 == 0.0); + ASSERT (!signbit (result1)); + ASSERT (!signbit (result2)); + ASSERT (ptr1 == input); + ASSERT (ptr2 == input + 1); + ASSERT (errno == 0 || errno == EINVAL); +#endif + } + { + const char input[] = " nan()."; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); +#if 1 /* All known CPUs support NaNs. */ + ASSERT (isnan (result)); /* OpenBSD 4.0, HP-UX 11.11, IRIX 6.5, OSF/1 5.1, mingw */ + ASSERT (ptr == input + 6); /* glibc-2.3.6, MacOS X 10.3, FreeBSD 6.2, OpenBSD 4.0, AIX 5.1, HP-UX 11.11, IRIX 6.5, OSF/1 5.1, mingw */ + ASSERT (errno == 0); +#else + ASSERT (result == 0.0); + ASSERT (!signbit (result)); + ASSERT (ptr == input); + ASSERT (errno == 0 || errno == EINVAL); +#endif + } + { + /* The behavior of nan(0) is implementation-defined, but all + implementations we know of which handle optional + n-char-sequences handle nan(0) the same as nan(). */ + const char input[] = "-nan(0)."; + char *ptr1; + char *ptr2; + double result1; + double result2; + errno = 0; + result1 = strtod (input, &ptr1); + result2 = strtod (input + 1, &ptr2); +#if 1 /* All known CPUs support NaNs. */ + ASSERT (isnan (result1)); /* OpenBSD 4.0, HP-UX 11.11, IRIX 6.5, OSF/1 5.1, mingw */ + ASSERT (isnan (result2)); /* OpenBSD 4.0, HP-UX 11.11, IRIX 6.5, OSF/1 5.1, mingw */ +# if 0 + /* Sign bits of NaN is a portability sticking point, not worth + worrying about. */ + ASSERT (!!signbit (result1) != !!signbit (result2)); /* glibc-2.3.6, IRIX 6.5, OSF/1 5.1, mingw */ +# endif + ASSERT (ptr1 == input + 7); /* glibc-2.3.6, OpenBSD 4.0, AIX 5.1, HP-UX 11.11, IRIX 6.5, OSF/1 5.1, mingw */ + ASSERT (ptr2 == input + 7); /* glibc-2.3.6, OpenBSD 4.0, AIX 5.1, HP-UX 11.11, IRIX 6.5, OSF/1 5.1, mingw */ + ASSERT (errno == 0); +#else + ASSERT (result1 == 0.0); + ASSERT (result2 == 0.0); + ASSERT (!signbit (result1)); + ASSERT (!signbit (result2)); + ASSERT (ptr1 == input); + ASSERT (ptr2 == input + 1); + ASSERT (errno == 0 || errno == EINVAL); +#endif + } + + /* Hex. */ + { + const char input[] = "0xa"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == 10.0); /* NetBSD 3.0, OpenBSD 4.0, AIX 5.1, HP-UX 11.11, IRIX 6.5, OSF/1 5.1, Solaris 10, mingw */ + ASSERT (ptr == input + 3); /* NetBSD 3.0, OpenBSD 4.0, AIX 5.1, HP-UX 11.11, IRIX 6.5, OSF/1 5.1, Solaris 10, mingw */ + ASSERT (errno == 0); + } + { + const char input[] = "0XA"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == 10.0); /* NetBSD 3.0, OpenBSD 4.0, AIX 5.1, HP-UX 11.11, IRIX 6.5, OSF/1 5.1, Solaris 10, mingw */ + ASSERT (ptr == input + 3); /* NetBSD 3.0, OpenBSD 4.0, AIX 5.1, HP-UX 11.11, IRIX 6.5, OSF/1 5.1, Solaris 10, mingw */ + ASSERT (errno == 0); + } + { + const char input[] = "0x1p"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == 1.0); /* NetBSD 3.0, OpenBSD 4.0, AIX 5.1, HP-UX 11.11, IRIX 6.5, OSF/1 5.1, Solaris 10, mingw */ + ASSERT (ptr == input + 3); /* NetBSD 3.0, OpenBSD 4.0, AIX 5.1, HP-UX 11.11, IRIX 6.5, OSF/1 5.1, Solaris 10, mingw */ + ASSERT (errno == 0); + } + { + const char input[] = "0x1p+"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == 1.0); /* NetBSD 3.0, OpenBSD 4.0, AIX 5.1, HP-UX 11.11, IRIX 6.5, OSF/1 5.1, Solaris 10, mingw */ + ASSERT (ptr == input + 3); /* NetBSD 3.0, OpenBSD 4.0, AIX 5.1, HP-UX 11.11, IRIX 6.5, OSF/1 5.1, Solaris 10, mingw */ + ASSERT (errno == 0); + } + { + const char input[] = "0x1p+1"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == 2.0); /* NetBSD 3.0, OpenBSD 4.0, AIX 5.1, HP-UX 11.11, IRIX 6.5, OSF/1 5.1, Solaris 10, mingw */ + ASSERT (ptr == input + 6); /* NetBSD 3.0, OpenBSD 4.0, AIX 5.1, HP-UX 11.11, IRIX 6.5, OSF/1 5.1, Solaris 10, mingw */ + ASSERT (errno == 0); + } + { + const char input[] = "0x1p+1a"; + char *ptr; + double result; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == 2.0); /* NetBSD 3.0, OpenBSD 4.0, AIX 5.1, HP-UX 11.11, IRIX 6.5, OSF/1 5.1, Solaris 10, mingw */ + ASSERT (ptr == input + 6); /* NetBSD 3.0, OpenBSD 4.0, AIX 5.1, HP-UX 11.11, IRIX 6.5, OSF/1 5.1, Solaris 10, mingw */ + ASSERT (errno == 0); + } + + /* Large buffers. */ + { + size_t m = 1000000; + char *input = malloc (m + 1); + if (input) + { + char *ptr; + double result; + memset (input, '\t', m - 1); + input[m - 1] = '1'; + input[m] = '\0'; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == 1.0); + ASSERT (ptr == input + m); + ASSERT (errno == 0); + } + free (input); + } + { + size_t m = 1000000; + char *input = malloc (m + 1); + if (input) + { + char *ptr; + double result; + memset (input, '0', m - 1); + input[m - 1] = '1'; + input[m] = '\0'; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == 1.0); + ASSERT (ptr == input + m); + ASSERT (errno == 0); + } + free (input); + } +#if 0 + /* Newlib has an artificial limit of 20000 for the exponent. TODO - + gnulib should fix this. */ + { + size_t m = 1000000; + char *input = malloc (m + 1); + if (input) + { + char *ptr; + double result; + input[0] = '.'; + memset (input + 1, '0', m - 10); + input[m - 9] = '1'; + input[m - 8] = 'e'; + input[m - 7] = '+'; + input[m - 6] = '9'; + input[m - 5] = '9'; + input[m - 4] = '9'; + input[m - 3] = '9'; + input[m - 2] = '9'; + input[m - 1] = '1'; + input[m] = '\0'; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == 1.0); /* MacOS X 10.3, FreeBSD 6.2, NetBSD 3.0, OpenBSD 4.0, IRIX 6.5, OSF/1 5.1, mingw */ + ASSERT (ptr == input + m); /* OSF/1 5.1 */ + ASSERT (errno == 0); /* MacOS X 10.3, FreeBSD 6.2, NetBSD 3.0, OpenBSD 4.0, IRIX 6.5, OSF/1 5.1, mingw */ + } + free (input); + } + { + size_t m = 1000000; + char *input = malloc (m + 1); + if (input) + { + char *ptr; + double result; + input[0] = '1'; + memset (input + 1, '0', m - 9); + input[m - 8] = 'e'; + input[m - 7] = '-'; + input[m - 6] = '9'; + input[m - 5] = '9'; + input[m - 4] = '9'; + input[m - 3] = '9'; + input[m - 2] = '9'; + input[m - 1] = '1'; + input[m] = '\0'; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == 1.0); /* MacOS X 10.3, FreeBSD 6.2, NetBSD 3.0, OpenBSD 4.0, IRIX 6.5, OSF/1 5.1, mingw */ + ASSERT (ptr == input + m); + ASSERT (errno == 0); /* MacOS X 10.3, FreeBSD 6.2, NetBSD 3.0, OpenBSD 4.0, IRIX 6.5, OSF/1 5.1, mingw */ + } + free (input); + } +#endif + { + size_t m = 1000000; + char *input = malloc (m + 1); + if (input) + { + char *ptr; + double result; + input[0] = '-'; + input[1] = '0'; + input[2] = 'e'; + input[3] = '1'; + memset (input + 4, '0', m - 3); + input[m] = '\0'; + errno = 0; + result = strtod (input, &ptr); + ASSERT (result == 0.0); + ASSERT (!!signbit (result) == !!signbit (-0.0)); /* IRIX 6.5, OSF/1 4.0 */ + ASSERT (ptr == input + m); + ASSERT (errno == 0); + } + free (input); + } + + /* Rounding. */ + /* TODO - is it worth some tests of rounding for typical IEEE corner + cases, such as .5 ULP rounding up to the smallest denormal and + not causing underflow, or DBL_MIN - .5 ULP not causing an + infinite loop? */ + + return status; +} diff -ruNp m4-1.4.10/tests/test-sys_stat.c m4-1.4.11/tests/test-sys_stat.c --- m4-1.4.10/tests/test-sys_stat.c 2007-05-30 19:31:11.000000000 -0600 +++ m4-1.4.11/tests/test-sys_stat.c 2007-10-09 06:17:06.000000000 -0600 @@ -1,10 +1,10 @@ /* Test of <sys/stat.h> substitute. Copyright (C) 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -12,8 +12,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ diff -ruNp m4-1.4.10/tests/test-sys_time.c m4-1.4.11/tests/test-sys_time.c --- m4-1.4.10/tests/test-sys_time.c 2007-05-30 19:31:11.000000000 -0600 +++ m4-1.4.11/tests/test-sys_time.c 2007-10-09 06:17:06.000000000 -0600 @@ -1,10 +1,10 @@ /* Test of <sys/time.h> substitute. Copyright (C) 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -12,8 +12,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ diff -ruNp m4-1.4.10/tests/test-unistd.c m4-1.4.11/tests/test-unistd.c --- m4-1.4.10/tests/test-unistd.c 2007-07-05 05:48:59.000000000 -0600 +++ m4-1.4.11/tests/test-unistd.c 2007-10-09 06:17:06.000000000 -0600 @@ -1,10 +1,10 @@ /* Test of <unistd.h> substitute. Copyright (C) 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -12,8 +12,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ diff -ruNp m4-1.4.10/tests/test-vasnprintf.c m4-1.4.11/tests/test-vasnprintf.c --- m4-1.4.10/tests/test-vasnprintf.c 2007-05-30 19:31:12.000000000 -0600 +++ m4-1.4.11/tests/test-vasnprintf.c 2007-10-09 06:17:06.000000000 -0600 @@ -1,10 +1,10 @@ /* Test of vasnprintf() and asnprintf() functions. Copyright (C) 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -12,8 +12,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ diff -ruNp m4-1.4.10/tests/test-vasprintf-posix.c m4-1.4.11/tests/test-vasprintf-posix.c --- m4-1.4.10/tests/test-vasprintf-posix.c 2007-07-05 05:49:00.000000000 -0600 +++ m4-1.4.11/tests/test-vasprintf-posix.c 2008-04-01 20:23:22.000000000 -0600 @@ -1,10 +1,10 @@ /* Test of POSIX compatible vasprintf() and asprintf() functions. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007-2008 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -12,8 +12,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ @@ -29,6 +28,8 @@ #include <stdlib.h> #include <string.h> +#include "nan.h" + #define SIZEOF(array) (sizeof (array) / sizeof (array[0])) #define ASSERT(expr) \ do \ @@ -41,18 +42,6 @@ } \ while (0) -/* The Compaq (ex-DEC) C 6.4 compiler chokes on the expression 0.0 / 0.0. */ -#ifdef __DECC -static double -NaN () -{ - static double zero = 0.0; - return zero / zero; -} -#else -# define NaN() (0.0 / 0.0) -#endif - /* The SGI MIPS floating-point format does not distinguish 0.0 and -0.0. */ static int have_minus_zero () @@ -106,7 +95,7 @@ strisnan (const char *string, size_t sta } return 0; } - + static void test_function (int (*my_asprintf) (char **, const char *, ...)) { @@ -239,7 +228,7 @@ test_function (int (*my_asprintf) (char { /* NaN. */ char *result; int retval = - my_asprintf (&result, "%a %d", NaN (), 33, 44, 55); + my_asprintf (&result, "%a %d", NaNd (), 33, 44, 55); ASSERT (result != NULL); ASSERT (strlen (result) >= 3 + 3 && strisnan (result, 0, strlen (result) - 3, 0) @@ -472,7 +461,7 @@ test_function (int (*my_asprintf) (char { /* FLAG_ZERO with NaN. */ char *result; int retval = - my_asprintf (&result, "%050a %d", NaN (), 33, 44, 55); + my_asprintf (&result, "%050a %d", NaNd (), 33, 44, 55); ASSERT (result != NULL); /* "0000000nan 33" is not a valid result; see <http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> */ @@ -553,7 +542,7 @@ test_function (int (*my_asprintf) (char { /* NaN. */ char *result; int retval = - my_asprintf (&result, "%La %d", 0.0L / 0.0L, 33, 44, 55); + my_asprintf (&result, "%La %d", NaNl (), 33, 44, 55); ASSERT (result != NULL); ASSERT (strlen (result) >= 3 + 3 && strisnan (result, 0, strlen (result) - 3, 0) @@ -888,7 +877,7 @@ test_function (int (*my_asprintf) (char { /* FLAG_ZERO with NaN. */ char *result; int retval = - my_asprintf (&result, "%050La %d", 0.0L / 0.0L, 33, 44, 55); + my_asprintf (&result, "%050La %d", NaNl (), 33, 44, 55); ASSERT (result != NULL); /* "0000000nan 33" is not a valid result; see <http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> */ @@ -1068,7 +1057,7 @@ test_function (int (*my_asprintf) (char { /* NaN. */ char *result; int retval = - my_asprintf (&result, "%f %d", NaN (), 33, 44, 55); + my_asprintf (&result, "%f %d", NaNd (), 33, 44, 55); ASSERT (result != NULL); ASSERT (strlen (result) >= 3 + 3 && strisnan (result, 0, strlen (result) - 3, 0) @@ -1161,7 +1150,7 @@ test_function (int (*my_asprintf) (char { /* FLAG_ZERO with NaN. */ char *result; int retval = - my_asprintf (&result, "%050f %d", NaN (), 33, 44, 55); + my_asprintf (&result, "%050f %d", NaNd (), 33, 44, 55); ASSERT (result != NULL); ASSERT (strlen (result) == 50 + 3 && strisnan (result, strspn (result, " "), strlen (result) - 3, 0) @@ -1345,10 +1334,9 @@ test_function (int (*my_asprintf) (char } { /* NaN. */ - static long double zero = 0.0L; char *result; int retval = - my_asprintf (&result, "%Lf %d", zero / zero, 33, 44, 55); + my_asprintf (&result, "%Lf %d", NaNl (), 33, 44, 55); ASSERT (result != NULL); ASSERT (strlen (result) >= 3 + 3 && strisnan (result, 0, strlen (result) - 3, 0) @@ -1540,10 +1528,9 @@ test_function (int (*my_asprintf) (char } { /* FLAG_ZERO with NaN. */ - static long double zero = 0.0L; char *result; int retval = - my_asprintf (&result, "%050Lf %d", zero / zero, 33, 44, 55); + my_asprintf (&result, "%050Lf %d", NaNl (), 33, 44, 55); ASSERT (result != NULL); ASSERT (strlen (result) == 50 + 3 && strisnan (result, strspn (result, " "), strlen (result) - 3, 0) @@ -1640,7 +1627,7 @@ test_function (int (*my_asprintf) (char { /* NaN. */ char *result; int retval = - my_asprintf (&result, "%F %d", NaN (), 33, 44, 55); + my_asprintf (&result, "%F %d", NaNd (), 33, 44, 55); ASSERT (result != NULL); ASSERT (strlen (result) >= 3 + 3 && strisnan (result, 0, strlen (result) - 3, 1) @@ -1754,10 +1741,9 @@ test_function (int (*my_asprintf) (char } { /* NaN. */ - static long double zero = 0.0L; char *result; int retval = - my_asprintf (&result, "%LF %d", zero / zero, 33, 44, 55); + my_asprintf (&result, "%LF %d", NaNl (), 33, 44, 55); ASSERT (result != NULL); ASSERT (strlen (result) >= 3 + 3 && strisnan (result, 0, strlen (result) - 3, 1) @@ -1979,7 +1965,7 @@ test_function (int (*my_asprintf) (char { /* NaN. */ char *result; int retval = - my_asprintf (&result, "%e %d", NaN (), 33, 44, 55); + my_asprintf (&result, "%e %d", NaNd (), 33, 44, 55); ASSERT (result != NULL); ASSERT (strlen (result) >= 3 + 3 && strisnan (result, 0, strlen (result) - 3, 0) @@ -2090,7 +2076,7 @@ test_function (int (*my_asprintf) (char { /* FLAG_ZERO with NaN. */ char *result; int retval = - my_asprintf (&result, "%050e %d", NaN (), 33, 44, 55); + my_asprintf (&result, "%050e %d", NaNd (), 33, 44, 55); ASSERT (result != NULL); ASSERT (strlen (result) == 50 + 3 && strisnan (result, strspn (result, " "), strlen (result) - 3, 0) @@ -2275,10 +2261,9 @@ test_function (int (*my_asprintf) (char } { /* NaN. */ - static long double zero = 0.0L; char *result; int retval = - my_asprintf (&result, "%Le %d", zero / zero, 33, 44, 55); + my_asprintf (&result, "%Le %d", NaNl (), 33, 44, 55); ASSERT (result != NULL); ASSERT (strlen (result) >= 3 + 3 && strisnan (result, 0, strlen (result) - 3, 0) @@ -2480,10 +2465,9 @@ test_function (int (*my_asprintf) (char } { /* FLAG_ZERO with NaN. */ - static long double zero = 0.0L; char *result; int retval = - my_asprintf (&result, "%050Le %d", zero / zero, 33, 44, 55); + my_asprintf (&result, "%050Le %d", NaNl (), 33, 44, 55); ASSERT (result != NULL); ASSERT (strlen (result) == 50 + 3 && strisnan (result, strspn (result, " "), strlen (result) - 3, 0) @@ -2681,7 +2665,7 @@ test_function (int (*my_asprintf) (char { /* NaN. */ char *result; int retval = - my_asprintf (&result, "%g %d", NaN (), 33, 44, 55); + my_asprintf (&result, "%g %d", NaNd (), 33, 44, 55); ASSERT (result != NULL); ASSERT (strlen (result) >= 3 + 3 && strisnan (result, 0, strlen (result) - 3, 0) @@ -2785,7 +2769,7 @@ test_function (int (*my_asprintf) (char { /* FLAG_ZERO with NaN. */ char *result; int retval = - my_asprintf (&result, "%050g %d", NaN (), 33, 44, 55); + my_asprintf (&result, "%050g %d", NaNd (), 33, 44, 55); ASSERT (result != NULL); ASSERT (strlen (result) == 50 + 3 && strisnan (result, strspn (result, " "), strlen (result) - 3, 0) @@ -2970,10 +2954,9 @@ test_function (int (*my_asprintf) (char } { /* NaN. */ - static long double zero = 0.0L; char *result; int retval = - my_asprintf (&result, "%Lg %d", zero / zero, 33, 44, 55); + my_asprintf (&result, "%Lg %d", NaNl (), 33, 44, 55); ASSERT (result != NULL); ASSERT (strlen (result) >= 3 + 3 && strisnan (result, 0, strlen (result) - 3, 0) @@ -3175,10 +3158,9 @@ test_function (int (*my_asprintf) (char } { /* FLAG_ZERO with NaN. */ - static long double zero = 0.0L; char *result; int retval = - my_asprintf (&result, "%050Lg %d", zero / zero, 33, 44, 55); + my_asprintf (&result, "%050Lg %d", NaNl (), 33, 44, 55); ASSERT (result != NULL); ASSERT (strlen (result) == 50 + 3 && strisnan (result, strspn (result, " "), strlen (result) - 3, 0) @@ -3234,6 +3216,138 @@ test_function (int (*my_asprintf) (char ASSERT (retval == strlen (result)); free (result); } + + /* Test the support of the left-adjust flag. */ + + { + char *result; + int retval = + my_asprintf (&result, "a%*sc", -3, "b"); + ASSERT (result != NULL); + ASSERT (strcmp (result, "ab c") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { + char *result; + int retval = + my_asprintf (&result, "a%-*sc", 3, "b"); + ASSERT (result != NULL); + ASSERT (strcmp (result, "ab c") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { + char *result; + int retval = + my_asprintf (&result, "a%-*sc", -3, "b"); + ASSERT (result != NULL); + ASSERT (strcmp (result, "ab c") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + /* Test the support of large precision. */ + + { + char *result; + int retval = + my_asprintf (&result, "%.4000d %d", 1234567, 99); + size_t i; + ASSERT (result != NULL); + for (i = 0; i < 4000 - 7; i++) + ASSERT (result[i] == '0'); + ASSERT (strcmp (result + 4000 - 7, "1234567 99") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { + char *result; + int retval = + my_asprintf (&result, "%.4000d %d", -1234567, 99); + size_t i; + ASSERT (result != NULL); + ASSERT (result[0] == '-'); + for (i = 0; i < 4000 - 7; i++) + ASSERT (result[1 + i] == '0'); + ASSERT (strcmp (result + 1 + 4000 - 7, "1234567 99") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { + char *result; + int retval = + my_asprintf (&result, "%.4000u %d", 1234567, 99); + size_t i; + ASSERT (result != NULL); + for (i = 0; i < 4000 - 7; i++) + ASSERT (result[i] == '0'); + ASSERT (strcmp (result + 4000 - 7, "1234567 99") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { + char *result; + int retval = + my_asprintf (&result, "%.4000o %d", 1234567, 99); + size_t i; + ASSERT (result != NULL); + for (i = 0; i < 4000 - 7; i++) + ASSERT (result[i] == '0'); + ASSERT (strcmp (result + 4000 - 7, "4553207 99") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { + char *result; + int retval = + my_asprintf (&result, "%.4000x %d", 1234567, 99); + size_t i; + ASSERT (result != NULL); + for (i = 0; i < 4000 - 6; i++) + ASSERT (result[i] == '0'); + ASSERT (strcmp (result + 4000 - 6, "12d687 99") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { + char *result; + int retval = + my_asprintf (&result, "%#.4000x %d", 1234567, 99); + size_t i; + ASSERT (result != NULL); + ASSERT (result[0] == '0'); + ASSERT (result[1] == 'x'); + for (i = 0; i < 4000 - 6; i++) + ASSERT (result[2 + i] == '0'); + ASSERT (strcmp (result + 2 + 4000 - 6, "12d687 99") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { + char input[5000]; + char *result; + int retval; + size_t i; + + for (i = 0; i < sizeof (input) - 1; i++) + input[i] = 'a' + ((1000000 / (i + 1)) % 26); + input[i] = '\0'; + retval = my_asprintf (&result, "%.4000s %d", input, 99); + ASSERT (result != NULL); + ASSERT (memcmp (result, input, 4000) == 0); + ASSERT (strcmp (result + 4000, " 99") == 0); + ASSERT (retval == strlen (result)); + free (result); + } } static int diff -ruNp m4-1.4.10/tests/test-vasprintf.c m4-1.4.11/tests/test-vasprintf.c --- m4-1.4.10/tests/test-vasprintf.c 2007-05-30 19:31:12.000000000 -0600 +++ m4-1.4.11/tests/test-vasprintf.c 2007-10-09 06:17:07.000000000 -0600 @@ -1,10 +1,10 @@ /* Test of vasprintf() and asprintf() functions. Copyright (C) 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -12,8 +12,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ diff -ruNp m4-1.4.10/tests/test-wchar.c m4-1.4.11/tests/test-wchar.c --- m4-1.4.10/tests/test-wchar.c 2007-05-30 19:31:12.000000000 -0600 +++ m4-1.4.11/tests/test-wchar.c 2007-10-09 06:17:07.000000000 -0600 @@ -1,10 +1,10 @@ /* Test of <wchar.h> substitute. Copyright (C) 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -12,8 +12,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ diff -ruNp m4-1.4.10/tests/test-wctype.c m4-1.4.11/tests/test-wctype.c --- m4-1.4.10/tests/test-wctype.c 2007-05-30 19:31:13.000000000 -0600 +++ m4-1.4.11/tests/test-wctype.c 2007-10-09 06:17:07.000000000 -0600 @@ -1,10 +1,10 @@ /* Test of <wctype.h> substitute. Copyright (C) 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -12,8 +12,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ diff -ruNp m4-1.4.10/tests/test-xvasprintf.c m4-1.4.11/tests/test-xvasprintf.c --- m4-1.4.10/tests/test-xvasprintf.c 2007-05-30 19:31:13.000000000 -0600 +++ m4-1.4.11/tests/test-xvasprintf.c 2007-10-09 06:17:07.000000000 -0600 @@ -1,10 +1,10 @@ /* Test of xvasprintf() and xasprintf() functions. Copyright (C) 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -12,8 +12,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ diff -ruNp m4-1.4.10/tests/verify.h m4-1.4.11/tests/verify.h --- m4-1.4.10/tests/verify.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.11/tests/verify.h 2007-12-11 19:25:23.000000000 -0700 @@ -0,0 +1,140 @@ +/* Compile-time assert-like macros. + + Copyright (C) 2005, 2006 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/>. */ + +/* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */ + +#ifndef VERIFY_H +# define VERIFY_H 1 + +/* Each of these macros verifies that its argument R is nonzero. To + be portable, R should be an integer constant expression. Unlike + assert (R), there is no run-time overhead. + + There are two macros, since no single macro can be used in all + contexts in C. verify_true (R) is for scalar contexts, including + integer constant expression contexts. verify (R) is for declaration + contexts, e.g., the top level. + + Symbols ending in "__" are private to this header. + + The code below uses several ideas. + + * The first step is ((R) ? 1 : -1). Given an expression R, of + integral or boolean or floating-point type, this yields an + expression of integral type, whose value is later verified to be + constant and nonnegative. + + * Next this expression W is wrapped in a type + struct verify_type__ { unsigned int verify_error_if_negative_size__: W; }. + If W is negative, this yields a compile-time error. No compiler can + deal with a bit-field of negative size. + + One might think that an array size check would have the same + effect, that is, that the type struct { unsigned int dummy[W]; } + would work as well. However, inside a function, some compilers + (such as C++ compilers and GNU C) allow local parameters and + variables inside array size expressions. With these compilers, + an array size check would not properly diagnose this misuse of + the verify macro: + + void function (int n) { verify (n < 0); } + + * For the verify macro, the struct verify_type__ will need to + somehow be embedded into a declaration. To be portable, this + declaration must declare an object, a constant, a function, or a + typedef name. If the declared entity uses the type directly, + such as in + + struct dummy {...}; + typedef struct {...} dummy; + extern struct {...} *dummy; + extern void dummy (struct {...} *); + extern struct {...} *dummy (void); + + two uses of the verify macro would yield colliding declarations + if the entity names are not disambiguated. A workaround is to + attach the current line number to the entity name: + + #define GL_CONCAT0(x, y) x##y + #define GL_CONCAT(x, y) GL_CONCAT0 (x, y) + extern struct {...} * GL_CONCAT(dummy,__LINE__); + + But this has the problem that two invocations of verify from + within the same macro would collide, since the __LINE__ value + would be the same for both invocations. + + A solution is to use the sizeof operator. It yields a number, + getting rid of the identity of the type. Declarations like + + extern int dummy [sizeof (struct {...})]; + extern void dummy (int [sizeof (struct {...})]); + extern int (*dummy (void)) [sizeof (struct {...})]; + + can be repeated. + + * Should the implementation use a named struct or an unnamed struct? + Which of the following alternatives can be used? + + extern int dummy [sizeof (struct {...})]; + extern int dummy [sizeof (struct verify_type__ {...})]; + extern void dummy (int [sizeof (struct {...})]); + extern void dummy (int [sizeof (struct verify_type__ {...})]); + extern int (*dummy (void)) [sizeof (struct {...})]; + extern int (*dummy (void)) [sizeof (struct verify_type__ {...})]; + + In the second and sixth case, the struct type is exported to the + outer scope; two such declarations therefore collide. GCC warns + about the first, third, and fourth cases. So the only remaining + possibility is the fifth case: + + extern int (*dummy (void)) [sizeof (struct {...})]; + + * This implementation exploits the fact that GCC does not warn about + the last declaration mentioned above. If a future version of GCC + introduces a warning for this, the problem could be worked around + by using code specialized to GCC, e.g.,: + + #if 4 <= __GNUC__ + # define verify(R) \ + extern int (* verify_function__ (void)) \ + [__builtin_constant_p (R) && (R) ? 1 : -1] + #endif + + * In C++, any struct definition inside sizeof is invalid. + Use a template type to work around the problem. */ + + +/* Verify requirement R at compile-time, as an integer constant expression. + Return 1. */ + +# ifdef __cplusplus +template <int w> + struct verify_type__ { unsigned int verify_error_if_negative_size__: w; }; +# define verify_true(R) \ + (!!sizeof (verify_type__<(R) ? 1 : -1>)) +# else +# define verify_true(R) \ + (!!sizeof \ + (struct { unsigned int verify_error_if_negative_size__: (R) ? 1 : -1; })) +# endif + +/* Verify requirement R at compile-time, as a declaration without a + trailing ';'. */ + +# define verify(R) extern int (* verify_function__ (void)) [verify_true (R)] + +#endif