diff -ruNp m4-1.4.5/AUTHORS m4-1.4.6/AUTHORS --- m4-1.4.5/AUTHORS 2006-06-29 21:46:11.000000000 -0600 +++ m4-1.4.6/AUTHORS 2006-08-21 19:43:07.000000000 -0600 @@ -85,3 +85,14 @@ jbrzusto@fastmail.fm M4 Ralf Wildenhues Germany, 1975 2006-03-20 Assigns Past and Future Changes Ralf.Wildenhues@gmx.de + +======================================================================== + +Copyright (C) 2000, 2006 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, with no Front-Cover Texts, and with no Back-Cover +Texts. A copy of the license is included in the ``GNU Free +Documentation License'' file as part of this distribution. diff -ruNp m4-1.4.5/BACKLOG m4-1.4.6/BACKLOG --- m4-1.4.5/BACKLOG 2000-02-16 20:03:19.000000000 -0700 +++ m4-1.4.6/BACKLOG 2006-08-21 19:52:36.000000000 -0600 @@ -49,3 +49,12 @@ rmail/speed 1. 29 Aug 94 Re: diversions and freezing 2. 05 Sep 94 slowness 3. 04 Oct 94 Autoconf, m4, and dnl's. + +Copyright (C) 2000, 2006 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, with no Front-Cover Texts, and with no Back-Cover +Texts. A copy of the license is included in the ``GNU Free +Documentation License'' file as part of this distribution. diff -ruNp m4-1.4.5/ChangeLog m4-1.4.6/ChangeLog --- m4-1.4.5/ChangeLog 2006-07-15 16:37:11.000000000 -0600 +++ m4-1.4.6/ChangeLog 2006-08-25 08:08:32.000000000 -0600 @@ -1,3 +1,365 @@ +2006-08-25 Eric Blake + + Release 1.4.6: + + * configure.ac (AC_INIT): Bump version number. + * NEWS: Describe changes since 1.4.5. + + * Makefile.maint (web-manual): Give up on VPATH build during + distribution. But distributions are made so infrequently that + this is not too much of a hardship. + * Makefile.am (MAINTAINERCLEANFILES): Avoid error if lib/CVS/ + exists. + +2006-08-24 Eric Blake + + * src/builtin.c (m4_index, m4_substr, m4_translit): Similar to + Solaris, produce output on just one argument. + (m4_regexp, m4_patsubst): For consistency, do likewise. + (m4_patsubst): Allow zero-length match at end of string. + * doc/m4.texinfo (Sysval): Fix overfull hbox. + (Bugs, Macro Arguments): Minor fixes. + (Other tokens): Rearrange node order. + (Index macro, Substr, Translit, Regexp, Patsubst): Add tests. + * NEWS: Document these fixes. + +2006-08-22 Eric Blake + + * src/input.c (pop_input): Avoid empty filename with -di option. + * src/debug.c (debug_message_prefix): Put space before message. + + * m4/gnulib-cache.m4: We don't explicitly use alloca module. + + * m4/gnulib-cache.m4: Augment with gnulib-tool --import gnupload. + * Makefile.maint (fetch): Simplify, now that we can use gnupload. + + * checks/check-them: State why a test is skipped. + * doc/m4.texinfo (Changeword, Sysval, Maketemp): Likewise. + + * ChangeLog: Add copyright. + * AUTHORS: Likewise. + * BACKLOG: Likewise. + * README: Likewise. + * THANKS: Likewise. + * TODO: Likewise. + * examples/COPYING: New file, add copyright for all the examples. + * checks/get-them: Put copyright on testsuite files. + +2006-08-18 Eric Blake + + Don't let unrelated child processes see too many files. + * m4/gnulib-cache.m4: Augment with gnulib-tool --import cloexec. + * src/builtin.c (m4_esyscmd, m4_regexp, m4_patsubst): Fix + spelling in error message. + * src/debug.c [!__STDC__]: Assume C89, and nuke old varargs.h. + (debug_set_output): Close debug file on exec. + * src/m4.h (includes): Add cloexec.h. + * src/output.c (make_room_for): Close diversions on exec. + * src/path.c (path_search): Close include files on exec. + * NEWS: Document this. + + Regular expressions were leaking memory. + * src/builtin.c (init_pattern_buffer, free_pattern_buffer): New + helper methods. + (m4_regexp, m4_patsubst): Avoid memory leak. + * src/input.c (init_pattern_buffer) [ENABLE_CHANGEWORD]: Make + static. + (set_word_regexp) [ENABLE_CHANGEWORD]: Avoid memory leak. Change + from O(n^2) to O(n) for calculating word_start. + (next_token, peek_token) [ENABLE_CHANGEWORD]: Treat word_start as + O(1) bitmap, not O(n) search string. + * NEWS: Document this fix. + +2006-08-17 Eric Blake + + * NEWS: Document previous checkin. + + * src/builtin.c (substitute): Avoid core dump when accessing + beyond bound of regular expression. + Reported by Karl Nelson. + * doc/m4.texinfo (Regexp): Add example that causes core dump on + some architectures prior to this patch. + * THANKS: Updated. + +2006-08-16 Eric Blake + + * doc/m4.texinfo (Invoking m4, Debug Output): Fix wording to be + clear that dumpdef does not always go to stderr. + + * src/builtin.c (m4_errprint): Flush buffers before printing to + stderr. + * THANKS: Updated. + +2006-08-15 Eric Blake + + * src/builtin.c (m4_m4wrap, m4_errprint, m4_shift): Make blind, + per debian bug 96075. + * doc/m4.texinfo (Loops, M4wrap, Errprint): Document this change. + (Changeword): Don't use shift as an example of a swallowed word. + (Divert): Discuss fact that divert is an English word. + Reported by Richard A Nelson. + +2006-08-14 Eric Blake + + * doc/m4.texinfo (Invoking m4): Minor fixes. + +2006-08-12 Eric Blake + + * doc/m4.texinfo (Arguments): Hint at better exch macro. + (Answers): Provide a better definition. + +2006-08-09 Eric Blake + + * doc/m4.texinfo (Incompatibilities): Document that m4 does not + yet understand locales. + * NEWS: Fix wording of a few items. + +2006-08-08 Eric Blake + + Avoid printing `NONE:0:' in error messages. + * src/m4.h (m4_error_at_line): New function. + * src/m4.c (m4_error_at_line): Implement. + * src/input.c (skip_line, input_init, next_token): Use "", not + "NONE", for no file, since NONE can be a real file name. + * src/macro.c (expand_argument): Likewise. + * src/debug.c (debug_message_prefix, trace_header): Check for + current file. + * doc/m4.texinfo (Dnl, M4wrap): Adjust accordingly. + (Location): Document that synclines and internal message format + are not impacted by redefining these macros. + (M4exit): Hint at bug in fatal_error. + (Answers): Provide workaround to match m4 output. + + * m4/gnulib-cache.m4: Augment with gnulib-tool --import verror. + * src/m4.h (m4_error): New function. + (M4ERROR, M4ERROR_AT_LINE): Reimplement without hacking around + error module deficiencies. + (reference_error, suppress_line): No longer needed. + * src/m4.c (m4_error): Implement. + (main): No longer need to install error callback. + +2006-08-04 Eric Blake + + * src/m4.h (program_name): Declare. + (suppress_line): New variable. + (M4ERROR_AT_LINE): New macro. + * src/m4.c (reference_error, main): Follow GNU Coding Standards + for error message format. + * src/input.c (skip_line, next_token): Use M4ERROR_AT_LINE. + * src/macro.c (expand_argument): Likewise. + * checks/check-them (examples): Adjust to new message format. + * src/builtin.c (m4___program__): New builtin. + * doc/m4.texinfo (Location): Split from Errprint into new node, + and document __program__. + (Builtin, Ifdef, Ifelse, Dumpdef, Trace, Debug Output, Dnl) + (Include, Regexp, Patsubst, Incr, Eval): Adjust error message + format. + (Extensions): Document __program__. + * NEWS: Document this change. + +2006-08-03 Eric Blake + + Don't confuse leading `(' in comment or quote with start of + argument collection. + * src/m4.h (enum token_type): Add TOKEN_OPEN, TOKEN_COMMA, + TOKEN_CLOSE. + (peek_input): Make private to input.c. + (peek_token): New prototype. + * src/input.c (default_word_regexp): Reduce ifdefs. + (peek_input): Make static. + (next_token): Return new token types. + (match_input, MATCH): Add argument consume, which controls + whether match should be pushed back. + (peek_token): New function. + (token_type_string) [DEBUG_INPUT]: New function. + * src/macro.c (expand_token, expand_argument, collect_arguments): + Handle new token types. + * doc/m4.texinfo (Changequote, Changecom): Document this. + * NEWS: Document this. + + * src/stackovf.c (setup_stackovf_trap): Free memory on failure. + + * src/stackovf.c (setup_stackovf_trap): Gracefully avoid stack + overflow detection when sigstack exists but is not implemented. + Fixes debian bug 154053. + * THANKS: Updated. + Reported by David Perlin. + +2006-08-02 Eric Blake + + * src/input.c (MATCH): Fix EOF detection on multi-byte comment + close. + +2006-08-01 Eric Blake + + * src/input.c (skip_line, next_token): Remember current file in + case input file ends abruptly. Addresses debian bug 175365. + (pop_input): Defer freeing storage that holds previous file + name... + (pop_wrapup): to here, after error message is issued. + * src/macro.c (expand_argument): Remember current file in case + input file ends abruptly. + * doc/m4.texinfo (Macro Arguments, Dnl, Changequote, Changecom) + (M4wrap): Adjust testsuite accordingly. + (Errprint): Document line number limitation of m4wrap. + * NEWS: Document this fix. + * THANKS: Update. + +2006-07-31 Eric Blake + + * src/input.c (peek_input, next_char, match_input): Be eight-bit + clean; fixes debian bug 311378. + * doc/m4.texinfo (Syntax): Describe eight-bit handling. + (Changequote, Changecom): Add examples to test this. + * NEWS: Document this fix. + * THANKS: Update. + Reported by Steven Augart. + + * doc/m4.texinfo: Whitespace fix. + * checks/get-them: Avoid exceeding 14-char file name limit. + * THANKS: Update. + +2006-07-30 Eric Blake + + * src/path.c (path_search): Detect allocation failure. + + Use native free when it is good enough. + * m4/gnulib-cache.m4: Augment with gnulib-tool --import free. + * src/builtin.c (define_user_macro, m4_regexp, m4_patsubst): + Adjust calls. + * src/symtab.c (free_symbol): Likewise. + * src/m4.c (xfree, main): Likewise. + * src/m4.h (obstack_chunk_free): Likewise. + * src/path.c (path_search): Likewise. + * src/input.c (pop_wrapup, set_quotes, set_comment): Likewise. + + * doc/m4.texinfo (Errprint): Add example for last patch. + * checks/check-them: Account for VPATH in latest example. + +2006-07-29 Eric Blake + + * src/path.c (path_search): Add result parameter, so that + -I can be accounted for. Debian bug 53685. + * src/m4.h (path_search): Update prototype. + * src/m4.c (main): Adjust callers. + * src/freeze.c (reload_frozen_state): Likewise. + * src/builtin.c (include, m4_undivert): Likewise. + * NEWS: Document this change. + Reported by Nicolas Lichtmaier. + +2006-07-28 Eric Blake + + * Makefile.am (MAINTAINERCLEANFILES): Fix typo that tripped up + several non-GNU makes. + * src/stackovf.c (setup_stackovf_trap): Missed _ from yesterday. + * src/m4.h: Likewise. + * src/input.c (push_wrapup): Avoid compiler warning with Solaris + /usr/ccs/bin/ucbcc. + +2006-07-27 Eric Blake + + * doc/m4.texinfo: Use @acronym{GNU} throughout. + (History): Update for 1.4.6. + + * src/m4.h (_): Remove K&R cruft. + * src/builtin.c: Likewise. + * src/debug.c: Likewise. + * src/eval.c: Likewise. + * src/macro.c: Likewise. + * src/stackovf.c: Likewise. + + * doc/Makefile.am (m4.1): Improve man page. + * src/m4.c (usage): Improve --help output, including adding the + bug reporting address. + (main): Follow GNU Coding Standards for --version output. + +2006-07-26 Eric Blake + + * doc/m4.texinfo: Use begin-quote, end-quote, begin-comment, and + end-comment consistently, to match POSIX. + + * doc/m4.texinfo (Macro Arguments, Changequote, Changecom) + (Dnl, M4wrap, Include): Document EOF issues, and add examples. + (Incompatibilities): Document incompatibility of changecom + vs. macro names, and of EOF in include. + * src/input.c (next_token): Reject unterminated comments at EOF. + (skip_line): Warn on unterminated dnl at EOF. + * NEWS: Document these changes. + +2006-07-25 Eric Blake + + * m4/gnulib-cache.m4: Update to reflect gnulib's split of + stdio-safer into fopen-safer and tmpfile-safer. + * src/m4.c: Remove redundant include. + +2006-07-24 Eric Blake + + Fix bugs related to stream handling. + * m4/gnulib-cache.m4: Augment with gnulib-tool --import + unlocked-io stdio-safer stdlib-safer close-stream. + * configure.ac (AC_CHECK_FUNCS_ONCE): Assume tmpfile; it can be + provided by gnulib if needed. + * src/output.c [! HAVE_TMPFILE]: Likewise. + * src/m4.h (includes): Replace unistd, stdio, and stdlib with + their safer counterparts. + (retcode): New global variable. + * src/input.c (pop_input): Check for read failure. + * src/freeze.c (reload_frozen_state): Likewise. + (produce_frozen_state): Check for write failure. + * src/debug.c (debug_set_file): Likewise. + * src/m4.c (usage, main): Likewise. + (retcode): Make global. + * src/builtin.c (m4_m4exit): Likewise. Ensure that the exit + status is non-zero except when everything succeeds. + * doc/m4.texinfo (M4exit): Document these changes. + (Incompatibilities): Remove documentation of bug now fixed. + * NEWS: Document these fixes. + +2006-07-22 Eric Blake + + * src/format.c (format): Avoid compiler warning that str may be + used uninitialized. + +2006-07-21 Eric Blake + + * src/m4.h [UNIX]: Add more platforms that are close enough to + categorize as UNIX, but which don't predefine __unix__. + Reported by Nelson H. F. Beebe. + +2006-07-20 Eric Blake + + * m4/gnulib-cache.m4: gnulib-tool has changed again. Regenerate + to explicitly ask for --assume-autoconf=2.60. + +2006-07-19 Eric Blake + + * doc/m4.texinfo (Sysval): Avoid kill -1, since ksh traps SIGHUP + and exits normally with 129. + Reported by Nelson H. F. Beebe. + * THANKS: Update. + + * src/m4.h (EXIT_MISMATCH): Define. + * src/freeze.c (reload_frozen_state): Detect version mismatch, by + exiting with status 63. + * src/m4.c (usage): Document this. + * doc/m4.texinfo (Invoking m4, Using frozen files): Likewise. + * NEWS: Likewise. + + * doc/m4.texinfo (copying): Relax restriction on front-cover and + back-cover texts. + +2006-07-17 Eric Blake + + * src/format.c (format): Support F, g, and G specifiers. + * doc/m4.texinfo (Format): Document this. + * NEWS: Document this addition. + + * doc/m4.texinfo (Builtin): Delete redundant text. + + * configure.ac (AC_INIT): Bump version number. + * src/builtin.c (substitute): Bah. Fix buffer overrun. + * NEWS: Document this fix. + 2006-07-15 Eric Blake Release 1.4.5: @@ -597,7 +959,7 @@ (hash): Likewise. Don't case-fold in the hash function. Shift by 7, not 3, for consistency with gnulib/lib/hash.c. Don't assume hash word is 32 bits. - NEWS: Document this change. + * NEWS: Document this change. 2006-06-04 Eric Blake @@ -2540,4 +2902,17 @@ Mon Jan 22 21:08:52 1990 Rene' Seindal * Initial beta release. Release 0.50, manual 0.05. - $Revision: 1.1.1.1.2.118 $ $Date: 2006/07/15 22:37:11 $ + ----- + + $Revision: 1.1.1.1.2.169 $ $Date: 2006/08/25 14:08:32 $ + + Local Variables: + coding: utf-8 + End: + + Copyright (C) 1990, 1991, 1992, 1993, 1994, 2000, 2001, 2003, + 2005, 2006 Free Software Foundation, Inc. + + Copying and distribution of this file, with or without + modification, are permitted provided the copyright notice + and this notice are preserved. diff -ruNp m4-1.4.5/Makefile.am m4-1.4.6/Makefile.am --- m4-1.4.5/Makefile.am 2006-07-15 15:24:18.000000000 -0600 +++ m4-1.4.6/Makefile.am 2006-08-24 12:18:28.000000000 -0600 @@ -27,9 +27,9 @@ DISTCLEANFILES = stamp-h ## maintainer-clean should remove as much as possible that ./bootstrap can ## recreate. In the m4 directory, keep only gnulib-cache.m4. MAINTAINERCLEANFILES = COPYING INSTALL Makefile.in aclocal.m4 \ - config-h.in configure depcomp doc/fdl.texi gendocs.sh install-sh - lib/* m4/[a-fh-z]* m4/g[a-mo-z]* m4/gnulib-comp.m4 m4/gnulib-tool.m4 \ - missing stamp-h.in + config-h.in configure depcomp doc/fdl.texi gendocs.sh install-sh \ + lib/[a-z]* m4/[a-fh-z]* m4/g[a-mo-z]* m4/gnulib-comp.m4 \ + m4/gnulib-tool.m4 missing stamp-h.in ACLOCAL_AMFLAGS = -I m4 DISTCHECK_CONFIGURE_FLAGS = --enable-changeword diff -ruNp m4-1.4.5/Makefile.in m4-1.4.6/Makefile.in --- m4-1.4.5/Makefile.in 2006-07-15 16:24:10.000000000 -0600 +++ m4-1.4.6/Makefile.in 2006-08-24 12:20:15.000000000 -0600 @@ -43,23 +43,26 @@ DIST_COMMON = README $(am__configure_dep subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/absolute-header.m4 \ - $(top_srcdir)/m4/alloca.m4 $(top_srcdir)/m4/codeset.m4 \ + $(top_srcdir)/m4/alloca.m4 $(top_srcdir)/m4/cloexec.m4 \ + $(top_srcdir)/m4/close-stream.m4 $(top_srcdir)/m4/codeset.m4 \ $(top_srcdir)/m4/eoverflow.m4 $(top_srcdir)/m4/error.m4 \ $(top_srcdir)/m4/exitfail.m4 $(top_srcdir)/m4/extensions.m4 \ + $(top_srcdir)/m4/fpending.m4 $(top_srcdir)/m4/free.m4 \ $(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gnulib-comp.m4 \ $(top_srcdir)/m4/intmax_t.m4 $(top_srcdir)/m4/inttypes_h.m4 \ $(top_srcdir)/m4/longdouble.m4 $(top_srcdir)/m4/longlong.m4 \ $(top_srcdir)/m4/mbchar.m4 $(top_srcdir)/m4/mbiter.m4 \ $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/memchr.m4 \ - $(top_srcdir)/m4/mkstemp.m4 $(top_srcdir)/m4/obstack.m4 \ - $(top_srcdir)/m4/regex.m4 $(top_srcdir)/m4/restrict.m4 \ + $(top_srcdir)/m4/mkstemp.m4 $(top_srcdir)/m4/regex.m4 \ $(top_srcdir)/m4/signed.m4 $(top_srcdir)/m4/size_max.m4 \ $(top_srcdir)/m4/ssize_t.m4 $(top_srcdir)/m4/stat-macros.m4 \ $(top_srcdir)/m4/stdarg.m4 $(top_srcdir)/m4/stdbool.m4 \ - $(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/strcase.m4 \ + $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdint_h.m4 \ + $(top_srcdir)/m4/stdio-safer.m4 \ + $(top_srcdir)/m4/stdlib-safer.m4 $(top_srcdir)/m4/strcase.m4 \ $(top_srcdir)/m4/strtol.m4 $(top_srcdir)/m4/sys_stat_h.m4 \ - $(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/ulonglong.m4 \ - $(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/vasnprintf.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.m4 $(top_srcdir)/m4/wchar_t.m4 \ $(top_srcdir)/m4/wcwidth.m4 $(top_srcdir)/m4/wint_t.m4 \ $(top_srcdir)/m4/xalloc.m4 $(top_srcdir)/m4/xsize.m4 \ @@ -94,6 +97,7 @@ DIST_ARCHIVES = $(distdir).tar.gz $(dist GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print +ABSOLUTE_STDINT_H = @ABSOLUTE_STDINT_H@ ABSOLUTE_SYS_STAT_H = @ABSOLUTE_SYS_STAT_H@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ @@ -105,6 +109,11 @@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +BITSIZEOF_PTRDIFF_T = @BITSIZEOF_PTRDIFF_T@ +BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@ +BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@ +BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@ +BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ @@ -123,6 +132,16 @@ GETOPT_H = @GETOPT_H@ GL_COND_LIBTOOL_FALSE = @GL_COND_LIBTOOL_FALSE@ GL_COND_LIBTOOL_TRUE = @GL_COND_LIBTOOL_TRUE@ GREP = @GREP@ +HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ +HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ +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_STDINT_H = @HAVE_STDINT_H@ +HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@ +HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@ +HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ +HAVE_WCHAR_H = @HAVE_WCHAR_H@ HAVE__BOOL = @HAVE__BOOL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -141,16 +160,22 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@ +SIZE_T_SUFFIX = @SIZE_T_SUFFIX@ STACKOVF_FALSE = @STACKOVF_FALSE@ STACKOVF_TRUE = @STACKOVF_TRUE@ STDBOOL_H = @STDBOOL_H@ +STDINT_H = @STDINT_H@ STRIP = @STRIP@ SYS_STAT_H = @SYS_STAT_H@ UNISTD_H = @UNISTD_H@ VERSION = @VERSION@ +WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ +WINT_T_SUFFIX = @WINT_T_SUFFIX@ ac_ct_CC = @ac_ct_CC@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ @@ -200,7 +225,9 @@ EXTRA_DIST = bootstrap c-boxes.el gendoc DISTCLEANFILES = stamp-h MAINTAINERCLEANFILES = COPYING INSTALL Makefile.in aclocal.m4 \ - config-h.in configure depcomp doc/fdl.texi gendocs.sh install-sh + config-h.in configure depcomp doc/fdl.texi gendocs.sh install-sh \ + lib/[a-z]* m4/[a-fh-z]* m4/g[a-mo-z]* m4/gnulib-comp.m4 \ + m4/gnulib-tool.m4 missing stamp-h.in ACLOCAL_AMFLAGS = -I m4 DISTCHECK_CONFIGURE_FLAGS = --enable-changeword @@ -633,8 +660,6 @@ uninstall-info: uninstall-info-recursive pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \ uninstall-info-am - lib/* m4/[a-fh-z]* m4/g[a-mo-z]* m4/gnulib-comp.m4 m4/gnulib-tool.m4 \ - missing stamp-h.in # 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.5/Makefile.maint m4-1.4.6/Makefile.maint --- m4-1.4.5/Makefile.maint 2006-07-15 15:10:39.000000000 -0600 +++ m4-1.4.6/Makefile.maint 2006-08-24 11:57:11.000000000 -0600 @@ -20,7 +20,7 @@ TEXI2HTML = texi2html .PHONY: cvs-release -cvs-release: version-check prev-tarball cvs-news fetch cvs-commit cvs-dist deltas web-manual +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"; \ @@ -73,46 +73,6 @@ cvs-news: exit 1; \ fi -## Program to use to fetch files. -WGET = wget -WGETSGO = $(WGET) http://savannah.gnu.org/cgi-bin/viewcvs/~checkout~ - -## Files that we fetch and which we compare against. -## FIXME should be a lot more here -FETCHFILES = \ -./INSTALL \ -./install-sh \ -doc/texinfo.tex - -## Fetch the latest versions of files we care about. -.PHONY: fetch -fetch: - rm -rf Fetchdir > /dev/null 2>&1 - mkdir Fetchdir -## If a get fails then that is a problem. - (cd Fetchdir && \ - $(WGETSGO)/autoconf/autoconf/INSTALL; \ - $(WGETSGO)/automake/automake/lib/install-sh; \ - $(WGETSGO)/texinfo/texinfo/doc/texinfo.tex; ) -## Don't exit after test because we want to give as many errors as -## possible. - @stat=0; for file in $(FETCHFILES); do \ - fetchedfile=Fetchdir/`echo $$file | sed 's,.*/,,g'`; \ - if diff -u $(srcdir)/$$file $$fetchedfile \ - >>Fetchdir/update.patch 2>/dev/null; then :; \ - else \ - stat=1; \ - echo "Updating $(srcdir)/$$file..."; \ - cp $$fetchedfile $(srcdir)/$$file; \ - fi; \ - done; \ - test $$stat = 1 && \ - echo "See Fetchdir/update.patch for a log of the changes."; \ - exit $$stat - - -GPG = gpg # set it to `:' to avoid gpg operations - .PHONY: cvs-commit cvs-commit: cvs-news cd $(srcdir) && $(SHELL) ./commit @@ -124,14 +84,6 @@ cvs-dist: cvs-news timestamps ## Finally, if everything was successful, tag the release cd $(srcdir) \ && $(CVS) -q tag `echo "release-$(VERSION)" | sed 's/\./_/g'` -## Generate signatures and directives for FSF ftp-upload: - for suffix in .gz .bz2; do \ - ofile="$(PACKAGE)-$(VERSION).tar$$suffix"; \ - $(GPG) --detach-sign $$ofile \ - && echo "directory: $(PACKAGE)" > $$ofile.directive \ - && $(GPG) --clearsign $$ofile.directive \ - && rm -f $$ofile.directive; \ - done .PHONY: new-tarball new-tarball: @@ -168,11 +120,7 @@ delta-diff: prev-tarball new-tarball && tar xzf "../$(PACKAGE)-$(VERSION).tar.gz" \ && $(DIFF) $(DIFF_OPTIONS) \ $(PACKAGE)-$(LASTRELEASE) $(PACKAGE)-$(VERSION) \ - | GZIP=$(GZIP_ENV) gzip -c > $$ofile \ - && $(GPG) --detach-sign $$ofile \ - && echo "directory: $(PACKAGE)" > $$ofile.directive \ - && $(GPG) --clearsign $$ofile.directive \ - && rm -f $$ofile.directive + | GZIP=$(GZIP_ENV) gzip -c > $$ofile rm -rf delta-diff @@ -188,15 +136,11 @@ delta-xdelta: prev-tarball new-tarball g ( test -z `$(XDELTA) delta $(XDELTA_OPTIONS) \ $(PACKAGE)-$(LASTRELEASE).tar.gz $(PACKAGE)-$(VERSION).tar.gz \ $$ofile 2>&1` \ - && : ) \ - && $(GPG) --detach-sign $$ofile \ - && echo "directory: $(PACKAGE)" > $$ofile.directive \ - && $(GPG) --clearsign $$ofile.directive \ - && rm -f $$ofile.directive + && : ) .PHONY: web-manual web-manual: - @cd "$(abs_srcdir)/doc"; \ - $(SHELL) "$(abs_srcdir)/gendocs.sh" $(PACKAGE) \ + @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.5/NEWS m4-1.4.6/NEWS --- m4-1.4.5/NEWS 2006-07-15 16:19:22.000000000 -0600 +++ m4-1.4.6/NEWS 2006-08-25 08:06:53.000000000 -0600 @@ -2,6 +2,44 @@ GNU M4 NEWS - User visible changes. Copyright (C) 1992, 1993, 1994, 2004, 2005, 2006 Free Software Foundation, Inc. +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 @@ -291,5 +329,6 @@ Version 0.50 - January 1990, by Rene' Se * Initial beta release. Local Variables: +mode: outline fill-column: 75 End: diff -ruNp m4-1.4.5/README m4-1.4.6/README --- m4-1.4.5/README 2006-06-29 21:46:11.000000000 -0600 +++ m4-1.4.6/README 2006-08-21 19:44:42.000000000 -0600 @@ -31,3 +31,14 @@ Send bug reports to `bug-m4@gnu.org'. A description of the problem: your input, what you expected, what you got, and why this is wrong. Diffs are welcome, but they only describe a solution, from which the problem might be uneasy to infer. + +======================================================================== + +Copyright (C) 2000, 2005, 2006 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, with no Front-Cover Texts, and with no Back-Cover +Texts. A copy of the license is included in the ``GNU Free +Documentation License'' file as part of this distribution. diff -ruNp m4-1.4.5/THANKS m4-1.4.6/THANKS --- m4-1.4.5/THANKS 2006-07-07 22:40:38.000000000 -0600 +++ m4-1.4.6/THANKS 2006-08-21 19:51:21.000000000 -0600 @@ -22,7 +22,9 @@ Bob Badour bob@badour.net Brendan Kehoe brendan@cygnus.com Bruno Haible bruno@clisp.org Damian Menscher menscher@uiuc.edu +Dan Jacobson jidanni@jidanni.org David J. MacKenzie djm@uunet.uu.net +David Perlin davep@nanosoft.com Erez Zadok ezk@cs.columbia.edu Eric Allman eric@cs.berkeley.edu Eric Backus ericb@lsid.hp.com @@ -47,6 +49,7 @@ John Gatewood Ham zappaman@buraphalinux. Josef T. Burger bolo@bolo.com Joseph E. Sacco jsacco@ssl.com 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 Kristine Lund lund@lpnaxp.in2p3.fr @@ -59,7 +62,9 @@ Michael Fetterman mafetter@ichips.intel. Michael L. Welcome welcome@bigbird.llnl.gov Mike Frysinger vapier@gentoo.org Mike Lijewski lijewski@theory.tc.cornell.edu +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 Misch noah@cs.caltech.edu @@ -69,6 +74,7 @@ Pierre Gaumond gaumondp@ere.umontreal.c Pierre Mathieu mathieu@geod.emr.ca Ralf Wildenhues Ralf.Wildenhues@gmx.de RenĂ© Seindal seindal@diku.dk +Richard A Nelson cowboy@vnet.ibm.com Richard Stallman rms@gnu.org Robert Bernstein rocky@panix.com Robert Bihlmeyer robbe@orcus.priv.at @@ -81,6 +87,7 @@ Skip Montanaro skip@automatrix.com Stepan Kasal kasal@ucw.cz Stephen Perkins perkins@cps.msu.edu Steve Williamson willy@uinpla.npl.uiuc.edu +Steven Augart saugart@yahoo.com Thorsten Ohl ohl@physics.harvard.edu Tom McConnell tmcconne@sedona.intel.com Tom Quinn trq@dionysos.thphys.ox.ac.uk @@ -90,3 +97,18 @@ Vern Paxson vern@ee.lbl.gov Vincent Lonngren Vincent.lonngren.759@student.lu.se Vivek P. Singhal singhal@cs.utexas.edu Walter Wong wcw+@cmu.edu + +======================================================================== + +Local Variables: +coding: utf-8 +End: + +Copyright (C) 2000, 2006 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, with no Front-Cover Texts, and with no Back-Cover +Texts. A copy of the license is included in the ``GNU Free +Documentation License'' file as part of this distribution. diff -ruNp m4-1.4.5/TODO m4-1.4.6/TODO --- m4-1.4.5/TODO 2006-07-14 13:47:17.000000000 -0600 +++ m4-1.4.6/TODO 2006-08-21 19:52:29.000000000 -0600 @@ -33,3 +33,12 @@ Local Variables: mode: outline outline-regexp: " *[-+*.] \\| " End: + +Copyright (C) 2000, 2006 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, with no Front-Cover Texts, and with no Back-Cover +Texts. A copy of the license is included in the ``GNU Free +Documentation License'' file as part of this distribution. diff -ruNp m4-1.4.5/aclocal.m4 m4-1.4.6/aclocal.m4 --- m4-1.4.5/aclocal.m4 2006-07-15 16:23:57.000000000 -0600 +++ m4-1.4.6/aclocal.m4 2006-08-24 11:46:46.000000000 -0600 @@ -850,11 +850,15 @@ AC_SUBST([am__untar]) m4_include([m4/absolute-header.m4]) m4_include([m4/alloca.m4]) +m4_include([m4/cloexec.m4]) +m4_include([m4/close-stream.m4]) m4_include([m4/codeset.m4]) m4_include([m4/eoverflow.m4]) m4_include([m4/error.m4]) m4_include([m4/exitfail.m4]) m4_include([m4/extensions.m4]) +m4_include([m4/fpending.m4]) +m4_include([m4/free.m4]) m4_include([m4/getopt.m4]) m4_include([m4/gnulib-comp.m4]) m4_include([m4/intmax_t.m4]) @@ -866,22 +870,23 @@ m4_include([m4/mbiter.m4]) m4_include([m4/mbrtowc.m4]) m4_include([m4/memchr.m4]) m4_include([m4/mkstemp.m4]) -m4_include([m4/obstack.m4]) m4_include([m4/regex.m4]) -m4_include([m4/restrict.m4]) m4_include([m4/signed.m4]) m4_include([m4/size_max.m4]) m4_include([m4/ssize_t.m4]) m4_include([m4/stat-macros.m4]) m4_include([m4/stdarg.m4]) m4_include([m4/stdbool.m4]) +m4_include([m4/stdint.m4]) m4_include([m4/stdint_h.m4]) +m4_include([m4/stdio-safer.m4]) +m4_include([m4/stdlib-safer.m4]) m4_include([m4/strcase.m4]) m4_include([m4/strtol.m4]) m4_include([m4/sys_stat_h.m4]) -m4_include([m4/uintmax_t.m4]) -m4_include([m4/ulonglong.m4]) +m4_include([m4/unistd-safer.m4]) m4_include([m4/unistd_h.m4]) +m4_include([m4/unlocked-io.m4]) m4_include([m4/vasnprintf.m4]) m4_include([m4/vasprintf.m4]) m4_include([m4/wchar_t.m4]) diff -ruNp m4-1.4.5/checks/001.comments m4-1.4.6/checks/001.comments --- m4-1.4.5/checks/001.comments 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/001.comments 2006-08-24 12:08:25.000000000 -0600 @@ -1,4 +1,9 @@ -dnl @ ../doc/m4.texinfo:772: Origin of test +dnl @ ../doc/m4.texinfo:774: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. `quoted text' # `commented text' dnl @result{}quoted text # `commented text' `quoting inhibits' `#' `comments' diff -ruNp m4-1.4.5/checks/002.inhibiting m4-1.4.6/checks/002.inhibiting --- m4-1.4.5/checks/002.inhibiting 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/002.inhibiting 2006-08-24 12:08:25.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:982: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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', `substr(ab') +dnl @result{} +define(`y', `cde, `3', `2')') +dnl @result{} +x`'y +dnl @result{}de diff -ruNp m4-1.4.5/checks/002.inhibiting_ m4-1.4.6/checks/002.inhibiting_ --- m4-1.4.5/checks/002.inhibiting_ 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/002.inhibiting_ 1969-12-31 17:00:00.000000000 -0700 @@ -1,7 +0,0 @@ -dnl @ ../doc/m4.texinfo:953: Origin of test -define(`x', `substr(ab') -dnl @result{} -define(`y', `cde, `3', `2')') -dnl @result{} -x`'y -dnl @result{}de diff -ruNp m4-1.4.5/checks/003.inhibiting m4-1.4.6/checks/003.inhibiting --- m4-1.4.5/checks/003.inhibiting 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/003.inhibiting 2006-08-24 12:08:25.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:995: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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', `m') +dnl @result{} +macro(`m')macro +dnl @result{}mmacro +macro(`m')`'macro +dnl @result{}mm diff -ruNp m4-1.4.5/checks/003.inhibiting_ m4-1.4.6/checks/003.inhibiting_ --- m4-1.4.5/checks/003.inhibiting_ 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/003.inhibiting_ 1969-12-31 17:00:00.000000000 -0700 @@ -1,7 +0,0 @@ -dnl @ ../doc/m4.texinfo:966: Origin of test -define(`macro', `m') -dnl @result{} -macro(`m')macro -dnl @result{}mmacro -macro(`m')`'macro -dnl @result{}mm diff -ruNp m4-1.4.5/checks/004.inhibiting m4-1.4.6/checks/004.inhibiting --- m4-1.4.5/checks/004.inhibiting 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/004.inhibiting 2006-08-24 12:08:25.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:1007: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/004.inhibiting_ m4-1.4.6/checks/004.inhibiting_ --- m4-1.4.5/checks/004.inhibiting_ 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/004.inhibiting_ 1969-12-31 17:00:00.000000000 -0700 @@ -1,7 +0,0 @@ -dnl @ ../doc/m4.texinfo:978: Origin of test -define(`macro', `di$1') -dnl @result{} -macro(`v')`ert' -dnl @result{}divert -macro(`v')ert -dnl @result{} diff -ruNp m4-1.4.5/checks/005.macro_argu m4-1.4.6/checks/005.macro_argu --- m4-1.4.5/checks/005.macro_argu 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/005.macro_argu 2006-08-24 12:08:25.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:1061: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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 +f +dnl @result{}2 diff -ruNp m4-1.4.5/checks/005.macro_argum m4-1.4.6/checks/005.macro_argum --- m4-1.4.5/checks/005.macro_argum 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/005.macro_argum 1969-12-31 17:00:00.000000000 -0700 @@ -1,7 +0,0 @@ -dnl @ ../doc/m4.texinfo:1031: Origin of test -define(`f', `1') -dnl @result{} -f(define(`f', `2')) -dnl @result{}1 -f -dnl @result{}2 diff -ruNp m4-1.4.5/checks/006.define m4-1.4.6/checks/006.define --- m4-1.4.5/checks/006.define 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/006.define 1969-12-31 17:00:00.000000000 -0700 @@ -1,5 +0,0 @@ -dnl @ ../doc/m4.texinfo:1139: Origin of test -define(`foo', `Hello world.') -dnl @result{} -foo -dnl @result{}Hello world. diff -ruNp m4-1.4.5/checks/006.macro_argu m4-1.4.6/checks/006.macro_argu --- m4-1.4.5/checks/006.macro_argu 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/006.macro_argu 2006-08-24 12:08:25.000000000 -0600 @@ -0,0 +1,8 @@ +dnl @ ../doc/m4.texinfo:1072: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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( +dnl @error{}m4:stdin:1: ERROR: end of file in argument list diff -ruNp m4-1.4.5/checks/007.define m4-1.4.6/checks/007.define --- m4-1.4.5/checks/007.define 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/007.define 2006-08-24 12:08:25.000000000 -0600 @@ -1,7 +1,10 @@ -dnl @ ../doc/m4.texinfo:1156: Origin of test -define(foo, one) +dnl @ ../doc/m4.texinfo:1177: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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(foo, two) -dnl @result{} -one -dnl @result{}two +foo +dnl @result{}Hello world. diff -ruNp m4-1.4.5/checks/008.define m4-1.4.6/checks/008.define --- m4-1.4.5/checks/008.define 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/008.define 2006-08-24 12:08:25.000000000 -0600 @@ -1,13 +1,12 @@ -dnl @ ../doc/m4.texinfo:1175: Origin of test -define(`array', `defn(format(``array[%d]'', `$1'))') +dnl @ ../doc/m4.texinfo:1194: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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(`array_set', `define(format(``array[%d]'', `$1'), `$2')') +define(foo, two) 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 +one +dnl @result{}two diff -ruNp m4-1.4.5/checks/009.arguments m4-1.4.6/checks/009.arguments --- m4-1.4.5/checks/009.arguments 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/009.arguments 1969-12-31 17:00:00.000000000 -0700 @@ -1,5 +0,0 @@ -dnl @ ../doc/m4.texinfo:1204: Origin of test -define(`exch', `$2, $1') -dnl @result{} -exch(`arg1', `arg2') -dnl @result{}arg2, arg1 diff -ruNp m4-1.4.5/checks/009.define m4-1.4.6/checks/009.define --- m4-1.4.5/checks/009.define 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/009.define 2006-08-24 12:08:25.000000000 -0600 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:1213: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/010.arguments m4-1.4.6/checks/010.arguments --- m4-1.4.5/checks/010.arguments 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/010.arguments 2006-08-24 12:08:25.000000000 -0600 @@ -1,7 +1,10 @@ -dnl @ ../doc/m4.texinfo:1214: Origin of test +dnl @ ../doc/m4.texinfo:1242: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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 +exch(`arg1', `arg2') +dnl @result{}arg2, arg1 diff -ruNp m4-1.4.5/checks/011.arguments m4-1.4.6/checks/011.arguments --- m4-1.4.5/checks/011.arguments 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/011.arguments 2006-08-24 12:08:26.000000000 -0600 @@ -1,5 +1,12 @@ -dnl @ ../doc/m4.texinfo:1234: Origin of test -define(`test', ``Macro name: $0'') +dnl @ ../doc/m4.texinfo:1252: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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{} -test -dnl @result{}Macro name: test +define(exch(``expansion text'', ``macro'')) +dnl @result{} +macro +dnl @result{}expansion text diff -ruNp m4-1.4.5/checks/012.arguments m4-1.4.6/checks/012.arguments --- m4-1.4.5/checks/012.arguments 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/012.arguments 2006-08-24 12:08:26.000000000 -0600 @@ -1,5 +1,10 @@ -dnl @ ../doc/m4.texinfo:1244: Origin of test -define(`foo', `This is macro `foo'.') +dnl @ ../doc/m4.texinfo:1275: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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(`test', ``Macro name: $0'') dnl @result{} -foo -dnl @result{}This is macro foo. +test +dnl @result{}Macro name: test diff -ruNp m4-1.4.5/checks/013.arguments m4-1.4.6/checks/013.arguments --- m4-1.4.5/checks/013.arguments 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/013.arguments 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,10 @@ +dnl @ ../doc/m4.texinfo:1285: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/013.pseudo_argu m4-1.4.6/checks/013.pseudo_argu --- m4-1.4.5/checks/013.pseudo_argu 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/013.pseudo_argu 1969-12-31 17:00:00.000000000 -0700 @@ -1,16 +0,0 @@ -dnl @ ../doc/m4.texinfo:1268: Origin of test -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.5/checks/014.pseudo_arg m4-1.4.6/checks/014.pseudo_arg --- m4-1.4.5/checks/014.pseudo_arg 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/014.pseudo_arg 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,21 @@ +dnl @ ../doc/m4.texinfo:1309: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/014.pseudo_argu m4-1.4.6/checks/014.pseudo_argu --- m4-1.4.5/checks/014.pseudo_argu 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/014.pseudo_argu 1969-12-31 17:00:00.000000000 -0700 @@ -1,5 +0,0 @@ -dnl @ ../doc/m4.texinfo:1289: Origin of test -define(`echo', `$*') -dnl @result{} -echo(arg1, arg2, arg3 , arg4) -dnl @result{}arg1,arg2,arg3 ,arg4 diff -ruNp m4-1.4.5/checks/015.pseudo_arg m4-1.4.6/checks/015.pseudo_arg --- m4-1.4.5/checks/015.pseudo_arg 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/015.pseudo_arg 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,10 @@ +dnl @ ../doc/m4.texinfo:1330: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/015.pseudo_argu m4-1.4.6/checks/015.pseudo_argu --- m4-1.4.5/checks/015.pseudo_argu 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/015.pseudo_argu 1969-12-31 17:00:00.000000000 -0700 @@ -1,5 +0,0 @@ -dnl @ ../doc/m4.texinfo:1300: Origin of test -define(`echo', `$@') -dnl @result{} -echo(arg1, arg2, arg3 , arg4) -dnl @result{}arg1,arg2,arg3 ,arg4 diff -ruNp m4-1.4.5/checks/016.pseudo_arg m4-1.4.6/checks/016.pseudo_arg --- m4-1.4.5/checks/016.pseudo_arg 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/016.pseudo_arg 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,10 @@ +dnl @ ../doc/m4.texinfo:1341: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/016.pseudo_argu m4-1.4.6/checks/016.pseudo_argu --- m4-1.4.5/checks/016.pseudo_argu 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/016.pseudo_argu 1969-12-31 17:00:00.000000000 -0700 @@ -1,15 +0,0 @@ -dnl @ ../doc/m4.texinfo:1310: Origin of test -define(`echo1', `$*') -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 diff -ruNp m4-1.4.5/checks/017.pseudo_arg m4-1.4.6/checks/017.pseudo_arg --- m4-1.4.5/checks/017.pseudo_arg 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/017.pseudo_arg 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,20 @@ +dnl @ ../doc/m4.texinfo:1351: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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', `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 diff -ruNp m4-1.4.5/checks/017.pseudo_argu m4-1.4.6/checks/017.pseudo_argu --- m4-1.4.5/checks/017.pseudo_argu 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/017.pseudo_argu 1969-12-31 17:00:00.000000000 -0700 @@ -1,15 +0,0 @@ -dnl @ ../doc/m4.texinfo:1332: Origin of test -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.5/checks/018.pseudo_arg m4-1.4.6/checks/018.pseudo_arg --- m4-1.4.5/checks/018.pseudo_arg 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/018.pseudo_arg 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,20 @@ +dnl @ ../doc/m4.texinfo:1373: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/018.pseudo_argu m4-1.4.6/checks/018.pseudo_argu --- m4-1.4.5/checks/018.pseudo_argu 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/018.pseudo_argu 1969-12-31 17:00:00.000000000 -0700 @@ -1,5 +0,0 @@ -dnl @ ../doc/m4.texinfo:1353: Origin of test -define(`foo', `$$$ hello $$$') -dnl @result{} -foo -dnl @result{}$$$ hello $$$ diff -ruNp m4-1.4.5/checks/019.pseudo_arg m4-1.4.6/checks/019.pseudo_arg --- m4-1.4.5/checks/019.pseudo_arg 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/019.pseudo_arg 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,10 @@ +dnl @ ../doc/m4.texinfo:1394: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/019.undefine m4-1.4.6/checks/019.undefine --- m4-1.4.5/checks/019.undefine 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/019.undefine 1969-12-31 17:00:00.000000000 -0700 @@ -1,15 +0,0 @@ -dnl @ ../doc/m4.texinfo:1380: Origin of test -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.5/checks/020.undefine m4-1.4.6/checks/020.undefine --- m4-1.4.5/checks/020.undefine 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/020.undefine 2006-08-24 12:08:26.000000000 -0600 @@ -1,7 +1,20 @@ -dnl @ ../doc/m4.texinfo:1400: Origin of test -define(`f', ``$0':$1') +dnl @ ../doc/m4.texinfo:1421: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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{} -f(f(f(undefine(`f')`hello world'))) -dnl @result{}f:f:f:hello world -f(`bye') -dnl @result{}f(bye) +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.5/checks/021.defn m4-1.4.6/checks/021.defn --- m4-1.4.5/checks/021.defn 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/021.defn 1969-12-31 17:00:00.000000000 -0700 @@ -1,7 +0,0 @@ -dnl @ ../doc/m4.texinfo:1436: Origin of test -define(`zap', defn(`undefine')) -dnl @result{} -zap(`undefine') -dnl @result{} -undefine(`zap') -dnl @result{}undefine(zap) diff -ruNp m4-1.4.5/checks/021.undefine m4-1.4.6/checks/021.undefine --- m4-1.4.5/checks/021.undefine 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/021.undefine 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:1441: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/022.defn m4-1.4.6/checks/022.defn --- m4-1.4.5/checks/022.defn 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/022.defn 2006-08-24 12:08:26.000000000 -0600 @@ -1,7 +1,12 @@ -dnl @ ../doc/m4.texinfo:1453: Origin of test -define(`foo', `This is `$0'') +dnl @ ../doc/m4.texinfo:1477: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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{} -define(`bar', defn(`foo')) +zap(`undefine') dnl @result{} -bar -dnl @result{}This is bar +undefine(`zap') +dnl @result{}undefine(zap) diff -ruNp m4-1.4.5/checks/023.defn m4-1.4.6/checks/023.defn --- m4-1.4.5/checks/023.defn 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/023.defn 2006-08-24 12:08:26.000000000 -0600 @@ -1,9 +1,12 @@ -dnl @ ../doc/m4.texinfo:1465: Origin of test -define(`string', `The macro dnl is very useful -') +dnl @ ../doc/m4.texinfo:1494: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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{} -string -dnl @result{}The macro -defn(`string') -dnl @result{}The macro dnl is very useful +define(`bar', defn(`foo')) dnl @result{} +bar +dnl @result{}This is bar diff -ruNp m4-1.4.5/checks/024.defn m4-1.4.6/checks/024.defn --- m4-1.4.5/checks/024.defn 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/024.defn 2006-08-24 12:08:26.000000000 -0600 @@ -1,13 +1,14 @@ -dnl @ ../doc/m4.texinfo:1483: Origin of test -define(`foo', a'a) +dnl @ ../doc/m4.texinfo:1506: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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{} -define(`a', `A') +string +dnl @result{}The macro +defn(`string') +dnl @result{}The macro dnl is very useful 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.5/checks/025.defn m4-1.4.6/checks/025.defn --- m4-1.4.5/checks/025.defn 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/025.defn 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:1524: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/025.pushdef m4-1.4.6/checks/025.pushdef --- m4-1.4.5/checks/025.pushdef 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/025.pushdef 1969-12-31 17:00:00.000000000 -0700 @@ -1,25 +0,0 @@ -dnl @ ../doc/m4.texinfo:1527: Origin of test -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.5/checks/026.pushdef m4-1.4.6/checks/026.pushdef --- m4-1.4.5/checks/026.pushdef 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/026.pushdef 2006-08-24 12:08:26.000000000 -0600 @@ -1,4 +1,9 @@ -dnl @ ../doc/m4.texinfo:1559: Origin of test +dnl @ ../doc/m4.texinfo:1568: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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 @@ -7,11 +12,19 @@ pushdef(`foo', `Expansion two.') dnl @result{} foo dnl @result{}Expansion two. -define(`foo', `Second expansion two.') +pushdef(`foo', `Expansion three.') +dnl @result{} +pushdef(`foo', `Expansion four.') +dnl @result{} +popdef(`foo') dnl @result{} foo -dnl @result{}Second expansion two. -undefine(`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.5/checks/027.indir m4-1.4.6/checks/027.indir --- m4-1.4.5/checks/027.indir 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/027.indir 1969-12-31 17:00:00.000000000 -0700 @@ -1,7 +0,0 @@ -dnl @ ../doc/m4.texinfo:1608: Origin of test -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.5/checks/027.pushdef m4-1.4.6/checks/027.pushdef --- m4-1.4.5/checks/027.pushdef 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/027.pushdef 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,22 @@ +dnl @ ../doc/m4.texinfo:1600: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/028.builtin m4-1.4.6/checks/028.builtin --- m4-1.4.5/checks/028.builtin 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/028.builtin 1969-12-31 17:00:00.000000000 -0700 @@ -1,21 +0,0 @@ -dnl @ ../doc/m4.texinfo:1642: Origin of test -pushdef(`define', `hidden') -dnl @result{} -undefine(`undefine') -dnl @result{} -define(`foo', `bar') -dnl @result{}hidden -foo -dnl @result{}foo -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.5/checks/028.indir m4-1.4.6/checks/028.indir --- m4-1.4.5/checks/028.indir 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/028.indir 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:1649: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/029.builtin m4-1.4.6/checks/029.builtin --- m4-1.4.5/checks/029.builtin 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/029.builtin 2006-08-24 12:08:26.000000000 -0600 @@ -1,12 +1,26 @@ -dnl @ ../doc/m4.texinfo:1669: Origin of test -builtin -dnl @result{}builtin -builtin() -dnl @error{}stdin:2: m4: undefined builtin `' +dnl @ ../doc/m4.texinfo:1683: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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{} -builtin(`builtin') -dnl @error{}stdin:3: m4: Warning: too few arguments to builtin `builtin' +undefine(`undefine') dnl @result{} -builtin(`builtin',) -dnl @error{}stdin:4: m4: undefined builtin `' +define(`foo', `bar') +dnl @result{}hidden +foo +dnl @result{}foo +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.5/checks/030.builtin m4-1.4.6/checks/030.builtin --- m4-1.4.5/checks/030.builtin 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/030.builtin 2006-08-24 12:08:26.000000000 -0600 @@ -1,21 +1,17 @@ -dnl @ ../doc/m4.texinfo:1687: Origin of test -pushdef(`define', `hidden') +dnl @ ../doc/m4.texinfo:1710: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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{} -undefine(`undefine') +builtin(`builtin') +dnl @error{}m4:stdin:3: Warning: too few arguments to builtin `builtin' dnl @result{} -define(`foo', `bar') -dnl @result{}hidden -foo -dnl @result{}foo -builtin(`define', `foo', `BAR') +builtin(`builtin',) +dnl @error{}m4:stdin:4: undefined builtin `' 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.5/checks/031.builtin m4-1.4.6/checks/031.builtin --- m4-1.4.5/checks/031.builtin 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/031.builtin 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -dnl @ ../doc/m4.texinfo:1714: Origin of test -builtin -dnl @result{}builtin -builtin() -dnl @error{}stdin:2: m4: undefined builtin `' -dnl @result{} -builtin(`builtin') -dnl @error{}stdin:3: m4: Warning: too few arguments to builtin `builtin' -dnl @result{} -builtin(`builtin',) -dnl @error{}stdin:4: m4: undefined builtin `' -dnl @result{} diff -ruNp m4-1.4.5/checks/031.ifdef m4-1.4.6/checks/031.ifdef --- m4-1.4.5/checks/031.ifdef 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/031.ifdef 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,15 @@ +dnl @ ../doc/m4.texinfo:1755: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/032.ifdef m4-1.4.6/checks/032.ifdef --- m4-1.4.5/checks/032.ifdef 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/032.ifdef 1969-12-31 17:00:00.000000000 -0700 @@ -1,10 +0,0 @@ -dnl @ ../doc/m4.texinfo:1759: Origin of test -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{}stdin:4: m4: Warning: excess arguments to builtin `ifdef' ignored -dnl @result{}no diff -ruNp m4-1.4.5/checks/032.ifelse m4-1.4.6/checks/032.ifelse --- m4-1.4.5/checks/032.ifelse 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/032.ifelse 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,11 @@ +dnl @ ../doc/m4.texinfo:1800: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/033.ifelse m4-1.4.6/checks/033.ifelse --- m4-1.4.5/checks/033.ifelse 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/033.ifelse 2006-08-24 12:08:26.000000000 -0600 @@ -1,6 +1,16 @@ -dnl @ ../doc/m4.texinfo:1804: Origin of test -ifelse(`some comments') +dnl @ ../doc/m4.texinfo:1810: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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', `bar') -dnl @error{}stdin:2: m4: Warning: too few arguments to builtin `ifelse' +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.5/checks/034.ifelse m4-1.4.6/checks/034.ifelse --- m4-1.4.5/checks/034.ifelse 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/034.ifelse 2006-08-24 12:08:26.000000000 -0600 @@ -1,11 +1,14 @@ -dnl @ ../doc/m4.texinfo:1814: Origin of test -ifelse(`foo', `bar', `true') +dnl @ ../doc/m4.texinfo:1828: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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{} -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 +foo +dnl @result{}foo +foo() +dnl @result{}arguments:1 +foo(`a', `b', `c') +dnl @result{}arguments:3 diff -ruNp m4-1.4.5/checks/035.ifelse m4-1.4.6/checks/035.ifelse --- m4-1.4.5/checks/035.ifelse 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/035.ifelse 2006-08-24 12:08:26.000000000 -0600 @@ -1,9 +1,8 @@ -dnl @ ../doc/m4.texinfo:1832: Origin of test -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 +dnl @ ../doc/m4.texinfo:1847: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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', `sixth', `seventh') +dnl @result{}seventh diff -ruNp m4-1.4.5/checks/036.ifelse m4-1.4.6/checks/036.ifelse --- m4-1.4.5/checks/036.ifelse 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/036.ifelse 1969-12-31 17:00:00.000000000 -0700 @@ -1,3 +0,0 @@ -dnl @ ../doc/m4.texinfo:1851: Origin of test -ifelse(`foo', `bar', `third', `gnu', `gnats', `sixth', `seventh') -dnl @result{}seventh diff -ruNp m4-1.4.5/checks/036.loops m4-1.4.6/checks/036.loops --- m4-1.4.5/checks/036.loops 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/036.loops 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:1879: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/037.loops m4-1.4.6/checks/037.loops --- m4-1.4.5/checks/037.loops 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/037.loops 2006-08-24 12:08:26.000000000 -0600 @@ -1,7 +1,15 @@ -dnl @ ../doc/m4.texinfo:1881: Origin of test -shift +dnl @ ../doc/m4.texinfo:1896: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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{} -shift(`bar') +reverse dnl @result{} -shift(`foo', `bar', `baz') -dnl @result{}bar,baz +reverse(`foo') +dnl @result{}foo +reverse(`foo', `bar', `gnats', `and gnus') +dnl @result{}and gnus, gnats, bar, foo diff -ruNp m4-1.4.5/checks/038.loops m4-1.4.6/checks/038.loops --- m4-1.4.5/checks/038.loops 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/038.loops 2006-08-24 12:08:26.000000000 -0600 @@ -1,10 +1,10 @@ -dnl @ ../doc/m4.texinfo:1898: Origin of test -define(`reverse', `ifelse(`$#', `0', , `$#', `1', ``$1'', - `reverse(shift($@)), `$1'')') +dnl @ ../doc/m4.texinfo:1927: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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{} -reverse -dnl @result{} -reverse(`foo') -dnl @result{}foo -reverse(`foo', `bar', `gnats', `and gnus') -dnl @result{}and gnus, gnats, bar, foo +forloop(`i', `1', `8', `i ') +dnl @result{}1 2 3 4 5 6 7 8 diff -ruNp m4-1.4.5/checks/039.loops m4-1.4.6/checks/039.loops --- m4-1.4.5/checks/039.loops 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/039.loops 2006-08-24 12:08:26.000000000 -0600 @@ -1,5 +1,15 @@ -dnl @ ../doc/m4.texinfo:1929: Origin of test +dnl @ ../doc/m4.texinfo:1936: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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 +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.5/checks/040.loops m4-1.4.6/checks/040.loops --- m4-1.4.5/checks/040.loops 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/040.loops 2006-08-24 12:08:26.000000000 -0600 @@ -1,10 +1,16 @@ -dnl @ ../doc/m4.texinfo:1938: Origin of test -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 @ ../doc/m4.texinfo:1962: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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 @result{}divert(`-1') +dnl @result{}# forloop(var, from, to, stmt) +dnl @result{}define(`forloop', +dnl @result{} `pushdef(`$1', `$2')_forloop(`$1', `$2', `$3', `$4')popdef(`$1')') +dnl @result{}define(`_forloop', +dnl @result{} `$4`'ifelse($1, `$3', , +dnl @result{} `define(`$1', incr($1))_forloop(`$1', `$2', `$3', `$4')')') +dnl @result{}divert`'dnl dnl @result{} diff -ruNp m4-1.4.5/checks/041.dumpdef m4-1.4.6/checks/041.dumpdef --- m4-1.4.5/checks/041.dumpdef 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/041.dumpdef 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:2018: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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: +dnl @result{} diff -ruNp m4-1.4.5/checks/041.loops m4-1.4.6/checks/041.loops --- m4-1.4.5/checks/041.loops 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/041.loops 1969-12-31 17:00:00.000000000 -0700 @@ -1,11 +0,0 @@ -dnl @ ../doc/m4.texinfo:1964: Origin of test -undivert(`forloop.m4') -dnl @result{}divert(`-1') -dnl @result{}# forloop(var, from, to, stmt) -dnl @result{}define(`forloop', -dnl @result{} `pushdef(`$1', `$2')_forloop(`$1', `$2', `$3', `$4')popdef(`$1')') -dnl @result{}define(`_forloop', -dnl @result{} `$4`'ifelse($1, `$3', , -dnl @result{} `define(`$1', incr($1))_forloop(`$1', `$2', `$3', `$4')')') -dnl @result{}divert`'dnl -dnl @result{} diff -ruNp m4-1.4.5/checks/042.dumpdef m4-1.4.6/checks/042.dumpdef --- m4-1.4.5/checks/042.dumpdef 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/042.dumpdef 2006-08-24 12:08:26.000000000 -0600 @@ -1,9 +1,14 @@ -dnl @ ../doc/m4.texinfo:2020: Origin of test -define(`foo', `Hello world.') -dnl @result{} -dumpdef(`foo') -dnl @error{}foo: `Hello world.' -dnl @result{} -dumpdef(`define') -dnl @error{}define: +dnl @ ../doc/m4.texinfo:2034: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/043.dumpdef m4-1.4.6/checks/043.dumpdef --- m4-1.4.5/checks/043.dumpdef 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/043.dumpdef 1969-12-31 17:00:00.000000000 -0700 @@ -1,9 +0,0 @@ -dnl @ ../doc/m4.texinfo:2036: Origin of test -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{}stdin:3: m4: undefined macro `f' -dnl @result{}f1 diff -ruNp m4-1.4.5/checks/043.trace m4-1.4.6/checks/043.trace --- m4-1.4.5/checks/043.trace 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/043.trace 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:2072: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/044.trace m4-1.4.6/checks/044.trace --- m4-1.4.5/checks/044.trace 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/044.trace 2006-08-24 12:08:26.000000000 -0600 @@ -1,13 +1,33 @@ -dnl @ ../doc/m4.texinfo:2074: Origin of test -define(`foo', `Hello World.') +dnl @ ../doc/m4.texinfo:2097: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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{} -define(`echo', `$@') +traceon(`foo') dnl @result{} -traceon(`foo', `echo') +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 @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 +dnl @result{}blah diff -ruNp m4-1.4.5/checks/045.trace m4-1.4.6/checks/045.trace --- m4-1.4.5/checks/045.trace 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/045.trace 2006-08-24 12:08:26.000000000 -0600 @@ -1,28 +1,18 @@ -dnl @ ../doc/m4.texinfo:2099: Origin of test -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{}stdin:8: m4: 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 +dnl @ ../doc/m4.texinfo:2130: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/046.debug_leve m4-1.4.6/checks/046.debug_leve --- m4-1.4.5/checks/046.debug_leve 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/046.debug_leve 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,25 @@ +dnl @ ../doc/m4.texinfo:2225: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/046.trace m4-1.4.6/checks/046.trace --- m4-1.4.5/checks/046.trace 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/046.trace 1969-12-31 17:00:00.000000000 -0700 @@ -1,13 +0,0 @@ -dnl @ ../doc/m4.texinfo:2132: Origin of test -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.5/checks/047.debug_level m4-1.4.6/checks/047.debug_level --- m4-1.4.5/checks/047.debug_level 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/047.debug_level 1969-12-31 17:00:00.000000000 -0700 @@ -1,20 +0,0 @@ -dnl @ ../doc/m4.texinfo:2226: Origin of test -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.5/checks/047.debug_outp m4-1.4.6/checks/047.debug_outp --- m4-1.4.5/checks/047.debug_outp 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/047.debug_outp 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,22 @@ +dnl @ ../doc/m4.texinfo:2270: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/048.debug_outpu m4-1.4.6/checks/048.debug_outpu --- m4-1.4.5/checks/048.debug_outpu 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/048.debug_outpu 1969-12-31 17:00:00.000000000 -0700 @@ -1,17 +0,0 @@ -dnl @ ../doc/m4.texinfo:2269: Origin of test -traceon(`divnum') -dnl @result{} -divnum(`extra') -dnl @error{}stdin:2: m4: Warning: excess arguments to builtin `divnum' ignored -dnl @error{}m4trace: -1- divnum(`extra') -> `0' -dnl @result{}0 -debugfile() -dnl @result{} -divnum(`extra') -dnl @error{}stdin:4: m4: 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.5/checks/048.dnl m4-1.4.6/checks/048.dnl --- m4-1.4.5/checks/048.dnl 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/048.dnl 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,9 @@ +dnl @ ../doc/m4.texinfo:2319: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/049.dnl m4-1.4.6/checks/049.dnl --- m4-1.4.5/checks/049.dnl 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/049.dnl 2006-08-24 12:08:26.000000000 -0600 @@ -1,4 +1,11 @@ -dnl @ ../doc/m4.texinfo:2318: Origin of test -define(`foo', `Macro `foo'.')dnl A very simple macro, indeed. -foo -dnl @result{}Macro foo. +dnl @ ../doc/m4.texinfo:2337: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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:2: 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.5/checks/050.dnl m4-1.4.6/checks/050.dnl --- m4-1.4.5/checks/050.dnl 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/050.dnl 2006-08-24 12:08:26.000000000 -0600 @@ -1,6 +1,13 @@ -dnl @ ../doc/m4.texinfo:2336: Origin of test -dnl(`args are ignored, but side effects occur', -define(`foo', `like this')) while this text is ignored: undefine(`foo') -dnl @error{}stdin:2: m4: Warning: excess arguments to builtin `dnl' ignored -See how `foo' was defined, foo? -dnl @result{}See how foo was defined, like this? +dnl @ ../doc/m4.texinfo:2348: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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{} +m4wrap(`m4wrap(`2 hi +')0 hi dnl 1 hi') +dnl @result{} +dnl @error{}m4: Warning: end of file treated as newline +dnl @result{}0 HI 2 HI diff -ruNp m4-1.4.5/checks/051.changequot m4-1.4.6/checks/051.changequot --- m4-1.4.5/checks/051.changequot 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/051.changequot 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:2377: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/051.changequote m4-1.4.6/checks/051.changequote --- m4-1.4.5/checks/051.changequote 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/051.changequote 1969-12-31 17:00:00.000000000 -0700 @@ -1,7 +0,0 @@ -dnl @ ../doc/m4.texinfo:2362: Origin of test -changequote(`[', `]') -dnl @result{} -define([foo], [Macro [foo].]) -dnl @result{} -foo -dnl @result{}Macro foo. diff -ruNp m4-1.4.5/checks/052.changequot m4-1.4.6/checks/052.changequot --- m4-1.4.5/checks/052.changequot 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/052.changequot 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:2392: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/052.changequote m4-1.4.6/checks/052.changequote --- m4-1.4.5/checks/052.changequote 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/052.changequote 1969-12-31 17:00:00.000000000 -0700 @@ -1,7 +0,0 @@ -dnl @ ../doc/m4.texinfo:2374: Origin of test -changequote(`[[[', `]]]') -dnl @result{} -define([[[foo]]], [[[Macro [[[[[foo]]]]].]]]) -dnl @result{} -foo -dnl @result{}Macro [[foo]]. diff -ruNp m4-1.4.5/checks/053.changequot m4-1.4.6/checks/053.changequot --- m4-1.4.5/checks/053.changequot 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/053.changequot 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:2406: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/053.changequote m4-1.4.6/checks/053.changequote --- m4-1.4.5/checks/053.changequote 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/053.changequote 1969-12-31 17:00:00.000000000 -0700 @@ -1,9 +0,0 @@ -dnl @ ../doc/m4.texinfo:2386: Origin of test -define(`foo', `Macro `FOO'.') -dnl @result{} -changequote(, ) -dnl @result{} -foo -dnl @result{}Macro `FOO'. -`foo' -dnl @result{}`Macro `FOO'.' diff -ruNp m4-1.4.5/checks/054.changecom m4-1.4.6/checks/054.changecom --- m4-1.4.5/checks/054.changecom 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/054.changecom 1969-12-31 17:00:00.000000000 -0700 @@ -1,11 +0,0 @@ -dnl @ ../doc/m4.texinfo:2432: Origin of test -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.5/checks/054.changequot m4-1.4.6/checks/054.changequot --- m4-1.4.5/checks/054.changequot 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/054.changequot 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:2418: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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'.' diff -ruNp m4-1.4.5/checks/055.changecom m4-1.4.6/checks/055.changecom --- m4-1.4.5/checks/055.changecom 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/055.changecom 1969-12-31 17:00:00.000000000 -0700 @@ -1,11 +0,0 @@ -dnl @ ../doc/m4.texinfo:2455: Origin of test -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.5/checks/055.changequot m4-1.4.6/checks/055.changequot --- m4-1.4.5/checks/055.changequot 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/055.changequot 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:2444: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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(`q', `Q') +dnl @result{} +q hi Q hi +dnl @result{}q HI Q HI +changequote +dnl @result{} +changequote(`-', `EOF') +dnl @result{} +- hi EOF hi +dnl @result{} hi HI diff -ruNp m4-1.4.5/checks/056.changequot m4-1.4.6/checks/056.changequot --- m4-1.4.5/checks/056.changequot 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/056.changequot 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,28 @@ +dnl @ ../doc/m4.texinfo:2465: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/056.changeword m4-1.4.6/checks/056.changeword --- m4-1.4.5/checks/056.changeword 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/056.changeword 1969-12-31 17:00:00.000000000 -0700 @@ -1,7 +0,0 @@ -dnl @ ../doc/m4.texinfo:2510: Origin of test -ifdef(`changeword', `', `m4exit(`77')') -dnl @result{} -changeword(`[_a-zA-Z0-9]+') -dnl @result{} -define(`1', `0')1 -dnl @result{}0 diff -ruNp m4-1.4.5/checks/057.changequot m4-1.4.6/checks/057.changequot --- m4-1.4.5/checks/057.changequot 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/057.changequot 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,24 @@ +dnl @ ../doc/m4.texinfo:2497: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/057.changeword m4-1.4.6/checks/057.changeword --- m4-1.4.5/checks/057.changeword 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/057.changeword 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -dnl @ ../doc/m4.texinfo:2523: Origin of test -ifdef(`changeword', `', `m4exit(`77')') -dnl @result{} -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.5/checks/058.changequot m4-1.4.6/checks/058.changequot --- m4-1.4.5/checks/058.changequot 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/058.changequot 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,8 @@ +dnl @ ../doc/m4.texinfo:2520: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +`dangling quote +dnl @error{}m4:stdin:1: ERROR: end of file in string diff -ruNp m4-1.4.5/checks/058.changeword m4-1.4.6/checks/058.changeword --- m4-1.4.5/checks/058.changeword 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/058.changeword 1969-12-31 17:00:00.000000000 -0700 @@ -1,10 +0,0 @@ -dnl @ ../doc/m4.texinfo:2546: Origin of test -ifdef(`changeword', `', `m4exit(`77')') -dnl @result{} -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.5/checks/059.changecom m4-1.4.6/checks/059.changecom --- m4-1.4.5/checks/059.changecom 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/059.changecom 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:2544: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/059.changeword m4-1.4.6/checks/059.changeword --- m4-1.4.5/checks/059.changeword 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/059.changeword 1969-12-31 17:00:00.000000000 -0700 @@ -1,8 +0,0 @@ -dnl @ ../doc/m4.texinfo:2581: Origin of test -ifdef(`changeword', `', `m4exit(`77')') -dnl @result{} -define(`a', `errprint(`Hello')')dnl -changeword(`@\([_a-zA-Z0-9]*\)') -dnl @result{} -@a -dnl @result{}errprint(Hello) diff -ruNp m4-1.4.5/checks/060.changecom m4-1.4.6/checks/060.changecom --- m4-1.4.5/checks/060.changecom 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/060.changecom 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:2567: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/060.m4wrap m4-1.4.6/checks/060.m4wrap --- m4-1.4.5/checks/060.m4wrap 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/060.m4wrap 1969-12-31 17:00:00.000000000 -0700 @@ -1,9 +0,0 @@ -dnl @ ../doc/m4.texinfo:2631: Origin of test -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.5/checks/061.changecom m4-1.4.6/checks/061.changecom --- m4-1.4.5/checks/061.changecom 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/061.changecom 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:2586: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/061.m4wrap m4-1.4.6/checks/061.m4wrap --- m4-1.4.5/checks/061.m4wrap 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/061.m4wrap 1969-12-31 17:00:00.000000000 -0700 @@ -1,8 +0,0 @@ -dnl @ ../doc/m4.texinfo:2660: Origin of test -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.5/checks/062.changecom m4-1.4.6/checks/062.changecom --- m4-1.4.5/checks/062.changecom 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/062.changecom 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:2605: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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{} +changecom(`q', `Q') +dnl @result{} +q hi Q hi +dnl @result{}q hi Q HI diff -ruNp m4-1.4.5/checks/062.include m4-1.4.6/checks/062.include --- m4-1.4.5/checks/062.include 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/062.include 1969-12-31 17:00:00.000000000 -0700 @@ -1,11 +0,0 @@ -dnl @ ../doc/m4.texinfo:2706: Origin of test -include(`none') -dnl @result{} -dnl @error{}stdin:1: m4: cannot open `none': No such file or directory -include() -dnl @result{} -dnl @error{}stdin:2: m4: cannot open `': No such file or directory -sinclude(`none') -dnl @result{} -sinclude() -dnl @result{} diff -ruNp m4-1.4.5/checks/063.changecom m4-1.4.6/checks/063.changecom --- m4-1.4.5/checks/063.changecom 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/063.changecom 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,26 @@ +dnl @ ../doc/m4.texinfo:2620: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/063.include m4-1.4.6/checks/063.include --- m4-1.4.5/checks/063.include 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/063.include 1969-12-31 17:00:00.000000000 -0700 @@ -1,8 +0,0 @@ -dnl @ ../doc/m4.texinfo:2734: Origin of test -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.5/checks/064.changecom m4-1.4.6/checks/064.changecom --- m4-1.4.5/checks/064.changecom 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/064.changecom 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,10 @@ +dnl @ ../doc/m4.texinfo:2645: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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:1: ERROR: end of file in comment diff -ruNp m4-1.4.5/checks/064.include m4-1.4.6/checks/064.include --- m4-1.4.5/checks/064.include 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/064.include 1969-12-31 17:00:00.000000000 -0700 @@ -1,8 +0,0 @@ -dnl @ ../doc/m4.texinfo:2749: Origin of test -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.5/checks/065.changeword m4-1.4.6/checks/065.changeword --- m4-1.4.5/checks/065.changeword 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/065.changeword 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:2695: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/065.divert m4-1.4.6/checks/065.divert --- m4-1.4.5/checks/065.divert 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/065.divert 1969-12-31 17:00:00.000000000 -0700 @@ -1,9 +0,0 @@ -dnl @ ../doc/m4.texinfo:2830: Origin of test -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.5/checks/066.changeword m4-1.4.6/checks/066.changeword --- m4-1.4.5/checks/066.changeword 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/066.changeword 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,17 @@ +dnl @ ../doc/m4.texinfo:2708: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/066.divert m4-1.4.6/checks/066.divert --- m4-1.4.5/checks/066.divert 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/066.divert 1969-12-31 17:00:00.000000000 -0700 @@ -1,9 +0,0 @@ -dnl @ ../doc/m4.texinfo:2846: Origin of test -define(`text', `TEXT') -dnl @result{} -divert(`1')`diverted text.' -divert -dnl @result{} -m4wrap(`Wrapped text preceeds ') -dnl @result{} -dnl @result{}Wrapped TEXT preceeds diverted text. diff -ruNp m4-1.4.5/checks/067.changeword m4-1.4.6/checks/067.changeword --- m4-1.4.5/checks/067.changeword 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/067.changeword 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,15 @@ +dnl @ ../doc/m4.texinfo:2731: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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 +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.5/checks/067.divert m4-1.4.6/checks/067.divert --- m4-1.4.5/checks/067.divert 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/067.divert 1969-12-31 17:00:00.000000000 -0700 @@ -1,6 +0,0 @@ -dnl @ ../doc/m4.texinfo:2863: Origin of test -divert(`-1') -define(`foo', `Macro `foo'.') -define(`bar', `Macro `bar'.') -divert -dnl @result{} diff -ruNp m4-1.4.5/checks/068.changeword m4-1.4.6/checks/068.changeword --- m4-1.4.5/checks/068.changeword 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/068.changeword 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,13 @@ +dnl @ ../doc/m4.texinfo:2765: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/068.undivert m4-1.4.6/checks/068.undivert --- m4-1.4.5/checks/068.undivert 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/068.undivert 1969-12-31 17:00:00.000000000 -0700 @@ -1,11 +0,0 @@ -dnl @ ../doc/m4.texinfo:2888: Origin of test -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.5/checks/069.m4wrap m4-1.4.6/checks/069.m4wrap --- m4-1.4.5/checks/069.m4wrap 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/069.m4wrap 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:2816: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/069.undivert m4-1.4.6/checks/069.undivert --- m4-1.4.5/checks/069.undivert 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/069.undivert 1969-12-31 17:00:00.000000000 -0700 @@ -1,11 +0,0 @@ -dnl @ ../doc/m4.texinfo:2911: Origin of test -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.5/checks/070.m4wrap m4-1.4.6/checks/070.m4wrap --- m4-1.4.5/checks/070.m4wrap 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/070.m4wrap 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,13 @@ +dnl @ ../doc/m4.texinfo:2845: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/070.undivert m4-1.4.6/checks/070.undivert --- m4-1.4.5/checks/070.undivert 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/070.undivert 1969-12-31 17:00:00.000000000 -0700 @@ -1,13 +0,0 @@ -dnl @ ../doc/m4.texinfo:2927: Origin of test -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.5/checks/071.m4wrap m4-1.4.6/checks/071.m4wrap --- m4-1.4.5/checks/071.m4wrap 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/071.m4wrap 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:2859: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/071.undivert m4-1.4.6/checks/071.undivert --- m4-1.4.5/checks/071.undivert 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/071.undivert 1969-12-31 17:00:00.000000000 -0700 @@ -1,9 +0,0 @@ -dnl @ ../doc/m4.texinfo:2946: Origin of test -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.5/checks/072.m4wrap m4-1.4.6/checks/072.m4wrap --- m4-1.4.5/checks/072.m4wrap 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/072.m4wrap 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,9 @@ +dnl @ ../doc/m4.texinfo:2873: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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: ERROR: end of file in argument list diff -ruNp m4-1.4.5/checks/072.undivert m4-1.4.6/checks/072.undivert --- m4-1.4.5/checks/072.undivert 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/072.undivert 1969-12-31 17:00:00.000000000 -0700 @@ -1,9 +0,0 @@ -dnl @ ../doc/m4.texinfo:2966: Origin of test -define(`bar', `BAR') -dnl @result{} -undivert(`foo') -dnl @result{}bar -dnl @result{} -include(`foo') -dnl @result{}BAR -dnl @result{} diff -ruNp m4-1.4.5/checks/073.divnum m4-1.4.6/checks/073.divnum --- m4-1.4.5/checks/073.divnum 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/073.divnum 1969-12-31 17:00:00.000000000 -0700 @@ -1,11 +0,0 @@ -dnl @ ../doc/m4.texinfo:2990: Origin of test -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.5/checks/073.include m4-1.4.6/checks/073.include --- m4-1.4.5/checks/073.include 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/073.include 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:2915: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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 @result{} +dnl @error{}m4:stdin:1: cannot open `none': No such file or directory +include() +dnl @result{} +dnl @error{}m4:stdin:2: cannot open `': No such file or directory +sinclude(`none') +dnl @result{} +sinclude() +dnl @result{} diff -ruNp m4-1.4.5/checks/074.cleardiv m4-1.4.6/checks/074.cleardiv --- m4-1.4.5/checks/074.cleardiv 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/074.cleardiv 1969-12-31 17:00:00.000000000 -0700 @@ -1,7 +0,0 @@ -dnl @ ../doc/m4.texinfo:3016: Origin of test -divert(`1') -Diversion one: divnum -divert(`2') -Diversion two: divnum -divert(`-1') -undivert diff -ruNp m4-1.4.5/checks/074.include m4-1.4.6/checks/074.include --- m4-1.4.5/checks/074.include 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/074.include 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,13 @@ +dnl @ ../doc/m4.texinfo:2943: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/075.cleardiv m4-1.4.6/checks/075.cleardiv --- m4-1.4.5/checks/075.cleardiv 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/075.cleardiv 1969-12-31 17:00:00.000000000 -0700 @@ -1,4 +0,0 @@ -dnl @ ../doc/m4.texinfo:3035: Origin of test -define(`cleardivert', -`pushdef(`_n', divnum)divert(`-1')undivert($@)divert(_n)popdef(`_n')') -dnl @result{} diff -ruNp m4-1.4.5/checks/075.include m4-1.4.6/checks/075.include --- m4-1.4.5/checks/075.include 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/075.include 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,13 @@ +dnl @ ../doc/m4.texinfo:2958: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/076.divert m4-1.4.6/checks/076.divert --- m4-1.4.5/checks/076.divert 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/076.divert 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:3045: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/076.len m4-1.4.6/checks/076.len --- m4-1.4.5/checks/076.len 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/076.len 1969-12-31 17:00:00.000000000 -0700 @@ -1,5 +0,0 @@ -dnl @ ../doc/m4.texinfo:3074: Origin of test -len() -dnl @result{}0 -len(`abcdef') -dnl @result{}6 diff -ruNp m4-1.4.5/checks/077.divert m4-1.4.6/checks/077.divert --- m4-1.4.5/checks/077.divert 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/077.divert 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:3061: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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 preceeds ') +dnl @result{} +dnl @result{}Wrapped TEXT preceeds diverted text. diff -ruNp m4-1.4.5/checks/077.index_macro m4-1.4.6/checks/077.index_macro --- m4-1.4.5/checks/077.index_macro 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/077.index_macro 1969-12-31 17:00:00.000000000 -0700 @@ -1,5 +0,0 @@ -dnl @ ../doc/m4.texinfo:3095: Origin of test -index(`gnus, gnats, and armadillos', `nat') -dnl @result{}7 -index(`gnus, gnats, and armadillos', `dag') -dnl @result{}-1 diff -ruNp m4-1.4.5/checks/078.divert m4-1.4.6/checks/078.divert --- m4-1.4.5/checks/078.divert 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/078.divert 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,11 @@ +dnl @ ../doc/m4.texinfo:3078: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/078.regexp m4-1.4.6/checks/078.regexp --- m4-1.4.5/checks/078.regexp 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/078.regexp 1969-12-31 17:00:00.000000000 -0700 @@ -1,9 +0,0 @@ -dnl @ ../doc/m4.texinfo:3140: Origin of test -regexp(`GNUs not Unix', `\<[a-z]\w+') -dnl @result{}5 -regexp(`GNUs not Unix', `\= 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{}stdin:8: m4: bad expression in eval: foo/6 -dnl @result{} -eval(foo/6) -dnl @result{}111 diff -ruNp m4-1.4.5/checks/088.len m4-1.4.6/checks/088.len --- m4-1.4.5/checks/088.len 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/088.len 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,10 @@ +dnl @ ../doc/m4.texinfo:3310: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/089.eval m4-1.4.6/checks/089.eval --- m4-1.4.5/checks/089.eval 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/089.eval 1969-12-31 17:00:00.000000000 -0700 @@ -1,11 +0,0 @@ -dnl @ ../doc/m4.texinfo:3543: Origin of test -eval(0x80000000 / -1) -dnl @result{}-2147483648 -eval(0x80000000 % -1) -dnl @result{}0 -eval(0x7fffffff) -dnl @result{}2147483647 -incr(eval(0x7fffffff)) -dnl @result{}-2147483648 -eval(-4 >> 33) -dnl @result{}-2 diff -ruNp m4-1.4.5/checks/089.index_macr m4-1.4.6/checks/089.index_macr --- m4-1.4.5/checks/089.index_macr 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/089.index_macr 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,10 @@ +dnl @ ../doc/m4.texinfo:3331: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/090.eval m4-1.4.6/checks/090.eval --- m4-1.4.5/checks/090.eval 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/090.eval 1969-12-31 17:00:00.000000000 -0700 @@ -1,17 +0,0 @@ -dnl @ ../doc/m4.texinfo:3567: Origin of test -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 diff -ruNp m4-1.4.5/checks/090.index_macr m4-1.4.6/checks/090.index_macr --- m4-1.4.5/checks/090.index_macr 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/090.index_macr 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,9 @@ +dnl @ ../doc/m4.texinfo:3340: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/091.platform_ma m4-1.4.6/checks/091.platform_ma --- m4-1.4.5/checks/091.platform_ma 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/checks/091.platform_ma 1969-12-31 17:00:00.000000000 -0700 @@ -1,5 +0,0 @@ -dnl @ ../doc/m4.texinfo:3640: Origin of test -__gnu__ -dnl @result{} -ifdef(`__gnu__', `Extensions are active') -dnl @result{}Extensions are active diff -ruNp m4-1.4.5/checks/091.regexp m4-1.4.6/checks/091.regexp --- m4-1.4.5/checks/091.regexp 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/091.regexp 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:3384: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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', `\= 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:8: bad expression in eval: foo/6 +dnl @result{} +eval(foo/6) +dnl @result{}111 diff -ruNp m4-1.4.5/checks/106.eval m4-1.4.6/checks/106.eval --- m4-1.4.5/checks/106.eval 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/106.eval 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:3830: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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(0x80000000 / -1) +dnl @result{}-2147483648 +eval(0x80000000 % -1) +dnl @result{}0 +eval(0x7fffffff) +dnl @result{}2147483647 +incr(eval(0x7fffffff)) +dnl @result{}-2147483648 +eval(-4 >> 33) +dnl @result{}-2 diff -ruNp m4-1.4.5/checks/107.eval m4-1.4.6/checks/107.eval --- m4-1.4.5/checks/107.eval 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/107.eval 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,22 @@ +dnl @ ../doc/m4.texinfo:3854: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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 diff -ruNp m4-1.4.5/checks/108.platform_m m4-1.4.6/checks/108.platform_m --- m4-1.4.5/checks/108.platform_m 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/108.platform_m 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,10 @@ +dnl @ ../doc/m4.texinfo:3927: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/109.platform_m m4-1.4.6/checks/109.platform_m --- m4-1.4.5/checks/109.platform_m 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/109.platform_m 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:3948: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/110.syscmd m4-1.4.6/checks/110.syscmd --- m4-1.4.5/checks/110.syscmd 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/110.syscmd 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,11 @@ +dnl @ ../doc/m4.texinfo:3981: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/111.esyscmd m4-1.4.6/checks/111.esyscmd --- m4-1.4.5/checks/111.esyscmd 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/111.esyscmd 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,11 @@ +dnl @ ../doc/m4.texinfo:4012: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/112.sysval m4-1.4.6/checks/112.sysval --- m4-1.4.5/checks/112.sysval 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/112.sysval 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,30 @@ +dnl @ ../doc/m4.texinfo:4039: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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(`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.5/checks/113.sysval m4-1.4.6/checks/113.sysval --- m4-1.4.5/checks/113.sysval 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/113.sysval 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,19 @@ +dnl @ ../doc/m4.texinfo:4085: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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 -13 $$') +dnl @result{} +sysval +dnl @result{}3328 +esyscmd(`kill -9 $$') +dnl @result{} +sysval +dnl @result{}2304 diff -ruNp m4-1.4.5/checks/114.maketemp m4-1.4.6/checks/114.maketemp --- m4-1.4.5/checks/114.maketemp 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/114.maketemp 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:4134: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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 /tmp is a valid directory name, which is not true +dnl for native Windows. +ifdef(`__unix__', , `errprint(` skipping: not sure /tmp exists +')m4exit(`77')')dnl +define(`file1', maketemp(`/tmp/fooXXXXXX'))dnl +define(`file2', maketemp(`/tmp/fooXXXXXX'))dnl +ifelse(file1, file2, `same', `different') +dnl @result{}different +syscmd(`rm 'file1 file2) +dnl @result{} +sysval +dnl @result{}0 diff -ruNp m4-1.4.5/checks/115.errprint m4-1.4.6/checks/115.errprint --- m4-1.4.5/checks/115.errprint 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/115.errprint 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,10 @@ +dnl @ ../doc/m4.texinfo:4178: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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{} diff -ruNp m4-1.4.5/checks/116.location m4-1.4.6/checks/116.location --- m4-1.4.5/checks/116.location 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/116.location 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,10 @@ +dnl @ ../doc/m4.texinfo:4205: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/117.location m4-1.4.6/checks/117.location --- m4-1.4.5/checks/117.location 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/117.location 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,15 @@ +dnl @ ../doc/m4.texinfo:4224: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/118.m4exit m4-1.4.6/checks/118.m4exit --- m4-1.4.5/checks/118.m4exit 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/118.m4exit 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:4274: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/119.m4exit m4-1.4.6/checks/119.m4exit --- m4-1.4.5/checks/119.m4exit 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/119.m4exit 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:4290: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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 to `m4exit'.') +dnl @result{} +divert(`1') And so is this. +divert +dnl @result{} +m4exit diff -ruNp m4-1.4.5/checks/120.extensions m4-1.4.6/checks/120.extensions --- m4-1.4.5/checks/120.extensions 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/120.extensions 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,23 @@ +dnl @ ../doc/m4.texinfo:4528: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/121.incompatib m4-1.4.6/checks/121.incompatib --- m4-1.4.5/checks/121.incompatib 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/121.incompatib 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,23 @@ +dnl @ ../doc/m4.texinfo:4641: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/122.answers m4-1.4.6/checks/122.answers --- m4-1.4.5/checks/122.answers 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/122.answers 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:4825: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/123.answers m4-1.4.6/checks/123.answers --- m4-1.4.5/checks/123.answers 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/123.answers 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,28 @@ +dnl @ ../doc/m4.texinfo:4840: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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.5/checks/124.answers m4-1.4.6/checks/124.answers --- m4-1.4.5/checks/124.answers 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/checks/124.answers 2006-08-24 12:08:26.000000000 -0600 @@ -0,0 +1,17 @@ +dnl @ ../doc/m4.texinfo:4873: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software 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__: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: Warning: excess arguments to builtin `divnum' ignored +dnl @result{}0 +dnl @error{}m4: fatal error: inside wrapped text diff -ruNp m4-1.4.5/checks/check-them m4-1.4.6/checks/check-them --- m4-1.4.5/checks/check-them 2006-07-10 06:24:49.000000000 -0600 +++ m4-1.4.6/checks/check-them 2006-08-22 12:07:42.000000000 -0600 @@ -51,10 +51,12 @@ do if test $? = 77 ; then skipped="$skipped $file" + cat $err continue fi - sed -e '/^dnl @result{}/!d' -e 's///' "$file" > $xout + sed -e '/^dnl @result{}/!d' -e 's///' -e "s|\.\./examples|$examples|" \ + "$file" > $xout if cmp -s $out $xout; then : @@ -65,7 +67,7 @@ do diff $xout $out fi - sed -e '/^dnl @error{}/!d' -e 's///' -e "s| m4:| $m4:|" "$file" > $xerr + sed -e '/^dnl @error{}/!d' -e 's///' -e "s|^m4:|$m4:|" "$file" > $xerr if cmp -s $err $xerr; then : diff -ruNp m4-1.4.5/checks/get-them m4-1.4.6/checks/get-them --- m4-1.4.5/checks/get-them 2006-07-14 13:47:18.000000000 -0600 +++ m4-1.4.6/checks/get-them 2006-08-22 06:24:16.000000000 -0600 @@ -28,7 +28,7 @@ BEGIN { else printf("Node: %s ", node); gsub(" ", "_", node); - node = tolower(substr(node, 1, 11)); + node = tolower(substr(node, 1, 10)); seq = 0; } @@ -46,7 +46,12 @@ BEGIN { seq++; count++; file = sprintf("%03d.%s", count, node); - printf("dnl @ %s:%d: Origin of test\n", FILENAME, NR) > file; + printf("dnl @ %s:%d: Origin of test\n"\ + "dnl @ Copyright (C) 2006 Free Software Foundation\n"\ + "dnl @ This file is free software; the Free Software Foundation\n"\ + "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) > file; next; } if ($0 ~ /^@end example$/) { diff -ruNp m4-1.4.5/config-h.in m4-1.4.6/config-h.in --- m4-1.4.5/config-h.in 2006-07-15 16:25:57.000000000 -0600 +++ m4-1.4.6/config-h.in 2006-08-24 11:47:26.000000000 -0600 @@ -1,8 +1,26 @@ /* config-h.in. Generated from configure.ac by autoheader. */ +/* Define this to an absolute name of . */ +#undef ABSOLUTE_STDINT_H + /* Define this to an absolute name of . */ #undef ABSOLUTE_SYS_STAT_H +/* Define to the number of bits in type 'ptrdiff_t'. */ +#undef BITSIZEOF_PTRDIFF_T + +/* Define to the number of bits in type 'sig_atomic_t'. */ +#undef BITSIZEOF_SIG_ATOMIC_T + +/* Define to the number of bits in type 'size_t'. */ +#undef BITSIZEOF_SIZE_T + +/* Define to the number of bits in type 'wchar_t'. */ +#undef BITSIZEOF_WCHAR_T + +/* Define to the number of bits in type 'wint_t'. */ +#undef BITSIZEOF_WINT_T + /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP systems. This function is required for `alloca.c' support on those systems. */ @@ -31,6 +49,50 @@ /* Define to 1 if you have the header file. */ #undef HAVE_BP_SYM_H +/* Define to 1 if you have the declaration of `clearerr_unlocked', and to 0 if + you don't. */ +#undef HAVE_DECL_CLEARERR_UNLOCKED + +/* Define to 1 if you have the declaration of `feof_unlocked', and to 0 if you + don't. */ +#undef HAVE_DECL_FEOF_UNLOCKED + +/* Define to 1 if you have the declaration of `ferror_unlocked', and to 0 if + you don't. */ +#undef HAVE_DECL_FERROR_UNLOCKED + +/* Define to 1 if you have the declaration of `fflush_unlocked', and to 0 if + you don't. */ +#undef HAVE_DECL_FFLUSH_UNLOCKED + +/* Define to 1 if you have the declaration of `fgets_unlocked', and to 0 if + you don't. */ +#undef HAVE_DECL_FGETS_UNLOCKED + +/* Define to 1 if you have the declaration of `fputc_unlocked', and to 0 if + you don't. */ +#undef HAVE_DECL_FPUTC_UNLOCKED + +/* Define to 1 if you have the declaration of `fputs_unlocked', and to 0 if + you don't. */ +#undef HAVE_DECL_FPUTS_UNLOCKED + +/* Define to 1 if you have the declaration of `fread_unlocked', and to 0 if + you don't. */ +#undef HAVE_DECL_FREAD_UNLOCKED + +/* Define to 1 if you have the declaration of `fwrite_unlocked', and to 0 if + you don't. */ +#undef HAVE_DECL_FWRITE_UNLOCKED + +/* Define to 1 if you have the declaration of `getchar_unlocked', and to 0 if + you don't. */ +#undef HAVE_DECL_GETCHAR_UNLOCKED + +/* Define to 1 if you have the declaration of `getc_unlocked', and to 0 if you + don't. */ +#undef HAVE_DECL_GETC_UNLOCKED + /* Define to 1 if you have the declaration of `getenv', and to 0 if you don't. */ #undef HAVE_DECL_GETENV @@ -43,6 +105,14 @@ */ #undef HAVE_DECL_MKDIR +/* Define to 1 if you have the declaration of `putchar_unlocked', and to 0 if + you don't. */ +#undef HAVE_DECL_PUTCHAR_UNLOCKED + +/* Define to 1 if you have the declaration of `putc_unlocked', and to 0 if you + don't. */ +#undef HAVE_DECL_PUTC_UNLOCKED + /* Define to 1 if you have the declaration of `strerror_r', and to 0 if you don't. */ #undef HAVE_DECL_STRERROR_R @@ -51,6 +121,10 @@ don't. */ #undef HAVE_DECL_WCWIDTH +/* Define to 1 if you have the declaration of `__fpending', and to 0 if you + don't. */ +#undef HAVE_DECL___FPENDING + /* Define to 1 if you have the header file. */ #undef HAVE_GETOPT_H @@ -73,6 +147,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_IO_H +/* Define to 1 if you have the `iswcntrl' function. */ +#undef HAVE_ISWCNTRL + /* Define to 1 if you have the `iswprint' function. */ #undef HAVE_ISWPRINT @@ -122,6 +199,9 @@ /* Define to 1 if libc includes obstacks. */ #undef HAVE_OBSTACK +/* 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 @@ -143,6 +223,15 @@ /* Define to 1 if the system has the type `siginfo_t'. */ #undef HAVE_SIGINFO_T +/* Define to 1 if 'sig_atomic_t' is a signed integer type. */ +#undef HAVE_SIGNED_SIG_ATOMIC_T + +/* Define to 1 if 'wchar_t' is a signed integer type. */ +#undef HAVE_SIGNED_WCHAR_T + +/* Define to 1 if 'wint_t' is a signed integer type. */ +#undef HAVE_SIGNED_WINT_T + /* Define to 1 if you have the `sigstack' function. */ #undef HAVE_SIGSTACK @@ -165,6 +254,9 @@ uintmax_t. */ #undef HAVE_STDINT_H_WITH_UINTMAX +/* Define to 1 if you have the header file. */ +#undef HAVE_STDIO_EXT_H + /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H @@ -189,6 +281,12 @@ /* Define to 1 if `sa_sigaction' is member of `struct sigaction'. */ #undef HAVE_STRUCT_SIGACTION_SA_SIGACTION +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_BITYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_INTTYPES_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H @@ -201,21 +299,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_WAIT_H -/* Define to 1 if you have the `tmpfile' function. */ -#undef HAVE_TMPFILE - -/* Define if you have the 'uintmax_t' type in or . */ -#undef HAVE_UINTMAX_T - /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H -/* Define if you have the 'unsigned long long' type. */ -#undef HAVE_UNSIGNED_LONG_LONG - -/* Define to 1 if the system has the type `unsigned long long int'. */ -#undef HAVE_UNSIGNED_LONG_LONG_INT - /* Define to 1 if you have the `vasnprintf' function. */ #undef HAVE_VASNPRINTF @@ -249,6 +335,9 @@ /* Define to 1 if the system has the type `_Bool'. */ #undef HAVE__BOOL +/* Define to 1 if you have the `__fpending' function. */ +#undef HAVE___FPENDING + /* Define to 1 if you have the `__secure_getenv' function. */ #undef HAVE___SECURE_GETENV @@ -270,13 +359,28 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION +/* the number of pending output bytes on stream `fp' */ +#undef PENDING_OUTPUT_N_BYTES + +/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type + 'ptrdiff_t'. */ +#undef PTRDIFF_T_SUFFIX + /* Define as the return type of signal handlers (`int' or `void'). */ #undef RETSIGTYPE +/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type + 'sig_atomic_t'. */ +#undef SIG_ATOMIC_T_SUFFIX + /* Define as the maximum value of type 'size_t', if the system doesn't define it. */ #undef SIZE_MAX +/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type + 'size_t'. */ +#undef SIZE_T_SUFFIX + /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at runtime. @@ -297,9 +401,22 @@ /* Define to 1 if using stack overflow detection */ #undef USE_STACKOVF +/* Define to 1 if you want getc etc. to use unlocked I/O if available. + Unlocked I/O can improve performance in unithreaded apps, but it is not + safe for multithreaded apps. */ +#undef USE_UNLOCKED_IO + /* Version number of package */ #undef VERSION +/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type + 'wchar_t'. */ +#undef WCHAR_T_SUFFIX + +/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type + 'wint_t'. */ +#undef WINT_T_SUFFIX + /* Define to 1 if malloc debugging is enabled */ #undef WITH_DMALLOC @@ -340,6 +457,9 @@ 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)) @@ -428,9 +548,5 @@ /* Define to rpl_strcasecmp always. */ #undef strcasecmp -/* Define to unsigned long or unsigned long long if and - don't define. */ -#undef uintmax_t - /* Define as a macro for copying va_list variables. */ #undef va_copy diff -ruNp m4-1.4.5/config.sub m4-1.4.6/config.sub --- m4-1.4.5/config.sub 2006-07-15 16:16:19.000000000 -0600 +++ m4-1.4.6/config.sub 2006-08-24 11:47:48.000000000 -0600 @@ -4,7 +4,7 @@ # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. -timestamp='2006-07-02' +timestamp='2006-08-14' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -284,7 +284,7 @@ case $basic_machine in | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ - | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \ + | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; @@ -367,7 +367,7 @@ case $basic_machine in | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ - | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa-* \ | ymp-* \ | z8k-*) @@ -909,6 +909,10 @@ case $basic_machine in sb1el) basic_machine=mipsisa64sb1el-unknown ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; sei) basic_machine=mips-sei os=-seiux diff -ruNp m4-1.4.5/configure m4-1.4.6/configure --- m4-1.4.5/configure 2006-07-15 16:24:14.000000000 -0600 +++ m4-1.4.6/configure 2006-08-24 11:47:17.000000000 -0600 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.60 for GNU M4 1.4.5. +# Generated by GNU Autoconf 2.60 for GNU M4 1.4.6. # # Report bugs to . # @@ -559,8 +559,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='GNU M4' PACKAGE_TARNAME='m4' -PACKAGE_VERSION='1.4.5' -PACKAGE_STRING='GNU M4 1.4.5' +PACKAGE_VERSION='1.4.6' +PACKAGE_STRING='GNU M4 1.4.6' PACKAGE_BUGREPORT='bug-m4@gnu.org' ac_unique_file="src/m4.h" @@ -696,6 +696,28 @@ LIBOBJS GETOPT_H STDBOOL_H HAVE__BOOL +HAVE_LONG_LONG_INT +HAVE_WCHAR_H +HAVE_INTTYPES_H +HAVE_SYS_TYPES_H +ABSOLUTE_STDINT_H +HAVE_STDINT_H +HAVE_SYS_INTTYPES_H +HAVE_SYS_BITYPES_H +BITSIZEOF_PTRDIFF_T +BITSIZEOF_SIG_ATOMIC_T +BITSIZEOF_SIZE_T +BITSIZEOF_WCHAR_T +BITSIZEOF_WINT_T +HAVE_SIGNED_SIG_ATOMIC_T +HAVE_SIGNED_WCHAR_T +HAVE_SIGNED_WINT_T +PTRDIFF_T_SUFFIX +SIG_ATOMIC_T_SUFFIX +SIZE_T_SUFFIX +WCHAR_T_SUFFIX +WINT_T_SUFFIX +STDINT_H ABSOLUTE_SYS_STAT_H SYS_STAT_H UNISTD_H @@ -1214,7 +1236,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.5 to adapt to many kinds of systems. +\`configure' configures GNU M4 1.4.6 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1284,7 +1306,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of GNU M4 1.4.5:";; + short | recursive ) echo "Configuration of GNU M4 1.4.6:";; esac cat <<\_ACEOF @@ -1378,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -GNU M4 configure 1.4.5 +GNU M4 configure 1.4.6 generated by GNU Autoconf 2.60 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1392,7 +1414,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.5, which was +It was created by GNU M4 $as_me 1.4.6, which was generated by GNU Autoconf 2.60. Invocation command line was $ $0 $@ @@ -1673,7 +1695,6 @@ ac_func_list="$ac_func_list sigaltstack" ac_func_list="$ac_func_list sigstack" ac_func_list="$ac_func_list sigvec" ac_func_list="$ac_func_list strerror" -ac_func_list="$ac_func_list tmpfile" ac_header_list="$ac_header_list wchar.h" ac_header_list="$ac_header_list wctype.h" ac_header_list="$ac_header_list sys/time.h" @@ -1682,8 +1703,10 @@ ac_func_list="$ac_func_list mbrtowc" ac_func_list="$ac_func_list mempcpy" ac_func_list="$ac_func_list wcrtomb" ac_func_list="$ac_func_list wcscoll" +ac_header_list="$ac_header_list stdint.h" ac_func_list="$ac_func_list lstat" ac_header_list="$ac_header_list sys/stat.h" +ac_func_list="$ac_func_list pipe" ac_func_list="$ac_func_list iswprint" ac_func_list="$ac_func_list wcwidth" # Check that the precious variables saved in the cache have kept the same @@ -2083,7 +2106,7 @@ fi # Define the identity of the package. PACKAGE='m4' - VERSION='1.4.5' + VERSION='1.4.6' cat >>confdefs.h <<_ACEOF @@ -5305,10 +5328,6 @@ done - - - - # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! { echo "$as_me:$LINENO: checking for working alloca.h" >&5 @@ -6822,277 +6841,12 @@ _ACEOF - - { 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. */ -#include -#include -int -main () -{ -uintmax_t i = (uintmax_t) -1; - ; - 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); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (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); }; } && - { ac_try='test -s conftest.$ac_objext' - { (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_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 -#include -int -main () -{ -uintmax_t i = (uintmax_t) -1; - ; - 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); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (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); }; } && - { ac_try='test -s conftest.$ac_objext' - { (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_header_stdint_h=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - gl_cv_header_stdint_h=no -fi - -rm -f core conftest.err 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 - - - { echo "$as_me:$LINENO: checking for unsigned long long int" >&5 -echo $ECHO_N "checking for unsigned long long int... $ECHO_C" >&6; } -if test "${ac_cv_type_unsigned_long_long_int+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. */ -unsigned long long int ull = 18446744073709551615ULL; - typedef int a[(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); - ; - 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); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (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); }; } && - { ac_try='test -s 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_type_unsigned_long_long_int=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_type_unsigned_long_long_int=no -fi - -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_type_unsigned_long_long_int" >&5 -echo "${ECHO_T}$ac_cv_type_unsigned_long_long_int" >&6; } - if test $ac_cv_type_unsigned_long_long_int = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_UNSIGNED_LONG_LONG_INT 1 -_ACEOF - - fi - - - - ac_cv_type_unsigned_long_long=$ac_cv_type_unsigned_long_long_int - if test $ac_cv_type_unsigned_long_long = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_UNSIGNED_LONG_LONG 1 -_ACEOF - - fi - - - - - if test $gl_cv_header_inttypes_h = no && test $gl_cv_header_stdint_h = no; then - - test $ac_cv_type_unsigned_long_long = yes \ - && ac_type='unsigned long long' \ - || ac_type='unsigned long' - -cat >>confdefs.h <<_ACEOF -#define uintmax_t $ac_type -_ACEOF - - else - -cat >>confdefs.h <<\_ACEOF -#define HAVE_UINTMAX_T 1 -_ACEOF - - fi - { echo "$as_me:$LINENO: checking for C/C++ restrict keyword" >&5 echo $ECHO_N "checking for C/C++ restrict keyword... $ECHO_C" >&6; } -if test "${gl_cv_c_restrict+set}" = set; then +if test "${ac_cv_c_restrict+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - gl_cv_c_restrict=no + 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 @@ -7102,7 +6856,20 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -float * $ac_kw x; +typedef int * int_ptr; + 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) + ; + return 0; +} _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" @@ -7138,7 +6905,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - gl_cv_c_restrict=$ac_kw; break + ac_cv_c_restrict=$ac_kw else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -7147,12 +6914,13 @@ sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test "$ac_cv_c_restrict" != no && break done fi -{ echo "$as_me:$LINENO: result: $gl_cv_c_restrict" >&5 -echo "${ECHO_T}$gl_cv_c_restrict" >&6; } - case $gl_cv_c_restrict in +{ 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 @@ -7160,7 +6928,7 @@ cat >>confdefs.h <<\_ACEOF _ACEOF ;; *) cat >>confdefs.h <<_ACEOF -#define restrict $gl_cv_c_restrict +#define restrict $ac_cv_c_restrict _ACEOF ;; esac @@ -7530,13 +7298,98 @@ _ACEOF fi - - - -{ echo "$as_me:$LINENO: checking for inline" >&5 -echo $ECHO_N "checking for inline... $ECHO_C" >&6; } -if test "${ac_cv_c_inline+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + { echo "$as_me:$LINENO: checking for long long int" >&5 +echo $ECHO_N "checking for long long int... $ECHO_C" >&6; } +if test "${ac_cv_type_long_long_int+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. */ +long long int ll = 9223372036854775807ll; + long long int nll = -9223372036854775807LL; + typedef int a[((-9223372036854775807LL < 0 + && 0 < 9223372036854775807ll) + ? 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)); + ; + 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s 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_type_long_long_int=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_long_long_int=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_long_long_int" >&5 +echo "${ECHO_T}$ac_cv_type_long_long_int" >&6; } + if test $ac_cv_type_long_long_int = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_LONG_LONG_INT 1 +_ACEOF + + fi + + + + + + + +{ echo "$as_me:$LINENO: checking for inline" >&5 +echo $ECHO_N "checking for inline... $ECHO_C" >&6; } +if test "${ac_cv_c_inline+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do @@ -7621,75 +7474,25 @@ esac - { 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 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. */ - -#include -#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 -#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 -/* The following two lines are a workaround against an autoconf-2.52 bug. */ -#include -#include - +$ac_includes_default int main () { -static int test_array [1 - 2 * !((EOVERFLOW) >= 0)]; -test_array [0] = 0 +#ifndef clearerr_unlocked + char *p = (char *) clearerr_unlocked; + return !p; +#endif ; return 0; @@ -7729,26 +7532,53 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_lo=0 ac_mid=0 - while :; do - cat >conftest.$ac_ext <<_ACEOF + 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 + + +fi + + +{ echo "$as_me:$LINENO: checking whether feof_unlocked is declared" >&5 +echo $ECHO_N "checking whether feof_unlocked is declared... $ECHO_C" >&6; } +if test "${ac_cv_have_decl_feof_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. */ - -#define _XOPEN_SOURCE_EXTENDED 1 -#include -/* The following two lines are a workaround against an autoconf-2.52 bug. */ -#include -#include - +$ac_includes_default int main () { -static int test_array [1 - 2 * !((EOVERFLOW) <= $ac_mid)]; -test_array [0] = 0 +#ifndef feof_unlocked + char *p = (char *) feof_unlocked; + return !p; +#endif ; return 0; @@ -7788,43 +7618,53 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_hi=$ac_mid; break + ac_cv_have_decl_feof_unlocked=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` + ac_cv_have_decl_feof_unlocked=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done +fi +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_feof_unlocked" >&5 +echo "${ECHO_T}$ac_cv_have_decl_feof_unlocked" >&6; } +if test $ac_cv_have_decl_feof_unlocked = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FEOF_UNLOCKED 1 +_ACEOF + + else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FEOF_UNLOCKED 0 +_ACEOF - cat >conftest.$ac_ext <<_ACEOF + +fi + + +{ echo "$as_me:$LINENO: checking whether ferror_unlocked is declared" >&5 +echo $ECHO_N "checking whether ferror_unlocked is declared... $ECHO_C" >&6; } +if test "${ac_cv_have_decl_ferror_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. */ - -#define _XOPEN_SOURCE_EXTENDED 1 -#include -/* The following two lines are a workaround against an autoconf-2.52 bug. */ -#include -#include - +$ac_includes_default int main () { -static int test_array [1 - 2 * !((EOVERFLOW) < 0)]; -test_array [0] = 0 +#ifndef ferror_unlocked + char *p = (char *) ferror_unlocked; + return !p; +#endif ; return 0; @@ -7864,29 +7704,56 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; 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. */ + ac_cv_have_decl_ferror_unlocked=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -#define _XOPEN_SOURCE_EXTENDED 1 -#include -/* The following two lines are a workaround against an autoconf-2.52 bug. */ -#include -#include + ac_cv_have_decl_ferror_unlocked=no +fi -int -main () -{ -static int test_array [1 - 2 * !((EOVERFLOW) >= $ac_mid)]; -test_array [0] = 0 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_ferror_unlocked" >&5 +echo "${ECHO_T}$ac_cv_have_decl_ferror_unlocked" >&6; } +if test $ac_cv_have_decl_ferror_unlocked = yes; then - ; - return 0; +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FERROR_UNLOCKED 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FERROR_UNLOCKED 0 +_ACEOF + + +fi + + +{ echo "$as_me:$LINENO: checking whether fflush_unlocked is declared" >&5 +echo $ECHO_N "checking whether fflush_unlocked is declared... $ECHO_C" >&6; } +if test "${ac_cv_have_decl_fflush_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 fflush_unlocked + char *p = (char *) fflush_unlocked; + return !p; +#endif + + ; + return 0; } _ACEOF rm -f conftest.$ac_objext @@ -7923,53 +7790,53 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_lo=$ac_mid; break + ac_cv_have_decl_fflush_unlocked=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` + ac_cv_have_decl_fflush_unlocked=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done +fi +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_fflush_unlocked" >&5 +echo "${ECHO_T}$ac_cv_have_decl_fflush_unlocked" >&6; } +if test $ac_cv_have_decl_fflush_unlocked = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FFLUSH_UNLOCKED 1 +_ACEOF + + else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FFLUSH_UNLOCKED 0 +_ACEOF - ac_lo= ac_hi= -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -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` + +{ echo "$as_me:$LINENO: checking whether fgets_unlocked is declared" >&5 +echo $ECHO_N "checking whether fgets_unlocked is declared... $ECHO_C" >&6; } +if test "${ac_cv_have_decl_fgets_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. */ - -#define _XOPEN_SOURCE_EXTENDED 1 -#include -/* The following two lines are a workaround against an autoconf-2.52 bug. */ -#include -#include - +$ac_includes_default int main () { -static int test_array [1 - 2 * !((EOVERFLOW) <= $ac_mid)]; -test_array [0] = 0 +#ifndef fgets_unlocked + char *p = (char *) fgets_unlocked; + return !p; +#endif ; return 0; @@ -8009,117 +7876,37 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_hi=$ac_mid + ac_cv_have_decl_fgets_unlocked=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_lo=`expr '(' $ac_mid ')' + 1` + ac_cv_have_decl_fgets_unlocked=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 -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 -/* The following two lines are a workaround against an autoconf-2.52 bug. */ -#include -#include - -static long int longval () { return EOVERFLOW; } -static unsigned long int ulongval () { return EOVERFLOW; } -#include -#include -int -main () -{ - - 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; +fi +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_fgets_unlocked" >&5 +echo "${ECHO_T}$ac_cv_have_decl_fgets_unlocked" >&6; } +if test $ac_cv_have_decl_fgets_unlocked = yes; then - ; - return 0; -} +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FGETS_UNLOCKED 1 _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_decl_EOVERFLOW=`cat conftest.val` -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -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 +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FGETS_UNLOCKED 0 _ACEOF - EOVERFLOW="$ac_cv_decl_EOVERFLOW" - fi +fi - { echo "$as_me:$LINENO: checking for signed" >&5 -echo $ECHO_N "checking for signed... $ECHO_C" >&6; } -if test "${bh_cv_c_signed+set}" = set; then +{ echo "$as_me:$LINENO: checking whether fputc_unlocked is declared" >&5 +echo $ECHO_N "checking whether fputc_unlocked is declared... $ECHO_C" >&6; } +if test "${ac_cv_have_decl_fputc_unlocked+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -8128,11 +7915,15 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - +$ac_includes_default int main () { -signed char x; +#ifndef fputc_unlocked + char *p = (char *) fputc_unlocked; + return !p; +#endif + ; return 0; } @@ -8171,30 +7962,37 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - bh_cv_c_signed=yes + ac_cv_have_decl_fputc_unlocked=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - bh_cv_c_signed=no + ac_cv_have_decl_fputc_unlocked=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $bh_cv_c_signed" >&5 -echo "${ECHO_T}$bh_cv_c_signed" >&6; } - if test $bh_cv_c_signed = no; then +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_fputc_unlocked" >&5 +echo "${ECHO_T}$ac_cv_have_decl_fputc_unlocked" >&6; } +if test $ac_cv_have_decl_fputc_unlocked = yes; then -cat >>confdefs.h <<\_ACEOF -#define signed +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FPUTC_UNLOCKED 1 _ACEOF - fi +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FPUTC_UNLOCKED 0 +_ACEOF - { echo "$as_me:$LINENO: checking for long long int" >&5 -echo $ECHO_N "checking for long long int... $ECHO_C" >&6; } -if test "${ac_cv_type_long_long_int+set}" = set; then + +fi + + +{ echo "$as_me:$LINENO: checking whether fputs_unlocked is declared" >&5 +echo $ECHO_N "checking whether fputs_unlocked is declared... $ECHO_C" >&6; } +if test "${ac_cv_have_decl_fputs_unlocked+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -8203,30 +8001,27 @@ _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; +$ac_includes_default int main () { -long long int llmax = 9223372036854775807ll; - return (ll << 63 | ll >> 63 | ll < i | ll > i - | llmax / ll | llmax % ll); +#ifndef fputs_unlocked + char *p = (char *) fputs_unlocked; + return !p; +#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 @@ -8243,7 +8038,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; @@ -8253,62 +8048,53 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_type_long_long_int=yes + ac_cv_have_decl_fputs_unlocked=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_type_long_long_int=no + ac_cv_have_decl_fputs_unlocked=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $ac_cv_type_long_long_int" >&5 -echo "${ECHO_T}$ac_cv_type_long_long_int" >&6; } - if test $ac_cv_type_long_long_int = yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_fputs_unlocked" >&5 +echo "${ECHO_T}$ac_cv_have_decl_fputs_unlocked" >&6; } +if test $ac_cv_have_decl_fputs_unlocked = yes; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_LONG_LONG_INT 1 +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FPUTS_UNLOCKED 1 _ACEOF - fi - - - - ac_cv_type_long_long=$ac_cv_type_long_long_int - if test $ac_cv_type_long_long = yes; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_LONG_LONG 1 +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FPUTS_UNLOCKED 0 _ACEOF - fi + +fi - { echo "$as_me:$LINENO: checking for long double" >&5 -echo $ECHO_N "checking for long double... $ECHO_C" >&6; } -if test "${gt_cv_c_long_double+set}" = set; then +{ echo "$as_me:$LINENO: checking whether fread_unlocked is declared" >&5 +echo $ECHO_N "checking whether fread_unlocked is declared... $ECHO_C" >&6; } +if test "${ac_cv_have_decl_fread_unlocked+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test "$GCC" = yes; then - gt_cv_c_long_double=yes - 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. */ - - /* The Stardent Vistra knows sizeof(long double), but does not support it. */ - long double foo = 0.0; - /* On Ultrix 4.3 cc, long double is 4 and double is 8. */ - int array [2*(sizeof(long double) >= sizeof(double)) - 1]; - +$ac_includes_default int main () { +#ifndef fread_unlocked + char *p = (char *) fread_unlocked; + return !p; +#endif ; return 0; @@ -8348,31 +8134,37 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - gt_cv_c_long_double=yes + ac_cv_have_decl_fread_unlocked=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - gt_cv_c_long_double=no + ac_cv_have_decl_fread_unlocked=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi fi -{ echo "$as_me:$LINENO: result: $gt_cv_c_long_double" >&5 -echo "${ECHO_T}$gt_cv_c_long_double" >&6; } - if test $gt_cv_c_long_double = yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_fread_unlocked" >&5 +echo "${ECHO_T}$ac_cv_have_decl_fread_unlocked" >&6; } +if test $ac_cv_have_decl_fread_unlocked = yes; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_LONG_DOUBLE 1 +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FREAD_UNLOCKED 1 _ACEOF - fi +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FREAD_UNLOCKED 0 +_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 + +fi + + +{ echo "$as_me:$LINENO: checking whether fwrite_unlocked is declared" >&5 +echo $ECHO_N "checking whether fwrite_unlocked is declared... $ECHO_C" >&6; } +if test "${ac_cv_have_decl_fwrite_unlocked+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -8381,11 +8173,14 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include - wchar_t foo = (wchar_t)'\0'; +$ac_includes_default int main () { +#ifndef fwrite_unlocked + char *p = (char *) fwrite_unlocked; + return !p; +#endif ; return 0; @@ -8425,30 +8220,37 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - gt_cv_c_wchar_t=yes + ac_cv_have_decl_fwrite_unlocked=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - gt_cv_c_wchar_t=no + ac_cv_have_decl_fwrite_unlocked=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 +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_fwrite_unlocked" >&5 +echo "${ECHO_T}$ac_cv_have_decl_fwrite_unlocked" >&6; } +if test $ac_cv_have_decl_fwrite_unlocked = yes; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_WCHAR_T 1 +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FWRITE_UNLOCKED 1 _ACEOF - fi +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FWRITE_UNLOCKED 0 +_ACEOF - { 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 + +fi + + +{ echo "$as_me:$LINENO: checking whether getc_unlocked is declared" >&5 +echo $ECHO_N "checking whether getc_unlocked is declared... $ECHO_C" >&6; } +if test "${ac_cv_have_decl_getc_unlocked+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -8457,11 +8259,14 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include - wint_t foo = (wchar_t)'\0'; +$ac_includes_default int main () { +#ifndef getc_unlocked + char *p = (char *) getc_unlocked; + return !p; +#endif ; return 0; @@ -8501,32 +8306,37 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - gt_cv_c_wint_t=yes + ac_cv_have_decl_getc_unlocked=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - gt_cv_c_wint_t=no + ac_cv_have_decl_getc_unlocked=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 +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_getc_unlocked" >&5 +echo "${ECHO_T}$ac_cv_have_decl_getc_unlocked" >&6; } +if test $ac_cv_have_decl_getc_unlocked = yes; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_WINT_T 1 +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_GETC_UNLOCKED 1 _ACEOF - fi + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_GETC_UNLOCKED 0 +_ACEOF +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 "$as_me:$LINENO: checking whether getchar_unlocked is declared" >&5 +echo $ECHO_N "checking whether getchar_unlocked is declared... $ECHO_C" >&6; } +if test "${ac_cv_have_decl_getchar_unlocked+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -8535,20 +8345,15 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - -#include -#include -#if HAVE_STDINT_H_WITH_UINTMAX -#include -#endif -#if HAVE_INTTYPES_H_WITH_UINTMAX -#include -#endif - +$ac_includes_default int main () { -intmax_t x = -1; +#ifndef getchar_unlocked + char *p = (char *) getchar_unlocked; + return !p; +#endif + ; return 0; } @@ -8587,102 +8392,37 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - gt_cv_c_intmax_t=yes + ac_cv_have_decl_getchar_unlocked=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - gt_cv_c_intmax_t=no + ac_cv_have_decl_getchar_unlocked=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' +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_getchar_unlocked" >&5 +echo "${ECHO_T}$ac_cv_have_decl_getchar_unlocked" >&6; } +if test $ac_cv_have_decl_getchar_unlocked = yes; then cat >>confdefs.h <<_ACEOF -#define intmax_t $ac_type +#define HAVE_DECL_GETCHAR_UNLOCKED 1 _ACEOF - fi - - - - - - - -if false; then - GL_COND_LIBTOOL_TRUE= - GL_COND_LIBTOOL_FALSE='#' else - GL_COND_LIBTOOL_TRUE='#' - GL_COND_LIBTOOL_FALSE= -fi - - - - - - - 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 - 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 -#endif - + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_GETCHAR_UNLOCKED 0 _ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "Need own alloca" >/dev/null 2>&1; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_ALLOCA 1 -_ACEOF - ALLOCA_H=alloca.h -else - ALLOCA_H= fi -rm -f conftest* - - else - ALLOCA_H=alloca.h - fi - - - -cat >>confdefs.h <<\_ACEOF -#define HAVE_ALLOCA_H 1 -_ACEOF - - { 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 putc_unlocked is declared" >&5 +echo $ECHO_N "checking whether putc_unlocked is declared... $ECHO_C" >&6; } +if test "${ac_cv_have_decl_putc_unlocked+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -8695,19 +8435,23 @@ $ac_includes_default int main () { -error_at_line (0, 0, "", 0, ""); +#ifndef putc_unlocked + char *p = (char *) putc_unlocked; + return !p; +#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 @@ -8724,7 +8468,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; @@ -8734,104 +8478,57 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_lib_error_at_line=yes + ac_cv_have_decl_putc_unlocked=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_lib_error_at_line=no -fi - -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext + ac_cv_have_decl_putc_unlocked=no 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 - case " $LIBOBJS " in - *" error.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS error.$ac_objext" - ;; -esac +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_putc_unlocked" >&5 +echo "${ECHO_T}$ac_cv_have_decl_putc_unlocked" >&6; } +if test $ac_cv_have_decl_putc_unlocked = yes; then - - - : - - - - - case " $LIBOBJS " in - *" exitfail.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS exitfail.$ac_objext" - ;; -esac - - - : - - - - if test -n "$GETOPT_H"; then - - case " $LIBOBJS " in - *" getopt.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS getopt.$ac_objext" - ;; -esac - - case " $LIBOBJS " in - *" getopt1.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS getopt1.$ac_objext" - ;; -esac - - - GETOPT_H=getopt.h - -cat >>confdefs.h <<\_ACEOF -#define __GETOPT_PREFIX rpl_ +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_PUTC_UNLOCKED 1 _ACEOF - - - - - - +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_PUTC_UNLOCKED 0 +_ACEOF fi - -for ac_header in stdlib.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 whether putchar_unlocked is declared" >&5 +echo $ECHO_N "checking whether putchar_unlocked is declared... $ECHO_C" >&6; } +if test "${ac_cv_have_decl_putchar_unlocked+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> +int +main () +{ +#ifndef putchar_unlocked + char *p = (char *) putchar_unlocked; + return !p; +#endif + + ; + return 0; +} _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" @@ -8867,154 +8564,194 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_header_compiler=yes + ac_cv_have_decl_putchar_unlocked=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_header_compiler=no + ac_cv_have_decl_putchar_unlocked=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: $ac_cv_have_decl_putchar_unlocked" >&5 +echo "${ECHO_T}$ac_cv_have_decl_putchar_unlocked" >&6; } +if test $ac_cv_have_decl_putchar_unlocked = 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 >>confdefs.h <<_ACEOF +#define HAVE_DECL_PUTCHAR_UNLOCKED 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_PUTCHAR_UNLOCKED 0 +_ACEOF + + +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 $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 +#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 +#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 /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <$ac_header> + +#define _XOPEN_SOURCE_EXTENDED 1 +#include +/* The following two lines are a workaround against an autoconf-2.52 bug. */ +#include +#include + +int +main () +{ +static int test_array [1 - 2 * !((EOVERFLOW) >= 0)]; +test_array [0] = 0 + + ; + 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; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_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 - ;; + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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 -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 - -{ echo "$as_me:$LINENO: checking for GNU libc compatible malloc" >&5 -echo $ECHO_N "checking for GNU libc compatible malloc... $ECHO_C" >&6; } -if test "${ac_cv_func_malloc_0_nonnull+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then - ac_cv_func_malloc_0_nonnull=no -else - cat >conftest.$ac_ext <<_ACEOF +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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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. */ -#if STDC_HEADERS || HAVE_STDLIB_H -# include -#else -char *malloc (); -#endif + +#define _XOPEN_SOURCE_EXTENDED 1 +#include +/* The following two lines are a workaround against an autoconf-2.52 bug. */ +#include +#include int main () { -return ! malloc (0); +static int test_array [1 - 2 * !((EOVERFLOW) <= $ac_mid)]; +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='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); } && { ac_try='./conftest$ac_exeext' + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; @@ -9024,135 +8761,115 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_func_malloc_0_nonnull=yes + ac_hi=$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 ) -ac_cv_func_malloc_0_nonnull=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext + 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 - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_func_malloc_0_nonnull" >&5 -echo "${ECHO_T}$ac_cv_func_malloc_0_nonnull" >&6; } -if test $ac_cv_func_malloc_0_nonnull = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_MALLOC 1 -_ACEOF - +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done else - cat >>confdefs.h <<\_ACEOF -#define HAVE_MALLOC 0 -_ACEOF - - case " $LIBOBJS " in - *" malloc.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS malloc.$ac_objext" - ;; -esac - + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -cat >>confdefs.h <<\_ACEOF -#define malloc rpl_malloc + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ _ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -fi - - - - - - - - - - - +#define _XOPEN_SOURCE_EXTENDED 1 +#include +/* The following two lines are a workaround against an autoconf-2.52 bug. */ +#include +#include +int +main () +{ +static int test_array [1 - 2 * !((EOVERFLOW) < 0)]; +test_array [0] = 0 - if test $ac_cv_header_wchar_h = yes && test $ac_cv_header_wctype_h = yes; then - case " $LIBOBJS " in - *" mbchar.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS mbchar.$ac_objext" - ;; + ; + 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 - - fi - - - - - : - - - -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 -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 +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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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 $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i 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 to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#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 +#define _XOPEN_SOURCE_EXTENDED 1 +#include +/* The following two lines are a workaround against an autoconf-2.52 bug. */ +#include +#include 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 @@ -9169,7 +8886,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; @@ -9179,63 +8896,57 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - eval "$as_ac_var=yes" + ac_lo=$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$ac_exeext 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 -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 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done else - case " $LIBOBJS " in - *" $ac_func.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext" - ;; -esac + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_lo= ac_hi= fi -done - - - if test $ac_cv_func_memchr = no; 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 +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; } -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 + +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. */ -$ac_includes_default -#include <$ac_header> + +#define _XOPEN_SOURCE_EXTENDED 1 +#include +/* The following two lines are a workaround against an autoconf-2.52 bug. */ +#include +#include + +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" @@ -9271,125 +8982,117 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_header_compiler=yes + ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_header_compiler=no + ac_lo=`expr '(' $ac_mid ')' + 1` 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 +done +case $ac_lo in +?*) ac_cv_decl_EOVERFLOW=$ac_lo;; +'') ;; +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 + +#define _XOPEN_SOURCE_EXTENDED 1 +#include +/* The following two lines are a workaround against an autoconf-2.52 bug. */ +#include +#include + +static long int longval () { return EOVERFLOW; } +static unsigned long int ulongval () { return EOVERFLOW; } +#include +#include +int +main () +{ + + 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_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>&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); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=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_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 *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext 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 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 -done +cat >>confdefs.h <<_ACEOF +#define EOVERFLOW $ac_cv_decl_EOVERFLOW +_ACEOF + EOVERFLOW="$ac_cv_decl_EOVERFLOW" fi -for ac_func in mkstemp -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 for signed" >&5 +echo $ECHO_N "checking for signed... $ECHO_C" >&6; } +if test "${bh_cv_c_signed+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -9398,53 +9101,23 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i 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 to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#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 (); +signed char x; ; 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 @@ -9461,7 +9134,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; @@ -9471,85 +9144,91 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - eval "$as_ac_var=yes" + bh_cv_c_signed=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - eval "$as_ac_var=no" + bh_cv_c_signed=no fi -rm -f core conftest.err conftest.$ac_objext \ - 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 +{ echo "$as_me:$LINENO: result: $bh_cv_c_signed" >&5 +echo "${ECHO_T}$bh_cv_c_signed" >&6; } + if test $bh_cv_c_signed = no; then + +cat >>confdefs.h <<\_ACEOF +#define signed _ACEOF -else - case " $LIBOBJS " in - *" $ac_func.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext" - ;; -esac + fi -fi -done - if test $ac_cv_func_mkstemp = no; then - gl_cv_func_mkstemp_limitations=yes - else - { echo "$as_me:$LINENO: checking for mkstemp limitations" >&5 -echo $ECHO_N "checking for mkstemp limitations... $ECHO_C" >&6; } -if test "${gl_cv_func_mkstemp_limitations+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else + ac_cv_type_long_long=$ac_cv_type_long_long_int + if test $ac_cv_type_long_long = yes; then - mkdir conftest.mkstemp - if test "$cross_compiling" = yes; then - gl_cv_func_mkstemp_limitations=yes +cat >>confdefs.h <<\_ACEOF +#define HAVE_LONG_LONG 1 +_ACEOF + + fi + + { echo "$as_me:$LINENO: checking for long double" >&5 +echo $ECHO_N "checking for long double... $ECHO_C" >&6; } +if test "${gt_cv_c_long_double+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + if test "$GCC" = yes; then + gt_cv_c_long_double=yes + else + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -# include -# include - int main () - { - int i; - for (i = 0; i < 70; i++) - { - char template[] = "conftest.mkstemp/coXXXXXX"; - int fd = mkstemp (template); - if (fd == -1) - exit (1); - close (fd); - } - exit (0); - } + /* The Stardent Vistra knows sizeof(long double), but does not support it. */ + long double foo = 0.0; + /* On Ultrix 4.3 cc, long double is 4 and double is 8. */ + int array [2*(sizeof(long double) >= sizeof(double)) - 1]; + +int +main () +{ + ; + 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' + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; @@ -9559,62 +9238,31 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - gl_cv_func_mkstemp_limitations=no + gt_cv_c_long_double=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_mkstemp_limitations=yes -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext + gt_cv_c_long_double=no fi - - rm -rf conftest.mkstemp - - +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi fi -{ echo "$as_me:$LINENO: result: $gl_cv_func_mkstemp_limitations" >&5 -echo "${ECHO_T}$gl_cv_func_mkstemp_limitations" >&6; } - fi - - if test $gl_cv_func_mkstemp_limitations = yes; then - case " $LIBOBJS " in - *" mkstemp.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS mkstemp.$ac_objext" - ;; -esac - - case " $LIBOBJS " in - *" tempname.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS tempname.$ac_objext" - ;; -esac - +{ echo "$as_me:$LINENO: result: $gt_cv_c_long_double" >&5 +echo "${ECHO_T}$gt_cv_c_long_double" >&6; } + if test $gt_cv_c_long_double = yes; then cat >>confdefs.h <<\_ACEOF -#define mkstemp rpl_mkstemp +#define HAVE_LONG_DOUBLE 1 _ACEOF + fi - - - - - - - - - -for ac_func in __secure_getenv gettimeofday -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 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 @@ -9623,53 +9271,24 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i 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 to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#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 + wchar_t foo = (wchar_t)'\0'; 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 @@ -9686,7 +9305,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; @@ -9696,36 +9315,30 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - eval "$as_ac_var=yes" + gt_cv_c_wchar_t=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$ac_exeext conftest.$ac_ext + gt_cv_c_wchar_t=no 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 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -done - +{ 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 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 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 @@ -9734,23 +9347,24 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include "obstack.h" +#include + wint_t foo = (wchar_t)'\0'; int main () { -struct obstack *mem; obstack_free(mem,(char *) 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 @@ -9767,7 +9381,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; @@ -9777,165 +9391,149 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_func_obstack=yes + gt_cv_c_wint_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_func_obstack=no + gt_cv_c_wint_t=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err 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 +{ 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_OBSTACK 1 +#define HAVE_WINT_T 1 _ACEOF -else - case " $LIBOBJS " in - *" obstack.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS obstack.$ac_objext" - ;; -esac - -fi - - if test $ac_cv_func_obstack = no; then - - - - - : - fi - - - -# Check whether --with-included-regex was given. -if test "${with_included_regex+set}" = set; then - withval=$with_included_regex; -fi - - - case $with_included_regex in #( - yes|no) ac_use_included_regex=$with_included_regex - ;; - '') - # If the system regex support is good enough that it passes the - # following run test, then default to *not* using the included regex.c. - # If cross compiling, assume the test would fail and use the included - # regex.c. The first failing regular expression is from `Spencer ere - # test #75' in grep-2.3. - { echo "$as_me:$LINENO: checking for working re_compile_pattern" >&5 -echo $ECHO_N "checking for working re_compile_pattern... $ECHO_C" >&6; } -if test "${gl_cv_func_re_compile_pattern_working+set}" = set; then + { 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 - if test "$cross_compiling" = yes; then - gl_cv_func_re_compile_pattern_working=no -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 - #include - #include - +#include +#include int main () { -static struct re_pattern_buffer regex; - unsigned char folded_chars[UCHAR_MAX + 1]; - int i; - const char *s; - struct re_registers regs; - re_set_syntax (RE_SYNTAX_POSIX_EGREP); - memset (®ex, 0, sizeof (regex)); - for (i = 0; i <= UCHAR_MAX; i++) - folded_chars[i] = i; - regex.translate = folded_chars; - s = re_compile_pattern ("a[[:]:]]b\n", 11, ®ex); - /* This should fail with _Invalid character class name_ error. */ - if (!s) - exit (1); - - /* This should succeed, but does not for e.g. glibc-2.1.3. */ - memset (®ex, 0, sizeof (regex)); - s = re_compile_pattern ("{1", 2, ®ex); - - if (s) - exit (1); - - /* The following example is derived from a problem report - against gawk from Jorge Stolfi . */ - memset (®ex, 0, sizeof (regex)); - s = re_compile_pattern ("[an\371]*n", 7, ®ex); - if (s) - exit (1); - - /* This should match, but does not for e.g. glibc-2.2.1. */ - if (re_match (®ex, "an", 2, 0, ®s) != 2) - exit (1); - - memset (®ex, 0, sizeof (regex)); - s = re_compile_pattern ("x", 1, ®ex); - if (s) - exit (1); +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 + *\"* | *\`* | *\\*) 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_header_inttypes_h=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 - /* The version of regex.c in e.g. GNU libc-2.2.93 did not - work with a negative RANGE argument. */ - if (re_search (®ex, "wxy", 3, 2, -2, ®s) != 1) - exit (1); + gl_cv_header_inttypes_h=no +fi - /* The version of regex.c in older versions of gnulib - ignored RE_ICASE. Detect that problem too. */ - memset (®ex, 0, sizeof (regex)); - re_set_syntax (RE_SYNTAX_EMACS | RE_ICASE); - s = re_compile_pattern ("x", 1, ®ex); - if (s) - exit (1); +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 - if (re_search (®ex, "WXY", 3, 0, 3, ®s) < 0) - exit (1); +cat >>confdefs.h <<_ACEOF +#define HAVE_INTTYPES_H_WITH_UINTMAX 1 +_ACEOF - /* REG_STARTEND was added to glibc on 2004-01-15. - Reject older versions. */ - if (! REG_STARTEND) - exit (1); + fi - /* Reject hosts whose regoff_t values are too narrow. - These include glibc 2.3.5 on hosts with 64-bit ptrdiff_t - and 32-bit int. */ - if (sizeof (regoff_t) < sizeof (ptrdiff_t) - || sizeof (regoff_t) < sizeof (ssize_t)) - exit (1); - exit (0); + { 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 +#include +int +main () +{ +uintmax_t i = (uintmax_t) -1; return !i; ; 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' + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; @@ -9945,166 +9543,3252 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - gl_cv_func_re_compile_pattern_working=yes + gl_cv_header_stdint_h=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_re_compile_pattern_working=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext + gl_cv_header_stdint_h=no fi - +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $gl_cv_func_re_compile_pattern_working" >&5 -echo "${ECHO_T}$gl_cv_func_re_compile_pattern_working" >&6; } - case $gl_cv_func_re_compile_pattern_working in #( - yes) ac_use_included_regex=no;; #( - no) ac_use_included_regex=yes;; - esac - ;; - *) { { echo "$as_me:$LINENO: error: Invalid value for --with-included-regex: $with_included_regex" >&5 -echo "$as_me: error: Invalid value for --with-included-regex: $with_included_regex" >&2;} - { (exit 1); exit 1; }; } - ;; - esac - - if test $ac_use_included_regex = yes; then +{ 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 _REGEX_LARGE_OFFSETS 1 +cat >>confdefs.h <<_ACEOF +#define HAVE_STDINT_H_WITH_UINTMAX 1 _ACEOF - -cat >>confdefs.h <<\_ACEOF -#define re_syntax_options rpl_re_syntax_options -_ACEOF + fi -cat >>confdefs.h <<\_ACEOF -#define re_set_syntax rpl_re_set_syntax -_ACEOF -cat >>confdefs.h <<\_ACEOF -#define re_compile_pattern rpl_re_compile_pattern + { 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 +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#if HAVE_STDINT_H_WITH_UINTMAX +#include +#endif +#if HAVE_INTTYPES_H_WITH_UINTMAX +#include +#endif -cat >>confdefs.h <<\_ACEOF -#define re_compile_fastmap rpl_re_compile_fastmap +int +main () +{ +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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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 + 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 -cat >>confdefs.h <<\_ACEOF -#define re_search rpl_re_search -_ACEOF - +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 re_search_2 rpl_re_search_2 +#define HAVE_INTMAX_T 1 _ACEOF + else -cat >>confdefs.h <<\_ACEOF -#define re_match rpl_re_match + 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 -cat >>confdefs.h <<\_ACEOF -#define re_match_2 rpl_re_match_2 -_ACEOF -cat >>confdefs.h <<\_ACEOF -#define re_set_registers rpl_re_set_registers -_ACEOF -cat >>confdefs.h <<\_ACEOF -#define re_comp rpl_re_comp + + + +if false; then + GL_COND_LIBTOOL_TRUE= + GL_COND_LIBTOOL_FALSE='#' +else + GL_COND_LIBTOOL_TRUE='#' + GL_COND_LIBTOOL_FALSE= +fi + + + + + + + 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 + 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 +#endif +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Need own alloca" >/dev/null 2>&1; then cat >>confdefs.h <<\_ACEOF -#define re_exec rpl_re_exec +#define HAVE_ALLOCA 1 _ACEOF + ALLOCA_H=alloca.h +else + ALLOCA_H= +fi +rm -f conftest* + + else + ALLOCA_H=alloca.h + fi + + cat >>confdefs.h <<\_ACEOF -#define regcomp rpl_regcomp +#define HAVE_ALLOCA_H 1 _ACEOF -cat >>confdefs.h <<\_ACEOF -#define regexec rpl_regexec + + case " $LIBOBJS " in + *" cloexec.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS cloexec.$ac_objext" + ;; +esac + + + + case " $LIBOBJS " in + *" close-stream.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS close-stream.$ac_objext" + ;; +esac + + + : + + + { 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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +error_at_line (0, 0, "", 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s 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_lib_error_at_line=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_lib_error_at_line=no +fi -cat >>confdefs.h <<\_ACEOF -#define regerror rpl_regerror +rm -f core conftest.err conftest.$ac_objext \ + 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 + case " $LIBOBJS " in + *" error.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS error.$ac_objext" + ;; +esac + +fi + + + + : + + + + case " $LIBOBJS " in + *" exitfail.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS exitfail.$ac_objext" + ;; +esac + + + : + + + case " $LIBOBJS " in + *" fopen-safer.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS fopen-safer.$ac_objext" + ;; +esac + + + + +for ac_header in stdio_ext.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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_header_compiler=no +fi -cat >>confdefs.h <<\_ACEOF -#define regfree rpl_regfree +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; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_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 + + +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 declares $ac_func. + For example, HP-UX 11i 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 to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s 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 + 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$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 + case " $LIBOBJS " in + *" $ac_func.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext" + ;; +esac + +fi +done + + + fp_headers=' +# include +# if HAVE_STDIO_EXT_H +# include +# 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 () +{ +#ifndef __fpending + char *p = (char *) __fpending; + return !p; +#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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_have_decl___fpending=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl___fpending=no +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 + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL___FPENDING 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL___FPENDING 0 +_ACEOF + + +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 + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +int +main () +{ +FILE *fp = stdin; (void) ($ac_expr); + ; + 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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 + fp_done=yes + +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 + test "$fp_done" = yes && break + done + + ac_cv_sys_pending_output_n_bytes=$ac_expr + + +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 +_ACEOF + + 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 + 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 +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 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_free=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gl_cv_func_free=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $gl_cv_func_free" >&5 +echo "${ECHO_T}$gl_cv_func_free" >&6; } + + if test $gl_cv_func_free = no; then + case " $LIBOBJS " in + *" free.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS free.$ac_objext" + ;; +esac + + +cat >>confdefs.h <<\_ACEOF +#define free rpl_free +_ACEOF + + fi + + + + if test -n "$GETOPT_H"; then + + case " $LIBOBJS " in + *" getopt.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS getopt.$ac_objext" + ;; +esac + + case " $LIBOBJS " in + *" getopt1.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS getopt1.$ac_objext" + ;; +esac + + + GETOPT_H=getopt.h + +cat >>confdefs.h <<\_ACEOF +#define __GETOPT_PREFIX rpl_ +_ACEOF + + + + + + + + + + +fi + + + +for ac_header in stdlib.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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_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 + +{ echo "$as_me:$LINENO: checking for GNU libc compatible malloc" >&5 +echo $ECHO_N "checking for GNU libc compatible malloc... $ECHO_C" >&6; } +if test "${ac_cv_func_malloc_0_nonnull+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_malloc_0_nonnull=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 STDC_HEADERS || HAVE_STDLIB_H +# include +#else +char *malloc (); +#endif + +int +main () +{ +return ! malloc (0); + ; + 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_func_malloc_0_nonnull=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 ) +ac_cv_func_malloc_0_nonnull=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: $ac_cv_func_malloc_0_nonnull" >&5 +echo "${ECHO_T}$ac_cv_func_malloc_0_nonnull" >&6; } +if test $ac_cv_func_malloc_0_nonnull = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_MALLOC 1 +_ACEOF + +else + cat >>confdefs.h <<\_ACEOF +#define HAVE_MALLOC 0 +_ACEOF + + case " $LIBOBJS " in + *" malloc.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS malloc.$ac_objext" + ;; +esac + + +cat >>confdefs.h <<\_ACEOF +#define malloc rpl_malloc +_ACEOF + +fi + + + + + + + + + + + + if test $ac_cv_header_wchar_h = yes; then + case " $LIBOBJS " in + *" mbchar.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS mbchar.$ac_objext" + ;; +esac + + + + + + + + +for ac_func in iswcntrl +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 declares $ac_func. + For example, HP-UX 11i 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 to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s 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 + 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$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 + + fi + + + + + : + + + +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 +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 declares $ac_func. + For example, HP-UX 11i 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 to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s 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 + 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$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 + case " $LIBOBJS " in + *" $ac_func.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext" + ;; +esac + +fi +done + + + if test $ac_cv_func_memchr = no; 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 + # 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_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 + + + fi + + +for ac_func in mkstemp +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 declares $ac_func. + For example, HP-UX 11i 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 to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s 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 + 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$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 + case " $LIBOBJS " in + *" $ac_func.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext" + ;; +esac + +fi +done + + + if test $ac_cv_func_mkstemp = no; then + gl_cv_func_mkstemp_limitations=yes + else + { echo "$as_me:$LINENO: checking for mkstemp limitations" >&5 +echo $ECHO_N "checking for mkstemp limitations... $ECHO_C" >&6; } +if test "${gl_cv_func_mkstemp_limitations+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + mkdir conftest.mkstemp + if test "$cross_compiling" = yes; then + gl_cv_func_mkstemp_limitations=yes + +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +# include +# include + int main () + { + int i; + for (i = 0; i < 70; i++) + { + char template[] = "conftest.mkstemp/coXXXXXX"; + int fd = mkstemp (template); + if (fd == -1) + exit (1); + close (fd); + } + exit (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_mkstemp_limitations=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_func_mkstemp_limitations=yes +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_mkstemp_limitations" >&5 +echo "${ECHO_T}$gl_cv_func_mkstemp_limitations" >&6; } + fi + + if test $gl_cv_func_mkstemp_limitations = yes; then + case " $LIBOBJS " in + *" mkstemp.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS mkstemp.$ac_objext" + ;; +esac + + case " $LIBOBJS " in + *" tempname.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS tempname.$ac_objext" + ;; +esac + + +cat >>confdefs.h <<\_ACEOF +#define mkstemp rpl_mkstemp +_ACEOF + + + + + + + + + + + + +for ac_func in __secure_getenv gettimeofday +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 declares $ac_func. + For example, HP-UX 11i 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 to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s 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 + 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$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 + + + fi + + { 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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include "obstack.h" +int +main () +{ +struct obstack *mem; obstack_free(mem,(char *) 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s 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_obstack=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_func_obstack=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext 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 + case " $LIBOBJS " in + *" obstack.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS obstack.$ac_objext" + ;; +esac + +fi + + + +# Check whether --with-included-regex was given. +if test "${with_included_regex+set}" = set; then + withval=$with_included_regex; +fi + + + case $with_included_regex in #( + yes|no) ac_use_included_regex=$with_included_regex + ;; + '') + # If the system regex support is good enough that it passes the + # following run test, then default to *not* using the included regex.c. + # If cross compiling, assume the test would fail and use the included + # regex.c. The first failing regular expression is from `Spencer ere + # test #75' in grep-2.3. + { echo "$as_me:$LINENO: checking for working re_compile_pattern" >&5 +echo $ECHO_N "checking for working re_compile_pattern... $ECHO_C" >&6; } +if test "${gl_cv_func_re_compile_pattern_working+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + gl_cv_func_re_compile_pattern_working=no +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 + #include + #include + +int +main () +{ +static struct re_pattern_buffer regex; + unsigned char folded_chars[UCHAR_MAX + 1]; + int i; + const char *s; + struct re_registers regs; + re_set_syntax (RE_SYNTAX_POSIX_EGREP); + memset (®ex, 0, sizeof (regex)); + for (i = 0; i <= UCHAR_MAX; i++) + folded_chars[i] = i; + regex.translate = folded_chars; + s = re_compile_pattern ("a[[:]:]]b\n", 11, ®ex); + /* This should fail with _Invalid character class name_ error. */ + if (!s) + exit (1); + + /* This should succeed, but does not for e.g. glibc-2.1.3. */ + memset (®ex, 0, sizeof (regex)); + s = re_compile_pattern ("{1", 2, ®ex); + + if (s) + exit (1); + + /* The following example is derived from a problem report + against gawk from Jorge Stolfi . */ + memset (®ex, 0, sizeof (regex)); + s = re_compile_pattern ("[an\371]*n", 7, ®ex); + if (s) + exit (1); + + /* This should match, but does not for e.g. glibc-2.2.1. */ + if (re_match (®ex, "an", 2, 0, ®s) != 2) + exit (1); + + memset (®ex, 0, sizeof (regex)); + s = re_compile_pattern ("x", 1, ®ex); + if (s) + exit (1); + + /* The version of regex.c in e.g. GNU libc-2.2.93 did not + work with a negative RANGE argument. */ + if (re_search (®ex, "wxy", 3, 2, -2, ®s) != 1) + exit (1); + + /* The version of regex.c in older versions of gnulib + ignored RE_ICASE. Detect that problem too. */ + memset (®ex, 0, sizeof (regex)); + re_set_syntax (RE_SYNTAX_EMACS | RE_ICASE); + s = re_compile_pattern ("x", 1, ®ex); + if (s) + exit (1); + + if (re_search (®ex, "WXY", 3, 0, 3, ®s) < 0) + exit (1); + + /* REG_STARTEND was added to glibc on 2004-01-15. + Reject older versions. */ + if (! REG_STARTEND) + exit (1); + + /* Reject hosts whose regoff_t values are too narrow. + These include glibc 2.3.5 on hosts with 64-bit ptrdiff_t + and 32-bit int. */ + if (sizeof (regoff_t) < sizeof (ptrdiff_t) + || sizeof (regoff_t) < sizeof (ssize_t)) + exit (1); + + exit (0); + ; + 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_re_compile_pattern_working=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_re_compile_pattern_working=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_re_compile_pattern_working" >&5 +echo "${ECHO_T}$gl_cv_func_re_compile_pattern_working" >&6; } + case $gl_cv_func_re_compile_pattern_working in #( + yes) ac_use_included_regex=no;; #( + no) ac_use_included_regex=yes;; + esac + ;; + *) { { echo "$as_me:$LINENO: error: Invalid value for --with-included-regex: $with_included_regex" >&5 +echo "$as_me: error: Invalid value for --with-included-regex: $with_included_regex" >&2;} + { (exit 1); exit 1; }; } + ;; + esac + + if test $ac_use_included_regex = yes; then + +cat >>confdefs.h <<\_ACEOF +#define _REGEX_LARGE_OFFSETS 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define re_syntax_options rpl_re_syntax_options +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define re_set_syntax rpl_re_set_syntax +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define re_compile_pattern rpl_re_compile_pattern +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define re_compile_fastmap rpl_re_compile_fastmap +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define re_search rpl_re_search +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define re_search_2 rpl_re_search_2 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define re_match rpl_re_match +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define re_match_2 rpl_re_match_2 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define re_set_registers rpl_re_set_registers +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define re_comp rpl_re_comp +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define re_exec rpl_re_exec +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define regcomp rpl_regcomp +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define regexec rpl_regexec +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define regerror rpl_regerror +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define regfree rpl_regfree +_ACEOF + + case " $LIBOBJS " in + *" regex.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS regex.$ac_objext" + ;; +esac + + + + + + + + + + + + + + + + + + + + + + + + + + + + { echo "$as_me:$LINENO: checking whether isblank is declared" >&5 +echo $ECHO_N "checking whether isblank is declared... $ECHO_C" >&6; } +if test "${ac_cv_have_decl_isblank+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 + +int +main () +{ +#ifndef isblank + char *p = (char *) isblank; + return !p; +#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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_have_decl_isblank=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl_isblank=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_isblank" >&5 +echo "${ECHO_T}$ac_cv_have_decl_isblank" >&6; } +if test $ac_cv_have_decl_isblank = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_ISBLANK 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_ISBLANK 0 +_ACEOF + + +fi + + + + fi + + + +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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_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 + + { echo "$as_me:$LINENO: checking for SIZE_MAX" >&5 +echo $ECHO_N "checking for SIZE_MAX... $ECHO_C" >&6; } + result= + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#if HAVE_STDINT_H +#include +#endif +#ifdef SIZE_MAX +Found it +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Found it" >/dev/null 2>&1; then + result=yes +fi +rm -f conftest* + + if test -z "$result"; 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. */ +#include +#include +int +main () +{ +static int test_array [1 - 2 * !((sizeof (size_t) * CHAR_BIT - 1) >= 0)]; +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_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='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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. */ +#include +#include +int +main () +{ +static int test_array [1 - 2 * !((sizeof (size_t) * CHAR_BIT - 1) <= $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_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='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_hi=$ac_mid; break +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` +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 + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +int +main () +{ +static int test_array [1 - 2 * !((sizeof (size_t) * CHAR_BIT - 1) < 0)]; +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_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='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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. */ +#include +#include +int +main () +{ +static int test_array [1 - 2 * !((sizeof (size_t) * CHAR_BIT - 1) >= $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_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='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_lo=$ac_mid; break +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` +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 + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +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 +#include +int +main () +{ +static int test_array [1 - 2 * !((sizeof (size_t) * CHAR_BIT - 1) <= $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_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='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_hi=$ac_mid +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo=`expr '(' $ac_mid ')' + 1` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) size_t_bits_minus_1=$ac_lo;; +'') size_t_bits_minus_1= ;; +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 +#include +static long int longval () { return sizeof (size_t) * CHAR_BIT - 1; } +static unsigned long int ulongval () { return sizeof (size_t) * CHAR_BIT - 1; } +#include +#include +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + return 1; + if ((sizeof (size_t) * CHAR_BIT - 1) < 0) + { + long int i = longval (); + if (i != (sizeof (size_t) * CHAR_BIT - 1)) + return 1; + fprintf (f, "%ld\n", i); + } + else + { + unsigned long int i = ulongval (); + if (i != (sizeof (size_t) * CHAR_BIT - 1)) + return 1; + fprintf (f, "%lu\n", i); + } + return ferror (f) || fclose (f) != 0; + + ; + 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 + size_t_bits_minus_1=`cat conftest.val` +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 ) +size_t_bits_minus_1= +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 + 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. */ +#include +int +main () +{ +static int test_array [1 - 2 * !((sizeof (size_t) <= sizeof (unsigned int)) >= 0)]; +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_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='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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. */ +#include +int +main () +{ +static int test_array [1 - 2 * !((sizeof (size_t) <= sizeof (unsigned int)) <= $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_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='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_hi=$ac_mid; break +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` +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 + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +static int test_array [1 - 2 * !((sizeof (size_t) <= sizeof (unsigned int)) < 0)]; +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_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='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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. */ +#include +int +main () +{ +static int test_array [1 - 2 * !((sizeof (size_t) <= sizeof (unsigned int)) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} _ACEOF - - case " $LIBOBJS " in - *" regex.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS regex.$ac_objext" - ;; +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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_lo=$ac_mid; break +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` +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 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi - - - - - - - - - - - - - - - - - - - - - - - { echo "$as_me:$LINENO: checking whether isblank is declared" >&5 -echo $ECHO_N "checking whether isblank is declared... $ECHO_C" >&6; } -if test "${ac_cv_have_decl_isblank+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else +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 - +#include int main () { -#ifndef isblank - char *p = (char *) isblank; - return !p; -#endif +static int test_array [1 - 2 * !((sizeof (size_t) <= sizeof (unsigned int)) <= $ac_mid)]; +test_array [0] = 0 ; return 0; @@ -10144,53 +12828,110 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_have_decl_isblank=yes + ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_have_decl_isblank=no + ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_isblank" >&5 -echo "${ECHO_T}$ac_cv_have_decl_isblank" >&6; } -if test $ac_cv_have_decl_isblank = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_ISBLANK 1 +done +case $ac_lo in +?*) fits_in_uint=$ac_lo;; +'') fits_in_uint= ;; +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 +static long int longval () { return sizeof (size_t) <= sizeof (unsigned int); } +static unsigned long int ulongval () { return sizeof (size_t) <= sizeof (unsigned int); } +#include +#include +int +main () +{ + FILE *f = fopen ("conftest.val", "w"); + if (! f) + return 1; + if ((sizeof (size_t) <= sizeof (unsigned int)) < 0) + { + long int i = longval (); + if (i != (sizeof (size_t) <= sizeof (unsigned int))) + return 1; + fprintf (f, "%ld\n", i); + } + else + { + unsigned long int i = ulongval (); + if (i != (sizeof (size_t) <= sizeof (unsigned int))) + return 1; + fprintf (f, "%lu\n", i); + } + return ferror (f) || fclose (f) != 0; -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_ISBLANK 0 + ; + 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 + fits_in_uint=`cat conftest.val` +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 ) +fits_in_uint= fi - - - - fi - - { echo "$as_me:$LINENO: checking for C/C++ restrict keyword" >&5 -echo $ECHO_N "checking for C/C++ restrict keyword... $ECHO_C" >&6; } -if test "${gl_cv_c_restrict+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - gl_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 - cat >conftest.$ac_ext <<_ACEOF +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.val + if test -n "$size_t_bits_minus_1" && test -n "$fits_in_uint"; then + if test $fits_in_uint = 1; then + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -float * $ac_kw x; +#include + extern size_t foo; + extern unsigned long foo; + +int +main () +{ + + ; + return 0; +} _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" @@ -10226,7 +12967,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - gl_cv_c_restrict=$ac_kw; break + fits_in_uint=0 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -10235,50 +12976,47 @@ sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done + fi + if test $fits_in_uint = 1; then + result="(((1U << $size_t_bits_minus_1) - 1) * 2 + 1)" + else + result="(((1UL << $size_t_bits_minus_1) - 1) * 2 + 1)" + fi + else + result='((size_t)~(size_t)0)' + fi + fi + { echo "$as_me:$LINENO: result: $result" >&5 +echo "${ECHO_T}$result" >&6; } + if test "$result" != yes; then -fi -{ echo "$as_me:$LINENO: result: $gl_cv_c_restrict" >&5 -echo "${ECHO_T}$gl_cv_c_restrict" >&6; } - case $gl_cv_c_restrict in - restrict) ;; - no) -cat >>confdefs.h <<\_ACEOF -#define restrict -_ACEOF - ;; - *) cat >>confdefs.h <<_ACEOF -#define restrict $gl_cv_c_restrict +cat >>confdefs.h <<_ACEOF +#define SIZE_MAX $result _ACEOF - ;; - esac + fi -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 ssize_t" >&5 +echo $ECHO_N "checking for ssize_t... $ECHO_C" >&6; } +if test "${gt_cv_ssize_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 +int +main () +{ +int x = sizeof (ssize_t *) + sizeof (ssize_t); + return !x; + ; + return 0; +} _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" @@ -10314,156 +13052,50 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_header_compiler=yes + gt_cv_ssize_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_header_compiler=no + gt_cv_ssize_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; } - -# 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; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_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; } +{ echo "$as_me:$LINENO: result: $gt_cv_ssize_t" >&5 +echo "${ECHO_T}$gt_cv_ssize_t" >&6; } + if test $gt_cv_ssize_t = no; 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 ssize_t int _ACEOF -fi + fi -done - { echo "$as_me:$LINENO: checking for SIZE_MAX" >&5 -echo $ECHO_N "checking for SIZE_MAX... $ECHO_C" >&6; } - result= - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#if HAVE_STDINT_H -#include -#endif -#ifdef SIZE_MAX -Found it -#endif -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "Found it" >/dev/null 2>&1; then - result=yes -fi -rm -f conftest* - if test -z "$result"; then - if test "$cross_compiling" = yes; then - # Depending upon the size, compute the lo and hi bounds. -cat >conftest.$ac_ext <<_ACEOF + { 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 + 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 -#include +#include int main () { -static int test_array [1 - 2 * !((sizeof (size_t) * CHAR_BIT - 1) >= 0)]; -test_array [0] = 0 + +#ifndef va_copy +void (*func) (va_list, va_list) = va_copy; +#endif ; return 0; @@ -10503,21 +13135,39 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_lo=0 ac_mid=0 - while :; do - cat >conftest.$ac_ext <<_ACEOF + gl_cv_func_va_copy=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gl_cv_func_va_copy=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +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 + 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 -#include +#include int main () { -static int test_array [1 - 2 * !((sizeof (size_t) * CHAR_BIT - 1) <= $ac_mid)]; -test_array [0] = 0 + +#ifndef __va_copy +error, bail out +#endif ; return 0; @@ -10557,92 +13207,263 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_hi=$ac_mid; break + gl_cv_func___va_copy=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` -fi + gl_cv_func___va_copy=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + + if test $gl_cv_func___va_copy = yes; then + +cat >>confdefs.h <<\_ACEOF +#define va_copy __va_copy +_ACEOF + + else + + + +cat >>confdefs.h <<\_ACEOF +#define va_copy gl_va_copy +_ACEOF + + fi + fi + + + + + # Define two additional variables used in the Makefile substitution. + + if test "$ac_cv_header_stdbool_h" = yes; then + STDBOOL_H='' + else + STDBOOL_H='stdbool.h' + fi + + + if test "$ac_cv_type__Bool" = yes; then + HAVE__BOOL=1 + else + HAVE__BOOL=0 + fi + + + + + + if test $ac_cv_type_long_long_int = yes; then + HAVE_LONG_LONG_INT=1 + else + HAVE_LONG_LONG_INT=0 + fi + + + + + + + + + if test $ac_cv_header_wchar_h = yes; then + HAVE_WCHAR_H=1 + else + HAVE_WCHAR_H=0 + fi + + + if test $ac_cv_header_inttypes_h = yes; then + HAVE_INTTYPES_H=1 + else + HAVE_INTTYPES_H=0 + fi + + + if test $ac_cv_header_sys_types_h = yes; then + HAVE_SYS_TYPES_H=1 + else + HAVE_SYS_TYPES_H=0 + fi + -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done + if test $ac_cv_header_stdint_h = yes; then + { echo "$as_me:$LINENO: checking absolute name of " >&5 +echo $ECHO_N "checking absolute name of ... $ECHO_C" >&6; } +if test "${gl_cv_absolute_stdint_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - cat >conftest.$ac_ext <<_ACEOF + + + + + if test $ac_cv_header_stdint_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 -#include -int -main () -{ -static int test_array [1 - 2 * !((sizeof (size_t) * CHAR_BIT - 1) < 0)]; -test_array [0] = 0 +#include +_ACEOF + gl_cv_absolute_stdint_h=`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | +sed -n '\#/stdint.h#{s#.*"\(.*/stdint.h\)".*#\1#;s#^/[^/]#//&#;p;q;}'` + fi - ; - return 0; -} +fi +{ echo "$as_me:$LINENO: result: $gl_cv_absolute_stdint_h" >&5 +echo "${ECHO_T}$gl_cv_absolute_stdint_h" >&6; } +cat >>confdefs.h <<_ACEOF +#define ABSOLUTE_STDINT_H "$gl_cv_absolute_stdint_h" _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); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (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); }; } && - { ac_try='test -s conftest.$ac_objext' - { (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_hi=-1 ac_mid=-1 - while :; do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ + + + ABSOLUTE_STDINT_H=\"$gl_cv_absolute_stdint_h\" + HAVE_STDINT_H=1 + else + ABSOLUTE_STDINT_H=\"no/such/file/stdint.h\" + HAVE_STDINT_H=0 + fi + + + + if test $ac_cv_header_stdint_h = yes; then + { echo "$as_me:$LINENO: checking whether stdint.h conforms to C99" >&5 +echo $ECHO_N "checking whether stdint.h conforms to C99... $ECHO_C" >&6; } +if test "${gl_cv_header_working_stdint_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + gl_cv_header_working_stdint_h=no + cat >conftest.$ac_ext <<_ACEOF + + /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ + #include -#include +#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 */ +#include ABSOLUTE_STDINT_H +#ifdef INT8_MAX +int8_t a1 = INT8_MAX; +int8_t a1min = INT8_MIN; +#endif +#ifdef INT16_MAX +int16_t a2 = INT16_MAX; +int16_t a2min = INT16_MIN; +#endif +#ifdef INT32_MAX +int32_t a3 = INT32_MAX; +int32_t a3min = INT32_MIN; +#endif +#ifdef INT64_MAX +int64_t a4 = INT64_MAX; +int64_t a4min = INT64_MIN; +#endif +#ifdef UINT8_MAX +uint8_t b1 = UINT8_MAX; +#else +typedef int b1[(unsigned char) -1 != 255 ? 1 : -1]; +#endif +#ifdef UINT16_MAX +uint16_t b2 = UINT16_MAX; +#endif +#ifdef UINT32_MAX +uint32_t b3 = UINT32_MAX; +#endif +#ifdef UINT64_MAX +uint64_t b4 = UINT64_MAX; +#endif +int_least8_t c1 = INT8_C (0x7f); +int_least8_t c1max = INT_LEAST8_MAX; +int_least8_t c1min = INT_LEAST8_MIN; +int_least16_t c2 = INT16_C (0x7fff); +int_least16_t c2max = INT_LEAST16_MAX; +int_least16_t c2min = INT_LEAST16_MIN; +int_least32_t c3 = INT32_C (0x7fffffff); +int_least32_t c3max = INT_LEAST32_MAX; +int_least32_t c3min = INT_LEAST32_MIN; +int_least64_t c4 = INT64_C (0x7fffffffffffffff); +int_least64_t c4max = INT_LEAST64_MAX; +int_least64_t c4min = INT_LEAST64_MIN; +uint_least8_t d1 = UINT8_C (0xff); +uint_least8_t d1max = UINT_LEAST8_MAX; +uint_least16_t d2 = UINT16_C (0xffff); +uint_least16_t d2max = UINT_LEAST16_MAX; +uint_least32_t d3 = UINT32_C (0xffffffff); +uint_least32_t d3max = UINT_LEAST32_MAX; +uint_least64_t d4 = UINT64_C (0xffffffffffffffff); +uint_least64_t d4max = UINT_LEAST64_MAX; +int_fast8_t e1 = INT_FAST8_MAX; +int_fast8_t e1min = INT_FAST8_MIN; +int_fast16_t e2 = INT_FAST16_MAX; +int_fast16_t e2min = INT_FAST16_MIN; +int_fast32_t e3 = INT_FAST32_MAX; +int_fast32_t e3min = INT_FAST32_MIN; +int_fast64_t e4 = INT_FAST64_MAX; +int_fast64_t e4min = INT_FAST64_MIN; +uint_fast8_t f1 = UINT_FAST8_MAX; +uint_fast16_t f2 = UINT_FAST16_MAX; +uint_fast32_t f3 = UINT_FAST32_MAX; +uint_fast64_t f4 = UINT_FAST64_MAX; +#ifdef INTPTR_MAX +intptr_t g = INTPTR_MAX; +intptr_t gmin = INTPTR_MIN; +#endif +#ifdef UINTPTR_MAX +uintptr_t h = UINTPTR_MAX; +#endif +intmax_t i = INTMAX_MAX; +uintmax_t j = UINTMAX_MAX; +struct s { + int check_PTRDIFF: PTRDIFF_MIN < 0 && 0 < PTRDIFF_MAX ? 1 : -1; + int check_SIG_ATOMIC: SIG_ATOMIC_MIN <= 0 && 0 < SIG_ATOMIC_MAX ? 1 : -1; + int check_SIZE: 0 < SIZE_MAX ? 1 : -1; + int check_WCHAR: WCHAR_MIN <= 0 && 0 < WCHAR_MAX ? 1 : -1; + int check_WINT: WINT_MIN <= 0 && 0 < WINT_MAX ? 1 : -1; + + /* Detect bugs in glibc 2.4 and Solaris 10 stdint.h, among others. */ + int check_UINT8_C: + (-1 < UINT8_C (0)) == (-1 < (uint_least8_t) 0) ? 1 : -1; + int check_UINT16_C: + (-1 < UINT16_C (0)) == (-1 < (uint_least16_t) 0) ? 1 : -1; + + /* Detect bugs in OpenBSD 3.9 stdint.h. */ +#ifdef UINT8_MAX + int check_uint8: (uint8_t) -1 == UINT8_MAX ? 1 : -1; +#endif +#ifdef UINT16_MAX + int check_uint16: (uint16_t) -1 == UINT16_MAX ? 1 : -1; +#endif +#ifdef UINT32_MAX + int check_uint32: (uint32_t) -1 == UINT32_MAX ? 1 : -1; +#endif +#ifdef UINT64_MAX + int check_uint64: (uint64_t) -1 == UINT64_MAX ? 1 : -1; +#endif + int check_uint_least8: (uint_least8_t) -1 == UINT_LEAST8_MAX ? 1 : -1; + int check_uint_least16: (uint_least16_t) -1 == UINT_LEAST16_MAX ? 1 : -1; + int check_uint_least32: (uint_least32_t) -1 == UINT_LEAST32_MAX ? 1 : -1; + int check_uint_least64: (uint_least64_t) -1 == UINT_LEAST64_MAX ? 1 : -1; + int check_uint_fast8: (uint_fast8_t) -1 == UINT_FAST8_MAX ? 1 : -1; + int check_uint_fast16: (uint_fast16_t) -1 == UINT_FAST16_MAX ? 1 : -1; + int check_uint_fast32: (uint_fast32_t) -1 == UINT_FAST32_MAX ? 1 : -1; + int check_uint_fast64: (uint_fast64_t) -1 == UINT_FAST64_MAX ? 1 : -1; + int check_uintptr: (uintptr_t) -1 == UINTPTR_MAX ? 1 : -1; + int check_uintmax: (uintmax_t) -1 == UINTMAX_MAX ? 1 : -1; + int check_size: (size_t) -1 == SIZE_MAX ? 1 : -1; +}; + int main () { -static int test_array [1 - 2 * !((sizeof (size_t) * CHAR_BIT - 1) >= $ac_mid)]; -test_array [0] = 0 ; return 0; @@ -10682,52 +13503,47 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_lo=$ac_mid; break + gl_cv_header_working_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` -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 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi +{ echo "$as_me:$LINENO: result: $gl_cv_header_working_stdint_h" >&5 +echo "${ECHO_T}$gl_cv_header_working_stdint_h" >&6; } + fi + if test "$gl_cv_header_working_stdint_h" != yes; then -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 + + +for ac_header in sys/inttypes.h sys/bitypes.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. */ -#include -#include -int -main () -{ -static int test_array [1 - 2 * !((sizeof (size_t) * CHAR_BIT - 1) <= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} +$ac_includes_default +#include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" @@ -10763,93 +13579,143 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_hi=$ac_mid + ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_lo=`expr '(' $ac_mid ')' + 1` + ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -done -case $ac_lo in -?*) size_t_bits_minus_1=$ac_lo;; -'') size_t_bits_minus_1= ;; -esac -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. */ -#include -#include -static long int longval () { return sizeof (size_t) * CHAR_BIT - 1; } -static unsigned long int ulongval () { return sizeof (size_t) * CHAR_BIT - 1; } -#include -#include -int -main () -{ - - FILE *f = fopen ("conftest.val", "w"); - if (! f) - return 1; - if ((sizeof (size_t) * CHAR_BIT - 1) < 0) - { - long int i = longval (); - if (i != (sizeof (size_t) * CHAR_BIT - 1)) - return 1; - fprintf (f, "%ld\n", i); - } - else - { - unsigned long int i = ulongval (); - if (i != (sizeof (size_t) * CHAR_BIT - 1)) - return 1; - fprintf (f, "%lu\n", i); - } - return ferror (f) || fclose (f) != 0; - - ; - 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 + (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); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_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 -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 - size_t_bits_minus_1=`cat conftest.val` +{ 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 - 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_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; } -( exit $ac_status ) -size_t_bits_minus_1= fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +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.val - if test "$cross_compiling" = yes; then + +done + + if test $ac_cv_header_sys_inttypes_h = yes; then + HAVE_SYS_INTTYPES_H=1 + else + HAVE_SYS_INTTYPES_H=0 + fi + + if test $ac_cv_header_sys_bitypes_h = yes; then + HAVE_SYS_BITYPES_H=1 + else + HAVE_SYS_BITYPES_H=0 + fi + + + + + + + + + + + for gltype in ptrdiff_t sig_atomic_t size_t wchar_t wint_t ; do + { echo "$as_me:$LINENO: checking for bit size of $gltype" >&5 +echo $ECHO_N "checking for bit size of $gltype... $ECHO_C" >&6; } +if { as_var=gl_cv_bitsizeof_${gltype}; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -10857,11 +13723,22 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include + + #include + #include + #if HAVE_WCHAR_H + /* BSD/OS 4.1 has a bug: and must be included before + . */ + # include + # include + # include + #endif + +#include int main () { -static int test_array [1 - 2 * !((sizeof (size_t) <= sizeof (unsigned int)) >= 0)]; +static int test_array [1 - 2 * !((sizeof ($gltype) * CHAR_BIT) >= 0)]; test_array [0] = 0 ; @@ -10910,11 +13787,22 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include + + #include + #include + #if HAVE_WCHAR_H + /* BSD/OS 4.1 has a bug: and must be included before + . */ + # include + # include + # include + #endif + +#include int main () { -static int test_array [1 - 2 * !((sizeof (size_t) <= sizeof (unsigned int)) <= $ac_mid)]; +static int test_array [1 - 2 * !((sizeof ($gltype) * CHAR_BIT) <= $ac_mid)]; test_array [0] = 0 ; @@ -10980,11 +13868,22 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include + + #include + #include + #if HAVE_WCHAR_H + /* BSD/OS 4.1 has a bug: and must be included before + . */ + # include + # include + # include + #endif + +#include int main () { -static int test_array [1 - 2 * !((sizeof (size_t) <= sizeof (unsigned int)) < 0)]; +static int test_array [1 - 2 * !((sizeof ($gltype) * CHAR_BIT) < 0)]; test_array [0] = 0 ; @@ -11033,11 +13932,22 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include + + #include + #include + #if HAVE_WCHAR_H + /* BSD/OS 4.1 has a bug: and must be included before + . */ + # include + # include + # include + #endif + +#include int main () { -static int test_array [1 - 2 * !((sizeof (size_t) <= sizeof (unsigned int)) >= $ac_mid)]; +static int test_array [1 - 2 * !((sizeof ($gltype) * CHAR_BIT) >= $ac_mid)]; test_array [0] = 0 ; @@ -11113,11 +14023,22 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include + + #include + #include + #if HAVE_WCHAR_H + /* BSD/OS 4.1 has a bug: and must be included before + . */ + # include + # include + # include + #endif + +#include int main () { -static int test_array [1 - 2 * !((sizeof (size_t) <= sizeof (unsigned int)) <= $ac_mid)]; +static int test_array [1 - 2 * !((sizeof ($gltype) * CHAR_BIT) <= $ac_mid)]; test_array [0] = 0 ; @@ -11164,173 +14085,14 @@ else sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -done -case $ac_lo in -?*) fits_in_uint=$ac_lo;; -'') fits_in_uint= ;; -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 -static long int longval () { return sizeof (size_t) <= sizeof (unsigned int); } -static unsigned long int ulongval () { return sizeof (size_t) <= sizeof (unsigned int); } -#include -#include -int -main () -{ - - FILE *f = fopen ("conftest.val", "w"); - if (! f) - return 1; - if ((sizeof (size_t) <= sizeof (unsigned int)) < 0) - { - long int i = longval (); - if (i != (sizeof (size_t) <= sizeof (unsigned int))) - return 1; - fprintf (f, "%ld\n", i); - } - else - { - unsigned long int i = ulongval (); - if (i != (sizeof (size_t) <= sizeof (unsigned int))) - return 1; - fprintf (f, "%lu\n", i); - } - return ferror (f) || fclose (f) != 0; - - ; - 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 - fits_in_uint=`cat conftest.val` -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 ) -fits_in_uint= -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 - if test -n "$size_t_bits_minus_1" && test -n "$fits_in_uint"; then - if test $fits_in_uint = 1; then - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - extern size_t foo; - extern unsigned long foo; - -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); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (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); }; } && - { ac_try='test -s conftest.$ac_objext' - { (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 - fits_in_uint=0 -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 - fi - if test $fits_in_uint = 1; then - result="(((1U << $size_t_bits_minus_1) - 1) * 2 + 1)" - else - result="(((1UL << $size_t_bits_minus_1) - 1) * 2 + 1)" - fi - else - result='((size_t)~(size_t)0)' - fi - fi - { echo "$as_me:$LINENO: result: $result" >&5 -echo "${ECHO_T}$result" >&6; } - if test "$result" != yes; then - -cat >>confdefs.h <<_ACEOF -#define SIZE_MAX $result -_ACEOF - - fi - - - { echo "$as_me:$LINENO: checking for ssize_t" >&5 -echo $ECHO_N "checking for ssize_t... $ECHO_C" >&6; } -if test "${gt_cv_ssize_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) result=$ac_lo;; +'') result=unknown ;; +esac else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -11338,41 +14100,60 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include + + #include + #include + #if HAVE_WCHAR_H + /* BSD/OS 4.1 has a bug: and must be included before + . */ + # include + # include + # include + #endif + +#include +static long int longval () { return sizeof ($gltype) * CHAR_BIT; } +static unsigned long int ulongval () { return sizeof ($gltype) * CHAR_BIT; } +#include +#include int main () { -int x = sizeof (ssize_t *) + sizeof (ssize_t); - return !x; + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + return 1; + if ((sizeof ($gltype) * CHAR_BIT) < 0) + { + long int i = longval (); + if (i != (sizeof ($gltype) * CHAR_BIT)) + return 1; + fprintf (f, "%ld\n", i); + } + else + { + unsigned long int i = ulongval (); + if (i != (sizeof ($gltype) * CHAR_BIT)) + 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 - 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='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (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>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; @@ -11382,25 +14163,35 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - gt_cv_ssize_t=yes + result=`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 - gt_cv_ssize_t=no +( exit $ac_status ) +result=unknown 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: $gt_cv_ssize_t" >&5 -echo "${ECHO_T}$gt_cv_ssize_t" >&6; } - if test $gt_cv_ssize_t = no; then +rm -f conftest.val + eval gl_cv_bitsizeof_${gltype}=\$result -cat >>confdefs.h <<\_ACEOF -#define ssize_t int +fi +ac_res=`eval echo '${'gl_cv_bitsizeof_${gltype}'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } + eval result=\$gl_cv_bitsizeof_${gltype} + if test $result = unknown; then + result=0 + fi + GLTYPE=`echo "$gltype" | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` + cat >>confdefs.h <<_ACEOF +#define BITSIZEOF_${GLTYPE} $result _ACEOF - fi + eval BITSIZEOF_${GLTYPE}=\$result + done @@ -11408,27 +14199,34 @@ _ACEOF - { 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 + for gltype in sig_atomic_t wchar_t wint_t ; do + { echo "$as_me:$LINENO: checking whether $gltype is signed" >&5 +echo $ECHO_N "checking whether $gltype is signed... $ECHO_C" >&6; } +if { as_var=gl_cv_type_${gltype}_signed; 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 + + #include + #include + #if HAVE_WCHAR_H + /* BSD/OS 4.1 has a bug: and must be included before + . */ + # include + # include + # include + #endif + + int verify[2 * (($gltype) -1 < ($gltype) 0) - 1]; int main () { -#ifndef va_copy -void (*func) (va_list, va_list) = va_copy; -#endif - ; return 0; } @@ -11467,40 +14265,91 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - gl_cv_func_va_copy=yes + result=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - gl_cv_func_va_copy=no + result=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + eval gl_cv_type_${gltype}_signed=\$result + fi +ac_res=`eval echo '${'gl_cv_type_${gltype}_signed'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } + eval result=\$gl_cv_type_${gltype}_signed + GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` + if test "$result" = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_SIGNED_${GLTYPE} 1 +_ACEOF - { 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 + eval HAVE_SIGNED_${GLTYPE}=1 + else + eval HAVE_SIGNED_${GLTYPE}=0 + fi + done + + + gl_cv_type_ptrdiff_t_signed=yes + gl_cv_type_size_t_signed=no + + + + + + + + for gltype in ptrdiff_t sig_atomic_t size_t wchar_t wint_t ; do + { echo "$as_me:$LINENO: checking for $gltype integer literal suffix" >&5 +echo $ECHO_N "checking for $gltype integer literal suffix... $ECHO_C" >&6; } +if { as_var=gl_cv_type_${gltype}_suffix; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - - cat >conftest.$ac_ext <<_ACEOF + eval gl_cv_type_${gltype}_suffix=no + eval result=\$gl_cv_type_${gltype}_signed + if test "$result" = yes; then + glsufu= + else + glsufu=u + fi + for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do + case $glsuf in + '') gltype1='int';; + l) gltype1='long int';; + ll) gltype1='long long int';; + i64) gltype1='__int64';; + u) gltype1='unsigned int';; + ul) gltype1='unsigned long int';; + ull) gltype1='unsigned long long int';; + ui64)gltype1='unsigned __int64';; + esac + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include + + #include + #include + #if HAVE_WCHAR_H + /* BSD/OS 4.1 has a bug: and must be included before + . */ + # include + # include + # include + #endif + + extern $gltype foo; + extern $gltype1 foo; int main () { -#ifndef __va_copy -error, bail out -#endif - ; return 0; } @@ -11539,51 +14388,44 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - gl_cv_func___va_copy=yes + eval gl_cv_type_${gltype}_suffix=\$glsuf else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - gl_cv_func___va_copy=no + fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + eval result=\$gl_cv_type_${gltype}_suffix + test "$result" != no && break + done fi - - if test $gl_cv_func___va_copy = yes; then - -cat >>confdefs.h <<\_ACEOF -#define va_copy __va_copy +ac_res=`eval echo '${'gl_cv_type_${gltype}_suffix'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } + GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` + eval result=\$gl_cv_type_${gltype}_suffix + test "$result" = no && result= + eval ${GLTYPE}_SUFFIX=\$result + cat >>confdefs.h <<_ACEOF +#define ${GLTYPE}_SUFFIX $result _ACEOF - else - + done -cat >>confdefs.h <<\_ACEOF -#define va_copy gl_va_copy -_ACEOF - fi + STDINT_H=stdint.h fi - - # Define two additional variables used in the Makefile substitution. - - if test "$ac_cv_header_stdbool_h" = yes; then - STDBOOL_H='' - else - STDBOOL_H='stdbool.h' - fi - - - if test "$ac_cv_type__Bool" = yes; then - HAVE__BOOL=1 - else - HAVE__BOOL=0 - fi + case " $LIBOBJS " in + *" mkstemp-safer.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS mkstemp-safer.$ac_objext" + ;; +esac @@ -12158,6 +15000,14 @@ done + case " $LIBOBJS " in + *" tmpfile-safer.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS tmpfile-safer.$ac_objext" + ;; +esac + + + for ac_header in unistd.h do @@ -12338,6 +15188,94 @@ done + + + + + case " $LIBOBJS " in + *" dup-safer.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS dup-safer.$ac_objext" + ;; +esac + + case " $LIBOBJS " in + *" fd-safer.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS fd-safer.$ac_objext" + ;; +esac + + case " $LIBOBJS " in + *" pipe-safer.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS pipe-safer.$ac_objext" + ;; +esac + + + + +cat >>confdefs.h <<\_ACEOF +#define USE_UNLOCKED_IO 1 +_ACEOF + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + for ac_func in vasnprintf do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` @@ -12858,10 +15796,14 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* AIX 3.2.5 declares wcwidth in . */ -#if HAVE_STRING_H -# include -#endif +#include #if HAVE_WCHAR_H +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.1 has a bug: and must be included before + . */ +# include +# include # include #endif @@ -12941,7 +15883,6 @@ fi - case " $LIBOBJS " in *" xmalloc.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS xmalloc.$ac_objext" @@ -14093,7 +17034,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.5, which was +This file was extended by GNU M4 $as_me 1.4.6, which was generated by GNU Autoconf 2.60. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -14146,7 +17087,7 @@ Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -GNU M4 config.status 1.4.5 +GNU M4 config.status 1.4.6 configured by $0, generated by GNU Autoconf 2.60, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" @@ -14424,9 +17365,9 @@ LIBOBJS!$LIBOBJS$ac_delim GETOPT_H!$GETOPT_H$ac_delim STDBOOL_H!$STDBOOL_H$ac_delim HAVE__BOOL!$HAVE__BOOL$ac_delim -ABSOLUTE_SYS_STAT_H!$ABSOLUTE_SYS_STAT_H$ac_delim -SYS_STAT_H!$SYS_STAT_H$ac_delim -UNISTD_H!$UNISTD_H$ac_delim +HAVE_LONG_LONG_INT!$HAVE_LONG_LONG_INT$ac_delim +HAVE_WCHAR_H!$HAVE_WCHAR_H$ac_delim +HAVE_INTTYPES_H!$HAVE_INTTYPES_H$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then @@ -14468,13 +17409,35 @@ _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 +ABSOLUTE_STDINT_H!$ABSOLUTE_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 +ABSOLUTE_SYS_STAT_H!$ABSOLUTE_SYS_STAT_H$ac_delim +SYS_STAT_H!$SYS_STAT_H$ac_delim +UNISTD_H!$UNISTD_H$ac_delim EOVERFLOW!$EOVERFLOW$ac_delim STACKOVF_TRUE!$STACKOVF_TRUE$ac_delim STACKOVF_FALSE!$STACKOVF_FALSE$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 4; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 26; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 diff -ruNp m4-1.4.5/configure.ac m4-1.4.6/configure.ac --- m4-1.4.5/configure.ac 2006-07-15 16:18:28.000000000 -0600 +++ m4-1.4.6/configure.ac 2006-08-24 08:47:02.000000000 -0600 @@ -18,7 +18,7 @@ # 02110-1301 USA AC_PREREQ([2.60]) -AC_INIT([GNU M4], [1.4.5], [bug-m4@gnu.org]) +AC_INIT([GNU M4], [1.4.6], [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]) @@ -48,7 +48,7 @@ AC_CHECK_MEMBERS([struct sigaction.sa_si AC_TYPE_SIGNAL AC_TYPE_SIZE_T -AC_CHECK_FUNCS_ONCE([sigaction sigaltstack sigstack sigvec strerror tmpfile]) +AC_CHECK_FUNCS_ONCE([sigaction sigaltstack sigstack sigvec strerror]) M4_INIT diff -ruNp m4-1.4.5/doc/Makefile.am m4-1.4.6/doc/Makefile.am --- m4-1.4.5/doc/Makefile.am 2006-07-13 06:34:52.000000000 -0600 +++ m4-1.4.6/doc/Makefile.am 2006-07-28 06:17:30.000000000 -0600 @@ -35,7 +35,8 @@ $(srcdir)/m4.1: $(top_srcdir)/configure. @if test -x ../src/m4$(EXEEXT) ; then \ echo "Updating man page m4.1" ; \ $(SHELL) $(top_srcdir)/missing --run \ - help2man -o $@ ../src/m4$(EXEEXT) ; \ + help2man --name="macro processor" --source=FSF \ + --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.5/doc/Makefile.in m4-1.4.6/doc/Makefile.in --- m4-1.4.5/doc/Makefile.in 2006-07-15 16:24:08.000000000 -0600 +++ m4-1.4.6/doc/Makefile.in 2006-08-24 11:47:42.000000000 -0600 @@ -41,23 +41,26 @@ DIST_COMMON = $(m4_TEXINFOS) $(srcdir)/M $(srcdir)/version.texi mdate-sh texinfo.tex ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/absolute-header.m4 \ - $(top_srcdir)/m4/alloca.m4 $(top_srcdir)/m4/codeset.m4 \ + $(top_srcdir)/m4/alloca.m4 $(top_srcdir)/m4/cloexec.m4 \ + $(top_srcdir)/m4/close-stream.m4 $(top_srcdir)/m4/codeset.m4 \ $(top_srcdir)/m4/eoverflow.m4 $(top_srcdir)/m4/error.m4 \ $(top_srcdir)/m4/exitfail.m4 $(top_srcdir)/m4/extensions.m4 \ + $(top_srcdir)/m4/fpending.m4 $(top_srcdir)/m4/free.m4 \ $(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gnulib-comp.m4 \ $(top_srcdir)/m4/intmax_t.m4 $(top_srcdir)/m4/inttypes_h.m4 \ $(top_srcdir)/m4/longdouble.m4 $(top_srcdir)/m4/longlong.m4 \ $(top_srcdir)/m4/mbchar.m4 $(top_srcdir)/m4/mbiter.m4 \ $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/memchr.m4 \ - $(top_srcdir)/m4/mkstemp.m4 $(top_srcdir)/m4/obstack.m4 \ - $(top_srcdir)/m4/regex.m4 $(top_srcdir)/m4/restrict.m4 \ + $(top_srcdir)/m4/mkstemp.m4 $(top_srcdir)/m4/regex.m4 \ $(top_srcdir)/m4/signed.m4 $(top_srcdir)/m4/size_max.m4 \ $(top_srcdir)/m4/ssize_t.m4 $(top_srcdir)/m4/stat-macros.m4 \ $(top_srcdir)/m4/stdarg.m4 $(top_srcdir)/m4/stdbool.m4 \ - $(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/strcase.m4 \ + $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdint_h.m4 \ + $(top_srcdir)/m4/stdio-safer.m4 \ + $(top_srcdir)/m4/stdlib-safer.m4 $(top_srcdir)/m4/strcase.m4 \ $(top_srcdir)/m4/strtol.m4 $(top_srcdir)/m4/sys_stat_h.m4 \ - $(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/ulonglong.m4 \ - $(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/vasnprintf.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.m4 $(top_srcdir)/m4/wchar_t.m4 \ $(top_srcdir)/m4/wcwidth.m4 $(top_srcdir)/m4/wint_t.m4 \ $(top_srcdir)/m4/xalloc.m4 $(top_srcdir)/m4/xsize.m4 \ @@ -87,6 +90,7 @@ man1dir = $(mandir)/man1 NROFF = nroff MANS = $(man_MANS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ABSOLUTE_STDINT_H = @ABSOLUTE_STDINT_H@ ABSOLUTE_SYS_STAT_H = @ABSOLUTE_SYS_STAT_H@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ @@ -98,6 +102,11 @@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +BITSIZEOF_PTRDIFF_T = @BITSIZEOF_PTRDIFF_T@ +BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@ +BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@ +BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@ +BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ @@ -116,6 +125,16 @@ GETOPT_H = @GETOPT_H@ GL_COND_LIBTOOL_FALSE = @GL_COND_LIBTOOL_FALSE@ GL_COND_LIBTOOL_TRUE = @GL_COND_LIBTOOL_TRUE@ GREP = @GREP@ +HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ +HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ +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_STDINT_H = @HAVE_STDINT_H@ +HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@ +HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@ +HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ +HAVE_WCHAR_H = @HAVE_WCHAR_H@ HAVE__BOOL = @HAVE__BOOL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -134,16 +153,22 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@ +SIZE_T_SUFFIX = @SIZE_T_SUFFIX@ STACKOVF_FALSE = @STACKOVF_FALSE@ STACKOVF_TRUE = @STACKOVF_TRUE@ STDBOOL_H = @STDBOOL_H@ +STDINT_H = @STDINT_H@ STRIP = @STRIP@ SYS_STAT_H = @SYS_STAT_H@ UNISTD_H = @UNISTD_H@ VERSION = @VERSION@ +WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ +WINT_T_SUFFIX = @WINT_T_SUFFIX@ ac_ct_CC = @ac_ct_CC@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ @@ -564,7 +589,8 @@ $(srcdir)/m4.1: $(top_srcdir)/configure. @if test -x ../src/m4$(EXEEXT) ; then \ echo "Updating man page m4.1" ; \ $(SHELL) $(top_srcdir)/missing --run \ - help2man -o $@ ../src/m4$(EXEEXT) ; \ + help2man --name="macro processor" --source=FSF \ + --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.5/doc/m4.1 m4-1.4.6/doc/m4.1 --- m4-1.4.5/doc/m4.1 2006-07-15 16:26:23.000000000 -0600 +++ m4-1.4.6/doc/m4.1 2006-08-24 12:20:43.000000000 -0600 @@ -1,11 +1,14 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.35. -.TH M4 "1" "July 2006" "M4 1.4.5" "User Commands" +.TH M4 "1" "August 2006" "FSF" "User Commands" .SH NAME -M4 \- manual page for M4 1.4.5 +M4 \- macro processor .SH SYNOPSIS .B m4 [\fIOPTION\fR]... [\fIFILE\fR]... .SH DESCRIPTION +Process macros in FILEs. If no FILE or if FILE is `\-', standard input +is read. +.PP Mandatory or optional arguments to long options are mandatory or optional for short options too. .SS "Operation modes:" @@ -30,16 +33,16 @@ suppress some warnings for builtins .SS "Preprocessor features:" .TP \fB\-D\fR, \fB\-\-define=NAME\fR[=\fIVALUE\fR] -enter NAME has having VALUE, or empty +define NAME has having VALUE, or empty .TP \fB\-I\fR, \fB\-\-include\fR=\fIDIRECTORY\fR -append this directory to include path +append DIRECTORY to include path .TP \fB\-s\fR, \fB\-\-synclines\fR -generate `#line NO "FILE"' lines +generate `#line NUM "FILE"' lines .TP \fB\-U\fR, \fB\-\-undefine\fR=\fINAME\fR -delete builtin NAME +undefine NAME .SS "Limits control:" .TP \fB\-G\fR, \fB\-\-traditional\fR @@ -99,21 +102,21 @@ quote values as necessary, with a or e f t trace for all macro calls, not only traceon'ed .TP -V -shorthand for all of the other flags -.TP x add a unique macro call id, useful with c flag +.TP +V +shorthand for all of the above flags .PP If defined, the environment variable `M4PATH' is a colon\-separated list of directories included after any specified by `\-I'. .PP -If no FILE or if FILE is `\-', standard input is read. -.PP -Exit status is 0 for success, 1 for failure, or whatever value was passed -to the m4exit macro. +Exit status is 0 for success, 1 for failure, 63 for frozen file version +mismatch, or whatever value was passed to the m4exit macro. .SH AUTHOR Written by Rene' Seindal. +.SH "REPORTING BUGS" +Report bugs to . .SH COPYRIGHT Copyright \(co 2006 Free Software Foundation, Inc. .br @@ -128,6 +131,6 @@ and .B M4 programs are properly installed at your site, the command .IP -.B info M4 +.B info m4 .PP should give you access to the complete manual. diff -ruNp m4-1.4.5/doc/m4.info m4-1.4.6/doc/m4.info --- m4-1.4.5/doc/m4.info 2006-07-15 16:26:21.000000000 -0600 +++ m4-1.4.6/doc/m4.info 2006-08-24 21:29:24.000000000 -0600 @@ -1,6 +1,7 @@ -This is m4.info, produced by makeinfo version 4.8 from m4.texinfo. +This is m4.info, produced by makeinfo version 4.8 from +/home/eblake/m4-patch/doc/m4.texinfo. - This manual is for GNU M4 (version 1.4.5, 15 July 2006), a package + This manual is for GNU M4 (version 1.4.6, 24 August 2006), a package containing an implementation of the m4 macro language. Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 2004, 2005, 2006 @@ -9,14 +10,9 @@ 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, with the Front-Cover texts - being "A GNU Manual," and with the Back-Cover Texts as in (a) - below. A copy of the license is included in the section entitled - "GNU Free Documentation License." - - (a) The FSF's Back-Cover Text is: "You have freedom to copy and - modify this GNU Manual, like GNU software. Copies published by - the Free Software Foundation raise funds for GNU development." + 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 GNU programming tools START-INFO-DIR-ENTRY @@ -29,7 +25,7 @@ File: m4.info, Node: Top, Next: Prelim GNU M4 ****** -This manual is for GNU M4 (version 1.4.5, 15 July 2006), a package +This manual is for GNU M4 (version 1.4.6, 24 August 2006), a package containing an implementation of the m4 macro language. Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 2004, 2005, 2006 @@ -38,14 +34,9 @@ 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, with the Front-Cover texts - being "A GNU Manual," and with the Back-Cover Texts as in (a) - below. A copy of the license is included in the section entitled - "GNU Free Documentation License." - - (a) The FSF's Back-Cover Text is: "You have freedom to copy and - modify this GNU Manual, like GNU software. Copies published by - the Free Software Foundation raise funds for GNU development." + 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 @@ -59,7 +50,7 @@ changes by Franc,ois Pinard and other vo names and email addresses can be found in the files `AUTHORS' and `THANKS' from the GNU M4 distribution. - This is release 1.4.5. It is now considered stable: future + This is release 1.4.6. 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... @@ -112,8 +103,8 @@ Lexical and syntactic conventions * Names:: Macro names * Quoted strings:: Quoting input to m4 -* Other tokens:: Other kinds of input tokens * Comments:: Comments in m4 input +* Other tokens:: Other kinds of input tokens * Input processing:: How m4 copies input to output How to invoke macros @@ -195,6 +186,7 @@ Running shell commands Miscellaneous builtin macros * Errprint:: Printing error messages +* Location:: Printing current location * M4exit:: Exiting from m4 Fast loading of frozen state @@ -250,8 +242,8 @@ output, expanding macros as it goes. Ma 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. +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 @@ -322,7 +314,7 @@ addressed some long standing bugs in the 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. +release of 1.4.5 and 1.4.6. Meanwhile, development has continued on new features for `m4', such as dynamic module loading and additional builtins. When complete, GNU @@ -397,11 +389,11 @@ input came from. These features occur w input. This option may be given more than once; order is significant, and redefining the same NAME loses the previous value. -`-I DIR' -`--include=DIR' - Make `m4' search DIR 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. +`-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' @@ -460,15 +452,16 @@ only by your hardware constraints) in GN might well disappear. This option does _not_ have the ability to break endless - rescanning loops, while these do not necessarily consume much + 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 to `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! + 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' @@ -488,13 +481,13 @@ Frozen files::). This can be used to sp reusing a common initialization script. `-F FILE' -`--freeze-state 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' +`--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 @@ -514,13 +507,16 @@ scripts. `-l NUM' `--arglength=NUM' Restrict the size of the output generated by macro tracing to NUM - characters per trace line. *Note Debug Levels::, for more details. + characters per trace line. If unspecified or zero, output is + unlimited. *Note Debug Levels::, for more details. `-o FILE' `--error-output=FILE' - Redirect debug and trace output to the named FILE. Error messages - are still printed on the standard error output. *Note Debug - Output::, for more details. + 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. `-t NAME' `--trace=NAME' @@ -537,10 +533,12 @@ conventional, but not required, for inpu The input files are read in the sequence given. The standard input can only be read once, so the file name `-' should only appear once on the command line. It is an error if an input file ends in the middle of -argument collection or a quoted string. +argument collection, a comment, or a quoted string. If none of the input files invoked `m4exit' (*note M4exit::), the -exit status of `m4' will be 0 for success, and 1 for failure. +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. @@ -551,7 +549,7 @@ File: m4.info, Node: Bugs, Next: Manua 1.4 Problems and bugs ===================== -If you have problems with GNU `m4' or think you've found a bug, please +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 @@ -645,14 +643,18 @@ As `m4' reads its input, it separates it 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 locales; all operations are -byte-oriented rather than character-oriented. +byte-oriented rather than character-oriented. 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 -* Other tokens:: Other kinds of input tokens * Comments:: Comments in m4 input +* Other tokens:: Other kinds of input tokens * Input processing:: How m4 copies input to output  @@ -662,22 +664,23 @@ File: m4.info, Node: Names, Next: Quot ========= A name is any sequence of letters, digits, and the character `_' -(underscore), where the first character is not a digit. If a name has -a macro definition, it will be subject to macro expansion (*note -Macros::). +(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: Other tokens, Prev: Names, Up: Syntax +File: m4.info, Node: Quoted strings, Next: Comments, Prev: Names, Up: Syntax 2.2 Quoted strings ================== -A quoted string is a sequence of characters surrounded by the quotes -``' and `'', where the nested start 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 +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 `' => @@ -691,18 +694,9 @@ is the empty string, and double-quoting macro `changequote'. *Note Changequote::, for more information.  -File: m4.info, Node: Other tokens, Next: Comments, Prev: Quoted strings, Up: Syntax - -2.3 Other tokens -================ +File: m4.info, Node: Comments, Next: Other tokens, Prev: Quoted strings, Up: Syntax -Any character, that is neither a part of a name, nor of a quoted string, -is a token by itself. - - -File: m4.info, Node: Comments, Next: Input processing, Prev: Other tokens, Up: Syntax - -2.4 Comments +2.3 Comments ============ Comments in `m4' are normally delimited by the characters `#' and @@ -711,7 +705,7 @@ but the entire comment (including the de 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 character can be +comment. The commenting effect of the begin-comment string can be inhibited by quoting it. `quoted text' # `commented text' @@ -724,7 +718,20 @@ using the builtin macro `changecom'. *N information.  -File: m4.info, Node: Input processing, Prev: Comments, Up: Syntax +File: m4.info, Node: Other tokens, Next: Input processing, Prev: Comments, Up: Syntax + +2.4 Other 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 2.5 Input Processing ==================== @@ -740,18 +747,27 @@ call will be read and parsed into tokens `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. If the input is +call first. For a running example, examine how `m4' handles this input: format(`Result is %d', eval(`2**15')) -`m4' will first expand `eval(2**15)' to `32768', and only then expand -the resulting call +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) -which will give the output +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 + =>Result is 32768 The order in which `m4' expands the macros can be explored using the *Note Trace:: facilities of GNU `m4'. @@ -827,11 +843,14 @@ call is not triggered. This solves the `include' or `eval'. Later in this document, the sentence "This macro is recognized only with parameters" refers to this specific provision. - There is also a command line option (`--prefix-builtins', or `-P') -which requires all builtin macro names to be prefixed by `m4_' for them -to be recognized. 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'. + There is also a command line option (`--prefix-builtins', or `-P', +*note Invoking m4::) which requires all builtin macro names to be +prefixed by `m4_' for them to be recognized. 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'. + + 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 @@ -917,12 +936,13 @@ will be collected before the macro is ca 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. +are too many arguments, the excess arguments are ignored. Unquoted +leading whitespace is stripped off all arguments. Normally `m4' will issue warnings if a builtin macro is called with an inappropriate number of arguments, but it can be suppressed with the -`-Q' command line option. For user defined macros, there is no check -of the number of arguments given. +`-Q' command line option (*note Invoking m4::). For user defined +macros, there is no check of the number of arguments given. Macros are expanded normally during argument collection, and whatever commas, quotes and parentheses that might show up in the resulting @@ -947,6 +967,12 @@ effect at the time the opening `(' was s f =>2 + It is an error if the end of file occurs while collecting arguments. + + define( + ^D + error-->m4:stdin:1: ERROR: end of file in argument list +  File: m4.info, Node: Quoting Arguments, Next: Macro expansion, Prev: Macro Arguments, Up: Macros @@ -1112,6 +1138,8 @@ to be reversed. =>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. *note Answers::) GNU `m4' allows the number following the `$' to consist of one or more digits, allowing macros to have any number of arguments. This is @@ -1334,11 +1362,11 @@ to avoid unwanted expansion of the text: => However, it is important to remember that `m4' rescanning is purely -textual. If an unbalanced right quote string occurs in a macro +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 right -quotes in macro definitions or arguments to macros. +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) => @@ -1481,49 +1509,8 @@ Builtin macros can be called indirectly 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 NAME maps to the -builtin. - - pushdef(`define', `hidden') - => - undefine(`undefine') - => - define(`foo', `bar') - =>hidden - foo - =>foo - builtin(`define', `foo', `BAR') - => - foo - =>BAR - undefine(`foo') - =>undefine(foo) - foo - =>BAR - builtin(`undefine', `foo') - => - foo - =>foo - - Note that this can be used to invoke builtins that normally require -parameters without actually providing them; but it will provoke a -warning, and usually result in a void expansion. - - builtin - =>builtin - builtin() - error-->stdin:2: m4: undefined builtin `' - => - builtin(`builtin') - error-->stdin:3: m4: Warning: too few arguments to builtin `builtin' - => - builtin(`builtin',) - error-->stdin:4: m4: undefined builtin `' - => - - This can be used even if NAME has been given another definition that -has covered the original, or been undefined so that no NAME maps to the -builtin. +has covered the original, or been undefined so that no macro maps to +the builtin. pushdef(`define', `hidden') => @@ -1546,20 +1533,20 @@ builtin. foo =>foo - Note that this can be used to invoke builtins that normally require -parameters without actually providing them; but it will provoke a -warning, and usually result in a void expansion. + Note that this 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-->stdin:2: m4: undefined builtin `' + error-->m4:stdin:2: undefined builtin `' => builtin(`builtin') - error-->stdin:3: m4: Warning: too few arguments to builtin `builtin' + error-->m4:stdin:3: Warning: too few arguments to builtin `builtin' => builtin(`builtin',) - error-->stdin:4: m4: undefined builtin `' + error-->m4:stdin:4: undefined builtin `' =>  @@ -1604,7 +1591,7 @@ There are two different builtin conditio ifdef(`foo', ``foo' is defined', ``foo' is not defined') =>foo is defined ifdef(`no_such_macro', `yes', `no', `extra argument') - error-->stdin:4: m4: Warning: excess arguments to builtin `ifdef' ignored + error-->m4:stdin:4: Warning: excess arguments to builtin `ifdef' ignored =>no  @@ -1642,7 +1629,7 @@ warning about missing arguments is never ifelse(`some comments') => ifelse(`foo', `bar') - error-->stdin:2: m4: Warning: too few arguments to builtin `ifelse' + error-->m4:stdin:2: Warning: too few arguments to builtin `ifelse' => Using three or four arguments provides decision points. @@ -1706,8 +1693,10 @@ used for iterating through the actual ar Takes any number of arguments, and expands to all but the first argument, separated by commas, with each argument quoted. + The macro `shift' is recognized only with parameters. + shift - => + =>shift shift(`bar') => shift(`foo', `bar', `baz') @@ -1852,7 +1841,7 @@ still live due to redefining a macro dur error-->f: ``$0'1' =>f2 f(popdef(`f')dumpdef(`f')) - error-->stdin:3: m4: undefined macro `f' + error-->m4:stdin:3: undefined macro `f' =>f1 *Note Debug Levels::, for information on controlling the details of @@ -1898,7 +1887,7 @@ is printed to the current debug file (us 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'. +option `--nesting-limit' (*note Invoking m4::). Tracing by name is an attribute that is preserved whether the macro is defined or not. This allows the `-t' option to select macros to @@ -1920,7 +1909,7 @@ trace before those macros are defined. ifdef(`foo', `yes', `no') =>no indir(`foo') - error-->stdin:8: m4: undefined macro `foo' + error-->m4:stdin:8: undefined macro `foo' => define(`foo', `blah') => @@ -1957,8 +1946,9 @@ File: m4.info, Node: Debug Levels, Nex 6.3 Controlling debugging output ================================ -The `-d' option to `m4' controls the amount of details presented, when -using the macros described in the preceding sections. +The `-d' option to `m4' (*note Invoking m4::) controls the amount of +details presented, when using the macros described in the preceding +sections. The FLAGS following the option can be one or more of the following: @@ -2049,28 +2039,29 @@ File: m4.info, Node: Debug Output, Pre =========================== Debug and tracing output can be redirected to files using either the -`-o' option to `m4', or with the builtin macro `debugfile': +`-o' option to `m4' (*note Invoking m4::), or with the builtin macro +`debugfile': -- Builtin: debugfile ([FILE]) Sends all further debug and trace output to FILE. If FILE is empty, 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, which are always - sent to standard error. If FILE cannot be opened, the current - debug file is unchanged. + 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. The expansion of `debugfile' is void. traceon(`divnum') => divnum(`extra') - error-->stdin:2: m4: Warning: excess arguments to builtin `divnum' ignored + error-->m4:stdin:2: Warning: excess arguments to builtin `divnum' ignored error-->m4trace: -1- divnum(`extra') -> `0' =>0 debugfile() => divnum(`extra') - error-->stdin:4: m4: Warning: excess arguments to builtin `divnum' ignored + error-->m4:stdin:4: Warning: excess arguments to builtin `divnum' ignored =>0 debugfile => @@ -2130,10 +2121,22 @@ line containing it, will still be discar dnl(`args are ignored, but side effects occur', define(`foo', `like this')) while this text is ignored: undefine(`foo') - error-->stdin:2: m4: Warning: excess arguments to builtin `dnl' ignored + error-->m4:stdin:2: 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. + + define(`hi', `HI') + => + m4wrap(`m4wrap(`2 hi + ')0 hi dnl 1 hi') + => + ^D + error-->m4: Warning: end of file treated as newline + =>0 HI 2 HI +  File: m4.info, Node: Changequote, Next: Changecom, Prev: Dnl, Up: Input Control @@ -2144,7 +2147,7 @@ The default quote delimiters can be chan `changequote': -- Builtin: changequote ([START = ``'], [END = `'']) - This sets START as the new start-quote delimiter and END as the + This sets START as the new begin-quote delimiter and END as the new end-quote delimiter. If any of the arguments are missing, the default quotes (``' and `'') are used instead of the void arguments. @@ -2158,8 +2161,8 @@ The default quote delimiters can be chan foo =>Macro foo. - If no single character is appropriate, START and END can be of any -length. + The quotation strings can safely contain eight-bit characters. If +no single character is appropriate, START and END can be of any length. changequote(`[[[', `]]]') => @@ -2181,20 +2184,92 @@ quoting mechanism, leaving no way to quo =>`Macro `FOO'.' There is no way in `m4' to quote a string containing an unmatched -left quote, except using `changequote' to change the current quotes. +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. - Neither quote string should start with a letter or `_' (underscore), -as they will be confused with names in the input. Doing so disables -the quoting mechanism. - - Changing the quotes to have the same start and end string disables -nesting of quotes. This makes it impossible to double-quote strings -across macro expansions, so it is not done very often. + Macros are recognized in preference to the begin-quote string, so if +a prefix of START can be recognized as 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 or `_' (underscore). + + define(`hi', `HI') + => + changequote(`q', `Q') + => + q hi Q hi + =>q HI Q HI + changequote + => + changequote(`-', `EOF') + => + - hi EOF hi + => 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. + + `dangling quote + ^D + error-->m4:stdin:1: ERROR: end of file in string  File: m4.info, Node: Changecom, Next: Changeword, Prev: Changequote, Up: Input Control @@ -2206,7 +2281,7 @@ The default comment delimiters can be ch `changecom': -- Builtin: changecom ([START], [END]) - This sets START as the new start-comment delimiter and END as the + This sets START as the new begin-comment delimiter and END as the new end-comment delimiter. If only one argument is provided, newline becomes the new end-comment delimiter. The comment delimiters can be of any length. Omitting the first argument, or @@ -2227,7 +2302,7 @@ The default comment delimiters can be ch 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 start comment delimiter. +the begin-comment delimiter. Calling `changecom' without any arguments, or with an empty string for the first argument, disables the commenting mechanism completely. @@ -2245,6 +2320,57 @@ for it. # comment again =># comment again + The comment strings can safely contain eight-bit characters. + + 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 +or `_' (underscore), and that neither the start-quote nor the +start-comment string should be a prefix of the other. + + define(`hi', `HI') + => + changecom(`q', `Q') + => + q hi Q hi + =>q hi Q HI + + 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:1: ERROR: end of file in comment +  File: m4.info, Node: Changeword, Next: M4wrap, Prev: Changecom, Up: Input Control @@ -2282,8 +2408,8 @@ Initially a word is defined by the follo Relaxing the lexical rules of `m4' might be useful (for example) if you wanted to apply translations to a file of numbers: - ifdef(`changeword', `', `m4exit(`77')') - => + ifdef(`changeword', `', `errprint(` skipping: no changeword support + ')m4exit(`77')')dnl changeword(`[_a-zA-Z0-9]+') => define(`1', `0')1 @@ -2293,8 +2419,8 @@ you wanted to apply translations to a fi generally make some of the builtins unavailable. You could use it to prevent accidental call of builtins, for example: - ifdef(`changeword', `', `m4exit(`77')') - => + ifdef(`changeword', `', `errprint(` skipping: no changeword support + ')m4exit(`77')')dnl define(`_indir', defn(`indir')) => changeword(`_[_a-zA-Z0-9]*') @@ -2314,8 +2440,8 @@ it must also accept `f' and `fo'. supplied contains any grouped subexpressions, then text outside the first of these is discarded before symbol lookup. So: - ifdef(`changeword', `', `m4exit(`77')') - => + ifdef(`changeword', `', `errprint(` skipping: no changeword support + ')m4exit(`77')')dnl changecom(`/*', `*/')dnl define(`foo', `bar')dnl changeword(`#\([_a-zA-Z0-9]*\)') @@ -2325,9 +2451,8 @@ first of these is discarded before symbo => `m4' now requires a `#' mark at the beginning of every macro -invocation, so one can use `m4' to preprocess shell scripts without -getting `shift' commands swallowed, and plain text without losing -various common words. +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. @@ -2343,8 +2468,8 @@ the TeX version: Then, the `m4' version: - ifdef(`changeword', `', `m4exit(`77')') - => + ifdef(`changeword', `', `errprint(` skipping: no changeword support + ')m4exit(`77')')dnl define(`a', `errprint(`Hello')')dnl changeword(`@\([_a-zA-Z0-9]*\)') => @@ -2387,7 +2512,8 @@ cleanup actions before normal exit, e.g. reached. As a GNU extension, additional arguments are concatenated with a space to the STRING. - The expansion of `m4wrap' is void. + The expansion of `m4wrap' is void. The macro `m4wrap' is + recognized only with parameters. define(`cleanup', `This is the `cleanup' action. ') @@ -2421,6 +2547,25 @@ you should not depend on this order. ^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: ERROR: end of file in argument list +  File: m4.info, Node: File Inclusion, Next: Diversions, Prev: Input Control, Up: Top @@ -2460,19 +2605,19 @@ There are two builtin macros in `m4' for include(`none') => - error-->stdin:1: m4: cannot open `none': No such file or directory + error-->m4:stdin:1: cannot open `none': No such file or directory include() => - error-->stdin:2: m4: cannot open `': No such file or directory + 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 pointing to the `examples' directory shipped as part of the GNU -`m4' package. The file `examples/incl.m4' in the distribution contains -the lines: +option (*note Invoking m4::) pointing to the `examples' directory +shipped as part of the GNU `m4' package. The file `examples/incl.m4' +in the distribution contains the lines: Include file start foo Include file end @@ -2503,7 +2648,10 @@ is an example, which defines `bar' to ex 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. +`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.  File: m4.info, Node: Search Path, Prev: Include, Up: File Inclusion @@ -2517,9 +2665,10 @@ the current working directory. If a file is not found in the current working directory, and the file name is not absolute, the file will be looked for in a specified search path. First, the directories specified with the `-I' option will be -searched, in the order found on the command line. Second, if the -`M4PATH' environment variable is set, it is expected to contain a -colon-separated list of directories, which will be searched in order. +searched, in the order found on the command line (*note Invoking m4::). +Second, 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. @@ -2607,6 +2756,24 @@ definitions. Here is how to avoid them. This is a common programming idiom in `m4'. + 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::). 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 @@ -2818,6 +2985,12 @@ Searching for substrings is done with `i 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 @@ -2861,9 +3034,20 @@ Searching for regular expressions is don regexp(`abc', `\(b\)', `\\\10\a') =>\b0a regexp(`abc', `b', `\1\') - error-->stdin:2: m4: Warning: sub-expression 1 not present - error-->stdin:2: m4: Warning: trailing \ ignored in replacement + 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 @@ -2888,6 +3072,15 @@ Substrings are extracted with `substr': 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 @@ -2928,6 +3121,12 @@ lowercase to uppercase, and the third `m while converting them to lowercase. The two first cases are by far the most common. + 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 @@ -2967,12 +3166,12 @@ Global substitution in a string is done patsubst(`GNUs not Unix', `\<', `OBS: ') =>OBS: GNUs OBS: not OBS: Unix patsubst(`GNUs not Unix', `\w*', `(\&)') - =>(GNUs)() (not)() (Unix) + =>(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-->stdin:6: m4: Warning: trailing \ ignored in replacement + error-->m4:stdin:6: Warning: trailing \ ignored in replacement =>GNUs NOT Unix Here is a slightly more realistic example, which capitalizes @@ -3011,6 +3210,12 @@ and preserves non-matching pieces: =>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 @@ -3058,10 +3263,11 @@ shows how `format' can be used to produc => The builtin `format' is modeled after the ANSI C `printf' function, -and supports the normal `%' specifiers: `c', `s', `d', `o', `x', `X', -`u', `e', `E' and `f'; it supports field widths and precisions, and the -modifiers `+', `-', ` ', `0', `#', `h' and `l'. For more details on -the functioning of `printf', see the C Library Manual. +and supports these `%' specifiers: `c', `s', `d', `o', `x', `X', `u', +`e', `E', `f', `F', `g', `G', and `%'; it supports field widths and +precisions, and the modifiers `+', `-', ` ', `0', `#', `h' and `l'. +For more details on the functioning of `printf', see the C Library +Manual. For now, unrecognized specifiers are silently ignored, but it is anticipated that a future release of GNU `m4' will support more @@ -3105,10 +3311,10 @@ Increment and decrement of integers are decr(`7') =>6 incr() - error-->stdin:3: m4: empty string treated as 0 in builtin `incr' + error-->m4:stdin:3: empty string treated as 0 in builtin `incr' =>1 decr() - error-->stdin:4: m4: empty string treated as 0 in builtin `decr' + error-->m4:stdin:4: empty string treated as 0 in builtin `decr' =>-1  @@ -3211,7 +3417,7 @@ relation return `0'. define(`foo', `666') => eval(`foo/6') - error-->stdin:8: m4: bad expression in eval: foo/6 + error-->m4:stdin:8: bad expression in eval: foo/6 => eval(foo/6) =>111 @@ -3310,8 +3516,8 @@ platform details. to the empty string. When GNU extensions are in effect (that is, when you did not use the -`-G' option), GNU `m4' will define the macro `__gnu__' to expand to the -empty string. +`-G' option, *note Invoking m4::), GNU `m4' will define the macro +`__gnu__' to expand to the empty string. __gnu__ => @@ -3450,11 +3656,13 @@ result is the signal number shifted left dnl This test assumes kill is a shell builtin, and that signals are dnl recognizable. - ifdef(`__unix__', , `m4exit(`77')')dnl - syscmd(`kill -1 $$') + ifdef(`__unix__', , + `errprint(` skipping: syscmd does not have unix semantics + ')m4exit(`77')')dnl + syscmd(`kill -13 $$') => sysval - =>256 + =>3328 esyscmd(`kill -9 $$') => sysval @@ -3493,10 +3701,11 @@ any of the previous chapters. * Menu: * Errprint:: Printing error messages +* Location:: Printing current location * M4exit:: Exiting from m4  -File: m4.info, Node: Errprint, Next: M4exit, Up: Miscellaneous +File: m4.info, Node: Errprint, Next: Location, Up: Miscellaneous 13.1 Printing error messages ============================ @@ -3507,7 +3716,8 @@ You can print error messages using `errp Prints MESSAGE and the rest of the arguments on the standard error output, separated by spaces. - The expansion of `errprint' is void. + The expansion of `errprint' is void. The macro `errprint' is + recognized only with parameters. errprint(`Invalid arguments to forloop ') @@ -3519,23 +3729,65 @@ supplied as part of the argument, as in implementations of `m4' do append a trailing newline on each `errprint' call, while some other implementations only print the first argument. - To make it possible to specify the location of the error, two -utility builtins exist: + +File: m4.info, Node: Location, Next: M4exit, Prev: Errprint, Up: Miscellaneous + +13.2 Printing current location +============================== + +To make it possible to specify the location of an error, three utility +builtins exist: -- Builtin: __file__ -- Builtin: __line__ - Expand to the quoted name of the current input file, and the - current input line number in that file. + -- 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(`m4:'__file__:__line__: `input error + 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::), 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, or warning message output. Assume +this example is run in the `checks' directory of the GNU M4 package, +using `--include=../examples' in the command line to find the file +`incl.m4' mentioned earlier: + + 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 + => + + Currently, all text wrapped with `m4wrap' (*note M4wrap::) behaves +as though it came from line 0 of the file "". It is hoped that a +future release of `m4' can overcome this limitation and remember which +file invoked the call to `m4wrap'. + + 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'. +  -File: m4.info, Node: M4exit, Prev: Errprint, Up: Miscellaneous +File: m4.info, Node: M4exit, Prev: Location, Up: Miscellaneous -13.2 Exiting from `m4' +13.3 Exiting from `m4' ====================== If you need to exit from `m4' before the entire input has been read, @@ -3543,8 +3795,9 @@ 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. No further input is read, and all - wrapped and diverted text is discarded. + 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. A common use of this is to abort processing: @@ -3554,7 +3807,7 @@ you can use `m4exit': resulting string to standard error. define(`fatal_error', - `errprint(`m4:'__file__:__line__`: fatal error: $* + `errprint(__program__:__file__:__line__`: fatal error: $* ')m4exit(`1')') => fatal_error(`this is a BAD one, buster') @@ -3563,7 +3816,9 @@ you can use `m4exit': 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. +(*note M4wrap::) is not reread. (This macro has a subtle bug, when +invoked from wrapped text. You should try to see if you can find it and +correct it. *note Answers::) m4wrap(`This text is lost to `m4exit'.') => @@ -3572,6 +3827,11 @@ not followed, e.g., diverted text is not => m4exit + 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 out, the exit status will be non-zero +even if `m4exit' requested zero. +  File: m4.info, Node: Frozen files, Next: Compatibility, Prev: Miscellaneous, Up: Top @@ -3668,6 +3928,11 @@ diversion number is also transmitted. 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 @@ -3676,7 +3941,7 @@ File: m4.info, Node: 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 a newer version of GNU `m4'. It is +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'. @@ -3690,8 +3955,8 @@ Numbers are always expressed in decimal. characters. The directives are: `C LEN1 , LEN2 STR1 STR2 ' - Uses STR1 and STR2 as the beginning comment and end comment - strings. If omitted, then `#' and are the comment delimiters. + Uses STR1 and STR2 as the begin-comment and end-comment strings. + If omitted, then `#' and are the comment delimiters. `D NUMBER, LEN STR ' Selects diversion NUMBER, making it current, then copy STR in the @@ -3717,8 +3982,8 @@ characters. The directives are: have no access to any builtins. `Q LEN1 , LEN2 STR1 STR2 ' - Uses STR1 and STR2 as the beginning quote and end quote strings. - If omitted, then ``' and `'' are the quote delimiters. + Uses STR1 and STR2 as the begin-quote and end-quote strings. If + omitted, then ``' and `'' are the quote delimiters. `T LEN1 , LEN2 STR1 STR2 ' Defines, though `pushdef', a definition for STR1 expanding to the @@ -3726,7 +3991,7 @@ characters. The directives are: the same name, and its order, along with `F', is important. `V NUMBER ' - Confirms the format of the file. `m4' 1.4.5 only creates and + Confirms the format of the file. `m4' 1.4.6 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. @@ -3758,8 +4023,8 @@ File: m4.info, Node: Extensions, Next: 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, unless overridden by other command line -options. +`-G' command line option (*note Invoking m4::), 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 @@ -3817,9 +4082,9 @@ options. * Macros can be called indirectly through `indir' (*note Indir::). - * The name of the current input file and the current input line - number are accessible through the builtins `__file__' and - `__line__' (*note Errprint::). + * 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::). @@ -3859,10 +4124,6 @@ behaviors is non-portable, as a future r cannot be parsed, or using `m4exit' (*note M4exit::) with a non-numeric argument). - * POSIX requires an application to exit with non-zero status if it - encounters a read error on stdin or write error on stdout, but GNU - `m4' still exits with status 0 even if the disk is full. - * 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' @@ -3924,6 +4185,24 @@ behaviors is non-portable, as a future r close quote, making it impossible to nest quotes. For predictable results, never call changequote with just one argument. + * Some 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 @@ -3936,12 +4215,6 @@ behaviors is non-portable, as a future r `traceon(`foo')' in the input, is an attribute that is preserved even if the macro is currently undefined. - * Traditional implementations allow argument collection, but not - string 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'. - * POSIX requires `eval' (*note Eval::) to treat all operators with the same precedence as C. However, GNU `m4' currently follows the traditional precedence of other `m4' implementations, where @@ -3957,6 +4230,10 @@ behaviors is non-portable, as a future r 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'. +  File: m4.info, Node: Other Incompatibilities, Prev: Incompatibilities, Up: Compatibility @@ -4012,6 +4289,19 @@ File: m4.info, Node: Answers, Next: Co Some of the examples in this manuals are buggy, for demonstration purposes. Correctly working macros are presented here. + 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 + The `cleardivert' macro (*note Cleardiv::) 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 @@ -4041,6 +4331,27 @@ with one that takes the number of argume undivert => + The `fatal_error' macro (*note M4exit::) does not quite match the +format of internal error messages when invoked inside wrapped text, due +to the current limitations of `__file__' (*note Location::) when +invoked inside `m4wrap'. Since `m4' omits the file and line number +from its warning messages when there is no current file (or +equivalently, when the current line is 0, since all files start at line +1), a better implementation would be: + + define(`fatal_error', + `errprint(__program__:ifelse(__line__, `0', `', + `__file__:__line__:')` fatal error: $* + ')m4exit(`1')') + => + m4wrap(`divnum(`demo of internal message') + fatal_error(`inside wrapped text')') + => + ^D + error-->m4: Warning: excess arguments to builtin `divnum' ignored + =>0 + error-->m4: fatal error: inside wrapped text +  File: m4.info, Node: Copying This Manual, Next: Indices, Prev: Answers, Up: Top @@ -4515,7 +4826,7 @@ B.1 Concept index * changing comment delimiters: Changecom. (line 6) * changing the quote delimiters: Changequote. (line 6) * characters, translating: Translit. (line 6) -* command line, file names on the: Invoking m4. (line 201) +* command line, file names on the: Invoking m4. (line 205) * command line, macro definitions on the: Invoking m4. (line 55) * command line, options: Invoking m4. (line 10) * commands, exit status from shell: Sysval. (line 6) @@ -4528,7 +4839,7 @@ B.1 Concept index * compatibility: Compatibility. (line 6) * conditionals: Ifdef. (line 6) * controlling debugging output: Debug Levels. (line 6) -* counting loops: Loops. (line 47) +* counting loops: Loops. (line 49) * debugging output, controlling: Debug Levels. (line 6) * debugging output, saving: Debug Output. (line 6) * decrement operator: Incr. (line 6) @@ -4558,10 +4869,10 @@ B.1 Concept index * file format, frozen file: Frozen file format. (line 6) * file inclusion <1>: File Inclusion. (line 6) * file inclusion: Undivert. (line 77) -* file names, on the command line: Invoking m4. (line 201) +* file names, on the command line: Invoking m4. (line 205) * files, diverting output to: Divert. (line 6) * files, names of temporary: Maketemp. (line 6) -* for loops: Loops. (line 47) +* for loops: Loops. (line 49) * formatted output: Format. (line 6) * frozen file format: Frozen file format. (line 6) * frozen files for fast loading: Using frozen files. (line 6) @@ -4572,12 +4883,12 @@ B.1 Concept index * GNU extensions <5>: Undivert. (line 77) * GNU extensions <6>: Patsubst. (line 6) * GNU extensions <7>: Search Path. (line 6) -* GNU extensions <8>: Arguments. (line 30) +* GNU extensions <8>: Arguments. (line 32) * GNU extensions <9>: Format. (line 6) * GNU extensions <10>: Indir. (line 6) * GNU extensions <11>: Debug Output. (line 6) * GNU extensions <12>: Builtin. (line 6) -* GNU extensions: Debug Levels. (line 58) +* GNU extensions: Debug Levels. (line 59) * included files, search path for: Search Path. (line 6) * inclusion, of files <1>: Undivert. (line 77) * inclusion, of files: File Inclusion. (line 6) @@ -4594,7 +4905,7 @@ B.1 Concept index * License: Copying This Manual. (line 6) * local variables: Pushdef. (line 75) * loops: Loops. (line 10) -* loops, counting: Loops. (line 47) +* loops, counting: Loops. (line 49) * macro definitions, on the command line: Invoking m4. (line 55) * macro expansion, tracing: Trace. (line 6) * macro invocation: Invocation. (line 6) @@ -4666,10 +4977,11 @@ the first time. [index] * Menu: -* __file__: Errprint. (line 28) +* __file__: Location. (line 10) * __gnu__: Platform macros. (line 12) -* __line__: Errprint. (line 29) +* __line__: Location. (line 11) * __os2__: Platform macros. (line 13) +* __program__: Location. (line 12) * __unix__: Platform macros. (line 15) * __windows__: Platform macros. (line 17) * builtin: Builtin. (line 9) @@ -4678,8 +4990,8 @@ the first time. * changequote: Changequote. (line 10) * changeword: Changeword. (line 23) * cleardivert: Cleardiv. (line 26) -* debugfile: Debug Output. (line 10) -* debugmode: Debug Levels. (line 62) +* debugfile: Debug Output. (line 11) +* debugmode: Debug Levels. (line 63) * decr: Incr. (line 11) * define: Define. (line 10) * defn: Defn. (line 10) @@ -4692,11 +5004,11 @@ the first time. * esyscmd: Esyscmd. (line 9) * eval: Eval. (line 9) * example: Manual. (line 32) -* fatal_error: M4exit. (line 17) -* forloop: Loops. (line 50) +* fatal_error: M4exit. (line 18) +* forloop: Loops. (line 52) * format: Format. (line 9) * ifdef: Ifdef. (line 10) -* ifelse: Ifelse. (line 11) +* ifelse: Ifelse. (line 12) * include: Include. (line 9) * incr: Incr. (line 10) * index: Index macro. (line 9) @@ -4710,7 +5022,7 @@ the first time. * popdef: Pushdef. (line 12) * pushdef: Pushdef. (line 11) * regexp: Regexp. (line 9) -* reverse: Loops. (line 30) +* reverse: Loops. (line 32) * shift: Loops. (line 17) * sinclude: Include. (line 10) * substr: Substr. (line 9) @@ -4728,89 +5040,90 @@ the first time.  Tag Table: -Node: Top1097 -Node: Preliminaries8712 -Node: Intro9439 -Node: History11069 -Node: Invoking m413683 -Node: Bugs22463 -Node: Manual23731 -Node: Syntax26663 -Node: Names27421 -Node: Quoted strings27784 -Node: Other tokens28405 -Node: Comments28627 -Node: Input processing29471 -Node: Macros30632 -Node: Invocation31126 -Node: Inhibiting Invocation31927 -Node: Macro Arguments35300 -Node: Quoting Arguments36960 -Node: Macro expansion38192 -Node: Definitions38860 -Node: Define39644 -Node: Arguments41563 -Node: Pseudo Arguments43180 -Node: Undefine45710 -Node: Defn46840 -Node: Pushdef49147 -Node: Indir51481 -Node: Builtin52409 -Node: Conditionals54773 -Node: Ifdef55487 -Node: Ifelse56343 -Node: Loops59101 -Node: Debugging62908 -Node: Dumpdef63493 -Node: Trace64871 -Node: Debug Levels67466 -Node: Debug Output70232 -Node: Input Control71355 -Node: Dnl71893 -Node: Changequote73414 -Node: Changecom75263 -Node: Changeword76842 -Node: M4wrap81334 -Node: File Inclusion83085 -Node: Include83402 -Node: Search Path85562 -Node: Diversions86353 -Node: Divert87591 -Node: Undivert89058 -Node: Divnum91782 -Node: Cleardiv92241 -Node: Text handling93400 -Node: Len94123 -Node: Index macro94508 -Node: Regexp95112 -Node: Substr96945 -Node: Translit97728 -Node: Patsubst99246 -Node: Format102607 -Node: Arithmetic104650 -Node: Incr105099 -Node: Eval105876 -Node: Shell commands110286 -Node: Platform macros111196 -Node: Syscmd112904 -Node: Esyscmd113873 -Node: Sysval114798 -Node: Maketemp116277 -Node: Miscellaneous116993 -Node: Errprint117366 -Node: M4exit118452 -Node: Frozen files119745 -Node: Using frozen files120526 -Node: Frozen file format123521 -Node: Compatibility126595 -Node: Extensions127210 -Node: Incompatibilities130640 -Node: Other Incompatibilities136849 -Node: Answers138777 -Node: Copying This Manual139870 -Node: GNU Free Documentation License140098 -Node: Indices162504 -Node: Concept index162736 -Node: Macro index173818 +Node: Top864 +Node: Preliminaries8278 +Node: Intro9005 +Node: History10637 +Node: Invoking m413261 +Node: Bugs22389 +Node: Manual23655 +Node: Syntax26587 +Node: Names27584 +Node: Quoted strings28034 +Node: Comments28669 +Node: Other tokens29508 +Node: Input processing30056 +Node: Macros31905 +Node: Invocation32399 +Node: Inhibiting Invocation33200 +Node: Macro Arguments36715 +Node: Quoting Arguments38613 +Node: Macro expansion39845 +Node: Definitions40513 +Node: Define41297 +Node: Arguments43216 +Node: Pseudo Arguments44945 +Node: Undefine47475 +Node: Defn48605 +Node: Pushdef50908 +Node: Indir53242 +Node: Builtin54170 +Node: Conditionals55589 +Node: Ifdef56303 +Node: Ifelse57158 +Node: Loops59915 +Node: Debugging63787 +Node: Dumpdef64372 +Node: Trace65749 +Node: Debug Levels68365 +Node: Debug Output71153 +Node: Input Control72334 +Node: Dnl72872 +Node: Changequote74682 +Node: Changecom78157 +Node: Changeword81088 +Node: M4wrap85705 +Node: File Inclusion87924 +Node: Include88241 +Node: Search Path90687 +Node: Diversions91499 +Node: Divert92737 +Node: Undivert94932 +Node: Divnum97656 +Node: Cleardiv98115 +Node: Text handling99274 +Node: Len99997 +Node: Index macro100382 +Node: Regexp101153 +Node: Substr103402 +Node: Translit104453 +Node: Patsubst106142 +Node: Format109676 +Node: Arithmetic111734 +Node: Incr112183 +Node: Eval112958 +Node: Shell commands117367 +Node: Platform macros118277 +Node: Syscmd120006 +Node: Esyscmd120975 +Node: Sysval121900 +Node: Maketemp123456 +Node: Miscellaneous124172 +Node: Errprint124603 +Node: Location125403 +Node: M4exit127601 +Node: Frozen files129381 +Node: Using frozen files130162 +Node: Frozen file format133402 +Node: Compatibility136465 +Node: Extensions137080 +Node: Incompatibilities140562 +Node: Other Incompatibilities147468 +Node: Answers149396 +Node: Copying This Manual151742 +Node: GNU Free Documentation License151970 +Node: Indices174376 +Node: Concept index174608 +Node: Macro index185690  End Tag Table diff -ruNp m4-1.4.5/doc/m4.texinfo m4-1.4.6/doc/m4.texinfo --- m4-1.4.5/doc/m4.texinfo 2006-07-15 15:48:08.000000000 -0600 +++ m4-1.4.6/doc/m4.texinfo 2006-08-24 08:15:09.000000000 -0600 @@ -40,7 +40,7 @@ @copying -This manual is for GNU M4 (version @value{VERSION}, @value{UPDATED}), +This manual is for @acronym{GNU} M4 (version @value{VERSION}, @value{UPDATED}), a package containing an implementation of the m4 macro language. Copyright @copyright{} 1989, 1990, 1991, 1992, 1993, 1994, 2004, 2005, @@ -50,15 +50,9 @@ Copyright @copyright{} 1989, 1990, 1991, Permission is granted to copy, distribute and/or modify this document under the terms of the @acronym{GNU} Free Documentation License, Version 1.2 or any later version published by the Free Software -Foundation; with no Invariant Sections, with the Front-Cover texts -being ``A @acronym{GNU} Manual,'' and with the Back-Cover Texts as in -(a) below. A copy of the license is included in the section entitled -``@acronym{GNU} Free Documentation License.'' - -(a) The FSF's Back-Cover Text is: ``You have freedom to copy and -modify this @acronym{GNU} Manual, like @acronym{GNU} software. Copies -published by the Free Software Foundation raise funds for -@acronym{GNU} development.'' +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 ``@acronym{GNU} Free Documentation License.'' @end quotation @end copying @@ -86,18 +80,18 @@ published by the Free Software Foundatio @insertcopying @end ifnottex -GNU @code{m4} is an implementation of the traditional UNIX macro +@acronym{GNU} @code{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). @code{m4} also has builtin functions for including files, running shell commands, doing arithmetic, etc. Autoconf needs -GNU @code{m4} for generating @file{configure} scripts, but not for +@acronym{GNU} @code{m4} for generating @file{configure} scripts, but not for running them. -GNU @code{m4} was originally written by Ren@'e Seindal, with +@acronym{GNU} @code{m4} was originally written by Ren@'e Seindal, with subsequent changes by Fran@,{c}ois Pinard and other volunteers on the Internet. All names and email addresses can be found in the -files @file{AUTHORS} and @file{THANKS} from the GNU M4 distribution. +files @file{AUTHORS} and @file{THANKS} from the @acronym{GNU} M4 distribution. This is release @value{VERSION}. It is now considered stable: future releases in the 1.4.x series are only meant to fix bugs, increase speed, @@ -157,8 +151,8 @@ Lexical and syntactic conventions * Names:: Macro names * Quoted strings:: Quoting input to m4 -* Other tokens:: Other kinds of input tokens * Comments:: Comments in m4 input +* Other tokens:: Other kinds of input tokens * Input processing:: How m4 copies input to output How to invoke macros @@ -240,6 +234,7 @@ Running shell commands Miscellaneous builtin macros * Errprint:: Printing error messages +* Location:: Printing current location * M4exit:: Exiting from m4 Fast loading of frozen state @@ -249,7 +244,7 @@ Fast loading of frozen state Compatibility with other versions of @code{m4} -* Extensions:: Extensions in GNU M4 +* Extensions:: Extensions in @acronym{GNU} M4 * Incompatibilities:: Facilities in System V m4 not in GNU M4 * Other Incompatibilities:: Other incompatibilities @@ -268,7 +263,7 @@ Indices @node Preliminaries @chapter Introduction and preliminaries -This first chapter explains what GNU @code{m4} is, where @code{m4} +This first chapter explains what @acronym{GNU} @code{m4} is, where @code{m4} comes from, how to read and use this documentation, how to call the @code{m4} program, and how to report bugs about it. It concludes by giving tips for reading the remainder of the manual. @@ -293,17 +288,17 @@ builtin or user-defined, and can take an Besides just doing macro expansion, @code{m4} has builtin functions for including named files, running shell commands, doing integer arithmetic, manipulating text in various ways, performing recursion, -etc@dots{} @code{m4} can be used either as a front-end to a compiler, or -as a macro processor in its own right. +etc.@dots{} @code{m4} can be used either as a front-end to a compiler, +or as a macro processor in its own right. The @code{m4} macro processor is widely available on all UNIXes, and has been standardized by @acronym{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 @code{m4} for -@emph{generating} @file{configure} scripts, is an incentive +popularity of @acronym{GNU} Autoconf, which requires @acronym{GNU} +@code{m4} for @emph{generating} @file{configure} scripts, is an incentive for many to install it, while these people will not themselves -program in @code{m4}. GNU @code{m4} is mostly compatible with the +program in @code{m4}. @acronym{GNU} @code{m4} is mostly compatible with the System V, Release 3 version, except for some minor differences. @xref{Compatibility}, for more details. @@ -342,7 +337,8 @@ Originally, the Kernighan and Plauger ma that is, the @code{Ratfor} equivalent of @code{cpp}. Later, @code{m4} was used as a frontend for @code{Ratfor}, @code{C} and @code{Cobol}. -Ren@'e Seindal released his implementation of @code{m4}, GNU @code{m4}, +Ren@'e Seindal released his implementation of @code{m4}, @acronym{GNU} +@code{m4}, in 1990, with the aim of removing the artificial limitations in many of the traditional @code{m4} implementations, such as maximum line length, macro size, or number of macros. @@ -352,22 +348,23 @@ evolution in the form of @code{M5}: ``Us Language: 2nd edition'', Electronic Announcement on comp.compilers newsgroup (1992). -Fran@,{c}ois Pinard took over maintenance of GNU @code{m4} in 1992, until -1994 when he released GNU @code{m4} 1.4, which was the stable release -for 10 years. It was at this time that GNU Autoconf decided to require -GNU @code{m4} as its underlying engine, since all other implementations -of @code{m4} had too many limitations. +Fran@,{c}ois Pinard took over maintenance of @acronym{GNU} @code{m4} in +1992, until 1994 when he released @acronym{GNU} @code{m4} 1.4, which was +the stable release for 10 years. It was at this time that @acronym{GNU} +Autoconf decided to require @acronym{GNU} @code{m4} as its underlying +engine, since all other implementations of @code{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 @code{m4} 1.4 that were floating around the net and +patches to @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. +prepared patches for the release of 1.4.5 and 1.4.6. Meanwhile, development has continued on new features for @code{m4}, such -as dynamic module loading and additional builtins. When complete, GNU -@code{m4} 2.0 will start a new series of releases. +as dynamic module loading and additional builtins. When complete, +@acronym{GNU} @code{m4} 2.0 will start a new series of releases. @node Invoking m4 @section Invoking @code{m4} @@ -376,7 +373,7 @@ The format of the @code{m4} command is: @comment ignore @example -@code{m4} [@var{option}@dots{}] [@var{file}@dots{}] +@code{m4} @r{[}@var{option}@dots{}@r{]} @r{[}@var{file}@dots{}@r{]} @end example @cindex command line, options @@ -413,8 +410,8 @@ output will be unbuffered, and interrupt Internally modify @emph{all} builtin macro names so they all start with the prefix @samp{m4_}. For example, using this option, one should write @samp{m4_define} instead of @samp{define}, and @samp{m4___file__} -instead of @samp{__file__}. This option has no effect if @option{-R} is -also specified. +instead of @samp{__file__}. This option has no effect if @option{-R} +is also specified. @item -Q @itemx --quiet @@ -425,7 +422,7 @@ calls, or treating the empty string as z @item -W @var{REGEXP} @itemx --word-regexp=@var{REGEXP} Use @var{REGEXP} as an alternative syntax for macro names. This -experimental option will not be present on all GNU @code{m4} +experimental option will not be present on all @acronym{GNU} @code{m4} implementations (@pxref{Changeword}). @end table @@ -437,8 +434,8 @@ search path can be altered, and the outp input came from. These features occur with the following options: @table @code -@item -D @var{NAME}[=@var{VALUE}] -@itemx --define=@var{NAME}[=@var{VALUE}] +@item -D @var{NAME}@r{[}=@var{VALUE}@r{]} +@itemx --define=@var{NAME}@r{[}=@var{VALUE}@r{]} This enters @var{NAME} into the symbol table, before any input files are read. If @samp{=@var{VALUE}} is missing, the value is taken to be the empty string. The @var{VALUE} can be any string, and the macro can be @@ -446,11 +443,11 @@ defined to take arguments, just as if it input. This option may be given more than once; order is significant, and redefining the same @var{NAME} loses the previous value. -@item -I @var{DIR} -@itemx --include=@var{DIR} -Make @code{m4} search @var{DIR} for included files that are not found in -the current working directory. @xref{Search Path}, for more details. -This option may be given more than once. +@item -I @var{DIRECTORY} +@itemx --include=@var{DIRECTORY} +Make @code{m4} search @var{DIRECTORY} for included files that are not +found in the current working directory. @xref{Search Path}, for more +details. This option may be given more than once. @item -s @itemx --synclines @@ -480,7 +477,7 @@ definition is silently ignored. There are some limits within @code{m4} that can be tuned. For compatibility, @code{m4} also accepts some options that control limits in other implementations, but which are automatically unbounded (limited -only by your hardware constraints) in GNU @code{m4}. +only by your hardware constraints) in @acronym{GNU} @code{m4}. @table @code @item -G @@ -508,12 +505,12 @@ Most users would never need this option. this option (which is still experimental) might well disappear. This option does @emph{not} have the ability to break endless -rescanning loops, while these do not necessarily consume much memory +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 to @code{m4} with useful +request complex, time-consuming computations from @code{m4} with useful results. Putting limitations in this area would break @code{m4} power. There are many pathological cases: @w{@samp{define(`a', `a')a}} is -only the simplest example (but @pxref{Compatibility}). Expecting GNU +only the simplest example (but @pxref{Compatibility}). Expecting @acronym{GNU} @code{m4} to detect these would be a little like expecting a compiler system to detect and diagnose endless loops: it is a quite @emph{hard} problem in general, if not undecidable! @@ -527,24 +524,24 @@ do nothing in this implementation. @item -N @var{NUM} @itemx --diversions=@var{NUM} These options are present only for compatibility with previous -versions of GNU @code{m4}, and were controlling the number of possible -diversions which could be used at the same time. They do nothing, +versions of @acronym{GNU} @code{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. @end table -GNU @code{m4} comes with a feature of freezing internal state +@acronym{GNU} @code{m4} comes with a feature of freezing internal state (@pxref{Frozen files}). This can be used to speed up @code{m4} execution when reusing a common initialization script. @table @code @item -F @var{FILE} -@itemx --freeze-state @var{FILE} +@itemx --freeze-state=@var{FILE} Once execution is finished, write out the frozen state on the specified @var{FILE}. It is conventional, but not required, for @var{FILE} to end in @samp{.m4f}. @item -R @var{FILE} -@itemx --reload-state @var{FILE} +@itemx --reload-state=@var{FILE} Before execution starts, recover the internal state from the specified frozen @var{FILE}. The options @option{-D}, @option{-U}, and @option{-t} take effect after state is reloaded, but before the input @@ -555,8 +552,8 @@ Finally, there are several options for a scripts. @table @code -@item -d[@var{FLAGS}] -@itemx --debug[=@var{FLAGS}] +@item -d@r{[}@var{FLAGS}@r{]} +@itemx --debug@r{[}=@var{FLAGS}@r{]} Set the debug-level according to the flags @var{FLAGS}. The debug-level controls the format and amount of information presented by the debugging functions. @xref{Debug Levels}, for more details on the format and @@ -565,13 +562,16 @@ meaning of @var{FLAGS}. If omitted, @va @item -l @var{NUM} @itemx --arglength=@var{NUM} Restrict the size of the output generated by macro tracing to @var{NUM} -characters per trace line. @xref{Debug Levels}, for more details. +characters per trace line. If unspecified or zero, output is +unlimited. @xref{Debug Levels}, for more details. @item -o @var{FILE} @itemx --error-output=@var{FILE} -Redirect debug and trace output to the named @var{FILE}. Error messages -are still printed on the standard error output. @xref{Debug Output}, -for more details. +Redirect @code{dumpdef} output, debug messages, and trace output to the +named @var{FILE}. Warnings, error messages, and @code{errprint} output +are still printed to standard error. If unspecified, debug output goes +to standard error; if empty, debug output is discarded. @xref{Debug +Output}, for more details. @item -t @var{NAME} @itemx --trace=@var{NAME} @@ -590,10 +590,12 @@ conventional, but not required, for inpu The input files are read in the sequence given. The standard input can only be read once, so the file name @file{-} should only appear once on the command line. It is an error if an input file ends in the middle of -argument collection or a quoted string. +argument collection, a comment, or a quoted string. If none of the input files invoked @code{m4exit} (@pxref{M4exit}), the -exit status of @code{m4} will be 0 for success, and 1 for failure. +exit status of @code{m4} will be 0 for success, 1 for general failure +(such as problems with reading an input file), and 63 for version +mismatch (@pxref{Using frozen files}). If you need to read a file whose name starts with a @file{-}, you can specify it as @samp{./-file}, or use @option{--} to mark the end of @@ -602,7 +604,7 @@ options. @node Bugs @section Problems and bugs -If you have problems with GNU @code{m4} or think you've found a bug, +If you have problems with @acronym{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 @@ -652,8 +654,8 @@ Example of input line The sequence @samp{^D} in an example indicates the end of the input file. The majority of these examples are self-contained, and you can run them with similar results by invoking @kbd{m4 -d}. In fact, the testsuite -that is bundled in the GNU M4 package consists of the examples in this -document! +that is bundled in the @acronym{GNU} M4 package consists of the examples +in this document! As each of the predefined macros in @code{m4} is described, a prototype call of the macro will be shown, giving descriptive names to the @@ -701,14 +703,18 @@ primitive is spelled within @code{m4}. As @code{m4} reads its input, it separates it into @dfn{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 @code{m4} can also -contain comments. GNU @code{m4} does not yet understand locales; all -operations are byte-oriented rather than character-oriented. +contain comments. @acronym{GNU} @code{m4} does not yet understand +locales; all operations are byte-oriented rather than +character-oriented. However, @code{m4} is eight-bit clean, so you can +use non-@sc{ascii} characters in quoted strings (@pxref{Changequote}), +comments (@pxref{Changecom}), and macro names (@pxref{Indir}), with the +exception of the @sc{nul} character (the zero byte @samp{'\0'}). @menu * Names:: Macro names * Quoted strings:: Quoting input to m4 -* Other tokens:: Other kinds of input tokens * Comments:: Comments in m4 input +* Other tokens:: Other kinds of input tokens * Input processing:: How m4 copies input to output @end menu @@ -717,9 +723,10 @@ operations are byte-oriented rather than @cindex names A name is any sequence of letters, digits, and the character @kbd{_} -(underscore), where the first character is not a digit. If a -name has a macro definition, it will be subject to macro expansion -(@pxref{Macros}). +(underscore), where the first character is not a digit. @code{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 +(@pxref{Macros}). Names are case-sensitive. Examples of legal names are: @samp{foo}, @samp{_tmp}, and @samp{name01}. @@ -727,8 +734,9 @@ Examples of legal names are: @samp{foo}, @section Quoted strings @cindex quoted string -A quoted string is a sequence of characters surrounded by the quotes -@kbd{`} and @kbd{'}, where the nested start and end quotes within the +A quoted string is a sequence of characters surrounded by quote +strings, defaulting to +@kbd{`} and @kbd{'}, 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 @@ -750,12 +758,6 @@ is the empty string, and double-quoting The quote characters can be changed at any time, using the builtin macro @code{changequote}. @xref{Changequote}, for more information. -@node Other tokens -@section Other tokens - -Any character, that is neither a part of a name, nor of a quoted string, -is a token by itself. - @node Comments @section Comments @@ -766,7 +768,7 @@ but the entire comment (including the de the output---comments are @emph{not} discarded by @code{m4}. Comments cannot be nested, so the first newline after a @samp{#} ends -the comment. The commenting effect of the begin comment character +the comment. The commenting effect of the begin-comment string can be inhibited by quoting it. @example @@ -780,6 +782,17 @@ The comment delimiters can be changed to the builtin macro @code{changecom}. @xref{Changecom}, for more information. +@node Other tokens +@section Other 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 (@samp{(} and +@samp{)}), comma (@samp{,}), and dollar (@samp{$}) have additional +roles, explained later. + @node Input processing @section Input Processing @@ -794,7 +807,8 @@ call will be read and parsed into tokens @code{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. If the input is +call first. For a running example, examine how @code{m4} handles this +input: @comment ignore @example @@ -802,8 +816,16 @@ format(`Result is %d', eval(`2**15')) @end example @noindent -@code{m4} will first expand @samp{eval(2**15)} to @samp{32768}, and only -then expand the resulting call +First, @code{m4} sees that the token @samp{format} is a macro name, so +it collects the tokens @samp{(}, @samp{`Result is %d'}, @samp{,}, +and @samp{@w{ }}, before encountering another potential macro. Sure +enough, @samp{eval} is a macro name, so the nested argument collection +picks up @samp{(}, @samp{`2**15'}, and @samp{)}, invoking the eval macro +with the lone argument of @samp{2**15}. The expansion of +@samp{eval(2**15)} is @samp{32768}, which is then rescanned as the five +tokens @samp{3}, @samp{2}, @samp{7}, @samp{6}, and @samp{8}; and +combined with the next @samp{)}, the format macro now has all its +arguments, as if the user had typed: @comment ignore @example @@ -811,15 +833,18 @@ format(`Result is %d', 32768) @end example @noindent -which will give the output +The format macro expands to @samp{Result is 32768}, and we have another +round of scanning for the tokens @samp{Result}, @samp{@w{ }}, +@samp{is}, @samp{@w{ }}, @samp{3}, @samp{2}, @samp{7}, @samp{6}, and +@samp{8}. None of these are macros, so the final output is @comment ignore @example -Result is 32768 +@result{}Result is 32768 @end example The order in which @code{m4} expands the macros can be explored using -the @ref{Trace} facilities of GNU @code{m4}. +the @ref{Trace} facilities of @acronym{GNU} @code{m4}. This process continues until there are no more macro calls to expand and all the input has been consumed. @@ -885,7 +910,7 @@ An innovation of the @code{m4} language, predecessors (like Stratchey's @code{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 +sometimes be the source of spurious, unwanted macro calls. So, @acronym{GNU} @code{m4} offers several mechanisms or techniques for inhibiting the recognition of names as macro calls. @@ -898,12 +923,16 @@ call is not triggered. This solves the specific provision. There is also a command line option (@option{--prefix-builtins}, or -@option{-P}) which requires all builtin macro names to be prefixed +@option{-P}, @pxref{Invoking m4}) which requires all builtin macro names +to be prefixed by @samp{m4_} for them to be recognized. The option has no effect whatsoever on user defined macros. For example, with this option, one has to write @code{m4_dnl} and even @code{m4_m4exit}. -If your version of GNU @code{m4} has the @code{changeword} feature +Another alternative is to redefine problematic macros to a name less +likely to cause conflicts, @xref{Definitions}. + +If your version of @acronym{GNU} @code{m4} has the @code{changeword} feature compiled in, it offers far more flexibility in specifying the syntax of macro names, both builtin or user-defined. @xref{Changeword}, for more information on this experimental feature. @@ -1002,11 +1031,12 @@ supplied, the missing arguments are take 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. Normally @code{m4} will issue warnings if a builtin macro is called with an inappropriate number of arguments, but it can be suppressed with -the @option{-Q} command line option. For user defined macros, there is no -check of the number of arguments given. +the @option{-Q} command line option (@pxref{Invoking m4}). For user +defined macros, there is no check of the number of arguments given. Macros are expanded normally during argument collection, and whatever commas, quotes and parentheses that might show up in the resulting @@ -1037,6 +1067,14 @@ f @result{}2 @end example +It is an error if the end of file occurs while collecting arguments. + +@example +define( +^D +@error{}m4:stdin:1: ERROR: end of file in argument list +@end example + @node Quoting Arguments @section Quoting macro arguments @@ -1162,8 +1200,8 @@ one @result{}two @end example -As a GNU extension, the first argument to @code{define} does not have to -be a simple word. +As a @acronym{GNU} extension, the first argument to @code{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 recognised. It can only be referenced by the builtins @ref{Indir} @@ -1221,9 +1259,12 @@ macro @end example @xref{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. @pxref{Answers}) -@cindex GNU extensions -GNU @code{m4} allows the number following the @samp{$} to consist of one +@cindex @acronym{GNU} extensions +@acronym{GNU} @code{m4} allows the number following the @samp{$} to +consist of one or more digits, allowing macros to have any number of arguments. This is not so in UNIX implementations of @code{m4}, which only recognize one digit. @@ -1474,11 +1515,11 @@ defn(`string') @end example However, it is important to remember that @code{m4} rescanning is purely -textual. If an unbalanced right quote string occurs in a macro +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 right -quotes in macro definitions or arguments to macros. +be rescanned unquoted. Thus it is a good idea to avoid unbalanced +end-quotes in macro definitions or arguments to macros. @example define(`foo', a'a) @@ -1591,7 +1632,7 @@ and @code{defn}. @cindex indirect call of macros @cindex call of macros, indirect @cindex macros, indirect call of -@cindex GNU extensions +@cindex @acronym{GNU} extensions Any macro can be called indirectly with @code{indir}: @deffn Builtin indir (@var{name}, @dots{}) @@ -1624,7 +1665,7 @@ called through the builtin @code{indir}. @cindex indirect call of builtins @cindex call of builtins, indirect @cindex builtins, indirect call of -@cindex GNU extensions +@cindex @acronym{GNU} extensions Builtin macros can be called indirectly with @code{builtin}: @deffn Builtin builtin (@var{name}, @dots{}) @@ -1636,52 +1677,7 @@ The macro @code{builtin} is recognized o @end deffn This can be used even if @var{name} has been given another definition -that has covered the original, or been undefined so that no @var{name} -maps to the builtin. - -@example -pushdef(`define', `hidden') -@result{} -undefine(`undefine') -@result{} -define(`foo', `bar') -@result{}hidden -foo -@result{}foo -builtin(`define', `foo', `BAR') -@result{} -foo -@result{}BAR -undefine(`foo') -@result{}undefine(foo) -foo -@result{}BAR -builtin(`undefine', `foo') -@result{} -foo -@result{}foo -@end example - -Note that this can be used to invoke builtins that normally require -parameters without actually providing them; but it will provoke a -warning, and usually result in a void expansion. - -@example -builtin -@result{}builtin -builtin() -@error{}stdin:2: m4: undefined builtin `' -@result{} -builtin(`builtin') -@error{}stdin:3: m4: Warning: too few arguments to builtin `builtin' -@result{} -builtin(`builtin',) -@error{}stdin:4: m4: undefined builtin `' -@result{} -@end example - -This can be used even if @var{name} has been given another definition -that has covered the original, or been undefined so that no @var{name} +that has covered the original, or been undefined so that no macro maps to the builtin. @example @@ -1707,21 +1703,21 @@ foo @result{}foo @end example -Note that this can be used to invoke builtins that normally require -parameters without actually providing them; but it will provoke a -warning, and usually result in a void expansion. +Note that this 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. @example builtin @result{}builtin builtin() -@error{}stdin:2: m4: undefined builtin `' +@error{}m4:stdin:2: undefined builtin `' @result{} builtin(`builtin') -@error{}stdin:3: m4: Warning: too few arguments to builtin `builtin' +@error{}m4:stdin:3: Warning: too few arguments to builtin `builtin' @result{} builtin(`builtin',) -@error{}stdin:4: m4: undefined builtin `' +@error{}m4:stdin:4: undefined builtin `' @result{} @end example @@ -1764,7 +1760,7 @@ define(`foo', `') ifdef(`foo', ``foo' is defined', ``foo' is not defined') @result{}foo is defined ifdef(`no_such_macro', `yes', `no', `extra argument') -@error{}stdin:4: m4: Warning: excess arguments to builtin `ifdef' ignored +@error{}m4:stdin:4: Warning: excess arguments to builtin `ifdef' ignored @result{}no @end example @@ -1798,14 +1794,14 @@ The macro @code{ifelse} is recognized on Using only one argument is a common @code{m4} idiom for introducing a block comment, as an alternative to repeatedly using @code{dnl}. This -special usage is recognized by GNU @code{m4}, so that in this case, the -warning about missing arguments is never triggered. +special usage is recognized by @acronym{GNU} @code{m4}, so that in this +case, the warning about missing arguments is never triggered. @example ifelse(`some comments') @result{} ifelse(`foo', `bar') -@error{}stdin:2: m4: Warning: too few arguments to builtin `ifelse' +@error{}m4:stdin:2: Warning: too few arguments to builtin `ifelse' @result{} @end example @@ -1876,11 +1872,13 @@ be used for iterating through the actual @deffn Builtin shift (@dots{}) Takes any number of arguments, and expands to all but the first argument, separated by commas, with each argument quoted. + +The macro @code{shift} is recognized only with parameters. @end deffn @example shift -@result{} +@result{}shift shift(`bar') @result{} shift(`foo', `bar', `baz') @@ -2040,7 +2038,7 @@ f(popdef(`f')dumpdef(`f')) @error{}f:@tabchar{}``$0'1' @result{}f2 f(popdef(`f')dumpdef(`f')) -@error{}stdin:3: m4: undefined macro `f' +@error{}m4:stdin:3: undefined macro `f' @result{}f1 @end example @@ -2090,7 +2088,7 @@ The number between dashes is the depth o 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 @option{--nesting-limit}. +option @option{--nesting-limit} (@pxref{Invoking m4}). Tracing by name is an attribute that is preserved whether the macro is defined or not. This allows the @option{-t} option to select macros to @@ -2113,7 +2111,7 @@ undefine(`foo') ifdef(`foo', `yes', `no') @result{}no indir(`foo') -@error{}stdin:8: m4: undefined macro `foo' +@error{}m4:stdin:8: undefined macro `foo' @result{} define(`foo', `blah') @result{} @@ -2152,8 +2150,9 @@ display. @cindex controlling debugging output @cindex debugging output, controlling -The @option{-d} option to @code{m4} controls the amount of details -presented, when using the macros described in the preceding sections. +The @option{-d} option to @code{m4} (@pxref{Invoking m4}) controls the +amount of details presented, when using the macros described in the +preceding sections. The @var{flags} following the option can be one or more of the following: @@ -2208,7 +2207,7 @@ If no flags are specified with the @opti @samp{aeq}. The examples throughout this manual assume the default flags. -@cindex GNU extensions +@cindex @acronym{GNU} extensions There is a builtin macro @code{debugmode}, which allows on-the-fly control of the debugging output format: @@ -2251,15 +2250,17 @@ foo @cindex saving debugging output @cindex debugging output, saving @cindex output, saving debugging -@cindex GNU extensions +@cindex @acronym{GNU} extensions Debug and tracing output can be redirected to files using either the -@option{-o} option to @code{m4}, or with the builtin macro @code{debugfile}: +@option{-o} option to @code{m4} (@pxref{Invoking m4}), or with the +builtin macro @code{debugfile}: @deffn Builtin debugfile (@ovar{file}) Sends all further debug and trace output to @var{file}. If @var{file} is empty, debug and trace output are discarded. If @code{debugfile} is called without any arguments, debug and trace output -are sent to standard error. This does not affect warnings, which are +are sent to standard error. This does not affect warnings, error +messages, or @code{errprint} output, which are always sent to standard error. If @var{file} cannot be opened, the current debug file is unchanged. @@ -2270,13 +2271,13 @@ The expansion of @code{debugfile} is voi traceon(`divnum') @result{} divnum(`extra') -@error{}stdin:2: m4: Warning: excess arguments to builtin `divnum' ignored +@error{}m4:stdin:2: Warning: excess arguments to builtin `divnum' ignored @error{}m4trace: -1- divnum(`extra') -> `0' @result{}0 debugfile() @result{} divnum(`extra') -@error{}stdin:4: m4: Warning: excess arguments to builtin `divnum' ignored +@error{}m4:stdin:4: Warning: excess arguments to builtin `divnum' ignored @result{}0 debugfile @result{} @@ -2325,7 +2326,7 @@ The input up to and including the next n to the way comments are treated (@pxref{Comments}). Usually, @code{dnl} is immediately followed by an end of line or some -other whitespace. GNU @code{m4} will produce a warning diagnostic if +other whitespace. @acronym{GNU} @code{m4} will produce a warning diagnostic if @code{dnl} is followed by an open parenthesis. In this case, @code{dnl} will collect and process all arguments, looking for a matching close parenthesis. All predictable side effects resulting from this @@ -2336,11 +2337,25 @@ next newline, on whatever line containin @example dnl(`args are ignored, but side effects occur', define(`foo', `like this')) while this text is ignored: undefine(`foo') -@error{}stdin:2: m4: Warning: excess arguments to builtin `dnl' ignored +@error{}m4:stdin:2: Warning: excess arguments to builtin `dnl' ignored See how `foo' was defined, foo? @result{}See how foo was defined, like this? @end example +If the end of file is encountered without a newline character, a +warning is issued and dnl stops consuming input. + +@example +define(`hi', `HI') +@result{} +m4wrap(`m4wrap(`2 hi +')0 hi dnl 1 hi') +@result{} +^D +@error{}m4: Warning: end of file treated as newline +@result{}0 HI 2 HI +@end example + @node Changequote @section Changing the quote characters @@ -2350,7 +2365,7 @@ The default quote delimiters can be chan @code{changequote}: @deffn Builtin changequote (@dvar{start, `}, @dvar{end, '}) -This sets @var{start} as the new start-quote delimiter and @var{end} as the +This sets @var{start} as the new begin-quote delimiter and @var{end} as the new end-quote delimiter. If any of the arguments are missing, the default quotes (@code{`} and @code{'}) are used instead of the void arguments. @comment FIXME POSIX requires that with one argument, the closing quote @@ -2368,6 +2383,23 @@ foo @result{}Macro foo. @end example +The quotation strings can safely contain eight-bit characters. +@ignore +Yuck. I know of no clean way to render an 8-bit character in both info +and dvi. This example uses the `open-guillemot' and `close-guillemot' +characters of the Latin-1 character set. + +@example +define(`a', `b') +@result{} +«a» +@result{}«b» +changequote(`«', `»') +@result{} +«a» +@result{}a +@end example +@end ignore If no single character is appropriate, @var{start} and @var{end} can be of any length. @@ -2395,7 +2427,7 @@ foo @end example There is no way in @code{m4} to quote a string containing an unmatched -left quote, except using @code{changequote} to change the current +begin-quote, except using @code{changequote} to change the current quotes. If the quotes should be changed from, say, @samp{[} to @samp{[[}, @@ -2403,13 +2435,93 @@ temporary quote characters have to be de calls of @code{changequote} must be made, one for the temporary quotes and one for the new quotes. -Neither quote string should start with a letter or @samp{_} (underscore), -as they will be confused with names in the input. Doing so disables -the quoting mechanism. - -Changing the quotes to have the same start and end string disables -nesting of quotes. This makes it impossible to double-quote strings -across macro expansions, so it is not done very often. +Macros are recognized in preference to the begin-quote string, so if a +prefix of @var{start} can be recognized as a potential macro name, the +quoting mechanism is effectively disabled. Unless you use +@code{changeword} (@pxref{Changeword}), this means that @var{start} +should not begin with a letter or @samp{_} (underscore). + +@example +define(`hi', `HI') +@result{} +changequote(`q', `Q') +@result{} +q hi Q hi +@result{}q HI Q HI +changequote +@result{} +changequote(`-', `EOF') +@result{} +- hi EOF hi +@result{} hi HI +@end example + +Quotes are recognized in preference to argument collection. In +particular, if @var{start} is a single @samp{(}, then argument +collection is effectively disabled. For portability with other +implementations, it is a good idea to avoid @samp{(}, @samp{,}, and +@samp{)} as the first character in @var{start}. + +@example +define(`echo', `$#:$@:') +@result{} +define(`hi', `HI') +@result{} +changequote(`(',`)') +@result{} +echo(hi) +@result{}0::hi +changequote +@result{} +changequote(`((', `))') +@result{} +echo(hi) +@result{}1:HI: +echo((hi)) +@result{}0::hi +changequote +@result{} +changequote(`,', `)') +@result{} +echo(hi,hi)bye) +@result{}1:HIhibye: +@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 +@var{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. + +@example +define(`hi', `HI') +@result{} +changequote(`""', `"') +@result{} +""hi"""hi" +@result{}hihi +""hi" ""hi" +@result{}hi hi +""hi"" "hi" +@result{}hi" "HI" +changequote +@result{} +`hi`hi'hi' +@result{}hi`hi'hi +changequote(`"', `"') +@result{} +"hi"hi"hi" +@result{}hiHIhi +@end example + +It is an error if the end of file occurs within a quoted string. + +@example +`dangling quote +^D +@error{}m4:stdin:1: ERROR: end of file in string +@end example @node Changecom @section Changing comment delimiters @@ -2420,7 +2532,7 @@ The default comment delimiters can be ch macro @code{changecom}: @deffn Builtin changecom (@ovar{start}, @ovar{end}) -This sets @var{start} as the new start-comment delimiter and @var{end} as +This sets @var{start} as the new begin-comment delimiter and @var{end} as the new end-comment delimiter. If only one argument is provided, newline becomes the new end-comment delimiter. The comment delimiters can be of any length. Omitting the first argument, or using the empty @@ -2445,7 +2557,7 @@ But: /* this is a comment now */ while t @cindex comments, copied to output 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 -start comment delimiter. +begin-comment delimiter. Calling @code{changecom} without any arguments, or with an empty string for the first argument, disables the commenting mechanism completely. @@ -2465,6 +2577,79 @@ changecom(`#') @result{}# comment again @end example +The comment strings can safely contain eight-bit characters. +@ignore +Yuck. I know of no clean way to render an 8-bit character in both info +and dvi. This example uses the `open-guillemot' and `close-guillemot' +characters of the Latin-1 character set. + +@example +define(`a', `b') +@result{} +«a» +@result{}«b» +changecom(`«', `»') +@result{} +«a» +@result{}«a» +@end example +@end ignore + +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 @var{start} should not begin with a +letter or @samp{_} (underscore), and that neither the start-quote nor +the start-comment string should be a prefix of the other. + +@example +define(`hi', `HI') +@result{} +changecom(`q', `Q') +@result{} +q hi Q hi +@result{}q hi Q HI +@end example + +Comments are recognized in preference to argument collection. In +particular, if @var{start} is a single @samp{(}, then argument +collection is effectively disabled. For portability with other +implementations, it is a good idea to avoid @samp{(}, @samp{,}, and +@samp{)} as the first character in @var{start}. + +@example +define(`echo', `$#:$@:') +@result{} +define(`hi', `HI') +@result{} +changecom(`(',`)') +@result{} +echo(hi) +@result{}0::(hi) +changecom +@result{} +changecom(`((', `))') +@result{} +echo(hi) +@result{}1:HI: +echo((hi)) +@result{}0::((hi)) +changecom(`,', `)') +@result{} +echo(hi,hi)bye) +@result{}1:HI,hi)bye: +@end example + +It is an error if the end of file occurs within a comment. + +@example +changecom(`/*', `*/') +@result{} +/*dangling comment +^D +@error{}m4:stdin:1: ERROR: end of file in comment +@end example + @node Changeword @section Changing the lexical structure of words @@ -2473,7 +2658,7 @@ changecom(`#') @quotation The macro @code{changeword} and all associated functionality is experimental. It is only available if the @option{--enable-changeword} -option was given to @code{configure}, at GNU @code{m4} installation +option was given to @code{configure}, at @acronym{GNU} @code{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. @emph{Do not rely on it}. Please direct your comments @@ -2508,8 +2693,8 @@ Relaxing the lexical rules of @code{m4} you wanted to apply translations to a file of numbers: @example -ifdef(`changeword', `', `m4exit(`77')') -@result{} +ifdef(`changeword', `', `errprint(` skipping: no changeword support +')m4exit(`77')')dnl changeword(`[_a-zA-Z0-9]+') @result{} define(`1', `0')1 @@ -2521,8 +2706,8 @@ make some of the builtins unavailable. accidental call of builtins, for example: @example -ifdef(`changeword', `', `m4exit(`77')') -@result{} +ifdef(`changeword', `', `errprint(` skipping: no changeword support +')m4exit(`77')')dnl define(`_indir', defn(`indir')) @result{} changeword(`_[_a-zA-Z0-9]*') @@ -2544,8 +2729,8 @@ supplied contains any grouped subexpress the first of these is discarded before symbol lookup. So: @example -ifdef(`changeword', `', `m4exit(`77')') -@result{} +ifdef(`changeword', `', `errprint(` skipping: no changeword support +')m4exit(`77')')dnl changecom(`/*', `*/')dnl define(`foo', `bar')dnl changeword(`#\([_a-zA-Z0-9]*\)') @@ -2556,9 +2741,8 @@ changeword(`#\([_a-zA-Z0-9]*\)') @end example @code{m4} now requires a @samp{#} mark at the beginning of every -macro invocation, so one can use @code{m4} to preprocess shell -scripts without getting @code{shift} commands swallowed, and plain -text without losing various common words. +macro invocation, so one can use @code{m4} to preprocess plain +text without losing various words like @samp{divert}. In @code{m4}, macro substitution is based on text, while in @TeX{}, it is based on tokens. @code{changeword} can throw this difference into @@ -2579,8 +2763,8 @@ relief. For example, here is the same i Then, the @code{m4} version: @example -ifdef(`changeword', `', `m4exit(`77')') -@result{} +ifdef(`changeword', `', `errprint(` skipping: no changeword support +')m4exit(`77')')dnl define(`a', `errprint(`Hello')')dnl changeword(`@@\([_a-zA-Z0-9]*\)') @result{} @@ -2622,10 +2806,11 @@ To save input text, use the builtin @cod @deffn Builtin m4wrap (@ovar{string}, @dots{}) Stores @var{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 @var{string}. +reached. As a @acronym{GNU} extension, additional arguments are +concatenated with a space to the @var{string}. The expansion of @code{m4wrap} is void. +The macro @code{m4wrap} is recognized only with parameters. @end deffn @example @@ -2668,6 +2853,30 @@ f(`10') @result{}Answer: 10*9*8*7*6*5*4*3*2*1=3628800 @end example +Invocations of @code{m4wrap} at the same recursion level are +concatenated and rescanned as usual: + +@example +define(`aa', `AA +') +@result{} +m4wrap(`a')m4wrap(`a') +@result{} +^D +@result{}AA +@end example + +@noindent +however, the transition between recursion levels behaves like an end of +file condition between two input files. + +@example +m4wrap(`m4wrap(`)')len(abc') +@result{} +^D +@error{}m4: ERROR: end of file in argument list +@end example + @node File Inclusion @chapter File inclusion @@ -2706,10 +2915,10 @@ parameters. @example include(`none') @result{} -@error{}stdin:1: m4: cannot open `none': No such file or directory +@error{}m4:stdin:1: cannot open `none': No such file or directory include() @result{} -@error{}stdin:2: m4: cannot open `': No such file or directory +@error{}m4:stdin:2: cannot open `': No such file or directory sinclude(`none') @result{} sinclude() @@ -2717,9 +2926,9 @@ sinclude() @end example The rest of this section assumes that @code{m4} is invoked with the -@option{-I} option pointing to the @file{examples} directory shipped as -part of the GNU @code{m4} package. The file @file{examples/@/incl.m4} in -the distribution contains the lines: +@option{-I} option (@pxref{Invoking m4}) pointing to the @file{examples} +directory shipped as part of the @acronym{GNU} @code{m4} package. The +file @file{examples/@/incl.m4} in the distribution contains the lines: @comment ignore @example Include file start @@ -2758,21 +2967,27 @@ This is `bar': >>bar<< This use of @code{include} is not trivial, though, as files can contain quotes, commas, and parentheses, which can interfere with the way the -@code{m4} parser works. +@code{m4} parser works. @acronym{GNU} @code{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. @node Search Path @section Searching for include files @cindex search path for included files @cindex included files, search path for -@cindex GNU extensions -GNU @code{m4} allows included files to be found in other directories +@cindex @acronym{GNU} extensions +@acronym{GNU} @code{m4} allows included files to be found in other directories than the current working directory. If a file is not found in the current working directory, and the file name is not absolute, the file will be looked for in a specified search path. First, the directories specified with the @option{-I} option will -be searched, in the order found on the command line. Second, if the +be searched, in the order found on the command line (@pxref{Invoking +m4}). Second, if the @env{M4PATH} environment variable is set, it is expected to contain a colon-separated list of directories, which will be searched in order. @@ -2789,7 +3004,7 @@ 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 +is limited mainly by the memory used to describe them, because @acronym{GNU} @code{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, @@ -2870,6 +3085,26 @@ divert This is a common programming idiom in @code{m4}. +Note that @code{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 @option{-P} option to rename all +builtins (@pxref{Invoking m4}). Another is to write a wrapper that +requires a parameter to be recognized. + +@example +We decided to divert the stream for irrigation. +@result{}We decided to the stream for irrigation. +define(`divert', `ifelse(`$#', `0', ``$0'', `builtin(`$0', $@@)')') +@result{} +divert(-1) +Ignored text. +divert(0) +@result{} +We decided to divert the stream for irrigation. +@result{}We decided to divert the stream for irrigation. +@end example + @node Undivert @section Undiverting output @@ -2879,7 +3114,7 @@ Diverted text can be undiverted explicit @deffn Builtin undivert (@ovar{number}@dots{}) Undiverts the 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, if @var{number} is not numeric, +numerical order. As a @acronym{GNU} extension, if @var{number} is not numeric, treat it as a file name instead. The expansion of @code{undivert} is void. @@ -2954,10 +3189,11 @@ divert`'undivert`'dnl @result{}three @end example -@cindex GNU extensions +@cindex @acronym{GNU} extensions @cindex file inclusion @cindex inclusion, of files -GNU @code{m4} allows named files to be undiverted. Given a non-numeric +@acronym{GNU} @code{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 @code{include} (@pxref{Include}). To illustrate the difference, the file @@ -3099,17 +3335,25 @@ index(`gnus, gnats, and armadillos', `da @result{}-1 @end example +Omitting @var{substring} evokes a warning, but still produces output. + +@example +index(`abc') +@error{}m4:stdin:1: Warning: too few arguments to builtin `index' +@result{}0 +@end example + @node Regexp @section Searching for regular expressions @cindex regular expressions -@cindex GNU extensions +@cindex @acronym{GNU} extensions Searching for regular expressions is done with the builtin @code{regexp}: @deffn Builtin regexp (@var{string}, @var{regexp}, @ovar{replacement}) Searches for @var{regexp} in @var{string}. The syntax for regular -expressions is the same as in GNU Emacs. +expressions is the same as in @acronym{GNU} Emacs. @ifnothtml @xref{Regexps, , Syntax of Regular Expressions, emacs, The GNU Emacs Manual}. @@ -3117,7 +3361,7 @@ Manual}. @ifhtml See @uref{http://www.gnu.org/@/software/@/emacs/@/manual/@/emacs.html#Regexps, -Syntax of Regular Expressions} in the GNU Emacs Manual. +Syntax of Regular Expressions} in the @acronym{GNU} Emacs Manual. @end ifhtml If @var{replacement} is omitted, @code{regexp} expands to the index of @@ -3154,9 +3398,22 @@ Here are some more examples on the handl regexp(`abc', `\(b\)', `\\\10\a') @result{}\b0a regexp(`abc', `b', `\1\') -@error{}stdin:2: m4: Warning: sub-expression 1 not present -@error{}stdin:2: m4: Warning: trailing \ ignored in replacement +@error{}m4:stdin:2: Warning: sub-expression 1 not present +@error{}m4:stdin:2: Warning: trailing \ ignored in replacement @result{} +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 +@result{}c +@end example + +Omitting @var{regexp} evokes a warning, but still produces output. + +@example +regexp(`abc') +@error{}m4:stdin:1: Warning: too few arguments to builtin `regexp' +@result{}0 @end example @node Substr @@ -3184,6 +3441,17 @@ substr(`gnus, gnats, and armadillos', `6 @result{}gnats @end example +Omitting @var{from} evokes a warning, but still produces output. + +@example +substr(`abc') +@error{}m4:stdin:1: Warning: too few arguments to builtin `substr' +@result{}abc +substr(`abc',) +@error{}m4:stdin:2: empty string treated as 0 in builtin `substr' +@result{}abc +@end example + @node Translit @section Translating characters @@ -3201,8 +3469,8 @@ are deleted from the expansion. If @var characters in @var{string} that are present in @var{chars} are deleted from the expansion. -As a GNU extension, both @var{chars} and @var{replacement} can contain -character-ranges, +As a @acronym{GNU} extension, both @var{chars} and @var{replacement} can +contain character-ranges, e.g., @samp{a-z} (meaning all lowercase letters) or @samp{0-9} (meaning all digits). To include a dash @samp{-} in @var{chars} or @var{replacement}, place it first or last. @@ -3228,19 +3496,27 @@ lowercase to uppercase, and the third `m while converting them to lowercase. The two first cases are by far the most common. +Omitting @var{chars} evokes a warning, but still produces output. + +@example +translit(`abc') +@error{}m4:stdin:1: Warning: too few arguments to builtin `translit' +@result{}abc +@end example + @node Patsubst @section Substituting text by regular expression @cindex regular expressions @cindex pattern substitution @cindex substitution by regular expression -@cindex GNU extensions +@cindex @acronym{GNU} extensions Global substitution in a string is done by @code{patsubst}: @deffn Builtin patsubst (@var{string}, @var{regexp}, @ovar{replacement}) Searches @var{string} for matches of @var{regexp}, and substitutes @var{replacement} for each match. The syntax for regular expressions -is the same as in GNU Emacs (@pxref{Regexp}). +is the same as in @acronym{GNU} Emacs (@pxref{Regexp}). The parts of @var{string} that are not covered by any match of @var{regexp} are copied to the expansion. Whenever a match is found, the @@ -3270,13 +3546,13 @@ patsubst(`GNUs not Unix', `^', `OBS: ') patsubst(`GNUs not Unix', `\<', `OBS: ') @result{}OBS: GNUs OBS: not OBS: Unix patsubst(`GNUs not Unix', `\w*', `(\&)') -@result{}(GNUs)() (not)() (Unix) +@result{}(GNUs)() (not)() (Unix)() patsubst(`GNUs not Unix', `\w+', `(\&)') @result{}(GNUs) (not) (Unix) patsubst(`GNUs not Unix', `[A-Z][a-z]+') @result{}GN not @comment patsubst(`GNUs not Unix', `not', `NOT\') -@error{}stdin:6: m4: Warning: trailing \ ignored in replacement +@error{}m4:stdin:6: Warning: trailing \ ignored in replacement @result{}GNUs NOT Unix @end example @@ -3321,12 +3597,20 @@ patreg(`aba abb 121', `\(.\)\(.\)\1', `\ @result{}bab @end example +Omitting @var{regexp} evokes a warning, but still produces output. + +@example +patsubst(`abc') +@error{}m4:stdin:1: Warning: too few arguments to builtin `patsubst' +@result{}abc +@end example + @node Format @section Formatted output @cindex formatted output @cindex output, formatted -@cindex GNU extensions +@cindex @acronym{GNU} extensions Formatted output can be made with @code{format}: @deffn Builtin format (@var{format-string}, @dots{}) @@ -3373,15 +3657,16 @@ forloop(`i', `1', `10', `format(`%6d squ @end example The builtin @code{format} is modeled after the ANSI C @samp{printf} -function, and supports the normal @samp{%} specifiers: @samp{c}, +function, and supports these @samp{%} specifiers: @samp{c}, @samp{s}, @samp{d}, @samp{o}, @samp{x}, @samp{X}, @samp{u}, @samp{e}, -@samp{E} and @samp{f}; it supports field widths and precisions, and the +@samp{E}, @samp{f}, @samp{F}, @samp{g}, @samp{G}, and @samp{%}; it +supports field widths and precisions, and the modifiers @samp{+}, @samp{-}, @samp{@w{ }}, @samp{0}, @samp{#}, @samp{h} and @samp{l}. For more details on the functioning of @code{printf}, see the C Library Manual. For now, unrecognized specifiers are silently ignored, but it is -anticipated that a future release of GNU @code{m4} will support more +anticipated that a future release of @acronym{GNU} @code{m4} will support more specifiers, and give warnings when problems are encountered. Likewise, escape sequences are not yet recognized. @@ -3423,10 +3708,10 @@ incr(`4') decr(`7') @result{}6 incr() -@error{}stdin:3: m4: empty string treated as 0 in builtin `incr' +@error{}m4:stdin:3: empty string treated as 0 in builtin `incr' @result{}1 decr() -@error{}stdin:4: m4: empty string treated as 0 in builtin `decr' +@error{}m4:stdin:4: empty string treated as 0 in builtin `decr' @result{}-1 @end example @@ -3483,7 +3768,8 @@ All operators, except exponentiation, ar Note that some older @code{m4} implementations use @samp{^} as an alternate operator for exponentiation, although @acronym{POSIX} requires the C behavior of bitwise exclusive-or. On the other hand, the -precedence of @samp{~} and @samp{!} are different in GNU @code{m4} than +precedence of @samp{~} and @samp{!} are different in @acronym{GNU} +@code{m4} than they are in C, matching the precedence in traditional @code{m4} implementations. This behavior is likely to change in a future version to match @acronym{POSIX}, so use parentheses to force the @@ -3524,7 +3810,7 @@ square(square(`5')`+1') define(`foo', `666') @result{} eval(`foo/6') -@error{}stdin:8: m4: bad expression in eval: foo/6 +@error{}m4:stdin:8: bad expression in eval: foo/6 @result{} eval(foo/6) @result{}111 @@ -3536,7 +3822,8 @@ expression). Therefore all macros must passed to @code{eval}. All evaluation is done with 32-bit signed integers, assuming -2's-complement with wrap-around. The shift operators are defined in GNU +2's-complement with wrap-around. The shift operators are defined in +@acronym{GNU} @code{m4} by doing an implicit bit-wise and of the right-hand operand with 0x1f, and sign-extension with right shift. @@ -3617,7 +3904,7 @@ exit value if this is not the case. @cindex platform macros Sometimes it is desirable for an input file to know which -platform @code{m4} is running on. GNU @code{m4} provides several +platform @code{m4} is running on. @acronym{GNU} @code{m4} provides several macros that are predefined to expand to the empty string; checking for their existence will confirm platform details. @@ -3633,9 +3920,9 @@ environment of @code{m4}. If defined, e string. @end deffn -When GNU extensions are in effect (that is, when you did not use the -@option{-G} option), GNU @code{m4} will define the macro @code{__gnu__} to -expand to the empty string. +When @acronym{GNU} extensions are in effect (that is, when you did not use the +@option{-G} option, @pxref{Invoking m4}), @acronym{GNU} @code{m4} will +define the macro @code{__gnu__} to expand to the empty string. @example __gnu__ @@ -3645,16 +3932,17 @@ ifdef(`__gnu__', `Extensions are active' @end example @cindex platform macro -On UNIX systems, GNU @code{m4} will define @code{__unix__} by default, -or @code{unix} when the @option{-G} option is specified. +On UNIX systems, @acronym{GNU} @code{m4} will define @code{__unix__} by +default, or @code{unix} when the @option{-G} option is specified. -On native Windows systems, GNU @code{m4} will define @code{__windows__} -by default, or @code{windows} when the @option{-G} option is specified. +On native Windows systems, @acronym{GNU} @code{m4} will define +@code{__windows__} by default, or @code{windows} when the @option{-G} +option is specified. -On OS/2 systems, GNU @code{m4} will define @code{__os2__} by default, or -@code{os2} when the @option{-G} option is specified. +On OS/2 systems, @acronym{GNU} @code{m4} will define @code{__os2__} by +default, or @code{os2} when the @option{-G} option is specified. -If GNU @code{m4} does not provide a platform macro for your system, +If @acronym{GNU} @code{m4} does not provide a platform macro for your system, please report that as a bug. @example @@ -3704,7 +3992,7 @@ the command, as well as using the newlin @node Esyscmd @section Reading the output of commands -@cindex GNU extensions +@cindex @acronym{GNU} extensions If you want @code{m4} to read the output of a shell command, use @code{esyscmd}: @@ -3785,14 +4073,25 @@ On UNIX platforms, where it is possible is terminated by a signal, rather than a normal exit, the result is the signal number shifted left by eight bits. +@comment This test has difficulties being portable, even on platforms +@comment where syscmd invokes /bin/sh. Kill is not portable with signal +@comment names. According to autoconf, the only portable signal numbers +@comment are 1 (HUP), 2 (INT), 9 (KILL), 13 (PIPE) and 15 (TERM). But +@comment all shells handle SIGINT, and ksh handles HUP (as in, the shell +@comment exits normally rather than letting the signal terminate it). +@comment Also, TERM is flaky, as it can also kill the running m4 on +@comment systems where /bin/sh does not create its own process group. +@comment That leaves KILL and PIPE as the two signals tested. @example dnl This test assumes kill is a shell builtin, and that signals are dnl recognizable. -ifdef(`__unix__', , `m4exit(`77')')dnl -syscmd(`kill -1 $$') +ifdef(`__unix__', , + `errprint(` skipping: syscmd does not have unix semantics +')m4exit(`77')')dnl +syscmd(`kill -13 $$') @result{} sysval -@result{}256 +@result{}3328 esyscmd(`kill -9 $$') @result{} sysval @@ -3835,7 +4134,8 @@ maketemp(`/tmp/fooXXXXXX') @example dnl This test assumes /tmp is a valid directory name, which is not true dnl for native Windows. -ifdef(`__unix__', , `m4exit(`77')')dnl +ifdef(`__unix__', , `errprint(` skipping: not sure /tmp exists +')m4exit(`77')')dnl define(`file1', maketemp(`/tmp/fooXXXXXX'))dnl define(`file2', maketemp(`/tmp/fooXXXXXX'))dnl ifelse(file1, file2, `same', `different') @@ -3855,6 +4155,7 @@ any of the previous chapters. @menu * Errprint:: Printing error messages +* Location:: Printing current location * M4exit:: Exiting from m4 @end menu @@ -3871,6 +4172,7 @@ Prints @var{message} and the rest of the standard error output, separated by spaces. The expansion of @code{errprint} is void. +The macro @code{errprint} is recognized only with parameters. @end deffn @example @@ -3886,22 +4188,66 @@ implementations of @code{m4} do append a @code{errprint} call, while some other implementations only print the first argument. -To make it possible to specify the location of the error, two +@node Location +@section Printing current location + +To make it possible to specify the location of an error, three utility builtins exist: @deffn Builtin __file__ @deffnx Builtin __line__ -Expand to the quoted name of the current input file, and the -current input line number in that file. +@deffnx 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 @code{m4}. @end deffn @example -errprint(`m4:'__file__:__line__: `input error +errprint(__program__:__file__:__line__: `input error ') @error{}m4:stdin:1: input error @result{} @end example +Line numbers start at 1 for each file. If the file was found due to the +@option{-I} option or @env{M4PATH} environment variable, that is +reflected in the file name. The syncline option (@option{-s}, +@pxref{Invoking m4}), and the +@samp{f} and @samp{l} flags of @code{debugmode} (@pxref{Debug Levels}), +also use this notion of current file and line. Redefining the three +location macros has no effect on syncline, debug, or warning message +output. Assume this example is run in the +@file{checks} directory of the @acronym{GNU} M4 package, using +@samp{--include=../examples} in the command line to find the file +@file{incl.m4} mentioned earlier: + +@example +define(`foo', ``$0' called at __file__:__line__') +@result{} +foo +@result{}foo called at stdin:2 +include(`incl.m4') +@result{}Include file start +@result{}foo called at ../examples/incl.m4:2 +@result{}Include file end +@result{} +@end example + +Currently, all text wrapped with @code{m4wrap} (@pxref{M4wrap}) behaves +as though it came from line 0 of the file ``''. It is hoped that a +future release of @code{m4} can overcome this limitation and remember +which file invoked the call to @code{m4wrap}. + +The @code{__program__} macro behaves like @samp{$0} in shell +terminology. If you invoke @code{m4} through an absolute path or a link +with a different spelling, rather than by relying on a @env{PATH} search +for plain @samp{m4}, it will affect how @code{__program__} expands. The +intent is that you can use it to produce error messages with the same +formatting that @code{m4} produces internally. It can also be used +within @code{syscmd} (@pxref{Syscmd}) to pick the same version of +@code{m4} that is currently running, rather than whatever version of +@code{m4} happens to be first in @env{PATH}. + @node M4exit @section Exiting from @code{m4} @@ -3912,8 +4258,9 @@ read, you can use @code{m4exit}: @deffn Builtin m4exit (@dvar{code, 0}) Causes @code{m4} to exit, with exit status @var{code}. If @var{code} is -left out, the exit status is zero. No further input is read, and all -wrapped and diverted text is discarded. +left out, the exit status is zero. If @var{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. @end deffn A common use of this is to abort processing: @@ -3926,7 +4273,7 @@ resulting string to standard error. @example define(`fatal_error', - `errprint(`m4:'__file__:__line__`: fatal error: $* + `errprint(__program__:__file__:__line__`: fatal error: $* ')m4exit(`1')') @result{} fatal_error(`this is a BAD one, buster') @@ -3936,7 +4283,9 @@ 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 -(@pxref{M4wrap}) is not reread. +(@pxref{M4wrap}) is not reread. (This macro has a subtle bug, when +invoked from wrapped text. You should try to see if you can find it and +correct it. @pxref{Answers}) @example m4wrap(`This text is lost to `m4exit'.') @@ -3947,6 +4296,11 @@ divert m4exit @end example +Note that it is still possible for the exit status to be different than +what was requested by @code{m4exit}. If @code{m4} detects some other +error, such as a write error on standard out, the exit status will be +non-zero even if @code{m4exit} requested zero. + @node Frozen files @chapter Fast loading of frozen state @@ -3957,7 +4311,7 @@ which files are listed on each @code{m4} user's input file, or else each input file uses @code{include}. Reading the common base of a big application, over and over again, may -be time consuming. GNU @code{m4} offers some machinery to speed up +be time consuming. @acronym{GNU} @code{m4} offers some machinery to speed up the start of an application using lengthy common bases. @menu @@ -3972,7 +4326,7 @@ the start of an application using length @cindex initialization, frozen states @cindex dumping into frozen file @cindex reloading a frozen file -@cindex GNU extensions +@cindex @acronym{GNU} extensions Suppose a user has a library of @code{m4} initializations in @file{base.m4}, which is then used with multiple input files: @@ -4005,7 +4359,7 @@ m4 -R base.m4f input3.m4 with the varying input. The first call, containing the @option{-F} option, only reads and executes file @file{base.m4}, defining various application macros and computing other initializations. -Once the input file @file{base.m4} has been completely processed, GNU +Once the input file @file{base.m4} has been completely processed, @acronym{GNU} @code{m4} produces on @file{base.m4f} a @dfn{frozen} file, that is, a file which contains a kind of snapshot of the @code{m4} internal state. @@ -4048,8 +4402,8 @@ Also, interactions for some options of @ and not in the next, have not been fully analyzed yet. On the other end, you may be confident that stacks of @code{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. +changed strings for quotes or comments. And future releases of +@acronym{GNU} M4 will improve on the utility of frozen files. When an @code{m4} run is to be frozen, the automatic undiversion which takes place at end of execution is inhibited. Instead, all @@ -4060,13 +4414,18 @@ A frozen file to be reloaded need not re It is looked up the same way as an @code{include} file (@pxref{Search Path}). +If the frozen file was generated with a newer version of @code{m4}, and +contains directives that an older @code{m4} cannot parse, attempting to +load the frozen file with option @option{-R} will cause @code{m4} to +exit with status 63 to indicate version mismatch. + @node Frozen file format @section Frozen file format @cindex frozen file format @cindex file format, frozen file 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 a newer version of GNU @code{m4}. +second machine uses the same or newer version of @acronym{GNU} @code{m4}. It is conventional, but not required, to give a frozen file the suffix of @code{.m4f}. @@ -4082,8 +4441,8 @@ directives are: @table @code @item C @var{len1} , @var{len2} @key{NL} @var{str1} @var{str2} @key{NL} -Uses @var{str1} and @var{str2} as the beginning comment and -end comment strings. If omitted, then @samp{#} and @key{NL} are the +Uses @var{str1} and @var{str2} as the begin-comment and +end-comment strings. If omitted, then @samp{#} and @key{NL} are the comment delimiters. @item D @var{number}, @var{len} @key{NL} @var{str} @key{NL} @@ -4092,7 +4451,7 @@ Selects diversion @var{number}, making i number for a non-existing diversion. To merely specify an active selection, use this command with an empty @var{str}. With 0 as the diversion @var{number}, @var{str} will be issued on standard output -at reload time. GNU @code{m4} will not produce the @samp{D} +at reload time. @acronym{GNU} @code{m4} will not produce the @samp{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 @@ -4111,7 +4470,7 @@ and its order, along with @samp{T}, is i have no access to any builtins. @item Q @var{len1} , @var{len2} @key{NL} @var{str1} @var{str2} @key{NL} -Uses @var{str1} and @var{str2} as the beginning quote and end quote +Uses @var{str1} and @var{str2} as the begin-quote and end-quote strings. If omitted, then @samp{`} and @samp{'} are the quote delimiters. @@ -4140,26 +4499,26 @@ There are also differences in BSD flavor is made to summarize these here. @menu -* Extensions:: Extensions in GNU M4 +* Extensions:: Extensions in @acronym{GNU} M4 * Incompatibilities:: Facilities in System V m4 not in GNU M4 * Other Incompatibilities:: Other incompatibilities @end menu @node Extensions -@section Extensions in GNU @code{m4} +@section Extensions in @acronym{GNU} @code{m4} -@cindex GNU extensions +@cindex @acronym{GNU} extensions This version of @code{m4} contains a few facilities that do not exist in System V @code{m4}. These extra facilities are all suppressed by -using the @option{-G} command line option, unless overridden by other -command line options. +using the @option{-G} command line option (@pxref{Invoking m4}), unless +overridden by other command line options. @itemize @bullet @item In the @code{$}@var{n} notation for macro arguments, @var{n} can contain several digits, while the System V @code{m4} only accepts one digit. -This allows macros in GNU @code{m4} to take any number of arguments, and -not only nine (@pxref{Arguments}). +This allows macros in @acronym{GNU} @code{m4} to take any number of +arguments, and not only nine (@pxref{Arguments}). This means that @code{define(`foo', `$11')} is ambiguous between implementations. To portably choose between grabbing the first @@ -4188,7 +4547,7 @@ Eleventh(`a', `b', `c', `d', `e', `f', ` @item The @code{divert} (@pxref{Divert}) macro can manage more than 9 -diversions. GNU @code{m4} treats all positive numbers as valid +diversions. @acronym{GNU} @code{m4} treats all positive numbers as valid diversions, rather than discarding diversions greater than 9. @item @@ -4222,9 +4581,9 @@ There is indirect access to any builtin Macros can be called indirectly through @code{indir} (@pxref{Indir}). @item -The name of the current input file and the current input line number are -accessible through the builtins @code{__file__} and @code{__line__} -(@pxref{Errprint}). +The name of the program, the current input file, and the current input +line number are accessible through the builtins @code{__program__}, +@code{__file__}, and @code{__line__} (@pxref{Location}). @item The format of the output from @code{dumpdef} and macro tracing can be @@ -4235,28 +4594,28 @@ The destination of trace and debug outpu @code{debugfile} (@pxref{Debug Output}). @end itemize -In addition to the above extensions, GNU @code{m4} implements the +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{-l}, @option{-o} and @option{-t}. @xref{Invoking m4}, for a description of these options. -Also, the debugging and tracing facilities in GNU @code{m4} are much +Also, the debugging and tracing facilities in @acronym{GNU} @code{m4} are much more extensive than in most other versions of @code{m4}. @node Incompatibilities -@section Facilities in System V @code{m4} not in GNU @code{m4} +@section Facilities in System V @code{m4} not in @acronym{GNU} @code{m4} The version of @code{m4} from System V contains a few facilities that -have not been implemented in GNU @code{m4} yet. Additionally, -@acronym{POSIX} requires some behaviors that GNU @code{m4} has not +have not been implemented in @acronym{GNU} @code{m4} yet. Additionally, +@acronym{POSIX} requires some behaviors that @acronym{GNU} @code{m4} has not implemented yet. Relying on these behaviors is non-portable, as a -future release of GNU @code{m4} may change. +future release of @acronym{GNU} @code{m4} may change. @itemize @bullet @item System V @code{m4} supports multiple arguments to @code{defn}, and -@acronym{POSIX} requires it. This is not yet implemented in GNU +@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. @@ -4269,16 +4628,12 @@ implemented for the various builtins tha @code{m4exit} (@pxref{M4exit}) with a non-numeric argument). @item -@acronym{POSIX} requires an application to exit with non-zero status if -it encounters a read error on stdin or write error on stdout, but GNU -@code{m4} still exits with status 0 even if the disk is full. - -@item @acronym{POSIX} requires @code{m4wrap} (@pxref{M4wrap}) to act in FIFO -(first-in, first-out) order, but GNU @code{m4} currently uses LIFO order. -Furthermore, @acronym{POSIX} states that only the first argument to -@code{m4wrap} is saved for later evaluation, bug GNU @code{m4} saves and -processes all arguments, with output separated by spaces. +(first-in, first-out) order, but @acronym{GNU} @code{m4} currently uses +LIFO order. Furthermore, @acronym{POSIX} states that only the first +argument to @code{m4wrap} is saved for later evaluation, bug +@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{examples/@/wrapfifo.m4} from the distribution: @@ -4308,13 +4663,13 @@ m4wrap(`a`'m4wrap(`c @acronym{POSIX} requires that all builtins that require arguments, but are called without arguments, behave as though empty strings had been passed. For example, @code{a`'define`'b} would expand to @code{ab}. -But GNU @code{m4} ignores certain builtins if they have missing +But @acronym{GNU} @code{m4} ignores certain builtins if they have missing arguments, giving @code{adefineb} for the above example. @item Traditional implementations handle @code{define(`f',`1')} (@pxref{Define}) by undefining the entire stack of previous definitions, and if doing -@code{undefine(`f')} first. GNU @code{m4} replaces just the top +@code{undefine(`f')} first. @acronym{GNU} @code{m4} replaces just the top definition on the stack, as if doing @code{popdef(`f')} followed by @code{pushdef(`f',`1')}. @@ -4322,7 +4677,7 @@ definition on the stack, as if doing @co @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. -GNU @code{m4} follows traditional behavior in @code{syscmd}, and +@acronym{GNU} @code{m4} follows traditional behavior in @code{syscmd}, and provides the extension @code{esyscmd} that provides the @acronym{POSIX} semantics. @@ -4331,23 +4686,45 @@ semantics. the trailing @samp{X} characters with the @code{m4} process id, giving the same result on identical input, without creating any files, which leaves the door open for a data race in which other processes can create -a file by the same name. GNU @code{m4} actually creates a temporary +a file by the same name. @acronym{GNU} @code{m4} actually creates a temporary file for each invocation of @code{maketemp}, which means that the output of the macro is different even if the input is identical. @item @acronym{POSIX} requires @code{changequote(@var{arg})} -(@pxref{Changequote}) to use newline as the close quote, but GNU +(@pxref{Changequote}) to use newline as the close quote, but @acronym{GNU} @code{m4} uses @samp{'} as the close quote. Meanwhile, some traditional implementations use @var{arg} as the close quote, making it impossible to nest quotes. For predictable results, never call changequote with just one argument. @item +Some implementations of @code{m4} give macros a higher precedence than +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. + +@item +Traditional implementations allow argument collection, but not string +and comment processing, to span file boundaries. Thus, if @file{a.m4} +contains @samp{len(}, and @file{b.m4} contains @samp{abc)}, +@kbd{m4 a.m4 b.m4} outputs @samp{3} with traditional @code{m4}, but +gives an error message that the end of file was encountered inside a +macro with @acronym{GNU} @code{m4}. On the other hand, traditional +implementations do end of file processing for files included with +@code{include} or @code{sinclude} (@pxref{Include}), while @acronym{GNU} +@code{m4} seamlessly integrates the content of those files. Thus +@code{include(`a.m4')include(`b.m4')} will output @samp{3} instead of +giving an error. + +@item Traditional @code{m4} treats @code{traceon} (@pxref{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 @code{m4} encounters @code{traceon} without +On the other hand, when @acronym{GNU} @code{m4} encounters +@code{traceon} without arguments, it turns tracing on for all existing definitions at the time, but does not trace future definitions; @code{traceoff} without arguments turns tracing off for all definitions regardless of whether they were @@ -4356,28 +4733,27 @@ the command line or @code{traceon(`foo') that is preserved even if the macro is currently undefined. @item -Traditional implementations allow argument collection, but not string -processing, to span file boundaries. Thus, if @file{a.m4} contains -@samp{len(}, and @file{b.m4} contains @samp{abc)}, @kbd{m4 a.m4 b.m4} -outputs @samp{3} with traditional @code{m4}, but gives an error message -that the end of file was encountered inside a macro with GNU @code{m4}. - -@item @acronym{POSIX} requires @code{eval} (@pxref{Eval}) to treat all -operators with the same precedence as C. However, GNU @code{m4} +operators with the same precedence as C. However, @acronym{GNU} @code{m4} currently follows the traditional precedence of other @code{m4} implementations, where bitwise and logical negation (@samp{~} and @samp{!}) have lower precedence than equality operators, rather than equal precedence with other unary operators. Use explicit parentheses -to ensure proper precedence. As extensions to @acronym{POSIX}, GNU +to ensure proper precedence. As extensions to @acronym{POSIX}, @acronym{GNU} @code{m4} treats the shift operators @samp{<<} and @samp{>>} as well-defined on signed integers (even though they are not in C), and adds the exponentiation operator @samp{**}. @item @acronym{POSIX} requires @code{translit} (@pxref{Translit}) to treat -each character of the second and third arguments literally, but GNU +each character of the second and third arguments literally, but @acronym{GNU} @code{m4} treats @samp{-} as a range operator. + +@item +@acronym{POSIX} requires @code{m4} to honor the locale environment +variables of @env{LANG}, @env{LC_ALL}, @env{LC_CTYPE}, +@env{LC_MESSAGES}, and @env{NLSPATH}, but this has not yet been +implemented in @acronym{GNU} @code{m4}. @end itemize @node Other Incompatibilities @@ -4388,16 +4764,16 @@ There are a few other incompatibilities @itemize @bullet @item -GNU @code{m4} implements sync lines differently from System V @code{m4}, -when text is being diverted. GNU @code{m4} outputs the sync lines when -the text is being diverted, and System V @code{m4} when the diverted -text is being brought back. +@acronym{GNU} @code{m4} implements sync lines differently from System V +@code{m4}, when text is being diverted. @acronym{GNU} @code{m4} outputs +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 -@code{undivert} call, whereas GNU @code{m4} regards the diverted text as -being generated at the time it is diverted. +@code{undivert} call, whereas @acronym{GNU} @code{m4} regards the +diverted text as being generated at the time it is diverted. The sync line option is used mostly when using @code{m4} as a front end to a compiler. If a diverted line causes a compiler error, @@ -4405,8 +4781,8 @@ the error messages should most probably diversion were made, and not where it was inserted again. @item -GNU @code{m4} makes no attempt at prohibiting self-referential definitions -like: +@acronym{GNU} @code{m4} makes no attempt at prohibiting self-referential +definitions like: @comment ignore @example @@ -4429,7 +4805,7 @@ ifelse(defn(`@var{holder}'), `@var{value @noindent 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 @code{m4} user to hang himself! Rescanning hangs may be +for the @acronym{GNU} @code{m4} user to hang himself! Rescanning hangs may be avoided through careful programming, a little like for endless loops in traditional programming languages. @end itemize @@ -4440,6 +4816,21 @@ in traditional programming languages. Some of the examples in this manuals are buggy, for demonstration purposes. Correctly working macros are presented here. +The @code{exch} macro (@pxref{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 @code{exch}, as +follows: + +@example +define(`exch', ``$2', `$1'') +@result{} +define(exch(`expansion text', `macro')) +@result{} +macro +@result{}expansion text +@end example + The @code{cleardivert} macro (@pxref{Cleardiv}) 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 @@ -4471,6 +4862,29 @@ undivert @result{} @end example +The @code{fatal_error} macro (@pxref{M4exit}) does not quite match the +format of internal error messages when invoked inside wrapped text, due +to the current limitations of @code{__file__} (@pxref{Location}) when +invoked inside @code{m4wrap}. Since @code{m4} omits the file and line +number from its warning messages when there is no current file (or +equivalently, when the current line is 0, since all files start at line +1), a better implementation would be: + +@example +define(`fatal_error', + `errprint(__program__:ifelse(__line__, `0', `', + `__file__:__line__:')` fatal error: $* +')m4exit(`1')') +@result{} +m4wrap(`divnum(`demo of internal message') +fatal_error(`inside wrapped text')') +@result{} +^D +@error{}m4: Warning: excess arguments to builtin `divnum' ignored +@result{}0 +@error{}m4: fatal error: inside wrapped text +@end example + @c ========================================================== Appendices @node Copying This Manual @@ -4511,6 +4925,7 @@ the first time. @bye @c Local Variables: +@c coding: ISO-8859-1 @c fill-column: 72 @c ispell-local-dictionary: "american" @c indent-tabs-mode: nil diff -ruNp m4-1.4.5/doc/stamp-vti m4-1.4.6/doc/stamp-vti --- m4-1.4.5/doc/stamp-vti 2006-07-15 16:26:21.000000000 -0600 +++ m4-1.4.6/doc/stamp-vti 2006-08-24 12:01:54.000000000 -0600 @@ -1,4 +1,4 @@ -@set UPDATED 15 July 2006 -@set UPDATED-MONTH July 2006 -@set EDITION 1.4.5 -@set VERSION 1.4.5 +@set UPDATED 24 August 2006 +@set UPDATED-MONTH August 2006 +@set EDITION 1.4.6 +@set VERSION 1.4.6 diff -ruNp m4-1.4.5/doc/texinfo.tex m4-1.4.6/doc/texinfo.tex --- m4-1.4.5/doc/texinfo.tex 2006-07-15 16:16:19.000000000 -0600 +++ m4-1.4.6/doc/texinfo.tex 2006-08-24 11:47:50.000000000 -0600 @@ -3,7 +3,7 @@ % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % -\def\texinfoversion{2006-06-19.13} +\def\texinfoversion{2006-07-17.16} % % Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free @@ -327,9 +327,9 @@ \pagebody{#1}% \ifdim\ht\footlinebox > 0pt % Only leave this space if the footline is nonempty. - % (We lessened \vsize for it in \oddfootingxxx.) + % (We lessened \vsize for it in \oddfootingyyy.) % The \baselineskip=24pt in plain's \makefootline has no effect. - \vskip 2\baselineskip + \vskip 24pt \unvbox\footlinebox \fi % @@ -2051,11 +2051,11 @@ where each line of input produces a line % and arrange explicitly to hyphenate at a dash. % -- rms. { - \catcode`\-=\active - \catcode`\_=\active + \catcode`\-=\active \catcode`\_=\active \catcode`\'=\active % \global\def\code{\begingroup - \catcode`\-=\active \catcode`\_=\active + \catcode`\-=\active \catcode`\_=\active \catcode`\'=\active + \let'\singlequotechar \ifallowcodebreaks \let-\codedash \let_\codeunder @@ -2472,8 +2472,8 @@ where each line of input produces a line % % Leave some space for the footline. Hopefully ok to assume % @evenfooting will not be used by itself. - \global\advance\pageheight by -\baselineskip - \global\advance\vsize by -\baselineskip + \global\advance\pageheight by -12pt + \global\advance\vsize by -12pt } \parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}} @@ -5042,7 +5042,7 @@ where each line of input produces a line {\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 \tensf error\kern-1.5pt} +\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. @@ -5265,11 +5265,10 @@ where each line of input produces a line % \maketwodispenvs {lisp}{example}{% \nonfillstart - \tt + \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}{% @@ -5397,6 +5396,22 @@ where each line of input produces a line \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\singlequotechar{% + \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax + '% + \else + \char'15 + \fi +} +% \begingroup \catcode`\^^I=\active \gdef\tabexpand{% @@ -5409,7 +5424,13 @@ where each line of input produces a line \wd0=\dimen0 \box0 \starttabbox }% } + \catcode`\'=\active + \gdef\quoteexpand{% + \catcode`\'=\active + \def'{\singlequotechar} + }% \endgroup +% \def\setupverbatim{% \let\nonarrowing = t% \nonfillstart @@ -5418,6 +5439,7 @@ where each line of input produces a line \def\par{\leavevmode\egroup\box0\endgraf}% \catcode`\`=\active \tabexpand + \quoteexpand % Respect line breaks, % print special symbols as themselves, and % make each space count diff -ruNp m4-1.4.5/doc/version.texi m4-1.4.6/doc/version.texi --- m4-1.4.5/doc/version.texi 2006-07-15 16:26:21.000000000 -0600 +++ m4-1.4.6/doc/version.texi 2006-08-24 12:01:54.000000000 -0600 @@ -1,4 +1,4 @@ -@set UPDATED 15 July 2006 -@set UPDATED-MONTH July 2006 -@set EDITION 1.4.5 -@set VERSION 1.4.5 +@set UPDATED 24 August 2006 +@set UPDATED-MONTH August 2006 +@set EDITION 1.4.6 +@set VERSION 1.4.6 diff -ruNp m4-1.4.5/examples/COPYING m4-1.4.6/examples/COPYING --- m4-1.4.5/examples/COPYING 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/examples/COPYING 2006-08-21 19:55:12.000000000 -0600 @@ -0,0 +1,8 @@ +The files in this directory provide example uses of GNU M4. +The following copyright notice applies to each of these +description files. + +Copyright (C) 2006 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. diff -ruNp m4-1.4.5/examples/Makefile.in m4-1.4.6/examples/Makefile.in --- m4-1.4.5/examples/Makefile.in 2006-07-15 16:24:09.000000000 -0600 +++ m4-1.4.6/examples/Makefile.in 2006-08-24 11:47:42.000000000 -0600 @@ -36,26 +36,29 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = examples -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in COPYING ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/absolute-header.m4 \ - $(top_srcdir)/m4/alloca.m4 $(top_srcdir)/m4/codeset.m4 \ + $(top_srcdir)/m4/alloca.m4 $(top_srcdir)/m4/cloexec.m4 \ + $(top_srcdir)/m4/close-stream.m4 $(top_srcdir)/m4/codeset.m4 \ $(top_srcdir)/m4/eoverflow.m4 $(top_srcdir)/m4/error.m4 \ $(top_srcdir)/m4/exitfail.m4 $(top_srcdir)/m4/extensions.m4 \ + $(top_srcdir)/m4/fpending.m4 $(top_srcdir)/m4/free.m4 \ $(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gnulib-comp.m4 \ $(top_srcdir)/m4/intmax_t.m4 $(top_srcdir)/m4/inttypes_h.m4 \ $(top_srcdir)/m4/longdouble.m4 $(top_srcdir)/m4/longlong.m4 \ $(top_srcdir)/m4/mbchar.m4 $(top_srcdir)/m4/mbiter.m4 \ $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/memchr.m4 \ - $(top_srcdir)/m4/mkstemp.m4 $(top_srcdir)/m4/obstack.m4 \ - $(top_srcdir)/m4/regex.m4 $(top_srcdir)/m4/restrict.m4 \ + $(top_srcdir)/m4/mkstemp.m4 $(top_srcdir)/m4/regex.m4 \ $(top_srcdir)/m4/signed.m4 $(top_srcdir)/m4/size_max.m4 \ $(top_srcdir)/m4/ssize_t.m4 $(top_srcdir)/m4/stat-macros.m4 \ $(top_srcdir)/m4/stdarg.m4 $(top_srcdir)/m4/stdbool.m4 \ - $(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/strcase.m4 \ + $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdint_h.m4 \ + $(top_srcdir)/m4/stdio-safer.m4 \ + $(top_srcdir)/m4/stdlib-safer.m4 $(top_srcdir)/m4/strcase.m4 \ $(top_srcdir)/m4/strtol.m4 $(top_srcdir)/m4/sys_stat_h.m4 \ - $(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/ulonglong.m4 \ - $(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/vasnprintf.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.m4 $(top_srcdir)/m4/wchar_t.m4 \ $(top_srcdir)/m4/wcwidth.m4 $(top_srcdir)/m4/wint_t.m4 \ $(top_srcdir)/m4/xalloc.m4 $(top_srcdir)/m4/xsize.m4 \ @@ -69,6 +72,7 @@ CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ABSOLUTE_STDINT_H = @ABSOLUTE_STDINT_H@ ABSOLUTE_SYS_STAT_H = @ABSOLUTE_SYS_STAT_H@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ @@ -80,6 +84,11 @@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +BITSIZEOF_PTRDIFF_T = @BITSIZEOF_PTRDIFF_T@ +BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@ +BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@ +BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@ +BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ @@ -98,6 +107,16 @@ GETOPT_H = @GETOPT_H@ GL_COND_LIBTOOL_FALSE = @GL_COND_LIBTOOL_FALSE@ GL_COND_LIBTOOL_TRUE = @GL_COND_LIBTOOL_TRUE@ GREP = @GREP@ +HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ +HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ +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_STDINT_H = @HAVE_STDINT_H@ +HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@ +HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@ +HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ +HAVE_WCHAR_H = @HAVE_WCHAR_H@ HAVE__BOOL = @HAVE__BOOL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -116,16 +135,22 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@ +SIZE_T_SUFFIX = @SIZE_T_SUFFIX@ STACKOVF_FALSE = @STACKOVF_FALSE@ STACKOVF_TRUE = @STACKOVF_TRUE@ STDBOOL_H = @STDBOOL_H@ +STDINT_H = @STDINT_H@ STRIP = @STRIP@ SYS_STAT_H = @SYS_STAT_H@ UNISTD_H = @UNISTD_H@ VERSION = @VERSION@ +WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ +WINT_T_SUFFIX = @WINT_T_SUFFIX@ ac_ct_CC = @ac_ct_CC@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ diff -ruNp m4-1.4.5/lib/Makefile.am m4-1.4.6/lib/Makefile.am --- m4-1.4.5/lib/Makefile.am 2006-07-15 16:15:00.000000000 -0600 +++ m4-1.4.6/lib/Makefile.am 2006-08-24 11:36:34.000000000 -0600 @@ -8,7 +8,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --lib=libm4 --source-base=lib --m4-base=m4 --doc-base=doc --aux-dir=. --macro-prefix=M4 alloca binary-io error fdl gendocs getopt mkstemp obstack regex strtol xalloc xvasprintf +# Reproduce by: gnulib-tool --import --dir=. --lib=libm4 --source-base=lib --m4-base=m4 --doc-base=doc --aux-dir=. --no-libtool --macro-prefix=M4 binary-io cloexec close-stream error fdl fopen-safer free gendocs getopt gnupload mkstemp obstack regex stdlib-safer strtol tmpfile-safer unlocked-io verror xalloc xvasprintf AUTOMAKE_OPTIONS = 1.5 gnits no-dependencies @@ -20,7 +20,7 @@ noinst_HEADERS = EXTRA_DIST = BUILT_SOURCES = SUFFIXES = -MOSTLYCLEANFILES = +MOSTLYCLEANFILES = core *.stackdump MOSTLYCLEANDIRS = CLEANFILES = DISTCLEANFILES = @@ -54,12 +54,42 @@ libm4_a_SOURCES += binary-io.h ## end gnulib module binary-io +## begin gnulib module cloexec + +EXTRA_DIST += cloexec.h + +## end gnulib module cloexec + +## begin gnulib module close-stream + +EXTRA_DIST += close-stream.h + +## end gnulib module close-stream + ## begin gnulib module exit libm4_a_SOURCES += exit.h ## end gnulib module exit +## begin gnulib module exitfail + +EXTRA_DIST += exitfail.h + +## end gnulib module exitfail + +## begin gnulib module fopen-safer + +EXTRA_DIST += stdio-safer.h stdio--.h + +## end gnulib module fopen-safer + +## begin gnulib module fpending + +EXTRA_DIST += __fpending.h + +## end gnulib module fpending + ## begin gnulib module getopt BUILT_SOURCES += $(GETOPT_H) @@ -92,12 +122,24 @@ libm4_a_SOURCES += mbuiter.h ## end gnulib module mbuiter +## begin gnulib module regex + +EXTRA_DIST += regcomp.c regex.h regex_internal.c regex_internal.h regexec.c + +## end gnulib module regex + ## begin gnulib module size_max libm4_a_SOURCES += size_max.h ## end gnulib module size_max +## begin gnulib module stat-macros + +EXTRA_DIST += stat-macros.h + +## end gnulib module stat-macros + ## begin gnulib module stdbool BUILT_SOURCES += $(STDBOOL_H) @@ -112,6 +154,47 @@ MOSTLYCLEANFILES += stdbool.h stdbool.h- ## end gnulib module stdbool +## begin gnulib module stdint + +BUILT_SOURCES += $(STDINT_H) +EXTRA_DIST += stdint_.h + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +stdint.h: stdint_.h + sed -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \ + -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \ + -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \ + -e 's|@''ABSOLUTE_STDINT_H''@|$(ABSOLUTE_STDINT_H)|g' \ + -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \ + -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \ + -e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \ + -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \ + -e 's/@''BITSIZEOF_PTRDIFF_T''@/$(BITSIZEOF_PTRDIFF_T)/g' \ + -e 's/@''PTRDIFF_T_SUFFIX''@/$(PTRDIFF_T_SUFFIX)/g' \ + -e 's/@''BITSIZEOF_SIG_ATOMIC_T''@/$(BITSIZEOF_SIG_ATOMIC_T)/g' \ + -e 's/@''HAVE_SIGNED_SIG_ATOMIC_T''@/$(HAVE_SIGNED_SIG_ATOMIC_T)/g' \ + -e 's/@''SIG_ATOMIC_T_SUFFIX''@/$(SIG_ATOMIC_T_SUFFIX)/g' \ + -e 's/@''BITSIZEOF_SIZE_T''@/$(BITSIZEOF_SIZE_T)/g' \ + -e 's/@''SIZE_T_SUFFIX''@/$(SIZE_T_SUFFIX)/g' \ + -e 's/@''BITSIZEOF_WCHAR_T''@/$(BITSIZEOF_WCHAR_T)/g' \ + -e 's/@''HAVE_SIGNED_WCHAR_T''@/$(HAVE_SIGNED_WCHAR_T)/g' \ + -e 's/@''WCHAR_T_SUFFIX''@/$(WCHAR_T_SUFFIX)/g' \ + -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 > $@-t + mv $@-t $@ +MOSTLYCLEANFILES += stdint.h stdint.h-t + +## end gnulib module stdint + +## begin gnulib module stdlib-safer + +EXTRA_DIST += stdlib-safer.h stdlib--.h + +## end gnulib module stdlib-safer + ## begin gnulib module strcase libm4_a_SOURCES += strcase.h @@ -141,6 +224,12 @@ MOSTLYCLEANDIRS += sys ## end gnulib module sys_stat +## begin gnulib module tmpfile-safer + +EXTRA_DIST += stdio-safer.h stdio--.h + +## end gnulib module tmpfile-safer + ## begin gnulib module unistd BUILT_SOURCES += $(UNISTD_H) @@ -153,6 +242,18 @@ MOSTLYCLEANFILES += unistd.h ## end gnulib module unistd +## begin gnulib module unistd-safer + +EXTRA_DIST += unistd-safer.h unistd--.h + +## end gnulib module unistd-safer + +## begin gnulib module unlocked-io + +EXTRA_DIST += unlocked-io.h + +## end gnulib module unlocked-io + ## begin gnulib module vasnprintf libm4_a_SOURCES += printf-args.h printf-parse.h vasnprintf.h @@ -165,12 +266,24 @@ libm4_a_SOURCES += vasprintf.h ## end gnulib module vasprintf +## begin gnulib module verror + +libm4_a_SOURCES += verror.h verror.c + +## end gnulib module verror + ## begin gnulib module wcwidth libm4_a_SOURCES += wcwidth.h ## end gnulib module wcwidth +## begin gnulib module xalloc + +EXTRA_DIST += xalloc.h + +## end gnulib module xalloc + ## begin gnulib module xalloc-die libm4_a_SOURCES += xalloc-die.c @@ -190,7 +303,7 @@ libm4_a_SOURCES += xvasprintf.h xvasprin ## end gnulib module xvasprintf -mostlyclean-local: +mostlyclean-local: mostlyclean-generic @test -z "$(MOSTLYCLEANDIRS)" || \ for dir in $(MOSTLYCLEANDIRS); do \ if test -d $$dir; then \ diff -ruNp m4-1.4.5/lib/Makefile.in m4-1.4.6/lib/Makefile.in --- m4-1.4.5/lib/Makefile.in 2006-07-15 16:24:09.000000000 -0600 +++ m4-1.4.6/lib/Makefile.in 2006-08-24 11:47:44.000000000 -0600 @@ -23,7 +23,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --lib=libm4 --source-base=lib --m4-base=m4 --doc-base=doc --aux-dir=. --macro-prefix=M4 alloca binary-io error fdl gendocs getopt mkstemp obstack regex strtol xalloc xvasprintf +# Reproduce by: gnulib-tool --import --dir=. --lib=libm4 --source-base=lib --m4-base=m4 --doc-base=doc --aux-dir=. --no-libtool --macro-prefix=M4 binary-io cloexec close-stream error fdl fopen-safer free gendocs getopt gnupload mkstemp obstack regex stdlib-safer strtol tmpfile-safer unlocked-io verror xalloc xvasprintf srcdir = @srcdir@ @@ -50,32 +50,35 @@ build_triplet = @build@ host_triplet = @host@ subdir = lib DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in alloca.c asnprintf.c asprintf.c error.c \ - error.h exitfail.c exitfail.h getopt.c getopt1.c malloc.c \ - mbchar.c memchr.c mkstemp.c obstack.c obstack.h printf-args.c \ - printf-parse.c regcomp.c regex.c regex.h regex_internal.c \ - regex_internal.h regexec.c stat-macros.h strcasecmp.c \ - strncasecmp.c strtol.c tempname.c vasnprintf.c vasprintf.c \ - xalloc.h xmalloc.c + $(srcdir)/Makefile.in __fpending.c alloca.c asnprintf.c \ + asprintf.c cloexec.c close-stream.c dup-safer.c error.c \ + error.h exitfail.c fd-safer.c fopen-safer.c free.c getopt.c \ + getopt1.c malloc.c mbchar.c memchr.c mkstemp-safer.c mkstemp.c \ + obstack.c obstack.h pipe-safer.c printf-args.c printf-parse.c \ + regex.c strcasecmp.c strncasecmp.c strtol.c tempname.c \ + tmpfile-safer.c vasnprintf.c vasprintf.c xmalloc.c ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/absolute-header.m4 \ - $(top_srcdir)/m4/alloca.m4 $(top_srcdir)/m4/codeset.m4 \ + $(top_srcdir)/m4/alloca.m4 $(top_srcdir)/m4/cloexec.m4 \ + $(top_srcdir)/m4/close-stream.m4 $(top_srcdir)/m4/codeset.m4 \ $(top_srcdir)/m4/eoverflow.m4 $(top_srcdir)/m4/error.m4 \ $(top_srcdir)/m4/exitfail.m4 $(top_srcdir)/m4/extensions.m4 \ + $(top_srcdir)/m4/fpending.m4 $(top_srcdir)/m4/free.m4 \ $(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gnulib-comp.m4 \ $(top_srcdir)/m4/intmax_t.m4 $(top_srcdir)/m4/inttypes_h.m4 \ $(top_srcdir)/m4/longdouble.m4 $(top_srcdir)/m4/longlong.m4 \ $(top_srcdir)/m4/mbchar.m4 $(top_srcdir)/m4/mbiter.m4 \ $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/memchr.m4 \ - $(top_srcdir)/m4/mkstemp.m4 $(top_srcdir)/m4/obstack.m4 \ - $(top_srcdir)/m4/regex.m4 $(top_srcdir)/m4/restrict.m4 \ + $(top_srcdir)/m4/mkstemp.m4 $(top_srcdir)/m4/regex.m4 \ $(top_srcdir)/m4/signed.m4 $(top_srcdir)/m4/size_max.m4 \ $(top_srcdir)/m4/ssize_t.m4 $(top_srcdir)/m4/stat-macros.m4 \ $(top_srcdir)/m4/stdarg.m4 $(top_srcdir)/m4/stdbool.m4 \ - $(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/strcase.m4 \ + $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdint_h.m4 \ + $(top_srcdir)/m4/stdio-safer.m4 \ + $(top_srcdir)/m4/stdlib-safer.m4 $(top_srcdir)/m4/strcase.m4 \ $(top_srcdir)/m4/strtol.m4 $(top_srcdir)/m4/sys_stat_h.m4 \ - $(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/ulonglong.m4 \ - $(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/vasnprintf.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.m4 $(top_srcdir)/m4/wchar_t.m4 \ $(top_srcdir)/m4/wcwidth.m4 $(top_srcdir)/m4/wint_t.m4 \ $(top_srcdir)/m4/xalloc.m4 $(top_srcdir)/m4/xsize.m4 \ @@ -91,8 +94,8 @@ AR = ar ARFLAGS = cru libm4_a_AR = $(AR) $(ARFLAGS) libm4_a_DEPENDENCIES = @LIBOBJS@ @ALLOCA@ -am_libm4_a_OBJECTS = strnlen1.$(OBJEXT) xalloc-die.$(OBJEXT) \ - xvasprintf.$(OBJEXT) xasprintf.$(OBJEXT) +am_libm4_a_OBJECTS = strnlen1.$(OBJEXT) verror.$(OBJEXT) \ + xalloc-die.$(OBJEXT) xvasprintf.$(OBJEXT) xasprintf.$(OBJEXT) libm4_a_OBJECTS = $(am_libm4_a_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = @@ -107,6 +110,7 @@ HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ABSOLUTE_STDINT_H = @ABSOLUTE_STDINT_H@ ABSOLUTE_SYS_STAT_H = @ABSOLUTE_SYS_STAT_H@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ @@ -118,6 +122,11 @@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +BITSIZEOF_PTRDIFF_T = @BITSIZEOF_PTRDIFF_T@ +BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@ +BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@ +BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@ +BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ @@ -136,6 +145,16 @@ GETOPT_H = @GETOPT_H@ GL_COND_LIBTOOL_FALSE = @GL_COND_LIBTOOL_FALSE@ GL_COND_LIBTOOL_TRUE = @GL_COND_LIBTOOL_TRUE@ GREP = @GREP@ +HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ +HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ +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_STDINT_H = @HAVE_STDINT_H@ +HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@ +HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@ +HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ +HAVE_WCHAR_H = @HAVE_WCHAR_H@ HAVE__BOOL = @HAVE__BOOL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -154,16 +173,22 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@ +SIZE_T_SUFFIX = @SIZE_T_SUFFIX@ STACKOVF_FALSE = @STACKOVF_FALSE@ STACKOVF_TRUE = @STACKOVF_TRUE@ STDBOOL_H = @STDBOOL_H@ +STDINT_H = @STDINT_H@ STRIP = @STRIP@ SYS_STAT_H = @SYS_STAT_H@ UNISTD_H = @UNISTD_H@ VERSION = @VERSION@ +WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ +WINT_T_SUFFIX = @WINT_T_SUFFIX@ ac_ct_CC = @ac_ct_CC@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ @@ -211,16 +236,23 @@ AUTOMAKE_OPTIONS = 1.5 gnits no-dependen noinst_LIBRARIES = libm4.a libm4_a_SOURCES = binary-io.h exit.h gettext.h mbchar.h mbuiter.h \ size_max.h strcase.h strnlen1.h strnlen1.c printf-args.h \ - printf-parse.h vasnprintf.h vasprintf.h wcwidth.h xalloc-die.c \ - xsize.h xvasprintf.h xvasprintf.c xasprintf.c + printf-parse.h vasnprintf.h vasprintf.h verror.h verror.c \ + wcwidth.h xalloc-die.c xsize.h xvasprintf.h xvasprintf.c \ + xasprintf.c libm4_a_LIBADD = @LIBOBJS@ @ALLOCA@ noinst_HEADERS = -EXTRA_DIST = alloca_.h getopt_.h getopt_int.h stdbool_.h stat_.h -BUILT_SOURCES = $(ALLOCA_H) $(GETOPT_H) $(STDBOOL_H) $(SYS_STAT_H) \ - $(UNISTD_H) +EXTRA_DIST = alloca_.h cloexec.h close-stream.h exitfail.h \ + stdio-safer.h stdio--.h __fpending.h getopt_.h getopt_int.h \ + regcomp.c regex.h regex_internal.c regex_internal.h regexec.c \ + stat-macros.h stdbool_.h stdint_.h stdlib-safer.h stdlib--.h \ + stat_.h stdio-safer.h stdio--.h unistd-safer.h unistd--.h \ + unlocked-io.h xalloc.h +BUILT_SOURCES = $(ALLOCA_H) $(GETOPT_H) $(STDBOOL_H) $(STDINT_H) \ + $(SYS_STAT_H) $(UNISTD_H) SUFFIXES = -MOSTLYCLEANFILES = alloca.h alloca.h-t getopt.h getopt.h-t stdbool.h \ - stdbool.h-t sys/stat.h sys/stat.h-t unistd.h +MOSTLYCLEANFILES = core *.stackdump alloca.h alloca.h-t getopt.h \ + getopt.h-t stdbool.h stdbool.h-t stdint.h stdint.h-t \ + sys/stat.h sys/stat.h-t unistd.h MOSTLYCLEANDIRS = sys CLEANFILES = DISTCLEANFILES = @@ -469,6 +501,33 @@ stdbool.h: stdbool_.h sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool_.h > $@-t mv $@-t $@ +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +stdint.h: stdint_.h + sed -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \ + -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \ + -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \ + -e 's|@''ABSOLUTE_STDINT_H''@|$(ABSOLUTE_STDINT_H)|g' \ + -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \ + -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \ + -e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \ + -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \ + -e 's/@''BITSIZEOF_PTRDIFF_T''@/$(BITSIZEOF_PTRDIFF_T)/g' \ + -e 's/@''PTRDIFF_T_SUFFIX''@/$(PTRDIFF_T_SUFFIX)/g' \ + -e 's/@''BITSIZEOF_SIG_ATOMIC_T''@/$(BITSIZEOF_SIG_ATOMIC_T)/g' \ + -e 's/@''HAVE_SIGNED_SIG_ATOMIC_T''@/$(HAVE_SIGNED_SIG_ATOMIC_T)/g' \ + -e 's/@''SIG_ATOMIC_T_SUFFIX''@/$(SIG_ATOMIC_T_SUFFIX)/g' \ + -e 's/@''BITSIZEOF_SIZE_T''@/$(BITSIZEOF_SIZE_T)/g' \ + -e 's/@''SIZE_T_SUFFIX''@/$(SIZE_T_SUFFIX)/g' \ + -e 's/@''BITSIZEOF_WCHAR_T''@/$(BITSIZEOF_WCHAR_T)/g' \ + -e 's/@''HAVE_SIGNED_WCHAR_T''@/$(HAVE_SIGNED_WCHAR_T)/g' \ + -e 's/@''WCHAR_T_SUFFIX''@/$(WCHAR_T_SUFFIX)/g' \ + -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 > $@-t + mv $@-t $@ + # We need the following in order to create when the system # has one that is incomplete. sys/stat.h: stat_.h @@ -482,7 +541,7 @@ sys/stat.h: stat_.h unistd.h: echo '/* Empty placeholder for $@. */' >$@ -mostlyclean-local: +mostlyclean-local: mostlyclean-generic @test -z "$(MOSTLYCLEANDIRS)" || \ for dir in $(MOSTLYCLEANDIRS); do \ if test -d $$dir; then \ diff -ruNp m4-1.4.5/lib/__fpending.c m4-1.4.6/lib/__fpending.c --- m4-1.4.5/lib/__fpending.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/lib/__fpending.c 2006-08-24 11:36:00.000000000 -0600 @@ -0,0 +1,32 @@ +/* __fpending.c -- return the number of pending output bytes on a stream + Copyright (C) 2000, 2004 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. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#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.5/lib/__fpending.h m4-1.4.6/lib/__fpending.h --- m4-1.4.5/lib/__fpending.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/lib/__fpending.h 2006-08-24 11:36:00.000000000 -0600 @@ -0,0 +1,33 @@ +/* Declare __fpending. + + Copyright (C) 2000, 2003, 2005 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 +#include + +#if HAVE_STDIO_EXT_H +# include +#endif + +#ifndef HAVE_DECL___FPENDING +"this configure-time declaration test was not run" +#endif +#if !HAVE_DECL___FPENDING +size_t __fpending (FILE *); +#endif diff -ruNp m4-1.4.5/lib/cloexec.c m4-1.4.6/lib/cloexec.c --- m4-1.4.5/lib/cloexec.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/lib/cloexec.c 2006-08-24 11:36:01.000000000 -0600 @@ -0,0 +1,60 @@ +/* closexec.c - set or clear the close-on-exec descriptor flag + Copyright (C) 1991, 2004, 2005 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. + + The code is taken from glibc/manual/llio.texi */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "cloexec.h" + +#include +#include + +#ifndef FD_CLOEXEC +# define FD_CLOEXEC 1 +#endif + +/* Set the `FD_CLOEXEC' flag of DESC if VALUE is true, + or clear the flag if VALUE is false. + Return 0 on success, or -1 on error with `errno' set. */ + +int +set_cloexec_flag (int desc, bool value) +{ +#if defined F_GETFD && defined F_SETFD + + int flags = fcntl (desc, F_GETFD, 0); + + if (0 <= flags) + { + int newflags = (value ? flags | FD_CLOEXEC : flags & ~FD_CLOEXEC); + + if (flags == newflags + || fcntl (desc, F_SETFD, newflags) != -1) + return 0; + } + + return -1; + +#else + + return 0; + +#endif +} diff -ruNp m4-1.4.5/lib/cloexec.h m4-1.4.6/lib/cloexec.h --- m4-1.4.5/lib/cloexec.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/lib/cloexec.h 2006-08-24 11:36:01.000000000 -0600 @@ -0,0 +1,2 @@ +#include +int set_cloexec_flag (int desc, bool value); diff -ruNp m4-1.4.5/lib/close-stream.c m4-1.4.6/lib/close-stream.c --- m4-1.4.5/lib/close-stream.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/lib/close-stream.c 2006-08-24 11:36:01.000000000 -0600 @@ -0,0 +1,78 @@ +/* Close a stream, with nicer error checking than fclose's. + + 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 + 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. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "close-stream.h" + +#include +#include + +#include "__fpending.h" + +#if USE_UNLOCKED_IO +# include "unlocked-io.h" +#endif + +/* Close STREAM. Return 0 if successful, EOF (setting errno) + otherwise. A failure might set errno to 0 if the error number + cannot be determined. + + If a program writes *anything* to STREAM, that program should close + STREAM and make sure that it succeeds before exiting. Otherwise, + suppose that you go to the extreme of checking the return status + of every function that does an explicit write to STREAM. The last + printf can succeed in writing to the internal stream buffer, and yet + the fclose(STREAM) could still fail (due e.g., to a disk full error) + when it tries to write out that buffered data. Thus, you would be + left with an incomplete output file and the offending program would + exit successfully. Even calling fflush is not always sufficient, + since some file systems (NFS and CODA) buffer written/flushed data + until an actual close call. + + Besides, it's wasteful to check the return value from every call + that writes to STREAM -- just let the internal stream state record + the failure. That's what the ferror test is checking below. */ + +int +close_stream (FILE *stream) +{ + bool some_pending = (__fpending (stream) != 0); + bool prev_fail = (ferror (stream) != 0); + bool fclose_fail = (fclose (stream) != 0); + + /* Return an error indication if there was a previous failure or if + fclose failed, with one exception: ignore an fclose failure if + there was no previous error, no data remains to be flushed, and + fclose failed with EBADF. That can happen when a program like cp + is invoked like this `cp a b >&-' (i.e., with standard output + closed) and doesn't generate any output (hence no previous error + and nothing to be flushed). */ + + if (prev_fail || (fclose_fail && (some_pending || errno != EBADF))) + { + if (! fclose_fail) + errno = 0; + return EOF; + } + + return 0; +} diff -ruNp m4-1.4.5/lib/close-stream.h m4-1.4.6/lib/close-stream.h --- m4-1.4.5/lib/close-stream.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/lib/close-stream.h 2006-08-24 11:36:02.000000000 -0600 @@ -0,0 +1,2 @@ +#include +int close_stream (FILE *stream); diff -ruNp m4-1.4.5/lib/dup-safer.c m4-1.4.6/lib/dup-safer.c --- m4-1.4.5/lib/dup-safer.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/lib/dup-safer.c 2006-08-24 11:36:02.000000000 -0600 @@ -0,0 +1,46 @@ +/* Invoke dup, but avoid some glitches. + Copyright (C) 2001, 2004, 2005 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. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "unistd-safer.h" + +#include + +#include +#ifndef STDERR_FILENO +# define STDERR_FILENO 2 +#endif + +/* Like dup, but do not return STDIN_FILENO, STDOUT_FILENO, or + STDERR_FILENO. */ + +int +dup_safer (int fd) +{ +#ifdef F_DUPFD + return fcntl (fd, F_DUPFD, STDERR_FILENO + 1); +#else + /* fd_safer calls us back, but eventually the recursion unwinds and + does the right thing. */ + return fd_safer (dup (fd)); +#endif +} diff -ruNp m4-1.4.5/lib/error.c m4-1.4.6/lib/error.c --- m4-1.4.5/lib/error.c 2006-07-15 16:14:31.000000000 -0600 +++ m4-1.4.6/lib/error.c 2006-08-24 11:36:02.000000000 -0600 @@ -1,5 +1,5 @@ /* Error handler for noninteractive utilities - Copyright (C) 1990-1998, 2000-2003, 2004 Free Software Foundation, Inc. + Copyright (C) 1990-1998, 2000-2005, 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 @@ -34,6 +34,9 @@ #endif #ifdef _LIBC +# include +# include +# include # include # define mbsrtowcs __mbsrtowcs #endif @@ -59,6 +62,7 @@ unsigned int error_message_count; # define program_name program_invocation_name # include +# include # include /* In GNU libc we want do not want to use the common name `error' directly. @@ -122,14 +126,10 @@ print_errno_message (int errnum) #endif #if _LIBC - if (_IO_fwide (stderr, 0) > 0) - { - __fwprintf (stderr, L": %s", s); - return; - } -#endif - + __fxprintf (NULL, ": %s", s); +#else fprintf (stderr, ": %s", s); +#endif } static void @@ -140,26 +140,65 @@ error_tail (int status, int errnum, cons { # define ALLOCA_LIMIT 2000 size_t len = strlen (message) + 1; - const wchar_t *wmessage = L"out of memory"; - wchar_t *wbuf = (len < ALLOCA_LIMIT - ? alloca (len * sizeof *wbuf) - : len <= SIZE_MAX / sizeof *wbuf - ? malloc (len * sizeof *wbuf) - : NULL); + wchar_t *wmessage = NULL; + mbstate_t st; + size_t res; + const char *tmp; + bool use_malloc = false; - if (wbuf) + while (1) { - size_t res; - mbstate_t st; - const char *tmp = message; + if (__libc_use_alloca (len * sizeof (wchar_t))) + wmessage = (wchar_t *) alloca (len * sizeof (wchar_t)); + else + { + if (!use_malloc) + wmessage = NULL; + + wchar_t *p = (wchar_t *) realloc (wmessage, + len * sizeof (wchar_t)); + if (p == NULL) + { + free (wmessage); + fputws_unlocked (L"out of memory\n", stderr); + return; + } + wmessage = p; + use_malloc = true; + } + memset (&st, '\0', sizeof (st)); - res = mbsrtowcs (wbuf, &tmp, len, &st); - wmessage = res == (size_t) -1 ? L"???" : wbuf; + tmp = message; + + res = mbsrtowcs (wmessage, &tmp, len, &st); + if (res != len) + break; + + if (__builtin_expect (len >= SIZE_MAX / 2, 0)) + { + /* This really should not happen if everything is fine. */ + res = (size_t) -1; + break; + } + + len *= 2; + } + + if (res == (size_t) -1) + { + /* The string cannot be converted. */ + if (use_malloc) + { + free (wmessage); + use_malloc = false; + } + wmessage = (wchar_t *) L"???"; } __vfwprintf (stderr, wmessage, args); - if (! (len < ALLOCA_LIMIT)) - free (wbuf); + + if (use_malloc) + free (wmessage); } else #endif @@ -170,11 +209,10 @@ error_tail (int status, int errnum, cons if (errnum) print_errno_message (errnum); #if _LIBC - if (_IO_fwide (stderr, 0) > 0) - putwc (L'\n', stderr); - else + __fxprintf (NULL, "\n"); +#else + putc ('\n', stderr); #endif - putc ('\n', stderr); fflush (stderr); if (status) exit (status); @@ -207,11 +245,10 @@ error (int status, int errnum, const cha else { #if _LIBC - if (_IO_fwide (stderr, 0) > 0) - __fwprintf (stderr, L"%s: ", program_name); - else + __fxprintf (NULL, "%s: ", program_name); +#else + fprintf (stderr, "%s: ", program_name); #endif - fprintf (stderr, "%s: ", program_name); } va_start (args, message); @@ -267,22 +304,19 @@ error_at_line (int status, int errnum, c else { #if _LIBC - if (_IO_fwide (stderr, 0) > 0) - __fwprintf (stderr, L"%s: ", program_name); - else + __fxprintf (NULL, "%s:", program_name); +#else + fprintf (stderr, "%s:", program_name); #endif - fprintf (stderr, "%s:", program_name); } - if (file_name != NULL) - { #if _LIBC - if (_IO_fwide (stderr, 0) > 0) - __fwprintf (stderr, L"%s:%d: ", file_name, line_number); - else + __fxprintf (NULL, file_name != NULL ? "%s:%d: " : " ", + file_name, line_number); +#else + fprintf (stderr, file_name != NULL ? "%s:%d: " : " ", + file_name, line_number); #endif - fprintf (stderr, "%s:%d: ", file_name, line_number); - } va_start (args, message); error_tail (status, errnum, message, args); diff -ruNp m4-1.4.5/lib/error.h m4-1.4.6/lib/error.h --- m4-1.4.5/lib/error.h 2006-07-15 16:14:32.000000000 -0600 +++ m4-1.4.6/lib/error.h 2006-08-24 11:36:02.000000000 -0600 @@ -1,5 +1,5 @@ /* Declaration for error-reporting function - Copyright (C) 1995, 1996, 1997, 2003 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 1997, 2003, 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 @@ -21,7 +21,7 @@ #ifndef __attribute__ /* This feature is available in gcc versions 2.5 and later. */ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__ # define __attribute__(Spec) /* empty */ # endif /* The __-protected variants of `format' and `printf' attributes diff -ruNp m4-1.4.5/lib/exitfail.c m4-1.4.6/lib/exitfail.c --- m4-1.4.5/lib/exitfail.c 2006-07-15 16:14:32.000000000 -0600 +++ m4-1.4.6/lib/exitfail.c 2006-08-24 11:36:03.000000000 -0600 @@ -1,6 +1,6 @@ /* Failure exit status - Copyright (C) 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2005 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 diff -ruNp m4-1.4.5/lib/fd-safer.c m4-1.4.6/lib/fd-safer.c --- m4-1.4.5/lib/fd-safer.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/lib/fd-safer.c 2006-08-24 11:36:03.000000000 -0600 @@ -0,0 +1,59 @@ +/* Return a safer copy of a file descriptor. + + Copyright (C) 2005 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. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "unistd-safer.h" + +#include + +#include +#ifndef STDIN_FILENO +# define STDIN_FILENO 0 +#endif +#ifndef STDERR_FILENO +# define STDERR_FILENO 2 +#endif + +/* Return FD, unless FD would be a copy of standard input, output, or + error; in that case, return a duplicate of FD, closing FD. On + failure to duplicate, close FD, set errno, and return -1. Preserve + errno if FD is negative, so that the caller can always inspect + errno when the returned value is negative. + + This function is usefully wrapped around functions that return file + descriptors, e.g., fd_safer (open ("file", O_RDONLY)). */ + +int +fd_safer (int fd) +{ + if (STDIN_FILENO <= fd && fd <= STDERR_FILENO) + { + int f = dup_safer (fd); + int e = errno; + close (fd); + errno = e; + fd = f; + } + + return fd; +} diff -ruNp m4-1.4.5/lib/fopen-safer.c m4-1.4.6/lib/fopen-safer.c --- m4-1.4.5/lib/fopen-safer.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/lib/fopen-safer.c 2006-08-24 11:36:03.000000000 -0600 @@ -0,0 +1,69 @@ +/* Invoke fopen, but avoid some glitches. + Copyright (C) 2001, 2004, 2005 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. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "stdio-safer.h" + +#include +#include +#include "unistd-safer.h" + +#ifndef STDERR_FILENO +# define STDERR_FILENO 2 +#endif + +/* Like fopen, but do not return stdin, stdout, or stderr. */ + +FILE * +fopen_safer (char const *file, char const *mode) +{ + FILE *fp = fopen (file, mode); + + if (fp) + { + int fd = fileno (fp); + + if (0 <= fd && fd <= STDERR_FILENO) + { + int f = dup_safer (fd); + + if (f < 0) + { + int e = errno; + fclose (fp); + errno = e; + return NULL; + } + + if (fclose (fp) != 0 + || ! (fp = fdopen (f, mode))) + { + int e = errno; + close (f); + errno = e; + return NULL; + } + } + } + + return fp; +} diff -ruNp m4-1.4.5/lib/free.c m4-1.4.6/lib/free.c --- m4-1.4.5/lib/free.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/lib/free.c 2006-08-24 11:36:03.000000000 -0600 @@ -0,0 +1,33 @@ +/* Work around incompatibility on older systems where free (NULL) fails. + + Copyright (C) 2003 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 */ + +#ifdef HAVE_CONFIG_H +# include +#endif +#undef free + +#include + +void +rpl_free (void *p) +{ + if (p) + free (p); +} diff -ruNp m4-1.4.5/lib/gettext.h m4-1.4.6/lib/gettext.h --- m4-1.4.5/lib/gettext.h 2006-07-15 16:14:33.000000000 -0600 +++ m4-1.4.6/lib/gettext.h 2006-08-24 11:36:04.000000000 -0600 @@ -1,5 +1,5 @@ /* Convenience header for conditional use of GNU . - Copyright (C) 1995-1998, 2000-2002, 2004 Free Software Foundation, Inc. + Copyright (C) 1995-1998, 2000-2002, 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 @@ -75,4 +75,168 @@ initializer for static 'char[]' or 'const char[]' variables. */ #define gettext_noop(String) String +/* The separator between msgctxt and msgid in a .mo file. */ +#define GETTEXT_CONTEXT_GLUE "\004" + +/* Pseudo function calls, taking a MSGCTXT and a MSGID instead of just a + MSGID. MSGCTXT and MSGID must be string literals. MSGCTXT should be + short and rarely need to change. + The letter 'p' stands for 'particular' or 'special'. */ +#define pgettext(Msgctxt, Msgid) \ + pgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) +#define dpgettext(Domainname, Msgctxt, Msgid) \ + pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) +#define dcpgettext(Domainname, Msgctxt, Msgid, Category) \ + pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, Category) +#define npgettext(Msgctxt, Msgid, MsgidPlural, N) \ + npgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES) +#define dnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N) \ + npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES) +#define dcnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N, Category) \ + npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, Category) + +#ifdef __GNUC__ +__inline +#else +#ifdef __cplusplus +inline +#endif +#endif +static const char * +pgettext_aux (const char *domain, + const char *msg_ctxt_id, const char *msgid, + int category) +{ + const char *translation = dcgettext (domain, msg_ctxt_id, category); + if (translation == msg_ctxt_id) + return msgid; + else + return translation; +} + +#ifdef __GNUC__ +__inline +#else +#ifdef __cplusplus +inline +#endif +#endif +static const char * +npgettext_aux (const char *domain, + const char *msg_ctxt_id, const char *msgid, + const char *msgid_plural, unsigned long int n, + int category) +{ + const char *translation = + dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); + if (translation == msg_ctxt_id || translation == msgid_plural) + return (n == 1 ? msgid : msgid_plural); + else + return translation; +} + +/* The same thing extended for non-constant arguments. Here MSGCTXT and MSGID + can be arbitrary expressions. But for string literals these macros are + less efficient than those above. */ + +#include + +#define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS \ + (__GNUC__ >= 3 || defined __cplusplus) + +#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS +#include +#endif + +#define pgettext_expr(Msgctxt, Msgid) \ + dcpgettext_expr (NULL, Msgctxt, Msgid, LC_MESSAGES) +#define dpgettext_expr(Domainname, Msgctxt, Msgid) \ + dcpgettext_expr (Domainname, Msgctxt, Msgid, LC_MESSAGES) + +#ifdef __GNUC__ +__inline +#else +#ifdef __cplusplus +inline +#endif +#endif +static const char * +dcpgettext_expr (const char *domain, + const char *msgctxt, const char *msgid, + int category) +{ + size_t msgctxt_len = strlen (msgctxt) + 1; + size_t msgid_len = strlen (msgid) + 1; + const char *translation; +#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS + char msg_ctxt_id[msgctxt_len + msgid_len]; +#else + char buf[1024]; + char *msg_ctxt_id = + (msgctxt_len + msgid_len <= sizeof (buf) + ? buf + : (char *) malloc (msgctxt_len + msgid_len)); + if (msg_ctxt_id != NULL) +#endif + { + memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); + msg_ctxt_id[msgctxt_len - 1] = '\004'; + memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); + translation = dcgettext (domain, msg_ctxt_id, category); +#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS + if (msg_ctxt_id != buf) + free (msg_ctxt_id); +#endif + if (translation != msg_ctxt_id) + return translation; + } + return msgid; +} + +#define npgettext_expr(Msgctxt, Msgid, MsgidPlural, N) \ + dcnpgettext_expr (NULL, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES) +#define dnpgettext_expr(Domainname, Msgctxt, Msgid, MsgidPlural, N) \ + dcnpgettext_expr (Domainname, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES) + +#ifdef __GNUC__ +__inline +#else +#ifdef __cplusplus +inline +#endif +#endif +static const char * +dcnpgettext_expr (const char *domain, + const char *msgctxt, const char *msgid, + const char *msgid_plural, unsigned long int n, + int category) +{ + size_t msgctxt_len = strlen (msgctxt) + 1; + size_t msgid_len = strlen (msgid) + 1; + const char *translation; +#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS + char msg_ctxt_id[msgctxt_len + msgid_len]; +#else + char buf[1024]; + char *msg_ctxt_id = + (msgctxt_len + msgid_len <= sizeof (buf) + ? buf + : (char *) malloc (msgctxt_len + msgid_len)); + if (msg_ctxt_id != NULL) +#endif + { + memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); + msg_ctxt_id[msgctxt_len - 1] = '\004'; + memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); + translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); +#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS + if (msg_ctxt_id != buf) + free (msg_ctxt_id); +#endif + if (!(translation == msg_ctxt_id || translation == msgid_plural)) + return translation; + } + return (n == 1 ? msgid : msgid_plural); +} + #endif /* _LIBGETTEXT_H */ diff -ruNp m4-1.4.5/lib/mbchar.h m4-1.4.6/lib/mbchar.h --- m4-1.4.5/lib/mbchar.h 2006-07-15 16:14:34.000000000 -0600 +++ m4-1.4.6/lib/mbchar.h 2006-08-24 11:36:05.000000000 -0600 @@ -156,7 +156,131 @@ #include #include -#include +/* BeOS 5 has the functions but no . */ +#if HAVE_WCTYPE_H +# include +#endif +/* FreeBSD 4.4 to 4.11 has but lacks the functions. + Assume all 12 functions are implemented the same way, or not at all. */ +#if !defined iswalnum && !HAVE_ISWCNTRL +static inline int +iswalnum (wint_t wc) +{ + return (wc >= 0 && wc < 128 + ? (wc >= '0' && wc <= '9') || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z') + : 0); +} +# define iswalnum iswalnum +#endif +#if !defined iswalpha && !HAVE_ISWCNTRL +static inline int +iswalpha (wint_t wc) +{ + return (wc >= 0 && wc < 128 + ? (wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z' + : 0); +} +# define iswalpha iswalpha +#endif +#if !defined iswblank && !HAVE_ISWCNTRL +static inline int +iswblank (wint_t wc) +{ + return (wc >= 0 && wc < 128 + ? wc == ' ' || wc == '\t' + : 0); +} +# define iswblank iswblank +#endif +#if !defined iswcntrl && !HAVE_ISWCNTRL +static inline int +iswcntrl (wint_t wc) +{ + return (wc >= 0 && wc < 128 + ? (wc & ~0x1f) == 0 || wc == 0x7f + : 0); +} +# define iswcntrl iswcntrl +#endif +#if !defined iswdigit && !HAVE_ISWCNTRL +static inline int +iswdigit (wint_t wc) +{ + return (wc >= '0' && wc <= '9'); +} +# define iswdigit iswdigit +#endif +#if !defined iswgraph && !HAVE_ISWCNTRL +static inline int +iswgraph (wint_t wc) +{ + return (wc >= 0 && wc < 128 + ? wc >= '!' && wc <= '~' + : 1); +} +# define iswgraph iswgraph +#endif +#if !defined iswlower && !HAVE_ISWCNTRL +static inline int +iswlower (wint_t wc) +{ + return (wc >= 0 && wc < 128 + ? wc >= 'a' && wc <= 'z' + : 0); +} +# define iswlower iswlower +#endif +#if !defined iswprint && !HAVE_ISWCNTRL +static inline int +iswprint (wint_t wc) +{ + return (wc >= 0 && wc < 128 + ? wc >= ' ' && wc <= '~' + : 1); +} +# define iswprint iswprint +#endif +#if !defined iswpunct && !HAVE_ISWCNTRL +static inline int +iswpunct (wint_t wc) +{ + return (wc >= 0 && wc < 128 + ? wc >= '!' && wc <= '~' + && !((wc >= '0' && wc <= '9') + || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z')) + : 1); +} +# define iswpunct iswpunct +#endif +#if !defined iswspace && !HAVE_ISWCNTRL +static inline int +iswspace (wint_t wc) +{ + return (wc >= 0 && wc < 128 + ? wc == ' ' || wc == '\t' + || wc == '\n' || wc == '\v' || wc == '\f' || wc == '\r' + : 0); +} +# define iswspace iswspace +#endif +#if !defined iswupper && !HAVE_ISWCNTRL +static inline int +iswupper (wint_t wc) +{ + return (wc >= 0 && wc < 128 + ? wc >= 'A' && wc <= 'Z' + : 0); +} +# define iswupper iswupper +#endif +#if !defined iswxdigit && !HAVE_ISWCNTRL +static inline int +iswxdigit (wint_t wc) +{ + return (wc >= '0' && wc <= '9') || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F'); +} +# define iswxdigit iswxdigit +#endif #include "wcwidth.h" diff -ruNp m4-1.4.5/lib/mkstemp-safer.c m4-1.4.6/lib/mkstemp-safer.c --- m4-1.4.5/lib/mkstemp-safer.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/lib/mkstemp-safer.c 2006-08-24 11:36:05.000000000 -0600 @@ -0,0 +1,41 @@ +/* Invoke mkstemp, but avoid some glitches. + + 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. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "stdlib-safer.h" + +#include +#include "unistd-safer.h" + +#if ! HAVE_MKSTEMP +int mkstemp (char *); +#endif + +/* Like mkstemp, but do not return STDIN_FILENO, STDOUT_FILENO, or + STDERR_FILENO. */ + +int +mkstemp_safer (char *template) +{ + return fd_safer (mkstemp (template)); +} diff -ruNp m4-1.4.5/lib/obstack.c m4-1.4.6/lib/obstack.c --- m4-1.4.5/lib/obstack.c 2006-07-15 16:14:34.000000000 -0600 +++ m4-1.4.6/lib/obstack.c 2006-08-24 11:36:06.000000000 -0600 @@ -1,8 +1,8 @@ /* obstack.c - subroutines used implicitly by object stack macros Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1996, 1997, - 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, - Inc. + 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 it under the terms of the GNU General Public License as published by @@ -55,13 +55,7 @@ #ifndef ELIDE_CODE - -# if HAVE_INTTYPES_H -# include -# endif -# if HAVE_STDINT_H || defined _LIBC -# include -# endif +# include /* Determine default alignment. */ union fooround diff -ruNp m4-1.4.5/lib/pipe-safer.c m4-1.4.6/lib/pipe-safer.c --- m4-1.4.5/lib/pipe-safer.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/lib/pipe-safer.c 2006-08-24 11:36:06.000000000 -0600 @@ -0,0 +1,59 @@ +/* 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 + 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. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "unistd-safer.h" + +#include +#include + +/* Like pipe, but ensure that neither of the file descriptors is + STDIN_FILENO, STDOUT_FILENO, or STDERR_FILENO. Fail with ENOSYS on + platforms that lack pipe. */ + +int +pipe_safer (int fd[2]) +{ +#if HAVE_PIPE + if (pipe (fd) == 0) + { + int i; + for (i = 0; i < 2; i++) + { + fd[i] = fd_safer (fd[i]); + if (fd[i] < 0) + { + int e = errno; + close (fd[1 - i]); + errno = e; + return -1; + } + } + + return 0; + } +#else + errno = ENOSYS; +#endif + + return -1; +} diff -ruNp m4-1.4.5/lib/printf-args.c m4-1.4.6/lib/printf-args.c --- m4-1.4.5/lib/printf-args.c 2006-07-15 16:14:35.000000000 -0600 +++ m4-1.4.6/lib/printf-args.c 2006-08-24 11:36:06.000000000 -0600 @@ -1,5 +1,5 @@ /* Decomposed printf argument list. - Copyright (C) 1999, 2002-2003, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002-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 @@ -79,7 +79,13 @@ printf_fetchargs (va_list args, argument break; #ifdef HAVE_WINT_T case TYPE_WIDE_CHAR: - ap->a.a_wide_char = va_arg (args, wint_t); + /* Although ISO C 99 7.24.1.(2) says that wint_t is "unchanged by + default argument promotions", this is not the case in mingw32, + where wint_t is 'unsigned short'. */ + ap->a.a_wide_char = + (sizeof (wint_t) < sizeof (int) + ? va_arg (args, int) + : va_arg (args, wint_t)); break; #endif case TYPE_STRING: diff -ruNp m4-1.4.5/lib/regex.h m4-1.4.6/lib/regex.h --- m4-1.4.5/lib/regex.h 2006-07-15 16:14:36.000000000 -0600 +++ m4-1.4.6/lib/regex.h 2006-08-24 11:36:08.000000000 -0600 @@ -37,12 +37,6 @@ extern "C" { # define __USE_GNU_REGEX 1 #endif -#ifdef __VMS -/* VMS doesn't have `size_t' in , even though POSIX says it - should be there. */ -# include -#endif - #ifdef _REGEX_LARGE_OFFSETS /* Use types and values that are wide enough to represent signed and @@ -641,9 +635,10 @@ extern int re_exec (const char *); # endif # endif #endif -/* gcc 3.1 and up support the [restrict] syntax, but g++ doesn't. */ +/* gcc 3.1 and up support the [restrict] syntax. */ #ifndef __restrict_arr -# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) && !defined __cplusplus +# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) \ + && !defined __GNUG__ # define __restrict_arr __restrict # else # define __restrict_arr diff -ruNp m4-1.4.5/lib/regex_internal.c m4-1.4.6/lib/regex_internal.c --- m4-1.4.5/lib/regex_internal.c 2006-07-15 16:14:36.000000000 -0600 +++ m4-1.4.6/lib/regex_internal.c 2006-08-24 11:36:08.000000000 -0600 @@ -488,27 +488,34 @@ re_string_skip_chars (re_string_t *pstr, mbstate_t prev_st; Idx rawbuf_idx; size_t mbclen; - wchar_t wc = 0; + wint_t wc = WEOF; /* Skip the characters which are not necessary to check. */ for (rawbuf_idx = pstr->raw_mbs_idx + pstr->valid_raw_len; rawbuf_idx < new_raw_idx;) { + wchar_t wc2; Idx remain_len; remain_len = pstr->len - rawbuf_idx; prev_st = pstr->cur_state; - mbclen = mbrtowc (&wc, (const char *) pstr->raw_mbs + rawbuf_idx, + mbclen = mbrtowc (&wc2, (const char *) pstr->raw_mbs + rawbuf_idx, remain_len, &pstr->cur_state); if (BE (mbclen == (size_t) -2 || mbclen == (size_t) -1 || mbclen == 0, 0)) { - /* We treat these cases as a singlebyte character. */ + /* We treat these cases as a single byte character. */ + if (mbclen == 0 || remain_len == 0) + wc = L'\0'; + else + wc = *(unsigned char *) (pstr->raw_mbs + rawbuf_idx); mbclen = 1; pstr->cur_state = prev_st; } + else + wc = wc2; /* Then proceed the next character. */ rawbuf_idx += mbclen; } - *last_wc = (wint_t) wc; + *last_wc = wc; return rawbuf_idx; } #endif /* RE_ENABLE_I18N */ @@ -627,7 +634,6 @@ re_string_reconstruct (re_string_t *pstr } #endif pstr->valid_len = 0; - pstr->valid_raw_len = 0; #ifdef RE_ENABLE_I18N if (pstr->mb_cur_max > 1) { @@ -690,6 +696,16 @@ re_string_reconstruct (re_string_t *pstr if (wc == WEOF) pstr->valid_len = re_string_skip_chars (pstr, idx, &wc) - idx; + if (wc == WEOF) + pstr->tip_context + = re_string_context_at (pstr, pstr->valid_raw_len - 1, eflags); + else + pstr->tip_context = ((BE (pstr->word_ops_used != 0, 0) + && IS_WIDE_WORD_CHAR (wc)) + ? CONTEXT_WORD + : ((IS_WIDE_NEWLINE (wc) + && pstr->newline_anchor) + ? CONTEXT_NEWLINE : 0)); if (BE (pstr->valid_len, 0)) { for (wcs_idx = 0; wcs_idx < pstr->valid_len; ++wcs_idx) @@ -698,17 +714,12 @@ re_string_reconstruct (re_string_t *pstr memset (pstr->mbs, -1, pstr->valid_len); } pstr->valid_raw_len = pstr->valid_len; - pstr->tip_context = ((BE (pstr->word_ops_used != 0, 0) - && IS_WIDE_WORD_CHAR (wc)) - ? CONTEXT_WORD - : ((IS_WIDE_NEWLINE (wc) - && pstr->newline_anchor) - ? CONTEXT_NEWLINE : 0)); } else #endif /* RE_ENABLE_I18N */ { int c = pstr->raw_mbs[pstr->raw_mbs_idx + offset - 1]; + pstr->valid_raw_len = 0; if (pstr->trans) c = pstr->trans[c]; pstr->tip_context = (bitset_contain (pstr->word_char, c) diff -ruNp m4-1.4.5/lib/regex_internal.h m4-1.4.6/lib/regex_internal.h --- m4-1.4.5/lib/regex_internal.h 2006-07-15 16:14:36.000000000 -0600 +++ m4-1.4.6/lib/regex_internal.h 2006-08-24 11:36:08.000000000 -0600 @@ -43,13 +43,10 @@ #if defined HAVE_WCTYPE_H || defined _LIBC # include #endif /* HAVE_WCTYPE_H || _LIBC */ -#if defined HAVE_STDINT_H || defined _LIBC -# include -#endif /* HAVE_STDINT_H || _LIBC */ +#include #if defined _LIBC # include #else -# define __libc_lock_define(CLASS,NAME) # define __libc_lock_init(NAME) do { } while (0) # define __libc_lock_lock(NAME) do { } while (0) # define __libc_lock_unlock(NAME) do { } while (0) @@ -711,7 +708,9 @@ struct re_dfa_t #ifdef DEBUG char* re_str; #endif +#ifdef _LIBC __libc_lock_define (, lock) +#endif }; #define re_node_set_init_empty(set) memset (set, '\0', sizeof (re_node_set)) diff -ruNp m4-1.4.5/lib/stat_.h m4-1.4.6/lib/stat_.h --- m4-1.4.5/lib/stat_.h 2006-07-15 16:14:37.000000000 -0600 +++ m4-1.4.6/lib/stat_.h 2006-08-24 11:36:09.000000000 -0600 @@ -26,7 +26,7 @@ /* mingw does not support symlinks, therefore it does not have lstat. But without links, stat does just fine. */ -#if ! HAVE_FUNC_LSTAT +#if ! HAVE_LSTAT # define lstat stat #endif diff -ruNp m4-1.4.5/lib/stdint_.h m4-1.4.6/lib/stdint_.h --- m4-1.4.5/lib/stdint_.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/lib/stdint_.h 2006-08-24 11:36:09.000000000 -0600 @@ -0,0 +1,454 @@ +/* Copyright (C) 2001-2002, 2004-2006 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. */ + +#ifndef _GL_STDINT_H +#define _GL_STDINT_H + +/* + * ISO C 99 for platforms that lack it. + * + */ + +/* 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 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 . + Include it before , since any "#include " + in would reinclude us, skipping our contents because + _GL_STDINT_H is defined. */ +# include @ABSOLUTE_STDINT_H@ +#endif + +/* defines some of the stdint.h types as well, on glibc, + IRIX 6.5, and OpenBSD 3.8 (via ). + MacOS X 10.4.6 includes (which is us), but + relies on the system definitions, so include + after @ABSOLUTE_STDINT_H@. */ +#if @HAVE_SYS_TYPES_H@ +# include +#endif + +/* Get LONG_MIN, LONG_MAX, ULONG_MAX. */ +#include + +#if @HAVE_INTTYPES_H@ + /* In OpenBSD 3.8, includes , which defines + int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__. + also defines intptr_t and uintptr_t. */ +# include +#elif @HAVE_SYS_INTTYPES_H@ + /* Solaris 7 has the types except the *_fast*_t types, and + the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX. */ +# include +#endif + +#if @HAVE_SYS_BITYPES_H@ && ! defined __BIT_TYPES_DEFINED__ + /* Linux libc4 >= 4.6.7 and libc5 have a that defines + int{8,16,32,64}_t and __BIT_TYPES_DEFINED__. In libc5 >= 5.2.2 it is + included by . */ +# include +#endif + +#if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS + +/* Get WCHAR_MIN, WCHAR_MAX. */ +# if @HAVE_WCHAR_H@ && ! (defined WCHAR_MIN && defined WCHAR_MAX) + /* BSD/OS 4.1 has a bug: and must be included before + . */ +# include +# include +# include +# 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 + +#undef int64_t +#undef uint64_t +#if LONG_MAX >> 31 >> 31 == 1 +# define int64_t long int +# define uint64_t unsigned long int +#elif defined _MSC_VER +# define int64_t __int64 +# define uint64_t unsigned __int64 +#elif @HAVE_LONG_LONG_INT@ +# define int64_t long long int +# define uint64_t unsigned long long int +#endif + +/* Avoid collision with Solaris 2.5.1 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 int64_t +# define int_least64_t int64_t +# define uint_least64_t uint64_t +#endif + +/* 7.18.1.3. Fastest minimum-width integer types */ + +/* Note: Other 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 int64_t +# define int_fast64_t int64_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 +#undef uintmax_t +#if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 +# define intmax_t long long int +# define uintmax_t unsigned long long int +#elif defined int64_t +# define intmax_t int64_t +# define uintmax_t uint64_t +#else +# define intmax_t long int +# 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 +#undef UINT64_MAX +#ifdef int64_t +# define INT64_MIN (~ INT64_MAX) +# define INT64_MAX INTMAX_C (9223372036854775807) +# 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 +#undef UINT_LEAST64_MAX +#ifdef int64_t +# define INT_LEAST64_MIN INT64_MIN +# define INT_LEAST64_MAX INT64_MAX +# 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 +#undef UINT_FAST64_MAX +#ifdef int64_t +# define INT_FAST64_MIN INT64_MIN +# define INT_FAST64_MAX INT64_MAX +# 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 +#undef UINTMAX_MAX +#define INTMAX_MIN (~ INTMAX_MAX) +#ifdef INT64_MAX +# define INTMAX_MAX INT64_MAX +# define UINTMAX_MAX UINT64_MAX +#else +# define INTMAX_MAX INT32_MAX +# 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 +# define UINT64_C(x) x##UL +#elif defined _MSC_VER +# define INT64_C(x) x##i64 +# define UINT64_C(x) x##ui64 +#elif @HAVE_LONG_LONG_INT@ +# define INT64_C(x) x##LL +# define UINT64_C(x) x##ULL +#endif + +/* 7.18.4.2. Macros for greatest-width integer constants */ + +#undef INTMAX_C +#undef UINTMAX_C +#if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 +# define INTMAX_C(x) x##LL +# define UINTMAX_C(x) x##ULL +#elif defined int64_t +# define INTMAX_C(x) INT64_C(x) +# define UINTMAX_C(x) UINT64_C(x) +#else +# define INTMAX_C(x) x##L +# define UINTMAX_C(x) x##UL +#endif + +#endif /* !defined __cplusplus || defined __STDC_CONSTANT_MACROS */ + +#endif /* _GL_STDINT_H */ diff -ruNp m4-1.4.5/lib/stdio--.h m4-1.4.6/lib/stdio--.h --- m4-1.4.5/lib/stdio--.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/lib/stdio--.h 2006-08-24 11:36:09.000000000 -0600 @@ -0,0 +1,28 @@ +/* Like stdio.h, but redefine some names to avoid glitches. + + 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. */ + +#include +#include "stdio-safer.h" + +#undef fopen +#define fopen fopen_safer + +#undef tmpfile +#define tmpfile tmpfile_safer diff -ruNp m4-1.4.5/lib/stdio-safer.h m4-1.4.6/lib/stdio-safer.h --- m4-1.4.5/lib/stdio-safer.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/lib/stdio-safer.h 2006-08-24 11:36:09.000000000 -0600 @@ -0,0 +1,24 @@ +/* Invoke stdio functions, but avoid some glitches. + + Copyright (C) 2001, 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 + +FILE *fopen_safer (char const *, char const *); +FILE *tmpfile_safer (void); diff -ruNp m4-1.4.5/lib/stdlib--.h m4-1.4.6/lib/stdlib--.h --- m4-1.4.5/lib/stdlib--.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/lib/stdlib--.h 2006-08-24 11:36:10.000000000 -0600 @@ -0,0 +1,25 @@ +/* Like stdlib.h, but redefine some names to avoid glitches. + + Copyright (C) 2005 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 +#include "stdlib-safer.h" + +#undef mkstemp +#define mkstemp mkstemp_safer diff -ruNp m4-1.4.5/lib/stdlib-safer.h m4-1.4.6/lib/stdlib-safer.h --- m4-1.4.5/lib/stdlib-safer.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/lib/stdlib-safer.h 2006-08-24 11:36:10.000000000 -0600 @@ -0,0 +1,21 @@ +/* Invoke stdlib.h functions, but avoid some glitches. + + Copyright (C) 2005 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. */ + +int mkstemp_safer (char *); diff -ruNp m4-1.4.5/lib/strnlen1.c m4-1.4.6/lib/strnlen1.c --- m4-1.4.5/lib/strnlen1.c 2006-07-15 16:14:38.000000000 -0600 +++ m4-1.4.6/lib/strnlen1.c 2006-08-24 11:36:11.000000000 -0600 @@ -1,20 +1,19 @@ /* Find the length of STRING + 1, but scan at most MAXLEN bytes. Copyright (C) 2005 Free Software Foundation, Inc. - This program 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, or (at your option) + 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 - Library General Public License for more details. + 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 Library 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, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H # include diff -ruNp m4-1.4.5/lib/strnlen1.h m4-1.4.6/lib/strnlen1.h --- m4-1.4.5/lib/strnlen1.h 2006-07-15 16:14:39.000000000 -0600 +++ m4-1.4.6/lib/strnlen1.h 2006-08-24 11:36:11.000000000 -0600 @@ -1,20 +1,19 @@ /* Find the length of STRING + 1, but scan at most MAXLEN bytes. Copyright (C) 2005 Free Software Foundation, Inc. - This program 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, or (at your option) + 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 - Library General Public License for more details. + 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 Library 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, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _STRNLEN1_H #define _STRNLEN1_H diff -ruNp m4-1.4.5/lib/tempname.c m4-1.4.6/lib/tempname.c --- m4-1.4.5/lib/tempname.c 2006-07-15 16:14:39.000000000 -0600 +++ m4-1.4.6/lib/tempname.c 2006-08-24 11:36:11.000000000 -0600 @@ -53,13 +53,7 @@ # include #endif -#if HAVE_STDINT_H || _LIBC -# include -#endif -#if HAVE_INTTYPES_H -# include -#endif - +#include #include #include diff -ruNp m4-1.4.5/lib/tmpfile-safer.c m4-1.4.6/lib/tmpfile-safer.c --- m4-1.4.5/lib/tmpfile-safer.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/lib/tmpfile-safer.c 2006-08-24 11:36:11.000000000 -0600 @@ -0,0 +1,76 @@ +/* Invoke tmpfile, but avoid some glitches. + Copyright (C) 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 Eric Blake, based on ideas from Paul Eggert. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "stdio-safer.h" + +#include +#include +#include "unistd-safer.h" + +#include "binary-io.h" + +#ifndef STDERR_FILENO +# define STDERR_FILENO 2 +#endif + +/* Like tmpfile, but do not return stdin, stdout, or stderr. + + Remember that tmpfile can leave files behind if your program calls _exit, + so this function should not be mixed with the close_stdout module. */ + +FILE * +tmpfile_safer (void) +{ + FILE *fp = tmpfile (); + + if (fp) + { + int fd = fileno (fp); + + if (0 <= fd && fd <= STDERR_FILENO) + { + int f = dup_safer (fd); + + if (f < 0) + { + int e = errno; + fclose (fp); + errno = e; + return NULL; + } + + /* Keep the temporary file in binary mode, on platforms + where that matters. */ + if (fclose (fp) != 0 + || ! (fp = fdopen (f, O_BINARY ? "wb+" : "w+"))) + { + int e = errno; + close (f); + errno = e; + return NULL; + } + } + } + + return fp; +} diff -ruNp m4-1.4.5/lib/unistd--.h m4-1.4.6/lib/unistd--.h --- m4-1.4.5/lib/unistd--.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/lib/unistd--.h 2006-08-24 11:36:11.000000000 -0600 @@ -0,0 +1,28 @@ +/* Like unistd.h, but redefine some names to avoid glitches. + + Copyright (C) 2005 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 +#include "unistd-safer.h" + +#undef dup +#define dup dup_safer + +#undef pipe +#define pipe pipe_safer diff -ruNp m4-1.4.5/lib/unistd-safer.h m4-1.4.6/lib/unistd-safer.h --- m4-1.4.5/lib/unistd-safer.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/lib/unistd-safer.h 2006-08-24 11:36:12.000000000 -0600 @@ -0,0 +1,23 @@ +/* Invoke unistd-like functions, but avoid some glitches. + + Copyright (C) 2001, 2003, 2005 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. */ + +int dup_safer (int); +int fd_safer (int); +int pipe_safer (int[2]); diff -ruNp m4-1.4.5/lib/unlocked-io.h m4-1.4.6/lib/unlocked-io.h --- m4-1.4.5/lib/unlocked-io.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/lib/unlocked-io.h 2006-08-24 11:36:12.000000000 -0600 @@ -0,0 +1,137 @@ +/* Prefer faster, non-thread-safe stdio functions if available. + + Copyright (C) 2001, 2002, 2003, 2004 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. */ + +#ifndef UNLOCKED_IO_H +# define UNLOCKED_IO_H 1 + +/* These are wrappers for functions/macros from the GNU C library, and + from other C libraries supporting POSIX's optional thread-safe functions. + + The standard I/O functions are thread-safe. These *_unlocked ones are + more efficient but not thread-safe. That they're not thread-safe is + fine since all of the applications in this package are single threaded. + + Also, some code that is shared with the GNU C library may invoke + the *_unlocked functions directly. On hosts that lack those + functions, invoke the non-thread-safe versions instead. */ + +# include + +# if HAVE_DECL_CLEARERR_UNLOCKED +# undef clearerr +# define clearerr(x) clearerr_unlocked (x) +# else +# define clearerr_unlocked(x) clearerr (x) +# endif + +# if HAVE_DECL_FEOF_UNLOCKED +# undef feof +# define feof(x) feof_unlocked (x) +# else +# define feof_unlocked(x) feof (x) +# endif + +# if HAVE_DECL_FERROR_UNLOCKED +# undef ferror +# define ferror(x) ferror_unlocked (x) +# else +# define ferror_unlocked(x) ferror (x) +# endif + +# if HAVE_DECL_FFLUSH_UNLOCKED +# undef fflush +# define fflush(x) fflush_unlocked (x) +# else +# define fflush_unlocked(x) fflush (x) +# endif + +# if HAVE_DECL_FGETS_UNLOCKED +# undef fgets +# define fgets(x,y,z) fgets_unlocked (x,y,z) +# else +# define fgets_unlocked(x,y,z) fgets (x,y,z) +# endif + +# if HAVE_DECL_FPUTC_UNLOCKED +# undef fputc +# define fputc(x,y) fputc_unlocked (x,y) +# else +# define fputc_unlocked(x,y) fputc (x,y) +# endif + +# if HAVE_DECL_FPUTS_UNLOCKED +# undef fputs +# define fputs(x,y) fputs_unlocked (x,y) +# else +# define fputs_unlocked(x,y) fputs (x,y) +# endif + +# if HAVE_DECL_FREAD_UNLOCKED +# undef fread +# define fread(w,x,y,z) fread_unlocked (w,x,y,z) +# else +# define fread_unlocked(w,x,y,z) fread (w,x,y,z) +# endif + +# if HAVE_DECL_FWRITE_UNLOCKED +# undef fwrite +# define fwrite(w,x,y,z) fwrite_unlocked (w,x,y,z) +# else +# define fwrite_unlocked(w,x,y,z) fwrite (w,x,y,z) +# endif + +# if HAVE_DECL_GETC_UNLOCKED +# undef getc +# define getc(x) getc_unlocked (x) +# else +# define getc_unlocked(x) getc (x) +# endif + +# if HAVE_DECL_GETCHAR_UNLOCKED +# undef getchar +# define getchar() getchar_unlocked () +# else +# define getchar_unlocked() getchar () +# endif + +# if HAVE_DECL_PUTC_UNLOCKED +# undef putc +# define putc(x,y) putc_unlocked (x,y) +# else +# define putc_unlocked(x,y) putc (x,y) +# endif + +# if HAVE_DECL_PUTCHAR_UNLOCKED +# undef putchar +# define putchar(x) putchar_unlocked (x) +# else +# define putchar_unlocked(x) putchar (x) +# endif + +# undef flockfile +# define flockfile(x) ((void) 0) + +# undef ftrylockfile +# define ftrylockfile(x) 0 + +# undef funlockfile +# define funlockfile(x) ((void) 0) + +#endif /* UNLOCKED_IO_H */ diff -ruNp m4-1.4.5/lib/vasprintf.h m4-1.4.6/lib/vasprintf.h --- m4-1.4.5/lib/vasprintf.h 2006-07-15 16:14:40.000000000 -0600 +++ m4-1.4.6/lib/vasprintf.h 2006-08-24 11:36:12.000000000 -0600 @@ -11,8 +11,8 @@ 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, + 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 _VASPRINTF_H diff -ruNp m4-1.4.5/lib/verror.c m4-1.4.6/lib/verror.c --- m4-1.4.5/lib/verror.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/lib/verror.c 2006-08-24 11:36:13.000000000 -0600 @@ -0,0 +1,79 @@ +/* va_list error handler for noninteractive utilities + Copyright (C) 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 Eric Blake. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "verror.h" +#include "xvasprintf.h" + +#include +#include +#include + +#if ENABLE_NLS +# include "gettext.h" +#endif + +#ifndef _ +# define _(String) String +#endif + +/* Print a message with `vfprintf (stderr, FORMAT, ARGS)'; + if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM). + If STATUS is nonzero, terminate the program with `exit (STATUS)'. + Use the globals error_print_progname and error_message_count similarly + to error(). */ +void +verror (int status, int errnum, const char *format, va_list args) +{ + verror_at_line (status, errnum, NULL, 0, format, args); +} + +/* Print a message with `vfprintf (stderr, FORMAT, ARGS)'; + if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM). + If STATUS is nonzero, terminate the program with `exit (STATUS)'. + If FNAME is not NULL, prepend the message with `FNAME:LINENO:'. + Use the globals error_print_progname, error_message_count, and + error_one_per_line similarly to error_at_line(). */ +void +verror_at_line (int status, int errnum, const char *file, + unsigned int line_number, const char *format, va_list args) +{ + char *message = xvasprintf (format, args); + if (message) + { + /* Until http://sourceware.org/bugzilla/show_bug.cgi?id=2997 is fixed, + glibc violates GNU Coding Standards when the file argument to + error_at_line is NULL. */ + if (file) + error_at_line (status, errnum, file, line_number, "%s", message); + else + error (status, errnum, "%s", message); + } + else + { + /* EOVERFLOW, EINVAL, and EILSEQ from xvasprintf are signs of + serious programmer errors. */ + error (0, errno, _("unable to display error message")); + abort (); + } + free (message); +} diff -ruNp m4-1.4.5/lib/verror.h m4-1.4.6/lib/verror.h --- m4-1.4.5/lib/verror.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/lib/verror.h 2006-08-24 11:36:13.000000000 -0600 @@ -0,0 +1,54 @@ +/* Declaration for va_list error-reporting function + Copyright (C) 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. */ + +#ifndef _VERROR_H +#define _VERROR_H 1 + +#include "error.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Print a message with `vfprintf (stderr, FORMAT, ARGS)'; + if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM). + If STATUS is nonzero, terminate the program with `exit (STATUS)'. + Use the globals error_print_progname and error_message_count similarly + to error(). */ + +extern void verror (int __status, int __errnum, const char *__format, + va_list __args) + __attribute__ ((__format__ (__printf__, 3, 0))); + +/* Print a message with `vfprintf (stderr, FORMAT, ARGS)'; + if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM). + If STATUS is nonzero, terminate the program with `exit (STATUS)'. + If FNAME is not NULL, prepend the message with `FNAME:LINENO:'. + Use the globals error_print_progname, error_message_count, and + error_one_per_line similarly to error_at_line(). */ + +extern void verror_at_line (int __status, int __errnum, const char *__fname, + unsigned int __lineno, const char *__format, + va_list __args) + __attribute__ ((__format__ (__printf__, 5, 0))); + +#ifdef __cplusplus +} +#endif + +#endif /* verror.h */ diff -ruNp m4-1.4.5/lib/wcwidth.h m4-1.4.6/lib/wcwidth.h --- m4-1.4.5/lib/wcwidth.h 2006-07-15 16:14:41.000000000 -0600 +++ m4-1.4.6/lib/wcwidth.h 2006-08-24 11:36:13.000000000 -0600 @@ -36,7 +36,14 @@ # include # endif # if !defined iswprint && !HAVE_ISWPRINT -# define iswprint(wc) 1 +static inline int +iswprint (wint_t wc) +{ + return (wc >= 0 && wc < 128 + ? wc >= ' ' && wc <= '~' + : 1); +} +# define iswprint iswprint # endif # ifndef HAVE_DECL_WCWIDTH diff -ruNp m4-1.4.5/m4/cloexec.m4 m4-1.4.6/m4/cloexec.m4 --- m4-1.4.5/m4/cloexec.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/m4/cloexec.m4 2006-08-24 11:36:15.000000000 -0600 @@ -0,0 +1,10 @@ +#serial 6 +dnl Copyright (C) 2004, 2005, 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. + +AC_DEFUN([gl_CLOEXEC], +[ + AC_LIBOBJ([cloexec]) +]) diff -ruNp m4-1.4.5/m4/close-stream.m4 m4-1.4.6/m4/close-stream.m4 --- m4-1.4.5/m4/close-stream.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/m4/close-stream.m4 2006-08-24 11:36:15.000000000 -0600 @@ -0,0 +1,12 @@ +dnl Copyright (C) 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. + +AC_DEFUN([gl_CLOSE_STREAM], +[ + AC_LIBOBJ([close-stream]) + + dnl Prerequisites of lib/close-stream.c. + : +]) diff -ruNp m4-1.4.5/m4/exitfail.m4 m4-1.4.6/m4/exitfail.m4 --- m4-1.4.5/m4/exitfail.m4 2006-07-15 16:14:44.000000000 -0600 +++ m4-1.4.6/m4/exitfail.m4 2006-08-24 11:36:15.000000000 -0600 @@ -1,12 +1,11 @@ -# exitfail.m4 serial 5 -dnl Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. +# exitfail.m4 serial 6 +dnl Copyright (C) 2002, 2003, 2005, 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. AC_DEFUN([gl_EXITFAIL], [ - AC_LIBSOURCES([exitfail.c, exitfail.h]) AC_LIBOBJ([exitfail]) dnl No prerequisites of lib/exitfail.c. diff -ruNp m4-1.4.5/m4/fpending.m4 m4-1.4.6/m4/fpending.m4 --- m4-1.4.5/m4/fpending.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/m4/fpending.m4 2006-08-24 11:36:16.000000000 -0600 @@ -0,0 +1,78 @@ +#serial 9 + +# Copyright (C) 2000, 2001, 2004, 2005, 2006 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. + +dnl From Jim Meyering +dnl Using code from emacs, based on suggestions from Paul Eggert +dnl and Ulrich Drepper. + +dnl Find out how to determine the number of pending output bytes on a stream. +dnl glibc (2.1.93 and newer) and Solaris provide __fpending. On other systems, +dnl we have to grub around in the FILE struct. + +AC_DEFUN([gl_FUNC_FPENDING], +[ + AC_CHECK_HEADERS(stdio_ext.h) + AC_REPLACE_FUNCS([__fpending]) + fp_headers=' +# include +# if HAVE_STDIO_EXT_H +# include +# endif +' + AC_CHECK_DECLS([__fpending], , , $fp_headers) + if test $ac_cv_func___fpending = no; then + AC_CACHE_CHECK( + [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 \ + ; do + + # Skip each embedded comment. + case "$ac_expr" in '#'*) continue;; esac + + AC_TRY_COMPILE( + [#include + ], + [FILE *fp = stdin; (void) ($ac_expr);], + fp_done=yes + ) + test "$fp_done" = yes && break + done + + ac_cv_sys_pending_output_n_bytes=$ac_expr + ] + ) + AC_DEFINE_UNQUOTED(PENDING_OUTPUT_N_BYTES, + $ac_cv_sys_pending_output_n_bytes, + [the number of pending output bytes on stream `fp']) + fi +]) diff -ruNp m4-1.4.5/m4/free.m4 m4-1.4.6/m4/free.m4 --- m4-1.4.5/m4/free.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/m4/free.m4 2006-08-24 11:36:16.000000000 -0600 @@ -0,0 +1,40 @@ +# 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 ]], + [[@%:@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.5/m4/gnulib-cache.m4 m4-1.4.6/m4/gnulib-cache.m4 --- m4-1.4.5/m4/gnulib-cache.m4 2006-07-13 06:28:50.000000000 -0600 +++ m4-1.4.6/m4/gnulib-cache.m4 2006-08-22 14:46:10.000000000 -0600 @@ -15,10 +15,10 @@ # Specification in the form of a command-line invocation: -# gnulib-tool --import --dir=. --lib=libm4 --source-base=lib --m4-base=m4 --doc-base=doc --aux-dir=. --macro-prefix=M4 alloca binary-io error fdl gendocs getopt mkstemp obstack regex strtol xalloc xvasprintf +# gnulib-tool --import --dir=. --lib=libm4 --source-base=lib --m4-base=m4 --doc-base=doc --aux-dir=. --no-libtool --macro-prefix=M4 binary-io cloexec close-stream error fdl fopen-safer free gendocs getopt gnupload mkstemp obstack regex stdlib-safer strtol tmpfile-safer unlocked-io verror xalloc xvasprintf # Specification in the form of a few gnulib-tool.m4 macro invocations: -gl_MODULES([alloca binary-io error fdl gendocs getopt mkstemp obstack regex strtol xalloc xvasprintf]) +gl_MODULES([binary-io cloexec close-stream error fdl fopen-safer free gendocs getopt gnupload mkstemp obstack regex stdlib-safer strtol tmpfile-safer unlocked-io verror xalloc xvasprintf]) gl_AVOID([]) gl_SOURCE_BASE([lib]) gl_M4_BASE([m4]) diff -ruNp m4-1.4.5/m4/gnulib-comp.m4 m4-1.4.6/m4/gnulib-comp.m4 --- m4-1.4.5/m4/gnulib-comp.m4 2006-07-15 16:15:05.000000000 -0600 +++ m4-1.4.6/m4/gnulib-comp.m4 2006-08-24 11:36:38.000000000 -0600 @@ -19,6 +19,8 @@ # any checks for libraries, header files, types and library functions. AC_DEFUN([M4_EARLY], [ + m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace + m4_pattern_allow([^gl_ES$])dnl a valid locale name AC_REQUIRE([AC_PROG_RANLIB]) AC_REQUIRE([AC_GNU_SOURCE]) AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) @@ -30,27 +32,37 @@ AC_DEFUN([M4_INIT], [ AM_CONDITIONAL([GL_COND_LIBTOOL], [false]) gl_FUNC_ALLOCA + gl_CLOEXEC + gl_CLOSE_STREAM gl_ERROR gl_EXITFAIL dnl gl_USE_SYSTEM_EXTENSIONS must be added quite early to configure.ac. + gl_FOPEN_SAFER + gl_FUNC_FPENDING + gl_FUNC_FREE gl_GETOPT AC_FUNC_MALLOC gl_MBCHAR gl_MBITER gl_FUNC_MEMCHR gl_FUNC_MKSTEMP - gl_OBSTACK + AC_FUNC_OBSTACK + dnl Note: AC_FUNC_OBSTACK does AC_LIBSOURCES([obstack.h, obstack.c]). gl_REGEX - gl_C_RESTRICT gl_SIZE_MAX gt_TYPE_SSIZE_T gl_STAT_MACROS gl_STDARG_H AM_STDBOOL_H + gl_STDINT_H + gl_STDLIB_SAFER gl_STRCASE gl_FUNC_STRTOL gl_HEADER_SYS_STAT_H + gl_TMPFILE_SAFER gl_HEADER_UNISTD + gl_UNISTD_SAFER + gl_FUNC_GLIBC_UNLOCKED_IO gl_FUNC_VASNPRINTF gl_FUNC_VASPRINTF gl_FUNC_WCWIDTH @@ -63,18 +75,29 @@ AC_DEFUN([M4_INIT], # gnulib-tool and may be removed by future gnulib-tool invocations. AC_DEFUN([M4_FILE_LIST], [ build-aux/gendocs.sh + build-aux/gnupload doc/fdl.texi doc/gendocs_template + lib/__fpending.c + lib/__fpending.h lib/alloca.c lib/alloca_.h lib/asnprintf.c lib/asprintf.c lib/binary-io.h + lib/cloexec.c + lib/cloexec.h + lib/close-stream.c + lib/close-stream.h + lib/dup-safer.c lib/error.c lib/error.h lib/exit.h lib/exitfail.c lib/exitfail.h + lib/fd-safer.c + lib/fopen-safer.c + lib/free.c lib/getopt.c lib/getopt1.c lib/getopt_.h @@ -85,9 +108,11 @@ AC_DEFUN([M4_FILE_LIST], [ lib/mbchar.h lib/mbuiter.h lib/memchr.c + lib/mkstemp-safer.c lib/mkstemp.c lib/obstack.c lib/obstack.h + lib/pipe-safer.c lib/printf-args.c lib/printf-args.h lib/printf-parse.c @@ -102,6 +127,11 @@ AC_DEFUN([M4_FILE_LIST], [ lib/stat-macros.h lib/stat_.h lib/stdbool_.h + lib/stdint_.h + lib/stdio--.h + lib/stdio-safer.h + lib/stdlib--.h + lib/stdlib-safer.h lib/strcase.h lib/strcasecmp.c lib/strncasecmp.c @@ -109,10 +139,16 @@ AC_DEFUN([M4_FILE_LIST], [ lib/strnlen1.h lib/strtol.c lib/tempname.c + lib/tmpfile-safer.c + lib/unistd--.h + lib/unistd-safer.h + lib/unlocked-io.h lib/vasnprintf.c lib/vasnprintf.h lib/vasprintf.c lib/vasprintf.h + lib/verror.c + lib/verror.h lib/wcwidth.h lib/xalloc-die.c lib/xalloc.h @@ -123,11 +159,15 @@ AC_DEFUN([M4_FILE_LIST], [ lib/xvasprintf.h m4/absolute-header.m4 m4/alloca.m4 + m4/cloexec.m4 + m4/close-stream.m4 m4/codeset.m4 m4/eoverflow.m4 m4/error.m4 m4/exitfail.m4 m4/extensions.m4 + m4/fpending.m4 + m4/free.m4 m4/getopt.m4 m4/intmax_t.m4 m4/inttypes_h.m4 @@ -138,23 +178,23 @@ AC_DEFUN([M4_FILE_LIST], [ m4/mbrtowc.m4 m4/memchr.m4 m4/mkstemp.m4 - m4/obstack.m4 m4/regex.m4 - m4/restrict.m4 m4/signed.m4 m4/size_max.m4 m4/ssize_t.m4 m4/stat-macros.m4 m4/stdarg.m4 m4/stdbool.m4 + m4/stdint.m4 m4/stdint_h.m4 + m4/stdio-safer.m4 + m4/stdlib-safer.m4 m4/strcase.m4 - m4/strerror_r.m4 m4/strtol.m4 m4/sys_stat_h.m4 - m4/uintmax_t.m4 - m4/ulonglong.m4 + m4/unistd-safer.m4 m4/unistd_h.m4 + m4/unlocked-io.m4 m4/vasnprintf.m4 m4/vasprintf.m4 m4/wchar_t.m4 diff -ruNp m4-1.4.5/m4/intmax_t.m4 m4-1.4.6/m4/intmax_t.m4 --- m4-1.4.5/m4/intmax_t.m4 2006-07-15 16:14:45.000000000 -0600 +++ m4-1.4.6/m4/intmax_t.m4 2006-08-24 11:36:17.000000000 -0600 @@ -1,5 +1,5 @@ -# intmax_t.m4 serial 4 -dnl Copyright (C) 1997-2004 Free Software Foundation, Inc. +# intmax_t.m4 serial 5 +dnl Copyright (C) 1997-2004, 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. @@ -46,7 +46,7 @@ AC_DEFUN([gt_AC_TYPE_INTMAX_T], #if HAVE_INTTYPES_H_WITH_UINTMAX #include #endif -], [intmax_t x = -1;], gt_cv_c_intmax_t=yes, gt_cv_c_intmax_t=no)]) +], [intmax_t x = -1; return !x;], gt_cv_c_intmax_t=yes, gt_cv_c_intmax_t=no)]) if test $gt_cv_c_intmax_t = yes; then AC_DEFINE(HAVE_INTMAX_T, 1, [Define if you have the 'intmax_t' type in or .]) diff -ruNp m4-1.4.5/m4/inttypes_h.m4 m4-1.4.6/m4/inttypes_h.m4 --- m4-1.4.5/m4/inttypes_h.m4 2006-07-15 16:14:45.000000000 -0600 +++ m4-1.4.6/m4/inttypes_h.m4 2006-08-24 11:36:17.000000000 -0600 @@ -1,5 +1,5 @@ -# inttypes_h.m4 serial 6 -dnl Copyright (C) 1997-2004 Free Software Foundation, Inc. +# inttypes_h.m4 serial 7 +dnl Copyright (C) 1997-2004, 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. @@ -15,7 +15,7 @@ AC_DEFUN([gl_AC_HEADER_INTTYPES_H], [AC_TRY_COMPILE( [#include #include ], - [uintmax_t i = (uintmax_t) -1;], + [uintmax_t i = (uintmax_t) -1; return !i;], gl_cv_header_inttypes_h=yes, gl_cv_header_inttypes_h=no)]) if test $gl_cv_header_inttypes_h = yes; then diff -ruNp m4-1.4.5/m4/longlong.m4 m4-1.4.6/m4/longlong.m4 --- m4-1.4.5/m4/longlong.m4 2006-07-15 16:14:46.000000000 -0600 +++ m4-1.4.6/m4/longlong.m4 2006-08-24 11:36:17.000000000 -0600 @@ -1,4 +1,4 @@ -# longlong.m4 serial 6 +# longlong.m4 serial 7 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, @@ -22,8 +22,8 @@ AC_DEFUN([AC_TYPE_LONG_LONG_INT], ? 1 : -1)]; int i = 63;]], [[long long int llmax = 9223372036854775807ll; - return (ll << 63 | ll >> 63 | ll < i | ll > i - | llmax / ll | llmax % ll);]])], + return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i) + | (llmax / ll) | (llmax % ll));]])], [ac_cv_type_long_long_int=yes], [ac_cv_type_long_long_int=no])]) if test $ac_cv_type_long_long_int = yes; then diff -ruNp m4-1.4.5/m4/mbchar.m4 m4-1.4.6/m4/mbchar.m4 --- m4-1.4.5/m4/mbchar.m4 2006-07-15 16:14:46.000000000 -0600 +++ m4-1.4.6/m4/mbchar.m4 2006-08-24 11:36:17.000000000 -0600 @@ -1,5 +1,5 @@ -# mbchar.m4 serial 2 -dnl Copyright (C) 2005 Free Software Foundation, Inc. +# mbchar.m4 serial 4 +dnl Copyright (C) 2005-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. @@ -10,11 +10,14 @@ dnl From Bruno Haible. AC_DEFUN([gl_MBCHAR], [ AC_REQUIRE([AC_GNU_SOURCE]) - dnl The following line is that so the user can test - dnl HAVE_WCHAR_H && HAVE_WCTYPE_H before #include "mbchar.h". - AC_CHECK_HEADERS_ONCE(wchar.h wctype.h) - dnl Compile mbchar.c only if HAVE_WCHAR_H && HAVE_WCTYPE_H. - if test $ac_cv_header_wchar_h = yes && test $ac_cv_header_wctype_h = yes; then + dnl The following line is that so the user can test HAVE_WCHAR_H + dnl before #include "mbchar.h". + AC_CHECK_HEADERS_ONCE([wchar.h]) + dnl Compile mbchar.c only if HAVE_WCHAR_H. + if test $ac_cv_header_wchar_h = yes; then AC_LIBOBJ([mbchar]) + dnl Prerequisites of mbchar.h and mbchar.c. + AC_CHECK_HEADERS_ONCE([wctype.h]) + AC_CHECK_FUNCS([iswcntrl]) fi ]) diff -ruNp m4-1.4.5/m4/mkstemp.m4 m4-1.4.6/m4/mkstemp.m4 --- m4-1.4.5/m4/mkstemp.m4 2006-07-15 16:14:47.000000000 -0600 +++ m4-1.4.6/m4/mkstemp.m4 2006-08-24 11:36:18.000000000 -0600 @@ -67,5 +67,4 @@ AC_DEFUN([gl_PREREQ_TEMPNAME], [ AC_CHECK_HEADERS_ONCE(sys/time.h) AC_CHECK_FUNCS(__secure_getenv gettimeofday) - AC_REQUIRE([gl_AC_TYPE_UINTMAX_T]) ]) diff -ruNp m4-1.4.5/m4/obstack.m4 m4-1.4.6/m4/obstack.m4 --- m4-1.4.5/m4/obstack.m4 2006-07-15 16:14:47.000000000 -0600 +++ m4-1.4.6/m4/obstack.m4 1969-12-31 17:00:00.000000000 -0700 @@ -1,23 +0,0 @@ -# obstack.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_OBSTACK], -[ - AC_FUNC_OBSTACK - dnl Note: AC_FUNC_OBSTACK does AC_LIBSOURCES([obstack.h, obstack.c]). - if test $ac_cv_func_obstack = no; then - gl_PREREQ_OBSTACK - fi -]) - -# Prerequisites of lib/obstack.c. -AC_DEFUN([gl_PREREQ_OBSTACK], -[ - AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) - AC_REQUIRE([gl_AC_HEADER_STDINT_H]) - AC_REQUIRE([gl_AC_TYPE_UINTMAX_T]) - : -]) diff -ruNp m4-1.4.5/m4/regex.m4 m4-1.4.6/m4/regex.m4 --- m4-1.4.5/m4/regex.m4 2006-07-15 16:14:47.000000000 -0600 +++ m4-1.4.6/m4/regex.m4 2006-08-24 11:36:18.000000000 -0600 @@ -1,4 +1,4 @@ -#serial 37 +#serial 39 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006 Free Software Foundation, Inc. @@ -14,10 +14,6 @@ AC_PREREQ([2.50]) AC_DEFUN([gl_REGEX], [ - AC_LIBSOURCES( - [regcomp.c, regex.c, regex.h, - regex_internal.c, regex_internal.h, regexec.c]) - AC_ARG_WITH([included-regex], [AC_HELP_STRING([--without-included-regex], [don't compile regex; this is the default on @@ -163,7 +159,7 @@ AC_DEFUN([gl_REGEX], AC_DEFUN([gl_PREREQ_REGEX], [ AC_REQUIRE([AC_GNU_SOURCE]) - AC_REQUIRE([gl_C_RESTRICT]) + AC_REQUIRE([AC_C_RESTRICT]) AC_REQUIRE([AM_LANGINFO_CODESET]) AC_CHECK_HEADERS_ONCE([locale.h wchar.h wctype.h]) AC_CHECK_FUNCS_ONCE([mbrtowc mempcpy wcrtomb wcscoll]) diff -ruNp m4-1.4.5/m4/restrict.m4 m4-1.4.6/m4/restrict.m4 --- m4-1.4.5/m4/restrict.m4 2006-07-15 16:14:48.000000000 -0600 +++ m4-1.4.6/m4/restrict.m4 1969-12-31 17:00:00.000000000 -0700 @@ -1,38 +0,0 @@ -#serial 1003 -dnl Copyright (C) 2003 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. - -# This macro can be removed once we can rely on Autoconf 2.57a or later, -# since we can then use its AC_C_RESTRICT. - -# gl_C_RESTRICT -# -------------- -# Determine whether the C/C++ compiler supports the "restrict" keyword -# introduced in ANSI C99, or an equivalent. Do nothing if the compiler -# accepts it. Otherwise, if the compiler supports an equivalent, -# define "restrict" to be that. Here are some variants: -# - GCC supports both __restrict and __restrict__ -# - older DEC Alpha C compilers support only __restrict -# - _Restrict is the only spelling accepted by Sun WorkShop 6 update 2 C -# Otherwise, define "restrict" to be empty. -AC_DEFUN([gl_C_RESTRICT], -[AC_CACHE_CHECK([for C/C++ restrict keyword], gl_cv_c_restrict, - [gl_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 - AC_COMPILE_IFELSE([AC_LANG_SOURCE( - [float * $ac_kw x;])], - [gl_cv_c_restrict=$ac_kw; break]) - done - ]) - case $gl_cv_c_restrict in - restrict) ;; - no) AC_DEFINE(restrict,, - [Define to equivalent of C99 restrict keyword, or to nothing if this - is not supported. Do not define if restrict is supported directly.]) ;; - *) AC_DEFINE_UNQUOTED(restrict, $gl_cv_c_restrict) ;; - esac -]) diff -ruNp m4-1.4.5/m4/stat-macros.m4 m4-1.4.6/m4/stat-macros.m4 --- m4-1.4.5/m4/stat-macros.m4 2006-07-15 16:14:48.000000000 -0600 +++ m4-1.4.6/m4/stat-macros.m4 2006-08-24 11:36:19.000000000 -0600 @@ -1,6 +1,6 @@ -#serial 2 +#serial 3 -# Copyright (C) 2005 Free Software Foundation, Inc. +# Copyright (C) 2005, 2006 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -8,7 +8,5 @@ AC_DEFUN([gl_STAT_MACROS], [ - AC_LIBSOURCES([stat-macros.h]) - AC_REQUIRE([AC_HEADER_STAT]) ]) diff -ruNp m4-1.4.5/m4/stdint.m4 m4-1.4.6/m4/stdint.m4 --- m4-1.4.5/m4/stdint.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/m4/stdint.m4 2006-08-24 11:36:19.000000000 -0600 @@ -0,0 +1,361 @@ +# stdint.m4 serial 18 +dnl Copyright (C) 2001-2002, 2004-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 and Bruno Haible. +dnl Test whether is supported or must be substituted. + +AC_DEFUN([gl_STDINT_H], +[ + AC_PREREQ(2.59)dnl + + dnl Check for long long int. + AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) + if test $ac_cv_type_long_long_int = yes; then + HAVE_LONG_LONG_INT=1 + else + HAVE_LONG_LONG_INT=0 + fi + AC_SUBST([HAVE_LONG_LONG_INT]) + + dnl Check for . + AC_CHECK_HEADERS_ONCE([wchar.h]) + if test $ac_cv_header_wchar_h = yes; then + HAVE_WCHAR_H=1 + else + HAVE_WCHAR_H=0 + fi + AC_SUBST([HAVE_WCHAR_H]) + + dnl Check for . + dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_inttypes_h. + if test $ac_cv_header_inttypes_h = yes; then + HAVE_INTTYPES_H=1 + else + HAVE_INTTYPES_H=0 + fi + AC_SUBST([HAVE_INTTYPES_H]) + + dnl Check for . + dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_sys_types_h. + if test $ac_cv_header_sys_types_h = yes; then + HAVE_SYS_TYPES_H=1 + else + HAVE_SYS_TYPES_H=0 + fi + AC_SUBST([HAVE_SYS_TYPES_H]) + + dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_stdint_h. + if test $ac_cv_header_stdint_h = yes; then + gl_ABSOLUTE_HEADER([stdint.h]) + ABSOLUTE_STDINT_H=\"$gl_cv_absolute_stdint_h\" + HAVE_STDINT_H=1 + else + ABSOLUTE_STDINT_H=\"no/such/file/stdint.h\" + HAVE_STDINT_H=0 + fi + AC_SUBST([ABSOLUTE_STDINT_H]) + AC_SUBST([HAVE_STDINT_H]) + + dnl Now see whether we need a substitute . Use + dnl ABSOLUTE_STDINT_H, not , so that it also works during + dnl a "config.status --recheck" if a stdint.h has been + dnl created in the build directory. + if test $ac_cv_header_stdint_h = yes; then + AC_CACHE_CHECK([whether stdint.h conforms to C99], + [gl_cv_header_working_stdint_h], + [gl_cv_header_working_stdint_h=no + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#include +#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 */ +#include ABSOLUTE_STDINT_H +#ifdef INT8_MAX +int8_t a1 = INT8_MAX; +int8_t a1min = INT8_MIN; +#endif +#ifdef INT16_MAX +int16_t a2 = INT16_MAX; +int16_t a2min = INT16_MIN; +#endif +#ifdef INT32_MAX +int32_t a3 = INT32_MAX; +int32_t a3min = INT32_MIN; +#endif +#ifdef INT64_MAX +int64_t a4 = INT64_MAX; +int64_t a4min = INT64_MIN; +#endif +#ifdef UINT8_MAX +uint8_t b1 = UINT8_MAX; +#else +typedef int b1[(unsigned char) -1 != 255 ? 1 : -1]; +#endif +#ifdef UINT16_MAX +uint16_t b2 = UINT16_MAX; +#endif +#ifdef UINT32_MAX +uint32_t b3 = UINT32_MAX; +#endif +#ifdef UINT64_MAX +uint64_t b4 = UINT64_MAX; +#endif +int_least8_t c1 = INT8_C (0x7f); +int_least8_t c1max = INT_LEAST8_MAX; +int_least8_t c1min = INT_LEAST8_MIN; +int_least16_t c2 = INT16_C (0x7fff); +int_least16_t c2max = INT_LEAST16_MAX; +int_least16_t c2min = INT_LEAST16_MIN; +int_least32_t c3 = INT32_C (0x7fffffff); +int_least32_t c3max = INT_LEAST32_MAX; +int_least32_t c3min = INT_LEAST32_MIN; +int_least64_t c4 = INT64_C (0x7fffffffffffffff); +int_least64_t c4max = INT_LEAST64_MAX; +int_least64_t c4min = INT_LEAST64_MIN; +uint_least8_t d1 = UINT8_C (0xff); +uint_least8_t d1max = UINT_LEAST8_MAX; +uint_least16_t d2 = UINT16_C (0xffff); +uint_least16_t d2max = UINT_LEAST16_MAX; +uint_least32_t d3 = UINT32_C (0xffffffff); +uint_least32_t d3max = UINT_LEAST32_MAX; +uint_least64_t d4 = UINT64_C (0xffffffffffffffff); +uint_least64_t d4max = UINT_LEAST64_MAX; +int_fast8_t e1 = INT_FAST8_MAX; +int_fast8_t e1min = INT_FAST8_MIN; +int_fast16_t e2 = INT_FAST16_MAX; +int_fast16_t e2min = INT_FAST16_MIN; +int_fast32_t e3 = INT_FAST32_MAX; +int_fast32_t e3min = INT_FAST32_MIN; +int_fast64_t e4 = INT_FAST64_MAX; +int_fast64_t e4min = INT_FAST64_MIN; +uint_fast8_t f1 = UINT_FAST8_MAX; +uint_fast16_t f2 = UINT_FAST16_MAX; +uint_fast32_t f3 = UINT_FAST32_MAX; +uint_fast64_t f4 = UINT_FAST64_MAX; +#ifdef INTPTR_MAX +intptr_t g = INTPTR_MAX; +intptr_t gmin = INTPTR_MIN; +#endif +#ifdef UINTPTR_MAX +uintptr_t h = UINTPTR_MAX; +#endif +intmax_t i = INTMAX_MAX; +uintmax_t j = UINTMAX_MAX; +struct s { + int check_PTRDIFF: PTRDIFF_MIN < 0 && 0 < PTRDIFF_MAX ? 1 : -1; + int check_SIG_ATOMIC: SIG_ATOMIC_MIN <= 0 && 0 < SIG_ATOMIC_MAX ? 1 : -1; + int check_SIZE: 0 < SIZE_MAX ? 1 : -1; + int check_WCHAR: WCHAR_MIN <= 0 && 0 < WCHAR_MAX ? 1 : -1; + int check_WINT: WINT_MIN <= 0 && 0 < WINT_MAX ? 1 : -1; + + /* Detect bugs in glibc 2.4 and Solaris 10 stdint.h, among others. */ + int check_UINT8_C: + (-1 < UINT8_C (0)) == (-1 < (uint_least8_t) 0) ? 1 : -1; + int check_UINT16_C: + (-1 < UINT16_C (0)) == (-1 < (uint_least16_t) 0) ? 1 : -1; + + /* Detect bugs in OpenBSD 3.9 stdint.h. */ +#ifdef UINT8_MAX + int check_uint8: (uint8_t) -1 == UINT8_MAX ? 1 : -1; +#endif +#ifdef UINT16_MAX + int check_uint16: (uint16_t) -1 == UINT16_MAX ? 1 : -1; +#endif +#ifdef UINT32_MAX + int check_uint32: (uint32_t) -1 == UINT32_MAX ? 1 : -1; +#endif +#ifdef UINT64_MAX + int check_uint64: (uint64_t) -1 == UINT64_MAX ? 1 : -1; +#endif + int check_uint_least8: (uint_least8_t) -1 == UINT_LEAST8_MAX ? 1 : -1; + int check_uint_least16: (uint_least16_t) -1 == UINT_LEAST16_MAX ? 1 : -1; + int check_uint_least32: (uint_least32_t) -1 == UINT_LEAST32_MAX ? 1 : -1; + int check_uint_least64: (uint_least64_t) -1 == UINT_LEAST64_MAX ? 1 : -1; + int check_uint_fast8: (uint_fast8_t) -1 == UINT_FAST8_MAX ? 1 : -1; + int check_uint_fast16: (uint_fast16_t) -1 == UINT_FAST16_MAX ? 1 : -1; + int check_uint_fast32: (uint_fast32_t) -1 == UINT_FAST32_MAX ? 1 : -1; + int check_uint_fast64: (uint_fast64_t) -1 == UINT_FAST64_MAX ? 1 : -1; + int check_uintptr: (uintptr_t) -1 == UINTPTR_MAX ? 1 : -1; + int check_uintmax: (uintmax_t) -1 == UINTMAX_MAX ? 1 : -1; + int check_size: (size_t) -1 == SIZE_MAX ? 1 : -1; +}; + ]])], + [gl_cv_header_working_stdint_h=yes])]) + fi + if test "$gl_cv_header_working_stdint_h" != yes; then + + dnl Check for , and for + dnl (used in Linux libc4 >= 4.6.7 and libc5). + AC_CHECK_HEADERS([sys/inttypes.h sys/bitypes.h]) + if test $ac_cv_header_sys_inttypes_h = yes; then + HAVE_SYS_INTTYPES_H=1 + else + HAVE_SYS_INTTYPES_H=0 + fi + AC_SUBST([HAVE_SYS_INTTYPES_H]) + if test $ac_cv_header_sys_bitypes_h = yes; then + HAVE_SYS_BITYPES_H=1 + else + HAVE_SYS_BITYPES_H=0 + fi + AC_SUBST([HAVE_SYS_BITYPES_H]) + + gl_STDINT_TYPE_PROPERTIES + STDINT_H=stdint.h + fi + AC_SUBST(STDINT_H) +]) + +dnl gl_STDINT_BITSIZEOF(TYPES, INCLUDES) +dnl Determine the size of each of the given types in bits. +AC_DEFUN([gl_STDINT_BITSIZEOF], +[ + dnl Use a shell loop, to avoid bloating configure, and + dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into + dnl config.h.in, + dnl - extra AC_SUBST calls, so that the right substitutions are made. + AC_FOREACH([gltype], [$1], + [AH_TEMPLATE([BITSIZEOF_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]), + [Define to the number of bits in type ']gltype['.])]) + for gltype in $1 ; do + AC_CACHE_CHECK([for bit size of $gltype], [gl_cv_bitsizeof_${gltype}], + [_AC_COMPUTE_INT([sizeof ($gltype) * CHAR_BIT], result, + [$2 +#include ], [result=unknown]) + eval gl_cv_bitsizeof_${gltype}=\$result + ]) + eval result=\$gl_cv_bitsizeof_${gltype} + if test $result = unknown; then + dnl Use a nonempty default, because some compilers, such as IRIX 5 cc, + dnl do a syntax check even on unused #if conditions and give an error + dnl on valid C code like this: + dnl #if 0 + dnl # if > 32 + dnl # endif + dnl #endif + result=0 + fi + GLTYPE=`echo "$gltype" | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` + AC_DEFINE_UNQUOTED([BITSIZEOF_${GLTYPE}], [$result]) + eval BITSIZEOF_${GLTYPE}=\$result + done + AC_FOREACH([gltype], [$1], + [AC_SUBST([BITSIZEOF_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))]) +]) + +dnl gl_CHECK_TYPES_SIGNED(TYPES, INCLUDES) +dnl Determine the signedness of each of the given types. +dnl Define HAVE_SIGNED_TYPE if type is signed. +AC_DEFUN([gl_CHECK_TYPES_SIGNED], +[ + dnl Use a shell loop, to avoid bloating configure, and + dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into + dnl config.h.in, + dnl - extra AC_SUBST calls, so that the right substitutions are made. + AC_FOREACH([gltype], [$1], + [AH_TEMPLATE([HAVE_SIGNED_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]), + [Define to 1 if ']gltype[' is a signed integer type.])]) + for gltype in $1 ; do + AC_CACHE_CHECK([whether $gltype is signed], [gl_cv_type_${gltype}_signed], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([$2[ + int verify[2 * (($gltype) -1 < ($gltype) 0) - 1];]])], + result=yes, result=no) + eval gl_cv_type_${gltype}_signed=\$result + ]) + eval result=\$gl_cv_type_${gltype}_signed + GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` + if test "$result" = yes; then + AC_DEFINE_UNQUOTED([HAVE_SIGNED_${GLTYPE}], 1) + eval HAVE_SIGNED_${GLTYPE}=1 + else + eval HAVE_SIGNED_${GLTYPE}=0 + fi + done + AC_FOREACH([gltype], [$1], + [AC_SUBST([HAVE_SIGNED_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))]) +]) + +dnl gl_INTEGER_TYPE_SUFFIX(TYPES, INCLUDES) +dnl Determine the suffix to use for integer constants of the given types. +dnl Define t_SUFFIX for each such type. +AC_DEFUN([gl_INTEGER_TYPE_SUFFIX], +[ + dnl Use a shell loop, to avoid bloating configure, and + dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into + dnl config.h.in, + dnl - extra AC_SUBST calls, so that the right substitutions are made. + AC_FOREACH([gltype], [$1], + [AH_TEMPLATE(translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX], + [Define to l, ll, u, ul, ull, etc., as suitable for + constants of type ']gltype['.])]) + for gltype in $1 ; do + AC_CACHE_CHECK([for $gltype integer literal suffix], + [gl_cv_type_${gltype}_suffix], + [eval gl_cv_type_${gltype}_suffix=no + eval result=\$gl_cv_type_${gltype}_signed + if test "$result" = yes; then + glsufu= + else + glsufu=u + fi + for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do + case $glsuf in + '') gltype1='int';; + l) gltype1='long int';; + ll) gltype1='long long int';; + i64) gltype1='__int64';; + u) gltype1='unsigned int';; + ul) gltype1='unsigned long int';; + ull) gltype1='unsigned long long int';; + ui64)gltype1='unsigned __int64';; + esac + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([$2 + extern $gltype foo; + extern $gltype1 foo;])], + [eval gl_cv_type_${gltype}_suffix=\$glsuf]) + eval result=\$gl_cv_type_${gltype}_suffix + test "$result" != no && break + done]) + GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` + eval result=\$gl_cv_type_${gltype}_suffix + test "$result" = no && result= + eval ${GLTYPE}_SUFFIX=\$result + AC_DEFINE_UNQUOTED([${GLTYPE}_SUFFIX], $result) + done + AC_FOREACH([gltype], [$1], + [AC_SUBST(translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX])]) +]) + +dnl gl_STDINT_INCLUDES +AC_DEFUN([gl_STDINT_INCLUDES], +[[ + #include + #include + #if HAVE_WCHAR_H + /* BSD/OS 4.1 has a bug: and must be included before + . */ + # include + # include + # include + #endif +]]) + +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. +AC_DEFUN([gl_STDINT_TYPE_PROPERTIES], +[ + gl_STDINT_BITSIZEOF([ptrdiff_t sig_atomic_t size_t wchar_t wint_t], + [gl_STDINT_INCLUDES]) + gl_CHECK_TYPES_SIGNED([sig_atomic_t wchar_t wint_t], + [gl_STDINT_INCLUDES]) + gl_cv_type_ptrdiff_t_signed=yes + gl_cv_type_size_t_signed=no + gl_INTEGER_TYPE_SUFFIX([ptrdiff_t sig_atomic_t size_t wchar_t wint_t], + [gl_STDINT_INCLUDES]) +]) diff -ruNp m4-1.4.5/m4/stdint_h.m4 m4-1.4.6/m4/stdint_h.m4 --- m4-1.4.5/m4/stdint_h.m4 2006-07-15 16:14:49.000000000 -0600 +++ m4-1.4.6/m4/stdint_h.m4 2006-08-24 11:36:20.000000000 -0600 @@ -1,5 +1,5 @@ -# stdint_h.m4 serial 5 -dnl Copyright (C) 1997-2004 Free Software Foundation, Inc. +# stdint_h.m4 serial 6 +dnl Copyright (C) 1997-2004, 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. @@ -15,7 +15,7 @@ AC_DEFUN([gl_AC_HEADER_STDINT_H], [AC_TRY_COMPILE( [#include #include ], - [uintmax_t i = (uintmax_t) -1;], + [uintmax_t i = (uintmax_t) -1; return !i;], gl_cv_header_stdint_h=yes, gl_cv_header_stdint_h=no)]) if test $gl_cv_header_stdint_h = yes; then diff -ruNp m4-1.4.5/m4/stdio-safer.m4 m4-1.4.6/m4/stdio-safer.m4 --- m4-1.4.5/m4/stdio-safer.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/m4/stdio-safer.m4 2006-08-24 11:36:20.000000000 -0600 @@ -0,0 +1,15 @@ +#serial 8 +dnl Copyright (C) 2002, 2005, 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. + +AC_DEFUN([gl_FOPEN_SAFER], +[ + AC_LIBOBJ([fopen-safer]) +]) + +AC_DEFUN([gl_TMPFILE_SAFER], +[ + AC_LIBOBJ([tmpfile-safer]) +]) diff -ruNp m4-1.4.5/m4/stdlib-safer.m4 m4-1.4.6/m4/stdlib-safer.m4 --- m4-1.4.5/m4/stdlib-safer.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/m4/stdlib-safer.m4 2006-08-24 11:36:20.000000000 -0600 @@ -0,0 +1,10 @@ +# stdlib-safer.m4 serial 2 +dnl Copyright (C) 2005, 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. + +AC_DEFUN([gl_STDLIB_SAFER], +[ + AC_LIBOBJ([mkstemp-safer]) +]) diff -ruNp m4-1.4.5/m4/uintmax_t.m4 m4-1.4.6/m4/uintmax_t.m4 --- m4-1.4.5/m4/uintmax_t.m4 2006-07-15 16:14:50.000000000 -0600 +++ m4-1.4.6/m4/uintmax_t.m4 1969-12-31 17:00:00.000000000 -0700 @@ -1,30 +0,0 @@ -# uintmax_t.m4 serial 9 -dnl Copyright (C) 1997-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. - -dnl From Paul Eggert. - -AC_PREREQ(2.13) - -# Define uintmax_t to 'unsigned long' or 'unsigned long long' -# if it is not already defined in or . - -AC_DEFUN([gl_AC_TYPE_UINTMAX_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_UNSIGNED_LONG_LONG]) - test $ac_cv_type_unsigned_long_long = yes \ - && ac_type='unsigned long long' \ - || ac_type='unsigned long' - AC_DEFINE_UNQUOTED(uintmax_t, $ac_type, - [Define to unsigned long or unsigned long long - if and don't define.]) - else - AC_DEFINE(HAVE_UINTMAX_T, 1, - [Define if you have the 'uintmax_t' type in or .]) - fi -]) diff -ruNp m4-1.4.5/m4/ulonglong.m4 m4-1.4.6/m4/ulonglong.m4 --- m4-1.4.5/m4/ulonglong.m4 2006-07-15 16:14:51.000000000 -0600 +++ m4-1.4.6/m4/ulonglong.m4 1969-12-31 17:00:00.000000000 -0700 @@ -1,43 +0,0 @@ -# ulonglong.m4 serial 5 -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. - -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.5/m4/unistd-safer.m4 m4-1.4.6/m4/unistd-safer.m4 --- m4-1.4.5/m4/unistd-safer.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/m4/unistd-safer.m4 2006-08-24 11:36:21.000000000 -0600 @@ -0,0 +1,13 @@ +#serial 8 +dnl Copyright (C) 2002, 2005, 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. + +AC_DEFUN([gl_UNISTD_SAFER], +[ + AC_CHECK_FUNCS_ONCE([pipe]) + AC_LIBOBJ([dup-safer]) + AC_LIBOBJ([fd-safer]) + AC_LIBOBJ([pipe-safer]) +]) diff -ruNp m4-1.4.5/m4/unlocked-io.m4 m4-1.4.6/m4/unlocked-io.m4 --- m4-1.4.5/m4/unlocked-io.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.6/m4/unlocked-io.m4 2006-08-24 11:36:21.000000000 -0600 @@ -0,0 +1,42 @@ +# unlocked-io.m4 serial 14 + +# Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +# 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. + +dnl From Jim Meyering. +dnl +dnl See if the glibc *_unlocked I/O macros or functions are available. +dnl Use only those *_unlocked macros or functions that are declared +dnl (because some of them were declared in Solaris 2.5.1 but were removed +dnl in Solaris 2.6, whereas we want binaries built on Solaris 2.5.1 to run +dnl on Solaris 2.6). + +AC_DEFUN([gl_FUNC_GLIBC_UNLOCKED_IO], +[ + AC_DEFINE([USE_UNLOCKED_IO], 1, + [Define to 1 if you want getc etc. to use unlocked I/O if available. + Unlocked I/O can improve performance in unithreaded apps, + but it is not safe for multithreaded apps.]) + + dnl Persuade glibc and Solaris to declare + dnl fgets_unlocked(), fputs_unlocked() etc. + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + + AC_CHECK_DECLS_ONCE([clearerr_unlocked]) + AC_CHECK_DECLS_ONCE([feof_unlocked]) + AC_CHECK_DECLS_ONCE([ferror_unlocked]) + AC_CHECK_DECLS_ONCE([fflush_unlocked]) + AC_CHECK_DECLS_ONCE([fgets_unlocked]) + AC_CHECK_DECLS_ONCE([fputc_unlocked]) + AC_CHECK_DECLS_ONCE([fputs_unlocked]) + AC_CHECK_DECLS_ONCE([fread_unlocked]) + AC_CHECK_DECLS_ONCE([fwrite_unlocked]) + AC_CHECK_DECLS_ONCE([getc_unlocked]) + AC_CHECK_DECLS_ONCE([getchar_unlocked]) + AC_CHECK_DECLS_ONCE([putc_unlocked]) + AC_CHECK_DECLS_ONCE([putchar_unlocked]) +]) diff -ruNp m4-1.4.5/m4/wcwidth.m4 m4-1.4.6/m4/wcwidth.m4 --- m4-1.4.5/m4/wcwidth.m4 2006-07-15 16:14:52.000000000 -0600 +++ m4-1.4.6/m4/wcwidth.m4 2006-08-24 11:36:22.000000000 -0600 @@ -1,4 +1,4 @@ -# wcwidth.m4 serial 3 +# wcwidth.m4 serial 5 dnl Copyright (C) 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, @@ -17,10 +17,14 @@ AC_DEFUN([gl_FUNC_WCWIDTH], AC_CHECK_DECLS([wcwidth], [], [], [ /* AIX 3.2.5 declares wcwidth in . */ -#if HAVE_STRING_H -# include -#endif +#include #if HAVE_WCHAR_H +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.1 has a bug: and must be included before + . */ +# include +# include # include #endif ])]) diff -ruNp m4-1.4.5/m4/xalloc.m4 m4-1.4.6/m4/xalloc.m4 --- m4-1.4.5/m4/xalloc.m4 2006-07-15 16:14:53.000000000 -0600 +++ m4-1.4.6/m4/xalloc.m4 2006-08-24 11:36:23.000000000 -0600 @@ -1,12 +1,11 @@ -# xalloc.m4 serial 12 -dnl Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. +# xalloc.m4 serial 13 +dnl Copyright (C) 2002, 2003, 2004, 2005, 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. AC_DEFUN([gl_XALLOC], [ - AC_LIBSOURCES([xmalloc.c, xalloc.h]) AC_LIBOBJ([xmalloc]) gl_PREREQ_XALLOC diff -ruNp m4-1.4.5/src/Makefile.in m4-1.4.6/src/Makefile.in --- m4-1.4.5/src/Makefile.in 2006-07-15 16:24:10.000000000 -0600 +++ m4-1.4.6/src/Makefile.in 2006-08-24 11:47:45.000000000 -0600 @@ -42,23 +42,26 @@ subdir = src DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/absolute-header.m4 \ - $(top_srcdir)/m4/alloca.m4 $(top_srcdir)/m4/codeset.m4 \ + $(top_srcdir)/m4/alloca.m4 $(top_srcdir)/m4/cloexec.m4 \ + $(top_srcdir)/m4/close-stream.m4 $(top_srcdir)/m4/codeset.m4 \ $(top_srcdir)/m4/eoverflow.m4 $(top_srcdir)/m4/error.m4 \ $(top_srcdir)/m4/exitfail.m4 $(top_srcdir)/m4/extensions.m4 \ + $(top_srcdir)/m4/fpending.m4 $(top_srcdir)/m4/free.m4 \ $(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gnulib-comp.m4 \ $(top_srcdir)/m4/intmax_t.m4 $(top_srcdir)/m4/inttypes_h.m4 \ $(top_srcdir)/m4/longdouble.m4 $(top_srcdir)/m4/longlong.m4 \ $(top_srcdir)/m4/mbchar.m4 $(top_srcdir)/m4/mbiter.m4 \ $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/memchr.m4 \ - $(top_srcdir)/m4/mkstemp.m4 $(top_srcdir)/m4/obstack.m4 \ - $(top_srcdir)/m4/regex.m4 $(top_srcdir)/m4/restrict.m4 \ + $(top_srcdir)/m4/mkstemp.m4 $(top_srcdir)/m4/regex.m4 \ $(top_srcdir)/m4/signed.m4 $(top_srcdir)/m4/size_max.m4 \ $(top_srcdir)/m4/ssize_t.m4 $(top_srcdir)/m4/stat-macros.m4 \ $(top_srcdir)/m4/stdarg.m4 $(top_srcdir)/m4/stdbool.m4 \ - $(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/strcase.m4 \ + $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdint_h.m4 \ + $(top_srcdir)/m4/stdio-safer.m4 \ + $(top_srcdir)/m4/stdlib-safer.m4 $(top_srcdir)/m4/strcase.m4 \ $(top_srcdir)/m4/strtol.m4 $(top_srcdir)/m4/sys_stat_h.m4 \ - $(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/ulonglong.m4 \ - $(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/vasnprintf.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.m4 $(top_srcdir)/m4/wchar_t.m4 \ $(top_srcdir)/m4/wcwidth.m4 $(top_srcdir)/m4/wint_t.m4 \ $(top_srcdir)/m4/xalloc.m4 $(top_srcdir)/m4/xsize.m4 \ @@ -93,6 +96,7 @@ DIST_SOURCES = $(am__m4_SOURCES_DIST) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ABSOLUTE_STDINT_H = @ABSOLUTE_STDINT_H@ ABSOLUTE_SYS_STAT_H = @ABSOLUTE_SYS_STAT_H@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ @@ -104,6 +108,11 @@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +BITSIZEOF_PTRDIFF_T = @BITSIZEOF_PTRDIFF_T@ +BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@ +BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@ +BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@ +BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ @@ -122,6 +131,16 @@ GETOPT_H = @GETOPT_H@ GL_COND_LIBTOOL_FALSE = @GL_COND_LIBTOOL_FALSE@ GL_COND_LIBTOOL_TRUE = @GL_COND_LIBTOOL_TRUE@ GREP = @GREP@ +HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ +HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ +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_STDINT_H = @HAVE_STDINT_H@ +HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@ +HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@ +HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ +HAVE_WCHAR_H = @HAVE_WCHAR_H@ HAVE__BOOL = @HAVE__BOOL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -140,16 +159,22 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@ +SIZE_T_SUFFIX = @SIZE_T_SUFFIX@ STACKOVF_FALSE = @STACKOVF_FALSE@ STACKOVF_TRUE = @STACKOVF_TRUE@ STDBOOL_H = @STDBOOL_H@ +STDINT_H = @STDINT_H@ STRIP = @STRIP@ SYS_STAT_H = @SYS_STAT_H@ UNISTD_H = @UNISTD_H@ VERSION = @VERSION@ +WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ +WINT_T_SUFFIX = @WINT_T_SUFFIX@ ac_ct_CC = @ac_ct_CC@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ diff -ruNp m4-1.4.5/src/builtin.c m4-1.4.6/src/builtin.c --- m4-1.4.5/src/builtin.c 2006-07-14 14:15:46.000000000 -0600 +++ m4-1.4.6/src/builtin.c 2006-08-24 07:43:14.000000000 -0600 @@ -39,10 +39,11 @@ extern FILE *popen (); builtin. */ #define DECLARE(name) \ - static void name _((struct obstack *, int, token_data **)) + static void name (struct obstack *, int, token_data **) DECLARE (m4___file__); DECLARE (m4___line__); +DECLARE (m4___program__); DECLARE (m4_builtin); DECLARE (m4_changecom); DECLARE (m4_changequote); @@ -97,6 +98,7 @@ builtin_tab[] = { "__file__", TRUE, FALSE, FALSE, m4___file__ }, { "__line__", TRUE, FALSE, FALSE, m4___line__ }, + { "__program__", TRUE, FALSE, FALSE, m4___program__ }, { "builtin", TRUE, FALSE, TRUE, m4_builtin }, { "changecom", FALSE, FALSE, FALSE, m4_changecom }, { "changequote", FALSE, FALSE, FALSE, m4_changequote }, @@ -112,7 +114,7 @@ builtin_tab[] = { "divnum", FALSE, FALSE, FALSE, m4_divnum }, { "dnl", FALSE, FALSE, FALSE, m4_dnl }, { "dumpdef", FALSE, FALSE, FALSE, m4_dumpdef }, - { "errprint", FALSE, FALSE, FALSE, m4_errprint }, + { "errprint", FALSE, FALSE, TRUE, m4_errprint }, { "esyscmd", TRUE, FALSE, TRUE, m4_esyscmd }, { "eval", FALSE, FALSE, TRUE, m4_eval }, { "format", TRUE, FALSE, TRUE, m4_format }, @@ -124,13 +126,13 @@ builtin_tab[] = { "indir", TRUE, FALSE, TRUE, m4_indir }, { "len", FALSE, FALSE, TRUE, m4_len }, { "m4exit", FALSE, FALSE, FALSE, m4_m4exit }, - { "m4wrap", FALSE, FALSE, FALSE, m4_m4wrap }, + { "m4wrap", FALSE, FALSE, TRUE, m4_m4wrap }, { "maketemp", FALSE, FALSE, TRUE, m4_maketemp }, { "patsubst", TRUE, FALSE, TRUE, m4_patsubst }, { "popdef", FALSE, FALSE, TRUE, m4_popdef }, { "pushdef", FALSE, TRUE, TRUE, m4_pushdef }, { "regexp", TRUE, FALSE, TRUE, m4_regexp }, - { "shift", FALSE, FALSE, FALSE, m4_shift }, + { "shift", FALSE, FALSE, TRUE, m4_shift }, { "sinclude", FALSE, FALSE, TRUE, m4_sinclude }, { "substr", FALSE, FALSE, TRUE, m4_substr }, { "syscmd", FALSE, FALSE, TRUE, m4_syscmd }, @@ -230,7 +232,7 @@ define_user_macro (const char *name, con s = lookup_symbol (name, mode); if (SYMBOL_TYPE (s) == TOKEN_TEXT) - xfree (SYMBOL_TEXT (s)); + free (SYMBOL_TEXT (s)); SYMBOL_TYPE (s) = TOKEN_TEXT; SYMBOL_TEXT (s) = xstrdup (text); @@ -481,7 +483,6 @@ define_macro (int argc, token_data **arg "INTERNAL ERROR: bad token data type in define_macro ()")); abort (); } - return; } static void @@ -870,7 +871,7 @@ m4_esyscmd (struct obstack *obs, int arg if (pin == NULL) { M4ERROR ((warning_status, errno, - "cannot open pipe to command \"%s\"", ARG (1))); + "cannot open pipe to command `%s'", ARG (1))); sysval = -1; } else @@ -1049,7 +1050,7 @@ m4_undivert (struct obstack *obs, int ar "non-numeric argument to builtin `%s'", ARG (0))); else { - fp = path_search (ARG (i)); + fp = path_search (ARG (i), NULL); if (fp != NULL) { insert_file (fp); @@ -1088,6 +1089,8 @@ m4_dnl (struct obstack *obs, int argc, t static void m4_shift (struct obstack *obs, int argc, token_data **argv) { + if (bad_argc (argv[0], argc, 2, -1)) + return; dump_args (obs, argc - 1, argv + 1, ",", TRUE); } @@ -1154,11 +1157,12 @@ static void include (int argc, token_data **argv, boolean silent) { FILE *fp; + const char *name; if (bad_argc (argv[0], argc, 2, 2)) return; - fp = path_search (ARG (1)); + fp = path_search (ARG (1), &name); if (fp == NULL) { if (!silent) @@ -1167,7 +1171,8 @@ include (int argc, token_data **argv, bo return; } - push_file (fp, ARG (1)); + push_file (fp, name); + free ((char *) name); } /*------------------------------------------------. @@ -1190,8 +1195,8 @@ m4_sinclude (struct obstack *obs, int ar include (argc, argv, TRUE); } -/* More miscellaneous builtins -- "maketemp", "errprint", "__file__" and - "__line__". The last two are GNU specific. */ +/* More miscellaneous builtins -- "maketemp", "errprint", "__file__", + "__line__", and "__program__". The last three are GNU specific. */ /*------------------------------------------------------------------. | Use the first argument as at template for a temporary file name. | @@ -1221,8 +1226,11 @@ m4_maketemp (struct obstack *obs, int ar static void m4_errprint (struct obstack *obs, int argc, token_data **argv) { + if (bad_argc (argv[0], argc, 2, -1)) + return; dump_args (obs, argc, argv, " ", FALSE); obstack_1grow (obs, '\0'); + debug_flush_files (); fprintf (stderr, "%s", (char *) obstack_finish (obs)); fflush (stderr); } @@ -1244,6 +1252,16 @@ m4___line__ (struct obstack *obs, int ar return; shipout_int (obs, current_line); } + +static void +m4___program__ (struct obstack *obs, int argc, token_data **argv) +{ + if (bad_argc (argv[0], argc, 1, 1)) + return; + obstack_grow (obs, lquote.string, lquote.length); + obstack_grow (obs, program_name, strlen (program_name)); + obstack_grow (obs, rquote.string, rquote.length); +} /* This section contains various macros for exiting, saving input until EOF is seen, and tracing macro calls. That is: "m4exit", "m4wrap", @@ -1257,13 +1275,29 @@ m4___line__ (struct obstack *obs, int ar static void m4_m4exit (struct obstack *obs, int argc, token_data **argv) { - int exit_code = 0; - - if (bad_argc (argv[0], argc, 1, 2)) - return; - if (argc >= 2 && !numeric_arg (argv[0], ARG (1), &exit_code)) - exit_code = 0; + int exit_code = EXIT_SUCCESS; + /* Warn on bad arguments, but still exit. */ + bad_argc (argv[0], argc, 1, 2); + if (argc >= 2 && !numeric_arg (argv[0], ARG (1), &exit_code)) + exit_code = EXIT_FAILURE; + if (exit_code < 0 || exit_code > 255) + { + M4ERROR ((warning_status, 0, + "exit status out of range: `%d'", exit_code)); + exit_code = EXIT_FAILURE; + } + if (close_stream (stdout) != 0) + { + M4ERROR ((warning_status, errno, "write error")); + if (exit_code == 0) + exit_code = EXIT_FAILURE; + } + /* Change debug stream back to stderr, to force flushing debug stream and + detect any errors it might have encountered. */ + debug_set_output (NULL); + if (exit_code == 0 && retcode != 0) + exit_code = retcode; exit (exit_code); } @@ -1276,6 +1310,8 @@ m4_m4exit (struct obstack *obs, int argc static void m4_m4wrap (struct obstack *obs, int argc, token_data **argv) { + if (bad_argc (argv[0], argc, 2, -1)) + return; if (no_gnu_extensions) obstack_grow (obs, ARG (1), strlen (ARG (1))); else @@ -1439,7 +1475,12 @@ m4_index (struct obstack *obs, int argc, int l1, l2, retval; if (bad_argc (argv[0], argc, 3, 3)) - return; + { + /* builtin(`index') is blank, but index(`abc') is 0. */ + if (argc == 2) + shipout_int (obs, 0); + return; + } l1 = strlen (ARG (1)); l2 = strlen (ARG (2)); @@ -1470,7 +1511,12 @@ m4_substr (struct obstack *obs, int argc int length, avail; if (bad_argc (argv[0], argc, 3, 4)) - return; + { + /* builtin(`substr') is blank, but substr(`abc') is abc. */ + if (argc == 2) + obstack_grow (obs, ARG (1), strlen (ARG (1))); + return; + } length = avail = strlen (ARG (1)); if (!numeric_arg (argv[0], ARG (2), &start)) @@ -1548,7 +1594,12 @@ m4_translit (struct obstack *obs, int ar int tolen; if (bad_argc (argv[0], argc, 3, 4)) - return; + { + /* builtin(`translit') is blank, but translit(`abc') is abc. */ + if (argc == 2) + obstack_grow (obs, ARG (1), strlen (ARG (1))); + return; + } from = ARG (2); if (strchr (from, '-') != NULL) @@ -1646,18 +1697,18 @@ Warning: \\0 will disappear, use \\& ins case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': ch -= '0'; - if (regs->end[ch] > 0) - obstack_grow (obs, victim + regs->start[ch], - regs->end[ch] - regs->start[ch]); - else + if (regs->num_regs - 1 <= 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")); - break; + return; default: obstack_1grow (obs, ch); @@ -1666,6 +1717,33 @@ Warning: trailing \\ ignored in replacem } } +/*------------------------------------------. +| Initialize regular expression variables. | +`------------------------------------------*/ + +static void +init_pattern_buffer (struct re_pattern_buffer *buf, struct re_registers *regs) +{ + buf->translate = NULL; + buf->fastmap = NULL; + buf->buffer = NULL; + buf->allocated = 0; + regs->start = NULL; + regs->end = NULL; +} + +/*----------------------------------------. +| Clean up regular expression variables. | +`----------------------------------------*/ + +static void +free_pattern_buffer (struct re_pattern_buffer *buf, struct re_registers *regs) +{ + regfree (buf); + free (regs->start); + free (regs->end); +} + /*--------------------------------------------------------------------------. | Regular expression version of index. Given two arguments, expand to the | | index of the first match of the second argument (a regexp) in the first. | @@ -1687,36 +1765,36 @@ m4_regexp (struct obstack *obs, int argc int length; /* length of first argument */ if (bad_argc (argv[0], argc, 3, 4)) - return; + { + /* builtin(`regexp') is blank, but regexp(`abc') is 0. */ + if (argc == 2) + shipout_int (obs, 0); + return; + } victim = TOKEN_DATA_TEXT (argv[1]); regexp = TOKEN_DATA_TEXT (argv[2]); - buf.buffer = NULL; - buf.allocated = 0; - buf.fastmap = NULL; - buf.translate = NULL; + init_pattern_buffer (&buf, ®s); msg = re_compile_pattern (regexp, strlen (regexp), &buf); if (msg != NULL) { M4ERROR ((warning_status, 0, "bad regular expression: `%s': %s", regexp, msg)); + free_pattern_buffer (&buf, ®s); return; } length = strlen (victim); - startpos = re_search (&buf, victim, length, 0, length, ®s); - xfree (buf.buffer); - - if (startpos == -2) - { - M4ERROR ((warning_status, 0, - "error matching regular expression \"%s\"", regexp)); - return; - } + /* Avoid overhead of allocating regs if we won't use it. */ + startpos = re_search (&buf, victim, length, 0, length, + argc == 3 ? NULL : ®s); - if (argc == 3) + if (startpos == -2) + M4ERROR ((warning_status, 0, + "error matching regular expression `%s'", regexp)); + else if (argc == 3) shipout_int (obs, startpos); else if (startpos >= 0) { @@ -1724,7 +1802,7 @@ m4_regexp (struct obstack *obs, int argc substitute (obs, victim, repl, ®s); } - return; + free_pattern_buffer (&buf, ®s); } /*--------------------------------------------------------------------------. @@ -1748,22 +1826,23 @@ m4_patsubst (struct obstack *obs, int ar int length; /* length of first argument */ if (bad_argc (argv[0], argc, 3, 4)) - return; + { + /* builtin(`patsubst') is blank, but patsubst(`abc') is abc. */ + if (argc == 2) + obstack_grow (obs, ARG (1), strlen (ARG (1))); + return; + } regexp = TOKEN_DATA_TEXT (argv[2]); - buf.buffer = NULL; - buf.allocated = 0; - buf.fastmap = NULL; - buf.translate = NULL; + init_pattern_buffer (&buf, ®s); msg = re_compile_pattern (regexp, strlen (regexp), &buf); if (msg != NULL) { M4ERROR ((warning_status, 0, "bad regular expression `%s': %s", regexp, msg)); - if (buf.buffer != NULL) - xfree (buf.buffer); + free (buf.buffer); return; } @@ -1772,7 +1851,7 @@ m4_patsubst (struct obstack *obs, int ar offset = 0; matchpos = 0; - while (offset < length) + while (offset <= length) { matchpos = re_search (&buf, victim, length, offset, length - offset, ®s); @@ -1785,7 +1864,7 @@ m4_patsubst (struct obstack *obs, int ar if (matchpos == -2) M4ERROR ((warning_status, 0, - "error matching regular expression \"%s\"", regexp)); + "error matching regular expression `%s'", regexp)); else if (offset < length) obstack_grow (obs, victim + offset, length - offset); break; @@ -1810,8 +1889,7 @@ m4_patsubst (struct obstack *obs, int ar } obstack_1grow (obs, '\0'); - xfree (buf.buffer); - return; + free_pattern_buffer (&buf, ®s); } /* Finally, a placeholder builtin. This builtin is not installed by diff -ruNp m4-1.4.5/src/debug.c m4-1.4.6/src/debug.c --- m4-1.4.5/src/debug.c 2006-06-30 09:35:27.000000000 -0600 +++ m4-1.4.6/src/debug.c 2006-08-23 05:28:14.000000000 -0600 @@ -21,13 +21,8 @@ #include "m4.h" -#include - -#ifdef __STDC__ #include -#else -#include -#endif +#include /* File for debugging output. */ FILE *debug = NULL; @@ -37,7 +32,7 @@ static struct obstack trace; extern int expansion_level; -static void debug_set_file _((FILE *)); +static void debug_set_file (FILE *); /*----------------------------------. | Initialise the debugging module. | @@ -137,8 +132,12 @@ debug_set_file (FILE *fp) { struct stat stdout_stat, debug_stat; - if (debug != NULL && debug != stderr && debug != stdout) - fclose (debug); + if (debug != NULL && debug != stderr && debug != stdout + && close_stream (debug) != 0) + { + M4ERROR ((warning_status, errno, "error writing to debug stream")); + retcode = EXIT_FAILURE; + } debug = fp; if (debug != NULL && debug != stdout) @@ -154,8 +153,12 @@ debug_set_file (FILE *fp) && stdout_stat.st_dev == debug_stat.st_dev && stdout_stat.st_ino != 0) { - if (debug != stderr) - fclose (debug); + if (debug != stderr && close_stream (debug) != 0) + { + M4ERROR ((warning_status, errno, + "error writing to debug stream")); + retcode = EXIT_FAILURE; + } debug = stdout; } } @@ -195,6 +198,9 @@ debug_set_output (const char *name) if (fp == NULL) return FALSE; + if (set_cloexec_flag (fileno (fp), true) != 0) + M4ERROR ((warning_status, errno, + "Warning: cannot protect debug file across forks")); debug_set_file (fp); } return TRUE; @@ -207,11 +213,15 @@ debug_set_output (const char *name) void debug_message_prefix (void) { - fprintf (debug, "m4 debug: "); - if (debug_level & DEBUG_TRACE_FILE) - fprintf (debug, "%s: ", current_file); - if (debug_level & DEBUG_TRACE_LINE) - fprintf (debug, "%d: ", current_line); + fprintf (debug, "m4debug:"); + if (current_line) + { + if (debug_level & DEBUG_TRACE_FILE) + fprintf (debug, "%s:", current_file); + if (debug_level & DEBUG_TRACE_LINE) + fprintf (debug, "%d:", current_line); + } + putc (' ', debug); } /* The rest of this file contains the functions for macro tracing output. @@ -226,17 +236,9 @@ debug_message_prefix (void) | left quote) and %r (optional right quote). | `---------------------------------------------------------------------*/ -#ifdef __STDC__ static void trace_format (const char *fmt, ...) -#else -static void -trace_format (...) -#endif { -#ifndef __STDC__ - const char *fmt; -#endif va_list args; char ch; @@ -246,12 +248,7 @@ trace_format (...) int slen; int maxlen; -#ifdef __STDC__ va_start (args, fmt); -#else - va_start (args); - fmt = va_arg (args, const char *); -#endif while (TRUE) { @@ -312,10 +309,13 @@ static void trace_header (int id) { trace_format ("m4trace:"); - if (debug_level & DEBUG_TRACE_FILE) - trace_format ("%s:", current_file); - if (debug_level & DEBUG_TRACE_LINE) - trace_format ("%d:", current_line); + if (current_line) + { + if (debug_level & DEBUG_TRACE_FILE) + trace_format ("%s:", current_file); + if (debug_level & DEBUG_TRACE_LINE) + trace_format ("%d:", current_line); + } trace_format (" -%d- ", expansion_level); if (debug_level & DEBUG_TRACE_CALLID) trace_format ("id %d: ", id); diff -ruNp m4-1.4.5/src/eval.c m4-1.4.6/src/eval.c --- m4-1.4.5/src/eval.c 2006-07-14 13:47:20.000000000 -0600 +++ m4-1.4.6/src/eval.c 2006-07-28 06:17:31.000000000 -0600 @@ -58,20 +58,20 @@ typedef enum eval_error } eval_error; -static eval_error logical_or_term _((eval_token, eval_t *)); -static eval_error logical_and_term _((eval_token, eval_t *)); -static eval_error or_term _((eval_token, eval_t *)); -static eval_error xor_term _((eval_token, eval_t *)); -static eval_error and_term _((eval_token, eval_t *)); -static eval_error not_term _((eval_token, eval_t *)); -static eval_error logical_not_term _((eval_token, eval_t *)); -static eval_error cmp_term _((eval_token, eval_t *)); -static eval_error shift_term _((eval_token, eval_t *)); -static eval_error add_term _((eval_token, eval_t *)); -static eval_error mult_term _((eval_token, eval_t *)); -static eval_error exp_term _((eval_token, eval_t *)); -static eval_error unary_term _((eval_token, eval_t *)); -static eval_error simple_term _((eval_token, eval_t *)); +static eval_error logical_or_term (eval_token, eval_t *); +static eval_error logical_and_term (eval_token, eval_t *); +static eval_error or_term (eval_token, eval_t *); +static eval_error xor_term (eval_token, eval_t *); +static eval_error and_term (eval_token, eval_t *); +static eval_error not_term (eval_token, eval_t *); +static eval_error logical_not_term (eval_token, eval_t *); +static eval_error cmp_term (eval_token, eval_t *); +static eval_error shift_term (eval_token, eval_t *); +static eval_error add_term (eval_token, eval_t *); +static eval_error mult_term (eval_token, eval_t *); +static eval_error exp_term (eval_token, eval_t *); +static eval_error unary_term (eval_token, eval_t *); +static eval_error simple_term (eval_token, eval_t *); /*--------------------. | Lexical functions. | diff -ruNp m4-1.4.5/src/format.c m4-1.4.6/src/format.c --- m4-1.4.5/src/format.c 2006-06-29 21:38:49.000000000 -0600 +++ m4-1.4.6/src/format.c 2006-07-22 15:33:36.000000000 -0600 @@ -200,6 +200,9 @@ format (struct obstack *obs, int argc, t case 'e': case 'E': case 'f': + case 'F': + case 'g': + case 'G': datatype = DOUBLE; break; @@ -277,6 +280,9 @@ format (struct obstack *obs, int argc, t else str = xasprintf (fstart, ARG_STR(argc, argv)); break; + + default: + abort(); } *fmt = c; diff -ruNp m4-1.4.5/src/freeze.c m4-1.4.6/src/freeze.c --- m4-1.4.5/src/freeze.c 2006-07-06 20:46:39.000000000 -0600 +++ m4-1.4.6/src/freeze.c 2006-07-29 20:51:16.000000000 -0600 @@ -148,7 +148,8 @@ INTERNAL ERROR: bad token data type in f /* All done. */ fputs ("# End of frozen state file\n", file); - fclose (file); + if (close_stream (file) != 0) + M4ERROR ((EXIT_FAILURE, errno, "unable to create frozen state")); } /*----------------------------------------------------------------------. @@ -221,7 +222,7 @@ reload_frozen_state (const char *name) } \ while (character == '\n') - file = path_search (name); + file = path_search (name, NULL); if (file == NULL) M4ERROR ((EXIT_FAILURE, errno, "cannot open %s", name)); @@ -234,8 +235,14 @@ reload_frozen_state (const char *name) GET_DIRECTIVE; VALIDATE ('V'); GET_CHARACTER; - VALIDATE ('1'); - GET_CHARACTER; + GET_NUMBER (number[0]); + if (number[0] > 1) + M4ERROR ((EXIT_MISMATCH, 0, + "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")); VALIDATE ('\n'); GET_DIRECTIVE; @@ -361,7 +368,9 @@ reload_frozen_state (const char *name) free (string[0]); free (string[1]); - fclose (file); + errno = 0; + if (ferror (file) || fclose (file) != 0) + M4ERROR ((EXIT_FAILURE, errno, "unable to read frozen state")); #undef GET_CHARACTER #undef GET_DIRECTIVE diff -ruNp m4-1.4.5/src/input.c m4-1.4.6/src/input.c --- m4-1.4.5/src/input.c 2006-07-14 13:47:20.000000000 -0600 +++ m4-1.4.6/src/input.c 2006-08-22 18:20:13.000000000 -0600 @@ -140,14 +140,20 @@ STRING ecomm; #ifdef ENABLE_CHANGEWORD -#define DEFAULT_WORD_REGEXP "[_a-zA-Z][_a-zA-Z0-9]*" +# define DEFAULT_WORD_REGEXP "[_a-zA-Z][_a-zA-Z0-9]*" static char *word_start; static struct re_pattern_buffer word_regexp; static int default_word_regexp; static struct re_registers regs; -#endif /* ENABLE_CHANGEWORD */ +#else /* ! ENABLE_CHANGEWORD */ +# define default_word_regexp 1 +#endif /* ! ENABLE_CHANGEWORD */ + +#ifdef DEBUG_INPUT +static const char *token_type_string (token_type); +#endif /*-------------------------------------------------------------------------. @@ -229,7 +235,7 @@ push_string_init (void) } next = (input_block *) obstack_alloc (current_input, - sizeof (struct input_block)); + sizeof (struct input_block)); next->type = INPUT_STRING; return current_input; } @@ -276,8 +282,9 @@ push_string_finish (void) void push_wrapup (const char *s) { - input_block *i = (input_block *) obstack_alloc (wrapup_stack, - sizeof (struct input_block)); + input_block *i; + i = (input_block *) obstack_alloc (wrapup_stack, + sizeof (struct input_block)); i->prev = wsp; i->type = INPUT_STRING; i->u.u_s.string = obstack_copy0 (wrapup_stack, s, strlen (s)); @@ -304,16 +311,45 @@ pop_input (void) case INPUT_FILE: if (debug_level & DEBUG_TRACE_INPUT) - DEBUG_MESSAGE2 ("input reverted to %s, line %d", - isp->u.u_f.name, isp->u.u_f.lineno); + { + if (isp->u.u_f.lineno) + DEBUG_MESSAGE2 ("input reverted to %s, line %d", + isp->u.u_f.name, isp->u.u_f.lineno); + else + DEBUG_MESSAGE ("input exhausted"); + } - fclose (isp->u.u_f.file); + if (ferror (isp->u.u_f.file)) + { + M4ERROR ((warning_status, 0, "read error")); + fclose (isp->u.u_f.file); + retcode = EXIT_FAILURE; + } + else if (fclose (isp->u.u_f.file) == EOF) + { + M4ERROR ((warning_status, errno, "error reading file")); + retcode = EXIT_FAILURE; + } current_file = isp->u.u_f.name; current_line = isp->u.u_f.lineno; output_current_line = isp->u.u_f.out_lineno; start_of_input_line = isp->u.u_f.advance_line; - if (tmp != NULL) - output_current_line = -1; + if (tmp == NULL) + { + /* We have exhausted the current input stack. However, + freeing the obstack now is a bad idea, since if we are in + the middle of a quote, comment, dnl, or argument + collection, there is still a pointer to the former + current_file that we must not invalidate until after the + warning message has been issued. Setting next to a + non-string is safe in this case, because the only place + more input could come from is another push_file or + pop_wrapup, both of which then free the input_block. */ + next = isp; + isp = NULL; + return; + } + output_current_line = -1; break; default: @@ -336,13 +372,14 @@ pop_input (void) boolean pop_wrapup (void) { + next = NULL; obstack_free (current_input, NULL); - xfree (current_input); + free (current_input); if (wsp == NULL) { obstack_free (wrapup_stack, NULL); - xfree (wrapup_stack); + free (wrapup_stack); return FALSE; } @@ -383,10 +420,10 @@ init_macro_token (token_data *td) | input stack. | `------------------------------------------------------------------------*/ -int +static int peek_input (void) { - register int ch; + int ch; while (1) { @@ -396,7 +433,7 @@ peek_input (void) switch (isp->type) { case INPUT_STRING: - ch = isp->u.u_s.string[0]; + ch = to_uchar (isp->u.u_s.string[0]); if (ch != '\0') return ch; break; @@ -435,13 +472,13 @@ peek_input (void) #define next_char() \ (isp && isp->type == INPUT_STRING && isp->u.u_s.string[0] \ - ? *isp->u.u_s.string++ \ + ? to_uchar (*isp->u.u_s.string++) \ : next_char_1 ()) static int next_char_1 (void) { - register int ch; + int ch; if (start_of_input_line) { @@ -457,7 +494,7 @@ next_char_1 (void) switch (isp->type) { case INPUT_STRING: - ch = *isp->u.u_s.string++; + ch = to_uchar (*isp->u.u_s.string++); if (ch != '\0') return ch; break; @@ -497,42 +534,61 @@ void skip_line (void) { int ch; + const char *file = current_file; + int line = current_line; while ((ch = next_char ()) != CHAR_EOF && ch != '\n') ; + if (ch == CHAR_EOF) + /* current_file changed to "" if we see CHAR_EOF, use the + previous value we stored earlier. */ + M4ERROR_AT_LINE ((warning_status, 0, file, line, + "Warning: end of file treated as newline")); } -/*----------------------------------------------------------------------. -| This function is for matching a string against a prefix of the input | -| stream. If the string matches the input, the input is discarded, | -| otherwise the characters read are pushed back again. The function is | -| used only when multicharacter quotes or comment delimiters are used. | -`----------------------------------------------------------------------*/ +/*------------------------------------------------------------------. +| This function is for matching a string against a prefix of the | +| input stream. If the string matches the input and consume is | +| TRUE, the input is discarded; otherwise any characters read are | +| pushed back again. The function is used only when multicharacter | +| quotes or comment delimiters are used. | +`------------------------------------------------------------------*/ -static int -match_input (const char *s) +static boolean +match_input (const char *s, boolean consume) { int n; /* number of characters matched */ int ch; /* input character */ const char *t; + boolean result = FALSE; ch = peek_input (); - if (ch != *s) - return 0; /* fail */ - (void) next_char (); + if (ch != to_uchar (*s)) + return FALSE; /* fail */ if (s[1] == '\0') - return 1; /* short match */ + { + if (consume) + (void) next_char (); + return TRUE; /* short match */ + } - for (n = 1, t = s++; (ch = peek_input ()) == *s++; n++) + (void) next_char (); + for (n = 1, t = s++; (ch = peek_input ()) == to_uchar (*s++); ) { (void) next_char (); + n++; if (*s == '\0') /* long match */ - return 1; + { + if (consume) + return TRUE; + result = TRUE; + break; + } } - /* Failed, push back input. */ + /* Failed or shouldn't consume, push back input. */ { struct obstack *h = push_string_init (); @@ -540,21 +596,23 @@ match_input (const char *s) obstack_grow (h, t, n); } push_string_finish (); - return 0; + return result; } -/*------------------------------------------------------------------------. -| The macro MATCH() is used to match a string against the input. The | -| first character is handled inline, for speed. Hopefully, this will not | -| hurt efficiency too much when single character quotes and comment | -| delimiters are used. | -`------------------------------------------------------------------------*/ - -#define MATCH(ch, s) \ - ((s)[0] == (ch) \ - && (ch) != '\0' \ - && ((s)[1] == '\0' \ - || (match_input ((s) + 1) ? (ch) = peek_input (), 1 : 0))) +/*--------------------------------------------------------------------. +| The macro MATCH() is used to match a string S against the input. | +| The first character is handled inline, for speed. Hopefully, this | +| will not hurt efficiency too much when single character quotes and | +| comment delimiters are used. If CONSUME, then CH is the result of | +| next_char, and a successful match will discard the matched string. | +| Otherwise, CH is the result of peek_char, and the input stream is | +| effectively unchanged. | +`--------------------------------------------------------------------*/ + +#define MATCH(ch, s, consume) \ + (to_uchar ((s)[0]) == (ch) \ + && (ch) != '\0' \ + && ((s)[1] == '\0' || (match_input ((s) + (consume), consume)))) /*----------------------------------------------------------. @@ -564,7 +622,7 @@ match_input (const char *s) void input_init (void) { - current_file = "NONE"; + current_file = ""; current_line = 0; obstack_init (&token_stack); @@ -606,8 +664,8 @@ input_init (void) void set_quotes (const char *lq, const char *rq) { - xfree (lquote.string); - xfree (rquote.string); + free (lquote.string); + free (rquote.string); lquote.string = xstrdup (lq ? lq : DEF_LQUOTE); lquote.length = strlen (lquote.string); @@ -618,8 +676,8 @@ set_quotes (const char *lq, const char * void set_comment (const char *bc, const char *ec) { - xfree (bcomm.string); - xfree (ecomm.string); + free (bcomm.string); + free (ecomm.string); bcomm.string = xstrdup (bc ? bc : DEF_BCOMM); bcomm.length = strlen (bcomm.string); @@ -629,12 +687,12 @@ set_comment (const char *bc, const char #ifdef ENABLE_CHANGEWORD -void +static void init_pattern_buffer (struct re_pattern_buffer *buf) { - buf->translate = 0; - buf->fastmap = 0; - buf->buffer = 0; + buf->translate = NULL; + buf->fastmap = NULL; + buf->buffer = NULL; buf->allocated = 0; } @@ -666,7 +724,9 @@ set_word_regexp (const char *regexp) /* If compilation worked, retry using the word_regexp struct. Can't rely on struct assigns working, so redo the compilation. */ + regfree (&word_regexp); msg = re_compile_pattern (regexp, strlen (regexp), &word_regexp); + re_set_registers (&word_regexp, ®s, regs.num_regs, regs.start, regs.end); if (msg != NULL) { @@ -685,8 +745,7 @@ set_word_regexp (const char *regexp) for (i = 1; i < 256; i++) { test[0] = i; - if (re_search (&word_regexp, test, 1, 0, 0, ®s) >= 0) - strcat (word_start, test); + word_start[i] = re_search (&word_regexp, test, 1, 0, 0, NULL) >= 0; } } @@ -717,6 +776,8 @@ next_token (token_data *td) int startpos; char *orig_text = 0; #endif + const char *file = current_file; + int line = current_line; obstack_free (&token_stack, token_bottom); obstack_1grow (&token_stack, '\0'); @@ -734,24 +795,31 @@ next_token (token_data *td) { init_macro_token (td); (void) next_char (); +#ifdef DEBUG_INPUT + fprintf (stderr, "next_token -> MACDEF (%s)\n", + find_builtin_by_addr (TOKEN_DATA_FUNC (td))->name); +#endif return TOKEN_MACDEF; } (void) next_char (); - if (MATCH (ch, bcomm.string)) + if (MATCH (ch, bcomm.string, TRUE)) { obstack_grow (&token_stack, bcomm.string, bcomm.length); - while ((ch = next_char ()) != CHAR_EOF && !MATCH (ch, ecomm.string)) + while ((ch = next_char ()) != CHAR_EOF + && !MATCH (ch, ecomm.string, TRUE)) obstack_1grow (&token_stack, ch); if (ch != CHAR_EOF) obstack_grow (&token_stack, ecomm.string, ecomm.length); + else + /* current_file changed to "" if we see CHAR_EOF, use the + previous value we stored earlier. */ + M4ERROR_AT_LINE ((EXIT_FAILURE, 0, file, line, + "ERROR: end of file in comment")); + type = TOKEN_STRING; } -#ifdef ENABLE_CHANGEWORD else if (default_word_regexp && (isalpha (ch) || ch == '_')) -#else - else if (isalpha (ch) || ch == '_') -#endif { obstack_1grow (&token_stack, ch); while ((ch = peek_input ()) != CHAR_EOF && (isalnum (ch) || ch == '_')) @@ -764,11 +832,11 @@ next_token (token_data *td) #ifdef ENABLE_CHANGEWORD - else if (!default_word_regexp && strchr (word_start, ch)) + else if (!default_word_regexp && word_start[ch]) { obstack_1grow (&token_stack, ch); while (1) - { + { ch = peek_input (); if (ch == CHAR_EOF) break; @@ -800,9 +868,23 @@ next_token (token_data *td) #endif /* ENABLE_CHANGEWORD */ - else if (!MATCH (ch, lquote.string)) + else if (!MATCH (ch, lquote.string, TRUE)) { - type = TOKEN_SIMPLE; + switch (ch) + { + case '(': + type = TOKEN_OPEN; + break; + case ',': + type = TOKEN_COMMA; + break; + case ')': + type = TOKEN_CLOSE; + break; + default: + type = TOKEN_SIMPLE; + break; + } obstack_1grow (&token_stack, ch); } else @@ -812,16 +894,18 @@ next_token (token_data *td) { ch = next_char (); if (ch == CHAR_EOF) - M4ERROR ((EXIT_FAILURE, 0, - "ERROR: end of file in string")); + /* current_file changed to "" if we see CHAR_EOF, use + the previous value we stored earlier. */ + M4ERROR_AT_LINE ((EXIT_FAILURE, 0, file, line, + "ERROR: end of file in string")); - if (MATCH (ch, rquote.string)) + if (MATCH (ch, rquote.string, TRUE)) { if (--quote_level == 0) break; obstack_grow (&token_stack, rquote.string, rquote.length); } - else if (MATCH (ch, lquote.string)) + else if (MATCH (ch, lquote.string, TRUE)) { quote_level++; obstack_grow (&token_stack, lquote.string, lquote.length); @@ -842,20 +926,127 @@ next_token (token_data *td) TOKEN_DATA_ORIG_TEXT (td) = orig_text; #endif #ifdef DEBUG_INPUT - fprintf (stderr, "next_token -> %d (%s)\n", type, TOKEN_DATA_TEXT (td)); + fprintf (stderr, "next_token -> %s (%s)\n", + token_type_string (type), TOKEN_DATA_TEXT (td)); #endif return type; } + +/*-----------------------------------------------. +| Peek at the next token from the input stream. | +`-----------------------------------------------*/ + +token_type +peek_token (void) +{ + int ch = peek_input (); + + if (ch == CHAR_EOF) + { +#ifdef DEBUG_INPUT + fprintf (stderr, "peek_token -> EOF\n"); +#endif + return TOKEN_EOF; + } + if (ch == CHAR_MACRO) + { +#ifdef DEBUG_INPUT + fprintf (stderr, "peek_token -> MACDEF\n"); +#endif + return TOKEN_MACDEF; + } + + if (MATCH (ch, bcomm.string, FALSE)) + { +#ifdef DEBUG_INPUT + fprintf (stderr, "peek_token -> COMMENT\n"); +#endif + return TOKEN_STRING; + } + + if ((default_word_regexp && (isalpha (ch) || ch == '_')) +#ifdef ENABLE_CHANGEWORD + || (! default_word_regexp && word_start[ch]) +#endif /* ENABLE_CHANGEWORD */ + ) + { +#ifdef DEBUG_INPUT + fprintf (stderr, "peek_token -> WORD\n"); +#endif + return TOKEN_WORD; + } + + if (MATCH (ch, lquote.string, FALSE)) + { +#ifdef DEBUG_INPUT + fprintf (stderr, "peek_token -> QUOTE\n"); +#endif + return TOKEN_STRING; + } + + switch (ch) + { + case '(': +#ifdef DEBUG_INPUT + fprintf (stderr, "peek_token -> OPEN\n"); +#endif + return TOKEN_OPEN; + case ',': +#ifdef DEBUG_INPUT + fprintf (stderr, "peek_token -> COMMA\n"); +#endif + return TOKEN_COMMA; + case ')': +#ifdef DEBUG_INPUT + fprintf (stderr, "peek_token -> CLOSE\n"); +#endif + return TOKEN_CLOSE; + default: +#ifdef DEBUG_INPUT + fprintf (stderr, "peek_token -> SIMPLE\n"); +#endif + return TOKEN_SIMPLE; + } +} #ifdef DEBUG_INPUT +static const char * +token_type_string (token_type t) +{ + switch (t) + { /* TOKSW */ + case TOKEN_EOF: + return "EOF"; + case TOKEN_STRING: + return "STRING"; + case TOKEN_WORD: + return "WORD"; + case TOKEN_OPEN: + return "OPEN"; + case TOKEN_COMMA: + return "COMMA"; + case TOKEN_CLOSE: + return "CLOSE"; + case TOKEN_SIMPLE: + return "SIMPLE"; + case TOKEN_MACDEF: + return "MACDEF"; + default: + abort (); + } + } + static void print_token (const char *s, token_type t, token_data *td) { fprintf (stderr, "%s: ", s); switch (t) { /* TOKSW */ + case TOKEN_OPEN: + case TOKEN_COMMA: + case TOKEN_CLOSE: case TOKEN_SIMPLE: fprintf (stderr, "char:"); break; diff -ruNp m4-1.4.5/src/m4.c m4-1.4.6/src/m4.c --- m4-1.4.5/src/m4.c 2006-07-15 15:39:28.000000000 -0600 +++ m4-1.4.6/src/m4.c 2006-08-09 05:51:02.000000000 -0600 @@ -24,7 +24,7 @@ #include #include -static void usage _((int)); +static void usage (int); /* Operate interactively (-e). */ static int interactive = 0; @@ -86,18 +86,30 @@ typedef struct macro_definition macro_de /* Error handling functions. */ -/*-------------------------------------------------------------------------. -| Print source and line reference on standard error, as a prefix for error | -| messages. Flush standard output first. | -`-------------------------------------------------------------------------*/ +/*-----------------------. +| Wrapper around error. | +`-----------------------*/ void -reference_error (void) +m4_error (int status, int errnum, const char *format, ...) { - int e = errno; - fflush (stdout); - fprintf (stderr, "%s:%d: ", current_file, current_line); - errno = e; + va_list args; + va_start (args, format); + verror_at_line (status, errnum, current_line ? current_file : NULL, + current_line, format, args); +} + +/*-------------------------------. +| Wrapper around error_at_line. | +`-------------------------------*/ + +void +m4_error_at_line (int status, int errnum, const char *file, int line, + const char *format, ...) +{ + va_list args; + va_start (args, format); + verror_at_line (status, errnum, line ? file : NULL, line, format, args); } #ifdef USE_STACKOVF @@ -115,23 +127,6 @@ stackovf_handler (void) #endif /* USE_STACKOV */ -/* Memory allocation. */ - -/*------------------------. -| Failsafe free routine. | -`------------------------*/ - -#ifdef WITH_DMALLOC -# undef xfree -#endif - -void -xfree (void *p) -{ - if (p != NULL) - free (p); -} - /*---------------------------------------------. | Print a usage message and exit with STATUS. | @@ -146,6 +141,11 @@ usage (int status) { printf ("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\ +", stdout); + fputs ("\ +\n\ Mandatory or optional arguments to long options are mandatory or optional\n\ for short options too.\n\ \n\ @@ -165,10 +165,10 @@ Operation modes:\n\ fputs ("\ \n\ Preprocessor features:\n\ - -D, --define=NAME[=VALUE] enter NAME has having VALUE, or empty\n\ - -I, --include=DIRECTORY append this directory to include path\n\ - -s, --synclines generate `#line NO \"FILE\"' lines\n\ - -U, --undefine=NAME delete builtin NAME\n\ + -D, --define=NAME[=VALUE] define NAME has having VALUE, or empty\n\ + -I, --include=DIRECTORY append DIRECTORY to include path\n\ + -s, --synclines generate `#line NUM \"FILE\"' lines\n\ + -U, --undefine=NAME undefine NAME\n\ ", stdout); fputs ("\ \n\ @@ -203,8 +203,8 @@ FLAGS is any of:\n\ p show results of path searches\n\ q quote values as necessary, with a or e flag\n\ t trace for all macro calls, not only traceon'ed\n\ - V shorthand for all of the other flags\n\ x add a unique macro call id, useful with c flag\n\ + V shorthand for all of the above flags\n\ ", stdout); fputs ("\ \n\ @@ -213,14 +213,14 @@ of directories included after any specif ", stdout); fputs ("\ \n\ -If no FILE or if FILE is `-', standard input is read.\n\ -", stdout); - fputs ("\ -\n\ -Exit status is 0 for success, 1 for failure, or whatever value was passed\n\ -to the m4exit macro.\n\ +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); } + + if (close_stream (stdout) != 0) + M4ERROR ((EXIT_FAILURE, errno, "write error")); exit (status); } @@ -259,6 +259,10 @@ static const struct option long_options[ { 0, 0, 0, 0 }, }; +/* Global catchall for any errors that should affect final error status, but + where we try to continue execution in the meantime. */ +int retcode; + #ifdef ENABLE_CHANGEWORD #define OPTSTRING "B:D:EF:GH:I:L:N:PQR:S:T:U:W:d::el:o:st:" #else @@ -268,7 +272,6 @@ static const struct option long_options[ int main (int argc, char *const *argv, char *const *envp) { - int retcode = EXIT_SUCCESS; macro_definition *head; /* head of deferred argument list */ macro_definition *tail; macro_definition *new; @@ -278,6 +281,7 @@ main (int argc, char *const *argv, char FILE *fp; program_name = argv[0]; + retcode = EXIT_SUCCESS; include_init (); debug_init (); @@ -290,7 +294,7 @@ main (int argc, char *const *argv, char head = tail = NULL; while (optchar = getopt_long (argc, (char **) argv, OPTSTRING, - long_options, NULL), + long_options, NULL), optchar != EOF) switch (optchar) { @@ -401,13 +405,16 @@ main (int argc, char *const *argv, char if (show_version) { printf ("%s\n", PACKAGE_STRING); - printf ("Written by Rene' Seindal.\n\ -\n\ + fputs ("\ Copyright (C) 2006 Free Software Foundation, Inc.\n\ This is free software; see the source for copying conditions. There is NO\n\ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ -"); +\n\ +Written by Rene' Seindal.\n\ +", stdout); + if (close_stream (stdout) != 0) + M4ERROR ((EXIT_FAILURE, errno, "write error")); exit (EXIT_SUCCESS); } @@ -464,7 +471,7 @@ warranty; not even for MERCHANTABILITY o } next = defines->next; - xfree (defines); + free (defines); defines = next; } @@ -491,7 +498,8 @@ warranty; not even for MERCHANTABILITY o push_file (stdin, "stdin"); else { - fp = path_search (argv[optind]); + const char *name; + fp = path_search (argv[optind], &name); if (fp == NULL) { error (0, errno, "%s", argv[optind]); @@ -500,8 +508,8 @@ warranty; not even for MERCHANTABILITY o retcode = EXIT_FAILURE; continue; } - else - push_file (fp, argv[optind]); + push_file (fp, name); + free ((char *) name); } expand_input (); } @@ -512,6 +520,10 @@ warranty; not even for MERCHANTABILITY o while (pop_wrapup ()) expand_input (); + /* Change debug stream back to stderr, to force flushing debug stream and + detect any errors it might have encountered. */ + debug_set_output (NULL); + if (frozen_file_to_write) produce_frozen_state (frozen_file_to_write); else @@ -520,5 +532,7 @@ warranty; not even for MERCHANTABILITY o undivert_all (); } + if (close_stream (stdout) != 0) + M4ERROR ((EXIT_FAILURE, errno, "write error")); exit (retcode); } diff -ruNp m4-1.4.5/src/m4.h m4-1.4.6/src/m4.h --- m4-1.4.5/src/m4.h 2006-07-11 06:10:21.000000000 -0600 +++ m4-1.4.6/src/m4.h 2006-08-19 06:56:59.000000000 -0600 @@ -27,7 +27,9 @@ /* Canonicalize UNIX recognition macros. */ #if defined unix || defined __unix || defined __unix__ \ - || defined _POSIX_VERSION || defined _POSIX2_VERSION + || defined _POSIX_VERSION || defined _POSIX2_VERSION \ + || defined __NetBSD__ || defined __OpenBSD__ \ + || defined __APPLE__ || defined __APPLE_CC__ # define UNIX 1 #endif @@ -41,26 +43,23 @@ # define OS2 1 #endif -/* FIXME - we no longer need this ansi2knr hack. */ -#define _(Args) Args - #include #include -#include -#include #include #include #include "binary-io.h" +#include "cloexec.h" +#include "close-stream.h" #include "error.h" #include "exit.h" #include "obstack.h" +#include "stdio--.h" +#include "stdlib--.h" +#include "unistd--.h" +#include "verror.h" #include "xalloc.h" -#ifdef HAVE_UNISTD_H -# include -#endif - /* If FALSE is defined, we presume TRUE is defined too. In this case, merely typedef boolean as being int. Or else, define these all. */ #ifndef FALSE @@ -73,6 +72,9 @@ typedef int boolean; #if ! HAVE_MKSTEMP int mkstemp (char *); #endif + +/* Used for version mismatch, when -R detects a frozen file it can't parse. */ +#define EXIT_MISMATCH 63 /* Various declarations. */ @@ -84,13 +86,24 @@ struct string typedef struct string STRING; /* Memory allocation. */ -void xfree (void *); #define obstack_chunk_alloc xmalloc -#define obstack_chunk_free xfree +#define obstack_chunk_free free /* Those must come first. */ typedef struct token_data token_data; typedef void builtin_func (struct obstack *, int, token_data **); + +/* Take advantage of GNU C compiler source level optimization hints, + using portable macros. */ +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 6) +# define M4_GNUC_ATTRIBUTE(args) __attribute__(args) +#else +# define M4_GNUC_ATTRIBUTE(args) +#endif /* __GNUC__ */ + +#define M4_GNUC_UNUSED M4_GNUC_ATTRIBUTE((__unused__)) +#define M4_GNUC_PRINTF(fmt, arg) \ + M4_GNUC_ATTRIBUTE((__format__ (__printf__, fmt, arg))) /* File: m4.c --- global definitions. */ @@ -109,14 +122,19 @@ extern const char *user_word_regexp; /* #endif /* Error handling. */ -#define M4ERROR(Arglist) \ - (reference_error (), error Arglist) +extern int retcode; +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); -void reference_error _((void)); +#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 setup_stackovf_trap (char *const *, char *const *, + void (*handler) (void)); #endif /* File: debug.c --- debugging and tracing function. */ @@ -203,15 +221,15 @@ extern FILE *debug; } \ while (0) -void debug_init _((void)); -int debug_decode _((const char *)); -void debug_flush_files _((void)); -boolean debug_set_output _((const char *)); -void debug_message_prefix _((void)); - -void trace_prepre _((const char *, int)); -void trace_pre _((const char *, int, int, token_data **)); -void trace_post _((const char *, int, int, token_data **, const char *)); +void debug_init (void); +int debug_decode (const char *); +void debug_flush_files (void); +boolean debug_set_output (const char *); +void debug_message_prefix (void); + +void trace_prepre (const char *, int); +void trace_pre (const char *, int, int, token_data **); +void trace_post (const char *, int, int, token_data **, const char *); /* File: input.c --- lexical definitions. */ @@ -219,10 +237,13 @@ void trace_post _((const char *, int, in enum token_type { TOKEN_EOF, /* end of file */ - TOKEN_STRING, /* a quoted string */ + TOKEN_STRING, /* a quoted string or comment */ TOKEN_WORD, /* an identifier */ - TOKEN_SIMPLE, /* a single character */ - TOKEN_MACDEF /* a macros definition (see "defn") */ + TOKEN_OPEN, /* ( */ + TOKEN_COMMA, /* , */ + TOKEN_CLOSE, /* ) */ + TOKEN_SIMPLE, /* any other single character */ + TOKEN_MACDEF /* a macro's definition (see "defn") */ }; /* The data for a token, a macro argument, and a macro definition. */ @@ -261,18 +282,18 @@ struct token_data typedef enum token_type token_type; typedef enum token_data_type token_data_type; -void input_init _((void)); -int peek_input _((void)); -token_type next_token _((token_data *)); -void skip_line _((void)); +void input_init (void); +token_type peek_token (void); +token_type next_token (token_data *); +void skip_line (void); /* push back input */ -void push_file _((FILE *, const char *)); -void push_macro _((builtin_func *)); -struct obstack *push_string_init _((void)); -const char *push_string_finish _((void)); -void push_wrapup _((const char *)); -boolean pop_wrapup _((void)); +void push_file (FILE *, const char *); +void push_macro (builtin_func *); +struct obstack *push_string_init (void); +const char *push_string_finish (void); +void push_wrapup (const char *); +boolean pop_wrapup (void); /* current input file, and line */ extern const char *current_file; @@ -287,22 +308,22 @@ extern STRING lquote, rquote; #define DEF_BCOMM "#" #define DEF_ECOMM "\n" -void set_quotes _((const char *, const char *)); -void set_comment _((const char *, const char *)); +void set_quotes (const char *, const char *); +void set_comment (const char *, const char *); #ifdef ENABLE_CHANGEWORD -void set_word_regexp _((const char *)); +void set_word_regexp (const char *); #endif /* File: output.c --- output functions. */ extern int current_diversion; extern int output_current_line; -void output_init _((void)); -void shipout_text _((struct obstack *, const char *, int)); -void make_diversion _((int)); -void insert_diversion _((int)); -void insert_file _((FILE *)); -void freeze_diversions _((FILE *)); +void output_init (void); +void shipout_text (struct obstack *, const char *, int); +void make_diversion (int); +void insert_diversion (int); +void insert_file (FILE *); +void freeze_diversions (FILE *); /* File symtab.c --- symbol table definitions. */ @@ -351,15 +372,15 @@ typedef void hack_symbol (); extern symbol **symtab; -void free_symbol _((symbol *sym)); -void symtab_init _((void)); -symbol *lookup_symbol _((const char *, symbol_lookup)); -void hack_all_symbols _((hack_symbol *, const char *)); +void free_symbol (symbol *sym); +void symtab_init (void); +symbol *lookup_symbol (const char *, symbol_lookup); +void hack_all_symbols (hack_symbol *, const char *); /* File: macro.c --- macro expansion. */ -void expand_input _((void)); -void call_macro _((symbol *, int, token_data **, struct obstack *)); +void expand_input (void); +void call_macro (symbol *, int, token_data **, struct obstack *); /* File: builtin.c --- builtins. */ @@ -382,22 +403,22 @@ struct predefined typedef struct builtin builtin; typedef struct predefined predefined; -void builtin_init _((void)); -void define_builtin _((const char *, const builtin *, symbol_lookup)); -void define_user_macro _((const char *, const char *, symbol_lookup)); -void undivert_all _((void)); -void expand_user_macro _((struct obstack *, symbol *, int, token_data **)); -void m4_placeholder _((struct obstack *, int, token_data **)); +void builtin_init (void); +void define_builtin (const char *, const builtin *, symbol_lookup); +void define_user_macro (const char *, const char *, symbol_lookup); +void undivert_all (void); +void expand_user_macro (struct obstack *, symbol *, int, token_data **); +void m4_placeholder (struct obstack *, int, token_data **); -const builtin *find_builtin_by_addr _((builtin_func *)); -const builtin *find_builtin_by_name _((const char *)); +const builtin *find_builtin_by_addr (builtin_func *); +const builtin *find_builtin_by_name (const char *); /* File: path.c --- path search for include files. */ -void include_init _((void)); -void include_env_init _((void)); -void add_include_directory _((const char *)); -FILE *path_search _((const char *)); +void include_init (void); +void include_env_init (void); +void add_include_directory (const char *); +FILE *path_search (const char *, const char **); /* File: eval.c --- expression evaluation. */ @@ -405,16 +426,16 @@ FILE *path_search _((const char *)); typedef int eval_t; typedef unsigned int unsigned_eval_t; -boolean evaluate _((const char *, eval_t *)); +boolean evaluate (const char *, eval_t *); /* File: format.c --- printf like formatting. */ -void format _((struct obstack *, int, token_data **)); +void format (struct obstack *, int, token_data **); /* File: freeze.c --- frozen state files. */ -void produce_frozen_state _((const char *)); -void reload_frozen_state _((const char *)); +void produce_frozen_state (const char *); +void reload_frozen_state (const char *); /* Debugging the memory allocator. */ @@ -438,13 +459,3 @@ void reload_frozen_state _((const char * a bit safer than casting to unsigned char, since it catches some type errors that the cast doesn't. */ static inline unsigned char to_uchar (char ch) { return ch; } - -/* Take advantage of GNU C compiler source level optimization hints, - using portable macros. */ -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4) -# define M4_GNUC_ATTRIBUTE(args) __attribute__(args) -#else -# define M4_GNUC_ATTRIBUTE(args) -#endif /* __GNUC__ */ - -#define M4_GNUC_UNUSED M4_GNUC_ATTRIBUTE((unused)) diff -ruNp m4-1.4.5/src/macro.c m4-1.4.6/src/macro.c --- m4-1.4.5/src/macro.c 2006-07-07 22:40:40.000000000 -0600 +++ m4-1.4.6/src/macro.c 2006-08-09 05:51:02.000000000 -0600 @@ -24,8 +24,8 @@ #include "m4.h" -static void expand_macro _((symbol *)); -static void expand_token _((struct obstack *, token_type, token_data *)); +static void expand_macro (symbol *); +static void expand_token (struct obstack *, token_type, token_data *); /* Current recursion level in expand_macro (). */ int expansion_level = 0; @@ -66,6 +66,9 @@ expand_token (struct obstack *obs, token case TOKEN_MACDEF: break; + case TOKEN_OPEN: + case TOKEN_COMMA: + case TOKEN_CLOSE: case TOKEN_SIMPLE: case TOKEN_STRING: shipout_text (obs, TOKEN_DATA_TEXT (td), strlen (TOKEN_DATA_TEXT (td))); @@ -76,7 +79,7 @@ expand_token (struct obstack *obs, token if (sym == NULL || SYMBOL_TYPE (sym) == TOKEN_VOID || (SYMBOL_TYPE (sym) == TOKEN_FUNC && SYMBOL_BLIND_NO_ARGS (sym) - && peek_input () != '(')) + && peek_token () != TOKEN_OPEN)) { #ifdef ENABLE_CHANGEWORD shipout_text (obs, TOKEN_DATA_ORIG_TEXT (td), @@ -115,6 +118,8 @@ expand_argument (struct obstack *obs, to token_data td; char *text; int paren_level; + const char *file = current_file; + int line = current_line; TOKEN_DATA_TYPE (argp) = TOKEN_VOID; @@ -132,11 +137,10 @@ expand_argument (struct obstack *obs, to switch (t) { /* TOKSW */ - case TOKEN_SIMPLE: - text = TOKEN_DATA_TEXT (&td); - if ((*text == ',' || *text == ')') && paren_level == 0) + case TOKEN_COMMA: + case TOKEN_CLOSE: + if (paren_level == 0) { - /* The argument MUST be finished, whether we want it or not. */ obstack_1grow (obs, '\0'); text = obstack_finish (obs); @@ -146,8 +150,12 @@ expand_argument (struct obstack *obs, to TOKEN_DATA_TYPE (argp) = TOKEN_TEXT; TOKEN_DATA_TEXT (argp) = text; } - return (boolean) (*TOKEN_DATA_TEXT (&td) == ','); + return (boolean) (t == TOKEN_COMMA); } + /* fallthru */ + case TOKEN_OPEN: + case TOKEN_SIMPLE: + text = TOKEN_DATA_TEXT (&td); if (*text == '(') paren_level++; @@ -157,8 +165,10 @@ expand_argument (struct obstack *obs, to break; case TOKEN_EOF: - M4ERROR ((EXIT_FAILURE, 0, - "ERROR: end of file in argument list")); + /* current_file changed to "" if we see TOKEN_EOF, use the + previous value we stored earlier. */ + M4ERROR_AT_LINE ((EXIT_FAILURE, 0, file, line, + "ERROR: end of file in argument list")); break; case TOKEN_WORD: @@ -194,7 +204,6 @@ static void collect_arguments (symbol *sym, struct obstack *argptr, struct obstack *arguments) { - int ch; /* lookahead for ( */ token_data td; token_data *tdp; boolean more_args; @@ -205,8 +214,7 @@ collect_arguments (symbol *sym, struct o tdp = (token_data *) obstack_copy (arguments, &td, sizeof (td)); obstack_grow (argptr, &tdp, sizeof (tdp)); - ch = peek_input (); - if (ch == '(') + if (peek_token () == TOKEN_OPEN) { next_token (&td); /* gobble parenthesis */ do diff -ruNp m4-1.4.5/src/output.c m4-1.4.6/src/output.c --- m4-1.4.5/src/output.c 2006-07-10 06:24:49.000000000 -0600 +++ m4-1.4.6/src/output.c 2006-08-19 06:56:59.000000000 -0600 @@ -34,10 +34,6 @@ /* Size of buffer size to use while copying files. */ #define COPY_BUFFER_SIZE (32 * 512) -#ifdef HAVE_TMPFILE -extern FILE *tmpfile (); -#endif - /* Output functions. Most of the complexity is for handling cpp like sync lines. @@ -103,27 +99,6 @@ output_init (void) output_unused = 0; } -#ifndef HAVE_TMPFILE - -/* Implement tmpfile(3) for non-USG systems. */ - -static FILE * -tmpfile (void) -{ - char buf[32]; - int fd; - - strcpy (buf, "/tmp/m4XXXXXX"); - fd = mkstemp (buf); - if (fd < 0) - return NULL; - - unlink (buf); - return fdopen (fd, "w+"); -} - -#endif /* not HAVE_TMPFILE */ - /*-----------------------------------------------------------------------. | Reorganize in-memory diversion buffers so the current diversion can | | accomodate LENGTH more characters without further reorganization. The | @@ -183,6 +158,9 @@ make_room_for (int length) if (selected_diversion->file == NULL) M4ERROR ((EXIT_FAILURE, errno, "ERROR: cannot create temporary file for diversion")); + if (set_cloexec_flag (fileno (selected_diversion->file), true) != 0) + M4ERROR ((warning_status, errno, + "Warning: cannot protect diversion across forks")); if (selected_diversion->used > 0) { @@ -364,7 +342,7 @@ shipout_text (struct obstack *obs, const sprintf (line, "#line %d", current_line); for (cursor = line; *cursor; cursor++) OUTPUT_CHARACTER (*cursor); - if (output_current_line < 1) + if (output_current_line < 1 && current_file[0] != '\0') { OUTPUT_CHARACTER (' '); OUTPUT_CHARACTER ('"'); diff -ruNp m4-1.4.5/src/path.c m4-1.4.6/src/path.c --- m4-1.4.5/src/path.c 2006-07-10 06:24:49.000000000 -0600 +++ m4-1.4.6/src/path.c 2006-08-19 06:56:59.000000000 -0600 @@ -100,14 +100,22 @@ add_include_directory (const char *dir) #endif } +/* Search for FILE, first in `.', then according to -I options. If + successful, return the open file, and if RESULT is not NULL, set + *RESULT to a malloc'd string that represents the file found with + respect to the current working directory. */ + FILE * -path_search (const char *file) +path_search (const char *file, const char **result) { FILE *fp; includes *incl; char *name; /* buffer for constructed name */ int e; + if (result) + *result = NULL; + /* Reject empty file. */ if (!*file) { @@ -118,7 +126,14 @@ path_search (const char *file) /* Look in current working directory first. */ fp = fopen (file, "r"); if (fp != NULL) - return fp; + { + if (set_cloexec_flag (fileno (fp), true) != 0) + M4ERROR ((warning_status, errno, + "Warning: cannot protect input file across forks")); + if (result) + *result = xstrdup (file); + return fp; + } /* If file not found, and filename absolute, fail. */ if (*file == '/' || no_gnu_extensions) @@ -142,10 +157,18 @@ path_search (const char *file) { if (debug_level & DEBUG_TRACE_PATH) DEBUG_MESSAGE2 ("path search for `%s' found `%s'", file, name); - break; + if (set_cloexec_flag (fileno (fp), true) != 0) + M4ERROR ((warning_status, errno, + "Warning: cannot protect input file across forks")); + if (result) + *result = name; + else + free (name); + errno = e; + return fp; } } - xfree (name); + free (name); errno = e; return fp; } diff -ruNp m4-1.4.5/src/stackovf.c m4-1.4.6/src/stackovf.c --- m4-1.4.5/src/stackovf.c 2006-06-29 21:46:14.000000000 -0600 +++ m4-1.4.6/src/stackovf.c 2006-08-03 06:48:45.000000000 -0600 @@ -110,8 +110,7 @@ # define STACKOVF_DETECT 16384 #endif -/* Giving a hand to ansi2knr... */ -typedef void (*handler_t) _((void)); +typedef void (*handler_t) (void); static const char *stackbot; static const char *stackend; @@ -347,7 +346,17 @@ Error - Do not know how to set up stack- ss.ss_sp = xmalloc ((unsigned) ss.ss_size); ss.ss_flags = 0; if (sigaltstack (&ss, NULL) < 0) - error (EXIT_FAILURE, errno, "sigaltstack"); + { + /* Oops - sigaltstack exists but doesn't work. We can't + install the overflow detector, but should gracefully treat + it as though sigaltstack doesn't exist. For example, this + happens when compiled with Linux 2.1 headers but run + against Linux 2.0 kernel. */ + free (ss.ss_sp); + if (errno == ENOSYS) + return; + error (EXIT_FAILURE, errno, "sigaltstack"); + } } #elif HAVE_SIGSTACK @@ -359,7 +368,17 @@ Error - Do not know how to set up stack- ss.ss_sp = stackbuf + SIGSTKSZ; ss.ss_onstack = 0; if (sigstack (&ss, NULL) < 0) - error (EXIT_FAILURE, errno, "sigstack"); + { + /* Oops - sigstack exists but doesn't work. We can't install + the overflow detector, but should gracefully treat it as + though sigstack doesn't exist. For example, this happens + when compiled with Linux 2.1 headers but run against Linux + 2.0 kernel. */ + free (stackbuf); + if (errno == ENOSYS) + return; + error (EXIT_FAILURE, errno, "sigstack"); + } } #else /* not HAVE_SIGSTACK */ @@ -376,7 +395,7 @@ Error - Do not know how to set up stack- # if HAVE_STRUCT_SIGACTION_SA_SIGACTION act.sa_sigaction = sigsegv_handler; # else /* ! HAVE_STRUCT_SIGACTION_SA_SIGACTION */ - act.sa_handler = (RETSIGTYPE (*) _((int))) sigsegv_handler; + act.sa_handler = (RETSIGTYPE (*) (int)) sigsegv_handler; # endif /* ! HAVE_STRUCT_SIGACTION_SA_SIGACTION */ sigemptyset (&act.sa_mask); act.sa_flags = (SA_ONSTACK | SA_RESETHAND | SA_SIGINFO); @@ -385,7 +404,7 @@ Error - Do not know how to set up stack- #else /* ! HAVE_SIGACTION */ - vec.sv_handler = (RETSIGTYPE (*)_ ((int))) sigsegv_handler; + vec.sv_handler = (RETSIGTYPE (*) (int)) sigsegv_handler; vec.sv_mask = 0; vec.sv_flags = (SV_ONSTACK | SV_RESETHAND); if (sigvec (SIGSEGV, &vec, NULL) < 0) diff -ruNp m4-1.4.5/src/symtab.c m4-1.4.6/src/symtab.c --- m4-1.4.5/src/symtab.c 2006-07-07 22:40:40.000000000 -0600 +++ m4-1.4.6/src/symtab.c 2006-07-31 06:09:38.000000000 -0600 @@ -144,11 +144,10 @@ free_symbol (symbol *sym) SYMBOL_DELETED (sym) = TRUE; else { - if (SYMBOL_NAME (sym)) - xfree (SYMBOL_NAME (sym)); + free (SYMBOL_NAME (sym)); if (SYMBOL_TYPE (sym) == TOKEN_TEXT) - xfree (SYMBOL_TEXT (sym)); - xfree (sym); + free (SYMBOL_TEXT (sym)); + free (sym); } }