diff -ruNp m4-1.4.7/ChangeLog m4-1.4.8/ChangeLog --- m4-1.4.7/ChangeLog 2006-09-25 06:15:00.000000000 -0600 +++ m4-1.4.8/ChangeLog 2006-11-20 21:08:44.000000000 -0700 @@ -1,3 +1,369 @@ +2006-11-20 Eric Blake + + Release 1.4.8: + + * configure.ac (AC_INIT): Bump version number. + * NEWS: Describe changes since 1.4.7. + +2006-11-16 Eric Blake + + * doc/m4.texinfo (Include, Search Path, Diversions, Divert): + Minor tweaks noticed while porting to head. + +2006-11-14 Eric Blake + + * src/output.c (cleanup_tmpfile, freeze_diversions): Clean up + spent iterators. + (m4_tmpname): Avoid memory leak. + +2006-11-13 Eric Blake + + * src/output.c (cleanup_tmpfile): Avoid double error message when + umask is prohibitive. + (m4_tmpname, m4_tmpopen, m4_tmpclose, m4_tmpremove): New + functions. + (m4_tmpfile): Add parameter, move cloexec action here. + (make_room_for): Adjust caller. Don't keep too many files open. + (insert_diversion_helper): Unlink emptied temp files. + (make_diversion): Don't keep too many files open. + * doc/m4.texinfo (Diversions): Tweak wording, now that open file + descriptors are no longer a limiting factor. + * NEWS: Document this change. + + Backport sparse diversion handling from head. + * m4/gnulib-cache.m4: Augment with 'gnulib-tool --import + avltree-oset'. + * src/output.c (struct m4_diversion): Rename from struct + diversion, and update members. All users changed. + (diversion_table): Change to an ordered set, instead of an array. + (div0): New storage for diversion 0. + (diversions): No longer needed. + (free_list): New list to allow recycling diversion storage. + (diversion_storage): New storage to reduce malloc overhead. + (cmp_diversion_CB, threshold_diversion_CB): New callbacks. + (output_init, output_exit, cleanup_tmpfile, make_room_for) + (make_diversion): Handle new diversion storage scheme. + (insert_diversion_helper): New function. + (insert_diversion, undivert_all, freeze_diversions): Use it. + * doc/m4.texinfo (Divert, Diversions): Move hidden test of memory + exhaustion to visible test of large diversion numbers. + * NEWS: Document this fix. + +2006-11-11 Eric Blake + + * src/builtin.c (m4_translit): Slight optimization. + + * src/m4.h (to_uchar): Depend on HAVE_INLINE. + + * src/builtin.c: Remove unnecessary casts. + (expand_ranges): Make 8-bit clean. + * doc/m4.texinfo (Translit): Add tests and wording. + * NEWS: Document this fix. + +2006-11-07 Eric Blake + + * src/m4.h (output_exit): New prototype. + * src/m4.c (main): Use it. + * src/output.c (cleanup_tmpfile): Close files before removing + directory. + (insert_diversion): Check for failure. + (output_exit): Avoid memory leak. + * doc/m4.texinfo (Diversions): Test this bug. + + * doc/m4.texinfo (Esyscmd, Errprint): Minor touchups. + +2006-11-01 Eric Blake + + Allow C++ compilation on Linux, as a safety measure in type + checking. + * m4/gnulib-cache.m4: Augment with 'gnulib-tool --import + stdbool'. + * src/m4.h (hack_symbol, hack_all_symbols): Use full prototype. + (boolean): Kill this, and use stdbool.h instead. + * src/debug.c, src/eval.c, src/input.c, src/macro.c, src/m4.c: + * src/output.c, src/symtab.c: All users changed. + * src/symtab.c (hack_all_symbols): Update prototype. + * src/builtin.c (dump_symbol, set_trace): Update signature. + (m4_dumpdef, m4_traceon, m4_traceoff): Update callers. + (mkstemp_helper, m4_m4wrap, expand_ranges, m4_translit): Allow + C++ compilation. + * src/debug.c (trace_flush): Likewise. + * src/freeze.c (reload_frozen_state): Likewise. + * src/input.c (push_file, push_string_finish, push_wrapup): + (token_bottom, next_token): Likewise. + * src/m4.c (main): Likewise. + + * doc/m4.texinfo (Invoking m4): Update according to POSIX 200x + draft wording. + * src/m4.h (m4_path_search): Tweak signature. + * src/path.c (m4_path_search): Likewise. + * src/builtin.c (include): Update caller. + * src/m4.c (main): Allow -D, -U, -t, and -s to be interspersed + with file names. Don't write to **argv. + (process_file): New helper method. + * NEWS: Document this fix. + +2006-10-31 Eric Blake + + * m4/gnulib-cache.m4: Augment with 'gnulib-tool --import strstr'. + * doc/m4.texinfo (Translit): Improve the documentation. + * src/builtin.c (m4_translit): Optimize to O(n) instead of O(n^2) + algorithm. + (m4_index): Simplify, and speed up slightly. + * NEWS: Document this fix. + +2006-10-28 Eric Blake + + * src/input.c (set_quotes): Don't allow empty end-quote with + non-empty start-quote. + (set_comment): Likewise for end-comment. + * src/builtin.c (m4_changecom): Adjust caller. + * doc/m4.texinfo (Changequote, Changecom): Update documentation to + match behavior. + (Incompatibilities): Document another POSIX bug. + * NEWS: Mention this change. + +2006-10-27 Ralf Wildenhues + + * examples/Makefile.am (EXTRA_DIST): Distribute recently-added + files. + +2006-10-26 Eric Blake + + Silence -Wwrite-strings -Wpointer-arith warnings. + * src/builtin.c (define_user_macro): Allow NULL argument. + (m4_builtin, m4_indir): Cast away const of "". + * src/format.c (format): Likewise. + * src/macro.c (collect_arguments): Likewise. + (expand_macro): Avoid math on void*. + * src/m4.c (main): Adjust caller. + * src/output.c (freeze_diversions): Detect off_t overflow. + + * src/input.c (pop_input): Remove unnecessary code. + +2006-10-25 Eric Blake + + * src/symtab.c (symtab_init): Avoid size_t overflow. + * src/output.c (make_diversion): Avoid size_t overflow. + * doc/m4.texinfo (Diversions): Test this fix. + * src/input.c (input_block): Remove unused member. Reduce size + of struct. + (push_file, pop_input): Avoid useless assignment. + * NEWS: Document the bug fix. + + Redo location tracking. Instead of having just files track the + line to return to when popping input, now all input blocks track + their current line. + * src/input.c (INPUT_STRING_WRAP, INPUT_FILE_INIT): No longer + needed. + (input_block): Have line and file storage for all input types, and + rename some members. + (input_change): New global flag. + (push_file, push_macro, push_string_init, push_wrapup): Store + location. + (push_string_finish, pop_input, pop_wrapup): Notice changes in + input blocks. + (peek_input): Adjust to new member names. + (next_char, next_char1): Adjust location if needed. + (skip_line): Simplify restoring location. + * doc/m4.texinfo (Location): Augment the test to catch line + location of expansion of multi-line arguments. + Reported by Stepan Kasal. + +2006-10-23 Eric Blake + + * doc/m4.texinfo (Macro Arguments): Document that leading space + in argument collection stops at macro expansion. + (Incompatibilities): Document POSIX whitespace wording issue. + +2006-10-20 Eric Blake + + * doc/m4.texinfo: Trailing '@comment' doesn't format nicely in + TeX, so recognize '@w{ }' instead. Likewise, @code{_name} at the + end of a TeX line splits incorrectly. + (Foreach, Improved foreach): Write these sections, borrowing ideas + from CVS head and from m4sugar. + * checks/get-them: Accomodate new way to show trailing space in + examples. + * examples/foreach.m4: Make usable in documentation. + * examples/foreachq.m4: New file. + * examples/foreachq2.m4: New file. + * examples/foreach2.m4: New file. + * NEWS: Document the documentation updates. + +2006-10-19 Eric Blake + + * src/builtin.c (mkstemp_helper, m4_mkstemp): New functions. + (m4_maketemp): Provide traditional behavior. + * doc/m4.texinfo (Mkstemp): Rename from Maketemp. Document the + new `mkstemp' macro and the flaws of the old `maketemp'. + (Incompatibilities): Move maketemp discussion to... + (Extensions): ...here, since -G now supresses the GNU extension. + * NEWS: Document this. + + * examples/forloop.m4: Simplify. + * examples/forloop2.m4: New file. + * examples/quote.m4: New file. + * doc/m4.texinfo (Loops): Rename to... + (Shift): ...this node. + (Forloop, Foreach, Improved forloop, Improved foreach): New + nodes. + +2006-10-17 Eric Blake + + * m4/gnulib-cache.m4: Update with 'gnulib-tool --import + config-h'. + * configure.ac (AC_CONFIG_HEADERS): Create config.h alongside + gnulib headers, rather than in top directory. + * src/Makefile.am (AUTOMAKE_OPTIONS): Add nostdinc, to reduce make + output clutter. + +2006-10-16 Eric Blake + + * doc/m4.texinfo: Backport some minor cleanups from head. + (Cleardivert): Rename from cleardiv. + + * doc/m4.texinfo (Invoking m4): Promote to a chapter, instead of + a section of Preliminaries. + (Operation modes, Preprocessor features, Limits control) + (Frozen state, Debugging options, Command line files): Subdivide + into new sections. + (Input processing, Quoting Arguments, Define, Arguments) + (Cleardiv, Format, M4exit): Fix grammar of references. + (Inhibiting Invocation, Macro Arguments, Builtin, Trace) + (Debug Levels, Debug Output, Include, Search Path, Divert) + (Platform macros, Syscmd, Location, Extensions): Point to new + sections. + (Top, Loops, Include, Undivert, Location, Incompatibilities): + Improve file references. + +2006-10-14 Eric Blake + + * m4/input.c (file_clean): Don't close stdin twice, POSIX says it + is not portable. + Reported by Ralf Wildenhues. + + * src/builtin.c (m4_undivert): Check for read error. + +2006-10-13 Eric Blake + + * src/m4.h (UNIX, W32_NATIVE, OS2): Move platform checks after + header files are included, since can affect the tests. + * THANKS: Updated. + Reported by Martin Koeppe. + + Backport head's usage of clean-temp module, as it is cleaner than + using tmpfile-safer. + * m4/gnulib-cache.m4: Augment with 'gnulib-tool --import + clean-temp closeout', and remove tmpfile-safer. + * src/m4.h (includes): Adjust. + (m4_path_search): Rename from path_search, to avoid collision + with gnulib. + * src/m4.c (main): Install closeout handler. Adjust caller. + (usage): Now done by closeout module. + * src/builtin.c (m4_m4exit): Likewise. + (m4_undivert, include): Adjust callers. + * src/freeze.c (reload_frozen_state): Likewise. + * src/path.c (m4_path_search): Rename from path_search. + * src/output.c (output_temp_dir): New variable. + (cleanup_tmpfile, m4_tmpfile): New functions, from head. + (insert_diversion, make_room_for): Use them. + * doc/m4.texinfo (Diversions): Document this, and add a test. + (Improved fatal_error): Fix typo. + (Maketemp): Port test to mingw, and no longer hide from + documentation. + * NEWS: Document the change in TMPDIR behavior. + + * configure.ac (m4_pattern_forbid): Narrow the range of forbidden + macros, to work with recent gnulib-tool update. + + * src/builtin.c (m4_builtin, m4_indir): Allow transparent + handling of defn results. + * doc/m4.texinfo (Builtin, Indir): Add test cases. + * NEWS: Document this. + +2006-10-12 Eric Blake + + * doc/m4.texinfo (Location): Fix typo in previous commit. + (Changeword): Catch one more case. + * src/input.c (skip_line): Fix case when outer file used macro to + supply the \n. + +2006-10-11 Eric Blake + + * src/input.c (enum input_type): Add additional types, to shave + time off the common case. + (push_wrapup): Wrapped strings remember location. + (push_string_finish): Normal strings carry no location. + (push_file): Start new files uninitialized. + (peek_input, next_char_1): Optimize common cases by updating + location only on new input types. + (pop_input): Update to honor new input types. + (skip_line, push_string_finish): Fix regression in previous patch + when dnl is not followed by newline in included file. + (push_string_init): Initialize all fields of INPUT_STRING sooner. + (peek_token): Simplify. + (peek_input): Don't pop input files on peek, so that __file__ and + __line__ as last token of include file work correctly. + * doc/m4.texinfo (History): Mention 1.4.8. + (Answers): Split into sections, one per answer. + (Improved exch, Improved cleardivert, Improved fatal_error): New + nodes. + (Dnl, M4wrap, Location, M4exit, Improved fatal_error): Update to + new m4wrap location semantics. + (Changeword): Add test that caught the regression. + * NEWS: Document this. + + * src/macro.c (expand_macro): In macro expansion errors, report + line number at open parenthesis. + * src/input.c (next_token): Fix off-by-one bug in reporting end + of file in unterminated comment and string. + (file_names): New obstack, necessary since expand_macro now hangs + on to file names longer than the files remain open. + (input_init): Initialize new obstack. + (push_file): Use new obstack. Delay updates to current_file + until after expand_macro has restored state. + (peek_input, next_char_1): Update current_file if necessary. + (pop_wrapup): Release memory. + * doc/m4.texinfo (Macro Arguments, Changequote, Changecom): Catch + the off-by-one bug. + (Dnl): Update to the new location reporting rules. + * NEWS: Document these changes. + +2006-10-10 Eric Blake + + * src/macro.c (argc_stack, argv_stack): New variables for sharing + obstacks across multiple macro calls. + (expand_input): Initialize and tear down stack once per input + file, instead of once per macro. + (expand_macro): Reuse existing stacks when possible. + (collect_arguments): Simplify slightly. + + * src/path.c (include_env_init): Fix botched patch application. + Reported by Ralf Wildenhues. + +2006-10-09 Eric Blake + + * src/m4.c (usage, main): Detect write failures to stderr. + * src/builtin.c (m4_m4exit): Likewise. + * NEWS: Document this. + + * src/macro.c (expand_macro): Allow --nesting-limit=0 to remove + the limit. + * NEWS: Document this. + * doc/m4.texinfo (Invoking m4): Likewise. + +2006-10-09 Ralf Wildenhues + + * src/path.c (include_env_init): Copy the string returned + by getenv before overwriting it; POSIX disallows this. + +2006-10-09 Eric Blake + + * src/m4.c (main): Defer debugfile until after --help. + * configure.ac (AC_INIT): Bump version number. + * NEWS: Start changes of 1.4.7a. + 2006-09-25 Eric Blake Release 1.4.7: @@ -3005,7 +3371,7 @@ Mon Jan 22 21:08:52 1990 Rene' Seindal ----- - $Revision: 1.1.1.1.2.181 $ $Date: 2006/09/25 12:15:00 $ + $Revision: 1.1.1.1.2.224 $ $Date: 2006/11/21 04:08:44 $ Local Variables: coding: utf-8 diff -ruNp m4-1.4.7/Makefile.in m4-1.4.8/Makefile.in --- m4-1.4.7/Makefile.in 2006-09-25 06:08:01.000000000 -0600 +++ m4-1.4.8/Makefile.in 2006-11-20 07:25:50.000000000 -0700 @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. +# Makefile.in generated by automake 1.10 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -13,15 +13,11 @@ # PARTICULAR PURPOSE. @SET_MAKE@ -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = . am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -35,32 +31,40 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in $(srcdir)/config-h.in \ - $(top_srcdir)/checks/Makefile.in $(top_srcdir)/configure \ - AUTHORS BACKLOG COPYING ChangeLog INSTALL NEWS THANKS TODO \ - config.guess config.sub depcomp install-sh missing subdir = . +DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(top_srcdir)/checks/Makefile.in \ + $(top_srcdir)/configure AUTHORS BACKLOG COPYING ChangeLog \ + INSTALL NEWS THANKS TODO config.guess config.sub depcomp \ + install-sh missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/absolute-header.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/alloca.m4 $(top_srcdir)/m4/allocsa.m4 \ + $(top_srcdir)/m4/cloexec.m4 $(top_srcdir)/m4/close-stream.m4 \ + $(top_srcdir)/m4/closeout.m4 $(top_srcdir)/m4/codeset.m4 \ + $(top_srcdir)/m4/config-h.m4 $(top_srcdir)/m4/eealloc.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/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/fatal-signal.m4 $(top_srcdir)/m4/fpending.m4 \ + $(top_srcdir)/m4/free.m4 $(top_srcdir)/m4/getopt.m4 \ + $(top_srcdir)/m4/gl_list.m4 $(top_srcdir)/m4/gnulib-comp.m4 \ + $(top_srcdir)/m4/inline.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/mbstate_t.m4 $(top_srcdir)/m4/memchr.m4 \ + $(top_srcdir)/m4/mkdtemp.m4 $(top_srcdir)/m4/mkstemp.m4 \ + $(top_srcdir)/m4/pathmax.m4 $(top_srcdir)/m4/quotearg.m4 \ + $(top_srcdir)/m4/regex.m4 $(top_srcdir)/m4/sig_atomic_t.m4 \ + $(top_srcdir)/m4/signalblocking.m4 \ + $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/ssize_t.m4 \ $(top_srcdir)/m4/stdarg.m4 $(top_srcdir)/m4/stdbool.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/strstr.m4 $(top_srcdir)/m4/strtol.m4 \ + $(top_srcdir)/m4/sys_stat_h.m4 $(top_srcdir)/m4/tempname.m4 \ + $(top_srcdir)/m4/tmpdir.m4 $(top_srcdir)/m4/ulonglong.m4 \ $(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/unistd_h.m4 \ $(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/vasnprintf.m4 \ $(top_srcdir)/m4/vasprintf.m4 $(top_srcdir)/m4/wchar_t.m4 \ @@ -71,18 +75,21 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/a am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ - configure.lineno configure.status.lineno + configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = config.h +CONFIG_HEADER = $(top_builddir)/lib/config.h CONFIG_CLEAN_FILES = checks/Makefile SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ - install-exec-recursive install-info-recursive \ - install-recursive installcheck-recursive installdirs-recursive \ - pdf-recursive ps-recursive uninstall-info-recursive \ - uninstall-recursive + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) @@ -102,8 +109,6 @@ ABSOLUTE_SYS_STAT_H = @ABSOLUTE_SYS_STAT ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ ALLOCA_H = @ALLOCA_H@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ @@ -129,8 +134,6 @@ EGREP = @EGREP@ EOVERFLOW = @EOVERFLOW@ EXEEXT = @EXEEXT@ 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@ @@ -141,8 +144,10 @@ 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_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@ HAVE_WCHAR_H = @HAVE_WCHAR_H@ HAVE__BOOL = @HAVE__BOOL@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -153,7 +158,10 @@ LIBM4_LTLIBDEPS = @LIBM4_LTLIBDEPS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ +M4_LIBOBJS = @M4_LIBOBJS@ +M4_LTLIBOBJS = @M4_LTLIBOBJS@ MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -168,8 +176,6 @@ 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@ @@ -178,9 +184,11 @@ UNISTD_H = @UNISTD_H@ VERSION = @VERSION@ WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ WINT_T_SUFFIX = @WINT_T_SUFFIX@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -192,6 +200,7 @@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ +builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ @@ -219,8 +228,11 @@ program_transform_name = @program_transf psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ SUBDIRS = . examples lib src doc checks EXTRA_DIST = bootstrap c-boxes.el gendocs.sh GNUmakefile Makefile.maint \ m4/gnulib-cache.m4 @@ -233,8 +245,7 @@ MAINTAINERCLEANFILES = COPYING INSTALL M ACLOCAL_AMFLAGS = -I m4 DISTCHECK_CONFIGURE_FLAGS = --enable-changeword -all: config.h - $(MAKE) $(AM_MAKEFLAGS) all-recursive +all: all-recursive .SUFFIXES: am--refresh: @@ -270,26 +281,8 @@ $(top_srcdir)/configure: $(am__configur cd $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) - -config.h: stamp-h1 - @if test ! -f $@; then \ - rm -f stamp-h1; \ - $(MAKE) stamp-h1; \ - else :; fi - -stamp-h1: $(srcdir)/config-h.in $(top_builddir)/config.status - @rm -f stamp-h1 - cd $(top_builddir) && $(SHELL) ./config.status config.h -$(srcdir)/config-h.in: $(am__configure_deps) - cd $(top_srcdir) && $(AUTOHEADER) - rm -f stamp-h1 - touch $@ - -distclean-hdr: - -rm -f config.h stamp-h1 checks/Makefile: $(top_builddir)/config.status $(top_srcdir)/checks/Makefile.in cd $(top_builddir) && $(SHELL) ./config.status $@ -uninstall-info-am: # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. @@ -322,8 +315,7 @@ $(RECURSIVE_TARGETS): $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" -mostlyclean-recursive clean-recursive distclean-recursive \ -maintainer-clean-recursive: +$(RECURSIVE_CLEAN_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ @@ -372,7 +364,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS mkid -fID $$unique tags: TAGS -TAGS: tags-recursive $(HEADERS) $(SOURCES) config-h.in $(TAGS_DEPENDENCIES) \ +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ @@ -389,7 +381,7 @@ TAGS: tags-recursive $(HEADERS) $(SOURCE tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ - list='$(SOURCES) $(HEADERS) config-h.in $(LISP) $(TAGS_FILES)'; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ @@ -401,11 +393,11 @@ TAGS: tags-recursive $(HEADERS) $(SOURCE $$tags $$unique; \ fi ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config-h.in $(TAGS_DEPENDENCIES) \ +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ - list='$(SOURCES) $(HEADERS) config-h.in $(LISP) $(TAGS_FILES)'; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ @@ -425,24 +417,22 @@ distclean-tags: distdir: $(DISTFILES) $(am__remove_distdir) - mkdir $(distdir) - $(mkdir_p) $(distdir)/checks $(distdir)/m4 - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ + test -d $(distdir) || mkdir $(distdir) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ @@ -456,7 +446,7 @@ distdir: $(DISTFILES) list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ - || $(mkdir_p) "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ distdir=`$(am__cd) $(distdir) && pwd`; \ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ @@ -464,6 +454,8 @@ distdir: $(DISTFILES) $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$top_distdir" \ distdir="$$distdir/$$subdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ distdir) \ || exit 1; \ fi; \ @@ -471,7 +463,7 @@ distdir: $(DISTFILES) -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ + ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r $(distdir) dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz @@ -546,7 +538,7 @@ distcheck: dist $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ - sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' + sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @cd $(distuninstallcheck_dir) \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ @@ -567,7 +559,7 @@ distcleancheck: distclean exit 1; } >&2 check-am: all-am check: check-recursive -all-am: Makefile config.h +all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive @@ -603,7 +595,7 @@ clean-am: clean-generic mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-hdr distclean-tags +distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive @@ -617,12 +609,20 @@ info-am: install-data-am: +install-dvi: install-dvi-recursive + install-exec-am: +install-html: install-html-recursive + install-info: install-info-recursive install-man: +install-pdf: install-pdf-recursive + +install-ps: install-ps-recursive + installcheck-am: maintainer-clean: maintainer-clean-recursive @@ -643,24 +643,25 @@ ps: ps-recursive ps-am: -uninstall-am: uninstall-info-am +uninstall-am: -uninstall-info: uninstall-info-recursive +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ + install-strip -.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \ - check-am clean clean-generic clean-recursive ctags \ - ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-shar \ - dist-tarZ dist-zip distcheck distclean distclean-generic \ - distclean-hdr distclean-recursive distclean-tags \ - distcleancheck distdir distuninstallcheck dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-strip installcheck \ - installcheck-am installdirs installdirs-am maintainer-clean \ - maintainer-clean-generic maintainer-clean-recursive \ - mostlyclean mostlyclean-generic mostlyclean-recursive pdf \ - pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \ - uninstall-info-am +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am am--refresh check check-am clean clean-generic \ + ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \ + dist-shar dist-tarZ dist-zip distcheck distclean \ + distclean-generic distclean-tags distcleancheck distdir \ + distuninstallcheck dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ + tags-recursive uninstall uninstall-am # 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. diff -ruNp m4-1.4.7/NEWS m4-1.4.8/NEWS --- m4-1.4.7/NEWS 2006-09-25 06:02:21.000000000 -0600 +++ m4-1.4.8/NEWS 2006-11-20 06:57:48.000000000 -0700 @@ -2,6 +2,57 @@ GNU M4 NEWS - User visible changes. Copyright (C) 1992, 1993, 1994, 2004, 2005, 2006 Free Software Foundation, Inc. +Version 1.4.8 - 20 November 2006, by Eric Blake (CVS version 1.4.7a) + +* The `divert' macro and `-H'/`--hashsize' command line option no longer + cause a core dump when handed extra large values. Also, `divert' now + uses memory proportional to the number of diversions in use, rather than + to the maximum diversion number encountered, so that large diversion + numbers are less likely to exhaust system memory; and is no longer + limited by the maximum number of file descriptors. +* The `--help' and `--version' command line options now consistently + override all earlier options. For example, `m4 --debugfile=trace + --help' now no longer accidentally creates an empty file `trace'. +* The `-L'/`--nesting-limit' command line option can now be set to 0 + to remove the default limit of 1024. However, it is still possible that + heavily nested input can cause abrupt program termination due to stack + overflow. +* Problems encountered when writing to standard error, such as with the + `errprint' macro, now always cause a non-zero exit status. +* Warnings and errors issued during macro expansion are now consistently + reported at the line where the macro name was detected, rather than + where the close parenthesis resides. Text wrapped by `m4wrap' now + remembers the location that was in effect when m4wrap was invoked, + rather than changing to line 0 and the empty string for a file. The + macros `__line__' and `__file__' now work correctly even as the last + token in an included file. +* The `builtin' and `indir' macros now transparently handle builtin + tokens generated by `defn'. +* When diversions created by the `divert' macro collect enough text that + M4 must use temporary files, the environment variable $TMPDIR is now + consulted, and a better effort is made to clean up those files in the + event of a fatal signal. +* The `mkstemp' builtin is added with the same GNU semantics as `maketemp', + based on the recommendation of POSIX to deprecate the POSIX semantics of + `maketemp' as inherently insecure. In GNU mode (no -G supplied on the + command line), `maketemp' silently retains the secure GNU semantics, but + a future release of M4 will change this to emit a warning. In + traditional mode (m4 -G), `maketemp' now uses the POSIX-mandated insecure + semantics, and issues a warning that you should convert your script to + use `mkstemp' instead. Additionally, `mkstemp' and `maketemp' are now + well-defined even if the template argument does not end in six `X' + characters. +* The manual has been improved, including a new section on a composite + macro `foreach'. +* The `changecom' and `changequote' macros now treat an empty second + argument the same as if it were missing, rather than using the empty + string and making it impossible to end a comment or quote. +* The `translit' macro now operates in linear instead of quadratic time, + and is now eight-bit clean. +* The `-D', `-U', `-s', and `-t' command line options now take effect + after any files encountered earlier on the command line, rather than up + front, as is done in traditional implementations and required by POSIX. + Version 1.4.7 - 25 September 2006, by Eric Blake (CVS version 1.4.6a) * Fix regression from 1.4.5 in handling a file that ends in a macro diff -ruNp m4-1.4.7/THANKS m4-1.4.8/THANKS --- m4-1.4.7/THANKS 2006-09-23 22:28:02.000000000 -0600 +++ m4-1.4.8/THANKS 2006-11-20 06:55:42.000000000 -0700 @@ -57,6 +57,7 @@ Kristine Lund lund@lpnaxp.in2p3.fr Krste Asanovic krste@icsi.berkeley.edu Marion Hakanson hakanson@cse.ogi.edu Mark Seiden mis@seiden.com +Martin Koeppe mkoeppe@gmx.de Matt Kraai kraai@debian.org Matthias Rabe rabe@mathematik.uni-bielefeld.de Michael Fetterman mafetter@ichips.intel.com diff -ruNp m4-1.4.7/aclocal.m4 m4-1.4.8/aclocal.m4 --- m4-1.4.7/aclocal.m4 2006-09-25 06:07:24.000000000 -0600 +++ m4-1.4.8/aclocal.m4 2006-11-20 07:25:28.000000000 -0700 @@ -1,7 +1,7 @@ -# generated automatically by aclocal 1.9.6 -*- Autoconf -*- +# generated automatically by aclocal 1.10 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005 Free Software Foundation, Inc. +# 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. @@ -11,7 +11,12 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. -# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. +m4_if(m4_PACKAGE_VERSION, [2.61],, +[m4_fatal([this file was generated for autoconf 2.61. +You have another version of autoconf. If you want to use that, +you should regenerate the build system entirely.], [63])]) + +# Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -21,14 +26,29 @@ # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. -AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"]) +# (This private macro should not be called outside this file.) +AC_DEFUN([AM_AUTOMAKE_VERSION], +[am__api_version='1.10' +dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to +dnl require some minimum version. Point them to the right macro. +m4_if([$1], [1.10], [], + [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl +]) + +# _AM_AUTOCONF_VERSION(VERSION) +# ----------------------------- +# aclocal traces this macro to find the Autoconf version. +# This is a private macro too. Using m4_define simplifies +# the logic in aclocal, which can simply ignore this definition. +m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- -# Call AM_AUTOMAKE_VERSION so it can be traced. +# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], - [AM_AUTOMAKE_VERSION([1.9.6])]) +[AM_AUTOMAKE_VERSION([1.10])dnl +_AM_AUTOCONF_VERSION(m4_PACKAGE_VERSION)]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- @@ -85,14 +105,14 @@ am_aux_dir=`cd $ac_aux_dir && pwd` # AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005 +# Copyright (C) 1997, 2000, 2001, 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. -# serial 7 +# serial 8 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- @@ -101,8 +121,10 @@ AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl -AC_SUBST([$1_TRUE]) -AC_SUBST([$1_FALSE]) +AC_SUBST([$1_TRUE])dnl +AC_SUBST([$1_FALSE])dnl +_AM_SUBST_NOTMAKE([$1_TRUE])dnl +_AM_SUBST_NOTMAKE([$1_FALSE])dnl if $2; then $1_TRUE= $1_FALSE='#' @@ -116,15 +138,14 @@ AC_CONFIG_COMMANDS_PRE( Usually this means the macro was only invoked conditionally.]]) fi])]) - -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 +# Copyright (C) 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. -# serial 8 +# serial 9 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, @@ -152,6 +173,7 @@ AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], UPC, [depcc="$UPC" am_compiler_list=], [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) @@ -217,6 +239,7 @@ AC_CACHE_CHECK([dependency style of $dep depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then @@ -269,7 +292,8 @@ if test "x$enable_dependency_tracking" ! AMDEPBACKSLASH='\' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) -AC_SUBST([AMDEPBACKSLASH]) +AC_SUBST([AMDEPBACKSLASH])dnl +_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- @@ -294,8 +318,9 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. - # So let's grep whole file. - if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue @@ -342,8 +367,8 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS] # Do all the work for Automake. -*- Autoconf -*- -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -# Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 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, @@ -366,16 +391,20 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS] # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], -[AC_PREREQ([2.58])dnl +[AC_PREREQ([2.60])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl -# test to see if srcdir already configured -if test "`cd $srcdir && pwd`" != "`pwd`" && - test -f $srcdir/config.status; then - AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) + fi fi # test whether we have cygpath @@ -395,6 +424,9 @@ m4_ifval([$2], AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl +dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. +m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, + [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl @@ -430,6 +462,10 @@ AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJC], + [_AM_DEPENDENCIES(OBJC)], + [define([AC_PROG_OBJC], + defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl ]) ]) @@ -465,7 +501,7 @@ echo "timestamp for $1" >`AS_DIRNAME([$1 # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -install_sh=${install_sh-"$am_aux_dir/install-sh"} +install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"} AC_SUBST(install_sh)]) # Copyright (C) 2003, 2005 Free Software Foundation, Inc. @@ -543,14 +579,14 @@ rm -f confinc confmf # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- -# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005 +# Copyright (C) 1997, 1999, 2000, 2001, 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. -# serial 4 +# serial 5 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ @@ -566,6 +602,7 @@ AC_SUBST($1)]) # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([missing])dnl test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then @@ -576,7 +613,7 @@ else fi ]) -# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. +# Copyright (C) 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, @@ -584,60 +621,23 @@ fi # AM_PROG_MKDIR_P # --------------- -# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. -# -# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories -# created by `make install' are always world readable, even if the -# installer happens to have an overly restrictive umask (e.g. 077). -# This was a mistake. There are at least two reasons why we must not -# use `-m 0755': -# - it causes special bits like SGID to be ignored, -# - it may be too restrictive (some setups expect 775 directories). -# -# Do not use -m 0755 and let people choose whatever they expect by -# setting umask. -# -# We cannot accept any implementation of `mkdir' that recognizes `-p'. -# Some implementations (such as Solaris 8's) are not thread-safe: if a -# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c' -# concurrently, both version can detect that a/ is missing, but only -# one can create it and the other will error out. Consequently we -# restrict ourselves to GNU make (using the --version option ensures -# this.) +# Check for `mkdir -p'. AC_DEFUN([AM_PROG_MKDIR_P], -[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then - # We used to keeping the `.' as first argument, in order to - # allow $(mkdir_p) to be used without argument. As in - # $(mkdir_p) $(somedir) - # where $(somedir) is conditionally defined. However this is wrong - # for two reasons: - # 1. if the package is installed by a user who cannot write `.' - # make install will fail, - # 2. the above comment should most certainly read - # $(mkdir_p) $(DESTDIR)$(somedir) - # so it does not work when $(somedir) is undefined and - # $(DESTDIR) is not. - # To support the latter case, we have to write - # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), - # so the `.' trick is pointless. - mkdir_p='mkdir -p --' -else - # On NextStep and OpenStep, the `mkdir' command does not - # recognize any option. It will interpret all options as - # directories to create, and then abort because `.' already - # exists. - for d in ./-p ./--version; - do - test -d $d && rmdir $d - done - # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. - if test -f "$ac_aux_dir/mkinstalldirs"; then - mkdir_p='$(mkinstalldirs)' - else - mkdir_p='$(install_sh) -d' - fi -fi -AC_SUBST([mkdir_p])]) +[AC_PREREQ([2.60])dnl +AC_REQUIRE([AC_PROG_MKDIR_P])dnl +dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, +dnl while keeping a definition of mkdir_p for backward compatibility. +dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. +dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of +dnl Makefile.ins that do not define MKDIR_P, so we do our own +dnl adjustment using top_builddir (which is defined more often than +dnl MKDIR_P). +AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl +case $mkdir_p in + [[\\/$]]* | ?:[[\\/]]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac +]) # Helper functions for option handling. -*- Autoconf -*- @@ -749,9 +749,21 @@ dnl Don't test for $cross_compiling = ye if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi -INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) +# 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. + +# _AM_SUBST_NOTMAKE(VARIABLE) +# --------------------------- +# Prevent Automake from outputing VARIABLE = @VARIABLE@ in Makefile.in. +# This macro is traced by Automake. +AC_DEFUN([_AM_SUBST_NOTMAKE]) + # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004, 2005 Free Software Foundation, Inc. @@ -850,17 +862,24 @@ AC_SUBST([am__untar]) m4_include([m4/absolute-header.m4]) m4_include([m4/alloca.m4]) +m4_include([m4/allocsa.m4]) m4_include([m4/cloexec.m4]) m4_include([m4/close-stream.m4]) +m4_include([m4/closeout.m4]) m4_include([m4/codeset.m4]) +m4_include([m4/config-h.m4]) +m4_include([m4/eealloc.m4]) m4_include([m4/eoverflow.m4]) m4_include([m4/error.m4]) m4_include([m4/exitfail.m4]) m4_include([m4/extensions.m4]) +m4_include([m4/fatal-signal.m4]) m4_include([m4/fpending.m4]) m4_include([m4/free.m4]) m4_include([m4/getopt.m4]) +m4_include([m4/gl_list.m4]) m4_include([m4/gnulib-comp.m4]) +m4_include([m4/inline.m4]) m4_include([m4/intmax_t.m4]) m4_include([m4/inttypes_h.m4]) m4_include([m4/longdouble.m4]) @@ -868,13 +887,17 @@ m4_include([m4/longlong.m4]) m4_include([m4/mbchar.m4]) m4_include([m4/mbiter.m4]) m4_include([m4/mbrtowc.m4]) +m4_include([m4/mbstate_t.m4]) m4_include([m4/memchr.m4]) +m4_include([m4/mkdtemp.m4]) m4_include([m4/mkstemp.m4]) +m4_include([m4/pathmax.m4]) +m4_include([m4/quotearg.m4]) m4_include([m4/regex.m4]) -m4_include([m4/signed.m4]) +m4_include([m4/sig_atomic_t.m4]) +m4_include([m4/signalblocking.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]) @@ -882,8 +905,12 @@ 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/strstr.m4]) m4_include([m4/strtol.m4]) m4_include([m4/sys_stat_h.m4]) +m4_include([m4/tempname.m4]) +m4_include([m4/tmpdir.m4]) +m4_include([m4/ulonglong.m4]) m4_include([m4/unistd-safer.m4]) m4_include([m4/unistd_h.m4]) m4_include([m4/unlocked-io.m4]) diff -ruNp m4-1.4.7/checks/001.comments m4-1.4.8/checks/001.comments --- m4-1.4.7/checks/001.comments 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/001.comments 2006-11-20 07:12:37.000000000 -0700 @@ -1,4 +1,4 @@ -dnl @ ../doc/m4.texinfo:807: Origin of test +dnl @ ../doc/m4.texinfo:872: 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 diff -ruNp m4-1.4.7/checks/002.inhibiting m4-1.4.8/checks/002.inhibiting --- m4-1.4.7/checks/002.inhibiting 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/002.inhibiting 2006-11-20 07:12:37.000000000 -0700 @@ -1,4 +1,4 @@ -dnl @ ../doc/m4.texinfo:984: Origin of test +dnl @ ../doc/m4.texinfo:1049: 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 diff -ruNp m4-1.4.7/checks/003.inhibiting m4-1.4.8/checks/003.inhibiting --- m4-1.4.7/checks/003.inhibiting 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/003.inhibiting 2006-11-20 07:12:37.000000000 -0700 @@ -1,4 +1,4 @@ -dnl @ ../doc/m4.texinfo:998: Origin of test +dnl @ ../doc/m4.texinfo:1063: 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 diff -ruNp m4-1.4.7/checks/004.inhibiting m4-1.4.8/checks/004.inhibiting --- m4-1.4.7/checks/004.inhibiting 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/004.inhibiting 2006-11-20 07:12:37.000000000 -0700 @@ -1,4 +1,4 @@ -dnl @ ../doc/m4.texinfo:1013: Origin of test +dnl @ ../doc/m4.texinfo:1078: 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 diff -ruNp m4-1.4.7/checks/005.inhibiting m4-1.4.8/checks/005.inhibiting --- m4-1.4.7/checks/005.inhibiting 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/005.inhibiting 2006-11-20 07:12:37.000000000 -0700 @@ -1,4 +1,4 @@ -dnl @ ../doc/m4.texinfo:1026: Origin of test +dnl @ ../doc/m4.texinfo:1091: 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 diff -ruNp m4-1.4.7/checks/006.inhibiting m4-1.4.8/checks/006.inhibiting --- m4-1.4.7/checks/006.inhibiting 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/006.inhibiting 2006-11-20 07:12:37.000000000 -0700 @@ -1,4 +1,4 @@ -dnl @ ../doc/m4.texinfo:1038: Origin of test +dnl @ ../doc/m4.texinfo:1103: 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 diff -ruNp m4-1.4.7/checks/007.macro_argu m4-1.4.8/checks/007.macro_argu --- m4-1.4.7/checks/007.macro_argu 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/007.macro_argu 2006-11-20 07:12:37.000000000 -0700 @@ -1,12 +1,23 @@ -dnl @ ../doc/m4.texinfo:1093: Origin of test +dnl @ ../doc/m4.texinfo:1135: 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') +define(`macro', `$1') +dnl @result{} +macro( unquoted leading space lost) +dnl @result{}unquoted leading space lost +macro(` quoted leading space kept') +dnl @result{} quoted leading space kept +macro( + divert `unquoted space kept after expansion') +dnl @result{} unquoted space kept after expansion +macro(macro(` +')`whitespace from expansion kept') +dnl @result{} +dnl @result{}whitespace from expansion kept +macro(`unquoted trailing whitespace kept' +) +dnl @result{}unquoted trailing whitespace kept dnl @result{} -f(define(`f', `2')) -dnl @result{}1 -f -dnl @result{}2 diff -ruNp m4-1.4.7/checks/008.macro_argu m4-1.4.8/checks/008.macro_argu --- m4-1.4.7/checks/008.macro_argu 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/008.macro_argu 2006-11-20 07:12:37.000000000 -0700 @@ -1,8 +1,12 @@ -dnl @ ../doc/m4.texinfo:1104: Origin of test +dnl @ ../doc/m4.texinfo:1181: 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 +define(`f', `1') +dnl @result{} +f(define(`f', `2')) +dnl @result{}1 +f +dnl @result{}2 diff -ruNp m4-1.4.7/checks/009.define m4-1.4.8/checks/009.define --- m4-1.4.7/checks/009.define 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/009.define 1969-12-31 17:00:00.000000000 -0700 @@ -1,10 +0,0 @@ -dnl @ ../doc/m4.texinfo:1210: 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{} -foo -dnl @result{}Hello world. diff -ruNp m4-1.4.7/checks/009.macro_argu m4-1.4.8/checks/009.macro_argu --- m4-1.4.7/checks/009.macro_argu 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/009.macro_argu 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,10 @@ +dnl @ ../doc/m4.texinfo:1192: 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. +hello world +dnl @result{}hello world +define( +dnl @error{}m4:stdin:2: ERROR: end of file in argument list diff -ruNp m4-1.4.7/checks/010.define m4-1.4.8/checks/010.define --- m4-1.4.7/checks/010.define 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/010.define 2006-11-20 07:12:37.000000000 -0700 @@ -1,12 +1,10 @@ -dnl @ ../doc/m4.texinfo:1227: Origin of test +dnl @ ../doc/m4.texinfo:1300: 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) +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.7/checks/011.define m4-1.4.8/checks/011.define --- m4-1.4.7/checks/011.define 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/011.define 2006-11-20 07:12:37.000000000 -0700 @@ -1,18 +1,12 @@ -dnl @ ../doc/m4.texinfo:1253: Origin of test +dnl @ ../doc/m4.texinfo:1317: 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'))') +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.7/checks/012.arguments m4-1.4.8/checks/012.arguments --- m4-1.4.7/checks/012.arguments 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/012.arguments 1969-12-31 17:00:00.000000000 -0700 @@ -1,10 +0,0 @@ -dnl @ ../doc/m4.texinfo:1282: 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{} -exch(`arg1', `arg2') -dnl @result{}arg2, arg1 diff -ruNp m4-1.4.7/checks/012.define m4-1.4.8/checks/012.define --- m4-1.4.7/checks/012.define 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/012.define 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:1343: 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.7/checks/013.arguments m4-1.4.8/checks/013.arguments --- m4-1.4.7/checks/013.arguments 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/013.arguments 2006-11-20 07:12:37.000000000 -0700 @@ -1,4 +1,4 @@ -dnl @ ../doc/m4.texinfo:1292: Origin of test +dnl @ ../doc/m4.texinfo:1372: 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 @@ -6,7 +6,5 @@ dnl @ with or without modifications, as 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.7/checks/014.arguments m4-1.4.8/checks/014.arguments --- m4-1.4.7/checks/014.arguments 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/014.arguments 2006-11-20 07:12:37.000000000 -0700 @@ -1,10 +1,12 @@ -dnl @ ../doc/m4.texinfo:1315: Origin of test +dnl @ ../doc/m4.texinfo:1382: 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'') +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.7/checks/015.arguments m4-1.4.8/checks/015.arguments --- m4-1.4.7/checks/015.arguments 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/015.arguments 2006-11-20 07:12:37.000000000 -0700 @@ -1,10 +1,10 @@ -dnl @ ../doc/m4.texinfo:1325: Origin of test +dnl @ ../doc/m4.texinfo:1405: 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'.') +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.7/checks/016.arguments m4-1.4.8/checks/016.arguments --- m4-1.4.7/checks/016.arguments 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/016.arguments 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,10 @@ +dnl @ ../doc/m4.texinfo:1415: 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.7/checks/016.pseudo_arg m4-1.4.8/checks/016.pseudo_arg --- m4-1.4.7/checks/016.pseudo_arg 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/016.pseudo_arg 1969-12-31 17:00:00.000000000 -0700 @@ -1,21 +0,0 @@ -dnl @ ../doc/m4.texinfo:1349: 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.7/checks/017.pseudo_arg m4-1.4.8/checks/017.pseudo_arg --- m4-1.4.7/checks/017.pseudo_arg 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/017.pseudo_arg 2006-11-20 07:12:37.000000000 -0700 @@ -1,10 +1,21 @@ -dnl @ ../doc/m4.texinfo:1370: Origin of test +dnl @ ../doc/m4.texinfo:1439: 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', `$*') +define(`nargs', `$#') dnl @result{} -echo(arg1, arg2, arg3 , arg4) -dnl @result{}arg1,arg2,arg3 ,arg4 +nargs +dnl @result{}0 +nargs() +dnl @result{}1 +nargs(`arg1', `arg2', `arg3') +dnl @result{}3 +nargs(`commas can be quoted, like this') +dnl @result{}1 +nargs(arg1#inside comments, commas do not separate arguments +still arg1) +dnl @result{}1 +nargs((unquoted parentheses, like this, group arguments)) +dnl @result{}1 diff -ruNp m4-1.4.7/checks/018.pseudo_arg m4-1.4.8/checks/018.pseudo_arg --- m4-1.4.7/checks/018.pseudo_arg 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/018.pseudo_arg 2006-11-20 07:12:37.000000000 -0700 @@ -1,10 +1,10 @@ -dnl @ ../doc/m4.texinfo:1381: Origin of test +dnl @ ../doc/m4.texinfo:1460: 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', `$@') +define(`echo', `$*') dnl @result{} echo(arg1, arg2, arg3 , arg4) dnl @result{}arg1,arg2,arg3 ,arg4 diff -ruNp m4-1.4.7/checks/019.pseudo_arg m4-1.4.8/checks/019.pseudo_arg --- m4-1.4.7/checks/019.pseudo_arg 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/019.pseudo_arg 2006-11-20 07:12:37.000000000 -0700 @@ -1,20 +1,10 @@ -dnl @ ../doc/m4.texinfo:1391: Origin of test +dnl @ ../doc/m4.texinfo:1471: 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', `$*') +define(`echo', `$@') 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 +echo(arg1, arg2, arg3 , arg4) +dnl @result{}arg1,arg2,arg3 ,arg4 diff -ruNp m4-1.4.7/checks/020.pseudo_arg m4-1.4.8/checks/020.pseudo_arg --- m4-1.4.7/checks/020.pseudo_arg 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/020.pseudo_arg 2006-11-20 07:12:37.000000000 -0700 @@ -1,4 +1,4 @@ -dnl @ ../doc/m4.texinfo:1413: Origin of test +dnl @ ../doc/m4.texinfo:1481: 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 @@ -8,13 +8,13 @@ define(`echo1', `$*') dnl @result{} define(`echo2', `$@') dnl @result{} -define(`foo', `bar') +define(`foo', `This is macro `foo'.') dnl @result{} -echo1(#foo'foo -foo) -dnl @result{}#foo'foo -dnl @result{}bar -echo2(#foo'foo -foo) -dnl @result{}#foobar -dnl @result{}bar' +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.7/checks/021.pseudo_arg m4-1.4.8/checks/021.pseudo_arg --- m4-1.4.7/checks/021.pseudo_arg 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/021.pseudo_arg 2006-11-20 07:12:37.000000000 -0700 @@ -1,10 +1,20 @@ -dnl @ ../doc/m4.texinfo:1434: Origin of test +dnl @ ../doc/m4.texinfo:1503: 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 $$$') +define(`echo1', `$*') dnl @result{} -foo -dnl @result{}$$$ hello $$$ +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.7/checks/022.pseudo_arg m4-1.4.8/checks/022.pseudo_arg --- m4-1.4.7/checks/022.pseudo_arg 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/022.pseudo_arg 2006-11-20 07:12:37.000000000 -0700 @@ -1,26 +1,10 @@ -dnl @ ../doc/m4.texinfo:1447: Origin of test +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', `no nested quote: $1') +define(`foo', `$$$ hello $$$') dnl @result{} -foo(`arg') -dnl @result{}no nested quote: arg -define(`foo', `nested quote around $: `$'1') -dnl @result{} -foo(`arg') -dnl @result{}nested quote around $: $1 -define(`foo', `nested empty quote after $: $`'1') -dnl @result{} -foo(`arg') -dnl @result{}nested empty quote after $: $1 -define(`foo', `nested quote around next character: $`1'') -dnl @result{} -foo(`arg') -dnl @result{}nested quote around next character: $1 -define(`foo', `nested quote around both: `$1'') -dnl @result{} -foo(`arg') -dnl @result{}nested quote around both: arg +foo +dnl @result{}$$$ hello $$$ diff -ruNp m4-1.4.7/checks/023.pseudo_arg m4-1.4.8/checks/023.pseudo_arg --- m4-1.4.7/checks/023.pseudo_arg 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/023.pseudo_arg 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,26 @@ +dnl @ ../doc/m4.texinfo:1537: 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', `no nested quote: $1') +dnl @result{} +foo(`arg') +dnl @result{}no nested quote: arg +define(`foo', `nested quote around $: `$'1') +dnl @result{} +foo(`arg') +dnl @result{}nested quote around $: $1 +define(`foo', `nested empty quote after $: $`'1') +dnl @result{} +foo(`arg') +dnl @result{}nested empty quote after $: $1 +define(`foo', `nested quote around next character: $`1'') +dnl @result{} +foo(`arg') +dnl @result{}nested quote around next character: $1 +define(`foo', `nested quote around both: `$1'') +dnl @result{} +foo(`arg') +dnl @result{}nested quote around both: arg diff -ruNp m4-1.4.7/checks/023.undefine m4-1.4.8/checks/023.undefine --- m4-1.4.7/checks/023.undefine 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/023.undefine 1969-12-31 17:00:00.000000000 -0700 @@ -1,20 +0,0 @@ -dnl @ ../doc/m4.texinfo:1486: 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{} -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.7/checks/024.undefine m4-1.4.8/checks/024.undefine --- m4-1.4.7/checks/024.undefine 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/024.undefine 2006-11-20 07:12:37.000000000 -0700 @@ -1,12 +1,20 @@ -dnl @ ../doc/m4.texinfo:1506: Origin of test +dnl @ ../doc/m4.texinfo:1576: 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') +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.7/checks/025.defn m4-1.4.8/checks/025.defn --- m4-1.4.7/checks/025.defn 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/025.defn 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -dnl @ ../doc/m4.texinfo:1543: 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{} -zap(`undefine') -dnl @result{} -undefine(`zap') -dnl @result{}undefine(zap) diff -ruNp m4-1.4.7/checks/025.undefine m4-1.4.8/checks/025.undefine --- m4-1.4.7/checks/025.undefine 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/025.undefine 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:1596: 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.7/checks/026.defn m4-1.4.8/checks/026.defn --- m4-1.4.7/checks/026.defn 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/026.defn 2006-11-20 07:12:37.000000000 -0700 @@ -1,12 +1,12 @@ -dnl @ ../doc/m4.texinfo:1560: Origin of test +dnl @ ../doc/m4.texinfo:1633: 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'') +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.7/checks/027.defn m4-1.4.8/checks/027.defn --- m4-1.4.7/checks/027.defn 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/027.defn 2006-11-20 07:12:37.000000000 -0700 @@ -1,14 +1,12 @@ -dnl @ ../doc/m4.texinfo:1572: Origin of test +dnl @ ../doc/m4.texinfo:1650: 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 -') +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.7/checks/028.defn m4-1.4.8/checks/028.defn --- m4-1.4.7/checks/028.defn 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/028.defn 2006-11-20 07:12:37.000000000 -0700 @@ -1,18 +1,14 @@ -dnl @ ../doc/m4.texinfo:1590: Origin of test +dnl @ ../doc/m4.texinfo:1662: 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) +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.7/checks/029.defn m4-1.4.8/checks/029.defn --- m4-1.4.7/checks/029.defn 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/029.defn 2006-11-20 07:12:37.000000000 -0700 @@ -1,13 +1,18 @@ -dnl @ ../doc/m4.texinfo:1609: Origin of test +dnl @ ../doc/m4.texinfo:1680: 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. -defn(`defn') +define(`foo', a'a) dnl @result{} -define(defn(`divnum'), `cannot redefine a builtin token') -dnl @error{}m4:stdin:2: Warning: define: invalid macro name ignored +define(`a', `A') dnl @result{} -divnum -dnl @result{}0 +define(`echo', `$@') +dnl @result{} +foo +dnl @result{}A'A +defn(`foo') +dnl @result{}aA' +echo(foo) +dnl @result{}AA' diff -ruNp m4-1.4.7/checks/030.defn m4-1.4.8/checks/030.defn --- m4-1.4.7/checks/030.defn 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/030.defn 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,13 @@ +dnl @ ../doc/m4.texinfo:1699: 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. +defn(`defn') +dnl @result{} +define(defn(`divnum'), `cannot redefine a builtin token') +dnl @error{}m4:stdin:2: Warning: define: invalid macro name ignored +dnl @result{} +divnum +dnl @result{}0 diff -ruNp m4-1.4.7/checks/030.pushdef m4-1.4.8/checks/030.pushdef --- m4-1.4.7/checks/030.pushdef 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/030.pushdef 1969-12-31 17:00:00.000000000 -0700 @@ -1,30 +0,0 @@ -dnl @ ../doc/m4.texinfo:1648: 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. -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.7/checks/031.pushdef m4-1.4.8/checks/031.pushdef --- m4-1.4.7/checks/031.pushdef 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/031.pushdef 2006-11-20 07:12:37.000000000 -0700 @@ -1,4 +1,4 @@ -dnl @ ../doc/m4.texinfo:1680: Origin of test +dnl @ ../doc/m4.texinfo:1738: 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 @@ -12,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.7/checks/032.indir m4-1.4.8/checks/032.indir --- m4-1.4.7/checks/032.indir 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/032.indir 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -dnl @ ../doc/m4.texinfo:1729: 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.7/checks/032.pushdef m4-1.4.8/checks/032.pushdef --- m4-1.4.7/checks/032.pushdef 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/032.pushdef 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,22 @@ +dnl @ ../doc/m4.texinfo:1770: 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.7/checks/033.indir m4-1.4.8/checks/033.indir --- m4-1.4.7/checks/033.indir 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/033.indir 2006-11-20 07:12:37.000000000 -0700 @@ -1,15 +1,12 @@ -dnl @ ../doc/m4.texinfo:1749: Origin of test +dnl @ ../doc/m4.texinfo:1819: 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 -indir(`f', define(`f', `3')) -dnl @result{}3 -indir(`f', undefine(`f')) -dnl @error{}m4:stdin:4: undefined macro `f' +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.7/checks/034.builtin m4-1.4.8/checks/034.builtin --- m4-1.4.7/checks/034.builtin 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/034.builtin 1969-12-31 17:00:00.000000000 -0700 @@ -1,26 +0,0 @@ -dnl @ ../doc/m4.texinfo:1782: 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{} -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.7/checks/034.indir m4-1.4.8/checks/034.indir --- m4-1.4.7/checks/034.indir 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/034.indir 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,15 @@ +dnl @ ../doc/m4.texinfo:1839: 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 +indir(`f', define(`f', `3')) +dnl @result{}3 +indir(`f', undefine(`f')) +dnl @error{}m4:stdin:4: undefined macro `f' +dnl @result{} diff -ruNp m4-1.4.7/checks/035.builtin m4-1.4.8/checks/035.builtin --- m4-1.4.7/checks/035.builtin 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/035.builtin 1969-12-31 17:00:00.000000000 -0700 @@ -1,17 +0,0 @@ -dnl @ ../doc/m4.texinfo:1814: 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{} -builtin(`builtin') -dnl @error{}m4:stdin:3: Warning: too few arguments to builtin `builtin' -dnl @result{} -builtin(`builtin',) -dnl @error{}m4:stdin:4: undefined builtin `' -dnl @result{} diff -ruNp m4-1.4.7/checks/035.indir m4-1.4.8/checks/035.indir --- m4-1.4.7/checks/035.indir 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/035.indir 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,19 @@ +dnl @ ../doc/m4.texinfo:1856: 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. +indir(defn(`defn'), `divnum') +dnl @error{}m4:stdin:1: Warning: indir: invalid macro name ignored +dnl @result{} +indir(`define', defn(`defn'), `divnum') +dnl @error{}m4:stdin:2: Warning: define: invalid macro name ignored +dnl @result{} +indir(`define', `foo', defn(`divnum')) +dnl @result{} +foo +dnl @result{}0 +indir(`divert', defn(`foo')) +dnl @error{}m4:stdin:5: empty string treated as 0 in builtin `divert' +dnl @result{} diff -ruNp m4-1.4.7/checks/036.builtin m4-1.4.8/checks/036.builtin --- m4-1.4.7/checks/036.builtin 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/036.builtin 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,30 @@ +dnl @ ../doc/m4.texinfo:1893: 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{} +undefine(`undefine') +dnl @result{} +define(`foo', `bar') +dnl @result{}hidden +foo +dnl @result{}foo +builtin(`define', `foo', defn(`divnum')) +dnl @result{} +foo +dnl @result{}0 +builtin(`define', `foo', `BAR') +dnl @result{} +foo +dnl @result{}BAR +undefine(`foo') +dnl @result{}undefine(foo) +foo +dnl @result{}BAR +builtin(`undefine', `foo') +dnl @result{} +foo +dnl @result{}foo diff -ruNp m4-1.4.7/checks/036.ifdef m4-1.4.8/checks/036.ifdef --- m4-1.4.7/checks/036.ifdef 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/036.ifdef 1969-12-31 17:00:00.000000000 -0700 @@ -1,15 +0,0 @@ -dnl @ ../doc/m4.texinfo:1859: 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.7/checks/037.builtin m4-1.4.8/checks/037.builtin --- m4-1.4.7/checks/037.builtin 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/037.builtin 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,17 @@ +dnl @ ../doc/m4.texinfo:1929: 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{} +builtin(`builtin') +dnl @error{}m4:stdin:3: Warning: too few arguments to builtin `builtin' +dnl @result{} +builtin(`builtin',) +dnl @error{}m4:stdin:4: undefined builtin `' +dnl @result{} diff -ruNp m4-1.4.7/checks/037.ifelse m4-1.4.8/checks/037.ifelse --- m4-1.4.7/checks/037.ifelse 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/037.ifelse 1969-12-31 17:00:00.000000000 -0700 @@ -1,11 +0,0 @@ -dnl @ ../doc/m4.texinfo:1905: 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.7/checks/038.ifdef m4-1.4.8/checks/038.ifdef --- m4-1.4.7/checks/038.ifdef 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/038.ifdef 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,15 @@ +dnl @ ../doc/m4.texinfo:1976: 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.7/checks/038.ifelse m4-1.4.8/checks/038.ifelse --- m4-1.4.7/checks/038.ifelse 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/038.ifelse 1969-12-31 17:00:00.000000000 -0700 @@ -1,16 +0,0 @@ -dnl @ ../doc/m4.texinfo:1915: 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', `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.7/checks/039.ifelse m4-1.4.8/checks/039.ifelse --- m4-1.4.7/checks/039.ifelse 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/039.ifelse 2006-11-20 07:12:37.000000000 -0700 @@ -1,14 +1,11 @@ -dnl @ ../doc/m4.texinfo:1933: Origin of test +dnl @ ../doc/m4.texinfo:2022: 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:$#')') +ifelse(`some comments') +dnl @result{} +ifelse(`foo', `bar') +dnl @error{}m4:stdin:2: Warning: too few arguments to builtin `ifelse' dnl @result{} -foo -dnl @result{}foo -foo() -dnl @result{}arguments:1 -foo(`a', `b', `c') -dnl @result{}arguments:3 diff -ruNp m4-1.4.7/checks/040.ifelse m4-1.4.8/checks/040.ifelse --- m4-1.4.7/checks/040.ifelse 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/040.ifelse 2006-11-20 07:12:37.000000000 -0700 @@ -1,16 +1,16 @@ -dnl @ ../doc/m4.texinfo:1952: Origin of test +dnl @ ../doc/m4.texinfo:2032: 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') -dnl @error{}m4:stdin:1: Warning: excess arguments to builtin `ifelse' ignored -dnl @result{}gnu -ifelse(`foo', `bar', `third', `gnu', `gnats', `sixth') +ifelse(`foo', `bar', `true') dnl @result{} -ifelse(`foo', `bar', `third', `gnu', `gnats', `sixth', `seventh') -dnl @result{}seventh -ifelse(`foo', `bar', `3', `gnu', `gnats', `6', `7', `8') -dnl @error{}m4:stdin:4: Warning: excess arguments to builtin `ifelse' ignored -dnl @result{}7 +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.7/checks/041.ifelse m4-1.4.8/checks/041.ifelse --- m4-1.4.7/checks/041.ifelse 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/041.ifelse 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:2050: 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{} +foo +dnl @result{}foo +foo() +dnl @result{}arguments:1 +foo(`a', `b', `c') +dnl @result{}arguments:3 diff -ruNp m4-1.4.7/checks/041.loops m4-1.4.8/checks/041.loops --- m4-1.4.7/checks/041.loops 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/041.loops 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -dnl @ ../doc/m4.texinfo:1992: 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.7/checks/042.ifelse m4-1.4.8/checks/042.ifelse --- m4-1.4.7/checks/042.ifelse 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/042.ifelse 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:2069: 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') +dnl @error{}m4:stdin:1: Warning: excess arguments to builtin `ifelse' ignored +dnl @result{}gnu +ifelse(`foo', `bar', `third', `gnu', `gnats', `sixth') +dnl @result{} +ifelse(`foo', `bar', `third', `gnu', `gnats', `sixth', `seventh') +dnl @result{}seventh +ifelse(`foo', `bar', `3', `gnu', `gnats', `6', `7', `8') +dnl @error{}m4:stdin:4: Warning: excess arguments to builtin `ifelse' ignored +dnl @result{}7 diff -ruNp m4-1.4.7/checks/042.loops m4-1.4.8/checks/042.loops --- m4-1.4.7/checks/042.loops 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/042.loops 1969-12-31 17:00:00.000000000 -0700 @@ -1,15 +0,0 @@ -dnl @ ../doc/m4.texinfo:2009: 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{} -reverse -dnl @result{} -reverse(`foo') -dnl @result{}foo -reverse(`foo', `bar', `gnats', `and gnus') -dnl @result{}and gnus, gnats, bar, foo diff -ruNp m4-1.4.7/checks/043.loops m4-1.4.8/checks/043.loops --- m4-1.4.7/checks/043.loops 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/043.loops 1969-12-31 17:00:00.000000000 -0700 @@ -1,10 +0,0 @@ -dnl @ ../doc/m4.texinfo:2041: 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 diff -ruNp m4-1.4.7/checks/043.shift m4-1.4.8/checks/043.shift --- m4-1.4.7/checks/043.shift 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/043.shift 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:2109: 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.7/checks/044.loops m4-1.4.8/checks/044.loops --- m4-1.4.7/checks/044.loops 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/044.loops 1969-12-31 17:00:00.000000000 -0700 @@ -1,15 +0,0 @@ -dnl @ ../doc/m4.texinfo:2050: 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', `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.7/checks/044.shift m4-1.4.8/checks/044.shift --- m4-1.4.7/checks/044.shift 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/044.shift 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,15 @@ +dnl @ ../doc/m4.texinfo:2126: 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{} +reverse +dnl @result{} +reverse(`foo') +dnl @result{}foo +reverse(`foo', `bar', `gnats', `and gnus') +dnl @result{}and gnus, gnats, bar, foo diff -ruNp m4-1.4.7/checks/045.loops m4-1.4.8/checks/045.loops --- m4-1.4.7/checks/045.loops 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/045.loops 1969-12-31 17:00:00.000000000 -0700 @@ -1,16 +0,0 @@ -dnl @ ../doc/m4.texinfo:2076: 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.7/checks/045.shift m4-1.4.8/checks/045.shift --- m4-1.4.7/checks/045.shift 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/045.shift 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,23 @@ +dnl @ ../doc/m4.texinfo:2158: 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(`quote.m4') +dnl @result{} +-quote-dquote-dquote_elt- +dnl @result{}---- +-quote()-dquote()-dquote_elt()- +dnl @result{}--`'-`'- +-quote(`1')-dquote(`1')-dquote_elt(`1')- +dnl @result{}-1-`1'-`1'- +-quote(`1', `2')-dquote(`1', `2')-dquote_elt(`1', `2')- +dnl @result{}-1,2-`1',`2'-`1',`2'- +define(`n', `$#')dnl +-n(quote(`1', `2'))-n(dquote(`1', `2'))-n(dquote_elt(`1', `2'))- +dnl @result{}-1-1-2- +dquote(dquote_elt(`1', `2')) +dnl @result{}``1'',``2'' +dquote_elt(dquote(`1', `2')) +dnl @result{}``1',`2'' diff -ruNp m4-1.4.7/checks/046.dumpdef m4-1.4.8/checks/046.dumpdef --- m4-1.4.7/checks/046.dumpdef 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/046.dumpdef 1969-12-31 17:00:00.000000000 -0700 @@ -1,14 +0,0 @@ -dnl @ ../doc/m4.texinfo:2132: 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.7/checks/046.shift m4-1.4.8/checks/046.shift --- m4-1.4.7/checks/046.shift 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/046.shift 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:2189: 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(`quote.m4')dnl +dnl @result{}divert(`-1') +dnl @result{}# quote(args) - convert args to single-quoted string +dnl @result{}define(`quote', `ifelse(`$#', `0', `', ``$*'')') +dnl @result{}# dquote(args) - convert args to quoted list of quoted strings +dnl @result{}define(`dquote', ``$@'') +dnl @result{}# dquote_elt(args) - convert args to list of double-quoted strings +dnl @result{}define(`dquote_elt', `ifelse(`$#', `0', `', `$#', `1', ```$1''', +dnl @result{} ```$1'',$0(shift($@))')') +dnl @result{}divert`'dnl diff -ruNp m4-1.4.7/checks/047.dumpdef m4-1.4.8/checks/047.dumpdef --- m4-1.4.7/checks/047.dumpdef 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/047.dumpdef 1969-12-31 17:00:00.000000000 -0700 @@ -1,14 +0,0 @@ -dnl @ ../doc/m4.texinfo:2148: 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.7/checks/047.forloop m4-1.4.8/checks/047.forloop --- m4-1.4.7/checks/047.forloop 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/047.forloop 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,10 @@ +dnl @ ../doc/m4.texinfo:2221: 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 diff -ruNp m4-1.4.7/checks/048.forloop m4-1.4.8/checks/048.forloop --- m4-1.4.7/checks/048.forloop 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/048.forloop 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,15 @@ +dnl @ ../doc/m4.texinfo:2230: 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', `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.7/checks/048.trace m4-1.4.8/checks/048.trace --- m4-1.4.7/checks/048.trace 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/048.trace 1969-12-31 17:00:00.000000000 -0700 @@ -1,18 +0,0 @@ -dnl @ ../doc/m4.texinfo:2186: 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.7/checks/049.forloop m4-1.4.8/checks/049.forloop --- m4-1.4.7/checks/049.forloop 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/049.forloop 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,13 @@ +dnl @ ../doc/m4.texinfo:2256: 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 +dnl @result{}divert(`-1') +dnl @result{}# forloop(var, from, to, stmt) - simple version +dnl @result{}define(`forloop', `pushdef(`$1', `$2')_forloop($@)popdef(`$1')') +dnl @result{}define(`_forloop', +dnl @result{} `$4`'ifelse($1, `$3', `', `define(`$1', incr($1))$0($@)')') +dnl @result{}divert`'dnl diff -ruNp m4-1.4.7/checks/049.trace m4-1.4.8/checks/049.trace --- m4-1.4.7/checks/049.trace 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/049.trace 1969-12-31 17:00:00.000000000 -0700 @@ -1,33 +0,0 @@ -dnl @ ../doc/m4.texinfo:2211: 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{} -traceon(`foo') -dnl @result{} -foo -dnl @result{}foo -define(`foo', `bar') -dnl @result{} -foo -dnl @error{}m4trace: -1- foo -> `bar' -dnl @result{}bar -undefine(`foo') -dnl @result{} -ifdef(`foo', `yes', `no') -dnl @result{}no -indir(`foo') -dnl @error{}m4:stdin:8: undefined macro `foo' -dnl @result{} -define(`foo', `blah') -dnl @result{} -foo -dnl @error{}m4trace: -1- foo -> `blah' -dnl @result{}blah -traceoff -dnl @result{} -foo -dnl @result{}blah diff -ruNp m4-1.4.7/checks/050.foreach m4-1.4.8/checks/050.foreach --- m4-1.4.7/checks/050.foreach 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/050.foreach 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,20 @@ +dnl @ ../doc/m4.texinfo:2301: 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(`foreach.m4') +dnl @result{} +foreach(`x', (foo, bar, foobar), `Word was: x +')dnl +dnl @result{}Word was: foo +dnl @result{}Word was: bar +dnl @result{}Word was: foobar +include(`foreachq.m4') +dnl @result{} +foreachq(`x', `foo, bar, foobar', `Word was: x +')dnl +dnl @result{}Word was: foo +dnl @result{}Word was: bar +dnl @result{}Word was: foobar diff -ruNp m4-1.4.7/checks/050.trace m4-1.4.8/checks/050.trace --- m4-1.4.7/checks/050.trace 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/050.trace 1969-12-31 17:00:00.000000000 -0700 @@ -1,18 +0,0 @@ -dnl @ ../doc/m4.texinfo:2244: 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.7/checks/051.debug_leve m4-1.4.8/checks/051.debug_leve --- m4-1.4.7/checks/051.debug_leve 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/051.debug_leve 1969-12-31 17:00:00.000000000 -0700 @@ -1,25 +0,0 @@ -dnl @ ../doc/m4.texinfo:2339: 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.7/checks/051.foreach m4-1.4.8/checks/051.foreach --- m4-1.4.7/checks/051.foreach 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/051.foreach 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,24 @@ +dnl @ ../doc/m4.texinfo:2322: 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(`foreach.m4') +dnl @result{} +define(`_case', ` $1) + $2=" $1";; +')dnl +define(`_cat', `$1$2')dnl +case $`'1 in +dnl @result{}case $1 in +foreach(`x', `(`(`a', `vara')', `(`b', `varb')', `(`c', `varc')')', + `_cat(`_case', x)')dnl +dnl @result{} a) +dnl @result{} vara=" a";; +dnl @result{} b) +dnl @result{} varb=" b";; +dnl @result{} c) +dnl @result{} varc=" c";; +esac +dnl @result{}esac diff -ruNp m4-1.4.7/checks/052.debug_outp m4-1.4.8/checks/052.debug_outp --- m4-1.4.7/checks/052.debug_outp 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/052.debug_outp 1969-12-31 17:00:00.000000000 -0700 @@ -1,22 +0,0 @@ -dnl @ ../doc/m4.texinfo:2384: 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.7/checks/052.foreach m4-1.4.8/checks/052.foreach --- m4-1.4.7/checks/052.foreach 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/052.foreach 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,15 @@ +dnl @ ../doc/m4.texinfo:2350: 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(`foreach.m4')dnl +dnl @result{}divert(`-1') +dnl @result{}# foreach(x, (item_1, item_2, ..., item_n), stmt) +dnl @result{}# parenthesized list, simple version +dnl @result{}define(`foreach', `pushdef(`$1')_foreach($@)popdef(`$1')') +dnl @result{}define(`_arg1', `$1') +dnl @result{}define(`_foreach', `ifelse(`$2', `()', `', +dnl @result{} `define(`$1', _arg1$2)$3`'$0(`$1', (shift$2), `$3')')') +dnl @result{}divert`'dnl diff -ruNp m4-1.4.7/checks/053.dnl m4-1.4.8/checks/053.dnl --- m4-1.4.7/checks/053.dnl 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/053.dnl 1969-12-31 17:00:00.000000000 -0700 @@ -1,9 +0,0 @@ -dnl @ ../doc/m4.texinfo:2433: 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.7/checks/053.foreach m4-1.4.8/checks/053.foreach --- m4-1.4.7/checks/053.foreach 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/053.foreach 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,24 @@ +dnl @ ../doc/m4.texinfo:2375: 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', `1')define(`b', `2')define(`c', `3') +dnl @result{} +include(`foreach.m4') +dnl @result{} +include(`foreachq.m4') +dnl @result{} +foreach(`x', `(``a'', ``(b'', ``c)'')', `x +') +dnl @result{}1 +dnl @result{}(2)1 +dnl @result{} +dnl @result{}, x +dnl @result{}) +foreachq(`x', ```a'', ``(b'', ``c)''', `x +')dnl +dnl @result{}a +dnl @result{}(b +dnl @result{}c) diff -ruNp m4-1.4.7/checks/054.dnl m4-1.4.8/checks/054.dnl --- m4-1.4.7/checks/054.dnl 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/054.dnl 1969-12-31 17:00:00.000000000 -0700 @@ -1,11 +0,0 @@ -dnl @ ../doc/m4.texinfo:2451: 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.7/checks/054.foreach m4-1.4.8/checks/054.foreach --- m4-1.4.7/checks/054.foreach 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/054.foreach 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:2398: 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(`foreachq.m4')dnl +dnl @result{}include(`quote.m4')dnl +dnl @result{}divert(`-1') +dnl @result{}# foreachq(x, `item_1, item_2, ..., item_n', stmt) +dnl @result{}# quoted list, simple version +dnl @result{}define(`foreachq', `pushdef(`$1')_foreachq($@)popdef(`$1')') +dnl @result{}define(`_arg1', `$1') +dnl @result{}define(`_foreachq', `ifelse(quote($2), `', `', +dnl @result{} `define(`$1', `_arg1($2)')$3`'$0(`$1', `shift($2)', `$3')')') +dnl @result{}divert`'dnl diff -ruNp m4-1.4.7/checks/055.dnl m4-1.4.8/checks/055.dnl --- m4-1.4.7/checks/055.dnl 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/055.dnl 1969-12-31 17:00:00.000000000 -0700 @@ -1,13 +0,0 @@ -dnl @ ../doc/m4.texinfo:2462: 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.7/checks/055.dumpdef m4-1.4.8/checks/055.dumpdef --- m4-1.4.7/checks/055.dumpdef 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/055.dumpdef 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:2457: 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.7/checks/056.changequot m4-1.4.8/checks/056.changequot --- m4-1.4.7/checks/056.changequot 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/056.changequot 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -dnl @ ../doc/m4.texinfo:2491: 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.7/checks/056.dumpdef m4-1.4.8/checks/056.dumpdef --- m4-1.4.7/checks/056.dumpdef 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/056.dumpdef 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:2473: 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.7/checks/057.changequot m4-1.4.8/checks/057.changequot --- m4-1.4.7/checks/057.changequot 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/057.changequot 1969-12-31 17:00:00.000000000 -0700 @@ -1,14 +0,0 @@ -dnl @ ../doc/m4.texinfo:2506: 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.7/checks/057.trace m4-1.4.8/checks/057.trace --- m4-1.4.7/checks/057.trace 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/057.trace 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:2513: 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.7/checks/058.changequot m4-1.4.8/checks/058.changequot --- m4-1.4.7/checks/058.changequot 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/058.changequot 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -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. -changequote(`[[[', `]]]') -dnl @result{} -define([[[foo]]], [[[Macro [[[[[foo]]]]].]]]) -dnl @result{} -foo -dnl @result{}Macro [[foo]]. diff -ruNp m4-1.4.7/checks/058.trace m4-1.4.8/checks/058.trace --- m4-1.4.7/checks/058.trace 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/058.trace 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,33 @@ +dnl @ ../doc/m4.texinfo:2538: 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{} +traceon(`foo') +dnl @result{} +foo +dnl @result{}foo +define(`foo', `bar') +dnl @result{} +foo +dnl @error{}m4trace: -1- foo -> `bar' +dnl @result{}bar +undefine(`foo') +dnl @result{} +ifdef(`foo', `yes', `no') +dnl @result{}no +indir(`foo') +dnl @error{}m4:stdin:8: undefined macro `foo' +dnl @result{} +define(`foo', `blah') +dnl @result{} +foo +dnl @error{}m4trace: -1- foo -> `blah' +dnl @result{}blah +traceoff +dnl @result{} +foo +dnl @result{}blah diff -ruNp m4-1.4.7/checks/059.changequot m4-1.4.8/checks/059.changequot --- m4-1.4.7/checks/059.changequot 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/059.changequot 1969-12-31 17:00:00.000000000 -0700 @@ -1,14 +0,0 @@ -dnl @ ../doc/m4.texinfo:2532: 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.7/checks/059.trace m4-1.4.8/checks/059.trace --- m4-1.4.7/checks/059.trace 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/059.trace 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:2571: 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.7/checks/060.changequot m4-1.4.8/checks/060.changequot --- m4-1.4.7/checks/060.changequot 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/060.changequot 1969-12-31 17:00:00.000000000 -0700 @@ -1,18 +0,0 @@ -dnl @ ../doc/m4.texinfo:2558: 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.7/checks/060.debug_leve m4-1.4.8/checks/060.debug_leve --- m4-1.4.7/checks/060.debug_leve 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/060.debug_leve 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,25 @@ +dnl @ ../doc/m4.texinfo:2666: 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.7/checks/061.changequot m4-1.4.8/checks/061.changequot --- m4-1.4.7/checks/061.changequot 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/061.changequot 1969-12-31 17:00:00.000000000 -0700 @@ -1,28 +0,0 @@ -dnl @ ../doc/m4.texinfo:2579: 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.7/checks/061.debug_outp m4-1.4.8/checks/061.debug_outp --- m4-1.4.7/checks/061.debug_outp 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/061.debug_outp 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,22 @@ +dnl @ ../doc/m4.texinfo:2711: 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.7/checks/062.changequot m4-1.4.8/checks/062.changequot --- m4-1.4.7/checks/062.changequot 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/062.changequot 1969-12-31 17:00:00.000000000 -0700 @@ -1,24 +0,0 @@ -dnl @ ../doc/m4.texinfo:2611: 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.7/checks/062.dnl m4-1.4.8/checks/062.dnl --- m4-1.4.7/checks/062.dnl 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/062.dnl 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,9 @@ +dnl @ ../doc/m4.texinfo:2761: 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.7/checks/063.changequot m4-1.4.8/checks/063.changequot --- m4-1.4.7/checks/063.changequot 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/063.changequot 1969-12-31 17:00:00.000000000 -0700 @@ -1,8 +0,0 @@ -dnl @ ../doc/m4.texinfo:2634: 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.7/checks/063.dnl m4-1.4.8/checks/063.dnl --- m4-1.4.7/checks/063.dnl 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/063.dnl 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,11 @@ +dnl @ ../doc/m4.texinfo:2779: 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:1: Warning: excess arguments to builtin `dnl' ignored +See how `foo' was defined, foo? +dnl @result{}See how foo was defined, like this? diff -ruNp m4-1.4.7/checks/064.changecom m4-1.4.8/checks/064.changecom --- m4-1.4.7/checks/064.changecom 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/064.changecom 1969-12-31 17:00:00.000000000 -0700 @@ -1,16 +0,0 @@ -dnl @ ../doc/m4.texinfo:2658: 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.7/checks/064.dnl m4-1.4.8/checks/064.dnl --- m4-1.4.7/checks/064.dnl 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/064.dnl 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,13 @@ +dnl @ ../doc/m4.texinfo:2790: 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(`2 hi +')0 hi dnl 1 hi') +dnl @result{} +define(`hi', `HI') +dnl @result{} +dnl @error{}m4:stdin:1: Warning: end of file treated as newline +dnl @result{}0 HI 2 HI diff -ruNp m4-1.4.7/checks/065.changecom m4-1.4.8/checks/065.changecom --- m4-1.4.7/checks/065.changecom 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/065.changecom 1969-12-31 17:00:00.000000000 -0700 @@ -1,16 +0,0 @@ -dnl @ ../doc/m4.texinfo:2681: 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.7/checks/065.changequot m4-1.4.8/checks/065.changequot --- m4-1.4.7/checks/065.changequot 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/065.changequot 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:2820: 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.7/checks/066.changecom m4-1.4.8/checks/066.changecom --- m4-1.4.7/checks/066.changecom 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/066.changecom 1969-12-31 17:00:00.000000000 -0700 @@ -1,14 +0,0 @@ -dnl @ ../doc/m4.texinfo:2700: 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.7/checks/066.changequot m4-1.4.8/checks/066.changequot --- m4-1.4.7/checks/066.changequot 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/066.changequot 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:2835: 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.7/checks/067.changecom m4-1.4.8/checks/067.changecom --- m4-1.4.7/checks/067.changecom 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/067.changecom 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -dnl @ ../doc/m4.texinfo:2719: 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.7/checks/067.changequot m4-1.4.8/checks/067.changequot --- m4-1.4.7/checks/067.changequot 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/067.changequot 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:2850: 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.7/checks/068.changecom m4-1.4.8/checks/068.changecom --- m4-1.4.7/checks/068.changecom 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/068.changecom 1969-12-31 17:00:00.000000000 -0700 @@ -1,26 +0,0 @@ -dnl @ ../doc/m4.texinfo:2734: 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.7/checks/068.changequot m4-1.4.8/checks/068.changequot --- m4-1.4.7/checks/068.changequot 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/068.changequot 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:2872: 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'.' +changequote(`,) +dnl @result{} +foo +dnl @result{}Macro FOO. diff -ruNp m4-1.4.7/checks/069.changecom m4-1.4.8/checks/069.changecom --- m4-1.4.7/checks/069.changecom 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/069.changecom 1969-12-31 17:00:00.000000000 -0700 @@ -1,10 +0,0 @@ -dnl @ ../doc/m4.texinfo:2759: 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.7/checks/069.changequot m4-1.4.8/checks/069.changequot --- m4-1.4.7/checks/069.changequot 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/069.changequot 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,30 @@ +dnl @ ../doc/m4.texinfo:2905: 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(`q', `Q') +dnl @result{} +q hi Q hi +dnl @result{}q HI Q HI +echo(hi) +dnl @result{}qHIQ +changequote +dnl @result{} +changequote(`-', `EOF') +dnl @result{} +- hi EOF hi +dnl @result{} hi HI +changequote +dnl @result{} +changequote(`1', `2') +dnl @result{} +hi1hi2 +dnl @result{}hi1hi2 +hi 1hi2 +dnl @result{}HI hi diff -ruNp m4-1.4.7/checks/070.changequot m4-1.4.8/checks/070.changequot --- m4-1.4.7/checks/070.changequot 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/070.changequot 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,28 @@ +dnl @ ../doc/m4.texinfo:2938: 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.7/checks/070.changeword m4-1.4.8/checks/070.changeword --- m4-1.4.7/checks/070.changeword 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/070.changeword 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -dnl @ ../doc/m4.texinfo:2809: 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.7/checks/071.changequot m4-1.4.8/checks/071.changequot --- m4-1.4.7/checks/071.changequot 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/071.changequot 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,24 @@ +dnl @ ../doc/m4.texinfo:2970: 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.7/checks/071.changeword m4-1.4.8/checks/071.changeword --- m4-1.4.7/checks/071.changeword 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/071.changeword 1969-12-31 17:00:00.000000000 -0700 @@ -1,17 +0,0 @@ -dnl @ ../doc/m4.texinfo:2822: 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.7/checks/072.changequot m4-1.4.8/checks/072.changequot --- m4-1.4.7/checks/072.changequot 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/072.changequot 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,10 @@ +dnl @ ../doc/m4.texinfo:2993: 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. +`hello world' +dnl @result{}hello world +`dangling quote +dnl @error{}m4:stdin:2: ERROR: end of file in string diff -ruNp m4-1.4.7/checks/072.changeword m4-1.4.8/checks/072.changeword --- m4-1.4.7/checks/072.changeword 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/072.changeword 1969-12-31 17:00:00.000000000 -0700 @@ -1,38 +0,0 @@ -dnl @ ../doc/m4.texinfo:2841: 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(`foo -', `bar -') -dnl @result{} -dnl This example wants to recognize changeword, dnl, and `foo\n'. -dnl First, we check that our regexp will match. -regexp(`changeword', `[cd][a-z]*\|foo[ -]') -dnl @result{}0 -regexp(`foo -', `[cd][a-z]*\|foo[ -]') -dnl @result{}0 -regexp(`f', `[cd][a-z]*\|foo[ -]') -dnl @result{}-1 -foo -dnl @result{}foo -changeword(`[cd][a-z]*\|foo[ -]') -dnl @result{} -dnl Even though `foo\n' matches, we forgot to allow `f'. -foo -dnl @result{}foo -changeword(`[cd][a-z]*\|fo*[ -]?') -dnl @result{} -dnl Now we can call `foo\n'. -foo -dnl @result{}bar diff -ruNp m4-1.4.7/checks/073.changecom m4-1.4.8/checks/073.changecom --- m4-1.4.7/checks/073.changecom 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/073.changecom 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:3019: 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.7/checks/073.changeword m4-1.4.8/checks/073.changeword --- m4-1.4.7/checks/073.changeword 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/073.changeword 1969-12-31 17:00:00.000000000 -0700 @@ -1,18 +0,0 @@ -dnl @ ../doc/m4.texinfo:2880: 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 -ifdef(`__unix__', , - `errprint(` skipping: syscmd does not have unix semantics -')m4exit(`77')')dnl -changecom(`/*', `*/')dnl -define(`foo', `bar')dnl -changeword(`#\([_a-zA-Z0-9]*\)') -dnl @result{} -#esyscmd(`echo foo \#foo') -dnl @result{}foo bar -dnl @result{} diff -ruNp m4-1.4.7/checks/074.changecom m4-1.4.8/checks/074.changecom --- m4-1.4.7/checks/074.changecom 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/074.changecom 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:3046: 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.7/checks/074.changeword m4-1.4.8/checks/074.changeword --- m4-1.4.7/checks/074.changeword 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/074.changeword 1969-12-31 17:00:00.000000000 -0700 @@ -1,13 +0,0 @@ -dnl @ ../doc/m4.texinfo:2917: 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.7/checks/075.changecom m4-1.4.8/checks/075.changecom --- m4-1.4.7/checks/075.changecom 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/075.changecom 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:3065: 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.7/checks/075.m4wrap m4-1.4.8/checks/075.m4wrap --- m4-1.4.7/checks/075.m4wrap 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/075.m4wrap 1969-12-31 17:00:00.000000000 -0700 @@ -1,14 +0,0 @@ -dnl @ ../doc/m4.texinfo:2968: 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.7/checks/076.changecom m4-1.4.8/checks/076.changecom --- m4-1.4.7/checks/076.changecom 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/076.changecom 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,20 @@ +dnl @ ../doc/m4.texinfo:3088: 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{} +define(`hi1hi2', `hello') +dnl @result{} +changecom(`q', `Q') +dnl @result{} +q hi Q hi +dnl @result{}q hi Q HI +changecom(`1', `2') +dnl @result{} +hi1hi2 +dnl @result{}hello +hi 1hi2 +dnl @result{}HI 1hi2 diff -ruNp m4-1.4.7/checks/076.m4wrap m4-1.4.8/checks/076.m4wrap --- m4-1.4.7/checks/076.m4wrap 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/076.m4wrap 1969-12-31 17:00:00.000000000 -0700 @@ -1,13 +0,0 @@ -dnl @ ../doc/m4.texinfo:2997: 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.7/checks/077.changecom m4-1.4.8/checks/077.changecom --- m4-1.4.7/checks/077.changecom 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/077.changecom 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,26 @@ +dnl @ ../doc/m4.texinfo:3111: 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.7/checks/077.m4wrap m4-1.4.8/checks/077.m4wrap --- m4-1.4.7/checks/077.m4wrap 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/077.m4wrap 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -dnl @ ../doc/m4.texinfo:3011: 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.7/checks/078.changecom m4-1.4.8/checks/078.changecom --- m4-1.4.7/checks/078.changecom 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/078.changecom 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,10 @@ +dnl @ ../doc/m4.texinfo:3136: 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:2: ERROR: end of file in comment diff -ruNp m4-1.4.7/checks/078.m4wrap m4-1.4.8/checks/078.m4wrap --- m4-1.4.7/checks/078.m4wrap 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/078.m4wrap 1969-12-31 17:00:00.000000000 -0700 @@ -1,9 +0,0 @@ -dnl @ ../doc/m4.texinfo:3025: 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.7/checks/079.changeword m4-1.4.8/checks/079.changeword --- m4-1.4.7/checks/079.changeword 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/079.changeword 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:3186: 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.7/checks/079.include m4-1.4.8/checks/079.include --- m4-1.4.7/checks/079.include 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/079.include 1969-12-31 17:00:00.000000000 -0700 @@ -1,16 +0,0 @@ -dnl @ ../doc/m4.texinfo:3067: 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.7/checks/080.changeword m4-1.4.8/checks/080.changeword --- m4-1.4.7/checks/080.changeword 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/080.changeword 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,17 @@ +dnl @ ../doc/m4.texinfo:3199: 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.7/checks/080.include m4-1.4.8/checks/080.include --- m4-1.4.7/checks/080.include 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/080.include 1969-12-31 17:00:00.000000000 -0700 @@ -1,13 +0,0 @@ -dnl @ ../doc/m4.texinfo:3095: 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.7/checks/081.changeword m4-1.4.8/checks/081.changeword --- m4-1.4.7/checks/081.changeword 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/081.changeword 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,38 @@ +dnl @ ../doc/m4.texinfo:3218: 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(`foo +', `bar +') +dnl @result{} +dnl This example wants to recognize changeword, dnl, and `foo\n'. +dnl First, we check that our regexp will match. +regexp(`changeword', `[cd][a-z]*\|foo[ +]') +dnl @result{}0 +regexp(`foo +', `[cd][a-z]*\|foo[ +]') +dnl @result{}0 +regexp(`f', `[cd][a-z]*\|foo[ +]') +dnl @result{}-1 +foo +dnl @result{}foo +changeword(`[cd][a-z]*\|foo[ +]') +dnl @result{} +dnl Even though `foo\n' matches, we forgot to allow `f'. +foo +dnl @result{}foo +changeword(`[cd][a-z]*\|fo*[ +]?') +dnl @result{} +dnl Now we can call `foo\n'. +foo +dnl @result{}bar diff -ruNp m4-1.4.7/checks/081.include m4-1.4.8/checks/081.include --- m4-1.4.7/checks/081.include 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/081.include 1969-12-31 17:00:00.000000000 -0700 @@ -1,13 +0,0 @@ -dnl @ ../doc/m4.texinfo:3110: 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.7/checks/082.changeword m4-1.4.8/checks/082.changeword --- m4-1.4.7/checks/082.changeword 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/082.changeword 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,36 @@ +dnl @ ../doc/m4.texinfo:3260: 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(`bar +', defn(`dnl'))dnl +define(`baz', `dnl +include(`foo') ignored +dnl')dnl +changeword(`\([_a-zA-Z][_a-zA-Z0-9]*\|bar +\)') +dnl @result{} +__file__:__line__ +dnl @result{}stdin:10 +include(`foo') ignored +__file__:__line__ +dnl @result{}stdin:12 +baz ignored +__file__:__line__ +dnl @result{}stdin:14 +define(`bar +', defn(`__file__')) +dnl @result{} +include(`foo') +dnl @result{}../examples/foo +define(`bar +', defn(`__line__')) +dnl @result{} +include(`foo') +dnl @result{}1 +__file__:__line__ +dnl @result{}stdin:21 diff -ruNp m4-1.4.7/checks/082.divert m4-1.4.8/checks/082.divert --- m4-1.4.7/checks/082.divert 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/082.divert 1969-12-31 17:00:00.000000000 -0700 @@ -1,14 +0,0 @@ -dnl @ ../doc/m4.texinfo:3197: 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.7/checks/083.changeword m4-1.4.8/checks/083.changeword --- m4-1.4.7/checks/083.changeword 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/083.changeword 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:3298: 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 +ifdef(`__unix__', , + `errprint(` skipping: syscmd does not have unix semantics +')m4exit(`77')')dnl +changecom(`/*', `*/')dnl +define(`foo', `bar')dnl +changeword(`#\([_a-zA-Z0-9]*\)') +dnl @result{} +#esyscmd(`echo foo \#foo') +dnl @result{}foo bar +dnl @result{} diff -ruNp m4-1.4.7/checks/083.divert m4-1.4.8/checks/083.divert --- m4-1.4.7/checks/083.divert 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/083.divert 1969-12-31 17:00:00.000000000 -0700 @@ -1,14 +0,0 @@ -dnl @ ../doc/m4.texinfo:3213: 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.7/checks/084.changeword m4-1.4.8/checks/084.changeword --- m4-1.4.7/checks/084.changeword 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/084.changeword 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,13 @@ +dnl @ ../doc/m4.texinfo:3335: 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.7/checks/084.divert m4-1.4.8/checks/084.divert --- m4-1.4.7/checks/084.divert 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/084.divert 1969-12-31 17:00:00.000000000 -0700 @@ -1,11 +0,0 @@ -dnl @ ../doc/m4.texinfo:3230: 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.7/checks/085.divert m4-1.4.8/checks/085.divert --- m4-1.4.7/checks/085.divert 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/085.divert 1969-12-31 17:00:00.000000000 -0700 @@ -1,16 +0,0 @@ -dnl @ ../doc/m4.texinfo:3247: 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. -We decided to divert the stream for irrigation. -dnl @result{}We decided to the stream for irrigation. -define(`divert', `ifelse(`$#', `0', ``$0'', `builtin(`$0', $@)')') -dnl @result{} -divert(-1) -Ignored text. -divert(0) -dnl @result{} -We decided to divert the stream for irrigation. -dnl @result{}We decided to divert the stream for irrigation. diff -ruNp m4-1.4.7/checks/085.m4wrap m4-1.4.8/checks/085.m4wrap --- m4-1.4.7/checks/085.m4wrap 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/085.m4wrap 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:3386: 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.7/checks/086.m4wrap m4-1.4.8/checks/086.m4wrap --- m4-1.4.7/checks/086.m4wrap 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/086.m4wrap 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,13 @@ +dnl @ ../doc/m4.texinfo:3415: 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.7/checks/086.undivert m4-1.4.8/checks/086.undivert --- m4-1.4.7/checks/086.undivert 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/086.undivert 1969-12-31 17:00:00.000000000 -0700 @@ -1,16 +0,0 @@ -dnl @ ../doc/m4.texinfo:3275: 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. -undivert(`1') -dnl @result{} -dnl @result{}This text is diverted. -dnl @result{} diff -ruNp m4-1.4.7/checks/087.m4wrap m4-1.4.8/checks/087.m4wrap --- m4-1.4.7/checks/087.m4wrap 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/087.m4wrap 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:3429: 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.7/checks/087.undivert m4-1.4.8/checks/087.undivert --- m4-1.4.7/checks/087.undivert 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/087.undivert 1969-12-31 17:00:00.000000000 -0700 @@ -1,16 +0,0 @@ -dnl @ ../doc/m4.texinfo:3298: 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')diverted text -divert -dnl @result{} -undivert() -dnl @result{} -undivert(`0') -dnl @result{} -undivert -dnl @result{}diverted text -dnl @result{} diff -ruNp m4-1.4.7/checks/088.m4wrap m4-1.4.8/checks/088.m4wrap --- m4-1.4.7/checks/088.m4wrap 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/088.m4wrap 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,9 @@ +dnl @ ../doc/m4.texinfo:3443: 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:stdin:1: ERROR: end of file in argument list diff -ruNp m4-1.4.7/checks/088.undivert m4-1.4.8/checks/088.undivert --- m4-1.4.7/checks/088.undivert 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/088.undivert 1969-12-31 17:00:00.000000000 -0700 @@ -1,18 +0,0 @@ -dnl @ ../doc/m4.texinfo:3314: 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 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.7/checks/089.include m4-1.4.8/checks/089.include --- m4-1.4.7/checks/089.include 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/089.include 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:3485: 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 @error{}m4:stdin:1: cannot open `none': No such file or directory +dnl @result{} +include() +dnl @error{}m4:stdin:2: cannot open `': No such file or directory +dnl @result{} +sinclude(`none') +dnl @result{} +sinclude() +dnl @result{} diff -ruNp m4-1.4.7/checks/089.undivert m4-1.4.8/checks/089.undivert --- m4-1.4.7/checks/089.undivert 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/089.undivert 1969-12-31 17:00:00.000000000 -0700 @@ -1,14 +0,0 @@ -dnl @ ../doc/m4.texinfo:3333: 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')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.7/checks/090.include m4-1.4.8/checks/090.include --- m4-1.4.7/checks/090.include 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/090.include 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,13 @@ +dnl @ ../doc/m4.texinfo:3516: 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.7/checks/090.undivert m4-1.4.8/checks/090.undivert --- m4-1.4.7/checks/090.undivert 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/090.undivert 1969-12-31 17:00:00.000000000 -0700 @@ -1,14 +0,0 @@ -dnl @ ../doc/m4.texinfo:3354: 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', `BAR') -dnl @result{} -undivert(`foo') -dnl @result{}bar -dnl @result{} -include(`foo') -dnl @result{}BAR -dnl @result{} diff -ruNp m4-1.4.7/checks/091.divnum m4-1.4.8/checks/091.divnum --- m4-1.4.7/checks/091.divnum 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/091.divnum 1969-12-31 17:00:00.000000000 -0700 @@ -1,16 +0,0 @@ -dnl @ ../doc/m4.texinfo:3378: 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. -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.7/checks/091.include m4-1.4.8/checks/091.include --- m4-1.4.7/checks/091.include 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/091.include 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,13 @@ +dnl @ ../doc/m4.texinfo:3531: 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.7/checks/092.cleardiv m4-1.4.8/checks/092.cleardiv --- m4-1.4.7/checks/092.cleardiv 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/092.cleardiv 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -dnl @ ../doc/m4.texinfo:3404: 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') -Diversion one: divnum -divert(`2') -Diversion two: divnum -divert(`-1') -undivert diff -ruNp m4-1.4.7/checks/092.diversions m4-1.4.8/checks/092.diversions --- m4-1.4.7/checks/092.diversions 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/092.diversions 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,33 @@ +dnl @ ../doc/m4.texinfo:3599: 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(`f', `.') +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +divert`'dnl +len(f) +dnl @result{}1048576 +divert(`1') +f +divert(`-1')undivert diff -ruNp m4-1.4.7/checks/093.cleardiv m4-1.4.8/checks/093.cleardiv --- m4-1.4.7/checks/093.cleardiv 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/093.cleardiv 1969-12-31 17:00:00.000000000 -0700 @@ -1,9 +0,0 @@ -dnl @ ../doc/m4.texinfo:3423: 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{} diff -ruNp m4-1.4.7/checks/093.diversions m4-1.4.8/checks/093.diversions --- m4-1.4.7/checks/093.diversions 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/093.diversions 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,33 @@ +dnl @ ../doc/m4.texinfo:3631: 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(`f', `.') +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +divert`'dnl +len(f) +dnl @result{}1048576 +divert(`1') +f +m4exit diff -ruNp m4-1.4.7/checks/094.divert m4-1.4.8/checks/094.divert --- m4-1.4.7/checks/094.divert 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/094.divert 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:3696: 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.7/checks/094.len m4-1.4.8/checks/094.len --- m4-1.4.7/checks/094.len 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/094.len 1969-12-31 17:00:00.000000000 -0700 @@ -1,10 +0,0 @@ -dnl @ ../doc/m4.texinfo:3462: 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.7/checks/095.divert m4-1.4.8/checks/095.divert --- m4-1.4.7/checks/095.divert 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/095.divert 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:3712: 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.7/checks/095.index_macr m4-1.4.8/checks/095.index_macr --- m4-1.4.7/checks/095.index_macr 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/095.index_macr 1969-12-31 17:00:00.000000000 -0700 @@ -1,10 +0,0 @@ -dnl @ ../doc/m4.texinfo:3483: 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.7/checks/096.divert m4-1.4.8/checks/096.divert --- m4-1.4.7/checks/096.divert 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/096.divert 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,11 @@ +dnl @ ../doc/m4.texinfo:3729: 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.7/checks/096.index_macr m4-1.4.8/checks/096.index_macr --- m4-1.4.7/checks/096.index_macr 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/096.index_macr 1969-12-31 17:00:00.000000000 -0700 @@ -1,9 +0,0 @@ -dnl @ ../doc/m4.texinfo:3492: 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.7/checks/097.divert m4-1.4.8/checks/097.divert --- m4-1.4.7/checks/097.divert 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/097.divert 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,10 @@ +dnl @ ../doc/m4.texinfo:3743: 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(eval(`1<<28'))world +divert(`2')hello +dnl @result{}hello +dnl @result{}world diff -ruNp m4-1.4.7/checks/097.regexp m4-1.4.8/checks/097.regexp --- m4-1.4.7/checks/097.regexp 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/097.regexp 1969-12-31 17:00:00.000000000 -0700 @@ -1,14 +0,0 @@ -dnl @ ../doc/m4.texinfo:3536: 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.7/checks/111.regexp m4-1.4.8/checks/111.regexp --- m4-1.4.7/checks/111.regexp 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/111.regexp 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,17 @@ +dnl @ ../doc/m4.texinfo:4064: 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(`abc', `\(b\)', `\\\10\a') +dnl @result{}\b0a +regexp(`abc', `b', `\1\') +dnl @error{}m4:stdin:2: Warning: sub-expression 1 not present +dnl @error{}m4:stdin:2: Warning: trailing \ ignored in replacement +dnl @result{} +regexp(`abc', `\(\(d\)?\)\(c\)', `\1\2\3\4\5\6') +dnl @error{}m4:stdin:3: Warning: sub-expression 4 not present +dnl @error{}m4:stdin:3: Warning: sub-expression 5 not present +dnl @error{}m4:stdin:3: Warning: sub-expression 6 not present +dnl @result{}c diff -ruNp m4-1.4.7/checks/112.eval m4-1.4.8/checks/112.eval --- m4-1.4.7/checks/112.eval 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/112.eval 1969-12-31 17:00:00.000000000 -0700 @@ -1,16 +0,0 @@ -dnl @ ../doc/m4.texinfo:3982: 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.7/checks/112.regexp m4-1.4.8/checks/112.regexp --- m4-1.4.7/checks/112.regexp 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/112.regexp 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,9 @@ +dnl @ ../doc/m4.texinfo:4080: 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(`abc') +dnl @error{}m4:stdin:1: Warning: too few arguments to builtin `regexp' +dnl @result{}0 diff -ruNp m4-1.4.7/checks/113.eval m4-1.4.8/checks/113.eval --- m4-1.4.7/checks/113.eval 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/113.eval 1969-12-31 17:00:00.000000000 -0700 @@ -1,22 +0,0 @@ -dnl @ ../doc/m4.texinfo:4006: 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.7/checks/113.substr m4-1.4.8/checks/113.substr --- m4-1.4.7/checks/113.substr 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/113.substr 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,10 @@ +dnl @ ../doc/m4.texinfo:4104: 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. +substr(`gnus, gnats, and armadillos', `6') +dnl @result{}gnats, and armadillos +substr(`gnus, gnats, and armadillos', `6', `5') +dnl @result{}gnats diff -ruNp m4-1.4.7/checks/114.platform_m m4-1.4.8/checks/114.platform_m --- m4-1.4.7/checks/114.platform_m 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/114.platform_m 1969-12-31 17:00:00.000000000 -0700 @@ -1,10 +0,0 @@ -dnl @ ../doc/m4.texinfo:4079: 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.7/checks/114.substr m4-1.4.8/checks/114.substr --- m4-1.4.7/checks/114.substr 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/114.substr 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:4113: 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. +substr(`abc') +dnl @error{}m4:stdin:1: Warning: too few arguments to builtin `substr' +dnl @result{}abc +substr(`abc',) +dnl @error{}m4:stdin:2: empty string treated as 0 in builtin `substr' +dnl @result{}abc diff -ruNp m4-1.4.7/checks/115.platform_m m4-1.4.8/checks/115.platform_m --- m4-1.4.7/checks/115.platform_m 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/115.platform_m 1969-12-31 17:00:00.000000000 -0700 @@ -1,16 +0,0 @@ -dnl @ ../doc/m4.texinfo:4100: 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.7/checks/115.translit m4-1.4.8/checks/115.translit --- m4-1.4.7/checks/115.translit 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/115.translit 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:4158: 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. +translit(`GNUs not Unix', `A-Z') +dnl @result{}s not nix +translit(`GNUs not Unix', `a-z', `A-Z') +dnl @result{}GNUS NOT UNIX +translit(`GNUs not Unix', `A-Z', `z-a') +dnl @result{}tmfs not fnix +translit(`+,-12345', `+--1-5', `<;>a-c-a') +dnl @result{}<;>abcba +translit(`abcdef', `aabdef', `bcged') +dnl @result{}bgced diff -ruNp m4-1.4.7/checks/116.syscmd m4-1.4.8/checks/116.syscmd --- m4-1.4.7/checks/116.syscmd 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/116.syscmd 1969-12-31 17:00:00.000000000 -0700 @@ -1,11 +0,0 @@ -dnl @ ../doc/m4.texinfo:4133: 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.7/checks/116.translit m4-1.4.8/checks/116.translit --- m4-1.4.7/checks/116.translit 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/116.translit 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,8 @@ +dnl @ ../doc/m4.texinfo:4185: 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. +translit(`«abc~', `~-»') +dnl @result{}abc diff -ruNp m4-1.4.7/checks/117.syscmd m4-1.4.8/checks/117.syscmd --- m4-1.4.7/checks/117.syscmd 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/117.syscmd 1969-12-31 17:00:00.000000000 -0700 @@ -1,8 +0,0 @@ -dnl @ ../doc/m4.texinfo:4167: 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(`syscmd(`cat')') -dnl @result{} diff -ruNp m4-1.4.7/checks/117.translit m4-1.4.8/checks/117.translit --- m4-1.4.7/checks/117.translit 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/117.translit 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,9 @@ +dnl @ ../doc/m4.texinfo:4193: 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. +translit(`abc') +dnl @error{}m4:stdin:1: Warning: too few arguments to builtin `translit' +dnl @result{}abc diff -ruNp m4-1.4.7/checks/118.esyscmd m4-1.4.8/checks/118.esyscmd --- m4-1.4.7/checks/118.esyscmd 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/118.esyscmd 1969-12-31 17:00:00.000000000 -0700 @@ -1,11 +0,0 @@ -dnl @ ../doc/m4.texinfo:4194: 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.7/checks/118.patsubst m4-1.4.8/checks/118.patsubst --- m4-1.4.7/checks/118.patsubst 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/118.patsubst 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,19 @@ +dnl @ ../doc/m4.texinfo:4235: 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. +patsubst(`GNUs not Unix', `^', `OBS: ') +dnl @result{}OBS: GNUs not Unix +patsubst(`GNUs not Unix', `\<', `OBS: ') +dnl @result{}OBS: GNUs OBS: not OBS: Unix +patsubst(`GNUs not Unix', `\w*', `(\&)') +dnl @result{}(GNUs)() (not)() (Unix)() +patsubst(`GNUs not Unix', `\w+', `(\&)') +dnl @result{}(GNUs) (not) (Unix) +patsubst(`GNUs not Unix', `[A-Z][a-z]+') +dnl @result{}GN not +patsubst(`GNUs not Unix', `not', `NOT\') +dnl @error{}m4:stdin:6: Warning: trailing \ ignored in replacement +dnl @result{}GNUs NOT Unix diff -ruNp m4-1.4.7/checks/119.patsubst m4-1.4.8/checks/119.patsubst --- m4-1.4.7/checks/119.patsubst 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/119.patsubst 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,15 @@ +dnl @ ../doc/m4.texinfo:4264: 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(`upcase', `translit(`$*', `a-z', `A-Z')')dnl +define(`downcase', `translit(`$*', `A-Z', `a-z')')dnl +define(`capitalize1', + `regexp(`$1', `^\(\w\)\(\w*\)', + `upcase(`\1')`'downcase(`\2')')')dnl +define(`capitalize', + `patsubst(`$1', `\w+', `capitalize1(`\&')')')dnl +capitalize(`GNUs not Unix') +dnl @result{}Gnus Not Unix diff -ruNp m4-1.4.7/checks/119.sysval m4-1.4.8/checks/119.sysval --- m4-1.4.7/checks/119.sysval 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/119.sysval 1969-12-31 17:00:00.000000000 -0700 @@ -1,30 +0,0 @@ -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. -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.7/checks/120.patsubst m4-1.4.8/checks/120.patsubst --- m4-1.4.7/checks/120.patsubst 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/120.patsubst 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,15 @@ +dnl @ ../doc/m4.texinfo:4280: 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(`patreg', +`patsubst($@) +regexp($@)')dnl +patreg(`bar foo baz Foo', `foo\|Foo', `FOO') +dnl @result{}bar FOO baz FOO +dnl @result{}FOO +patreg(`aba abb 121', `\(.\)\(.\)\1', `\2\1\2') +dnl @result{}bab abb 212 +dnl @result{}bab diff -ruNp m4-1.4.7/checks/120.sysval m4-1.4.8/checks/120.sysval --- m4-1.4.7/checks/120.sysval 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/120.sysval 1969-12-31 17:00:00.000000000 -0700 @@ -1,19 +0,0 @@ -dnl @ ../doc/m4.texinfo:4270: 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.7/checks/121.maketemp m4-1.4.8/checks/121.maketemp --- m4-1.4.7/checks/121.maketemp 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/121.maketemp 1969-12-31 17:00:00.000000000 -0700 @@ -1,18 +0,0 @@ -dnl @ ../doc/m4.texinfo:4322: 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.7/checks/121.patsubst m4-1.4.8/checks/121.patsubst --- m4-1.4.7/checks/121.patsubst 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/121.patsubst 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,9 @@ +dnl @ ../doc/m4.texinfo:4294: 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. +patsubst(`abc') +dnl @error{}m4:stdin:1: Warning: too few arguments to builtin `patsubst' +dnl @result{}abc diff -ruNp m4-1.4.7/checks/122.errprint m4-1.4.8/checks/122.errprint --- m4-1.4.7/checks/122.errprint 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/122.errprint 1969-12-31 17:00:00.000000000 -0700 @@ -1,10 +0,0 @@ -dnl @ ../doc/m4.texinfo:4366: 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.7/checks/122.format m4-1.4.8/checks/122.format --- m4-1.4.7/checks/122.format 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/122.format 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:4319: 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', `The brown fox jumped over the lazy dog') +dnl @result{} +format(`The string "%s" uses %d characters', foo, len(foo)) +dnl @result{}The string "The brown fox jumped over the lazy dog" uses 38 characters +format(`%.0f', `56789.9876') +dnl @result{}56790 +len(format(`%-*X', `300', `1')) +dnl @result{}300 diff -ruNp m4-1.4.7/checks/123.format m4-1.4.8/checks/123.format --- m4-1.4.7/checks/123.format 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/123.format 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,21 @@ +dnl @ ../doc/m4.texinfo:4333: 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', `10', `format(`%6d squared is %10d +', i, eval(i**2))') +dnl @result{} 1 squared is 1 +dnl @result{} 2 squared is 4 +dnl @result{} 3 squared is 9 +dnl @result{} 4 squared is 16 +dnl @result{} 5 squared is 25 +dnl @result{} 6 squared is 36 +dnl @result{} 7 squared is 49 +dnl @result{} 8 squared is 64 +dnl @result{} 9 squared is 81 +dnl @result{} 10 squared is 100 +dnl @result{} diff -ruNp m4-1.4.7/checks/123.location m4-1.4.8/checks/123.location --- m4-1.4.7/checks/123.location 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/123.location 1969-12-31 17:00:00.000000000 -0700 @@ -1,10 +0,0 @@ -dnl @ ../doc/m4.texinfo:4393: 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.7/checks/124.incr m4-1.4.8/checks/124.incr --- m4-1.4.7/checks/124.incr 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/124.incr 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:4397: 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. +incr(`4') +dnl @result{}5 +decr(`7') +dnl @result{}6 +incr() +dnl @error{}m4:stdin:3: empty string treated as 0 in builtin `incr' +dnl @result{}1 +decr() +dnl @error{}m4:stdin:4: empty string treated as 0 in builtin `decr' +dnl @result{}-1 diff -ruNp m4-1.4.7/checks/124.location m4-1.4.8/checks/124.location --- m4-1.4.7/checks/124.location 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/124.location 1969-12-31 17:00:00.000000000 -0700 @@ -1,15 +0,0 @@ -dnl @ ../doc/m4.texinfo:4412: 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.7/checks/125.eval m4-1.4.8/checks/125.eval --- m4-1.4.7/checks/125.eval 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/125.eval 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,25 @@ +dnl @ ../doc/m4.texinfo:4489: 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(`-3 * 5') +dnl @result{}-15 +eval(index(`Hello world', `llo') >= 0) +dnl @result{}1 +eval(`0r1:0111 + 0b100 + 0r3:12') +dnl @result{}12 +define(`square', `eval(`('$1`)**2')') +dnl @result{} +square(`9') +dnl @result{}81 +square(square(`5')`+1') +dnl @result{}676 +define(`foo', `666') +dnl @result{} +eval(`foo/6') +dnl @error{}m4:stdin:8: bad expression in eval: foo/6 +dnl @result{} +eval(foo/6) +dnl @result{}111 diff -ruNp m4-1.4.7/checks/125.m4exit m4-1.4.8/checks/125.m4exit --- m4-1.4.7/checks/125.m4exit 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/125.m4exit 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -dnl @ ../doc/m4.texinfo:4462: 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.7/checks/126.eval m4-1.4.8/checks/126.eval --- m4-1.4.7/checks/126.eval 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/126.eval 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:4522: 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.7/checks/126.m4exit m4-1.4.8/checks/126.m4exit --- m4-1.4.7/checks/126.m4exit 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/126.m4exit 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -dnl @ ../doc/m4.texinfo:4478: 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.7/checks/127.eval m4-1.4.8/checks/127.eval --- m4-1.4.7/checks/127.eval 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/127.eval 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,22 @@ +dnl @ ../doc/m4.texinfo:4546: 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.7/checks/127.extensions m4-1.4.8/checks/127.extensions --- m4-1.4.7/checks/127.extensions 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/127.extensions 1969-12-31 17:00:00.000000000 -0700 @@ -1,23 +0,0 @@ -dnl @ ../doc/m4.texinfo:4721: 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.7/checks/128.incompatib m4-1.4.8/checks/128.incompatib --- m4-1.4.7/checks/128.incompatib 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/128.incompatib 1969-12-31 17:00:00.000000000 -0700 @@ -1,23 +0,0 @@ -dnl @ ../doc/m4.texinfo:4839: 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.7/checks/128.platform_m m4-1.4.8/checks/128.platform_m --- m4-1.4.7/checks/128.platform_m 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/128.platform_m 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,10 @@ +dnl @ ../doc/m4.texinfo:4620: 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.7/checks/129.answers m4-1.4.8/checks/129.answers --- m4-1.4.7/checks/129.answers 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/129.answers 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -dnl @ ../doc/m4.texinfo:5023: 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.7/checks/129.platform_m m4-1.4.8/checks/129.platform_m --- m4-1.4.7/checks/129.platform_m 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/129.platform_m 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,16 @@ +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. +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.7/checks/130.answers m4-1.4.8/checks/130.answers --- m4-1.4.7/checks/130.answers 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/130.answers 1969-12-31 17:00:00.000000000 -0700 @@ -1,28 +0,0 @@ -dnl @ ../doc/m4.texinfo:5038: 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.7/checks/130.syscmd m4-1.4.8/checks/130.syscmd --- m4-1.4.7/checks/130.syscmd 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/130.syscmd 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,11 @@ +dnl @ ../doc/m4.texinfo:4674: 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.7/checks/131.answers m4-1.4.8/checks/131.answers --- m4-1.4.7/checks/131.answers 2006-09-23 22:33:20.000000000 -0600 +++ m4-1.4.8/checks/131.answers 1969-12-31 17:00:00.000000000 -0700 @@ -1,17 +0,0 @@ -dnl @ ../doc/m4.texinfo:5071: 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.7/checks/131.syscmd m4-1.4.8/checks/131.syscmd --- m4-1.4.7/checks/131.syscmd 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/131.syscmd 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,8 @@ +dnl @ ../doc/m4.texinfo:4709: 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(`syscmd(`cat')') +dnl @result{} diff -ruNp m4-1.4.7/checks/132.esyscmd m4-1.4.8/checks/132.esyscmd --- m4-1.4.7/checks/132.esyscmd 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/132.esyscmd 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,11 @@ +dnl @ ../doc/m4.texinfo:4736: 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.7/checks/133.sysval m4-1.4.8/checks/133.sysval --- m4-1.4.7/checks/133.sysval 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/133.sysval 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,30 @@ +dnl @ ../doc/m4.texinfo:4766: 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.7/checks/134.sysval m4-1.4.8/checks/134.sysval --- m4-1.4.7/checks/134.sysval 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/134.sysval 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,19 @@ +dnl @ ../doc/m4.texinfo:4812: 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.7/checks/135.mkstemp m4-1.4.8/checks/135.mkstemp --- m4-1.4.7/checks/135.mkstemp 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/135.mkstemp 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,25 @@ +dnl @ ../doc/m4.texinfo:4890: 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(`echo foo??????')dnl +dnl @result{}foo?????? +define(`file1', maketemp(`fooXXXXXX'))dnl +ifelse(esyscmd(`echo foo??????'), `foo??????', `no file', `created') +dnl @result{}created +define(`file2', maketemp(`fooXX'))dnl +define(`file3', mkstemp(`fooXXXXXX'))dnl +ifelse(len(file1), len(file2), `same length', `different') +dnl @result{}same length +ifelse(file1, file2, `same', `different file') +dnl @result{}different file +ifelse(file2, file3, `same', `different file') +dnl @result{}different file +ifelse(file1, file3, `same', `different file') +dnl @result{}different file +syscmd(`rm 'file1 file2 file3) +dnl @result{} +sysval +dnl @result{}0 diff -ruNp m4-1.4.7/checks/136.errprint m4-1.4.8/checks/136.errprint --- m4-1.4.7/checks/136.errprint 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/136.errprint 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:4941: 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{} +errprint(`1')errprint(`2',`3 +') +dnl @error{}12 3 +dnl @result{} diff -ruNp m4-1.4.7/checks/137.location m4-1.4.8/checks/137.location --- m4-1.4.7/checks/137.location 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/137.location 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,10 @@ +dnl @ ../doc/m4.texinfo:4975: 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.7/checks/138.location m4-1.4.8/checks/138.location --- m4-1.4.7/checks/138.location 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/138.location 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,15 @@ +dnl @ ../doc/m4.texinfo:4994: 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.7/checks/139.location m4-1.4.8/checks/139.location --- m4-1.4.7/checks/139.location 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/139.location 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,29 @@ +dnl @ ../doc/m4.texinfo:5014: 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(`foo', `echo(__line__ +__line__)') +dnl @result{} +echo(__line__ +__line__) +dnl @result{}4 +dnl @result{}5 +m4wrap(`foo +') +dnl @result{} +foo(errprint(__line__ +__line__ +)) +dnl @error{}8 +dnl @error{}9 +dnl @result{}8 +dnl @result{}8 +__line__ +dnl @result{}11 +dnl @result{}6 +dnl @result{}6 diff -ruNp m4-1.4.7/checks/140.m4exit m4-1.4.8/checks/140.m4exit --- m4-1.4.7/checks/140.m4exit 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/140.m4exit 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:5067: 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 due to `m4exit'.') +dnl @result{} +divert(`1') So is this. +divert +dnl @result{} +m4exit And this is never read. diff -ruNp m4-1.4.7/checks/141.m4exit m4-1.4.8/checks/141.m4exit --- m4-1.4.7/checks/141.m4exit 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/141.m4exit 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:5084: 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.7/checks/142.extensions m4-1.4.8/checks/142.extensions --- m4-1.4.7/checks/142.extensions 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/142.extensions 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,23 @@ +dnl @ ../doc/m4.texinfo:5334: 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.7/checks/143.incompatib m4-1.4.8/checks/143.incompatib --- m4-1.4.7/checks/143.incompatib 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/143.incompatib 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,23 @@ +dnl @ ../doc/m4.texinfo:5459: 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.7/checks/144.improved_e m4-1.4.8/checks/144.improved_e --- m4-1.4.7/checks/144.improved_e 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/144.improved_e 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:5670: 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.7/checks/145.improved_f m4-1.4.8/checks/145.improved_f --- m4-1.4.7/checks/145.improved_f 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/145.improved_f 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,30 @@ +dnl @ ../doc/m4.texinfo:5690: 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(`forloop2.m4')dnl +dnl @result{}divert(`-1') +dnl @result{}# forloop(var, from, to, stmt) - improved version: +dnl @result{}# works even if VAR is not a strict macro name +dnl @result{}# performs sanity check that FROM is larger than TO +dnl @result{}# allows complex numerical expressions in TO and FROM +dnl @result{}define(`forloop', `ifelse(eval(`($3) >= ($2)'), `1', +dnl @result{} `pushdef(`$1', eval(`$2'))_forloop(`$1', +dnl @result{} eval(`$3'), `$4')popdef(`$1')')') +dnl @result{}define(`_forloop', +dnl @result{} `$3`'ifelse(indir(`$1'), `$2', `', +dnl @result{} `define(`$1', incr(indir(`$1')))$0($@)')') +dnl @result{}divert`'dnl +include(`forloop2.m4') +dnl @result{} +forloop(`i', `2', `1', `no iteration occurs') +dnl @result{} +forloop(`', `1', `2', ` odd iterator name') +dnl @result{} odd iterator name odd iterator name +forloop(`i', `5 + 5', `0xc', ` 0x`'eval(i, `16')') +dnl @result{} 0xa 0xb 0xc +forloop(`i', `a', `b', `non-numeric bounds') +dnl @error{}m4:stdin:6: bad expression in eval (bad input): (b) >= (a) +dnl @result{} diff -ruNp m4-1.4.7/checks/146.improved_f m4-1.4.8/checks/146.improved_f --- m4-1.4.7/checks/146.improved_f 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/146.improved_f 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,32 @@ +dnl @ ../doc/m4.texinfo:5729: 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(`foreachq.m4') +dnl @result{} +traceon(`shift')debugmode(`aq') +dnl @result{} +foreachq(`x', ``1', `2', `3', `4'', `x +')dnl +dnl @result{}1 +dnl @error{}m4trace: -3- shift(`1', `2', `3', `4') +dnl @error{}m4trace: -2- shift(`1', `2', `3', `4') +dnl @result{}2 +dnl @error{}m4trace: -4- shift(`1', `2', `3', `4') +dnl @error{}m4trace: -3- shift(`2', `3', `4') +dnl @error{}m4trace: -3- shift(`1', `2', `3', `4') +dnl @error{}m4trace: -2- shift(`2', `3', `4') +dnl @result{}3 +dnl @error{}m4trace: -5- shift(`1', `2', `3', `4') +dnl @error{}m4trace: -4- shift(`2', `3', `4') +dnl @error{}m4trace: -3- shift(`3', `4') +dnl @error{}m4trace: -4- shift(`1', `2', `3', `4') +dnl @error{}m4trace: -3- shift(`2', `3', `4') +dnl @error{}m4trace: -2- shift(`3', `4') +dnl @result{}4 +dnl @error{}m4trace: -6- shift(`1', `2', `3', `4') +dnl @error{}m4trace: -5- shift(`2', `3', `4') +dnl @error{}m4trace: -4- shift(`3', `4') +dnl @error{}m4trace: -3- shift(`4') diff -ruNp m4-1.4.7/checks/147.improved_f m4-1.4.8/checks/147.improved_f --- m4-1.4.7/checks/147.improved_f 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/147.improved_f 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,30 @@ +dnl @ ../doc/m4.texinfo:5767: 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(`foreachq2.m4') +dnl @result{} +undivert(`foreachq2.m4')dnl +dnl @result{}include(`quote.m4')dnl +dnl @result{}divert(`-1') +dnl @result{}# foreachq(x, `item_1, item_2, ..., item_n', stmt) +dnl @result{}# quoted list, improved version +dnl @result{}define(`foreachq', `pushdef(`$1')_foreachq($@)popdef(`$1')') +dnl @result{}define(`_arg1q', ``$1'') +dnl @result{}define(`_rest', `ifelse(`$#', `1', `', `dquote(shift($@))')') +dnl @result{}define(`_foreachq', `ifelse(`$2', `', `', +dnl @result{} `define(`$1', _arg1q($2))$3`'$0(`$1', _rest($2), `$3')')') +dnl @result{}divert`'dnl +traceon(`shift')debugmode(`aq') +dnl @result{} +foreachq(`x', ``1', `2', `3', `4'', `x +')dnl +dnl @result{}1 +dnl @error{}m4trace: -3- shift(`1', `2', `3', `4') +dnl @result{}2 +dnl @error{}m4trace: -3- shift(`2', `3', `4') +dnl @result{}3 +dnl @error{}m4trace: -3- shift(`3', `4') +dnl @result{}4 diff -ruNp m4-1.4.7/checks/148.improved_f m4-1.4.8/checks/148.improved_f --- m4-1.4.7/checks/148.improved_f 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/148.improved_f 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,34 @@ +dnl @ ../doc/m4.texinfo:5808: 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(`foreach2.m4') +dnl @result{} +undivert(`foreach2.m4')dnl +dnl @result{}include(`quote.m4')dnl +dnl @result{}divert(`-1') +dnl @result{}# foreach(x, (item_1, item_2, ..., item_n), stmt) +dnl @result{}# parenthesized list, improved version +dnl @result{}define(`foreach', `pushdef(`$1')_foreach(`$1', +dnl @result{} (dquote(dquote_elt$2)), `$3')popdef(`$1')') +dnl @result{}define(`_arg1', `$1') +dnl @result{}define(`_foreach', `ifelse(`$2', `(`')', `', +dnl @result{} `define(`$1', _arg1$2)$3`'$0(`$1', (dquote(shift$2)), `$3')')') +dnl @result{}divert`'dnl +traceon(`shift')debugmode(`aq') +dnl @result{} +foreach(`x', `(`1', `2', `3', `4')', `x +')dnl +dnl @error{}m4trace: -4- shift(`1', `2', `3', `4') +dnl @error{}m4trace: -4- shift(`2', `3', `4') +dnl @error{}m4trace: -4- shift(`3', `4') +dnl @result{}1 +dnl @error{}m4trace: -3- shift(``1'', ``2'', ``3'', ``4'') +dnl @result{}2 +dnl @error{}m4trace: -3- shift(``2'', ``3'', ``4'') +dnl @result{}3 +dnl @error{}m4trace: -3- shift(``3'', ``4'') +dnl @result{}4 +dnl @error{}m4trace: -3- shift(``4'') diff -ruNp m4-1.4.7/checks/149.improved_f m4-1.4.8/checks/149.improved_f --- m4-1.4.7/checks/149.improved_f 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/149.improved_f 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,70 @@ +dnl @ ../doc/m4.texinfo:5852: 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(`foreach2.m4') +dnl @result{} +include(`foreachq2.m4') +dnl @result{} +dnl 0-element list: +foreach(`x', `', `') / foreachq(`x', `', `') +dnl @result{} / +dnl 1-element list of empty element +foreach(`x', `()', `') / foreachq(`x', ``'', `') +dnl @result{}<> / <> +dnl 2-element list of empty elements +foreach(`x', `(`',`')', `') / foreachq(`x', ``',`'', `') +dnl @result{}<><> / <><> +dnl 1-element list of a comma +foreach(`x', `(`,')', `') / foreachq(`x', ``,'', `') +dnl @result{}<,> / <,> +dnl 2-element list of unbalanced parentheses +foreach(`x', `(`(', `)')', `') / foreachq(`x', ``(', `)'', `') +dnl @result{}<(><)> / <(><)> +define(`active', `ACT, IVE') +dnl @result{} +traceon(`active') +dnl @result{} +dnl list of unquoted macros; expansion occurs before recursion +foreach(`x', `(active, active)', ` +')dnl +dnl @error{}m4trace: -4- active -> `ACT, IVE' +dnl @error{}m4trace: -4- active -> `ACT, IVE' +dnl @result{} +dnl @result{} +dnl @result{} +dnl @result{} +foreachq(`x', `active, active', ` +')dnl +dnl @error{}m4trace: -3- active -> `ACT, IVE' +dnl @error{}m4trace: -3- active -> `ACT, IVE' +dnl @result{} +dnl @error{}m4trace: -3- active -> `ACT, IVE' +dnl @error{}m4trace: -3- active -> `ACT, IVE' +dnl @result{} +dnl @result{} +dnl @result{} +dnl list of quoted macros; expansion occurs during recursion +foreach(`x', `(`active', `active')', ` +')dnl +dnl @error{}m4trace: -1- active -> `ACT, IVE' +dnl @result{} +dnl @error{}m4trace: -1- active -> `ACT, IVE' +dnl @result{} +foreachq(`x', ``active', `active'', ` +')dnl +dnl @error{}m4trace: -1- active -> `ACT, IVE' +dnl @result{} +dnl @error{}m4trace: -1- active -> `ACT, IVE' +dnl @result{} +dnl list of double-quoted macro names; no expansion +foreach(`x', `(``active'', ``active'')', ` +')dnl +dnl @result{} +dnl @result{} +foreachq(`x', ```active'', ``active''', ` +')dnl +dnl @result{} +dnl @result{} diff -ruNp m4-1.4.7/checks/150.improved_c m4-1.4.8/checks/150.improved_c --- m4-1.4.7/checks/150.improved_c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/150.improved_c 2006-11-20 07:12:37.000000000 -0700 @@ -0,0 +1,28 @@ +dnl @ ../doc/m4.texinfo:5928: 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.7/checks/151.improved_f m4-1.4.8/checks/151.improved_f --- m4-1.4.7/checks/151.improved_f 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/checks/151.improved_f 2006-11-20 07:12:38.000000000 -0700 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:5965: 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(ifdef(`__program__', `__program__', ``m4'')'dnl +`:ifelse(__line__, `0', `', + `__file__:__line__:')` fatal error: $* +')m4exit(`1')') +dnl @result{} +m4wrap(`divnum(`demo of internal message') +fatal_error(`inside wrapped text')') +dnl @result{} +dnl @error{}m4:stdin:6: Warning: excess arguments to builtin `divnum' ignored +dnl @result{}0 +dnl @error{}m4:stdin:6: fatal error: inside wrapped text diff -ruNp m4-1.4.7/checks/get-them m4-1.4.8/checks/get-them --- m4-1.4.7/checks/get-them 2006-08-22 10:13:38.000000000 -0600 +++ m4-1.4.8/checks/get-them 2006-11-20 06:55:42.000000000 -0700 @@ -64,7 +64,7 @@ BEGIN { else prefix = ""; gsub("@@", "@", $0); - gsub("@comment.*", "", $0); + gsub("@w{ }", " ", $0); gsub("@tabchar{}", "\t", $0); printf("%s%s\n", prefix, $0) >> file; } diff -ruNp m4-1.4.7/config-h.in m4-1.4.8/config-h.in --- m4-1.4.7/config-h.in 2006-09-25 06:07:51.000000000 -0600 +++ m4-1.4.8/config-h.in 1969-12-31 17:00:00.000000000 -0700 @@ -1,555 +0,0 @@ -/* 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. - */ -#undef CRAY_STACKSEG_END - -/* Define to 1 if using `alloca.c'. */ -#undef C_ALLOCA - -/* Define to 1 if the changeword(REGEXP) functionality is wanted */ -#undef ENABLE_CHANGEWORD - -/* Define as good substitute value for EOVERFLOW. */ -#undef EOVERFLOW - -/* Define to 1 if the return value of system() disagrees with pclose(). */ -#undef FUNC_SYSTEM_BROKEN - -/* Define to 1 if you have `alloca' after including , a header that - may be supplied by this distribution. */ -#undef HAVE_ALLOCA - -/* Define HAVE_ALLOCA_H for backward compatibility with older code that - includes only if HAVE_ALLOCA_H is defined. */ -#undef HAVE_ALLOCA_H - -/* 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 - -/* Define to 1 if you have the declaration of `isblank', and to 0 if you - don't. */ -#undef HAVE_DECL_ISBLANK - -/* Define to 1 if you have the declaration of `mkdir', and to 0 if you don't. - */ -#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 - -/* Define to 1 if you have the declaration of `wcwidth', and to 0 if you - 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 - -/* Define to 1 if you have the `getopt_long_only' function. */ -#undef HAVE_GETOPT_LONG_ONLY - -/* Define to 1 if you have the `gettimeofday' function. */ -#undef HAVE_GETTIMEOFDAY - -/* Define if you have the 'intmax_t' type in or . */ -#undef HAVE_INTMAX_T - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define if exists, doesn't clash with , and - declares uintmax_t. */ -#undef HAVE_INTTYPES_H_WITH_UINTMAX - -/* 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 - -/* Define if you have and nl_langinfo(CODESET). */ -#undef HAVE_LANGINFO_CODESET - -/* Define to 1 if you have the header file. */ -#undef HAVE_LIMITS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LOCALE_H - -/* Define if you have the 'long double' type. */ -#undef HAVE_LONG_DOUBLE - -/* Define if you have the 'long long' type. */ -#undef HAVE_LONG_LONG - -/* Define to 1 if the system has the type `long long int'. */ -#undef HAVE_LONG_LONG_INT - -/* Define to 1 if you have the `lstat' function. */ -#undef HAVE_LSTAT - -/* Define to 1 if your system has a GNU libc compatible `malloc' function, and - to 0 otherwise. */ -#undef HAVE_MALLOC - -/* Define to 1 if you have the `mbrtowc' function. */ -#undef HAVE_MBRTOWC - -/* Define to 1 if declares mbstate_t. */ -#undef HAVE_MBSTATE_T - -/* Define to 1 if you have the `memchr' function. */ -#undef HAVE_MEMCHR - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the `mempcpy' function. */ -#undef HAVE_MEMPCPY - -/* 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 - -/* Define to 1 if the system has the type `rlim_t'. */ -#undef HAVE_RLIM_T - -/* Define to 1 if you have the `sigaction' function. */ -#undef HAVE_SIGACTION - -/* Define to 1 if you have the `sigaltstack' function. */ -#undef HAVE_SIGALTSTACK - -/* Define to 1 if the system has the type `sigcontext'. */ -#undef HAVE_SIGCONTEXT - -/* Define to 1 if you have the header file. */ -#undef HAVE_SIGINFO_H - -/* 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 - -/* Define to 1 if you have the `sigvec' function. */ -#undef HAVE_SIGVEC - -/* Define to 1 if you have the `snprintf' function. */ -#undef HAVE_SNPRINTF - -/* Define to 1 if the system has the type `stack_t'. */ -#undef HAVE_STACK_T - -/* Define to 1 if stdbool.h conforms to C99. */ -#undef HAVE_STDBOOL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define if exists, doesn't clash with , and declares - 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 - -/* Define to 1 if you have the `strerror' function. */ -#undef HAVE_STRERROR - -/* Define to 1 if you have the `strerror_r' function. */ -#undef HAVE_STRERROR_R - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the `strncasecmp' function. */ -#undef HAVE_STRNCASECMP - -/* Define to 1 if you have the `strtol' function. */ -#undef HAVE_STRTOL - -/* 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 - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TIME_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_WAIT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define to 1 if you have the `vasnprintf' function. */ -#undef HAVE_VASNPRINTF - -/* Define to 1 if you have the `vasprintf' function. */ -#undef HAVE_VASPRINTF - -/* Define to 1 if you have the header file. */ -#undef HAVE_WCHAR_H - -/* Define if you have the 'wchar_t' type. */ -#undef HAVE_WCHAR_T - -/* Define to 1 if you have the `wcrtomb' function. */ -#undef HAVE_WCRTOMB - -/* Define to 1 if you have the `wcscoll' function. */ -#undef HAVE_WCSCOLL - -/* Define to 1 if you have the `wcslen' function. */ -#undef HAVE_WCSLEN - -/* Define to 1 if you have the header file. */ -#undef HAVE_WCTYPE_H - -/* Define to 1 if you have the `wcwidth' function. */ -#undef HAVE_WCWIDTH - -/* Define if you have the 'wint_t' type. */ -#undef HAVE_WINT_T - -/* 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 - -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* 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. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown */ -#undef STACK_DIRECTION - -/* Define to 1 if the `S_IS*' macros in do not work properly. */ -#undef STAT_MACROS_BROKEN - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Define to 1 if strerror_r returns char *. */ -#undef STRERROR_R_CHAR_P - -/* 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 - -/* Define to 1 if on AIX 3. - System headers sometimes define this. - We just want to avoid a redefinition error message. */ -#ifndef _ALL_SOURCE -# undef _ALL_SOURCE -#endif - -/* Number of bits in a file offset, on hosts where this is settable. */ -#undef _FILE_OFFSET_BITS - -/* Enable GNU extensions on systems that have them. */ -#ifndef _GNU_SOURCE -# undef _GNU_SOURCE -#endif - -/* Define for large files, on AIX-style hosts. */ -#undef _LARGE_FILES - -/* Define to 1 if on MINIX. */ -#undef _MINIX - -/* Define to 2 if the system does not provide POSIX.1 features except with - this defined. */ -#undef _POSIX_1_SOURCE - -/* Define to 1 if you need to in order for `stat' and other things to work. */ -#undef _POSIX_SOURCE - -/* Define if you want regoff_t to be at least as wide POSIX requires. */ -#undef _REGEX_LARGE_OFFSETS - -/* Enable extensions on Solaris. */ -#ifndef __EXTENSIONS__ -# undef __EXTENSIONS__ -#endif -#ifndef _POSIX_PTHREAD_SEMANTICS -# undef _POSIX_PTHREAD_SEMANTICS -#endif - -/* Define to rpl_ if the getopt replacement functions and variables should be - used. */ -#undef __GETOPT_PREFIX - -/* Define to rpl_ if the mkstemp replacement function should be used. */ -#undef __MKSTEMP_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)) - -/* Define to `__inline__' or `__inline' if that's what the C compiler - calls it, or to nothing if 'inline' is not supported under any name. */ -#ifndef __cplusplus -#undef inline -#endif - -/* Define to long or long long if and don't define. */ -#undef intmax_t - -/* Define to rpl_malloc if the replacement function should be used. */ -#undef malloc - -/* Define to a type if does not define. */ -#undef mbstate_t - -/* Define to rpl_re_comp if the replacement should be used. */ -#undef re_comp - -/* Define to rpl_re_compile_fastmap if the replacement should be used. */ -#undef re_compile_fastmap - -/* Define to rpl_re_compile_pattern if the replacement should be used. */ -#undef re_compile_pattern - -/* Define to rpl_re_exec if the replacement should be used. */ -#undef re_exec - -/* Define to rpl_re_match if the replacement should be used. */ -#undef re_match - -/* Define to rpl_re_match_2 if the replacement should be used. */ -#undef re_match_2 - -/* Define to rpl_re_search if the replacement should be used. */ -#undef re_search - -/* Define to rpl_re_search_2 if the replacement should be used. */ -#undef re_search_2 - -/* Define to rpl_re_set_registers if the replacement should be used. */ -#undef re_set_registers - -/* Define to rpl_re_set_syntax if the replacement should be used. */ -#undef re_set_syntax - -/* Define to rpl_re_syntax_options if the replacement should be used. */ -#undef re_syntax_options - -/* Define to rpl_regcomp if the replacement should be used. */ -#undef regcomp - -/* Define to rpl_regerror if the replacement should be used. */ -#undef regerror - -/* Define to rpl_regexec if the replacement should be used. */ -#undef regexec - -/* Define to rpl_regfree if the replacement should be used. */ -#undef regfree - -/* Define to equivalent of C99 restrict keyword, or to nothing if this is not - supported. Do not define if restrict is supported directly. */ -#undef restrict - -/* Define to int if rlim_t is not defined in sys/resource.h */ -#undef rlim_t - -/* Define to empty if the C compiler doesn't support this keyword. */ -#undef signed - -/* Define to `unsigned int' if does not define. */ -#undef size_t - -/* Define as a signed type of the same size as size_t. */ -#undef ssize_t - -/* Define to struct sigaltstack if stack_t is not in signal.h */ -#undef stack_t - -/* Define to rpl_strcasecmp always. */ -#undef strcasecmp - -/* Define as a macro for copying va_list variables. */ -#undef va_copy diff -ruNp m4-1.4.7/configure m4-1.4.8/configure --- m4-1.4.7/configure 2006-09-25 06:07:43.000000000 -0600 +++ m4-1.4.8/configure 2006-11-20 07:25:55.000000000 -0700 @@ -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.7. +# Generated by GNU Autoconf 2.61 for GNU M4 1.4.8. # # Report bugs to . # @@ -12,7 +12,8 @@ ## M4sh Initialization. ## ## --------------------- ## -# Be Bourne compatible +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: @@ -21,10 +22,13 @@ if test -n "${ZSH_VERSION+set}" && (emul alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh + + # PATH needs CR @@ -217,7 +221,7 @@ test \$exitcode = 0) || { (exit 1); exit else as_candidate_shells= as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /usr/bin/posix$PATH_SEPARATOR/bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. @@ -235,7 +239,6 @@ IFS=$as_save_IFS # Try only shells that exist, to save several forks. if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { ("$as_shell") 2> /dev/null <<\_ASEOF -# Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: @@ -244,10 +247,12 @@ if test -n "${ZSH_VERSION+set}" && (emul alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh + : _ASEOF @@ -255,7 +260,6 @@ _ASEOF CONFIG_SHELL=$as_shell as_have_required=yes if { "$as_shell" 2> /dev/null <<\_ASEOF -# Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: @@ -264,10 +268,12 @@ if test -n "${ZSH_VERSION+set}" && (emul alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh + : (as_func_return () { @@ -514,19 +520,28 @@ else as_mkdir_p=false fi -# Find out whether ``test -x'' works. Don't use a zero-byte file, as -# systems may use methods other than mode bits to determine executability. -cat >conf$$.file <<_ASEOF -#! /bin/sh -exit 0 -_ASEOF -chmod +x conf$$.file -if test -x conf$$.file >/dev/null 2>&1; then - as_executable_p="test -x" +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' else - as_executable_p=: + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' fi -rm -f conf$$.file +as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -559,44 +574,44 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='GNU M4' PACKAGE_TARNAME='m4' -PACKAGE_VERSION='1.4.7' -PACKAGE_STRING='GNU M4 1.4.7' +PACKAGE_VERSION='1.4.8' +PACKAGE_STRING='GNU M4 1.4.8' PACKAGE_BUGREPORT='bug-m4@gnu.org' ac_unique_file="src/m4.h" # Factoring default headers for most tests. ac_includes_default="\ #include -#if HAVE_SYS_TYPES_H +#ifdef HAVE_SYS_TYPES_H # include #endif -#if HAVE_SYS_STAT_H +#ifdef HAVE_SYS_STAT_H # include #endif -#if STDC_HEADERS +#ifdef STDC_HEADERS # include # include #else -# if HAVE_STDLIB_H +# ifdef HAVE_STDLIB_H # include # endif #endif -#if HAVE_STRING_H -# if !STDC_HEADERS && HAVE_MEMORY_H +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif -#if HAVE_STRINGS_H +#ifdef HAVE_STRINGS_H # include #endif -#if HAVE_INTTYPES_H +#ifdef HAVE_INTTYPES_H # include #endif -#if HAVE_STDINT_H +#ifdef HAVE_STDINT_H # include #endif -#if HAVE_UNISTD_H +#ifdef HAVE_UNISTD_H # include #endif" @@ -642,6 +657,7 @@ target_alias INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA +am__isrc CYGPATH_W PACKAGE VERSION @@ -692,11 +708,11 @@ GL_COND_LIBTOOL_TRUE GL_COND_LIBTOOL_FALSE ALLOCA ALLOCA_H -LIBOBJS GETOPT_H STDBOOL_H HAVE__BOOL HAVE_LONG_LONG_INT +HAVE_UNSIGNED_LONG_LONG_INT HAVE_WCHAR_H HAVE_INTTYPES_H HAVE_SYS_TYPES_H @@ -726,7 +742,10 @@ LIBM4_LIBDEPS LIBM4_LTLIBDEPS STACKOVF_TRUE STACKOVF_FALSE -LTLIBOBJS' +LIBOBJS +LTLIBOBJS +M4_LIBOBJS +M4_LTLIBOBJS' ac_subst_files='' ac_precious_vars='build_alias host_alias @@ -734,6 +753,7 @@ target_alias CC CFLAGS LDFLAGS +LIBS CPPFLAGS CPP' @@ -841,10 +861,10 @@ do -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` + ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` eval enable_$ac_feature=no ;; -docdir | --docdir | --docdi | --doc | --do) @@ -860,10 +880,10 @@ do -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` + ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` eval enable_$ac_feature=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ @@ -1057,19 +1077,19 @@ do -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } - ac_package=`echo $ac_package| sed 's/-/_/g'` + ac_package=`echo $ac_package | sed 's/[-.]/_/g'` eval with_$ac_package=\$ac_optarg ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/-/_/g'` + ac_package=`echo $ac_package | sed 's/[-.]/_/g'` eval with_$ac_package=no ;; --x) @@ -1238,7 +1258,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.7 to adapt to many kinds of systems. +\`configure' configures GNU M4 1.4.8 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1308,7 +1328,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of GNU M4 1.4.7:";; + short | recursive ) echo "Configuration of GNU M4 1.4.8:";; esac cat <<\_ACEOF @@ -1335,6 +1355,7 @@ Some influential environment variables: CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory + LIBS libraries to pass to the linker, e.g. -l CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor @@ -1403,8 +1424,8 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -GNU M4 configure 1.4.7 -generated by GNU Autoconf 2.60 +GNU M4 configure 1.4.8 +generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. @@ -1417,8 +1438,8 @@ 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.7, which was -generated by GNU Autoconf 2.60. Invocation command line was +It was created by GNU M4 $as_me 1.4.8, which was +generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ @@ -1698,9 +1719,14 @@ 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_header_list="$ac_header_list unistd.h" +ac_func_list="$ac_func_list raise" +ac_header_list="$ac_header_list stdio_ext.h" 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" +ac_header_list="$ac_header_list sys/param.h" +ac_func_list="$ac_func_list iswprint" +ac_func_list="$ac_func_list mbsinit" ac_header_list="$ac_header_list locale.h" ac_func_list="$ac_func_list mbrtowc" ac_func_list="$ac_func_list mempcpy" @@ -1709,8 +1735,9 @@ 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_header_list="$ac_header_list sys/time.h" +ac_func_list="$ac_func_list gettimeofday" 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 # value. @@ -1792,7 +1819,8 @@ ac_link='$CC -o conftest$ac_exeext $CFLA ac_compiler_gnu=$ac_cv_c_compiler_gnu -am__api_version="1.9" +am__api_version='1.10' + ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then @@ -1860,7 +1888,7 @@ case $as_dir/ in # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. @@ -1975,38 +2003,53 @@ else echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi -if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then - # We used to keeping the `.' as first argument, in order to - # allow $(mkdir_p) to be used without argument. As in - # $(mkdir_p) $(somedir) - # where $(somedir) is conditionally defined. However this is wrong - # for two reasons: - # 1. if the package is installed by a user who cannot write `.' - # make install will fail, - # 2. the above comment should most certainly read - # $(mkdir_p) $(DESTDIR)$(somedir) - # so it does not work when $(somedir) is undefined and - # $(DESTDIR) is not. - # To support the latter case, we have to write - # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), - # so the `.' trick is pointless. - mkdir_p='mkdir -p --' -else - # On NextStep and OpenStep, the `mkdir' command does not - # recognize any option. It will interpret all options as - # directories to create, and then abort because `.' already - # exists. - for d in ./-p ./--version; - do - test -d $d && rmdir $d - done - # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. - if test -f "$ac_aux_dir/mkinstalldirs"; then - mkdir_p='$(mkinstalldirs)' +{ echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5 +echo $ECHO_N "checking for a thread-safe mkdir -p... $ECHO_C" >&6; } +if test -z "$MKDIR_P"; then + if test "${ac_cv_path_mkdir+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in mkdir gmkdir; do + for ac_exec_ext in '' $ac_executable_extensions; do + { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue + case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir (GNU coreutils) '* | \ + 'mkdir (coreutils) '* | \ + 'mkdir (fileutils) '4.1*) + ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext + break 3;; + esac + done + done +done +IFS=$as_save_IFS + +fi + + if test "${ac_cv_path_mkdir+set}" = set; then + MKDIR_P="$ac_cv_path_mkdir -p" else - mkdir_p='$(install_sh) -d' + # As a last resort, use the slow shell script. Don't cache a + # value for MKDIR_P within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + test -d ./--version && rmdir ./--version + MKDIR_P="$ac_install_sh -d" fi fi +{ echo "$as_me:$LINENO: result: $MKDIR_P" >&5 +echo "${ECHO_T}$MKDIR_P" >&6; } + +mkdir_p="$MKDIR_P" +case $mkdir_p in + [\\/$]* | ?:[\\/]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac for ac_prog in gawk mawk nawk awk do @@ -2026,7 +2069,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2089,12 +2132,16 @@ else fi rmdir .tst 2>/dev/null -# test to see if srcdir already configured -if test "`cd $srcdir && pwd`" != "`pwd`" && - test -f $srcdir/config.status; then - { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + am__isrc=' -I$(srcdir)' + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} { (exit 1); exit 1; }; } + fi fi # test whether we have cygpath @@ -2109,7 +2156,7 @@ fi # Define the identity of the package. PACKAGE='m4' - VERSION='1.4.7' + VERSION='1.4.8' cat >>confdefs.h <<_ACEOF @@ -2137,7 +2184,7 @@ AUTOHEADER=${AUTOHEADER-"${am_missing_ru MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} -install_sh=${install_sh-"$am_aux_dir/install-sh"} +install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"} # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right @@ -2161,7 +2208,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2201,7 +2248,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2241,7 +2288,7 @@ else fi fi -INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" # We need awk for the "check" target. The system "awk" is bad on # some platforms. @@ -2261,8 +2308,7 @@ VERSION=$PACKAGE_VERSION; - -ac_config_headers="$ac_config_headers config.h:config-h.in" +ac_config_headers="$ac_config_headers lib/config.h:lib/config.hin" # Make sure we can run config.sub. @@ -2370,7 +2416,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2410,7 +2456,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2467,7 +2513,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2508,7 +2554,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue @@ -2566,7 +2612,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2610,7 +2656,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2751,7 +2797,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. -for ac_file in $ac_files +for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in @@ -2779,6 +2825,12 @@ done test "$ac_cv_exeext" = no && ac_cv_exeext= else + ac_file='' +fi + +{ echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6; } +if test -z "$ac_file"; then echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -2790,8 +2842,6 @@ See \`config.log' for more details." >&2 fi ac_exeext=$ac_cv_exeext -{ echo "$as_me:$LINENO: result: $ac_file" >&5 -echo "${ECHO_T}$ac_file" >&6; } # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. @@ -2969,27 +3019,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 @@ -3044,27 +3077,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 @@ -3099,27 +3115,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 @@ -3155,27 +3154,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 @@ -3291,27 +3273,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg else echo "$as_me: failed program was:" >&5 @@ -3400,9 +3365,7 @@ if test "x$enable_dependency_tracking" ! am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi - - -if test "x$enable_dependency_tracking" != xno; then + if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else @@ -3412,7 +3375,6 @@ fi - depcc="$CC" am_compiler_list= { echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 @@ -3480,6 +3442,7 @@ else depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then @@ -3509,9 +3472,7 @@ fi echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type - - -if + if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= @@ -3539,7 +3500,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3579,7 +3540,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_RANLIB="ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3677,17 +3638,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : else echo "$as_me: failed program was:" >&5 @@ -3721,17 +3675,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then # Broken: success on invalid input. continue else @@ -3796,17 +3743,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : else echo "$as_me: failed program was:" >&5 @@ -3840,17 +3780,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then # Broken: success on invalid input. continue else @@ -3905,7 +3838,7 @@ do for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_GREP" && $as_executable_p "$ac_path_GREP"; } || continue + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in @@ -3987,7 +3920,7 @@ do for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_EGREP" && $as_executable_p "$ac_path_EGREP"; } || continue + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in @@ -4112,27 +4045,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 @@ -4308,27 +4224,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 @@ -4386,27 +4285,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 @@ -4442,17 +4324,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -4553,7 +4428,7 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - #define __EXTENSIONS__ 1 +# define __EXTENSIONS__ 1 $ac_includes_default int main () @@ -4576,27 +4451,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_safe_to_define___extensions__=yes else echo "$as_me: failed program was:" >&5 @@ -4618,6 +4476,11 @@ _ACEOF #define _POSIX_PTHREAD_SEMANTICS 1 _ACEOF + cat >>confdefs.h <<\_ACEOF +#define _TANDEM_SOURCE 1 +_ACEOF + + @@ -4667,27 +4530,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 @@ -4723,17 +4569,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -4855,27 +4694,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_type_siginfo_t=yes else echo "$as_me: failed program was:" >&5 @@ -4934,27 +4756,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_member_struct_sigaction_sa_sigaction=yes else echo "$as_me: failed program was:" >&5 @@ -4992,27 +4797,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_member_struct_sigaction_sa_sigaction=yes else echo "$as_me: failed program was:" >&5 @@ -5073,27 +4861,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_type_signal=int else echo "$as_me: failed program was:" >&5 @@ -5149,27 +4920,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_type_size_t=yes else echo "$as_me: failed program was:" >&5 @@ -5263,27 +5017,11 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 @@ -5292,7 +5030,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_var'}'` @@ -5367,27 +5105,11 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_working_alloca_h=yes else echo "$as_me: failed program was:" >&5 @@ -5396,7 +5118,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_working_alloca_h=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_working_alloca_h" >&5 @@ -5427,7 +5149,7 @@ cat >>conftest.$ac_ext <<_ACEOF # include # define alloca _alloca # else -# if HAVE_ALLOCA_H +# ifdef HAVE_ALLOCA_H # include # else # ifdef _AIX @@ -5463,27 +5185,11 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_func_alloca_works=yes else echo "$as_me: failed program was:" >&5 @@ -5492,7 +5198,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_alloca_works=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_func_alloca_works" >&5 @@ -5612,27 +5318,11 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 @@ -5641,7 +5331,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_var'}'` @@ -5738,29 +5428,32 @@ _ACEOF fi -{ echo "$as_me:$LINENO: checking whether strerror_r is declared" >&5 -echo $ECHO_N "checking whether strerror_r is declared... $ECHO_C" >&6; } -if test "${ac_cv_have_decl_strerror_r+set}" = set; then + + +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 - cat >conftest.$ac_ext <<_ACEOF + # Is the header compilable? +{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -int -main () -{ -#ifndef strerror_r - char *p = (char *) strerror_r; - return !p; -#endif - - ; - return 0; -} +#include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" @@ -5775,59 +5468,460 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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_strerror_r=yes + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_have_decl_strerror_r=no + ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_strerror_r" >&5 -echo "${ECHO_T}$ac_cv_have_decl_strerror_r" >&6; } -if test $ac_cv_have_decl_strerror_r = yes; then +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_STRERROR_R 1 +# 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 - - -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_STRERROR_R 0 +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> _ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 - + ac_header_preproc=no fi +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } - -for ac_func in strerror_r -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +# 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 defined STDC_HEADERS || defined 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 + gl_cv_func_malloc_0_nonnull=1 +else + gl_cv_func_malloc_0_nonnull=0 +fi + + + +cat >>confdefs.h <<_ACEOF +#define MALLOC_0_IS_NONNULL $gl_cv_func_malloc_0_nonnull +_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 + 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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + if test "$cross_compiling" = yes; then + ac_cv_type_long_long_int=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 + #ifndef LLONG_MAX + # define HALF \ + (1LL << (sizeof (long long int) * CHAR_BIT - 2)) + # define LLONG_MAX (HALF - 1 + HALF) + #endif +int +main () +{ +long long int n = 1; + int i; + for (i = 0; ; i++) + { + long long int m = n << i; + if (m >> i != n) + return 1; + if (LLONG_MAX / 2 < m) + break; + } + return 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_type_long_long_int=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_type_long_long_int=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + +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_ipa8_conftest.oo \ + 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 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 + 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. */ + + /* 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_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + gt_cv_c_long_double=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gt_cv_c_long_double=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 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_LONG_DOUBLE 1 +_ACEOF + + fi + +{ echo "$as_me:$LINENO: checking whether strerror_r is declared" >&5 +echo $ECHO_N "checking whether strerror_r is declared... $ECHO_C" >&6; } +if test "${ac_cv_have_decl_strerror_r+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 strerror_r + (void) strerror_r; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl_strerror_r=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl_strerror_r=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_strerror_r" >&5 +echo "${ECHO_T}$ac_cv_have_decl_strerror_r" >&6; } +if test $ac_cv_have_decl_strerror_r = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STRERROR_R 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STRERROR_R 0 +_ACEOF + + +fi + + + +for ac_func in strerror_r +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 @@ -5891,27 +5985,11 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 @@ -5920,7 +5998,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_var'}'` @@ -5975,27 +6053,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_func_strerror_r_char_p=yes else echo "$as_me: failed program was:" >&5 @@ -6078,6 +6139,83 @@ _ACEOF fi + { echo "$as_me:$LINENO: checking for sig_atomic_t" >&5 +echo $ECHO_N "checking for sig_atomic_t... $ECHO_C" >&6; } +if test "${ac_cv_type_sig_atomic_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 + +typedef sig_atomic_t ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_sig_atomic_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_sig_atomic_t=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_sig_atomic_t" >&5 +echo "${ECHO_T}$ac_cv_type_sig_atomic_t" >&6; } +if test $ac_cv_type_sig_atomic_t = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_SIG_ATOMIC_T 1 +_ACEOF + + +else + +cat >>confdefs.h <<\_ACEOF +#define sig_atomic_t int +_ACEOF + +fi + + + + + + + + + if test -z "$GETOPT_H"; then for ac_header in getopt.h @@ -6100,45 +6238,28 @@ 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 +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_try") 2>&5 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 @@ -6174,17 +6295,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -6320,27 +6434,11 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 @@ -6349,7 +6447,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_var'}'` @@ -6385,8 +6483,7 @@ int main () { #ifndef optreset - char *p = (char *) optreset; - return !p; + (void) optreset; #endif ; @@ -6406,27 +6503,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_have_decl_optreset=yes else echo "$as_me: failed program was:" >&5 @@ -6469,8 +6549,7 @@ int main () { #ifndef getopt_clip - char *p = (char *) getopt_clip; - return !p; + (void) getopt_clip; #endif ; @@ -6490,27 +6569,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_have_decl_getopt_clip=yes else echo "$as_me: failed program was:" >&5 @@ -6608,8 +6670,7 @@ int main () { #ifndef getenv - char *p = (char *) getenv; - return !p; + (void) getenv; #endif ; @@ -6629,27 +6690,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_have_decl_getenv=yes else echo "$as_me: failed program was:" >&5 @@ -6678,6 +6722,75 @@ _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 + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifndef __cplusplus +typedef int foo_t; +static $ac_kw foo_t static_foo () {return 0; } +$ac_kw foo_t foo () {return 0; } +#endif + +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_c_inline=$ac_kw +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 "$ac_cv_c_inline" != no && break +done + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5 +echo "${ECHO_T}$ac_cv_c_inline" >&6; } + + +case $ac_cv_c_inline in + inline | yes) ;; + *) + case $ac_cv_c_inline in + no) ac_val=;; + *) ac_val=$ac_cv_c_inline;; + esac + cat >>confdefs.h <<_ACEOF +#ifndef __cplusplus +#define inline $ac_val +#endif +_ACEOF + ;; +esac + @@ -6716,27 +6829,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_type_mbstate_t=yes else echo "$as_me: failed program was:" >&5 @@ -6800,27 +6896,11 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then gl_cv_func_mbrtowc=yes else echo "$as_me: failed program was:" >&5 @@ -6829,7 +6909,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 gl_cv_func_mbrtowc=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $gl_cv_func_mbrtowc" >&5 @@ -6896,27 +6976,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then break else echo "$as_me: failed program was:" >&5 @@ -6940,27 +7003,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_sys_largefile_CC=' -n32'; break else echo "$as_me: failed program was:" >&5 @@ -6988,7 +7034,6 @@ if test "${ac_cv_sys_file_offset_bits+se echo $ECHO_N "(cached) $ECHO_C" >&6 else while :; do - ac_cv_sys_file_offset_bits=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -7025,28 +7070,11 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 - break + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_sys_file_offset_bits=no; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -7086,33 +7114,16 @@ case "(($ac_try" in *) 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 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_sys_file_offset_bits=64; break else echo "$as_me: failed program was:" >&5 @@ -7122,26 +7133,28 @@ sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cv_sys_file_offset_bits=unknown break done fi { echo "$as_me:$LINENO: result: $ac_cv_sys_file_offset_bits" >&5 echo "${ECHO_T}$ac_cv_sys_file_offset_bits" >&6; } -if test "$ac_cv_sys_file_offset_bits" != no; then - +case $ac_cv_sys_file_offset_bits in #( + no | unknown) ;; + *) cat >>confdefs.h <<_ACEOF #define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits _ACEOF - -fi +;; +esac rm -f conftest* - { echo "$as_me:$LINENO: checking for _LARGE_FILES value needed for large files" >&5 + if test $ac_cv_sys_file_offset_bits = unknown; then + { echo "$as_me:$LINENO: checking for _LARGE_FILES value needed for large files" >&5 echo $ECHO_N "checking for _LARGE_FILES value needed for large files... $ECHO_C" >&6; } if test "${ac_cv_sys_large_files+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else while :; do - ac_cv_sys_large_files=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -7178,28 +7191,11 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 - break + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_sys_large_files=no; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -7245,27 +7241,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_sys_large_files=1; break else echo "$as_me: failed program was:" >&5 @@ -7275,25 +7254,32 @@ sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cv_sys_large_files=unknown break done fi { echo "$as_me:$LINENO: result: $ac_cv_sys_large_files" >&5 echo "${ECHO_T}$ac_cv_sys_large_files" >&6; } -if test "$ac_cv_sys_large_files" != no; then - +case $ac_cv_sys_large_files in #( + no | unknown) ;; + *) cat >>confdefs.h <<_ACEOF #define _LARGE_FILES $ac_cv_sys_large_files _ACEOF - -fi +;; +esac rm -f conftest* + 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 "${ac_cv_c_restrict+set}" = set; then @@ -7337,27 +7323,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_c_restrict=$ac_kw else echo "$as_me: failed program was:" >&5 @@ -7420,27 +7389,11 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then am_cv_langinfo_codeset=yes else echo "$as_me: failed program was:" >&5 @@ -7449,7 +7402,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 am_cv_langinfo_codeset=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi @@ -7471,64 +7424,6 @@ _ACEOF -{ echo "$as_me:$LINENO: checking whether stat file-mode macros are broken" >&5 -echo $ECHO_N "checking whether stat file-mode macros are broken... $ECHO_C" >&6; } -if test "${ac_cv_header_stat_broken+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include - -#if defined S_ISBLK && defined S_IFDIR -# if S_ISBLK (S_IFDIR) -You lose. -# endif -#endif - -#if defined S_ISBLK && defined S_IFCHR -# if S_ISBLK (S_IFCHR) -You lose. -# endif -#endif - -#if defined S_ISLNK && defined S_IFREG -# if S_ISLNK (S_IFREG) -You lose. -# endif -#endif - -#if defined S_ISSOCK && defined S_IFREG -# if S_ISSOCK (S_IFREG) -You lose. -# endif -#endif - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "You lose" >/dev/null 2>&1; then - ac_cv_header_stat_broken=yes -else - ac_cv_header_stat_broken=no -fi -rm -f conftest* - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_stat_broken" >&5 -echo "${ECHO_T}$ac_cv_header_stat_broken" >&6; } -if test $ac_cv_header_stat_broken = yes; then - -cat >>confdefs.h <<\_ACEOF -#define STAT_MACROS_BROKEN 1 -_ACEOF - -fi - { echo "$as_me:$LINENO: checking for stdbool.h that conforms to C99" >&5 echo $ECHO_N "checking for stdbool.h that conforms to C99... $ECHO_C" >&6; } if test "${ac_cv_header_stdbool_h+set}" = set; then @@ -7629,27 +7524,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_header_stdbool_h=yes else echo "$as_me: failed program was:" >&5 @@ -7699,27 +7577,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_type__Bool=yes else echo "$as_me: failed program was:" >&5 @@ -7749,9 +7610,9 @@ _ACEOF fi - { 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 "$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 @@ -7760,18 +7621,16 @@ _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) +unsigned long long int ull = 18446744073709551615ULL; + typedef int a[(18446744073709551615ULL <= (unsigned long long int) -1 ? 1 : -1)]; - int i = 63; + int i = 63; int main () { -long long int llmax = 9223372036854775807ll; - return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i) - | (llmax / ll) | (llmax % ll)); +unsigned long long int ullmax = 18446744073709551615ull; + return (ull << 63 | ull >> 63 | ull << i | ull >> i + | ullmax / ull | ullmax % ull); ; return 0; } @@ -7789,44 +7648,28 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_type_unsigned_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 + ac_cv_type_unsigned_long_long_int=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $ac_cv_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_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_LONG_LONG_INT 1 +#define HAVE_UNSIGNED_LONG_LONG_INT 1 _ACEOF fi @@ -7835,25 +7678,34 @@ _ACEOF - - -{ 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 "$as_me:$LINENO: checking whether stat file-mode macros are broken" >&5 +echo $ECHO_N "checking whether stat file-mode macros are broken... $ECHO_C" >&6; } +if test "${ac_cv_header_stat_broken+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_cv_c_inline=no -for ac_kw in inline __inline__ __inline; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#ifndef __cplusplus -typedef int foo_t; -static $ac_kw foo_t static_foo () {return 0; } -$ac_kw foo_t foo () {return 0; } +#include +#include + +#if defined S_ISBLK && defined S_IFDIR +extern char c1[S_ISBLK (S_IFDIR) ? -1 : 1]; +#endif + +#if defined S_ISBLK && defined S_IFCHR +extern char c2[S_ISBLK (S_IFCHR) ? -1 : 1]; +#endif + +#if defined S_ISLNK && defined S_IFREG +extern char c3[S_ISLNK (S_IFREG) ? -1 : 1]; +#endif + +#if defined S_ISSOCK && defined S_IFREG +extern char c4[S_ISSOCK (S_IFREG) ? -1 : 1]; #endif _ACEOF @@ -7870,58 +7722,35 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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_c_inline=$ac_kw + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_header_stat_broken=no else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_header_stat_broken=yes +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_stat_broken" >&5 +echo "${ECHO_T}$ac_cv_header_stat_broken" >&6; } +if test $ac_cv_header_stat_broken = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STAT_MACROS_BROKEN 1 +_ACEOF fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - test "$ac_cv_c_inline" != no && break -done -fi -{ echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5 -echo "${ECHO_T}$ac_cv_c_inline" >&6; } -case $ac_cv_c_inline in - inline | yes) ;; - *) - case $ac_cv_c_inline in - no) ac_val=;; - *) ac_val=$ac_cv_c_inline;; - esac - cat >>confdefs.h <<_ACEOF -#ifndef __cplusplus -#define inline $ac_val -#endif -_ACEOF - ;; -esac + + @@ -7941,8 +7770,7 @@ int main () { #ifndef clearerr_unlocked - char *p = (char *) clearerr_unlocked; - return !p; + (void) clearerr_unlocked; #endif ; @@ -7962,27 +7790,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_have_decl_clearerr_unlocked=yes else echo "$as_me: failed program was:" >&5 @@ -8027,8 +7838,7 @@ int main () { #ifndef feof_unlocked - char *p = (char *) feof_unlocked; - return !p; + (void) feof_unlocked; #endif ; @@ -8048,27 +7858,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_have_decl_feof_unlocked=yes else echo "$as_me: failed program was:" >&5 @@ -8113,8 +7906,7 @@ int main () { #ifndef ferror_unlocked - char *p = (char *) ferror_unlocked; - return !p; + (void) ferror_unlocked; #endif ; @@ -8134,27 +7926,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_have_decl_ferror_unlocked=yes else echo "$as_me: failed program was:" >&5 @@ -8199,8 +7974,7 @@ int main () { #ifndef fflush_unlocked - char *p = (char *) fflush_unlocked; - return !p; + (void) fflush_unlocked; #endif ; @@ -8220,27 +7994,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_have_decl_fflush_unlocked=yes else echo "$as_me: failed program was:" >&5 @@ -8285,8 +8042,7 @@ int main () { #ifndef fgets_unlocked - char *p = (char *) fgets_unlocked; - return !p; + (void) fgets_unlocked; #endif ; @@ -8306,27 +8062,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_have_decl_fgets_unlocked=yes else echo "$as_me: failed program was:" >&5 @@ -8371,8 +8110,7 @@ int main () { #ifndef fputc_unlocked - char *p = (char *) fputc_unlocked; - return !p; + (void) fputc_unlocked; #endif ; @@ -8392,27 +8130,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_have_decl_fputc_unlocked=yes else echo "$as_me: failed program was:" >&5 @@ -8457,8 +8178,7 @@ int main () { #ifndef fputs_unlocked - char *p = (char *) fputs_unlocked; - return !p; + (void) fputs_unlocked; #endif ; @@ -8478,27 +8198,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_have_decl_fputs_unlocked=yes else echo "$as_me: failed program was:" >&5 @@ -8543,8 +8246,7 @@ int main () { #ifndef fread_unlocked - char *p = (char *) fread_unlocked; - return !p; + (void) fread_unlocked; #endif ; @@ -8564,27 +8266,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_have_decl_fread_unlocked=yes else echo "$as_me: failed program was:" >&5 @@ -8629,8 +8314,7 @@ int main () { #ifndef fwrite_unlocked - char *p = (char *) fwrite_unlocked; - return !p; + (void) fwrite_unlocked; #endif ; @@ -8650,27 +8334,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_have_decl_fwrite_unlocked=yes else echo "$as_me: failed program was:" >&5 @@ -8715,8 +8382,7 @@ int main () { #ifndef getc_unlocked - char *p = (char *) getc_unlocked; - return !p; + (void) getc_unlocked; #endif ; @@ -8736,27 +8402,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_have_decl_getc_unlocked=yes else echo "$as_me: failed program was:" >&5 @@ -8801,8 +8450,7 @@ int main () { #ifndef getchar_unlocked - char *p = (char *) getchar_unlocked; - return !p; + (void) getchar_unlocked; #endif ; @@ -8822,27 +8470,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_have_decl_getchar_unlocked=yes else echo "$as_me: failed program was:" >&5 @@ -8887,8 +8518,7 @@ int main () { #ifndef putc_unlocked - char *p = (char *) putc_unlocked; - return !p; + (void) putc_unlocked; #endif ; @@ -8908,27 +8538,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_have_decl_putc_unlocked=yes else echo "$as_me: failed program was:" >&5 @@ -8973,48 +8586,30 @@ int main () { #ifndef putchar_unlocked - char *p = (char *) putchar_unlocked; - return !p; + (void) putchar_unlocked; #endif ; return 0; } -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { 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 +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_have_decl_putchar_unlocked=yes else echo "$as_me: failed program was:" >&5 @@ -9132,27 +8727,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF @@ -9191,27 +8769,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 @@ -9267,27 +8828,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF @@ -9326,27 +8870,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 @@ -9412,27 +8939,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 @@ -9499,187 +9009,10 @@ case "(($ac_try" in *) 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 -_ACEOF - - EOVERFLOW="$ac_cv_decl_EOVERFLOW" - - 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 $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -signed char x; 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 - bh_cv_c_signed=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - bh_cv_c_signed=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 - -cat >>confdefs.h <<\_ACEOF -#define signed -_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 -_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 - 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. */ - - /* 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_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 + (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;; @@ -9689,25 +9022,33 @@ 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_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 - gt_cv_c_long_double=no fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.val + + else + ac_cv_decl_EOVERFLOW=E2BIG + fi + fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi 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_decl_EOVERFLOW" >&5 +echo "${ECHO_T}$ac_cv_decl_EOVERFLOW" >&6; } + if test "$ac_cv_decl_EOVERFLOW" != yes; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_LONG_DOUBLE 1 +cat >>confdefs.h <<_ACEOF +#define EOVERFLOW $ac_cv_decl_EOVERFLOW _ACEOF + EOVERFLOW="$ac_cv_decl_EOVERFLOW" + fi @@ -9745,27 +9086,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then gt_cv_c_wchar_t=yes else echo "$as_me: failed program was:" >&5 @@ -9821,27 +9145,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then gt_cv_c_wint_t=yes else echo "$as_me: failed program was:" >&5 @@ -9897,27 +9204,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then gl_cv_header_inttypes_h=yes else echo "$as_me: failed program was:" >&5 @@ -9973,27 +9263,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then gl_cv_header_stdint_h=yes else echo "$as_me: failed program was:" >&5 @@ -10016,6 +9289,17 @@ _ACEOF + 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 +_ACEOF + + fi + + + { echo "$as_me:$LINENO: checking for intmax_t" >&5 echo $ECHO_N "checking for intmax_t... $ECHO_C" >&6; } @@ -10059,27 +9343,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then gt_cv_c_intmax_t=yes else echo "$as_me: failed program was:" >&5 @@ -10116,8 +9383,7 @@ _ACEOF - -if false; then + if false; then GL_COND_LIBTOOL_TRUE= GL_COND_LIBTOOL_FALSE='#' else @@ -10140,7 +9406,13 @@ fi # Define an additional variable used in the Makefile substitution. if test $ac_cv_working_alloca_h = yes; then - cat >conftest.$ac_ext <<_ACEOF + { echo "$as_me:$LINENO: checking for alloca as a compiler built-in" >&5 +echo $ECHO_N "checking for alloca as a compiler built-in... $ECHO_C" >&6; } +if test "${gl_cv_rpl_alloca+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -10148,23 +9420,32 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #if defined __GNUC__ || defined _AIX || defined _MSC_VER - Need own alloca + Need own alloca #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "Need own alloca" >/dev/null 2>&1; then + gl_cv_rpl_alloca=yes +else + gl_cv_rpl_alloca=no +fi +rm -f conftest* + + +fi +{ echo "$as_me:$LINENO: result: $gl_cv_rpl_alloca" >&5 +echo "${ECHO_T}$gl_cv_rpl_alloca" >&6; } + if test $gl_cv_rpl_alloca = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_ALLOCA 1 _ACEOF - ALLOCA_H=alloca.h -else - ALLOCA_H= -fi -rm -f conftest* - + ALLOCA_H=alloca.h + else + ALLOCA_H= + fi else ALLOCA_H=alloca.h fi @@ -10177,24 +9458,35 @@ _ACEOF - 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 +cat >>confdefs.h <<\_ACEOF +#define SIGNAL_SAFE_LIST 1 +_ACEOF + + + M4_LIBOBJS="$M4_LIBOBJS cloexec.$ac_objext" + + + M4_LIBOBJS="$M4_LIBOBJS close-stream.$ac_objext" + +cat >>confdefs.h <<\_ACEOF +#define GNULIB_CLOSE_STREAM 1 +_ACEOF + + + : + + + M4_LIBOBJS="$M4_LIBOBJS closeout.$ac_objext" + : + { echo "$as_me:$LINENO: checking for error_at_line" >&5 echo $ECHO_N "checking for error_at_line... $ECHO_C" >&6; } if test "${ac_cv_lib_error_at_line+set}" = set; then @@ -10206,11 +9498,11 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default +#include int main () { -error_at_line (0, 0, "", 0, ""); +error_at_line (0, 0, "", 0, "an error occurred"); ; return 0; } @@ -10228,27 +9520,11 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_error_at_line=yes else echo "$as_me: failed program was:" >&5 @@ -10257,18 +9533,13 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_error_at_line=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_lib_error_at_line" >&5 echo "${ECHO_T}$ac_cv_lib_error_at_line" >&6; } if test $ac_cv_lib_error_at_line = no; then - case " $LIBOBJS " in - *" error.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS error.$ac_objext" - ;; -esac - + M4_LIBOBJS="$M4_LIBOBJS error.$ac_objext" fi @@ -10277,194 +9548,135 @@ fi - case " $LIBOBJS " in - *" exitfail.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS exitfail.$ac_objext" - ;; -esac - + M4_LIBOBJS="$M4_LIBOBJS exitfail.$ac_objext" : - 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 -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 + + + + + + + +for ac_func in sigaction +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <$ac_header> +/* 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 -if { (ac_try="$ac_cpp conftest.$ac_ext" +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; 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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_header_preproc=no + eval "$as_ac_var=no" fi -rm -f conftest.err conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( cat <<\_ASBOX -## ----------------------------- ## -## Report this to bug-m4@gnu.org ## -## ----------------------------- ## -_ASBOX - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -{ echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext fi -ac_res=`eval echo '${'$as_ac_Header'}'` +ac_res=`eval echo '${'$as_ac_var'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then +if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi - done + + M4_LIBOBJS="$M4_LIBOBJS fopen-safer.$ac_objext" + +cat >>confdefs.h <<\_ACEOF +#define GNULIB_FOPEN_SAFER 1 +_ACEOF + + + + + + + + + + for ac_func in __fpending do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` @@ -10531,27 +9743,11 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 @@ -10560,7 +9756,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_var'}'` @@ -10572,16 +9768,10 @@ if test `eval echo '${'$as_ac_var'}'` = _ACEOF else - case " $LIBOBJS " in - *" $ac_func.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext" - ;; -esac - + M4_LIBOBJS="$M4_LIBOBJS $ac_func.$ac_objext" fi done - fp_headers=' # include # if HAVE_STDIO_EXT_H @@ -10605,8 +9795,7 @@ int main () { #ifndef __fpending - char *p = (char *) __fpending; - return !p; + (void) __fpending; #endif ; @@ -10626,27 +9815,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_have_decl___fpending=yes else echo "$as_me: failed program was:" >&5 @@ -10741,27 +9913,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then fp_done=yes else @@ -10826,88 +9981,125 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; 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 + M4_LIBOBJS="$M4_LIBOBJS free.$ac_objext" + +cat >>confdefs.h <<\_ACEOF +#define free rpl_free +_ACEOF + + fi + + + + if test -n "$GETOPT_H"; then + + M4_LIBOBJS="$M4_LIBOBJS getopt.$ac_objext" + M4_LIBOBJS="$M4_LIBOBJS getopt1.$ac_objext" + + GETOPT_H=getopt.h + +cat >>confdefs.h <<\_ACEOF +#define __GETOPT_PREFIX rpl_ +_ACEOF + + + + + + + + + + +fi + + + + + { echo "$as_me:$LINENO: checking whether the compiler generally respects inline" >&5 +echo $ECHO_N "checking whether the compiler generally respects inline... $ECHO_C" >&6; } +if test "${gl_cv_c_inline_effective+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test $ac_cv_c_inline = no; then + gl_cv_c_inline_effective=no + else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifdef __NO_INLINE__ + #error "inline is not effective" + #endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - gl_cv_func_free=yes + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + gl_cv_c_inline_effective=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - gl_cv_func_free=no + gl_cv_c_inline_effective=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 + fi +fi +{ echo "$as_me:$LINENO: result: $gl_cv_c_inline_effective" >&5 +echo "${ECHO_T}$gl_cv_c_inline_effective" >&6; } + if test $gl_cv_c_inline_effective = yes; then cat >>confdefs.h <<\_ACEOF -#define free rpl_free +#define HAVE_INLINE 1 _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 @@ -10948,27 +10140,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 @@ -11004,17 +10179,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -11092,7 +10260,7 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#if STDC_HEADERS || HAVE_STDLIB_H +#if defined STDC_HEADERS || defined HAVE_STDLIB_H # include #else char *malloc (); @@ -11153,12 +10321,7 @@ else #define HAVE_MALLOC 0 _ACEOF - case " $LIBOBJS " in - *" malloc.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS malloc.$ac_objext" - ;; -esac - + M4_LIBOBJS="$M4_LIBOBJS malloc.$ac_objext" cat >>confdefs.h <<\_ACEOF #define malloc rpl_malloc @@ -11177,12 +10340,7 @@ fi if test $ac_cv_header_wchar_h = yes; then - case " $LIBOBJS " in - *" mbchar.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS mbchar.$ac_objext" - ;; -esac - + M4_LIBOBJS="$M4_LIBOBJS mbchar.$ac_objext" @@ -11256,27 +10414,11 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 @@ -11285,7 +10427,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_var'}'` @@ -11374,27 +10516,11 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 @@ -11403,7 +10529,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_var'}'` @@ -11415,16 +10541,10 @@ if test `eval echo '${'$as_ac_var'}'` = _ACEOF else - case " $LIBOBJS " in - *" $ac_func.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext" - ;; -esac - + M4_LIBOBJS="$M4_LIBOBJS $ac_func.$ac_objext" fi done - if test $ac_cv_func_memchr = no; then @@ -11466,136 +10586,214 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } + +# Is the header present? +{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_header_compiler=no + ac_header_preproc=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6; } +rm -f 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 mkdtemp +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* 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 -# 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> +int +main () +{ +return $ac_func (); + ; + return 0; +} _ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; 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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_header_preproc=no + eval "$as_ac_var=no" fi -rm -f conftest.err conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( cat <<\_ASBOX -## ----------------------------- ## -## Report this to bug-m4@gnu.org ## -## ----------------------------- ## -_ASBOX - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -{ echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext fi -ac_res=`eval echo '${'$as_ac_Header'}'` +ac_res=`eval echo '${'$as_ac_var'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then +if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF +else + M4_LIBOBJS="$M4_LIBOBJS $ac_func.$ac_objext" fi - done + if test $ac_cv_func_mkdtemp = no; then + : fi @@ -11628,9 +10826,9 @@ int i; large = 2147483647; for (i = 0; i < 70; i++) { - char template[] = "conftest.mkstemp/coXXXXXX"; + char templ[] = "conftest.mkstemp/coXXXXXX"; int (*mkstemp_function) (char *) = mkstemp; - int fd = mkstemp_function (template); + int fd = mkstemp_function (templ); if (fd < 0 || lseek (fd, large, SEEK_SET) != large) return 1; close (fd); @@ -11685,21 +10883,76 @@ cat >>confdefs.h <<\_ACEOF #define __MKSTEMP_PREFIX rpl_ _ACEOF - case " $LIBOBJS " in - *" mkstemp.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS mkstemp.$ac_objext" - ;; -esac + M4_LIBOBJS="$M4_LIBOBJS mkstemp.$ac_objext" - case " $LIBOBJS " in - *" tempname.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS tempname.$ac_objext" - ;; + + 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. */ +$ac_includes_default + #include "obstack.h" +int +main () +{ +struct obstack mem; + #define obstack_chunk_alloc malloc + #define obstack_chunk_free free + obstack_init (&mem); + obstack_free (&mem, 0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_func_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_ipa8_conftest.oo \ + 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 + M4_LIBOBJS="$M4_LIBOBJS obstack.$ac_objext" +fi @@ -11708,12 +10961,32 @@ esac -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 + + + + + + M4_LIBOBJS="$M4_LIBOBJS quotearg.$ac_objext" + + + + + + + + + + + + + + + + + + { echo "$as_me:$LINENO: checking for mbstate_t" >&5 +echo $ECHO_N "checking for mbstate_t... $ECHO_C" >&6; } +if test "${ac_cv_type_mbstate_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -11722,107 +10995,62 @@ _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 - +$ac_includes_default +# include int main () { -return $ac_func (); +mbstate_t x; return sizeof 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 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" + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_mbstate_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - eval "$as_ac_var=no" + ac_cv_type_mbstate_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 -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: $ac_cv_type_mbstate_t" >&5 +echo "${ECHO_T}$ac_cv_type_mbstate_t" >&6; } + if test $ac_cv_type_mbstate_t = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_MBSTATE_T 1 _ACEOF -fi -done + else +cat >>confdefs.h <<\_ACEOF +#define mbstate_t int +_ACEOF - fi + 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 whether mbrtowc and mbstate_t are properly declared" >&5 +echo $ECHO_N "checking whether mbrtowc and mbstate_t are properly declared... $ECHO_C" >&6; } +if test "${gl_cv_func_mbrtowc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -11831,11 +11059,15 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include "obstack.h" +#include int main () { -struct obstack *mem; obstack_free(mem,(char *) 0) +wchar_t wc; + char const s[] = ""; + size_t n = 1; + mbstate_t state; + return ! (sizeof state && (mbrtowc) (&wc, s, n, &state)); ; return 0; } @@ -11853,54 +11085,32 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + gl_cv_func_mbrtowc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_func_obstack=no + gl_cv_func_mbrtowc=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $ac_cv_func_obstack" >&5 -echo "${ECHO_T}$ac_cv_func_obstack" >&6; } -if test $ac_cv_func_obstack = yes; then +{ echo "$as_me:$LINENO: result: $gl_cv_func_mbrtowc" >&5 +echo "${ECHO_T}$gl_cv_func_mbrtowc" >&6; } + if test $gl_cv_func_mbrtowc = yes; then cat >>confdefs.h <<\_ACEOF -#define HAVE_OBSTACK 1 +#define HAVE_MBRTOWC 1 _ACEOF -else - case " $LIBOBJS " in - *" obstack.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS obstack.$ac_objext" - ;; -esac + fi -fi @@ -12176,12 +11386,7 @@ cat >>confdefs.h <<\_ACEOF #define regfree rpl_regfree _ACEOF - case " $LIBOBJS " in - *" regex.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS regex.$ac_objext" - ;; -esac - + M4_LIBOBJS="$M4_LIBOBJS regex.$ac_objext" @@ -12223,8 +11428,7 @@ int main () { #ifndef isblank - char *p = (char *) isblank; - return !p; + (void) isblank; #endif ; @@ -12244,53 +11448,234 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; 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 + + + signals_not_posix= + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "sigset_t" >/dev/null 2>&1; then + : +else + signals_not_posix=1 +fi +rm -f conftest* + + if test -z "$signals_not_posix"; then + { echo "$as_me:$LINENO: checking for sigprocmask" >&5 +echo $ECHO_N "checking for sigprocmask... $ECHO_C" >&6; } +if test "${ac_cv_func_sigprocmask+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 sigprocmask to an innocuous variant, in case declares sigprocmask. + For example, HP-UX 11i declares gettimeofday. */ +#define sigprocmask innocuous_sigprocmask + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char sigprocmask (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef sigprocmask + +/* 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 sigprocmask (); +/* 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_sigprocmask || defined __stub___sigprocmask +choke me +#endif + +int +main () +{ +return sigprocmask (); + ; + 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_try") 2>&5 + (eval "$ac_link") 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_func_sigprocmask=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_func_sigprocmask=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_func_sigprocmask" >&5 +echo "${ECHO_T}$ac_cv_func_sigprocmask" >&6; } +if test $ac_cv_func_sigprocmask = yes; then + gl_cv_func_sigprocmask=1 +fi + + fi + if test -n "$gl_cv_func_sigprocmask"; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_POSIX_SIGNALBLOCKING 1 +_ACEOF + + else + M4_LIBOBJS="$M4_LIBOBJS sigprocmask.$ac_objext" + + { echo "$as_me:$LINENO: checking for sigset_t" >&5 +echo $ECHO_N "checking for sigset_t... $ECHO_C" >&6; } +if test "${ac_cv_type_sigset_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 +/* Mingw defines sigset_t not in , but in . */ +#include + +typedef sigset_t ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_have_decl_isblank=yes + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_sigset_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_have_decl_isblank=no + ac_cv_type_sigset_t=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 +{ echo "$as_me:$LINENO: result: $ac_cv_type_sigset_t" >&5 +echo "${ECHO_T}$ac_cv_type_sigset_t" >&6; } +if test $ac_cv_type_sigset_t = yes; then cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_ISBLANK 1 +#define HAVE_SIGSET_T 1 _ACEOF - +gl_cv_type_sigset_t=yes else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_ISBLANK 0 + gl_cv_type_sigset_t=no +fi + + if test $gl_cv_type_sigset_t = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_SIGSET_T 1 _ACEOF + fi + + + -fi @@ -12336,27 +11721,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 @@ -12392,17 +11760,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -12468,8 +11829,12 @@ 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 + if test "${gl_cv_size_max+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + gl_cv_size_max= + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -12487,12 +11852,12 @@ Found it _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "Found it" >/dev/null 2>&1; then - result=yes + gl_cv_size_max=yes fi rm -f conftest* - if test -z "$result"; then - if test "$cross_compiling" = yes; then + if test -z "$gl_cv_size_max"; then + if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -12525,27 +11890,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF @@ -12579,27 +11927,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 @@ -12650,27 +11981,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF @@ -12704,27 +12018,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 @@ -12785,27 +12082,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 @@ -12892,7 +12172,8 @@ 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 + + if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -12924,27 +12205,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF @@ -12977,27 +12241,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 @@ -13047,27 +12294,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF @@ -13100,27 +12330,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 @@ -13180,27 +12393,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 @@ -13286,17 +12482,18 @@ 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 + + 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; + extern size_t foo; + extern unsigned long foo; int main () @@ -13319,27 +12516,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then fits_in_uint=0 else echo "$as_me: failed program was:" >&5 @@ -13349,22 +12529,25 @@ 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)" + fi + if test $fits_in_uint = 1; then + gl_cv_size_max="(((1U << $size_t_bits_minus_1) - 1) * 2 + 1)" + else + gl_cv_size_max="(((1UL << $size_t_bits_minus_1) - 1) * 2 + 1)" + fi else - result="(((1UL << $size_t_bits_minus_1) - 1) * 2 + 1)" + gl_cv_size_max='((size_t)~(size_t)0)' 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_size_max" >&5 +echo "${ECHO_T}$gl_cv_size_max" >&6; } + if test "$gl_cv_size_max" != yes; then cat >>confdefs.h <<_ACEOF -#define SIZE_MAX $result +#define SIZE_MAX $gl_cv_size_max _ACEOF fi @@ -13404,27 +12587,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then gt_cv_ssize_t=yes else echo "$as_me: failed program was:" >&5 @@ -13446,9 +12612,6 @@ _ACEOF fi - - - { 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 @@ -13487,27 +12650,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then gl_cv_func_va_copy=yes else echo "$as_me: failed program was:" >&5 @@ -13559,27 +12705,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then gl_cv_func___va_copy=yes else echo "$as_me: failed program was:" >&5 @@ -13637,6 +12766,13 @@ _ACEOF fi + if test $ac_cv_type_unsigned_long_long_int = yes; then + HAVE_UNSIGNED_LONG_LONG_INT=1 + else + HAVE_UNSIGNED_LONG_LONG_INT=0 + fi + + @@ -13852,30 +12988,13 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec (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=$? + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then gl_cv_header_working_stdint_h=yes else echo "$as_me: failed program was:" >&5 @@ -13931,27 +13050,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 @@ -13987,17 +13089,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -14131,27 +13226,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF @@ -14195,27 +13273,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 @@ -14276,27 +13337,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF @@ -14340,27 +13384,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 @@ -14431,27 +13458,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 @@ -14548,6 +13558,7 @@ 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 + eval gl_cv_bitsizeof_${gltype}=\$result fi @@ -14617,27 +13628,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then result=yes else echo "$as_me: failed program was:" >&5 @@ -14740,27 +13734,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then eval gl_cv_type_${gltype}_suffix=\$glsuf else echo "$as_me: failed program was:" >&5 @@ -14794,26 +13771,11 @@ _ACEOF - case " $LIBOBJS " in - *" mkstemp-safer.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS mkstemp-safer.$ac_objext" - ;; -esac - - - - - case " $LIBOBJS " in - *" strcasecmp.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS strcasecmp.$ac_objext" - ;; -esac + M4_LIBOBJS="$M4_LIBOBJS mkstemp-safer.$ac_objext" -cat >>confdefs.h <<\_ACEOF -#define strcasecmp rpl_strcasecmp -_ACEOF + M4_LIBOBJS="$M4_LIBOBJS strcasecmp.$ac_objext" : @@ -14887,27 +13849,11 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 @@ -14916,7 +13862,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_var'}'` @@ -14928,14 +13874,76 @@ if test `eval echo '${'$as_ac_var'}'` = _ACEOF else - case " $LIBOBJS " in - *" $ac_func.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext" - ;; + M4_LIBOBJS="$M4_LIBOBJS $ac_func.$ac_objext" +fi +done + + { echo "$as_me:$LINENO: checking whether strncasecmp is declared" >&5 +echo $ECHO_N "checking whether strncasecmp is declared... $ECHO_C" >&6; } +if test "${ac_cv_have_decl_strncasecmp+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 strncasecmp + (void) strncasecmp; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl_strncasecmp=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl_strncasecmp=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_strncasecmp" >&5 +echo "${ECHO_T}$ac_cv_have_decl_strncasecmp" >&6; } +if test $ac_cv_have_decl_strncasecmp = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STRNCASECMP 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STRNCASECMP 0 +_ACEOF + fi -done if test $ac_cv_func_strncasecmp = no; then @@ -14946,6 +13954,13 @@ done + M4_LIBOBJS="$M4_LIBOBJS strstr.$ac_objext" + + + : + + + for ac_func in strtol do @@ -14995,45 +14010,29 @@ choke me 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 +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_try") 2>&5 + (eval "$ac_link") 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 @@ -15042,7 +14041,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_var'}'` @@ -15054,12 +14053,7 @@ if test `eval echo '${'$as_ac_var'}'` = _ACEOF else - case " $LIBOBJS " in - *" $ac_func.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext" - ;; -esac - + M4_LIBOBJS="$M4_LIBOBJS $ac_func.$ac_objext" fi done @@ -15072,7 +14066,6 @@ done - { echo "$as_me:$LINENO: checking whether mkdir is declared" >&5 echo $ECHO_N "checking whether mkdir is declared... $ECHO_C" >&6; } if test "${ac_cv_have_decl_mkdir+set}" = set; then @@ -15090,8 +14083,7 @@ int main () { #ifndef mkdir - char *p = (char *) mkdir; - return !p; + (void) mkdir; #endif ; @@ -15111,27 +14103,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_have_decl_mkdir=yes else echo "$as_me: failed program was:" >&5 @@ -15157,45 +14132,6 @@ else _ACEOF -fi - - - - SYS_STAT_H= - if test $ac_cv_func_lstat:$ac_cv_have_decl_mkdir != yes: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_sys_stat_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - - - - - if test $ac_cv_header_sys_stat_h = yes; then - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF - gl_cv_absolute_sys_stat_h=`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | -sed -n '\#/sys/stat.h#{s#.*"\(.*/sys/stat.h\)".*#\1#;s#^/[^/]#//&#;p;q;}'` - fi - -fi -{ echo "$as_me:$LINENO: result: $gl_cv_absolute_sys_stat_h" >&5 -echo "${ECHO_T}$gl_cv_absolute_sys_stat_h" >&6; } -cat >>confdefs.h <<_ACEOF -#define ABSOLUTE_SYS_STAT_H "$gl_cv_absolute_sys_stat_h" -_ACEOF - - - ABSOLUTE_SYS_STAT_H=\"$gl_cv_absolute_sys_stat_h\" - for ac_header in io.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` @@ -15234,27 +14170,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 @@ -15290,17 +14209,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -15364,20 +14276,162 @@ fi done +fi + - SYS_STAT_H='sys/stat.h' - else - ABSOLUTE_SYS_STAT_H=\"no/such/file/sys/stat.h\" - fi - case " $LIBOBJS " in - *" tmpfile-safer.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS tmpfile-safer.$ac_objext" - ;; + { echo "$as_me:$LINENO: checking absolute name of " >&5 +echo $ECHO_N "checking absolute name of ... $ECHO_C" >&6; } +if test "${gl_cv_absolute_sys_stat_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + + + + + if test $ac_cv_header_sys_stat_h = yes; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF + gl_cv_absolute_sys_stat_h=`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | +sed -n '\#/sys/stat.h#{s#.*"\(.*/sys/stat.h\)".*#\1#;s#^/[^/]#//&#;p;q;}'` + fi + +fi +{ echo "$as_me:$LINENO: result: $gl_cv_absolute_sys_stat_h" >&5 +echo "${ECHO_T}$gl_cv_absolute_sys_stat_h" >&6; } +cat >>confdefs.h <<_ACEOF +#define ABSOLUTE_SYS_STAT_H "$gl_cv_absolute_sys_stat_h" +_ACEOF + + + ABSOLUTE_SYS_STAT_H=\"$gl_cv_absolute_sys_stat_h\" + + SYS_STAT_H='sys/stat.h' + + + + + + M4_LIBOBJS="$M4_LIBOBJS tempname.$ac_objext" + + + + + + + + + + + + + + + + + +for ac_func in __secure_getenv +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done @@ -15420,27 +14474,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 @@ -15474,19 +14511,12 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -15565,24 +14595,9 @@ 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 - + M4_LIBOBJS="$M4_LIBOBJS dup-safer.$ac_objext" + M4_LIBOBJS="$M4_LIBOBJS fd-safer.$ac_objext" + M4_LIBOBJS="$M4_LIBOBJS pipe-safer.$ac_objext" @@ -15715,27 +14730,11 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 @@ -15744,7 +14743,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_var'}'` @@ -15756,36 +14755,14 @@ if test `eval echo '${'$as_ac_var'}'` = _ACEOF else - case " $LIBOBJS " in - *" $ac_func.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext" - ;; -esac - + M4_LIBOBJS="$M4_LIBOBJS $ac_func.$ac_objext" fi done - if test $ac_cv_func_vasnprintf = no; then - case " $LIBOBJS " in - *" printf-args.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS printf-args.$ac_objext" - ;; -esac - - case " $LIBOBJS " in - *" printf-parse.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS printf-parse.$ac_objext" - ;; -esac - - case " $LIBOBJS " in - *" asnprintf.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS asnprintf.$ac_objext" - ;; -esac - - + M4_LIBOBJS="$M4_LIBOBJS printf-args.$ac_objext" + M4_LIBOBJS="$M4_LIBOBJS printf-parse.$ac_objext" + M4_LIBOBJS="$M4_LIBOBJS asnprintf.$ac_objext" @@ -15835,27 +14812,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_type_ptrdiff_t=yes else echo "$as_me: failed program was:" >&5 @@ -15953,27 +14913,11 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 @@ -15982,7 +14926,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_var'}'` @@ -16069,27 +15013,11 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 @@ -16098,7 +15026,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_var'}'` @@ -16110,23 +15038,12 @@ if test `eval echo '${'$as_ac_var'}'` = _ACEOF else - case " $LIBOBJS " in - *" $ac_func.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext" - ;; -esac - + M4_LIBOBJS="$M4_LIBOBJS $ac_func.$ac_objext" fi done - if test $ac_cv_func_vasprintf = no; then - case " $LIBOBJS " in - *" asprintf.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS asprintf.$ac_objext" - ;; -esac - + M4_LIBOBJS="$M4_LIBOBJS asprintf.$ac_objext" @@ -16159,6 +15076,7 @@ esac + { echo "$as_me:$LINENO: checking whether wcwidth is declared" >&5 echo $ECHO_N "checking whether wcwidth is declared... $ECHO_C" >&6; } if test "${ac_cv_have_decl_wcwidth+set}" = set; then @@ -16188,8 +15106,7 @@ int main () { #ifndef wcwidth - char *p = (char *) wcwidth; - return !p; + (void) wcwidth; #endif ; @@ -16209,27 +15126,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_have_decl_wcwidth=yes else echo "$as_me: failed program was:" >&5 @@ -16259,18 +15159,13 @@ fi - case " $LIBOBJS " in - *" xmalloc.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS xmalloc.$ac_objext" - ;; -esac + M4_LIBOBJS="$M4_LIBOBJS xmalloc.$ac_objext" : - : @@ -16316,27 +15211,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 @@ -16372,17 +15250,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -16456,6 +15327,10 @@ done + + + + # Code from Jim Avera . # stackovf.c requires: # 1. Either sigaction with SA_ONSTACK, or sigvec with SV_ONSTACK @@ -16506,27 +15381,11 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then M4_cv_use_stackovf=yes else echo "$as_me: failed program was:" >&5 @@ -16535,16 +15394,14 @@ sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi fi fi { echo "$as_me:$LINENO: result: $M4_cv_use_stackovf" >&5 echo "${ECHO_T}$M4_cv_use_stackovf" >&6; } - - -if test "$M4_cv_use_stackovf" = yes; then + if test "$M4_cv_use_stackovf" = yes; then STACKOVF_TRUE= STACKOVF_FALSE='#' else @@ -16597,27 +15454,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_type_rlim_t=yes else echo "$as_me: failed program was:" >&5 @@ -16684,27 +15524,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_type_stack_t=yes else echo "$as_me: failed program was:" >&5 @@ -16771,27 +15594,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_type_sigcontext=yes else echo "$as_me: failed program was:" >&5 @@ -16846,27 +15652,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then M4_cv_func_system_consistent=yes else echo "$as_me: failed program was:" >&5 @@ -17120,6 +15909,23 @@ echo "$as_me: error: conditional \"GL_CO Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi +test "X$DEFS" = X-DHAVE_CONFIG_H && DEFS= + + M4_libobjs= + M4_ltlibobjs= + if test -n "$M4_LIBOBJS"; then + # Remove the extension. + sed_drop_objext='s/\.o$//;s/\.obj$//' + for i in `for i in $M4_LIBOBJS; do echo "$i"; done | sed "$sed_drop_objext" | sort | uniq`; do + M4_libobjs="$M4_libobjs $i.$ac_objext" + M4_ltlibobjs="$M4_ltlibobjs $i.lo" + done + fi + M4_LIBOBJS=$M4_libobjs + + M4_LTLIBOBJS=$M4_ltlibobjs + + if test -z "${STACKOVF_TRUE}" && test -z "${STACKOVF_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"STACKOVF\" was never defined. Usually this means the macro was only invoked conditionally." >&5 @@ -17151,7 +15957,8 @@ cat >>$CONFIG_STATUS <<\_ACEOF ## M4sh Initialization. ## ## --------------------- ## -# Be Bourne compatible +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: @@ -17160,10 +15967,13 @@ if test -n "${ZSH_VERSION+set}" && (emul alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh + + # PATH needs CR @@ -17387,19 +16197,28 @@ else as_mkdir_p=false fi -# Find out whether ``test -x'' works. Don't use a zero-byte file, as -# systems may use methods other than mode bits to determine executability. -cat >conf$$.file <<_ASEOF -#! /bin/sh -exit 0 -_ASEOF -chmod +x conf$$.file -if test -x conf$$.file >/dev/null 2>&1; then - as_executable_p="test -x" +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' else - as_executable_p=: + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' fi -rm -f conf$$.file +as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -17414,8 +16233,8 @@ 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.7, which was -generated by GNU Autoconf 2.60. Invocation command line was +This file was extended by GNU M4 $as_me 1.4.8, which was +generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -17444,7 +16263,7 @@ current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit - -V, --version print version number, then exit + -V, --version print version number and configuration settings, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions @@ -17467,8 +16286,8 @@ Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -GNU M4 config.status 1.4.7 -configured by $0, generated by GNU Autoconf 2.60, +GNU M4 config.status 1.4.8 +configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2006 Free Software Foundation, Inc. @@ -17478,6 +16297,7 @@ gives unlimited permission to copy, dist ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' +MKDIR_P='$MKDIR_P' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF @@ -17580,7 +16400,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF for ac_config_target in $ac_config_targets do case $ac_config_target in - "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h:config-h.in" ;; + "lib/config.h") CONFIG_HEADERS="$CONFIG_HEADERS lib/config.h:lib/config.hin" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "stamp-h") CONFIG_COMMANDS="$CONFIG_COMMANDS stamp-h" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; @@ -17691,6 +16511,7 @@ target_alias!$target_alias$ac_delim INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim INSTALL_DATA!$INSTALL_DATA$ac_delim +am__isrc!$am__isrc$ac_delim CYGPATH_W!$CYGPATH_W$ac_delim PACKAGE!$PACKAGE$ac_delim VERSION!$VERSION$ac_delim @@ -17741,13 +16562,12 @@ GL_COND_LIBTOOL_TRUE!$GL_COND_LIBTOOL_TR GL_COND_LIBTOOL_FALSE!$GL_COND_LIBTOOL_FALSE$ac_delim ALLOCA!$ALLOCA$ac_delim ALLOCA_H!$ALLOCA_H$ac_delim -LIBOBJS!$LIBOBJS$ac_delim GETOPT_H!$GETOPT_H$ac_delim STDBOOL_H!$STDBOOL_H$ac_delim HAVE__BOOL!$HAVE__BOOL$ac_delim HAVE_LONG_LONG_INT!$HAVE_LONG_LONG_INT$ac_delim +HAVE_UNSIGNED_LONG_LONG_INT!$HAVE_UNSIGNED_LONG_LONG_INT$ac_delim HAVE_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 @@ -17789,6 +16609,7 @@ _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF +HAVE_INTTYPES_H!$HAVE_INTTYPES_H$ac_delim 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 @@ -17816,10 +16637,13 @@ LIBM4_LIBDEPS!$LIBM4_LIBDEPS$ac_delim LIBM4_LTLIBDEPS!$LIBM4_LTLIBDEPS$ac_delim STACKOVF_TRUE!$STACKOVF_TRUE$ac_delim STACKOVF_FALSE!$STACKOVF_FALSE$ac_delim +LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim +M4_LIBOBJS!$M4_LIBOBJS$ac_delim +M4_LTLIBOBJS!$M4_LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 28; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 32; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 @@ -18046,6 +16870,11 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_ [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac + ac_MKDIR_P=$MKDIR_P + case $MKDIR_P in + [\\/$]* | ?:[\\/]* ) ;; + */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; + esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF @@ -18099,6 +16928,7 @@ s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t +s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out @@ -18263,8 +17093,9 @@ echo "$as_me: executing $ac_file command # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. - # So let's grep whole file. - if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ diff -ruNp m4-1.4.7/configure.ac m4-1.4.8/configure.ac --- m4-1.4.7/configure.ac 2006-09-25 06:04:42.000000000 -0600 +++ m4-1.4.8/configure.ac 2006-11-20 06:56:33.000000000 -0700 @@ -18,16 +18,15 @@ # 02110-1301 USA AC_PREREQ([2.60]) -AC_INIT([GNU M4], [1.4.7], [bug-m4@gnu.org]) +AC_INIT([GNU M4], [1.4.8], [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]) -m4_pattern_forbid([^M4_]) -m4_pattern_allow([^M4_cv_]) +m4_pattern_forbid([^M4_[A-Z]]) AC_CONFIG_SRCDIR([src/m4.h]) -AC_CONFIG_HEADERS([config.h:config-h.in]) +AC_CONFIG_HEADERS([lib/config.h:lib/config.hin]) AC_CANONICAL_BUILD AC_CANONICAL_HOST diff -ruNp m4-1.4.7/depcomp m4-1.4.8/depcomp --- m4-1.4.7/depcomp 2006-09-25 06:08:01.000000000 -0600 +++ m4-1.4.8/depcomp 2006-11-20 07:08:16.000000000 -0700 @@ -1,7 +1,7 @@ #! /bin/sh # depcomp - compile a program generating dependencies as side-effects -scriptversion=2006-07-09.11 +scriptversion=2006-10-15.18 # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006 Free Software # Foundation, Inc. @@ -92,7 +92,20 @@ gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. - "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" +## Unfortunately, FreeBSD c89 acceptance of flags depends upon +## the command line argument order; so add the flags where they +## appear in depend2.am. Note that the slowdown incurred here +## affects only configure: in makefiles, %FASTDEP% shortcuts this. + for arg + do + case $arg in + -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; + *) set fnord "$@" "$arg" ;; + esac + shift # fnord + shift # $arg + done + "$@" stat=$? if test $stat -eq 0; then : else diff -ruNp m4-1.4.7/doc/Makefile.in m4-1.4.8/doc/Makefile.in --- m4-1.4.7/doc/Makefile.in 2006-09-25 06:07:58.000000000 -0600 +++ m4-1.4.8/doc/Makefile.in 2006-11-20 07:25:48.000000000 -0700 @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. +# Makefile.in generated by automake 1.10 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -13,15 +13,11 @@ # PARTICULAR PURPOSE. @SET_MAKE@ -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -41,24 +37,32 @@ 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/cloexec.m4 \ - $(top_srcdir)/m4/close-stream.m4 $(top_srcdir)/m4/codeset.m4 \ + $(top_srcdir)/m4/alloca.m4 $(top_srcdir)/m4/allocsa.m4 \ + $(top_srcdir)/m4/cloexec.m4 $(top_srcdir)/m4/close-stream.m4 \ + $(top_srcdir)/m4/closeout.m4 $(top_srcdir)/m4/codeset.m4 \ + $(top_srcdir)/m4/config-h.m4 $(top_srcdir)/m4/eealloc.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/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/fatal-signal.m4 $(top_srcdir)/m4/fpending.m4 \ + $(top_srcdir)/m4/free.m4 $(top_srcdir)/m4/getopt.m4 \ + $(top_srcdir)/m4/gl_list.m4 $(top_srcdir)/m4/gnulib-comp.m4 \ + $(top_srcdir)/m4/inline.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/mbstate_t.m4 $(top_srcdir)/m4/memchr.m4 \ + $(top_srcdir)/m4/mkdtemp.m4 $(top_srcdir)/m4/mkstemp.m4 \ + $(top_srcdir)/m4/pathmax.m4 $(top_srcdir)/m4/quotearg.m4 \ + $(top_srcdir)/m4/regex.m4 $(top_srcdir)/m4/sig_atomic_t.m4 \ + $(top_srcdir)/m4/signalblocking.m4 \ + $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/ssize_t.m4 \ $(top_srcdir)/m4/stdarg.m4 $(top_srcdir)/m4/stdbool.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/strstr.m4 $(top_srcdir)/m4/strtol.m4 \ + $(top_srcdir)/m4/sys_stat_h.m4 $(top_srcdir)/m4/tempname.m4 \ + $(top_srcdir)/m4/tmpdir.m4 $(top_srcdir)/m4/ulonglong.m4 \ $(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/unistd_h.m4 \ $(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/vasnprintf.m4 \ $(top_srcdir)/m4/vasprintf.m4 $(top_srcdir)/m4/wchar_t.m4 \ @@ -69,7 +73,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/a am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_HEADER = $(top_builddir)/lib/config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = @@ -86,6 +90,12 @@ MAKEINFOHTML = $(MAKEINFO) --html AM_MAKEINFOHTMLFLAGS = $(AM_MAKEINFOFLAGS) DVIPS = dvips am__installdirs = "$(DESTDIR)$(infodir)" "$(DESTDIR)$(man1dir)" +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; man1dir = $(mandir)/man1 NROFF = nroff MANS = $(man_MANS) @@ -95,8 +105,6 @@ ABSOLUTE_SYS_STAT_H = @ABSOLUTE_SYS_STAT ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ ALLOCA_H = @ALLOCA_H@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ @@ -122,8 +130,6 @@ EGREP = @EGREP@ EOVERFLOW = @EOVERFLOW@ EXEEXT = @EXEEXT@ 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@ @@ -134,8 +140,10 @@ 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_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@ HAVE_WCHAR_H = @HAVE_WCHAR_H@ HAVE__BOOL = @HAVE__BOOL@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -146,7 +154,10 @@ LIBM4_LTLIBDEPS = @LIBM4_LTLIBDEPS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ +M4_LIBOBJS = @M4_LIBOBJS@ +M4_LTLIBOBJS = @M4_LTLIBOBJS@ MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -161,8 +172,6 @@ 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@ @@ -171,9 +180,11 @@ UNISTD_H = @UNISTD_H@ VERSION = @VERSION@ WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ WINT_T_SUFFIX = @WINT_T_SUFFIX@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -185,6 +196,7 @@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ +builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ @@ -212,8 +224,11 @@ program_transform_name = @program_transf psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ info_TEXINFOS = m4.texinfo m4_TEXINFOS = fdl.texi man_MANS = m4.1 @@ -326,9 +341,26 @@ maintainer-clean-vti: TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ $(DVIPS) -o $@ $< +uninstall-dvi-am: + @$(NORMAL_UNINSTALL) + @list='$(DVIS)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(dvidir)/$$f'"; \ + rm -f "$(DESTDIR)$(dvidir)/$$f"; \ + done + +uninstall-html-am: + @$(NORMAL_UNINSTALL) + @list='$(HTMLS)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -rf '$(DESTDIR)$(htmldir)/$$f'"; \ + rm -rf "$(DESTDIR)$(htmldir)/$$f"; \ + done + uninstall-info-am: @$(PRE_UNINSTALL) - @if (install-info --version && \ + @if test -d '$(DESTDIR)$(infodir)' && \ + (install-info --version && \ install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \ list='$(INFO_DEPS)'; \ for file in $$list; do \ @@ -342,12 +374,28 @@ uninstall-info-am: for file in $$list; do \ relfile=`echo "$$file" | sed 's|^.*/||'`; \ relfile_i=`echo "$$relfile" | sed 's|\.info$$||;s|$$|.i|'`; \ - (if cd "$(DESTDIR)$(infodir)"; then \ + (if test -d "$(DESTDIR)$(infodir)" && cd "$(DESTDIR)$(infodir)"; then \ echo " cd '$(DESTDIR)$(infodir)' && rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]"; \ rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]; \ else :; fi); \ done +uninstall-pdf-am: + @$(NORMAL_UNINSTALL) + @list='$(PDFS)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(pdfdir)/$$f'"; \ + rm -f "$(DESTDIR)$(pdfdir)/$$f"; \ + done + +uninstall-ps-am: + @$(NORMAL_UNINSTALL) + @list='$(PSS)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(psdir)/$$f'"; \ + rm -f "$(DESTDIR)$(psdir)/$$f"; \ + done + dist-info: $(INFO_DEPS) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ list='$(INFO_DEPS)'; \ @@ -356,10 +404,13 @@ dist-info: $(INFO_DEPS) $(srcdir)/*) base=`echo "$$base" | sed "s|^$$srcdirstrip/||"`;; \ esac; \ if test -f $$base; then d=.; else d=$(srcdir); fi; \ - for file in $$d/$$base*; do \ - relfile=`expr "$$file" : "$$d/\(.*\)"`; \ - test -f $(distdir)/$$relfile || \ - cp -p $$file $(distdir)/$$relfile; \ + base_i=`echo "$$base" | sed 's|\.info$$||;s|$$|.i|'`; \ + for file in $$d/$$base $$d/$$base-[0-9] $$d/$$base-[0-9][0-9] $$d/$$base_i[0-9] $$d/$$base_i[0-9][0-9]; do \ + if test -f $$file; then \ + relfile=`expr "$$file" : "$$d/\(.*\)"`; \ + test -f $(distdir)/$$relfile || \ + cp -p $$file $(distdir)/$$relfile; \ + else :; fi; \ done; \ done @@ -376,7 +427,7 @@ maintainer-clean-aminfo: done install-man1: $(man1_MANS) $(man_MANS) @$(NORMAL_INSTALL) - test -z "$(man1dir)" || $(mkdir_p) "$(DESTDIR)$(man1dir)" + test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)" @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ for i in $$l2; do \ @@ -427,22 +478,21 @@ CTAGS: distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ @@ -461,7 +511,7 @@ check: check-am all-am: Makefile $(INFO_DEPS) $(MANS) installdirs: for dir in "$(DESTDIR)$(infodir)" "$(DESTDIR)$(man1dir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am @@ -510,13 +560,42 @@ info-am: $(INFO_DEPS) install-data-am: install-info-am install-man +install-dvi: install-dvi-am + +install-dvi-am: $(DVIS) + @$(NORMAL_INSTALL) + test -z "$(dvidir)" || $(MKDIR_P) "$(DESTDIR)$(dvidir)" + @list='$(DVIS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(dvidir)/$$f'"; \ + $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(dvidir)/$$f"; \ + done install-exec-am: +install-html: install-html-am + +install-html-am: $(HTMLS) + @$(NORMAL_INSTALL) + test -z "$(htmldir)" || $(MKDIR_P) "$(DESTDIR)$(htmldir)" + @list='$(HTMLS)'; for p in $$list; do \ + if test -f "$$p" || test -d "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + if test -d "$$d$$p"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)/$$f'"; \ + $(MKDIR_P) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \ + echo " $(INSTALL_DATA) '$$d$$p'/* '$(DESTDIR)$(htmldir)/$$f'"; \ + $(INSTALL_DATA) "$$d$$p"/* "$(DESTDIR)$(htmldir)/$$f"; \ + else \ + echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(htmldir)/$$f'"; \ + $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(htmldir)/$$f"; \ + fi; \ + done install-info: install-info-am install-info-am: $(INFO_DEPS) @$(NORMAL_INSTALL) - test -z "$(infodir)" || $(mkdir_p) "$(DESTDIR)$(infodir)" + test -z "$(infodir)" || $(MKDIR_P) "$(DESTDIR)$(infodir)" @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ list='$(INFO_DEPS)'; \ for file in $$list; do \ @@ -546,6 +625,28 @@ install-info-am: $(INFO_DEPS) else : ; fi install-man: install-man1 +install-pdf: install-pdf-am + +install-pdf-am: $(PDFS) + @$(NORMAL_INSTALL) + test -z "$(pdfdir)" || $(MKDIR_P) "$(DESTDIR)$(pdfdir)" + @list='$(PDFS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(pdfdir)/$$f'"; \ + $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(pdfdir)/$$f"; \ + done +install-ps: install-ps-am + +install-ps-am: $(PSS) + @$(NORMAL_INSTALL) + test -z "$(psdir)" || $(MKDIR_P) "$(DESTDIR)$(psdir)" + @list='$(PSS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(psdir)/$$f'"; \ + $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(psdir)/$$f"; \ + done installcheck-am: maintainer-clean: maintainer-clean-am @@ -565,21 +666,26 @@ ps: ps-am ps-am: $(PSS) -uninstall-am: uninstall-info-am uninstall-man +uninstall-am: uninstall-dvi-am uninstall-html-am uninstall-info-am \ + uninstall-man uninstall-pdf-am uninstall-ps-am uninstall-man: uninstall-man1 +.MAKE: install-am install-strip + .PHONY: all all-am check check-am clean clean-generic dist-info \ distclean distclean-generic distdir dvi dvi-am html html-am \ info info-am install install-am install-data install-data-am \ - install-exec install-exec-am install-info install-info-am \ - install-man install-man1 install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-aminfo maintainer-clean-generic \ - maintainer-clean-vti mostlyclean mostlyclean-aminfo \ - mostlyclean-generic mostlyclean-vti pdf pdf-am ps ps-am \ - uninstall uninstall-am uninstall-info-am uninstall-man \ - uninstall-man1 + install-dvi install-dvi-am install-exec install-exec-am \ + install-html install-html-am install-info install-info-am \ + install-man install-man1 install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-aminfo \ + maintainer-clean-generic maintainer-clean-vti mostlyclean \ + mostlyclean-aminfo mostlyclean-generic mostlyclean-vti pdf \ + pdf-am ps ps-am uninstall uninstall-am uninstall-dvi-am \ + uninstall-html-am uninstall-info-am uninstall-man \ + uninstall-man1 uninstall-pdf-am uninstall-ps-am # Depend on configure.ac for version, m4.c for usage text. Do not depend on diff -ruNp m4-1.4.7/doc/gendocs_template m4-1.4.8/doc/gendocs_template --- m4-1.4.7/doc/gendocs_template 2006-09-23 22:28:32.000000000 -0600 +++ m4-1.4.8/doc/gendocs_template 2006-11-20 06:57:33.000000000 -0700 @@ -25,10 +25,8 @@

 [image of the head of a GNU] + alt=" [image of the head of a GNU] " width="129" height="122"/> -(no gifs due to patent problems)


diff -ruNp m4-1.4.7/doc/m4.1 m4-1.4.8/doc/m4.1 --- m4-1.4.7/doc/m4.1 2006-09-25 06:10:11.000000000 -0600 +++ m4-1.4.8/doc/m4.1 2006-11-20 07:12:34.000000000 -0700 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.35. -.TH M4 "1" "September 2006" "FSF" "User Commands" +.TH M4 "1" "November 2006" "FSF" "User Commands" .SH NAME M4 \- macro processor .SH SYNOPSIS diff -ruNp m4-1.4.7/doc/m4.info m4-1.4.8/doc/m4.info --- m4-1.4.7/doc/m4.info 2006-09-25 06:10:42.000000000 -0600 +++ m4-1.4.8/doc/m4.info 2006-11-20 07:12:30.000000000 -0700 @@ -1,6 +1,6 @@ This is m4.info, produced by makeinfo version 4.8 from m4.texinfo. - This manual is for GNU M4 (version 1.4.7, 23 September 2006), a + This manual is for GNU M4 (version 1.4.8, 20 November 2006), a package containing an implementation of the m4 macro language. Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 2004, 2005, 2006 @@ -24,7 +24,7 @@ File: m4.info, Node: Top, Next: Prelim GNU M4 ****** -This manual is for GNU M4 (version 1.4.7, 23 September 2006), a package +This manual is for GNU M4 (version 1.4.8, 20 November 2006), a package containing an implementation of the m4 macro language. Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 2004, 2005, 2006 @@ -46,10 +46,10 @@ generating `configure' scripts, but not GNU `m4' was originally written by Rene' Seindal, with subsequent changes by Franc,ois Pinard and other volunteers on the Internet. All -names and email addresses can be found in the files `AUTHORS' and -`THANKS' from the GNU M4 distribution. +names and email addresses can be found in the files `m4-1.4.8/AUTHORS' +and `m4-1.4.8/THANKS' from the GNU M4 distribution. - This is release 1.4.7. It is now considered stable: future + This is release 1.4.8. 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... @@ -65,6 +65,7 @@ will go away and _you should not count o * Menu: * Preliminaries:: Introduction and preliminaries +* Invoking m4:: Invoking `m4' * Syntax:: Lexical and syntactic conventions * Macros:: How to invoke macros @@ -94,10 +95,18 @@ Introduction and preliminaries * Intro:: Introduction to `m4' * History:: Historical references -* Invoking m4:: Invoking `m4' * Bugs:: Problems and bugs * Manual:: Using this manual +Invoking `m4' + +* Operation modes:: Command line options for operation modes +* Preprocessor features:: Command line options for preprocessor features +* Limits control:: Command line options for limits control +* Frozen state:: Command line options for frozen state +* Debugging options:: Command line options for debugging +* Command line files:: Specifying input files on the command line + Lexical and syntactic conventions * Names:: Macro names @@ -130,7 +139,9 @@ Conditionals, loops, and recursion * Ifdef:: Testing if a macro is defined * Ifelse:: If-else construct, or multibranch -* Loops:: Loops and recursion in m4 +* Shift:: Recursion in `m4' +* Forloop:: Iteration by counting +* Foreach:: Iteration by list contents How to debug macros and input @@ -157,7 +168,7 @@ Diverting and undiverting output * Divert:: Diverting output * Undivert:: Undiverting output * Divnum:: Diversion numbers -* Cleardiv:: Discarding diverted text +* Cleardivert:: Discarding diverted text Macros for text handling @@ -180,7 +191,7 @@ Macros for running shell commands * Syscmd:: Executing simple commands * Esyscmd:: Reading the output of commands * Sysval:: Exit status -* Maketemp:: Making temporary files +* Mkstemp:: Making temporary files Miscellaneous builtin macros @@ -199,6 +210,14 @@ Compatibility with other versions of `m4 * Incompatibilities:: Facilities in System V m4 not in GNU M4 * Other Incompatibilities:: Other incompatibilities +Correct version of some examples + +* Improved exch:: Solution for `exch' +* Improved forloop:: Solution for `forloop' +* Improved foreach:: Solution for `foreach' +* Improved cleardivert:: Solution for `cleardivert' +* Improved fatal_error:: Solution for `fatal_error' + How to make copies of this manual * GNU Free Documentation License:: License for copying this manual @@ -209,7 +228,7 @@ Indices of concepts and macros * Macro index:: Index for all `m4' macros  -File: m4.info, Node: Preliminaries, Next: Syntax, Prev: Top, Up: Top +File: m4.info, Node: Preliminaries, Next: Invoking m4, Prev: Top, Up: Top 1 Introduction and preliminaries ******************************** @@ -226,7 +245,6 @@ language. * Intro:: Introduction to `m4' * History:: Historical references -* Invoking m4:: Invoking `m4' * Bugs:: Problems and bugs * Manual:: Using this manual @@ -263,7 +281,7 @@ scripts than doing real work. Beware th the health of compulsive programmers.  -File: m4.info, Node: History, Next: Invoking m4, Prev: Intro, Up: Preliminaries +File: m4.info, Node: History, Next: Bugs, Prev: Intro, Up: Preliminaries 1.2 Historical references ========================= @@ -313,17 +331,107 @@ 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, 1.4.6, and 1.4.7. +release of 1.4.5, 1.4.6, 1.4.7, and 1.4.8. Meanwhile, development has continued on new features for `m4', such as dynamic module loading and additional builtins. When complete, GNU `m4' 2.0 will start a new series of releases.  -File: m4.info, Node: Invoking m4, Next: Bugs, Prev: History, Up: Preliminaries +File: m4.info, Node: Bugs, Next: Manual, Prev: History, Up: Preliminaries + +1.3 Problems and bugs +===================== + +If you have problems with GNU M4 or think you've found a bug, please +report it. Before reporting a bug, make sure you've actually found a +real bug. Carefully reread the documentation and see if it really says +you can do what you're trying to do. If it's not clear whether you +should be able to do something or not, report that too; it's a bug in +the documentation! + + Before reporting a bug or trying to fix it yourself, try to isolate +it to the smallest possible input file that reproduces the problem. +Then send us the input file and the exact results `m4' gave you. Also +say what you expected to occur; this will help us decide whether the +problem was really in the documentation. + + Once you've got a precise problem, send e-mail to (Internet) +. Please include the version number of `m4' you are +using. You can get this information with the command `m4 --version'. +Also provide details about the platform you are executing on. + + Non-bug suggestions are always welcome as well. If you have +questions about things that are unclear in the documentation or are +just obscure features, please report them too. + + +File: m4.info, Node: Manual, Prev: Bugs, Up: Preliminaries + +1.4 Using this manual +===================== -1.3 Invoking `m4' -================= +This manual contains a number of examples of `m4' input and output, and +a simple notation is used to distinguish input, output and error +messages from `m4'. Examples are set out from the normal text, and +shown in a fixed width font, like this + + This is an example of an example! + + To distinguish input from output, all output from `m4' is prefixed +by the string `=>', and all error messages by the string `error-->'. +Thus + + Example of input line + =>Output line from m4 + error-->and an error message + + The sequence `^D' in an example indicates the end of the input file. +The majority of these examples are self-contained, and you can run them +with similar results by invoking `m4 -d'. In fact, the testsuite that +is bundled in the GNU M4 package consists of the examples in this +document! + + As each of the predefined macros in `m4' is described, a prototype +call of the macro will be shown, giving descriptive names to the +arguments, e.g., + + -- Composite: example (STRING, [COUNT = `1'], [ARGUMENT]...) + This is a sample prototype. There is not really a macro named + `example', but this documents that if there were, it would be a + Composite macro, rather than a Builtin. It requires at least one + argument, STRING. Remember that in `m4', there must not be a + space between the macro name and the opening parenthesis, unless + it was intended to call the macro without any arguments. The + brackets around COUNT and ARGUMENT show that these arguments are + optional. If COUNT is omitted, the macro behaves as if count were + `1', whereas if ARGUMENT is omitted, the macro behaves as if it + were the empty string. A blank argument is not the same as an + omitted argument. For example, `example(`a')', `example(`a',`1')', + and `example(`a',`1',)' would behave identically with COUNT set to + `1'; while `example(`a',)' and `example(`a',`')' would explicitly + pass the empty string for COUNT. The ellipses (`...') show that + the macro processes additional arguments after ARGUMENT, rather + than ignoring them. + + All macro arguments in `m4' are strings, but some are given special +interpretation, e.g., as numbers, file names, regular expressions, etc. +The documentation for each macro will state how the parameters are +interpreted, and what happens if the argument cannot be parsed +according to the desired interpretation. Unless specified otherwise, a +parameter specified to be a number is parsed as a decimal, even if the +argument has leading zeros; and parsing the empty string as a number +results in 0 rather than an error, although a warning will be issued. + + This document consistently writes and uses "builtin", without a +hyphen, as if it were an English word. This is how the `builtin' +primitive is spelled within `m4'. + + +File: m4.info, Node: Invoking m4, Next: Syntax, Prev: Preliminaries, Up: Top + +2 Invoking `m4' +*************** The format of the `m4' command is: @@ -331,38 +439,57 @@ The format of the `m4' command is: All options begin with `-', or if long option names are used, with `--'. A long option name need not be written completely, any -unambiguous prefix is sufficient. Unless `POSIXLY_CORRECT' is set in -the environment, options may be intermixed with files. The argument -`--' is a marker to denote the end of options. +unambiguous prefix is sufficient. POSIX requires `m4' to recognize +arguments intermixed with files, even when `POSIXLY_CORRECT' is set in +the environment. Most options take effect at startup regardless of +their position, but some are documented below as taking effect after +any files that occurred earlier in the command line. The argument `--' +is a marker to denote the end of options. With short options, options that do not take arguments may be combined into a single command line argument with subsequent options, options with mandatory arguments may be provided either as a single command line argument or as two arguments, and options with optional -arguments must be provided as a single argument. In other words, -without `POSIXLY_CORRECT', `m4 -QPDfoo -d a -d+f' is equivalent to `m4 --Q -P -D foo -d -d+f -- a', although the latter form is considered -canonical. (With `POSIXLY_CORRECT', it is equivalent to `m4 -Q -P -D -foo -d -- a ./-d+f'). +arguments must be provided as a single argument. In other words, `m4 +-QPDfoo -d a -d+f' is equivalent to `m4 -Q -P -D foo -d -d+f -- ./a', +although the latter form is considered canonical. With long options, options with mandatory arguments may be provided with an equal sign (`=') in a single argument, or as two arguments, and options with optional arguments must be provided as a single argument. In other words, `m4 --def foo --debug a' is equivalent to `m4 ---define=foo --debug= -- a', although the latter form is considered +--define=foo --debug= -- ./a', although the latter form is considered canonical (not to mention more robust, in case a future version of `m4' introduces an option named `--default'). `m4' understands the following options, grouped by functionality. + +* Menu: + +* Operation modes:: Command line options for operation modes +* Preprocessor features:: Command line options for preprocessor features +* Limits control:: Command line options for limits control +* Frozen state:: Command line options for frozen state +* Debugging options:: Command line options for debugging +* Command line files:: Specifying input files on the command line + + +File: m4.info, Node: Operation modes, Next: Preprocessor features, Up: Invoking m4 + +2.1 Command line options for operation modes +============================================ + Several options control the overall operation of `m4': `--help' Print a help summary on standard output, then immediately exit - `m4' without reading any input files. + `m4' without reading any input files or performing any other + actions. `--version' Print the version number of the program on standard output, then - immediately exit `m4' without reading any input files. + immediately exit `m4' without reading any input files or + performing any other actions. `-E' `--fatal-warnings' @@ -394,13 +521,19 @@ Several options control the overall oper `-W REGEXP' `--word-regexp=REGEXP' Use REGEXP as an alternative syntax for macro names. This - experimental option will not be present on all GNU `m4' + experimental option will not be present in all GNU `m4' implementations (*note Changeword::). - Several options allow `m4' to behave more like a preprocessor. -Macro definitions and deletions can be made on the command line, the -search path can be altered, and the output file can track where the -input came from. These features occur with the following options: + +File: m4.info, Node: Preprocessor features, Next: Limits control, Prev: Operation modes, Up: Invoking m4 + +2.2 Command line options for preprocessor features +================================================== + +Several options allow `m4' to behave more like a preprocessor. Macro +definitions and deletions can be made on the command line, the search +path can be altered, and the output file can track where the input came +from. These features occur with the following options: `-D NAME[=VALUE]' `--define=NAME[=VALUE]' @@ -408,8 +541,9 @@ input came from. These features occur w read. If `=VALUE' is missing, the value is taken to be the empty string. The VALUE can be any string, and the macro can be defined to take arguments, just as if it was defined from within the - input. This option may be given more than once; order is - significant, and redefining the same NAME loses the previous value. + input. This option may be given more than once; order with + respect to file names is significant, and redefining the same NAME + loses the previous value. `-I DIRECTORY' `--include=DIRECTORY' @@ -420,14 +554,15 @@ input came from. These features occur w `-s' `--synclines' Generate synchronization lines, for use by the C preprocessor or - other similar tools. This is useful, for example, when `m4' is - used as a front end to a compiler. Source file name and line - number information is conveyed by directives of the form `#line - LINENUM "FILE"', which are inserted as needed into the middle of - the output. Such directives mean that the following line - originated or was expanded from the contents of input file FILE at - line LINENUM. The `"FILE"' part is often omitted when the file - name did not change from the previous directive. + other similar tools. Order is significant with respect to file + names. This option is useful, for example, when `m4' is used as a + front end to a compiler. Source file name and line number + information is conveyed by directives of the form `#line LINENUM + "FILE"', which are inserted as needed into the middle of the + output. Such directives mean that the following line originated + or was expanded from the contents of input file FILE at line + LINENUM. The `"FILE"' part is often omitted when the file name + did not change from the previous directive. Synchronization directives are always given on complete lines by themselves. When a synchronization discrepancy occurs in the @@ -439,12 +574,19 @@ input came from. These features occur w This deletes any predefined meaning NAME might have. Obviously, only predefined macros can be deleted in this way. This option may be given more than once; undefining a NAME that does not have a - definition is silently ignored. + definition is silently ignored. Order is significant with respect + to file names. + + +File: m4.info, Node: Limits control, Next: Frozen state, Prev: Preprocessor features, Up: Invoking m4 + +2.3 Command line options for limits control +=========================================== - There are some limits within `m4' that can be tuned. For +There are some limits within `m4' that can be tuned. For compatibility, `m4' also accepts some options that control limits in other implementations, but which are automatically unbounded (limited -only by your hardware constraints) in GNU `m4'. +only by your hardware and operating system constraints) in GNU `m4'. `-G' `--traditional' @@ -464,7 +606,9 @@ only by your hardware constraints) in GN `--nesting-limit=NUM' Artificially limit the nesting of macro calls to NUM levels, stopping program execution if this limit is ever exceeded. When - not specified, nesting is limited to 1024 levels. + not specified, nesting is limited to 1024 levels. A value of zero + means unlimited; but then heavily nested code could potentially + cause a stack overflow. The precise effect of this option might be more correctly associated with textual nesting than dynamic recursion. It has @@ -500,9 +644,15 @@ only by your hardware constraints) in GN because there is no fixed limit anymore. They may disappear in future releases, and issue a warning to that effect. - GNU `m4' comes with a feature of freezing internal state (*note -Frozen files::). This can be used to speed up `m4' execution when -reusing a common initialization script. + +File: m4.info, Node: Frozen state, Next: Debugging options, Prev: Limits control, Up: Invoking m4 + +2.4 Command line options for frozen state +========================================= + +GNU `m4' comes with a feature of freezing internal state (*note Frozen +files::). This can be used to speed up `m4' execution when reusing a +common initialization script. `-F FILE' `--freeze-state=FILE' @@ -517,8 +667,13 @@ reusing a common initialization script. effect after state is reloaded, but before the input files are read. - Finally, there are several options for aiding in debugging `m4' -scripts. + +File: m4.info, Node: Debugging options, Next: Command line files, Prev: Frozen state, Up: Invoking m4 + +2.5 Command line options for debugging +====================================== + +Finally, there are several options for aiding in debugging `m4' scripts. `-d[FLAGS]' `--debug[=FLAGS]' @@ -551,13 +706,19 @@ scripts. `--trace=NAME' This enables tracing for the macro NAME, at any point where it is defined. NAME need not be defined when this option is given. - This option may be given more than once. *Note Trace::, for more - details. + This option may be given more than once, and order is significant + with respect to file names. *Note Trace::, for more details. + + +File: m4.info, Node: Command line files, Prev: Debugging options, Up: Invoking m4 - The remaining arguments on the command line are taken to be input -file names. If no names are present, the standard input is read. A -file name of `-' is taken to mean the standard input. It is -conventional, but not required, for input files to end in `.m4'. +2.6 Specifying input files on the command line +============================================== + +The remaining arguments on the command line are taken to be input file +names. If no names are present, standard input is read. A file name +of `-' is taken to mean standard input. It is conventional, but not +required, for input files to end in `.m4'. The input files are read in the sequence given. Standard input can be read more than once, so the file name `-' may appear multiple times @@ -566,6 +727,10 @@ terminal or other special file type. It ends in the middle of argument collection, a comment, or a quoted string. + The options `--define' (`-D'), `--undefine' (`-U'), `--synclines' +(`-s'), and `--trace' (`-t') only take effect after processing input +from any file names that occur earlier on the command line. + If none of the input files invoked `m4exit' (*note M4exit::), the exit status of `m4' will be 0 for success, 1 for general failure (such as problems with reading an input file), and 63 for version mismatch @@ -575,99 +740,9 @@ as problems with reading an input file), specify it as `./-file', or use `--' to mark the end of options.  -File: m4.info, Node: Bugs, Next: Manual, Prev: Invoking m4, Up: Preliminaries - -1.4 Problems and bugs -===================== - -If you have problems with GNU M4 or think you've found a bug, please -report it. Before reporting a bug, make sure you've actually found a -real bug. Carefully reread the documentation and see if it really says -you can do what you're trying to do. If it's not clear whether you -should be able to do something or not, report that too; it's a bug in -the documentation! - - Before reporting a bug or trying to fix it yourself, try to isolate -it to the smallest possible input file that reproduces the problem. -Then send us the input file and the exact results `m4' gave you. Also -say what you expected to occur; this will help us decide whether the -problem was really in the documentation. - - Once you've got a precise problem, send e-mail to (Internet) -. Please include the version number of `m4' you are -using. You can get this information with the command `m4 --version'. -Also provide details about the platform you are executing on. +File: m4.info, Node: Syntax, Next: Macros, Prev: Invoking m4, Up: Top - Non-bug suggestions are always welcome as well. If you have -questions about things that are unclear in the documentation or are -just obscure features, please report them too. - - -File: m4.info, Node: Manual, Prev: Bugs, Up: Preliminaries - -1.5 Using this manual -===================== - -This manual contains a number of examples of `m4' input and output, and -a simple notation is used to distinguish input, output and error -messages from `m4'. Examples are set out from the normal text, and -shown in a fixed width font, like this - - This is an example of an example! - - To distinguish input from output, all output from `m4' is prefixed -by the string `=>', and all error messages by the string `error-->'. -Thus - - Example of input line - =>Output line from m4 - error-->and an error message - - The sequence `^D' in an example indicates the end of the input file. -The majority of these examples are self-contained, and you can run them -with similar results by invoking `m4 -d'. In fact, the testsuite that -is bundled in the GNU M4 package consists of the examples in this -document! - - As each of the predefined macros in `m4' is described, a prototype -call of the macro will be shown, giving descriptive names to the -arguments, e.g., - - -- Composite: example (STRING, [COUNT = `1'], [ARGUMENT]...) - This is a sample prototype. There is not really a macro named - `example', but this documents that if there were, it would be a - Composite macro, rather than a Builtin. It requires at least one - argument, STRING. Remember that in `m4', there must not be a - space between the macro name and the opening parenthesis, unless - it was intended to call the macro without any arguments. The - brackets around COUNT and ARGUMENT show that these arguments are - optional. If COUNT is omitted, the macro behaves as if count were - `1', whereas if ARGUMENT is omitted, the macro behaves as if it - were the empty string. A blank argument is not the same as an - omitted argument. For example, `example(`a')', `example(`a',`1')', - and `example(`a',`1',)' would behave identically with COUNT set to - `1'; while `example(`a',)' and `example(`a',`')' would explicitly - pass the empty string for COUNT. The ellipses (`...') show that - the macro processes additional arguments after ARGUMENT, rather - than ignoring them. - - All macro arguments in `m4' are strings, but some are given special -interpretation, e.g., as numbers, file names, regular expressions, etc. -The documentation for each macro will state how the parameters are -interpreted, and what happens if the argument cannot be parsed -according to the desired interpretation. Unless specified otherwise, a -parameter specified to be a number is parsed as a decimal, even if the -argument has leading zeros; and parsing the empty string as a number -results in 0 rather than an error, although a warning will be issued. - - This document consistently writes and uses "builtin", without a -hyphen, as if it were an English word. This is how the `builtin' -primitive is spelled within `m4'. - - -File: m4.info, Node: Syntax, Next: Macros, Prev: Preliminaries, Up: Top - -2 Lexical and syntactic conventions +3 Lexical and syntactic conventions *********************************** As `m4' reads its input, it separates it into "tokens". A token is @@ -691,7 +766,7 @@ eight-bit clean, so you can use non-ASCI  File: m4.info, Node: Names, Next: Quoted strings, Up: Syntax -2.1 Macro names +3.1 Macro names =============== A name is any sequence of letters, digits, and the character `_' @@ -705,7 +780,7 @@ Names are case-sensitive.  File: m4.info, Node: Quoted strings, Next: Comments, Prev: Names, Up: Syntax -2.2 Quoting input to `m4' +3.2 Quoting input to `m4' ========================= A quoted string is a sequence of characters surrounded by quote @@ -727,7 +802,7 @@ macro `changequote'. *Note Changequote:  File: m4.info, Node: Comments, Next: Other tokens, Prev: Quoted strings, Up: Syntax -2.3 Comments in `m4' input +3.3 Comments in `m4' input ========================== Comments in `m4' are normally delimited by the characters `#' and @@ -751,7 +826,7 @@ information.  File: m4.info, Node: Other tokens, Next: Input processing, Prev: Comments, Up: Syntax -2.4 Other kinds of input tokens +3.4 Other kinds of input tokens =============================== Any character, that is neither a part of a name, nor of a quoted string, @@ -764,7 +839,7 @@ comma (`,'), and dollar (`$') have addit  File: m4.info, Node: Input processing, Prev: Other tokens, Up: Syntax -2.5 How `m4' copies input to output +3.5 How `m4' copies input to output =================================== As `m4' reads the input token by token, it will copy each token @@ -801,7 +876,7 @@ round of scanning for the tokens `Result =>Result is 32768 The order in which `m4' expands the macros can be explored using the -*Note Trace:: facilities of GNU `m4'. +trace facilities of GNU `m4' (*note Trace::). This process continues until there are no more macro calls to expand and all the input has been consumed. @@ -809,7 +884,7 @@ and all the input has been consumed.  File: m4.info, Node: Macros, Next: Definitions, Prev: Syntax, Up: Top -3 How to invoke macros +4 How to invoke macros ********************** This chapter covers macro invocation, macro arguments and how macro @@ -826,7 +901,7 @@ expansion is treated.  File: m4.info, Node: Invocation, Next: Inhibiting Invocation, Up: Macros -3.1 Macro invocation +4.1 Macro invocation ==================== Macro invocations has one of the forms @@ -856,7 +931,7 @@ with no arguments.  File: m4.info, Node: Inhibiting Invocation, Next: Macro Arguments, Prev: Invocation, Up: Macros -3.2 Preventing macro invocation +4.2 Preventing macro invocation =============================== An innovation of the `m4' language, compared to some of its @@ -875,11 +950,11 @@ call is not triggered. This solves the is recognized only with parameters" refers to this specific provision. There is also a command line option (`--prefix-builtins', or `-P', -*note Invoking m4::) that renames all builtin macro with a prefix of -`m4_' at startup. The option has no effect whatsoever on user defined -macros. For example, with this option, one has to write `m4_dnl' and -even `m4_m4exit'. It also has no effect on whether a macro requires -parameters. +*note Invoking m4: Operation modes.) that renames all builtin macros +with a prefix of `m4_' at startup. The option has no effect whatsoever +on user defined macros. For example, with this option, one has to +write `m4_dnl' and even `m4_m4exit'. It also has no effect on whether +a macro requires parameters. Another alternative is to redefine problematic macros to a name less likely to cause conflicts, *Note Definitions::. @@ -957,7 +1032,7 @@ removed, the `divert' builtin was called  File: m4.info, Node: Macro Arguments, Next: Quoting Arguments, Prev: Inhibiting Invocation, Up: Macros -3.3 Macro arguments +4.3 Macro arguments =================== When a name is seen, and it has a macro definition, it will be expanded @@ -969,13 +1044,34 @@ 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. +leading whitespace is stripped off all arguments, but whitespace +generated by a macro expansion or occuring after a macro that expanded +to an empty string remains intact. Whitespace includes space, tab, +newline, carriage return, vertical tab, and formfeed. + + define(`macro', `$1') + => + macro( unquoted leading space lost) + =>unquoted leading space lost + macro(` quoted leading space kept') + => quoted leading space kept + macro( + divert `unquoted space kept after expansion') + => unquoted space kept after expansion + macro(macro(` + ')`whitespace from expansion kept') + => + =>whitespace from expansion kept + macro(`unquoted trailing whitespace kept' + ) + =>unquoted trailing whitespace kept + => Normally `m4' will issue warnings if a builtin macro is called with an inappropriate number of arguments, but it can be suppressed with the `--quiet' command line option (or `--silent', or `-Q', *note Invoking -m4::). For user defined macros, there is no check of the number of -arguments given. +m4: Operation modes.). 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 @@ -986,7 +1082,7 @@ expands to `, b, c', the macro call is a macro call with four arguments, which are `a ', `b', `c' and `d'. To understand why the first argument contains whitespace, remember that -leading unquoted whitespace is never part of an argument, but trailing +unquoted leading whitespace is never part of an argument, but trailing whitespace always is. It is possible for a macro's definition to change during argument @@ -1002,17 +1098,19 @@ effect at the time the opening `(' was s It is an error if the end of file occurs while collecting arguments. + hello world + =>hello world define( ^D - error-->m4:stdin:1: ERROR: end of file in argument list + error-->m4:stdin:2: ERROR: end of file in argument list  File: m4.info, Node: Quoting Arguments, Next: Macro expansion, Prev: Macro Arguments, Up: Macros -3.4 On Quoting Arguments to macros +4.4 On Quoting Arguments to macros ================================== -Each argument has leading unquoted whitespace removed. Within each +Each argument has unquoted leading whitespace removed. Within each argument, all unquoted parentheses must match. For example, if FOO is a macro, @@ -1020,7 +1118,7 @@ a macro, is a macro call, with one argument, whose value is `() (() ('. Commas separate arguments, except when they occur inside quotes, comments, or -unquoted parentheses, *Note Pseudo Arguments::, for examples. +unquoted parentheses. *Note Pseudo Arguments::, for examples. It is common practice to quote all arguments to macros, unless you are sure you want the arguments expanded. Thus, in the above example @@ -1040,7 +1138,7 @@ syntax via `changeword' (*note Changewor  File: m4.info, Node: Macro expansion, Prev: Quoting Arguments, Up: Macros -3.5 Macro expansion +4.5 Macro expansion =================== When the arguments, if any, to a macro call have been collected, the @@ -1060,7 +1158,7 @@ will expand first to `bar', and when thi  File: m4.info, Node: Definitions, Next: Conditionals, Prev: Macros, Up: Top -4 How to define new macros +5 How to define new macros ************************** Macros can be defined, redefined and deleted in several different ways. @@ -1082,7 +1180,7 @@ value, and bring back the original value  File: m4.info, Node: Define, Next: Arguments, Up: Definitions -4.1 Defining a macro +5.1 Defining a macro ==================== The normal way to define or redefine macros is to use the builtin @@ -1129,7 +1227,7 @@ other implementations of `m4' replace al be a simple word. It can be any text string, even the empty string. A macro with a non-standard name cannot be invoked in the normal way, as the name is not recognized. It can only be referenced by the builtins -*Note Indir:: and *Note Defn::. +`Indir' (*note Indir::) and `Defn' (*note Defn::). Arrays and associative arrays can be simulated by using this trick. @@ -1151,7 +1249,7 @@ the name is not recognized. It can only  File: m4.info, Node: Arguments, Next: Pseudo Arguments, Prev: Define, Up: Definitions -4.2 Arguments to macros +5.2 Arguments to macros ======================= Macros can have arguments. The Nth argument is denoted by `$n' in the @@ -1178,7 +1276,7 @@ to be reversed. *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::) +not have to double quote; or *note Answers: Improved exch.). GNU `m4' allows the number following the `$' to consist of one or more digits, allowing macros to have any number of arguments. This is @@ -1206,7 +1304,7 @@ string, and not a name.  File: m4.info, Node: Pseudo Arguments, Next: Undefine, Prev: Arguments, Up: Definitions -4.3 Special arguments to macros +5.3 Special arguments to macros =============================== There is a special notation for the number of actual arguments supplied, @@ -1325,7 +1423,7 @@ an argument.  File: m4.info, Node: Undefine, Next: Defn, Prev: Pseudo Arguments, Up: Definitions -4.4 Deleting a macro +5.4 Deleting a macro ==================== A macro definition can be removed with `undefine': @@ -1368,7 +1466,7 @@ case, `undefine' does nothing.  File: m4.info, Node: Defn, Next: Pushdef, Prev: Undefine, Up: Definitions -4.5 Renaming macros +5.5 Renaming macros =================== It is possible to rename an already defined macro. To do this, you need @@ -1419,7 +1517,8 @@ to avoid unwanted expansion of the text: ') => string - =>The macro defn(`string') + =>The macro + defn(`string') =>The macro dnl is very useful => @@ -1458,7 +1557,7 @@ time, such tokens are silently converted  File: m4.info, Node: Pushdef, Next: Indir, Prev: Defn, Up: Definitions -4.6 Temporarily redefining macros +5.6 Temporarily redefining macros ================================= It is possible to redefine a macro temporarily, reverting to the @@ -1541,14 +1640,14 @@ definition.  File: m4.info, Node: Indir, Next: Builtin, Prev: Pushdef, Up: Definitions -4.7 Indirect call of macros +5.7 Indirect call of macros =========================== Any macro can be called indirectly with `indir': - -- Builtin: indir (NAME, ...) + -- Builtin: indir (NAME, [ARGS...]) Results in a call to the macro NAME, which is passed the rest of - the arguments. If NAME is not defined, an error message is + the arguments ARGS. If NAME is not defined, an error message is printed, and the expansion is void. The macro `indir' is recognized only with parameters. @@ -1583,18 +1682,36 @@ that was in effect before argument colle error-->m4:stdin:4: undefined macro `f' => + When handed the result of `defn' (*note Defn::) as one of its +arguments, `indir' defers to the invoked NAME for whether a token +representing a builtin is recognized or flattened to the empty string. + + indir(defn(`defn'), `divnum') + error-->m4:stdin:1: Warning: indir: invalid macro name ignored + => + indir(`define', defn(`defn'), `divnum') + error-->m4:stdin:2: Warning: define: invalid macro name ignored + => + indir(`define', `foo', defn(`divnum')) + => + foo + =>0 + indir(`divert', defn(`foo')) + error-->m4:stdin:5: empty string treated as 0 in builtin `divert' + => +  File: m4.info, Node: Builtin, Prev: Indir, Up: Definitions -4.8 Indirect call of builtins +5.8 Indirect call of builtins ============================= Builtin macros can be called indirectly with `builtin': - -- Builtin: builtin (NAME, ...) + -- Builtin: builtin (NAME, [ARGS...]) Results in a call to the builtin NAME, which is passed the rest of - the arguments. If NAME does not name a builtin, an error message - is printed, and the expansion is void. + the arguments ARGS. If NAME does not name a builtin, an error + message is printed, and the expansion is void. The macro `builtin' is recognized only with parameters. @@ -1610,6 +1727,10 @@ the builtin. =>hidden foo =>foo + builtin(`define', `foo', defn(`divnum')) + => + foo + =>0 builtin(`define', `foo', `BAR') => foo @@ -1624,9 +1745,9 @@ the builtin. =>foo The NAME argument only matches the original name of the builtin, -even when the `--prefix-builtins' option (or `-P', *note Invoking m4::) -is in effect. This is different from `indir', which only tracks -current macro names. +even when the `--prefix-builtins' option (or `-P', *note Invoking m4: +Operation modes.) is in effect. This is different from `indir', which +only tracks current macro names. Note that `indir' and `builtin' can be used to invoke builtins without arguments, even when they normally require parameters to be @@ -1648,7 +1769,7 @@ expansion.  File: m4.info, Node: Conditionals, Next: Debugging, Prev: Definitions, Up: Top -5 Conditionals, loops, and recursion +6 Conditionals, loops, and recursion ************************************ Macros, expanding to plain text, perhaps with arguments, are not quite @@ -1662,12 +1783,14 @@ true. * Ifdef:: Testing if a macro is defined * Ifelse:: If-else construct, or multibranch -* Loops:: Loops and recursion in m4 +* Shift:: Recursion in `m4' +* Forloop:: Iteration by counting +* Foreach:: Iteration by list contents  File: m4.info, Node: Ifdef, Next: Ifelse, Up: Conditionals -5.1 Testing if a macro is defined +6.1 Testing if a macro is defined ================================= There are two different builtin conditionals in `m4'. The first is @@ -1691,9 +1814,9 @@ There are two different builtin conditio =>no  -File: m4.info, Node: Ifelse, Next: Loops, Prev: Ifdef, Up: Conditionals +File: m4.info, Node: Ifelse, Next: Shift, Prev: Ifdef, Up: Conditionals -5.2 If-else construct, or multibranch +6.2 If-else construct, or multibranch ===================================== The other conditional, `ifelse', is much more powerful. It can be used @@ -1779,10 +1902,10 @@ examples. A common use of `ifelse' is i various kinds.  -File: m4.info, Node: Loops, Prev: Ifelse, Up: Conditionals +File: m4.info, Node: Shift, Next: Forloop, Prev: Ifelse, Up: Conditionals -5.3 Loops and recursion -======================= +6.3 Recursion in `m4' +===================== There is no direct support for loops in `m4', but macros can be recursive. There is no limit on the number of recursion levels, other @@ -1810,7 +1933,7 @@ used for iterating through the actual ar An example of the use of `shift' is this macro: -- Composite: reverse (...) - Takes any number of arguments, and reverse their order. + Takes any number of arguments, and reverses their order. It is implemented as: @@ -1826,9 +1949,69 @@ used for iterating through the actual ar While not a very interesting macro, it does show how simple loops can be made with `shift', `ifelse' and recursion. It also shows that -`shift' is usually used with `$@'. +`shift' is usually used with `$@'. Sometimes, a recursive algorithm +requires adding quotes to each element: + + -- Composite: quote (...) + -- Composite: dquote (...) + -- Composite: dquote_elt (...) + Takes any number of arguments, and adds quoting. With `quote', + only one level of quoting is added, effectively removing whitespace + after commas and turning multiple arguments into a single string. + With `dquote', two levels of quoting are added, one around each + element, and one around the list. And with `dquote_elt', two + levels of quoting are added around each element. + + An actual implementation of these three macros is distributed as +`m4-1.4.8/examples/quote.m4' in this package. First, let's examine +their usage: + + include(`quote.m4') + => + -quote-dquote-dquote_elt- + =>---- + -quote()-dquote()-dquote_elt()- + =>--`'-`'- + -quote(`1')-dquote(`1')-dquote_elt(`1')- + =>-1-`1'-`1'- + -quote(`1', `2')-dquote(`1', `2')-dquote_elt(`1', `2')- + =>-1,2-`1',`2'-`1',`2'- + define(`n', `$#')dnl + -n(quote(`1', `2'))-n(dquote(`1', `2'))-n(dquote_elt(`1', `2'))- + =>-1-1-2- + dquote(dquote_elt(`1', `2')) + =>``1'',``2'' + dquote_elt(dquote(`1', `2')) + =>``1',`2'' + + The last two lines show that when given two arguments, `dquote' +results in one string, while `dquote_elt' results in two. Now, examine +the implementation. Note that `quote' and `dquote_elt' make decisions +based on their number of arguments, so that when called without +arguments, they result in nothing instead of a quoted empty string; +this is so that it is possible to distinquish between no arguments and +an empty first argument. `dquote', on the other hand, results in a +string no matter what, since it is still possible to tell whether it +was invoked without arguments based on the resulting string. + + undivert(`quote.m4')dnl + =>divert(`-1') + =># quote(args) - convert args to single-quoted string + =>define(`quote', `ifelse(`$#', `0', `', ``$*'')') + =># dquote(args) - convert args to quoted list of quoted strings + =>define(`dquote', ``$@'') + =># dquote_elt(args) - convert args to list of double-quoted strings + =>define(`dquote_elt', `ifelse(`$#', `0', `', `$#', `1', ```$1''', + => ```$1'',$0(shift($@))')') + =>divert`'dnl + + +File: m4.info, Node: Forloop, Next: Foreach, Prev: Shift, Up: Conditionals + +6.4 Iteration by counting +========================= - Here is an example of a loop macro that implements a simple for loop. +Here is an example of a loop macro that implements a simple for loop. -- Composite: forloop (ITERATOR, START, END, TEXT) Takes the name in ITERATOR, which must be a valid macro name, and @@ -1842,7 +2025,7 @@ can be made with `shift', `ifelse' and r include(`forloop.m4') => forloop(`i', `1', `8', `i ') - =>1 2 3 4 5 6 7 8 + =>1 2 3 4 5 6 7 8 For-loops can be nested, like: @@ -1863,38 +2046,168 @@ previous definition of the first argumen argument. The macro `_forloop' expands the fourth argument once, and tests to -see if it is finished. If it has not finished, it increments the -iteration variable (using the predefined macro `incr', *note Incr::), -and recurses. +see if the iterator has reached the final value. If it has not +finished, it increments the iterator (using the predefined macro +`incr', *note Incr::), and recurses. - Here is the actual implementation of `forloop', distributed as -`examples/forloop.m4' in this package: + Here is an actual implementation of `forloop', distributed as +`m4-1.4.8/examples/forloop.m4' in this package: - undivert(`forloop.m4') + undivert(`forloop.m4')dnl =>divert(`-1') - =># forloop(var, from, to, stmt) - =>define(`forloop', - => `pushdef(`$1', `$2')_forloop(`$1', `$2', `$3', `$4')popdef(`$1')') + =># forloop(var, from, to, stmt) - simple version + =>define(`forloop', `pushdef(`$1', `$2')_forloop($@)popdef(`$1')') =>define(`_forloop', - => `$4`'ifelse($1, `$3', , - => `define(`$1', incr($1))_forloop(`$1', `$2', `$3', `$4')')') + => `$4`'ifelse($1, `$3', `', `define(`$1', incr($1))$0($@)')') =>divert`'dnl - => - Notice the careful use of quotes. Only three macro arguments are -unquoted, each for its own reason. Try to find out _why_ these three + Notice the careful use of quotes. Certain macro arguments are left +unquoted, each for its own reason. Try to find out _why_ these arguments are left unquoted, and see what happens if they are quoted. +(As presented, these two macros are useful but not very robust for +general use. They lack even basic error handling for cases like START +less than END, END not numeric, or ITERATOR not being a macro name. +See if you can improve these macros; or *note Answers: Improved +forloop.). + + +File: m4.info, Node: Foreach, Prev: Forloop, Up: Conditionals - Now, even though these two macros are useful, they are still not -robust enough for general use. They lack even basic error handling of -cases like start value less than final value, and the first argument -not being a name. Correcting these errors are left as an exercise to -the reader. +6.5 Iteration by list contents +============================== + +Here is an example of a loop macro that implements list iteration. + + -- Composite: foreach (ITERATOR, PAREN-LIST, TEXT) + -- Composite: foreachq (ITERATOR, QUOTE-LIST, TEXT) + Takes the name in ITERATOR, which must be a valid macro name, and + successively assign it each value from PAREN-LIST or QUOTE-LIST. + In `foreach', PAREN-LIST is a comma-separated list of elements + contained in parentheses. In `foreachq', QUOTE-LIST is a + comma-separated list of elements contained in a quoted string. + For each assignment to ITERATOR, append TEXT to the overall + expansion. TEXT may refer to ITERATOR. Any definition of + ITERATOR prior to this invocation is restored. + + As an example, this displays each word in a list inside of a +sentence, using an implementation of `foreach' distributed as +`m4-1.4.8/examples/foreach.m4', and `foreachq' in +`m4-1.4.8/examples/foreachq.m4'. + + include(`foreach.m4') + => + foreach(`x', (foo, bar, foobar), `Word was: x + ')dnl + =>Word was: foo + =>Word was: bar + =>Word was: foobar + include(`foreachq.m4') + => + foreachq(`x', `foo, bar, foobar', `Word was: x + ')dnl + =>Word was: foo + =>Word was: bar + =>Word was: foobar + + It is possible to be more complex; each element of the PAREN-LIST or +QUOTE-LIST can itself be a list, to pass as further arguments to a +helper macro. This example generates a shell case statement: + + include(`foreach.m4') + => + define(`_case', ` $1) + $2=" $1";; + ')dnl + define(`_cat', `$1$2')dnl + case $`'1 in + =>case $1 in + foreach(`x', `(`(`a', `vara')', `(`b', `varb')', `(`c', `varc')')', + `_cat(`_case', x)')dnl + => a) + => vara=" a";; + => b) + => varb=" b";; + => c) + => varc=" c";; + esac + =>esac + + The implementation of the `foreach' macro is a bit more involved; it +is a wrapper around two helper macros. First, `_arg1' is needed to +grab the first element of a list. Second, `_foreach' implements the +recursion, successively walking through the original list. Here is a +simple implementation of `foreach': + + undivert(`foreach.m4')dnl + =>divert(`-1') + =># foreach(x, (item_1, item_2, ..., item_n), stmt) + =># parenthesized list, simple version + =>define(`foreach', `pushdef(`$1')_foreach($@)popdef(`$1')') + =>define(`_arg1', `$1') + =>define(`_foreach', `ifelse(`$2', `()', `', + => `define(`$1', _arg1$2)$3`'$0(`$1', (shift$2), `$3')')') + =>divert`'dnl + + Unfortunately, that implementation is not robust to macro names as +list elements. Each iteration of `_foreach' is stripping another layer +of quotes, leading to erratic results if list elements are not already +fully expanded. The first cut at implementing `foreachq' takes this +into account. Also, when using quoted elements in a PAREN-LIST, the +overall list must be quoted. A QUOTE-LIST has the nice property of +requiring fewer characters to create a list containing the same quoted +elements. To see the difference between the two macros, we attempt to +pass double-quoted macro names in a list, expecting the macro name on +output after one layer of quotes is removed during list iteration and +the final layer removed during the final rescan: + + define(`a', `1')define(`b', `2')define(`c', `3') + => + include(`foreach.m4') + => + include(`foreachq.m4') + => + foreach(`x', `(``a'', ``(b'', ``c)'')', `x + ') + =>1 + =>(2)1 + => + =>, x + =>) + foreachq(`x', ```a'', ``(b'', ``c)''', `x + ')dnl + =>a + =>(b + =>c) + + Obviously, `foreachq' did a better job; here is its implementation: + + undivert(`foreachq.m4')dnl + =>include(`quote.m4')dnl + =>divert(`-1') + =># foreachq(x, `item_1, item_2, ..., item_n', stmt) + =># quoted list, simple version + =>define(`foreachq', `pushdef(`$1')_foreachq($@)popdef(`$1')') + =>define(`_arg1', `$1') + =>define(`_foreachq', `ifelse(quote($2), `', `', + => `define(`$1', `_arg1($2)')$3`'$0(`$1', `shift($2)', `$3')')') + =>divert`'dnl + + Notice that `_foreachq' had to use the helper macro `quote' defined +earlier (*note Shift::), to ensure that the embedded `ifelse' call does +not go haywire if a list element contains a comma. Unfortunately, this +implementation of `foreachq' has its own severe flaw. Whereas the +`foreach' implementation was linear, this macro is quadratic in the +number of list elements, and is much more likely to trip up the limit +set by the command line option `--nesting-limit' (or `-L', *note +Invoking m4: Limits control.). (It is possible to have robust +iteration with linear behavior for either list style. See if you can +learn from the best elements of both of these implementations to create +robust macros; or *note Answers: Improved foreach.).  File: m4.info, Node: Debugging, Next: Input Control, Prev: Conditionals, Up: Top -6 How to debug macros and input +7 How to debug macros and input ******************************* When writing macros for `m4', they often do not work as intended on the @@ -1911,16 +2224,16 @@ Fortunately, there is support for macro  File: m4.info, Node: Dumpdef, Next: Trace, Up: Debugging -6.1 Displaying macro definitions +7.1 Displaying macro definitions ================================ If you want to see what a name expands into, you can use the builtin `dumpdef': - -- Builtin: dumpdef (...) + -- Builtin: dumpdef ([NAMES...]) Accepts any number of arguments. If called without any arguments, it displays the definitions of all known names, otherwise it - displays the definitions of the names given. The output is + displays the definitions of the NAMES given. The output is printed to the current debug file (usually standard error), and is sorted by name. If an unknown name is encountered, a warning is printed. @@ -1956,25 +2269,27 @@ the display.  File: m4.info, Node: Trace, Next: Debug Levels, Prev: Dumpdef, Up: Debugging -6.2 Tracing macro calls +7.2 Tracing macro calls ======================= It is possible to trace macro calls and expansions through the builtins `traceon' and `traceoff': - -- Builtin: traceon (...) - -- Builtin: traceoff (...) + -- Builtin: traceon ([NAMES...]) + -- Builtin: traceoff ([NAMES...]) When called without any arguments, `traceon' and `traceoff' will turn tracing on and off, respectively, for all defined macros. - When called with arguments, only the named macros are affected, - whether or not they are currently defined. + + When called with arguments, only the macros listed in NAMES are + affected, whether or not they are currently defined. The expansion of `traceon' and `traceoff' is void. Whenever a traced macro is called and the arguments have been collected, the call is displayed. If the expansion of the macro call is not void, the expansion can be displayed after the call. The output -is printed to the current debug file (usually standard error). +is printed to the current debug file (defaulting to standard error, +*note Debug Output::). define(`foo', `Hello World.') => @@ -1993,7 +2308,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' (*note Invoking m4::). +option `--nesting-limit' (*note Invoking m4: Limits control.). 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 @@ -2049,12 +2364,12 @@ the display.  File: m4.info, Node: Debug Levels, Next: Debug Output, Prev: Trace, Up: Debugging -6.3 Controlling debugging output +7.3 Controlling debugging output ================================ -The `-d' option to `m4' (*note Invoking m4::) controls the amount of -details presented, when using the macros described in the preceding -sections. +The `-d' option to `m4' (*note Invoking m4: Debugging options.) +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: @@ -2141,20 +2456,21 @@ control of the debugging output format:  File: m4.info, Node: Debug Output, Prev: Debug Levels, Up: Debugging -6.4 Saving debugging output +7.4 Saving debugging output =========================== Debug and tracing output can be redirected to files using either the -`--debugfile' option to `m4' (*note Invoking m4::), or with the builtin -macro `debugfile': +`--debugfile' option to `m4' (*note Invoking m4: Debugging options.), +or with the builtin macro `debugfile': -- Builtin: debugfile ([FILE]) - Sends all further debug and trace output to FILE. 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, error messages, or - `errprint' output, which are always sent to standard error. If - FILE cannot be opened, the current debug file is unchanged. + Sends all further debug and trace output to FILE, opened in append + mode. If FILE is the empty string, debug and trace output are + discarded. If `debugfile' is called without any arguments, debug + and trace output are sent to standard error. This does not affect + warnings, error messages, or `errprint' output, which are always + sent to standard error. If FILE cannot be opened, the current + debug file is unchanged, and an error is issued. The expansion of `debugfile' is void. @@ -2178,7 +2494,7 @@ macro `debugfile':  File: m4.info, Node: Input Control, Next: File Inclusion, Prev: Debugging, Up: Top -7 Input control +8 Input control *************** This chapter describes various builtin macros for controlling the input @@ -2195,14 +2511,15 @@ to `m4'.  File: m4.info, Node: Dnl, Next: Changequote, Up: Input Control -7.1 Deleting whitespace in input +8.1 Deleting whitespace in input ================================ The builtin `dnl' stands for "Discard to Next Line": -- Builtin: dnl All characters, up to and including the next newline, are discarded - without performing any macro expansion. + without performing any macro expansion. A warning is issued if + the end of the file is encountered without a newline. The expansion of `dnl' is void. @@ -2227,26 +2544,26 @@ 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-->m4:stdin:2: Warning: excess arguments to builtin `dnl' ignored + error-->m4:stdin:1: Warning: excess arguments to builtin `dnl' ignored See how `foo' was defined, foo? =>See how foo was defined, like this? If the end of file is encountered without a newline character, a warning is issued and dnl stops consuming input. - define(`hi', `HI') - => m4wrap(`m4wrap(`2 hi ')0 hi dnl 1 hi') => + define(`hi', `HI') + => ^D - error-->m4: Warning: end of file treated as newline + error-->m4:stdin:1: Warning: end of file treated as newline =>0 HI 2 HI  File: m4.info, Node: Changequote, Next: Changecom, Prev: Dnl, Up: Input Control -7.2 Changing the quote characters +8.2 Changing the quote characters ================================= The default quote delimiters can be changed with the builtin @@ -2254,9 +2571,11 @@ The default quote delimiters can be chan -- Builtin: changequote ([START = ``'], [END = `'']) 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. + new end-quote delimiter. If both arguments are missing, the + default quotes (``' and `'') are used. If START is void, then + quoting is disabled. Otherwise, if END is missing or void, the + default end-quote delimiter (`'') is used. The quote delimiters + can be of any length. The expansion of `changequote' is void. @@ -2269,6 +2588,8 @@ The default quote delimiters can be chan The quotation strings can safely contain eight-bit characters. If no single character is appropriate, START and END can be of any length. +Other implementations cap the delimiter length to five characters, but +GNU has no inherent limit. changequote(`[[[', `]]]') => @@ -2277,17 +2598,31 @@ no single character is appropriate, STAR foo =>Macro [[foo]]. - Changing the quotes to the empty strings will effectively disable the -quoting mechanism, leaving no way to quote text. + Calling `changequote' with START as the empty string will +effectively disable the quoting mechanism, leaving no way to quote text. +However, using an empty string is not portable, as some other +implementations of `m4' revert to the default quoting, while others +preserve the prior non-empty delimiter. If START is not empty, then an +empty END will use the default end-quote delimiter of `'', as +otherwise, it would be impossible to end a quoted string. Again, this +is not portable, as some other `m4' implementations reuse START as the +end-quote delimiter, while others preserve the previous non-empty +value. Omitting both arguments restores the default begin-quote and +end-quote delimiters; fortunately this behavior is portable to all +implementations of `m4'. define(`foo', `Macro `FOO'.') => - changequote(, ) + changequote(`', `') => foo =>Macro `FOO'. `foo' =>`Macro `FOO'.' + changequote(`,) + => + foo + =>Macro FOO. There is no way in `m4' to quote a string containing an unmatched begin-quote, except using `changequote' to change the current quotes. @@ -2298,23 +2633,37 @@ quote characters have to be defined. To the new quotes. 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). +a prefix of START can be recognized as part of a potential macro name, +the quoting mechanism is effectively disabled. Unless you use +`changeword' (*note Changeword::), this means that START should not +begin with a letter, digit, or `_' (underscore). However, even though +quoted strings are not recognized, the quote characters can still be +discerned in macro expansion and in trace output. + define(`echo', `$@') + => define(`hi', `HI') => changequote(`q', `Q') => q hi Q hi =>q HI Q HI + echo(hi) + =>qHIQ changequote => changequote(`-', `EOF') => - hi EOF hi => hi HI + changequote + => + changequote(`1', `2') + => + hi1hi2 + =>hi1hi2 + hi 1hi2 + =>HI hi Quotes are recognized in preference to argument collection. In particular, if START is a single `(', then argument collection is @@ -2373,25 +2722,27 @@ very often. It is an error if the end of file occurs within a quoted string. + `hello world' + =>hello world `dangling quote ^D - error-->m4:stdin:1: ERROR: end of file in string + error-->m4:stdin:2: ERROR: end of file in string  File: m4.info, Node: Changecom, Next: Changeword, Prev: Changequote, Up: Input Control -7.3 Changing the comment delimiters +8.3 Changing the comment delimiters =================================== The default comment delimiters can be changed with the builtin macro `changecom': - -- Builtin: changecom ([START], [END]) + -- Builtin: changecom ([START], [END = `']) 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 - using the empty string as the first argument, disables comments. + new end-comment delimiter. If both arguments are missing, or + START is void, then comments are disabled. Otherwise, if END is + missing or void, the default end-comment delimiter of newline is + used. The comment delimiters can be of any length. The expansion of `changecom' is void. @@ -2410,10 +2761,13 @@ The default comment delimiters can be ch quoted strings. If you want the text inside a comment expanded, quote the begin-comment delimiter. - Calling `changecom' without any arguments, or with an empty string -for the first argument, disables the commenting mechanism completely. -To restore the original comment start of `#', you must explicitly ask -for it. + Calling `changecom' without any arguments, or with START as the +empty string, will effectively disable the commenting mechanism. To +restore the original comment start of `#', you must explicitly ask for +it. If START is not empty, then an empty END will use the default +end-comment delimiter of newline, as otherwise, it would be impossible +to end a comment. However, this is not portable, as some other `m4' +implementations preserve the previous non-empty delimiters instead. define(`comment', `COMMENT') => @@ -2421,26 +2775,37 @@ for it. => # Not a comment anymore =># Not a COMMENT anymore - changecom(`#') + changecom(`#', `') => # comment again =># comment again - The comment strings can safely contain eight-bit characters. + The comment strings can safely contain eight-bit characters. If no +single character is appropriate, START and END can be of any length. +Other implementations cap the delimiter length to five characters, but +GNU has no inherent limit. Comments are recognized in preference to macros. However, this is not compatible with other implementations, where macros and even quoting takes precedence over comments, so it may change in a future release. -For portability, this means that START should not begin with a letter -or `_' (underscore), and that neither the start-quote nor the +For portability, this means that START should not begin with a letter, +digit, or `_' (underscore), and that neither the start-quote nor the start-comment string should be a prefix of the other. define(`hi', `HI') => + define(`hi1hi2', `hello') + => changecom(`q', `Q') => q hi Q hi =>q hi Q HI + changecom(`1', `2') + => + hi1hi2 + =>hello + hi 1hi2 + =>HI 1hi2 Comments are recognized in preference to argument collection. In particular, if START is a single `(', then argument collection is @@ -2475,12 +2840,12 @@ START. => /*dangling comment ^D - error-->m4:stdin:1: ERROR: end of file in comment + error-->m4:stdin:2: ERROR: end of file in comment  File: m4.info, Node: Changeword, Next: M4wrap, Prev: Changecom, Up: Input Control -7.4 Changing the lexical structure of words +8.4 Changing the lexical structure of words =========================================== The macro `changeword' and all associated functionality is @@ -2639,7 +3004,7 @@ speed.  File: m4.info, Node: M4wrap, Prev: Changeword, Up: Input Control -7.5 Saving text until end of input +8.5 Saving text until end of input ================================== It is possible to `save' some text until the end of the normal input has @@ -2706,12 +3071,12 @@ file condition between two input files. m4wrap(`m4wrap(`)')len(abc') => ^D - error-->m4: ERROR: end of file in argument list + error-->m4:stdin:1: ERROR: end of file in argument list  File: m4.info, Node: File Inclusion, Next: Diversions, Prev: Input Control, Up: Top -8 File inclusion +9 File inclusion **************** `m4' allows you to include named files at any point in the input. @@ -2724,7 +3089,7 @@ File: m4.info, Node: File Inclusion, N  File: m4.info, Node: Include, Next: Search Path, Up: File Inclusion -8.1 Including named files +9.1 Including named files ========================= There are two builtin macros in `m4' for including files: @@ -2746,23 +3111,26 @@ There are two builtin macros in `m4' for parameters. include(`none') - => error-->m4:stdin:1: cannot open `none': No such file or directory - include() => + include() error-->m4:stdin:2: cannot open `': No such file or directory + => sinclude(`none') => sinclude() => The rest of this section assumes that `m4' is invoked with the `-I' -option (*note Invoking m4::) 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: Preprocessor features.) pointing to the +`m4-1.4.8/examples' directory shipped as part of the GNU `m4' package. +The file `m4-1.4.8/examples/incl.m4' in the distribution contains the +lines: + Include file start foo Include file end + Normally file inclusion is used to insert the contents of a file into the input stream. The contents of the file will be read by `m4' and macro calls in the file will be expanded: @@ -2795,22 +3163,26 @@ with the next character, even if the inc of a comment, string, or macro call. These conditions are only treated as end of file errors if specified as input files on the command line. + In GNU `m4', an alternative method of reading files is using +`undivert' (*note Undivert::) on a named file. +  File: m4.info, Node: Search Path, Prev: Include, Up: File Inclusion -8.2 Searching for include files +9.2 Searching for include files =============================== GNU `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 `-I' option will be -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 `--prepend-include' or `-B' command-line option was provided +(*note Invoking m4: Preprocessor features.), those directories are +searched first, in reverse order that those options were listed on the +command line. Then `m4' looks in the current working directory. Next +comes the directories specified with the `--include' or `-I' option, in +the order found on the command line. Finally, if the `M4PATH' +environment variable is set, it is expected to contain a +colon-separated list of directories, which will be searched in order. If the automatic search for include-files causes trouble, the `p' debug flag (*note Debug Levels::) can help isolate the problem. @@ -2818,8 +3190,8 @@ debug flag (*note Debug Levels::) can he  File: m4.info, Node: Diversions, Next: Text handling, Prev: File Inclusion, Up: Top -9 Diverting and undiverting output -********************************** +10 Diverting and undiverting output +*********************************** Diversions are a way of temporarily saving output. The output of `m4' can at any time be diverted to a temporary file, and be reinserted into @@ -2832,22 +3204,32 @@ tries to keep diversions in memory. How overall memory usable by all diversions taken altogether (512K, currently). When this maximum is about to be exceeded, a temporary file is opened to receive the contents of the biggest diversion still -in memory, freeing this memory for other diversions. So, it is -theoretically possible that the number of diversions be limited by the -number of available file descriptors. +in memory, freeing this memory for other diversions. When creating the +temporary file, `m4' honors the value of the environment variable +`TMPDIR', and falls back to `/tmp'. So, it is theoretically possible +that the number and aggregate size of diversions is limited only by +available disk space. + + Diversions make it possible to generate output in a different order +than the input was read. It is possible to implement topological +sorting dependencies. For example, GNU Autoconf makes use of +diversions under the hood to ensure that the expansion of a prerequisite +macro appears in the output prior to the expansion of a dependent macro, +regardless of which order the two macros were invoked in the user's +input file. * Menu: * Divert:: Diverting output * Undivert:: Undiverting output * Divnum:: Diversion numbers -* Cleardiv:: Discarding diverted text +* Cleardivert:: Discarding diverted text  File: m4.info, Node: Divert, Next: Undivert, Up: Diversions -9.1 Diverting output -==================== +10.1 Diverting output +===================== Output is diverted using `divert': @@ -2885,10 +3267,11 @@ after any wrapped text is expanded. ^D =>Wrapped TEXT preceeds diverted text. - If output is diverted to a non-existent diversion, it is simply + If output is diverted to a negative diversion, it is simply discarded. This can be used to suppress unwanted output. A common example of unwanted output is the trailing newlines after macro -definitions. Here is how to avoid them. +definitions. Here is a common programming idiom in `m4' for avoiding +them. divert(`-1') define(`foo', `Macro `foo'.') @@ -2896,22 +3279,31 @@ definitions. Here is how to avoid them. divert => - This is a common programming idiom in `m4'. + Traditional implementations only supported ten diversions. But as a +GNU extension, diversion numbers can be as large as positive integers +will allow, rather than treating a multi-digit diversion number as a +request to discard text. + + divert(eval(`1<<28'))world + divert(`2')hello + ^D + =>hello + =>world Note that `divert' is an English word, but also an active macro without arguments. When processing plain text, the word might appear in normal text and be unintentionally swallowed as a macro invocation. One way to avoid this is to use the `-P' option to rename all builtins -(*note Invoking m4::). Another is to write a wrapper that requires a -parameter to be recognized. +(*note Invoking m4: Operation modes.). Another is to write a wrapper +that requires a parameter to be recognized. We decided to divert the stream for irrigation. =>We decided to the stream for irrigation. define(`divert', `ifelse(`$#', `0', ``$0'', `builtin(`$0', $@)')') => - divert(-1) + divert(`-1') Ignored text. - divert(0) + divert(`0') => We decided to divert the stream for irrigation. =>We decided to divert the stream for irrigation. @@ -2919,16 +3311,20 @@ parameter to be recognized.  File: m4.info, Node: Undivert, Next: Divnum, Prev: Divert, Up: Diversions -9.2 Undiverting output -====================== +10.2 Undiverting output +======================= Diverted text can be undiverted explicitly using the builtin `undivert': - -- Builtin: undivert ([NUMBER]...) - 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 NUMBER is - not numeric, treat it as a file name instead. + -- Builtin: undivert ([DIVERSIONS...]) + Undiverts the numeric DIVERSIONS given by the arguments, in the + order given. If no arguments are supplied, all diversions are + undiverted, in numerical order. + + As a GNU extension, DIVERSIONS may contain non-numeric strings, + which are treated as the names of files to copy into the output + without expansion. A warning is issued if a file could not be + opened. The expansion of `undivert' is void. @@ -2996,8 +3392,8 @@ not get rearranged among the other diver GNU `m4' allows named files to be undiverted. Given a non-numeric argument, the contents of the file named will be copied, uninterpreted, to the current output. This complements the builtin `include' (*note -Include::). To illustrate the difference, the file `examples/foo' -contains the word `bar': +Include::). To illustrate the difference, the file +`m4-1.4.8/examples/foo' contains the word `bar': define(`bar', `BAR') => @@ -3012,10 +3408,10 @@ contains the word `bar': issued, and the expansion is void.  -File: m4.info, Node: Divnum, Next: Cleardiv, Prev: Undivert, Up: Diversions +File: m4.info, Node: Divnum, Next: Cleardivert, Prev: Undivert, Up: Diversions -9.3 Diversion numbers -===================== +10.3 Diversion numbers +====================== The current diversion is tracked by the builtin `divnum': @@ -3035,10 +3431,10 @@ The current diversion is tracked by the =>Diversion two: 2  -File: m4.info, Node: Cleardiv, Prev: Divnum, Up: Diversions +File: m4.info, Node: Cleardivert, Prev: Divnum, Up: Diversions -9.4 Discarding diverted text -============================ +10.4 Discarding diverted text +============================= Often it is not known, when output is diverted, whether the diverted text is actually needed. Since all non-empty diversion are brought back @@ -3059,8 +3455,8 @@ No output is produced at all. Clearing selected diversions can be done with the following macro: - -- Composite: cleardivert ([DIVERSION]...) - Discard the contents of each listed diversion. + -- Composite: cleardivert ([DIVERSIONS...]) + Discard the contents of each of the listed numeric DIVERSIONS. define(`cleardivert', `pushdef(`_n', divnum)divert(`-1')undivert($@)divert(_n)popdef(`_n')') @@ -3068,12 +3464,13 @@ No output is produced at all. It is called just like `undivert', but the effect is to clear the diversions, given by the arguments. (This macro has a nasty bug! You -should try to see if you can find it and correct it. *note Answers::) +should try to see if you can find it and correct it; or *note Answers: +Improved cleardivert.).  File: m4.info, Node: Text handling, Next: Arithmetic, Prev: Diversions, Up: Top -10 Macros for text handling +11 Macros for text handling *************************** There are a number of builtins in `m4' for manipulating text in various @@ -3092,7 +3489,7 @@ ways, extracting substrings, searching,  File: m4.info, Node: Len, Next: Index macro, Up: Text handling -10.1 Calculating length of strings +11.1 Calculating length of strings ================================== The length of a string can be calculated by `len': @@ -3110,7 +3507,7 @@ The length of a string can be calculated  File: m4.info, Node: Index macro, Next: Regexp, Prev: Len, Up: Text handling -10.2 Searching for substrings +11.2 Searching for substrings ============================= Searching for substrings is done with `index': @@ -3136,7 +3533,7 @@ Searching for substrings is done with `i  File: m4.info, Node: Regexp, Next: Substr, Prev: Index macro, Up: Text handling -10.3 Searching for regular expressions +11.3 Searching for regular expressions ====================================== Searching for regular expressions is done with the builtin `regexp': @@ -3194,7 +3591,7 @@ Searching for regular expressions is don  File: m4.info, Node: Substr, Next: Translit, Prev: Regexp, Up: Text handling -10.4 Extracting substrings +11.4 Extracting substrings ========================== Substrings are extracted with `substr': @@ -3226,7 +3623,7 @@ Substrings are extracted with `substr':  File: m4.info, Node: Translit, Next: Patsubst, Prev: Substr, Up: Text handling -10.5 Translating characters +11.5 Translating characters =========================== Character translation is done with `translit': @@ -3235,19 +3632,26 @@ Character translation is done with `tran Expands to STRING, with each character that occurs in CHARS translated into the character from REPLACEMENT with the same index. - If REPLACEMENT is shorter than CHARS, the excess characters are - deleted from the expansion. If REPLACEMENT is omitted, all - characters in STRING that are present in CHARS are deleted from - the expansion. + If REPLACEMENT is shorter than CHARS, the excess characters of + CHARS are deleted from the expansion; if CHARS is shorter, the + excess characters in REPLACEMENT are silently ignored. If + REPLACEMENT is omitted, all characters in STRING that are present + in CHARS are deleted from the expansion. If a character appears + more than once in CHARS, only the first instance is used in making + the translation. Only a single translation pass is made, even if + characters in REPLACEMENT also appear in CHARS. As a GNU extension, both CHARS and REPLACEMENT can contain character-ranges, e.g., `a-z' (meaning all lowercase letters) or `0-9' (meaning all digits). To include a dash `-' in CHARS or - REPLACEMENT, place it first or last. - - It is not an error for the last character in the range to be - `larger' than the first. In that case, the range runs backwards, - i.e., `9-0' means the string `9876543210'. + REPLACEMENT, place it first or last in the entire string, or as + the last character of a range. Back-to-back ranges can share a + common endpoint. It is not an error for the last character in the + range to be `larger' than the first. In that case, the range runs + backwards, i.e., `9-0' means the string `9876543210'. The + expansion of a range is dependent on the underlying encoding of + characters, so using ranges is not always portable between + machines. The macro `translit' is recognized only with parameters. @@ -3257,11 +3661,20 @@ Character translation is done with `tran =>GNUS NOT UNIX translit(`GNUs not Unix', `A-Z', `z-a') =>tmfs not fnix - - The first example deletes all uppercase letters, the second converts -lowercase to uppercase, and the third `mirrors' all uppercase letters, -while converting them to lowercase. The two first cases are by far the -most common. + translit(`+,-12345', `+--1-5', `<;>a-c-a') + =><;>abcba + translit(`abcdef', `aabdef', `bcged') + =>bgced + + In the ASCII encoding, the first example deletes all uppercase +letters, the second converts lowercase to uppercase, and the third +`mirrors' all uppercase letters, while converting them to lowercase. +The two first cases are by far the most common, even though they are not +portable to EBCDIC or other encodings. The fourth example shows a +range ending in `-', as well as back-to-back ranges. The final example +shows that `a' is mapped to `b', not `c'; the resulting `b' is not +further remapped to `g'; the `d' and `e' are swapped, and the `f' is +discarded. Omitting CHARS evokes a warning, but still produces output. @@ -3272,7 +3685,7 @@ most common.  File: m4.info, Node: Patsubst, Next: Format, Prev: Translit, Up: Text handling -10.6 Substituting text by regular expression +11.6 Substituting text by regular expression ============================================ Global substitution in a string is done by `patsubst': @@ -3312,7 +3725,8 @@ Global substitution in a string is done patsubst(`GNUs not Unix', `\w+', `(\&)') =>(GNUs) (not) (Unix) patsubst(`GNUs not Unix', `[A-Z][a-z]+') - =>GN not patsubst(`GNUs not Unix', `not', `NOT\') + =>GN not + patsubst(`GNUs not Unix', `not', `NOT\') error-->m4:stdin:6: Warning: trailing \ ignored in replacement =>GNUs NOT Unix @@ -3361,7 +3775,7 @@ and preserves non-matching pieces:  File: m4.info, Node: Format, Prev: Patsubst, Up: Text handling -10.7 Formatted output +11.7 Formatted output ===================== Formatted output can be made with `format': @@ -3385,8 +3799,8 @@ Formatted output can be made with `forma len(format(`%-*X', `300', `1')) =>300 - Using the `forloop' macro defined in *Note Loops::, this example -shows how `format' can be used to produce tabular output. + Using the `forloop' macro defined earlier (*note Forloop::), this +example shows how `format' can be used to produce tabular output. include(`forloop.m4') => @@ -3419,7 +3833,7 @@ escape sequences are not yet recognized.  File: m4.info, Node: Arithmetic, Next: Shell commands, Prev: Text handling, Up: Top -11 Macros for doing arithmetic +12 Macros for doing arithmetic ****************************** Integer arithmetic is included in `m4', with a C-like syntax. As @@ -3434,7 +3848,7 @@ decrement operations.  File: m4.info, Node: Incr, Next: Eval, Up: Arithmetic -11.1 Decrement and increment operators +12.1 Decrement and increment operators ====================================== Increment and decrement of integers are supported using the builtins @@ -3462,7 +3876,7 @@ Increment and decrement of integers are  File: m4.info, Node: Eval, Prev: Incr, Up: Arithmetic -11.2 Evaluating integer expressions +12.2 Evaluating integer expressions =================================== Integer expressions are evaluated with `eval': @@ -3614,7 +4028,7 @@ width is negative. On error, the expans  File: m4.info, Node: Shell commands, Next: Miscellaneous, Prev: Arithmetic, Up: Top -12 Macros for running shell commands +13 Macros for running shell commands ************************************ There are a few builtin macros in `m4' that allow you to run shell @@ -3633,12 +4047,12 @@ value if this is not the case. * Syscmd:: Executing simple commands * Esyscmd:: Reading the output of commands * Sysval:: Exit status -* Maketemp:: Making temporary files +* Mkstemp:: Making temporary files  File: m4.info, Node: Platform macros, Next: Syscmd, Up: Shell commands -12.1 Determining the platform +13.1 Determining the platform ============================= Sometimes it is desirable for an input file to know which platform `m4' @@ -3658,8 +4072,8 @@ platform details. to the empty string. When GNU extensions are in effect (that is, when you did not use the -`-G' option, *note Invoking m4::), GNU `m4' will define the macro -`__gnu__' to expand to the empty string. +`-G' option, *note Invoking m4: Limits control.), GNU `m4' will define +the macro `__gnu__' to expand to the empty string. __gnu__ => @@ -3692,7 +4106,7 @@ please report that as a bug.  File: m4.info, Node: Syscmd, Next: Esyscmd, Prev: Platform macros, Up: Shell commands -12.2 Executing simple commands +13.2 Executing simple commands ============================== Any shell command can be executed, using `syscmd': @@ -3726,17 +4140,17 @@ tell `m4' to read all of its input befor then hand a valid (albeit emptied) pipe as standard input for the `cat' subcommand. Therefore, you should be careful when using standard input (either by specifying no files, or by passing `-' as a file name on the -command line, *note Invoking m4::), and also invoking subcommands via -`syscmd' or `esyscmd' that consume data from standard input. When -standard input is a seekable file, the subprocess will pick up with the -next character not yet processed by `m4'; when it is a pipe or other -non-seekable file, there is no guarantee how much data will already be -buffered by `m4' and thus unavailable to the child. +command line, *note Invoking m4: Command line files.), and also +invoking subcommands via `syscmd' or `esyscmd' that consume data from +standard input. When standard input is a seekable file, the subprocess +will pick up with the next character not yet processed by `m4'; when it +is a pipe or other non-seekable file, there is no guarantee how much +data will already be buffered by `m4' and thus unavailable to the child.  File: m4.info, Node: Esyscmd, Next: Sysval, Prev: Syscmd, Up: Shell commands -12.3 Reading the output of commands +13.3 Reading the output of commands =================================== If you want `m4' to read the output of a shell command, use `esyscmd': @@ -3745,7 +4159,7 @@ If you want `m4' to read the output of a Expands to the standard output of the shell command SHELL-COMMAND. Prior to executing the command, `m4' flushes its buffers. The - default standard input and error output of SHELL-COMMAND are the + default standard input and standard error of SHELL-COMMAND are the same as those of `m4'. The error output of SHELL-COMMAND is not a part of the expansion: it will appear along with the error output of `m4'. @@ -3765,9 +4179,9 @@ the command, as well as using the newlin input between `m4' and the child process of `esyscmd'.  -File: m4.info, Node: Sysval, Next: Maketemp, Prev: Esyscmd, Up: Shell commands +File: m4.info, Node: Sysval, Next: Mkstemp, Prev: Esyscmd, Up: Shell commands -12.4 Exit status +13.4 Exit status ================ To see whether a shell command succeeded, use `sysval': @@ -3827,37 +4241,88 @@ result is the signal number shifted left =>2304  -File: m4.info, Node: Maketemp, Prev: Sysval, Up: Shell commands +File: m4.info, Node: Mkstemp, Prev: Sysval, Up: Shell commands -12.5 Making temporary files +13.5 Making temporary files =========================== Commands specified to `syscmd' or `esyscmd' might need a temporary file, for output or for some other purpose. There is a builtin macro, -`maketemp', for making temporary file names: +`mkstemp', for making a temporary file: + -- Builtin: mkstemp (TEMPLATE) -- Builtin: maketemp (TEMPLATE) Expands to a name of a new, empty file, made from the string TEMPLATE, which should end with the string `XXXXXX'. The six `X' - characters are then replaced with random data, in order to make - the file name unique. + characters are then replaced with random characters matching the + regular expression `[a-zA-Z0-9._-]', in order to make the file + name unique. If fewer than six `X' characters are found at the end + of `template', the result will be longer than the template. The + created file will have access permissions as if by `chmod =rw,go=', + meaning that the current umask of the `m4' process is taken into + account, and at most only the current user can read and write the + file. + + The traditional behavior, standardized by POSIX, is that + `maketemp' merely replaces the trailing `X' with the process id, + without creating a file, and without ensuring that the resulting + string is a unique file name. In part, this means that using the + same TEMPLATE twice in the same input file will result in the same + expansion. This behavior is a security hole, as it is very easy + for another process to guess the name that will be generated, and + thus interfere with a subsequent use of `syscmd' trying to + manipulate that file name. Hence, POSIX has recommended that all + new implementations of `m4' provide the secure `mkstemp' builtin, + and that users of `m4' check for its existence. - The macro `maketemp' is recognized only with parameters. + The macros `mkstemp' and `maketemp' are recognized only with + parameters. + + If you try this next example, you will most likely get different +output for the two file names, since the replacement characters are +randomly chosen: maketemp(`/tmp/fooXXXXXX') =>/tmp/fooa07346 - - Traditional implementations of `m4' replaced the trailing `X' -sequence with the process id, without creating the file; meaning you -only get one result no matter how many times you use maketemp on the -same string. As of this release, POSIX is considering the addition of -a new macro `mkstemp' that behaves like GNU `maketemp', so a future -version of GNU M4 may have changes in this area. + ifdef(`mkstemp', `define(`maketemp', defn(`mkstemp'))', + `define(`mkstemp', defn(`maketemp'))dnl + errprint(`warning: potentially insecure maketemp implementation + ')') + => + mkstemp(`doc') + =>docQv83Uw + + Unless you use the `--traditional' command line option (or `-G', +*note Invoking m4: Limits control.), the GNU version of `maketemp' is +secure. This means that using the same template to multiple calls will +generate multiple files. However, we recommend that you use the new +`mkstemp' macro, introduced in GNU M4 1.4.8, which is secure even in +traditional mode. + + syscmd(`echo foo??????')dnl + =>foo?????? + define(`file1', maketemp(`fooXXXXXX'))dnl + ifelse(esyscmd(`echo foo??????'), `foo??????', `no file', `created') + =>created + define(`file2', maketemp(`fooXX'))dnl + define(`file3', mkstemp(`fooXXXXXX'))dnl + ifelse(len(file1), len(file2), `same length', `different') + =>same length + ifelse(file1, file2, `same', `different file') + =>different file + ifelse(file2, file3, `same', `different file') + =>different file + ifelse(file1, file3, `same', `different file') + =>different file + syscmd(`rm 'file1 file2 file3) + => + sysval + =>0  File: m4.info, Node: Miscellaneous, Next: Frozen files, Prev: Shell commands, Up: Top -13 Miscellaneous builtin macros +14 Miscellaneous builtin macros ******************************* This chapter describes various builtins, that do not really belong in @@ -3872,14 +4337,15 @@ any of the previous chapters.  File: m4.info, Node: Errprint, Next: Location, Up: Miscellaneous -13.1 Printing error messages +14.1 Printing error messages ============================ You can print error messages using `errprint': -- Builtin: errprint (MESSAGE, ...) - Prints MESSAGE and the rest of the arguments on the standard error - output, separated by spaces. + Prints MESSAGE and the rest of the arguments to standard error, + separated by spaces. Standard error is used, regardless of the + `--debugfile' option (*note Invoking m4: Debugging options.). The expansion of `errprint' is void. The macro `errprint' is recognized only with parameters. @@ -3888,16 +4354,24 @@ You can print error messages using `errp ') error-->Invalid arguments to forloop => + errprint(`1')errprint(`2',`3 + ') + error-->12 3 + => - A trailing newline is _not_ printed automatically, so it must be -supplied as part of the argument, as in the example. BSD -implementations of `m4' do append a trailing newline on each `errprint' -call, while some other implementations only print the first argument. + A trailing newline is _not_ printed automatically, so it should be +supplied as part of the argument, as in the example. Unfortunately, the +exact output of `errprint' is not very portable to other `m4' +implementations: POSIX requires that all arguments be printed, but some +implementations of `m4' only print the first. Furthermore, some BSD +implementations always append a newline for each `errprint' call, +regardless of whether the last argument already had one, and POSIX is +silent on whether this is acceptable.  File: m4.info, Node: Location, Next: M4exit, Prev: Errprint, Up: Miscellaneous -13.2 Printing current location +14.2 Printing current location ============================== To make it possible to specify the location of an error, three utility @@ -3917,13 +4391,14 @@ builtins exist: 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: +the file name. The syncline option (`-s', *note Invoking m4: +Preprocessor features.), and the `f' and `l' flags of `debugmode' +(*note Debug Levels::), also use this notion of current file and line. +Redefining the three location macros has no effect on syncline, debug, +or warning message output. Assume this example is run in the +`m4-1.4.8/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__') => @@ -3935,10 +4410,38 @@ using `--include=../examples' in the com =>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 location of macros invoked during the rescanning of macro +expansion text corresponds to the location in the file where the +expansion was triggered, regardless of how many newline characters the +expansion text contains. As of GNU M4 1.4.8, the location of text +wrapped with `m4wrap' (*note M4wrap::) is the point at which the +`m4wrap' was invoked. Previous versions, however, behaved as though +wrapped text came from line 0 of the file "". + + define(`echo', `$@') + => + define(`foo', `echo(__line__ + __line__)') + => + echo(__line__ + __line__) + =>4 + =>5 + m4wrap(`foo + ') + => + foo(errprint(__line__ + __line__ + )) + error-->8 + error-->9 + =>8 + =>8 + __line__ + =>11 + ^D + =>6 + =>6 The `__program__' macro behaves like `$0' in shell terminology. If you invoke `m4' through an absolute path or a link with a different @@ -3947,12 +4450,13 @@ will affect how `__program__' expands. 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'. +rather than whatever version of `m4' happens to be first in `PATH'. It +was first introduced in GNU M4 1.4.6.  File: m4.info, Node: M4exit, Prev: Location, Up: Miscellaneous -13.3 Exiting from `m4' +14.3 Exiting from `m4' ====================== If you need to exit from `m4' before the entire input has been read, @@ -3964,6 +4468,13 @@ you can use `m4exit': the range of 0 to 255, the exit status is one. No further input is read, and all wrapped and diverted text is discarded. + m4wrap(`This text is lost due to `m4exit'.') + => + divert(`1') So is this. + divert + => + m4exit And this is never read. + A common use of this is to abort processing: -- Composite: fatal_error (MESSAGE) @@ -3981,21 +4492,14 @@ 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. (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'.') - => - divert(`1') And so is this. - divert - => - m4exit +(*note M4wrap::) is not reread. (This macro could be made more robust +to earlier versions of `m4'. You should try to see if you can find +weaknesses and correct them; or *note Answers: Improved fatal_error.). Note that it is still possible for the exit status to be different than what was requested by `m4exit'. If `m4' detects some other error, -such as a write error on standard out, the exit status will be non-zero -even if `m4exit' requested zero. +such as a write error on standard output, the exit status will be +non-zero even if `m4exit' requested zero. If standard input is seekable, then the file will be positioned at the next unread character. If it is a pipe or other non-seekable file, @@ -4005,7 +4509,7 @@ buffers, and thus discarded.  File: m4.info, Node: Frozen files, Next: Compatibility, Prev: Miscellaneous, Up: Top -14 Fast loading of frozen state +15 Fast loading of frozen state ******************************* Some bigger `m4' applications may be built over a common base @@ -4026,7 +4530,7 @@ start of an application using lengthy co  File: m4.info, Node: Using frozen files, Next: Frozen file format, Up: Frozen files -14.1 Using frozen files +15.1 Using frozen files ======================= Suppose a user has a library of `m4' initializations in `base.m4', @@ -4106,7 +4610,7 @@ to indicate version mismatch.  File: m4.info, Node: Frozen file format, Prev: Using frozen files, Up: Frozen files -14.2 Frozen file format +15.2 Frozen file format ======================= Frozen files are sharable across architectures. It is safe to write a @@ -4161,7 +4665,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.7 only creates and + Confirms the format of the file. `m4' 1.4.8 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. @@ -4169,7 +4673,7 @@ characters. The directives are:  File: m4.info, Node: Compatibility, Next: Answers, Prev: Frozen files, Up: Top -15 Compatibility with other versions of `m4' +16 Compatibility with other versions of `m4' ******************************************** This chapter describes the differences between this implementation of @@ -4188,13 +4692,13 @@ made to summarize these here.  File: m4.info, Node: Extensions, Next: Incompatibilities, Up: Compatibility -15.1 Extensions in GNU `m4' +16.1 Extensions in GNU `m4' =========================== This version of `m4' contains a few facilities that do not exist in System V `m4'. These extra facilities are all suppressed by using the -`-G' command line option (*note Invoking m4::), unless overridden by -other command line options. +`-G' command line option (*note Invoking m4: Limits control.), unless +overridden by other command line options. * In the `$'N notation for macro arguments, N can contain several digits, while the System V `m4' only accepts one digit. This @@ -4262,6 +4766,11 @@ other command line options. * The destination of trace and debug output can be controlled with `debugfile' (*note Debug Output::). + * The `maketemp' (*note Mkstemp::) macro behaves like `mkstemp', + creating a new file with a unique name on every invocation, rather + than following the insecure behavior of replacing the trailing `X' + characters with the `m4' process id. + In addition to the above extensions, GNU `m4' implements the following command line options: `-F', `-G', `-I', `-L', `-R', `-V', `-W', `-d', `-i', `-l', `--debugfile' and `-t'. *Note Invoking m4::, @@ -4273,7 +4782,7 @@ extensive than in most other versions of  File: m4.info, Node: Incompatibilities, Next: Other Incompatibilities, Prev: Extensions, Up: Compatibility -15.2 Facilities in System V `m4' not in GNU `m4' +16.2 Facilities in System V `m4' not in GNU `m4' ================================================ The version of `m4' from System V contains a few facilities that have @@ -4305,7 +4814,7 @@ behaviors is non-portable, as a future r all arguments, with output separated by spaces. However, it is possible to emulate POSIX behavior by including the - file `examples/wrapfifo.m4' from the distribution: + file `m4-1.4.8/examples/wrapfifo.m4' from the distribution: undivert(`wrapfifo.m4')dnl =>dnl Redefine m4wrap to have FIFO semantics. @@ -4344,22 +4853,29 @@ behaviors is non-portable, as a future r follows traditional behavior in `syscmd', and provides the extension `esyscmd' that provides the POSIX semantics. - * POSIX requires `maketemp' (*note Maketemp::) to replace the - trailing `X' characters with the `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 `m4' actually creates a - temporary file for each invocation of `maketemp', which means that - the output of the macro is different even if the input is - identical. - - * POSIX requires `changequote(ARG)' (*note Changequote::) to use - newline as the close quote, but GNU `m4' uses `'' as the close - quote. Meanwhile, some traditional implementations use ARG as the - close quote, making it impossible to nest quotes. For predictable - results, never call changequote with just one argument. + * At one point, POSIX required `changequote(ARG)' (*note + Changequote::) to use newline as the close quote, but this was a + bug, and the next version of POSIX is anticipated to state that + using empty strings or just one argument is unspecified. + Meanwhile, the GNU `m4' behavior of treating an empty end-quote + delimiter as `'' is not portable, as Solaris treats it as + repeating the start-quote delimiter, and BSD treats it as leaving + the previous end-quote delimiter unchanged. For predictable + results, never call changequote with just one argument, or with + empty strings for arguments. + + * At one point, POSIX required `changecom(ARG,)' (*note Changecom::) + to make it impossible to end a comment, but this is a bug, and the + next version of POSIX is anticipated to state that using empty + strings is unspecified. Meanwhile, the GNU `m4' behavior of + treating an empty end-comment delimiter as newline is not + portable, as BSD treats it as leaving the previous end-comment + delimiter unchanged. It is also impossible in BSD implementations + to disable comments, even though that is required by POSIX. For + predictable results, never call changecom with empty strings for + arguments. - * Some implementations of `m4' give macros a higher precedence than + * Most implementations of `m4' give macros a higher precedence than comments when parsing, meaning that if the start delimiter given to `changecom' (*note Changecom::) starts with a macro name, comments are effectively disabled. POSIX does not specify what the @@ -4408,10 +4924,17 @@ behaviors is non-portable, as a future r `LANG', `LC_ALL', `LC_CTYPE', `LC_MESSAGES', and `NLSPATH', but this has not yet been implemented in GNU `m4'. + * POSIX states that only unquoted leading newlines and blanks (that + is, space and tab) are ignored when collecting macro arguments. + However, this appears to be a bug in POSIX, since most traditional + implementations also ignore all whitespace (formfeed, carriage + return, and vertical tab). GNU `m4' follows tradition and ignores + all leading unquoted whitespace. +  File: m4.info, Node: Other Incompatibilities, Prev: Incompatibilities, Up: Compatibility -15.3 Other incompatibilities +16.3 Other incompatibilities ============================ There are a few other incompatibilities between this implementation of @@ -4457,15 +4980,30 @@ There are a few other incompatibilities  File: m4.info, Node: Answers, Next: Copying This Manual, Prev: Compatibility, Up: Top -16 Correct version of some examples +17 Correct version of some examples *********************************** -Some of the examples in this manuals are buggy, for demonstration -purposes. Correctly working macros are presented here. +Some of the examples in this manuals are buggy or not very robust, for +demonstration purposes. Improved versions of these composite macros are +presented here. + +* Menu: + +* Improved exch:: Solution for `exch' +* Improved forloop:: Solution for `forloop' +* Improved foreach:: Solution for `foreach' +* Improved cleardivert:: Solution for `cleardivert' +* Improved fatal_error:: Solution for `fatal_error' - 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 + +File: m4.info, Node: Improved exch, Next: Improved forloop, Up: Answers + +17.1 Solution for `exch' +======================== + +The `exch' macro (*note Arguments::) as presented requires clients to +double quote their arguments. A nicer definition, which lets clients +follow the rule of thumb of one level of quoting per level of parentheses, involves adding quotes in the definition of `exch', as follows: @@ -4476,7 +5014,247 @@ follows: macro =>expansion text - The `cleardivert' macro (*note Cleardiv::) cannot, as it stands, be + +File: m4.info, Node: Improved forloop, Next: Improved foreach, Prev: Improved exch, Up: Answers + +17.2 Solution for `forloop' +=========================== + +The `forloop' macro (*note Forloop::) as presented earlier can go into +an infinite loop if given an iterator that is not parsed as a macro +name. It does not do any sanity checking on its numeric bounds, and +only permits decimal numbers for bounds. Here is an improved version, +shipped as `m4-1.4.8/examples/forloop2.m4'; this version also optimizes +based on the fact that the starting bound does not need to be passed to +the helper `_forloop'. + + undivert(`forloop2.m4')dnl + =>divert(`-1') + =># forloop(var, from, to, stmt) - improved version: + =># works even if VAR is not a strict macro name + =># performs sanity check that FROM is larger than TO + =># allows complex numerical expressions in TO and FROM + =>define(`forloop', `ifelse(eval(`($3) >= ($2)'), `1', + => `pushdef(`$1', eval(`$2'))_forloop(`$1', + => eval(`$3'), `$4')popdef(`$1')')') + =>define(`_forloop', + => `$3`'ifelse(indir(`$1'), `$2', `', + => `define(`$1', incr(indir(`$1')))$0($@)')') + =>divert`'dnl + include(`forloop2.m4') + => + forloop(`i', `2', `1', `no iteration occurs') + => + forloop(`', `1', `2', ` odd iterator name') + => odd iterator name odd iterator name + forloop(`i', `5 + 5', `0xc', ` 0x`'eval(i, `16')') + => 0xa 0xb 0xc + forloop(`i', `a', `b', `non-numeric bounds') + error-->m4:stdin:6: bad expression in eval (bad input): (b) >= (a) + => + + Of course, it is possible to make even more improvements, such as +adding an optional step argument, or allowing iteration through +descending sequences. GNU Autoconf provides some of these additional +bells and whistles in its `m4_for' macro. + + +File: m4.info, Node: Improved foreach, Next: Improved cleardivert, Prev: Improved forloop, Up: Answers + +17.3 Solution for `foreach' +=========================== + +The `foreach' and `foreachq' macros (*note Foreach::) as presented +earlier each have flaws. First, we will examine and fix the quadratic +behavior of `foreachq': + + include(`foreachq.m4') + => + traceon(`shift')debugmode(`aq') + => + foreachq(`x', ``1', `2', `3', `4'', `x + ')dnl + =>1 + error-->m4trace: -3- shift(`1', `2', `3', `4') + error-->m4trace: -2- shift(`1', `2', `3', `4') + =>2 + error-->m4trace: -4- shift(`1', `2', `3', `4') + error-->m4trace: -3- shift(`2', `3', `4') + error-->m4trace: -3- shift(`1', `2', `3', `4') + error-->m4trace: -2- shift(`2', `3', `4') + =>3 + error-->m4trace: -5- shift(`1', `2', `3', `4') + error-->m4trace: -4- shift(`2', `3', `4') + error-->m4trace: -3- shift(`3', `4') + error-->m4trace: -4- shift(`1', `2', `3', `4') + error-->m4trace: -3- shift(`2', `3', `4') + error-->m4trace: -2- shift(`3', `4') + =>4 + error-->m4trace: -6- shift(`1', `2', `3', `4') + error-->m4trace: -5- shift(`2', `3', `4') + error-->m4trace: -4- shift(`3', `4') + error-->m4trace: -3- shift(`4') + + Each successive iteration was adding more quoted `shift' +invocations, and the entire list contents were passing through every +iteration. In general, when recursing, it is a good idea to make the +recursion use fewer arguments, rather than adding additional quoted +uses of `shift'. By doing so, `m4' uses less memory, invokes fewer +macros, is less likely to run into machine limits, and most +importantly, performs faster. The fixed version of `foreachq' can be +found in `m4-1.4.8/examples/foreachq2.m4': + + include(`foreachq2.m4') + => + undivert(`foreachq2.m4')dnl + =>include(`quote.m4')dnl + =>divert(`-1') + =># foreachq(x, `item_1, item_2, ..., item_n', stmt) + =># quoted list, improved version + =>define(`foreachq', `pushdef(`$1')_foreachq($@)popdef(`$1')') + =>define(`_arg1q', ``$1'') + =>define(`_rest', `ifelse(`$#', `1', `', `dquote(shift($@))')') + =>define(`_foreachq', `ifelse(`$2', `', `', + => `define(`$1', _arg1q($2))$3`'$0(`$1', _rest($2), `$3')')') + =>divert`'dnl + traceon(`shift')debugmode(`aq') + => + foreachq(`x', ``1', `2', `3', `4'', `x + ')dnl + =>1 + error-->m4trace: -3- shift(`1', `2', `3', `4') + =>2 + error-->m4trace: -3- shift(`2', `3', `4') + =>3 + error-->m4trace: -3- shift(`3', `4') + =>4 + + Note that the fixed version calls unquoted helper macros in +`_foreachq' to trim elements immediately; those helper macros in turn +must re-supply the layer of quotes lost in the macro invocation. +Contrast the use of `_arg1q', which quotes the first list element, with +`_arg1' of the earlier implementation that returned the first list +element directly. + + For a different approach, the improved version of `foreach', +available in `m4-1.4.8/examples/foreach2.m4', simply overquotes the +arguments to `_foreach' to begin with, using `dquote_elt'. Then +`_foreach' can just use `_arg1' to remove the extra layer of quoting +that was added up front: + + include(`foreach2.m4') + => + undivert(`foreach2.m4')dnl + =>include(`quote.m4')dnl + =>divert(`-1') + =># foreach(x, (item_1, item_2, ..., item_n), stmt) + =># parenthesized list, improved version + =>define(`foreach', `pushdef(`$1')_foreach(`$1', + => (dquote(dquote_elt$2)), `$3')popdef(`$1')') + =>define(`_arg1', `$1') + =>define(`_foreach', `ifelse(`$2', `(`')', `', + => `define(`$1', _arg1$2)$3`'$0(`$1', (dquote(shift$2)), `$3')')') + =>divert`'dnl + traceon(`shift')debugmode(`aq') + => + foreach(`x', `(`1', `2', `3', `4')', `x + ')dnl + error-->m4trace: -4- shift(`1', `2', `3', `4') + error-->m4trace: -4- shift(`2', `3', `4') + error-->m4trace: -4- shift(`3', `4') + =>1 + error-->m4trace: -3- shift(``1'', ``2'', ``3'', ``4'') + =>2 + error-->m4trace: -3- shift(``2'', ``3'', ``4'') + =>3 + error-->m4trace: -3- shift(``3'', ``4'') + =>4 + error-->m4trace: -3- shift(``4'') + + In summary, recursion over list elements is trickier than it +appeared at first glance, but provides a powerful idiom within `m4' +processing. As a final demonstration, both list styles are now able to +handle several scenarios that would wreak havoc on the original +implementations. This points out one other difference between the two +list styles. `foreach' evaluates unquoted list elements only once, in +preparation for calling `_foreach'. But `foreachq' evaluates unquoted +list elements twice while visiting the first list element, once in +`_arg1q' and once in `_rest'. When deciding which list style to use, +one must take into account whether repeating the side effects of +unquoted list elements will have any detrimental effects. + + include(`foreach2.m4') + => + include(`foreachq2.m4') + => + dnl 0-element list: + foreach(`x', `', `') / foreachq(`x', `', `') + => / + dnl 1-element list of empty element + foreach(`x', `()', `') / foreachq(`x', ``'', `') + =><> / <> + dnl 2-element list of empty elements + foreach(`x', `(`',`')', `') / foreachq(`x', ``',`'', `') + =><><> / <><> + dnl 1-element list of a comma + foreach(`x', `(`,')', `') / foreachq(`x', ``,'', `') + =><,> / <,> + dnl 2-element list of unbalanced parentheses + foreach(`x', `(`(', `)')', `') / foreachq(`x', ``(', `)'', `') + =><(><)> / <(><)> + define(`active', `ACT, IVE') + => + traceon(`active') + => + dnl list of unquoted macros; expansion occurs before recursion + foreach(`x', `(active, active)', ` + ')dnl + error-->m4trace: -4- active -> `ACT, IVE' + error-->m4trace: -4- active -> `ACT, IVE' + => + => + => + => + foreachq(`x', `active, active', ` + ')dnl + error-->m4trace: -3- active -> `ACT, IVE' + error-->m4trace: -3- active -> `ACT, IVE' + => + error-->m4trace: -3- active -> `ACT, IVE' + error-->m4trace: -3- active -> `ACT, IVE' + => + => + => + dnl list of quoted macros; expansion occurs during recursion + foreach(`x', `(`active', `active')', ` + ')dnl + error-->m4trace: -1- active -> `ACT, IVE' + => + error-->m4trace: -1- active -> `ACT, IVE' + => + foreachq(`x', ``active', `active'', ` + ')dnl + error-->m4trace: -1- active -> `ACT, IVE' + => + error-->m4trace: -1- active -> `ACT, IVE' + => + dnl list of double-quoted macro names; no expansion + foreach(`x', `(``active'', ``active'')', ` + ')dnl + => + => + foreachq(`x', ```active'', ``active''', ` + ')dnl + => + => + + +File: m4.info, Node: Improved cleardivert, Next: Improved fatal_error, Prev: Improved foreach, Up: Answers + +17.4 Solution for `cleardivert' +=============================== + +The `cleardivert' macro (*note Cleardivert::) cannot, as it stands, be called without arguments to clear all pending diversions. That is because using undivert with an empty string for an argument is different than using it with no arguments at all. Compare the earlier definition @@ -4505,16 +5283,23 @@ 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: + +File: m4.info, Node: Improved fatal_error, Prev: Improved cleardivert, Up: Answers + +17.5 Solution for `fatal_error' +=============================== + +The `fatal_error' macro (*note M4exit::) is not robust to versions of +GNU M4 earlier than 1.4.8, where invoking `__file__' (*note Location::) +inside `m4wrap' would result in an empty string, and `__line__' +resulted in `0' even though all files start at line 1. Furthermore, +versions earlier than 1.4.6 did not support the `__program__' macro. +If you want `fatal_error' to work across the entire 1.4.x release +series, a better implementation would be: define(`fatal_error', - `errprint(__program__:ifelse(__line__, `0', `', + `errprint(ifdef(`__program__', `__program__', ``m4'')'dnl + `:ifelse(__line__, `0', `', `__file__:__line__:')` fatal error: $* ')m4exit(`1')') => @@ -4522,9 +5307,9 @@ equivalently, when the current line is 0 fatal_error(`inside wrapped text')') => ^D - error-->m4: Warning: excess arguments to builtin `divnum' ignored + error-->m4:stdin:6: Warning: excess arguments to builtin `divnum' ignored =>0 - error-->m4: fatal error: inside wrapped text + error-->m4:stdin:6: fatal error: inside wrapped text  File: m4.info, Node: Copying This Manual, Next: Indices, Prev: Answers, Up: Top @@ -4988,158 +5773,165 @@ B.1 Index for many concepts [index] * Menu: -* arguments to macros: Macro Arguments. (line 6) -* Arguments to macros: Arguments. (line 6) -* arguments to macros, special: Pseudo Arguments. (line 6) -* arguments, quoted macro: Quoting Arguments. (line 6) -* arithmetic: Arithmetic. (line 6) -* arrays: Define. (line 52) -* builtins, indirect call of: Builtin. (line 6) -* call of builtins, indirect: Builtin. (line 6) -* call of macros, indirect: Indir. (line 6) -* 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 235) -* command line, macro definitions on the: Invoking m4. (line 78) -* command line, options: Invoking m4. (line 10) -* commands, exit status from shell: Sysval. (line 6) -* commands, running shell: Shell commands. (line 6) -* commands, running UNIX: Shell commands. (line 6) -* comment delimiters, changing: Changecom. (line 6) -* comments: Comments. (line 6) -* comments, copied to output: Changecom. (line 29) -* comparing strings: Ifelse. (line 6) -* compatibility: Compatibility. (line 6) -* conditionals: Ifdef. (line 6) -* controlling debugging output: Debug Levels. (line 6) -* counting loops: Loops. (line 50) -* debugging output, controlling: Debug Levels. (line 6) -* debugging output, saving: Debug Output. (line 6) -* decrement operator: Incr. (line 6) -* defining new macros: Definitions. (line 6) -* definitions, displaying macro: Dumpdef. (line 6) -* deleting macros: Undefine. (line 6) -* deleting whitespace in input: Dnl. (line 6) -* discarding diverted text: Cleardiv. (line 6) -* displaying macro definitions: Dumpdef. (line 6) -* diversion numbers: Divnum. (line 6) -* diverted text, discarding: Cleardiv. (line 6) -* diverting output to files: Divert. (line 6) -* dumping into frozen file: Using frozen files. (line 6) -* error messages, printing: Errprint. (line 6) -* evaluation, of integer expressions: Eval. (line 6) -* executing shell commands: Shell commands. (line 6) -* executing UNIX commands: Shell commands. (line 6) -* exit status from shell commands: Sysval. (line 6) -* exiting from m4: M4exit. (line 6) -* expansion of macros: Macro expansion. (line 6) -* expansion, tracing macro: Trace. (line 6) -* expressions, evaluation of integer: Eval. (line 6) -* extracting substrings: Substr. (line 6) -* fast loading of frozen files: Using frozen files. (line 6) +* arguments to macros: Macro Arguments. (line 6) +* Arguments to macros: Arguments. (line 6) +* arguments to macros, special: Pseudo Arguments. (line 6) +* arguments, quoted macro: Quoting Arguments. (line 6) +* arithmetic: Arithmetic. (line 6) +* arrays: Define. (line 52) +* builtins, indirect call of: Builtin. (line 6) +* call of builtins, indirect: Builtin. (line 6) +* call of macros, indirect: Indir. (line 6) +* changing comment delimiters: Changecom. (line 6) +* changing the quote delimiters: Changequote. (line 6) +* characters, translating: Translit. (line 6) +* command line, file names on the: Command line files. (line 6) +* command line, macro definitions on the: Preprocessor features. + (line 6) +* command line, options: Invoking m4. (line 10) +* commands, exit status from shell: Sysval. (line 6) +* commands, running shell: Shell commands. (line 6) +* commands, running UNIX: Shell commands. (line 6) +* comment delimiters, changing: Changecom. (line 6) +* comments: Comments. (line 6) +* comments, copied to output: Changecom. (line 29) +* comparing strings: Ifelse. (line 6) +* compatibility: Compatibility. (line 6) +* conditionals: Ifdef. (line 6) +* controlling debugging output: Debug Levels. (line 6) +* counting loops: Forloop. (line 6) +* debugging output, controlling: Debug Levels. (line 6) +* debugging output, saving: Debug Output. (line 6) +* decrement operator: Incr. (line 6) +* defining new macros: Definitions. (line 6) +* definitions, displaying macro: Dumpdef. (line 6) +* deleting macros: Undefine. (line 6) +* deleting whitespace in input: Dnl. (line 6) +* discarding diverted text: Cleardivert. (line 6) +* displaying macro definitions: Dumpdef. (line 6) +* diversion numbers: Divnum. (line 6) +* diverted text, discarding: Cleardivert. (line 6) +* diverting output to files: Divert. (line 6) +* dumping into frozen file: Using frozen files. (line 6) +* error messages, printing: Errprint. (line 6) +* evaluation, of integer expressions: Eval. (line 6) +* executing shell commands: Shell commands. (line 6) +* executing UNIX commands: Shell commands. (line 6) +* exit status from shell commands: Sysval. (line 6) +* exiting from m4: M4exit. (line 6) +* expansion of macros: Macro expansion. (line 6) +* expansion, tracing macro: Trace. (line 6) +* expressions, evaluation of integer: Eval. (line 6) +* extracting substrings: Substr. (line 6) +* fast loading of frozen files: Using frozen files. (line 6) * FDL, GNU Free Documentation License: GNU Free Documentation License. - (line 6) -* file format, frozen file: Frozen file format. (line 6) -* file inclusion <1>: Undivert. (line 77) -* file inclusion: File Inclusion. (line 6) -* file names, on the command line: Invoking m4. (line 235) -* files, diverting output to: Divert. (line 6) -* files, names of temporary: Maketemp. (line 6) -* for loops: Loops. (line 50) -* formatted output: Format. (line 6) -* frozen file format: Frozen file format. (line 6) -* frozen files for fast loading: Using frozen files. (line 6) -* GNU extensions <1>: Builtin. (line 6) -* GNU extensions <2>: Undivert. (line 77) -* GNU extensions <3>: Extensions. (line 6) -* GNU extensions <4>: Patsubst. (line 6) -* GNU extensions <5>: Search Path. (line 6) -* GNU extensions <6>: Esyscmd. (line 6) -* GNU extensions <7>: Using frozen files. (line 6) -* GNU extensions <8>: Debug Output. (line 6) -* GNU extensions <9>: Regexp. (line 6) -* GNU extensions <10>: Arguments. (line 32) -* GNU extensions <11>: Format. (line 6) -* GNU extensions <12>: Indir. (line 6) -* GNU extensions <13>: Define. (line 41) -* 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) -* increment operator: Incr. (line 6) -* indirect call of builtins: Builtin. (line 6) -* indirect call of macros: Indir. (line 6) -* initialization, frozen states: Using frozen files. (line 6) -* input tokens: Syntax. (line 6) -* input, saving: M4wrap. (line 6) -* integer arithmetic: Arithmetic. (line 6) -* integer expression evaluation: Eval. (line 6) -* length of strings: Len. (line 6) -* lexical structure of words: Changeword. (line 6) -* License: Copying This Manual. (line 6) -* local variables: Pushdef. (line 75) -* loops: Loops. (line 10) -* loops, counting: Loops. (line 50) -* macro definitions, on the command line: Invoking m4. (line 78) -* macro expansion, tracing: Trace. (line 6) -* macro invocation: Invocation. (line 6) -* macros, arguments to <1>: Arguments. (line 6) -* macros, arguments to: Macro Arguments. (line 6) -* macros, displaying definitions: Dumpdef. (line 6) -* macros, expansion of: Macro expansion. (line 6) -* macros, how to define new: Definitions. (line 6) -* macros, how to delete: Undefine. (line 6) -* macros, how to rename: Defn. (line 6) -* macros, indirect call of: Indir. (line 6) -* macros, quoted arguments to: Quoting Arguments. (line 6) -* macros, recursive: Loops. (line 6) -* macros, special arguments to: Pseudo Arguments. (line 6) -* macros, temporary redefinition of: Pushdef. (line 6) -* messages, printing error: Errprint. (line 6) -* multibranches: Ifelse. (line 66) -* names: Names. (line 6) -* options, command line: Invoking m4. (line 10) -* output, diverting to files: Divert. (line 6) -* output, formatted: Format. (line 6) -* output, saving debugging: Debug Output. (line 6) -* pattern substitution: Patsubst. (line 6) -* platform macro: Platform macros. (line 31) -* platform macros: Platform macros. (line 6) -* POSIXLY_CORRECT: Invoking m4. (line 10) -* printing error messages: Errprint. (line 6) -* quote delimiters, changing the: Changequote. (line 6) -* quoted macro arguments: Quoting Arguments. (line 6) -* quoted string: Quoted strings. (line 6) -* recursive macros: Loops. (line 6) -* redefinition of macros, temporary: Pushdef. (line 6) -* regular expressions <1>: Regexp. (line 6) -* regular expressions: Patsubst. (line 6) -* reloading a frozen file: Using frozen files. (line 6) -* renaming macros: Defn. (line 6) -* running shell commands: Shell commands. (line 6) -* running UNIX commands: Shell commands. (line 6) -* saving debugging output: Debug Output. (line 6) -* saving input: M4wrap. (line 6) -* search path for included files: Search Path. (line 6) -* shell commands, exit status from: Sysval. (line 6) -* shell commands, running: Shell commands. (line 6) -* special arguments to macros: Pseudo Arguments. (line 6) -* status of shell commands: Sysval. (line 6) -* status, setting m4 exit: M4exit. (line 6) -* strings, length of: Len. (line 6) -* substitution by regular expression: Patsubst. (line 6) -* substrings, extracting: Substr. (line 6) -* temporary file names: Maketemp. (line 6) -* temporary redefinition of macros: Pushdef. (line 6) -* tokens: Syntax. (line 6) -* tracing macro expansion: Trace. (line 6) -* translating characters: Translit. (line 6) -* undefining macros: Undefine. (line 6) -* UNIX commands, exit status from: Sysval. (line 6) -* UNIX commands, running: Shell commands. (line 6) -* variables, local: Pushdef. (line 75) -* words, lexical structure of: Changeword. (line 6) + (line 6) +* file format, frozen file: Frozen file format. (line 6) +* file inclusion <1>: Undivert. (line 81) +* file inclusion: File Inclusion. (line 6) +* file names, on the command line: Command line files. (line 6) +* files, diverting output to: Divert. (line 6) +* files, names of temporary: Mkstemp. (line 6) +* for each loops: Foreach. (line 6) +* for loops: Forloop. (line 6) +* formatted output: Format. (line 6) +* frozen file format: Frozen file format. (line 6) +* frozen files for fast loading: Using frozen files. (line 6) +* GNU extensions <1>: Indir. (line 6) +* GNU extensions <2>: Patsubst. (line 6) +* GNU extensions <3>: Extensions. (line 6) +* GNU extensions <4>: Regexp. (line 6) +* GNU extensions <5>: Using frozen files. (line 6) +* GNU extensions <6>: Format. (line 6) +* GNU extensions <7>: Undivert. (line 81) +* GNU extensions <8>: Divert. (line 54) +* GNU extensions <9>: Search Path. (line 6) +* GNU extensions <10>: Define. (line 41) +* GNU extensions <11>: Arguments. (line 32) +* GNU extensions <12>: Esyscmd. (line 6) +* GNU extensions <13>: Debug Output. (line 6) +* GNU extensions <14>: Mkstemp. (line 52) +* GNU extensions <15>: Builtin. (line 6) +* GNU extensions: Debug Levels. (line 59) +* included files, search path for: Search Path. (line 6) +* inclusion, of files <1>: Undivert. (line 81) +* inclusion, of files: File Inclusion. (line 6) +* increment operator: Incr. (line 6) +* indirect call of builtins: Builtin. (line 6) +* indirect call of macros: Indir. (line 6) +* initialization, frozen states: Using frozen files. (line 6) +* input tokens: Syntax. (line 6) +* input, saving: M4wrap. (line 6) +* integer arithmetic: Arithmetic. (line 6) +* integer expression evaluation: Eval. (line 6) +* iterating over lists: Foreach. (line 6) +* length of strings: Len. (line 6) +* lexical structure of words: Changeword. (line 6) +* License: Copying This Manual. (line 6) +* local variables: Pushdef. (line 75) +* loops: Shift. (line 10) +* loops, counting: Forloop. (line 6) +* loops, list iteration: Foreach. (line 6) +* macro definitions, on the command line: Preprocessor features. + (line 6) +* macro expansion, tracing: Trace. (line 6) +* macro invocation: Invocation. (line 6) +* macros, arguments to <1>: Macro Arguments. (line 6) +* macros, arguments to: Arguments. (line 6) +* macros, displaying definitions: Dumpdef. (line 6) +* macros, expansion of: Macro expansion. (line 6) +* macros, how to define new: Definitions. (line 6) +* macros, how to delete: Undefine. (line 6) +* macros, how to rename: Defn. (line 6) +* macros, indirect call of: Indir. (line 6) +* macros, quoted arguments to: Quoting Arguments. (line 6) +* macros, recursive: Shift. (line 6) +* macros, special arguments to: Pseudo Arguments. (line 6) +* macros, temporary redefinition of: Pushdef. (line 6) +* messages, printing error: Errprint. (line 6) +* multibranches: Ifelse. (line 66) +* names: Names. (line 6) +* options, command line: Invoking m4. (line 10) +* output, diverting to files: Divert. (line 6) +* output, formatted: Format. (line 6) +* output, saving debugging: Debug Output. (line 6) +* pattern substitution: Patsubst. (line 6) +* platform macro: Platform macros. (line 31) +* platform macros: Platform macros. (line 6) +* POSIXLY_CORRECT: Invoking m4. (line 10) +* printing error messages: Errprint. (line 6) +* quote delimiters, changing the: Changequote. (line 6) +* quoted macro arguments: Quoting Arguments. (line 6) +* quoted string: Quoted strings. (line 6) +* recursive macros: Shift. (line 6) +* redefinition of macros, temporary: Pushdef. (line 6) +* regular expressions <1>: Patsubst. (line 6) +* regular expressions: Regexp. (line 6) +* reloading a frozen file: Using frozen files. (line 6) +* renaming macros: Defn. (line 6) +* running shell commands: Shell commands. (line 6) +* running UNIX commands: Shell commands. (line 6) +* saving debugging output: Debug Output. (line 6) +* saving input: M4wrap. (line 6) +* search path for included files: Search Path. (line 6) +* shell commands, exit status from: Sysval. (line 6) +* shell commands, running: Shell commands. (line 6) +* special arguments to macros: Pseudo Arguments. (line 6) +* status of shell commands: Sysval. (line 6) +* status, setting m4 exit: M4exit. (line 6) +* strings, length of: Len. (line 6) +* substitution by regular expression: Patsubst. (line 6) +* substrings, extracting: Substr. (line 6) +* temporary file names: Mkstemp. (line 6) +* temporary redefinition of macros: Pushdef. (line 6) +* tokens: Syntax. (line 6) +* tracing macro expansion: Trace. (line 6) +* translating characters: Translit. (line 6) +* undefining macros: Undefine. (line 6) +* UNIX commands, exit status from: Sysval. (line 6) +* UNIX commands, running: Shell commands. (line 6) +* variables, local: Pushdef. (line 75) +* words, lexical structure of: Changeword. (line 6)  File: m4.info, Node: Macro index, Prev: Concept index, Up: Indices @@ -5161,11 +5953,11 @@ the first time. * __unix__: Platform macros. (line 15) * __windows__: Platform macros. (line 17) * builtin: Builtin. (line 9) -* capitalize: Patsubst. (line 54) +* capitalize: Patsubst. (line 55) * changecom: Changecom. (line 10) * changequote: Changequote. (line 10) * changeword: Changeword. (line 23) -* cleardivert: Cleardiv. (line 26) +* cleardivert: Cleardivert. (line 26) * debugfile: Debug Output. (line 11) * debugmode: Debug Levels. (line 63) * decr: Incr. (line 11) @@ -5174,14 +5966,18 @@ the first time. * divert: Divert. (line 9) * divnum: Divnum. (line 9) * dnl: Dnl. (line 9) -* downcase: Patsubst. (line 53) +* downcase: Patsubst. (line 54) +* dquote: Shift. (line 53) +* dquote_elt: Shift. (line 54) * dumpdef: Dumpdef. (line 10) * errprint: Errprint. (line 9) * esyscmd: Esyscmd. (line 9) * eval: Eval. (line 9) * example: Manual. (line 32) -* fatal_error: M4exit. (line 18) -* forloop: Loops. (line 53) +* fatal_error: M4exit. (line 25) +* foreach: Foreach. (line 9) +* foreachq: Foreach. (line 10) +* forloop: Forloop. (line 9) * format: Format. (line 9) * ifdef: Ifdef. (line 10) * ifelse: Ifelse. (line 12) @@ -5192,14 +5988,16 @@ the first time. * len: Len. (line 9) * m4exit: M4exit. (line 10) * m4wrap: M4wrap. (line 14) -* maketemp: Maketemp. (line 11) +* maketemp: Mkstemp. (line 12) +* mkstemp: Mkstemp. (line 11) * os2: Platform macros. (line 14) * patsubst: Patsubst. (line 9) * popdef: Pushdef. (line 12) * pushdef: Pushdef. (line 11) +* quote: Shift. (line 52) * regexp: Regexp. (line 9) -* reverse: Loops. (line 32) -* shift: Loops. (line 17) +* reverse: Shift. (line 32) +* shift: Shift. (line 17) * sinclude: Include. (line 10) * substr: Substr. (line 9) * syscmd: Syscmd. (line 9) @@ -5210,96 +6008,109 @@ the first time. * undefine: Undefine. (line 9) * undivert: Undivert. (line 9) * unix: Platform macros. (line 16) -* upcase: Patsubst. (line 52) +* upcase: Patsubst. (line 53) * windows: Platform macros. (line 18)  Tag Table: -Node: Top841 -Node: Preliminaries8308 -Node: Intro9035 -Node: History10667 -Node: Invoking m413299 -Node: Bugs24213 -Node: Manual25479 -Node: Syntax28411 -Node: Names29414 -Node: Quoted strings29876 -Node: Comments30525 -Node: Other tokens31392 -Node: Input processing31970 -Node: Macros33849 -Node: Invocation34343 -Node: Inhibiting Invocation35144 -Node: Macro Arguments38698 -Node: Quoting Arguments40625 -Node: Macro expansion41946 -Node: Definitions42614 -Node: Define43399 -Node: Arguments45586 -Node: Pseudo Arguments47317 -Node: Undefine50532 -Node: Defn51662 -Node: Pushdef54389 -Node: Indir56723 -Node: Builtin58194 -Node: Conditionals59857 -Node: Ifdef60571 -Node: Ifelse61434 -Node: Loops64653 -Node: Debugging68589 -Node: Dumpdef69174 -Node: Trace70551 -Node: Debug Levels73171 -Node: Debug Output75959 -Node: Input Control77149 -Node: Dnl77686 -Node: Changequote79496 -Node: Changecom82973 -Node: Changeword85914 -Node: M4wrap91355 -Node: File Inclusion93608 -Node: Include93925 -Node: Search Path96371 -Node: Diversions97183 -Node: Divert98421 -Node: Undivert100616 -Node: Divnum103340 -Node: Cleardiv103799 -Node: Text handling104958 -Node: Len105681 -Node: Index macro106066 -Node: Regexp106837 -Node: Substr109086 -Node: Translit110137 -Node: Patsubst111826 -Node: Format115360 -Node: Arithmetic117418 -Node: Incr117867 -Node: Eval118642 -Node: Shell commands123051 -Node: Platform macros123973 -Node: Syscmd125702 -Node: Esyscmd127488 -Node: Sysval128534 -Node: Maketemp130090 -Node: Miscellaneous131178 -Node: Errprint131611 -Node: Location132411 -Node: M4exit134609 -Node: Frozen files136630 -Node: Using frozen files137411 -Node: Frozen file format140651 -Node: Compatibility143714 -Node: Extensions144329 -Node: Incompatibilities147826 -Node: Other Incompatibilities154899 -Node: Answers156827 -Node: Copying This Manual159173 -Node: GNU Free Documentation License159429 -Node: Indices181823 -Node: Concept index182103 -Node: Macro index193351 +Node: Top840 +Node: Preliminaries9196 +Node: Intro9882 +Node: History11514 +Node: Bugs14146 +Node: Manual15408 +Node: Invoking m418340 +Node: Operation modes20488 +Node: Preprocessor features22199 +Node: Limits control24701 +Node: Frozen state27637 +Node: Debugging options28436 +Node: Command line files30175 +Node: Syntax31538 +Node: Names32539 +Node: Quoted strings33001 +Node: Comments33650 +Node: Other tokens34517 +Node: Input processing35095 +Node: Macros36982 +Node: Invocation37476 +Node: Inhibiting Invocation38277 +Node: Macro Arguments41848 +Node: Quoting Arguments44539 +Node: Macro expansion45861 +Node: Definitions46529 +Node: Define47314 +Node: Arguments49520 +Node: Pseudo Arguments51268 +Node: Undefine54483 +Node: Defn55613 +Node: Pushdef58346 +Node: Indir60680 +Node: Builtin62782 +Node: Conditionals64544 +Node: Ifdef65363 +Node: Ifelse66226 +Node: Shift69445 +Node: Forloop73244 +Node: Foreach75813 +Node: Debugging80792 +Node: Dumpdef81377 +Node: Trace82761 +Node: Debug Levels85449 +Node: Debug Output88255 +Node: Input Control89526 +Node: Dnl90063 +Node: Changequote91964 +Node: Changecom96760 +Node: Changeword100276 +Node: M4wrap105717 +Node: File Inclusion107978 +Node: Include108295 +Node: Search Path110895 +Node: Diversions111812 +Node: Divert113603 +Node: Undivert116129 +Node: Divnum119011 +Node: Cleardivert119475 +Node: Text handling120680 +Node: Len121403 +Node: Index macro121788 +Node: Regexp122559 +Node: Substr124808 +Node: Translit125859 +Node: Patsubst128581 +Node: Format132121 +Node: Arithmetic134188 +Node: Incr134637 +Node: Eval135412 +Node: Shell commands139821 +Node: Platform macros140743 +Node: Syscmd142487 +Node: Esyscmd144292 +Node: Sysval145340 +Node: Mkstemp146895 +Node: Miscellaneous150197 +Node: Errprint150630 +Node: Location151849 +Node: M4exit154651 +Node: Frozen files156738 +Node: Using frozen files157519 +Node: Frozen file format160759 +Node: Compatibility163822 +Node: Extensions164437 +Node: Incompatibilities168204 +Node: Other Incompatibilities176116 +Node: Answers178044 +Node: Improved exch178661 +Node: Improved forloop179199 +Node: Improved foreach181035 +Node: Improved cleardivert187974 +Node: Improved fatal_error188957 +Node: Copying This Manual190019 +Node: GNU Free Documentation License190275 +Node: Indices212669 +Node: Concept index212949 +Node: Macro index224692  End Tag Table diff -ruNp m4-1.4.7/doc/m4.texinfo m4-1.4.8/doc/m4.texinfo --- m4-1.4.7/doc/m4.texinfo 2006-09-23 22:28:02.000000000 -0600 +++ m4-1.4.8/doc/m4.texinfo 2006-11-20 06:55:43.000000000 -0700 @@ -91,7 +91,9 @@ running them. @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 @acronym{GNU} M4 distribution. +files @file{m4-@value{VERSION}/@/AUTHORS} and +@file{m4-@value{VERSION}/@/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, @@ -113,6 +115,7 @@ changeword will go away and @emph{you sh @menu * Preliminaries:: Introduction and preliminaries +* Invoking m4:: Invoking @code{m4} * Syntax:: Lexical and syntactic conventions * Macros:: How to invoke macros @@ -143,10 +146,18 @@ Introduction and preliminaries * Intro:: Introduction to @code{m4} * History:: Historical references -* Invoking m4:: Invoking @code{m4} * Bugs:: Problems and bugs * Manual:: Using this manual +Invoking @code{m4} + +* Operation modes:: Command line options for operation modes +* Preprocessor features:: Command line options for preprocessor features +* Limits control:: Command line options for limits control +* Frozen state:: Command line options for frozen state +* Debugging options:: Command line options for debugging +* Command line files:: Specifying input files on the command line + Lexical and syntactic conventions * Names:: Macro names @@ -179,7 +190,9 @@ Conditionals, loops, and recursion * Ifdef:: Testing if a macro is defined * Ifelse:: If-else construct, or multibranch -* Loops:: Loops and recursion in m4 +* Shift:: Recursion in @code{m4} +* Forloop:: Iteration by counting +* Foreach:: Iteration by list contents How to debug macros and input @@ -206,7 +219,7 @@ Diverting and undiverting output * Divert:: Diverting output * Undivert:: Undiverting output * Divnum:: Diversion numbers -* Cleardiv:: Discarding diverted text +* Cleardivert:: Discarding diverted text Macros for text handling @@ -229,7 +242,7 @@ Macros for running shell commands * Syscmd:: Executing simple commands * Esyscmd:: Reading the output of commands * Sysval:: Exit status -* Maketemp:: Making temporary files +* Mkstemp:: Making temporary files Miscellaneous builtin macros @@ -248,6 +261,14 @@ Compatibility with other versions of @co * Incompatibilities:: Facilities in System V m4 not in GNU M4 * Other Incompatibilities:: Other incompatibilities +Correct version of some examples + +* Improved exch:: Solution for @code{exch} +* Improved forloop:: Solution for @code{forloop} +* Improved foreach:: Solution for @code{foreach} +* Improved cleardivert:: Solution for @code{cleardivert} +* Improved fatal_error:: Solution for @code{fatal_error} + How to make copies of this manual * GNU Free Documentation License:: License for copying this manual @@ -274,7 +295,6 @@ language. @menu * Intro:: Introduction to @code{m4} * History:: Historical references -* Invoking m4:: Invoking @code{m4} * Bugs:: Problems and bugs * Manual:: Using this manual @end menu @@ -360,14 +380,108 @@ addressed some long standing bugs in the Then in 2005 Gary V. Vaughan collected together the many 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, 1.4.6, and 1.4.7. +prepared patches for the release of 1.4.5, 1.4.6, 1.4.7, and 1.4.8. Meanwhile, development has continued on new features for @code{m4}, such as dynamic module loading and additional builtins. When complete, @acronym{GNU} @code{m4} 2.0 will start a new series of releases. +@node Bugs +@section Problems and bugs + +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 +whether you should be able to do something or not, report that too; it's +a bug in the documentation! + +Before reporting a bug or trying to fix it yourself, try to isolate it +to the smallest possible input file that reproduces the problem. Then +send us the input file and the exact results @code{m4} gave you. Also +say what you expected to occur; this will help us decide whether the +problem was really in the documentation. + +Once you've got a precise problem, send e-mail to (Internet) +@email{bug-m4@@gnu.org}. Please include the version number of @code{m4} +you are using. You can get this information with the command +@kbd{m4 --version}. Also provide details about the platform you are +executing on. + +Non-bug suggestions are always welcome as well. If you have questions +about things that are unclear in the documentation or are just obscure +features, please report them too. + +@node Manual +@section Using this manual + +This manual contains a number of examples of @code{m4} input and output, +and a simple notation is used to distinguish input, output and error +messages from @code{m4}. Examples are set out from the normal text, and +shown in a fixed width font, like this + +@comment ignore +@example +This is an example of an example! +@end example + +To distinguish input from output, all output from @code{m4} is prefixed +by the string @samp{@result{}}, and all error messages by the string +@samp{@error{}}. Thus + +@comment ignore +@example +Example of input line +@result{}Output line from m4 +@error{}and an error message +@end example + +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 @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 +arguments, e.g., + +@deffn Composite example (@var{string}, @dvar{count, 1}, @ + @ovar{argument}@dots{}) +This is a sample prototype. There is not really a macro named +@code{example}, but this documents that if there were, it would be a +Composite macro, rather than a Builtin. It requires at least one +argument, @var{string}. Remember that in @code{m4}, there must not be a +space between the macro name and the opening parenthesis, unless it was +intended to call the macro without any arguments. The brackets around +@var{count} and @var{argument} show that these arguments are optional. +If @var{count} is omitted, the macro behaves as if count were @samp{1}, +whereas if @var{argument} is omitted, the macro behaves as if it were +the empty string. A blank argument is not the same as an omitted +argument. For example, @samp{example(`a')}, @samp{example(`a',`1')}, +and @samp{example(`a',`1',)} would behave identically with @var{count} +set to @samp{1}; while @samp{example(`a',)} and @samp{example(`a',`')} +would explicitly pass the empty string for @var{count}. The ellipses +(@samp{@dots{}}) show that the macro processes additional arguments +after @var{argument}, rather than ignoring them. +@end deffn + +All macro arguments in @code{m4} are strings, but some are given +special interpretation, e.g., as numbers, file names, regular +expressions, etc. The documentation for each macro will state how the +parameters are interpreted, and what happens if the argument cannot be +parsed according to the desired interpretation. Unless specified +otherwise, a parameter specified to be a number is parsed as a decimal, +even if the argument has leading zeros; and parsing the empty string as +a number results in 0 rather than an error, although a warning will be +issued. + +This document consistently writes and uses @dfn{builtin}, without a +hyphen, as if it were an English word. This is how the @code{builtin} +primitive is spelled within @code{m4}. + @node Invoking m4 -@section Invoking @code{m4} +@chapter Invoking @code{m4} The format of the @code{m4} command is: @@ -381,39 +495,57 @@ The format of the @code{m4} command is: @cindex @env{POSIXLY_CORRECT} All options begin with @samp{-}, or if long option names are used, with @samp{--}. A long option name need not be written completely, any -unambiguous prefix is sufficient. Unless @env{POSIXLY_CORRECT} is set -in the environment, options may be intermixed with files. The argument -@option{--} is a marker to denote the end of options. +unambiguous prefix is sufficient. @acronym{POSIX} requires @code{m4} to +recognize arguments intermixed with files, even when +@env{POSIXLY_CORRECT} is set in the environment. Most options take +effect at startup regardless of their position, but some are documented +below as taking effect after any files that occurred earlier in the +command line. The argument @option{--} is a marker to denote the end of +options. With short options, options that do not take arguments may be combined into a single command line argument with subsequent options, options with mandatory arguments may be provided either as a single command line argument or as two arguments, and options with optional arguments must -be provided as a single argument. In other words, without -@env{POSIXLY_CORRECT}, @kbd{m4 -QPDfoo -d a -d+f} is equivalent to -@kbd{m4 -Q -P -D foo -d -d+f -- a}, although the latter form is -considered canonical. (With @env{POSIXLY_CORRECT}, it is equivalent to -@kbd{m4 -Q -P -D foo -d -- a ./-d+f}). +be provided as a single argument. In other words, +@kbd{m4 -QPDfoo -d a -d+f} is equivalent to +@kbd{m4 -Q -P -D foo -d -d+f -- ./a}, although the latter form is +considered canonical. With long options, options with mandatory arguments may be provided with an equal sign (@samp{=}) in a single argument, or as two arguments, and options with optional arguments must be provided as a single argument. In other words, @kbd{m4 --def foo --debug a} is equivalent to -@kbd{m4 --define=foo --debug= -- a}, although the latter form is +@kbd{m4 --define=foo --debug= -- ./a}, although the latter form is considered canonical (not to mention more robust, in case a future version of @code{m4} introduces an option named @option{--default}). @code{m4} understands the following options, grouped by functionality. + +@menu +* Operation modes:: Command line options for operation modes +* Preprocessor features:: Command line options for preprocessor features +* Limits control:: Command line options for limits control +* Frozen state:: Command line options for frozen state +* Debugging options:: Command line options for debugging +* Command line files:: Specifying input files on the command line +@end menu + +@node Operation modes +@section Command line options for operation modes + Several options control the overall operation of @code{m4}: @table @code @item --help Print a help summary on standard output, then immediately exit -@code{m4} without reading any input files. +@code{m4} without reading any input files or performing any other +actions. @item --version Print the version number of the program on standard output, then -immediately exit @code{m4} without reading any input files. +immediately exit @code{m4} without reading any input files or +performing any other actions. @item -E @itemx --fatal-warnings @@ -446,10 +578,13 @@ 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 @acronym{GNU} @code{m4} +experimental option will not be present in all @acronym{GNU} @code{m4} implementations (@pxref{Changeword}). @end table +@node Preprocessor features +@section Command line options for preprocessor features + @cindex macro definitions, on the command line @cindex command line, macro definitions on the Several options allow @code{m4} to behave more like a preprocessor. @@ -464,8 +599,9 @@ This enters @var{NAME} into the symbol t 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 defined to take arguments, just as if it was defined from within the -input. This option may be given more than once; order is significant, -and redefining the same @var{NAME} loses the previous value. +input. This option may be given more than once; order with respect to +file names is significant, and redefining the same @var{NAME} loses the +previous value. @item -I @var{DIRECTORY} @itemx --include=@var{DIRECTORY} @@ -476,7 +612,8 @@ details. This option may be given more @item -s @itemx --synclines Generate synchronization lines, for use by the C preprocessor or other -similar tools. This is useful, for example, when @code{m4} is used as a +similar tools. Order is significant with respect to file names. This +option is useful, for example, when @code{m4} is used as a front end to a compiler. Source file name and line number information is conveyed by directives of the form @samp{#line @var{linenum} "@var{file}"}, which are inserted as needed into the middle of the @@ -495,13 +632,18 @@ until the beginning of the next generate This deletes any predefined meaning @var{NAME} might have. Obviously, only predefined macros can be deleted in this way. This option may be given more than once; undefining a @var{NAME} that does not have a -definition is silently ignored. +definition is silently ignored. Order is significant with respect to +file names. @end table +@node Limits control +@section Command line options for limits control + 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 @acronym{GNU} @code{m4}. +only by your hardware and operating system constraints) in @acronym{GNU} +@code{m4}. @table @code @item -G @@ -520,7 +662,9 @@ increase this value, unless you define a @itemx --nesting-limit=@var{NUM} Artificially limit the nesting of macro calls to @var{NUM} levels, stopping program execution if this limit is ever exceeded. When not -specified, nesting is limited to 1024 levels. +specified, nesting is limited to 1024 levels. A value of zero means +unlimited; but then heavily nested code could potentially cause a stack +overflow. The precise effect of this option might be more correctly associated with textual nesting than dynamic recursion. It has been useful @@ -555,6 +699,9 @@ because there is no fixed limit anymore. releases, and issue a warning to that effect. @end table +@node Frozen state +@section Command line options for frozen 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. @@ -574,6 +721,9 @@ frozen @var{FILE}. The options @option{ files are read. @end table +@node Debugging options +@section Command line options for debugging + Finally, there are several options for aiding in debugging @code{m4} scripts. @@ -608,14 +758,18 @@ unlimited. @xref{Debug Levels}, for mor @itemx --trace=@var{NAME} This enables tracing for the macro @var{NAME}, at any point where it is defined. @var{NAME} need not be defined when this option is given. -This option may be given more than once. @xref{Trace}, for more details. +This option may be given more than once, and order is significant with +respect to file names. @xref{Trace}, for more details. @end table +@node Command line files +@section Specifying input files on the command line + @cindex command line, file names on the @cindex file names, on the command line The remaining arguments on the command line are taken to be input file -names. If no names are present, the standard input is read. A file -name of @file{-} is taken to mean the standard input. It is +names. If no names are present, standard input is read. A file +name of @file{-} is taken to mean standard input. It is conventional, but not required, for input files to end in @samp{.m4}. The input files are read in the sequence given. Standard input can be @@ -625,6 +779,11 @@ terminal or other special file type. It ends in the middle of argument collection, a comment, or a quoted string. +The options @option{--define} (@option{-D}), @option{--undefine} +(@option{-U}), @option{--synclines} (@option{-s}), and @option{--trace} +(@option{-t}) only take effect after processing input from any file +names that occur earlier on the command line. + If none of the input files invoked @code{m4exit} (@pxref{M4exit}), the 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 @@ -634,100 +793,6 @@ If you need to read a file whose name st specify it as @samp{./-file}, or use @option{--} to mark the end of options. -@node Bugs -@section Problems and bugs - -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 -whether you should be able to do something or not, report that too; it's -a bug in the documentation! - -Before reporting a bug or trying to fix it yourself, try to isolate it -to the smallest possible input file that reproduces the problem. Then -send us the input file and the exact results @code{m4} gave you. Also -say what you expected to occur; this will help us decide whether the -problem was really in the documentation. - -Once you've got a precise problem, send e-mail to (Internet) -@email{bug-m4@@gnu.org}. Please include the version number of @code{m4} -you are using. You can get this information with the command @samp{m4 ---version}. Also provide details about the platform you are executing -on. - -Non-bug suggestions are always welcome as well. If you have questions -about things that are unclear in the documentation or are just obscure -features, please report them too. - -@node Manual -@section Using this manual - -This manual contains a number of examples of @code{m4} input and output, -and a simple notation is used to distinguish input, output and error -messages from @code{m4}. Examples are set out from the normal text, and -shown in a fixed width font, like this - -@comment ignore -@example -This is an example of an example! -@end example - -To distinguish input from output, all output from @code{m4} is prefixed -by the string @samp{@result{}}, and all error messages by the string -@samp{@error{}}. Thus - -@comment ignore -@example -Example of input line -@result{}Output line from m4 -@error{}and an error message -@end example - -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 @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 -arguments, e.g., - -@deffn Composite example (@var{string}, @dvar{count, 1}, @ - @ovar{argument}@dots{}) -This is a sample prototype. There is not really a macro named -@code{example}, but this documents that if there were, it would be a -Composite macro, rather than a Builtin. It requires at least one -argument, @var{string}. Remember that in @code{m4}, there must not be a -space between the macro name and the opening parenthesis, unless it was -intended to call the macro without any arguments. The brackets around -@var{count} and @var{argument} show that these arguments are optional. -If @var{count} is omitted, the macro behaves as if count were @samp{1}, -whereas if @var{argument} is omitted, the macro behaves as if it were -the empty string. A blank argument is not the same as an omitted -argument. For example, @samp{example(`a')}, @samp{example(`a',`1')}, -and @samp{example(`a',`1',)} would behave identically with @var{count} -set to @samp{1}; while @samp{example(`a',)} and @samp{example(`a',`')} -would explicitly pass the empty string for @var{count}. The ellipses -(@samp{@dots{}}) show that the macro processes additional arguments -after @var{argument}, rather than ignoring them. -@end deffn - -All macro arguments in @code{m4} are strings, but some are given -special interpretation, e.g., as numbers, file names, regular -expressions, etc. The documentation for each macro will state how the -parameters are interpreted, and what happens if the argument cannot be -parsed according to the desired interpretation. Unless specified -otherwise, a parameter specified to be a number is parsed as a decimal, -even if the argument has leading zeros; and parsing the empty string as -a number results in 0 rather than an error, although a warning will be -issued. - -This document consistently writes and uses @dfn{builtin}, without a -hyphen, as if it were an English word. This is how the @code{builtin} -primitive is spelled within @code{m4}. - @node Syntax @chapter Lexical and syntactic conventions @@ -755,7 +820,7 @@ exception of the @sc{nul} character (the @section Macro names @cindex names -A name is any sequence of letters, digits, and the character @kbd{_} +A name is any sequence of letters, digits, and the character @samp{_} (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 @@ -769,7 +834,7 @@ Examples of legal names are: @samp{foo}, @cindex quoted string 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 +@samp{`} and @samp{'}, 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 @@ -877,7 +942,7 @@ round of scanning for the tokens @samp{R @end example The order in which @code{m4} expands the macros can be explored using -the @ref{Trace} facilities of @acronym{GNU} @code{m4}. +the trace facilities of @acronym{GNU} @code{m4} (@pxref{Trace}). This process continues until there are no more macro calls to expand and all the input has been consumed. @@ -956,9 +1021,9 @@ call is not triggered. This solves the specific provision. There is also a command line option (@option{--prefix-builtins}, or -@option{-P}, @pxref{Invoking m4}) that renames all builtin macro with a -prefix of @samp{m4_} at startup. The option has no effect -whatsoever on user defined macros. For example, with this option, +@option{-P}, @pxref{Operation modes, , Invoking m4}) that renames all +builtin macros with a prefix of @samp{m4_} at startup. 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}. It also has no effect on whether a macro requires parameters. @@ -1060,14 +1125,37 @@ If the name is followed by an opening pa collected before the macro is called. If too few arguments are supplied, the missing arguments are taken to be the empty string. However, some builtins are documented to behave differently for a -missing optional argument than for an explicit empty string. If -there are too many arguments, the excess arguments are ignored. -Unquoted leading whitespace is stripped off all arguments. +missing optional argument than for an explicit empty string. If there +are too many arguments, the excess arguments are ignored. Unquoted +leading whitespace is stripped off all arguments, but whitespace +generated by a macro expansion or occuring after a macro that expanded +to an empty string remains intact. Whitespace includes space, tab, +newline, carriage return, vertical tab, and formfeed. + +@example +define(`macro', `$1') +@result{} +macro( unquoted leading space lost) +@result{}unquoted leading space lost +macro(` quoted leading space kept') +@result{} quoted leading space kept +macro( + divert `unquoted space kept after expansion') +@result{} unquoted space kept after expansion +macro(macro(` +')`whitespace from expansion kept') +@result{} +@result{}whitespace from expansion kept +macro(`unquoted trailing whitespace kept' +) +@result{}unquoted trailing whitespace kept +@result{} +@end example 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{--quiet} command line option (or @option{--silent}, or -@option{-Q}, @pxref{Invoking m4}). For user +@option{-Q}, @pxref{Operation modes, , 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 @@ -1083,7 +1171,7 @@ bar(a foo, d) @noindent is a macro call with four arguments, which are @samp{a }, @samp{b}, @samp{c} and @samp{d}. To understand why the first argument contains -whitespace, remember that leading unquoted whitespace is never part +whitespace, remember that unquoted leading whitespace is never part of an argument, but trailing whitespace always is. It is possible for a macro's definition to change during argument @@ -1102,9 +1190,11 @@ f It is an error if the end of file occurs while collecting arguments. @example +hello world +@result{}hello world define( ^D -@error{}m4:stdin:1: ERROR: end of file in argument list +@error{}m4:stdin:2: ERROR: end of file in argument list @end example @node Quoting Arguments @@ -1113,7 +1203,7 @@ define( @cindex quoted macro arguments @cindex macros, quoted arguments to @cindex arguments, quoted macro -Each argument has leading unquoted whitespace removed. Within each +Each argument has unquoted leading whitespace removed. Within each argument, all unquoted parentheses must match. For example, if @var{foo} is a macro, @@ -1125,7 +1215,7 @@ foo(() (`(') `(') @noindent is a macro call, with one argument, whose value is @samp{() (() (}. Commas separate arguments, except when they occur inside quotes, -comments, or unquoted parentheses, @xref{Pseudo Arguments}, for +comments, or unquoted parentheses. @xref{Pseudo Arguments}, for examples. It is common practice to quote all arguments to macros, unless you are @@ -1244,8 +1334,8 @@ As a @acronym{GNU} extension, the first not have to be a simple word. It can be any text string, even the empty string. A macro with a non-standard name cannot be invoked in the normal way, as the name is -not recognized. It can only be referenced by the builtins @ref{Indir} -and @ref{Defn}. +not recognized. It can only be referenced by the builtins @code{Indir} +(@pxref{Indir}) and @code{Defn} (@pxref{Defn}). @cindex arrays Arrays and associative arrays can be simulated by using this trick. @@ -1300,7 +1390,7 @@ macro @xref{Quoting Arguments}, for an explanation of the double quotes. (You should try and improve this example so that clients of @code{exch} -do not have to double quote. @pxref{Answers}) +do not have to double quote; or @pxref{Improved exch, , Answers}). @cindex @acronym{GNU} extensions @acronym{GNU} @code{m4} allows the number following the @samp{$} to @@ -1574,7 +1664,7 @@ define(`string', `The macro dnl is very ') @result{} string -@result{}The macro @comment +@result{}The macro@w{ } defn(`string') @result{}The macro dnl is very useful @result{} @@ -1715,10 +1805,10 @@ and @code{defn}. @cindex @acronym{GNU} extensions Any macro can be called indirectly with @code{indir}: -@deffn Builtin indir (@var{name}, @dots{}) +@deffn Builtin indir (@var{name}, @ovar{args@dots{}}) Results in a call to the macro @var{name}, which is passed the -rest of the arguments. If @var{name} is not defined, an error message -is printed, and the expansion is void. +rest of the arguments @var{args}. If @var{name} is not defined, an +error message is printed, and the expansion is void. The macro @code{indir} is recognized only with parameters. @end deffn @@ -1758,6 +1848,27 @@ indir(`f', undefine(`f')) @result{} @end example +When handed the result of @code{defn} (@pxref{Defn}) as one of its +arguments, @code{indir} defers to the invoked @var{name} for whether a +token representing a builtin is recognized or flattened to the empty +string. + +@example +indir(defn(`defn'), `divnum') +@error{}m4:stdin:1: Warning: indir: invalid macro name ignored +@result{} +indir(`define', defn(`defn'), `divnum') +@error{}m4:stdin:2: Warning: define: invalid macro name ignored +@result{} +indir(`define', `foo', defn(`divnum')) +@result{} +foo +@result{}0 +indir(`divert', defn(`foo')) +@error{}m4:stdin:5: empty string treated as 0 in builtin `divert' +@result{} +@end example + @node Builtin @section Indirect call of builtins @@ -1767,10 +1878,10 @@ indir(`f', undefine(`f')) @cindex @acronym{GNU} extensions Builtin macros can be called indirectly with @code{builtin}: -@deffn Builtin builtin (@var{name}, @dots{}) +@deffn Builtin builtin (@var{name}, @ovar{args@dots{}}) Results in a call to the builtin @var{name}, which is passed the -rest of the arguments. If @var{name} does not name a builtin, an error -message is printed, and the expansion is void. +rest of the arguments @var{args}. If @var{name} does not name a +builtin, an error message is printed, and the expansion is void. The macro @code{builtin} is recognized only with parameters. @end deffn @@ -1788,6 +1899,10 @@ define(`foo', `bar') @result{}hidden foo @result{}foo +builtin(`define', `foo', defn(`divnum')) +@result{} +foo +@result{}0 builtin(`define', `foo', `BAR') @result{} foo @@ -1804,8 +1919,8 @@ foo The @var{name} argument only matches the original name of the builtin, even when the @option{--prefix-builtins} option (or @option{-P}, -@pxref{Invoking m4}) is in effect. This is different from @code{indir}, -which only tracks current macro names. +@pxref{Operation modes, , Invoking m4}) is in effect. This is different +from @code{indir}, which only tracks current macro names. Note that @code{indir} and @code{builtin} can be used to invoke builtins without arguments, even when they normally require parameters to be @@ -1837,7 +1952,9 @@ something a number of times, or while so @menu * Ifdef:: Testing if a macro is defined * Ifelse:: If-else construct, or multibranch -* Loops:: Loops and recursion in m4 +* Shift:: Recursion in @code{m4} +* Forloop:: Iteration by counting +* Foreach:: Iteration by list contents @end menu @node Ifdef @@ -1966,8 +2083,8 @@ Naturally, the normal case will be sligh examples. A common use of @code{ifelse} is in macros implementing loops of various kinds. -@node Loops -@section Loops and recursion +@node Shift +@section Recursion in @code{m4} @cindex recursive macros @cindex macros, recursive @@ -2001,7 +2118,7 @@ shift(`foo', `bar', `baz') An example of the use of @code{shift} is this macro: @deffn Composite reverse (@dots{}) -Takes any number of arguments, and reverse their order. +Takes any number of arguments, and reverses their order. @end deffn It is implemented as: @@ -2020,7 +2137,70 @@ reverse(`foo', `bar', `gnats', `and gnus While not a very interesting macro, it does show how simple loops can be made with @code{shift}, @code{ifelse} and recursion. It also shows -that @code{shift} is usually used with @samp{$@@}. +that @code{shift} is usually used with @samp{$@@}. Sometimes, a +recursive algorithm requires adding quotes to each element: + +@deffn Composite quote (@dots{}) +@deffnx Composite dquote (@dots{}) +@deffnx Composite dquote_elt (@dots{}) +Takes any number of arguments, and adds quoting. With @code{quote}, +only one level of quoting is added, effectively removing whitespace +after commas and turning multiple arguments into a single string. With +@code{dquote}, two levels of quoting are added, one around each element, +and one around the list. And with @code{dquote_elt}, two levels of +quoting are added around each element. +@end deffn + +An actual implementation of these three macros is distributed as +@file{m4-@value{VERSION}/@/examples/@/quote.m4} in this package. First, +let's examine their usage: + +@example +include(`quote.m4') +@result{} +-quote-dquote-dquote_elt- +@result{}---- +-quote()-dquote()-dquote_elt()- +@result{}--`'-`'- +-quote(`1')-dquote(`1')-dquote_elt(`1')- +@result{}-1-`1'-`1'- +-quote(`1', `2')-dquote(`1', `2')-dquote_elt(`1', `2')- +@result{}-1,2-`1',`2'-`1',`2'- +define(`n', `$#')dnl +-n(quote(`1', `2'))-n(dquote(`1', `2'))-n(dquote_elt(`1', `2'))- +@result{}-1-1-2- +dquote(dquote_elt(`1', `2')) +@result{}``1'',``2'' +dquote_elt(dquote(`1', `2')) +@result{}``1',`2'' +@end example + +The last two lines show that when given two arguments, @code{dquote} +results in one string, while @code{dquote_elt} results in two. Now, +examine the implementation. Note that @code{quote} and +@code{dquote_elt} make decisions based on their number of arguments, so +that when called without arguments, they result in nothing instead of a +quoted empty string; this is so that it is possible to distinquish +between no arguments and an empty first argument. @code{dquote}, on the +other hand, results in a string no matter what, since it is still +possible to tell whether it was invoked without arguments based on the +resulting string. + +@example +undivert(`quote.m4')dnl +@result{}divert(`-1') +@result{}# quote(args) - convert args to single-quoted string +@result{}define(`quote', `ifelse(`$#', `0', `', ``$*'')') +@result{}# dquote(args) - convert args to quoted list of quoted strings +@result{}define(`dquote', ``$@@'') +@result{}# dquote_elt(args) - convert args to list of double-quoted strings +@result{}define(`dquote_elt', `ifelse(`$#', `0', `', `$#', `1', ```$1''', +@result{} ```$1'',$0(shift($@@))')') +@result{}divert`'dnl +@end example + +@node Forloop +@section Iteration by counting @cindex for loops @cindex loops, counting @@ -2042,7 +2222,7 @@ It can, for example, be used for simple include(`forloop.m4') @result{} forloop(`i', `1', `8', `i ') -@result{}1 2 3 4 5 6 7 8 @comment +@result{}1 2 3 4 5 6 7 8@w{ } @end example For-loops can be nested, like: @@ -2062,39 +2242,184 @@ forloop(`i', `1', `4', `forloop(`j', `1' The implementation of the @code{forloop} macro is fairly straightforward. The @code{forloop} macro itself is simply a wrapper, which saves the previous definition of the first argument, calls the -internal macro @code{_forloop}, and re-establishes the saved definition of -the first argument. +internal macro @code{@w{_forloop}}, and re-establishes the saved +definition of the first argument. -The macro @code{_forloop} expands the fourth argument once, and tests -to see if it is finished. If it has not finished, it increments -the iteration variable (using the predefined macro @code{incr}, -@pxref{Incr}), and recurses. +The macro @code{@w{_forloop}} expands the fourth argument once, and +tests to see if the iterator has reached the final value. If it has +not finished, it increments the iterator (using the predefined macro +@code{incr}, @pxref{Incr}), and recurses. -Here is the actual implementation of @code{forloop}, distributed as -@file{examples/@/forloop.m4} in this package: +Here is an actual implementation of @code{forloop}, distributed as +@file{m4-@value{VERSION}/@/examples/@/forloop.m4} in this package: @example -undivert(`forloop.m4') +undivert(`forloop.m4')dnl @result{}divert(`-1') -@result{}# forloop(var, from, to, stmt) -@result{}define(`forloop', -@result{} `pushdef(`$1', `$2')_forloop(`$1', `$2', `$3', `$4')popdef(`$1')') +@result{}# forloop(var, from, to, stmt) - simple version +@result{}define(`forloop', `pushdef(`$1', `$2')_forloop($@@)popdef(`$1')') @result{}define(`_forloop', -@result{} `$4`'ifelse($1, `$3', , -@result{} `define(`$1', incr($1))_forloop(`$1', `$2', `$3', `$4')')') +@result{} `$4`'ifelse($1, `$3', `', `define(`$1', incr($1))$0($@@)')') @result{}divert`'dnl -@result{} @end example -Notice the careful use of quotes. Only three macro arguments are +Notice the careful use of quotes. Certain macro arguments are left unquoted, each for its own reason. Try to find out @emph{why} these -three arguments are left unquoted, and see what happens if they are -quoted. +arguments are left unquoted, and see what happens if they are quoted. +(As presented, these two macros are useful but not very robust for +general use. They lack even basic error handling for cases like +@var{start} less than @var{end}, @var{end} not numeric, or +@var{iterator} not being a macro name. See if you can improve these +macros; or @pxref{Improved forloop, , Answers}). + +@node Foreach +@section Iteration by list contents + +@cindex for each loops +@cindex loops, list iteration +@cindex iterating over lists +Here is an example of a loop macro that implements list iteration. + +@deffn Composite foreach (@var{iterator}, @var{paren-list}, @var{text}) +@deffnx Composite foreachq (@var{iterator}, @var{quote-list}, @var{text}) +Takes the name in @var{iterator}, which must be a valid macro name, and +successively assign it each value from @var{paren-list} or +@var{quote-list}. In @code{foreach}, @var{paren-list} is a +comma-separated list of elements contained in parentheses. In +@code{foreachq}, @var{quote-list} is a comma-separated list of elements +contained in a quoted string. For each assignment to @var{iterator}, +append @var{text} to the overall expansion. @var{text} may refer to +@var{iterator}. Any definition of @var{iterator} prior to this +invocation is restored. +@end deffn + +As an example, this displays each word in a list inside of a sentence, +using an implementation of @code{foreach} distributed as +@file{m4-@value{VERSION}/@/examples/@/foreach.m4}, and @code{foreachq} +in @file{m4-@value{VERSION}/@/examples/@/foreachq.m4}. + +@example +include(`foreach.m4') +@result{} +foreach(`x', (foo, bar, foobar), `Word was: x +')dnl +@result{}Word was: foo +@result{}Word was: bar +@result{}Word was: foobar +include(`foreachq.m4') +@result{} +foreachq(`x', `foo, bar, foobar', `Word was: x +')dnl +@result{}Word was: foo +@result{}Word was: bar +@result{}Word was: foobar +@end example + +It is possible to be more complex; each element of the @var{paren-list} +or @var{quote-list} can itself be a list, to pass as further arguments +to a helper macro. This example generates a shell case statement: + +@example +include(`foreach.m4') +@result{} +define(`_case', ` $1) + $2=" $1";; +')dnl +define(`_cat', `$1$2')dnl +case $`'1 in +@result{}case $1 in +foreach(`x', `(`(`a', `vara')', `(`b', `varb')', `(`c', `varc')')', + `_cat(`_case', x)')dnl +@result{} a) +@result{} vara=" a";; +@result{} b) +@result{} varb=" b";; +@result{} c) +@result{} varc=" c";; +esac +@result{}esac +@end example + +The implementation of the @code{foreach} macro is a bit more involved; +it is a wrapper around two helper macros. First, @code{@w{_arg1}} is +needed to grab the first element of a list. Second, +@code{@w{_foreach}} implements the recursion, successively walking +through the original list. Here is a simple implementation of +@code{foreach}: + +@example +undivert(`foreach.m4')dnl +@result{}divert(`-1') +@result{}# foreach(x, (item_1, item_2, ..., item_n), stmt) +@result{}# parenthesized list, simple version +@result{}define(`foreach', `pushdef(`$1')_foreach($@@)popdef(`$1')') +@result{}define(`_arg1', `$1') +@result{}define(`_foreach', `ifelse(`$2', `()', `', +@result{} `define(`$1', _arg1$2)$3`'$0(`$1', (shift$2), `$3')')') +@result{}divert`'dnl +@end example + +Unfortunately, that implementation is not robust to macro names as list +elements. Each iteration of @code{@w{_foreach}} is stripping another +layer of quotes, leading to erratic results if list elements are not +already fully expanded. The first cut at implementing @code{foreachq} +takes this into account. Also, when using quoted elements in a +@var{paren-list}, the overall list must be quoted. A @var{quote-list} +has the nice property of requiring fewer characters to create a list +containing the same quoted elements. To see the difference between the +two macros, we attempt to pass double-quoted macro names in a list, +expecting the macro name on output after one layer of quotes is removed +during list iteration and the final layer removed during the final +rescan: + +@example +define(`a', `1')define(`b', `2')define(`c', `3') +@result{} +include(`foreach.m4') +@result{} +include(`foreachq.m4') +@result{} +foreach(`x', `(``a'', ``(b'', ``c)'')', `x +') +@result{}1 +@result{}(2)1 +@result{} +@result{}, x +@result{}) +foreachq(`x', ```a'', ``(b'', ``c)''', `x +')dnl +@result{}a +@result{}(b +@result{}c) +@end example -Now, even though these two macros are useful, they are still not robust -enough for general use. They lack even basic error handling of cases -like start value less than final value, and the first argument not being -a name. Correcting these errors are left as an exercise to the reader. +Obviously, @code{foreachq} did a better job; here is its implementation: + +@example +undivert(`foreachq.m4')dnl +@result{}include(`quote.m4')dnl +@result{}divert(`-1') +@result{}# foreachq(x, `item_1, item_2, ..., item_n', stmt) +@result{}# quoted list, simple version +@result{}define(`foreachq', `pushdef(`$1')_foreachq($@@)popdef(`$1')') +@result{}define(`_arg1', `$1') +@result{}define(`_foreachq', `ifelse(quote($2), `', `', +@result{} `define(`$1', `_arg1($2)')$3`'$0(`$1', `shift($2)', `$3')')') +@result{}divert`'dnl +@end example + +Notice that @code{@w{_foreachq}} had to use the helper macro +@code{quote} defined earlier (@pxref{Shift}), to ensure that the +embedded @code{ifelse} call does not go haywire if a list element +contains a comma. Unfortunately, this implementation of @code{foreachq} +has its own severe flaw. Whereas the @code{foreach} implementation was +linear, this macro is quadratic in the number of list elements, and is +much more likely to trip up the limit set by the command line option +@option{--nesting-limit} (or @option{-L}, @pxref{Limits control, , +Invoking m4}). (It is possible to have robust iteration with linear +behavior for either list style. See if you can learn from the best +elements of both of these implementations to create robust macros; or +@pxref{Improved foreach, , Answers}). @node Debugging @chapter How to debug macros and input @@ -2119,10 +2444,10 @@ Fortunately, there is support for macro If you want to see what a name expands into, you can use the builtin @code{dumpdef}: -@deffn Builtin dumpdef (@dots{}) +@deffn Builtin dumpdef (@ovar{names@dots{}}) Accepts any number of arguments. If called without any arguments, it displays the definitions of all known names, otherwise it displays -the definitions of the names given. The output is printed to the +the definitions of the @var{names} given. The output is printed to the current debug file (usually standard error), and is sorted by name. If an unknown name is encountered, a warning is printed. @@ -2168,12 +2493,13 @@ display. It is possible to trace macro calls and expansions through the builtins @code{traceon} and @code{traceoff}: -@deffn Builtin traceon (@dots{}) -@deffnx Builtin traceoff (@dots{}) +@deffn Builtin traceon (@ovar{names@dots{}}) +@deffnx Builtin traceoff (@ovar{names@dots{}}) When called without any arguments, @code{traceon} and @code{traceoff} will turn tracing on and off, respectively, for all defined macros. -When called with arguments, only the named macros are affected, whether -or not they are currently defined. + +When called with arguments, only the macros listed in @var{names} are +affected, whether or not they are currently defined. The expansion of @code{traceon} and @code{traceoff} is void. @end deffn @@ -2181,7 +2507,8 @@ The expansion of @code{traceon} and @cod Whenever a traced macro is called and the arguments have been collected, the call is displayed. If the expansion of the macro call is not void, the expansion can be displayed after the call. The output is printed -to the current debug file (usually standard error). +to the current debug file (defaulting to standard error, @pxref{Debug +Output}). @example define(`foo', `Hello World.') @@ -2202,7 +2529,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} (@pxref{Invoking m4}). +option @option{--nesting-limit} (@pxref{Limits control, , 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 @@ -2264,9 +2591,9 @@ display. @cindex controlling debugging output @cindex debugging output, controlling -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 @option{-d} option to @code{m4} (@pxref{Debugging options, , +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: @@ -2366,17 +2693,17 @@ foo @cindex output, saving debugging @cindex @acronym{GNU} extensions Debug and tracing output can be redirected to files using either the -@option{--debugfile} option to @code{m4} (@pxref{Invoking m4}), or with the -builtin macro @code{debugfile}: +@option{--debugfile} option to @code{m4} (@pxref{Debugging options, , +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, error -messages, or @code{errprint} output, which are +Sends all further debug and trace output to @var{file}, opened in append +mode. If @var{file} is the empty string, 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, 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. +current debug file is unchanged, and an error is issued. The expansion of @code{debugfile} is void. @end deffn @@ -2422,7 +2749,8 @@ The builtin @code{dnl} stands for ``Disc @deffn Builtin dnl All characters, up to and including the next newline, are discarded -without performing any macro expansion. +without performing any macro expansion. A warning is issued if the end +of the file is encountered without a newline. The expansion of @code{dnl} is void. @end deffn @@ -2451,7 +2779,7 @@ 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{}m4:stdin:2: Warning: excess arguments to builtin `dnl' ignored +@error{}m4:stdin:1: Warning: excess arguments to builtin `dnl' ignored See how `foo' was defined, foo? @result{}See how foo was defined, like this? @end example @@ -2460,13 +2788,13 @@ If the end of file is encountered withou warning is issued and dnl stops consuming input. @example -define(`hi', `HI') -@result{} m4wrap(`m4wrap(`2 hi ')0 hi dnl 1 hi') @result{} +define(`hi', `HI') +@result{} ^D -@error{}m4: Warning: end of file treated as newline +@error{}m4:stdin:1: Warning: end of file treated as newline @result{}0 HI 2 HI @end example @@ -2479,11 +2807,12 @@ The default quote delimiters can be chan @code{changequote}: @deffn Builtin changequote (@dvar{start, `}, @dvar{end, '}) -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 -@comment be set to newline, not '. +This sets @var{start} as the new begin-quote delimiter and @var{end} as +the new end-quote delimiter. If both arguments are missing, the default +quotes (@code{`} and @code{'}) are used. If @var{start} is void, then +quoting is disabled. Otherwise, if @var{end} is missing or void, the +default end-quote delimiter (@code{'}) is used. The quote delimiters +can be of any length. The expansion of @code{changequote} is void. @end deffn @@ -2499,9 +2828,9 @@ foo 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. +@comment Yuck. I know of no clean way to render an 8-bit character in +@comment both info and dvi. This example uses the `open-guillemot' and +@comment `close-guillemot' characters of the Latin-1 character set. @example define(`a', `b') @@ -2515,7 +2844,8 @@ changequote(`«', `»') @end example @end ignore If no single character is appropriate, @var{start} and @var{end} can be -of any length. +of any length. Other implementations cap the delimiter length to five +characters, but @acronym{GNU} has no inherent limit. @example changequote(`[[[', `]]]') @@ -2526,18 +2856,32 @@ foo @result{}Macro [[foo]]. @end example -Changing the quotes to the empty strings will effectively disable the -quoting mechanism, leaving no way to quote text. +Calling @code{changequote} with @var{start} as the empty string will +effectively disable the quoting mechanism, leaving no way to quote text. +However, using an empty string is not portable, as some other +implementations of @code{m4} revert to the default quoting, while others +preserve the prior non-empty delimiter. If @var{start} is not empty, +then an empty @var{end} will use the default end-quote delimiter of +@samp{'}, as otherwise, it would be impossible to end a quoted string. +Again, this is not portable, as some other @code{m4} implementations +reuse @var{start} as the end-quote delimiter, while others preserve the +previous non-empty value. Omitting both arguments restores the default +begin-quote and end-quote delimiters; fortunately this behavior is +portable to all implementations of @code{m4}. @example define(`foo', `Macro `FOO'.') @result{} -changequote(, ) +changequote(`', `') @result{} foo @result{}Macro `FOO'. `foo' @result{}`Macro `FOO'.' +changequote(`,) +@result{} +foo +@result{}Macro FOO. @end example There is no way in @code{m4} to quote a string containing an unmatched @@ -2550,24 +2894,39 @@ calls of @code{changequote} must be made and one for the new quotes. 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 +prefix of @var{start} can be recognized as part of 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). +should not begin with a letter, digit, or @samp{_} (underscore). +However, even though quoted strings are not recognized, the quote +characters can still be discerned in macro expansion and in trace +output. @example +define(`echo', `$@@') +@result{} define(`hi', `HI') @result{} changequote(`q', `Q') @result{} q hi Q hi @result{}q HI Q HI +echo(hi) +@result{}qHIQ changequote @result{} changequote(`-', `EOF') @result{} - hi EOF hi @result{} hi HI +changequote +@result{} +changequote(`1', `2') +@result{} +hi1hi2 +@result{}hi1hi2 +hi 1hi2 +@result{}HI hi @end example Quotes are recognized in preference to argument collection. In @@ -2632,9 +2991,11 @@ changequote(`"', `"') It is an error if the end of file occurs within a quoted string. @example +`hello world' +@result{}hello world `dangling quote ^D -@error{}m4:stdin:1: ERROR: end of file in string +@error{}m4:stdin:2: ERROR: end of file in string @end example @node Changecom @@ -2645,12 +3006,12 @@ It is an error if the end of file occurs The default comment delimiters can be changed with the builtin macro @code{changecom}: -@deffn Builtin changecom (@ovar{start}, @ovar{end}) -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 -string as the first argument, disables comments. +@deffn Builtin changecom (@ovar{start}, @dvar{end, @key{NL}}) +This sets @var{start} as the new begin-comment delimiter and @var{end} +as the new end-comment delimiter. If both arguments are missing, or +@var{start} is void, then comments are disabled. Otherwise, if +@var{end} is missing or void, the default end-comment delimiter of +newline is used. The comment delimiters can be of any length. The expansion of @code{changecom} is void. @end deffn @@ -2673,10 +3034,14 @@ Note how comments are copied to the outp strings. If you want the text inside a comment expanded, quote the begin-comment delimiter. -Calling @code{changecom} without any arguments, or with an empty string -for the first argument, disables the commenting mechanism completely. -To restore the original comment start of @samp{#}, you must explicitly -ask for it. +Calling @code{changecom} without any arguments, or with @var{start} as +the empty string, will effectively disable the commenting mechanism. To +restore the original comment start of @samp{#}, you must explicitly ask +for it. If @var{start} is not empty, then an empty @var{end} will use +the default end-comment delimiter of newline, as otherwise, it would be +impossible to end a comment. However, this is not portable, as some +other @code{m4} implementations preserve the previous non-empty +delimiters instead. @example define(`comment', `COMMENT') @@ -2685,7 +3050,7 @@ changecom @result{} # Not a comment anymore @result{}# Not a COMMENT anymore -changecom(`#') +changecom(`#', `') @result{} # comment again @result{}# comment again @@ -2693,9 +3058,9 @@ changecom(`#') 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. +@comment Yuck. I know of no clean way to render an 8-bit character in +@comment both info and dvi. This example uses the `open-guillemot' and +@comment `close-guillemot' characters of the Latin-1 character set. @example define(`a', `b') @@ -2708,21 +3073,33 @@ changecom(`«', `»') @result{}«a» @end example @end ignore +If no single character is appropriate, @var{start} and @var{end} can be +of any length. Other implementations cap the delimiter length to five +characters, but @acronym{GNU} has no inherent limit. Comments are recognized in preference to macros. However, this is not compatible with other implementations, where macros and even quoting takes precedence over comments, so it may change in a future release. For portability, this means that @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. +letter, digit, 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{} +define(`hi1hi2', `hello') +@result{} changecom(`q', `Q') @result{} q hi Q hi @result{}q hi Q HI +changecom(`1', `2') +@result{} +hi1hi2 +@result{}hello +hi 1hi2 +@result{}HI 1hi2 @end example Comments are recognized in preference to argument collection. In @@ -2761,7 +3138,7 @@ changecom(`/*', `*/') @result{} /*dangling comment ^D -@error{}m4:stdin:1: ERROR: end of file in comment +@error{}m4:stdin:2: ERROR: end of file in comment @end example @node Changeword @@ -2873,6 +3250,47 @@ foo @result{}bar @end example +@ignore +@comment One more test of including newline in a macro name; but this +@comment does not need to be displayed in the manual. This ensures +@comment that line numbering is correct when dnl cuts across include +@comment file boundaries, and when __file__ or __line__ is the last +@comment token in an include file. + +@example +ifdef(`changeword', `', `errprint(` skipping: no changeword support +')m4exit(`77')')dnl +define(`bar +', defn(`dnl'))dnl +define(`baz', `dnl +include(`foo') ignored +dnl')dnl +changeword(`\([_a-zA-Z][_a-zA-Z0-9]*\|bar +\)') +@result{} +__file__:__line__ +@result{}stdin:10 +include(`foo') ignored +__file__:__line__ +@result{}stdin:12 +baz ignored +__file__:__line__ +@result{}stdin:14 +define(`bar +', defn(`__file__')) +@result{} +include(`foo') +@result{}../examples/foo +define(`bar +', defn(`__line__')) +@result{} +include(`foo') +@result{}1 +__file__:__line__ +@result{}stdin:21 +@end example +@end ignore + @code{changeword} has another function. If the regular expression supplied contains any grouped subexpressions, then text outside the first of these is discarded before symbol lookup. So: @@ -3026,7 +3444,7 @@ file condition between two input files. m4wrap(`m4wrap(`)')len(abc') @result{} ^D -@error{}m4: ERROR: end of file in argument list +@error{}m4:stdin:1: ERROR: end of file in argument list @end example @node File Inclusion @@ -3066,11 +3484,11 @@ parameters. @example include(`none') -@result{} @error{}m4:stdin:1: cannot open `none': No such file or directory -include() @result{} +include() @error{}m4:stdin:2: cannot open `': No such file or directory +@result{} sinclude(`none') @result{} sinclude() @@ -3078,16 +3496,19 @@ sinclude() @end example The rest of this section assumes that @code{m4} is invoked with the -@option{-I} option (@pxref{Invoking m4}) pointing to the @file{examples} +@option{-I} option (@pxref{Preprocessor features, , Invoking m4}) +pointing to the @file{m4-@value{VERSION}/@/examples} directory shipped as part of the @acronym{GNU} @code{m4} package. The -file @file{examples/@/incl.m4} in the distribution contains the lines: +file @file{m4-@value{VERSION}/@/examples/@/incl.m4} in the distribution +contains the lines: + @comment ignore @example Include file start foo Include file end @end example -@noindent + Normally file inclusion is used to insert the contents of a file into the input stream. The contents of the file will be read by @code{m4} and macro calls in the file will be expanded: @@ -3120,11 +3541,13 @@ 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. @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. +the file contents with the next character, even if the included file +ended in the middle of a comment, string, or macro call. These +conditions are only treated as end of file errors if specified as input +files on the command line. + +In @acronym{GNU} @code{m4}, an alternative method of reading files is +using @code{undivert} (@pxref{Undivert}) on a named file. @node Search Path @section Searching for include files @@ -3135,13 +3558,15 @@ command line. @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 (@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. +If the @option{--prepend-include} or @option{-B} command-line option was +provided (@pxref{Preprocessor features, , Invoking m4}), those +directories are searched first, in reverse order that those options were +listed on the command line. Then @code{m4} looks in the current working +directory. Next comes the directories specified with the +@option{--include} or @option{-I} option, in the order found on the +command line. Finally, 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. If the automatic search for include-files causes trouble, the @samp{p} debug flag (@pxref{Debug Levels}) can help isolate the problem. @@ -3162,17 +3587,91 @@ limit to the overall memory usable by al (512K, currently). When this maximum is about to be exceeded, a temporary file is opened to receive the contents of the biggest diversion still in memory, freeing this memory for other diversions. -So, it is theoretically possible that the number of diversions be -limited by the number of available file descriptors. +When creating the temporary file, @code{m4} honors the value of the +environment variable @env{TMPDIR}, and falls back to @file{/tmp}. +So, it is theoretically possible that the number and aggregate size of +diversions is limited only by available disk space. + +@ignore +@comment We need to test spilled diversions, but don't need to expose +@comment this highly repetitive test in the manual. + +@example +divert(`-1')define(`f', `.') +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +divert`'dnl +len(f) +@result{}1048576 +divert(`1') +f +divert(`-1')undivert +@end example + +@comment Another test of spilled diversions. + +@example +divert(`-1')define(`f', `.') +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +divert`'dnl +len(f) +@result{}1048576 +divert(`1') +f +m4exit +@end example +@end ignore -@c FIXME: need some explanation here why this is a useful feature, not -@c just how you use it. +Diversions make it possible to generate output in a different order than +the input was read. It is possible to implement topological sorting +dependencies. For example, @acronym{GNU} Autoconf makes use of +diversions under the hood to ensure that the expansion of a prerequisite +macro appears in the output prior to the expansion of a dependent macro, +regardless of which order the two macros were invoked in the user's +input file. @menu * Divert:: Diverting output * Undivert:: Undiverting output * Divnum:: Diversion numbers -* Cleardiv:: Discarding diverted text +* Cleardivert:: Discarding diverted text @end menu @node Divert @@ -3222,10 +3721,10 @@ m4wrap(`Wrapped text preceeds ') @result{}Wrapped TEXT preceeds diverted text. @end example -If output is diverted to a non-existent diversion, it is simply -discarded. This can be used to suppress unwanted output. A common -example of unwanted output is the trailing newlines after macro -definitions. Here is how to avoid them. +If output is diverted to a negative diversion, it is simply discarded. +This can be used to suppress unwanted output. A common example of +unwanted output is the trailing newlines after macro definitions. Here +is a common programming idiom in @code{m4} for avoiding them. @example divert(`-1') @@ -3235,23 +3734,35 @@ divert @result{} @end example -This is a common programming idiom in @code{m4}. +@cindex @acronym{GNU} extensions +Traditional implementations only supported ten diversions. But as a +@acronym{GNU} extension, diversion numbers can be as large as positive +integers will allow, rather than treating a multi-digit diversion number +as a request to discard text. + +@example +divert(eval(`1<<28'))world +divert(`2')hello +^D +@result{}hello +@result{}world +@end example 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. +builtins (@pxref{Operation modes, , 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) +divert(`-1') Ignored text. -divert(0) +divert(`0') @result{} We decided to divert the stream for irrigation. @result{}We decided to divert the stream for irrigation. @@ -3263,11 +3774,14 @@ We decided to divert the stream for irri Diverted text can be undiverted explicitly using the builtin @code{undivert}: -@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 @acronym{GNU} extension, if @var{number} is not numeric, -treat it as a file name instead. +@deffn Builtin undivert (@ovar{diversions@dots{}}) +Undiverts the numeric @var{diversions} given by the arguments, in the +order given. If no arguments are supplied, all diversions are +undiverted, in numerical order. + +As a @acronym{GNU} extension, @var{diversions} may contain non-numeric +strings, which are treated as the names of files to copy into the output +without expansion. A warning is issued if a file could not be opened. The expansion of @code{undivert} is void. @end deffn @@ -3349,7 +3863,7 @@ 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 -@file{examples/@/foo} contains the word @samp{bar}: +@file{m4-@value{VERSION}/@/examples/@/foo} contains the word @samp{bar}: @example define(`bar', `BAR') @@ -3389,7 +3903,7 @@ Diversion two: divnum @result{}Diversion two: 2 @end example -@node Cleardiv +@node Cleardivert @section Discarding diverted text @cindex discarding diverted text @@ -3416,8 +3930,8 @@ No output is produced at all. Clearing selected diversions can be done with the following macro: -@deffn Composite cleardivert (@ovar{diversion}@dots{}) -Discard the contents of each listed diversion. +@deffn Composite cleardivert (@ovar{diversions@dots{}}) +Discard the contents of each of the listed numeric @var{diversions}. @end deffn @example @@ -3428,7 +3942,8 @@ define(`cleardivert', It is called just like @code{undivert}, but the effect is to clear the diversions, given by the arguments. (This macro has a nasty bug! You -should try to see if you can find it and correct it. @pxref{Answers}) +should try to see if you can find it and correct it; or @pxref{Improved +cleardivert, , Answers}). @node Text handling @chapter Macros for text handling @@ -3617,19 +4132,25 @@ Expands to @var{string}, with each chara the same index. If @var{replacement} is shorter than @var{chars}, the excess characters -are deleted from the expansion. If @var{replacement} is omitted, all -characters in @var{string} that are present in @var{chars} are deleted -from the expansion. +of @var{chars} are deleted from the expansion; if @var{chars} is +shorter, the excess characters in @var{replacement} are silently +ignored. If @var{replacement} is omitted, all characters in +@var{string} that are present in @var{chars} are deleted from the +expansion. If a character appears more than once in @var{chars}, only +the first instance is used in making the translation. Only a single +translation pass is made, even if characters in @var{replacement} also +appear in @var{chars}. 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. - -It is not an error for the last character in the range to be `larger' -than the first. In that case, the range runs backwards, i.e., -@samp{9-0} means the string @samp{9876543210}. +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 in the +entire string, or as the last character of a range. Back-to-back ranges +can share a common endpoint. It is not an error for the last character +in the range to be `larger' than the first. In that case, the range +runs backwards, i.e., @samp{9-0} means the string @samp{9876543210}. +The expansion of a range is dependent on the underlying encoding of +characters, so using ranges is not always portable between machines. The macro @code{translit} is recognized only with parameters. @end deffn @@ -3641,12 +4162,31 @@ translit(`GNUs not Unix', `a-z', `A-Z') @result{}GNUS NOT UNIX translit(`GNUs not Unix', `A-Z', `z-a') @result{}tmfs not fnix +translit(`+,-12345', `+--1-5', `<;>a-c-a') +@result{}<;>abcba +translit(`abcdef', `aabdef', `bcged') +@result{}bgced @end example -The first example deletes all uppercase letters, the second converts -lowercase to uppercase, and the third `mirrors' all uppercase letters, -while converting them to lowercase. The two first cases are by far the -most common. +In the @sc{ascii} encoding, the first example deletes all uppercase +letters, the second converts lowercase to uppercase, and the third +`mirrors' all uppercase letters, while converting them to lowercase. +The two first cases are by far the most common, even though they are not +portable to @sc{ebcdic} or other encodings. The fourth example shows a +range ending in @samp{-}, as well as back-to-back ranges. The final +example shows that @samp{a} is mapped to @samp{b}, not @samp{c}; the +resulting @samp{b} is not further remapped to @samp{g}; the @samp{d} and +@samp{e} are swapped, and the @samp{f} is discarded. + +@ignore +@comment No need to fight 8-bit characters, as it is difficult to get +@comment rendering right in both info and dvi. + +@example +translit(`«abc~', `~-»') +@result{}abc +@end example +@end ignore Omitting @var{chars} evokes a warning, but still produces output. @@ -3702,7 +4242,7 @@ patsubst(`GNUs not Unix', `\w*', `(\&)') patsubst(`GNUs not Unix', `\w+', `(\&)') @result{}(GNUs) (not) (Unix) patsubst(`GNUs not Unix', `[A-Z][a-z]+') -@result{}GN not @comment +@result{}GN not@w{ } patsubst(`GNUs not Unix', `not', `NOT\') @error{}m4:stdin:6: Warning: trailing \ ignored in replacement @result{}GNUs NOT Unix @@ -3787,7 +4327,7 @@ len(format(`%-*X', `300', `1')) @result{}300 @end example -Using the @code{forloop} macro defined in @xref{Loops}, this +Using the @code{forloop} macro defined earlier (@pxref{Forloop}), this example shows how @code{format} can be used to produce tabular output. @example @@ -4048,7 +4588,7 @@ exit value if this is not the case. * Syscmd:: Executing simple commands * Esyscmd:: Reading the output of commands * Sysval:: Exit status -* Maketemp:: Making temporary files +* Mkstemp:: Making temporary files @end menu @node Platform macros @@ -4072,9 +4612,10 @@ environment of @code{m4}. If defined, e string. @end deffn -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. +When @acronym{GNU} extensions are in effect (that is, when you did not +use the @option{-G} option, @pxref{Limits control, , Invoking m4}), +@acronym{GNU} @code{m4} will define the macro @code{@w{__gnu__}} to +expand to the empty string. @example __gnu__ @@ -4084,15 +4625,15 @@ ifdef(`__gnu__', `Extensions are active' @end example @cindex platform macro -On UNIX systems, @acronym{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{@w{__unix__}} +by default, or @code{unix} 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. +@code{@w{__windows__}} by default, or @code{windows} 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. +On OS/2 systems, @acronym{GNU} @code{m4} will define @code{@w{__os2__}} +by default, or @code{os2} when the @option{-G} option is specified. If @acronym{GNU} @code{m4} does not provide a platform macro for your system, please report that as a bug. @@ -4147,7 +4688,8 @@ will tell @code{m4} to read all of its i wrapped text, then hand a valid (albeit emptied) pipe as standard input for the @code{cat} subcommand. Therefore, you should be careful when using standard input (either by specifying no files, or by passing -@samp{-} as a file name on the command line, @pxref{Invoking m4}), and +@samp{-} as a file name on the command line, @pxref{Command line files, +, Invoking m4}), and also invoking subcommands via @code{syscmd} or @code{esyscmd} that consume data from standard input. When standard input is a seekable file, the subprocess will pick up with the next character not yet @@ -4183,7 +4725,7 @@ Expands to the standard output of the sh @var{shell-command}. Prior to executing the command, @code{m4} flushes its buffers. -The default standard input and error output of @var{shell-command} are +The default standard input and standard error of @var{shell-command} are the same as those of @code{m4}. The error output of @var{shell-command} is not a part of the expansion: it will appear along with the error output of @code{m4}. @@ -4283,57 +4825,89 @@ sysval @result{}2304 @end example -@node Maketemp +@node Mkstemp @section Making temporary files @cindex temporary file names @cindex files, names of temporary Commands specified to @code{syscmd} or @code{esyscmd} might need a -temporary file, for output or for some other purpose. -There is a builtin macro, @code{maketemp}, for making temporary file -names: +temporary file, for output or for some other purpose. There is a +builtin macro, @code{mkstemp}, for making a temporary file: -@deffn Builtin maketemp (@var{template}) +@deffn Builtin mkstemp (@var{template}) +@deffnx Builtin maketemp (@var{template}) Expands to a name of a new, empty file, made from the string @var{template}, which should end with the string @samp{XXXXXX}. The six -@code{X} characters are then replaced with random data, in order to make -the file name unique. +@samp{X} characters are then replaced with random characters matching +the regular expression @samp{[a-zA-Z0-9._-]}, in order to make the file +name unique. If fewer than six @samp{X} characters are found at the end +of @code{template}, the result will be longer than the template. The +created file will have access permissions as if by @kbd{chmod =rw,go=}, +meaning that the current umask of the @code{m4} process is taken into +account, and at most only the current user can read and write the file. + +The traditional behavior, standardized by @acronym{POSIX}, is that +@code{maketemp} merely replaces the trailing @samp{X} with the process +id, without creating a file, and without ensuring that the resulting +string is a unique file name. In part, this means that using the same +@var{template} twice in the same input file will result in the same +expansion. This behavior is a security hole, as it is very easy for +another process to guess the name that will be generated, and thus +interfere with a subsequent use of @code{syscmd} trying to manipulate +that file name. Hence, @acronym{POSIX} has recommended that all new +implementations of @code{m4} provide the secure @code{mkstemp} builtin, +and that users of @code{m4} check for its existence. -The macro @code{maketemp} is recognized only with parameters. +The macros @code{mkstemp} and @code{maketemp} are recognized only with +parameters. @end deffn +If you try this next example, you will most likely get different output +for the two file names, since the replacement characters are randomly +chosen: + @comment ignore @example maketemp(`/tmp/fooXXXXXX') @result{}/tmp/fooa07346 +ifdef(`mkstemp', `define(`maketemp', defn(`mkstemp'))', + `define(`mkstemp', defn(`maketemp'))dnl +errprint(`warning: potentially insecure maketemp implementation +')') +@result{} +mkstemp(`doc') +@result{}docQv83Uw @end example -Traditional implementations of @code{m4} replaced the trailing @samp{X} -sequence with the process id, without creating the file; meaning you -only get one result no matter how many times you use maketemp on the -same string. As of this release, @acronym{POSIX} is considering the -addition of a new macro @code{mkstemp} that behaves like @acronym{GNU} -@code{maketemp}, so a future version of @acronym{GNU} M4 may have -changes in this area. - -@ignore -@c This test makes sure maketemp gets testsuite coverage, but is -@c somewhat complex for use in the manual. -@example -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') -@result{}different -syscmd(`rm 'file1 file2) +@cindex @acronym{GNU} extensions +Unless you use the @option{--traditional} command line option (or +@option{-G}, @pxref{Limits control, , Invoking m4}), the @acronym{GNU} +version of @code{maketemp} is secure. This means that using the same +template to multiple calls will generate multiple files. However, we +recommend that you use the new @code{mkstemp} macro, introduced in +@acronym{GNU} M4 1.4.8, which is secure even in traditional mode. + +@example +syscmd(`echo foo??????')dnl +@result{}foo?????? +define(`file1', maketemp(`fooXXXXXX'))dnl +ifelse(esyscmd(`echo foo??????'), `foo??????', `no file', `created') +@result{}created +define(`file2', maketemp(`fooXX'))dnl +define(`file3', mkstemp(`fooXXXXXX'))dnl +ifelse(len(file1), len(file2), `same length', `different') +@result{}same length +ifelse(file1, file2, `same', `different file') +@result{}different file +ifelse(file2, file3, `same', `different file') +@result{}different file +ifelse(file1, file3, `same', `different file') +@result{}different file +syscmd(`rm 'file1 file2 file3) @result{} sysval @result{}0 @end example -@end ignore @node Miscellaneous @chapter Miscellaneous builtin macros @@ -4356,8 +4930,9 @@ any of the previous chapters. You can print error messages using @code{errprint}: @deffn Builtin errprint (@var{message}, @dots{}) -Prints @var{message} and the rest of the arguments on the -standard error output, separated by spaces. +Prints @var{message} and the rest of the arguments to standard error, +separated by spaces. Standard error is used, regardless of the +@option{--debugfile} option (@pxref{Debugging options, , Invoking m4}). The expansion of @code{errprint} is void. The macro @code{errprint} is recognized only with parameters. @@ -4368,13 +4943,20 @@ errprint(`Invalid arguments to forloop ') @error{}Invalid arguments to forloop @result{} +errprint(`1')errprint(`2',`3 +') +@error{}12 3 +@result{} @end example -A trailing newline is @emph{not} printed automatically, so it must be -supplied as part of the argument, as in the example. BSD -implementations of @code{m4} do append a trailing newline on each -@code{errprint} call, while some other implementations only print the -first argument. +A trailing newline is @emph{not} printed automatically, so it should be +supplied as part of the argument, as in the example. Unfortunately, the +exact output of @code{errprint} is not very portable to other @code{m4} +implementations: @acronym{POSIX} requires that all arguments be printed, +but some implementations of @code{m4} only print the first. +Furthermore, some BSD implementations always append a newline for each +@code{errprint} call, regardless of whether the last argument already +had one, and @acronym{POSIX} is silent on whether this is acceptable. @node Location @section Printing current location @@ -4400,14 +4982,14 @@ errprint(__program__:__file__:__line__: 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 +@pxref{Preprocessor features, , 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: +@file{m4-@value{VERSION}/@/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__') @@ -4421,20 +5003,51 @@ include(`incl.m4') @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 location of macros invoked during the rescanning of macro expansion +text corresponds to the location in the file where the expansion was +triggered, regardless of how many newline characters the expansion text +contains. As of @acronym{GNU} M4 1.4.8, the location of text wrapped +with @code{m4wrap} (@pxref{M4wrap}) is the point at which the +@code{m4wrap} was invoked. Previous versions, however, behaved as +though wrapped text came from line 0 of the file ``''. -The @code{__program__} macro behaves like @samp{$0} in shell +@example +define(`echo', `$@@') +@result{} +define(`foo', `echo(__line__ +__line__)') +@result{} +echo(__line__ +__line__) +@result{}4 +@result{}5 +m4wrap(`foo +') +@result{} +foo(errprint(__line__ +__line__ +)) +@error{}8 +@error{}9 +@result{}8 +@result{}8 +__line__ +@result{}11 +^D +@result{}6 +@result{}6 +@end example + +The @code{@w{__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 +for plain @samp{m4}, it will affect how @code{@w{__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}. +@code{m4} happens to be first in @env{PATH}. It was first introduced in +@acronym{GNU} M4 1.4.6. @node M4exit @section Exiting from @code{m4} @@ -4451,6 +5064,15 @@ is outside the range of 0 to 255, the ex input is read, and all wrapped and diverted text is discarded. @end deffn +@example +m4wrap(`This text is lost due to `m4exit'.') +@result{} +divert(`1') So is this. +divert +@result{} +m4exit And this is never read. +@end example + A common use of this is to abort processing: @deffn Composite fatal_error (@var{message}) @@ -4471,22 +5093,13 @@ 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. (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'.') -@result{} -divert(`1') And so is this. -divert -@result{} -m4exit -@end example +(@pxref{M4wrap}) is not reread. (This macro could be made more robust +to earlier versions of @code{m4}. You should try to see if you can find +weaknesses and correct them; or @pxref{Improved fatal_error, , Answers}). 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 +error, such as a write error on standard output, the exit status will be non-zero even if @code{m4exit} requested zero. If standard input is seekable, then the file will be positioned at the @@ -4625,7 +5238,7 @@ of @code{.m4f}. These are simple (editable) text files, made up of directives, each starting with a capital letter and ending with a newline (@key{NL}). Wherever a directive is expected, the character -@kbd{#} introduces a comment line; empty lines are also ignored if they +@samp{#} introduces a comment line; empty lines are also ignored if they are not part of an embedded string. In the following descriptions, each @var{len} refers to the length of the corresponding strings @var{str} in the next line of input. Numbers @@ -4703,8 +5316,8 @@ is made to summarize these here. @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 (@pxref{Invoking m4}), unless -overridden by other command line options. +using the @option{-G} command line option (@pxref{Limits control, , +Invoking m4}), unless overridden by other command line options. @itemize @bullet @item @@ -4775,8 +5388,8 @@ Macros can be called indirectly through @item 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}). +line number are accessible through the builtins @code{@w{__program__}}, +@code{@w{__file__}}, and @code{@w{__line__}} (@pxref{Location}). @item The format of the output from @code{dumpdef} and macro tracing can be @@ -4785,6 +5398,12 @@ controlled with @code{debugmode} (@pxref @item The destination of trace and debug output can be controlled with @code{debugfile} (@pxref{Debug Output}). + +@item +The @code{maketemp} (@pxref{Mkstemp}) macro behaves like @code{mkstemp}, +creating a new file with a unique name on every invocation, rather than +following the insecure behavior of replacing the trailing @samp{X} +characters with the @code{m4} process id. @end itemize In addition to the above extensions, @acronym{GNU} @code{m4} implements the @@ -4834,7 +5453,8 @@ argument to @code{m4wrap} is saved for l separated by spaces. However, it is possible to emulate @acronym{POSIX} behavior by -including the file @file{examples/@/wrapfifo.m4} from the distribution: +including the file @file{m4-@value{VERSION}/@/examples/@/wrapfifo.m4} +from the distribution: @example undivert(`wrapfifo.m4')dnl @@ -4880,29 +5500,36 @@ provides the extension @code{esyscmd} th semantics. @item -@acronym{POSIX} requires @code{maketemp} (@pxref{Maketemp}) to replace -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. @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. +At one point, @acronym{POSIX} required @code{changequote(@var{arg})} +(@pxref{Changequote}) to use newline as the close quote, but this was a +bug, and the next version of @acronym{POSIX} is anticipated to state +that using empty strings or just one argument is unspecified. +Meanwhile, the @acronym{GNU} @code{m4} behavior of treating an empty +end-quote delimiter as @samp{'} is not portable, as Solaris treats it as +repeating the start-quote delimiter, and BSD treats it as leaving the +previous end-quote delimiter unchanged. For predictable results, never +call changequote with just one argument, or with empty strings for +arguments. @item -@acronym{POSIX} requires @code{changequote(@var{arg})} -(@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. +At one point, @acronym{POSIX} required @code{changecom(@var{arg},)} +(@pxref{Changecom}) to make it impossible to end a comment, but this is +a bug, and the next version of @acronym{POSIX} is anticipated to state +that using empty strings is unspecified. Meanwhile, the @acronym{GNU} +@code{m4} behavior of treating an empty end-comment delimiter as newline +is not portable, as BSD treats it as leaving the previous end-comment +delimiter unchanged. It is also impossible in BSD implementations to +disable comments, even though that is required by @acronym{POSIX}. For +predictable results, never call changecom with empty strings for +arguments. @item -Some implementations of @code{m4} give macros a higher precedence than +Most 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. +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 @@ -4952,6 +5579,14 @@ each character of the second and third a 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}. + +@item +@acronym{POSIX} states that only unquoted leading newlines and blanks +(that is, space and tab) are ignored when collecting macro arguments. +However, this appears to be a bug in @acronym{POSIX}, since most +traditional implementations also ignore all whitespace (formfeed, +carriage return, and vertical tab). @acronym{GNU} @code{m4} follows +tradition and ignores all leading unquoted whitespace. @end itemize @node Other Incompatibilities @@ -5011,8 +5646,20 @@ in traditional programming languages. @node Answers @chapter Correct version of some examples -Some of the examples in this manuals are buggy, for demonstration -purposes. Correctly working macros are presented here. +Some of the examples in this manuals are buggy or not very robust, for +demonstration purposes. Improved versions of these composite macros are +presented here. + +@menu +* Improved exch:: Solution for @code{exch} +* Improved forloop:: Solution for @code{forloop} +* Improved foreach:: Solution for @code{foreach} +* Improved cleardivert:: Solution for @code{cleardivert} +* Improved fatal_error:: Solution for @code{fatal_error} +@end menu + +@node Improved exch +@section Solution for @code{exch} The @code{exch} macro (@pxref{Arguments}) as presented requires clients to double quote their arguments. A nicer definition, which lets @@ -5029,7 +5676,250 @@ macro @result{}expansion text @end example -The @code{cleardivert} macro (@pxref{Cleardiv}) cannot, as it stands, be +@node Improved forloop +@section Solution for @code{forloop} + +The @code{forloop} macro (@pxref{Forloop}) as presented earlier can go +into an infinite loop if given an iterator that is not parsed as a macro +name. It does not do any sanity checking on its numeric bounds, and +only permits decimal numbers for bounds. Here is an improved version, +shipped as @file{m4-@value{VERSION}/@/examples/@/forloop2.m4}; this +version also optimizes based on the fact that the starting bound does +not need to be passed to the helper @code{@w{_forloop}}. + +@example +undivert(`forloop2.m4')dnl +@result{}divert(`-1') +@result{}# forloop(var, from, to, stmt) - improved version: +@result{}# works even if VAR is not a strict macro name +@result{}# performs sanity check that FROM is larger than TO +@result{}# allows complex numerical expressions in TO and FROM +@result{}define(`forloop', `ifelse(eval(`($3) >= ($2)'), `1', +@result{} `pushdef(`$1', eval(`$2'))_forloop(`$1', +@result{} eval(`$3'), `$4')popdef(`$1')')') +@result{}define(`_forloop', +@result{} `$3`'ifelse(indir(`$1'), `$2', `', +@result{} `define(`$1', incr(indir(`$1')))$0($@@)')') +@result{}divert`'dnl +include(`forloop2.m4') +@result{} +forloop(`i', `2', `1', `no iteration occurs') +@result{} +forloop(`', `1', `2', ` odd iterator name') +@result{} odd iterator name odd iterator name +forloop(`i', `5 + 5', `0xc', ` 0x`'eval(i, `16')') +@result{} 0xa 0xb 0xc +forloop(`i', `a', `b', `non-numeric bounds') +@error{}m4:stdin:6: bad expression in eval (bad input): (b) >= (a) +@result{} +@end example + +Of course, it is possible to make even more improvements, such as +adding an optional step argument, or allowing iteration through +descending sequences. @acronym{GNU} Autoconf provides some of these +additional bells and whistles in its @code{m4_for} macro. + +@node Improved foreach +@section Solution for @code{foreach} + +The @code{foreach} and @code{foreachq} macros (@pxref{Foreach}) as +presented earlier each have flaws. First, we will examine and fix the +quadratic behavior of @code{foreachq}: + +@example +include(`foreachq.m4') +@result{} +traceon(`shift')debugmode(`aq') +@result{} +foreachq(`x', ``1', `2', `3', `4'', `x +')dnl +@result{}1 +@error{}m4trace: -3- shift(`1', `2', `3', `4') +@error{}m4trace: -2- shift(`1', `2', `3', `4') +@result{}2 +@error{}m4trace: -4- shift(`1', `2', `3', `4') +@error{}m4trace: -3- shift(`2', `3', `4') +@error{}m4trace: -3- shift(`1', `2', `3', `4') +@error{}m4trace: -2- shift(`2', `3', `4') +@result{}3 +@error{}m4trace: -5- shift(`1', `2', `3', `4') +@error{}m4trace: -4- shift(`2', `3', `4') +@error{}m4trace: -3- shift(`3', `4') +@error{}m4trace: -4- shift(`1', `2', `3', `4') +@error{}m4trace: -3- shift(`2', `3', `4') +@error{}m4trace: -2- shift(`3', `4') +@result{}4 +@error{}m4trace: -6- shift(`1', `2', `3', `4') +@error{}m4trace: -5- shift(`2', `3', `4') +@error{}m4trace: -4- shift(`3', `4') +@error{}m4trace: -3- shift(`4') +@end example + +Each successive iteration was adding more quoted @code{shift} +invocations, and the entire list contents were passing through every +iteration. In general, when recursing, it is a good idea to make the +recursion use fewer arguments, rather than adding additional quoted +uses of @code{shift}. By doing so, @code{m4} uses less memory, invokes +fewer macros, is less likely to run into machine limits, and most +importantly, performs faster. The fixed version of @code{foreachq} can +be found in @file{m4-@value{VERSION}/@/examples/@/foreachq2.m4}: + +@example +include(`foreachq2.m4') +@result{} +undivert(`foreachq2.m4')dnl +@result{}include(`quote.m4')dnl +@result{}divert(`-1') +@result{}# foreachq(x, `item_1, item_2, ..., item_n', stmt) +@result{}# quoted list, improved version +@result{}define(`foreachq', `pushdef(`$1')_foreachq($@@)popdef(`$1')') +@result{}define(`_arg1q', ``$1'') +@result{}define(`_rest', `ifelse(`$#', `1', `', `dquote(shift($@@))')') +@result{}define(`_foreachq', `ifelse(`$2', `', `', +@result{} `define(`$1', _arg1q($2))$3`'$0(`$1', _rest($2), `$3')')') +@result{}divert`'dnl +traceon(`shift')debugmode(`aq') +@result{} +foreachq(`x', ``1', `2', `3', `4'', `x +')dnl +@result{}1 +@error{}m4trace: -3- shift(`1', `2', `3', `4') +@result{}2 +@error{}m4trace: -3- shift(`2', `3', `4') +@result{}3 +@error{}m4trace: -3- shift(`3', `4') +@result{}4 +@end example + +Note that the fixed version calls unquoted helper macros in +@code{@w{_foreachq}} to trim elements immediately; those helper macros +in turn must re-supply the layer of quotes lost in the macro invocation. +Contrast the use of @code{@w{_arg1q}}, which quotes the first list +element, with @code{@w{_arg1}} of the earlier implementation that +returned the first list element directly. + +For a different approach, the improved version of @code{foreach}, +available in @file{m4-@value{VERSION}/@/examples/@/foreach2.m4}, simply +overquotes the arguments to @code{@w{_foreach}} to begin with, using +@code{dquote_elt}. Then @code{@w{_foreach}} can just use +@code{@w{_arg1}} to remove the extra layer of quoting that was added up +front: + +@example +include(`foreach2.m4') +@result{} +undivert(`foreach2.m4')dnl +@result{}include(`quote.m4')dnl +@result{}divert(`-1') +@result{}# foreach(x, (item_1, item_2, ..., item_n), stmt) +@result{}# parenthesized list, improved version +@result{}define(`foreach', `pushdef(`$1')_foreach(`$1', +@result{} (dquote(dquote_elt$2)), `$3')popdef(`$1')') +@result{}define(`_arg1', `$1') +@result{}define(`_foreach', `ifelse(`$2', `(`')', `', +@result{} `define(`$1', _arg1$2)$3`'$0(`$1', (dquote(shift$2)), `$3')')') +@result{}divert`'dnl +traceon(`shift')debugmode(`aq') +@result{} +foreach(`x', `(`1', `2', `3', `4')', `x +')dnl +@error{}m4trace: -4- shift(`1', `2', `3', `4') +@error{}m4trace: -4- shift(`2', `3', `4') +@error{}m4trace: -4- shift(`3', `4') +@result{}1 +@error{}m4trace: -3- shift(``1'', ``2'', ``3'', ``4'') +@result{}2 +@error{}m4trace: -3- shift(``2'', ``3'', ``4'') +@result{}3 +@error{}m4trace: -3- shift(``3'', ``4'') +@result{}4 +@error{}m4trace: -3- shift(``4'') +@end example + +In summary, recursion over list elements is trickier than it appeared at +first glance, but provides a powerful idiom within @code{m4} processing. +As a final demonstration, both list styles are now able to handle +several scenarios that would wreak havoc on the original +implementations. This points out one other difference between the two +list styles. @code{foreach} evaluates unquoted list elements only once, +in preparation for calling @code{@w{_foreach}}. But @code{foreachq} +evaluates unquoted list elements twice while visiting the first list +element, once in @code{@w{_arg1q}} and once in @code{@w{_rest}}. When +deciding which list style to use, one must take into account whether +repeating the side effects of unquoted list elements will have any +detrimental effects. + +@example +include(`foreach2.m4') +@result{} +include(`foreachq2.m4') +@result{} +dnl 0-element list: +foreach(`x', `', `') / foreachq(`x', `', `') +@result{} /@w{ } +dnl 1-element list of empty element +foreach(`x', `()', `') / foreachq(`x', ``'', `') +@result{}<> / <> +dnl 2-element list of empty elements +foreach(`x', `(`',`')', `') / foreachq(`x', ``',`'', `') +@result{}<><> / <><> +dnl 1-element list of a comma +foreach(`x', `(`,')', `') / foreachq(`x', ``,'', `') +@result{}<,> / <,> +dnl 2-element list of unbalanced parentheses +foreach(`x', `(`(', `)')', `') / foreachq(`x', ``(', `)'', `') +@result{}<(><)> / <(><)> +define(`active', `ACT, IVE') +@result{} +traceon(`active') +@result{} +dnl list of unquoted macros; expansion occurs before recursion +foreach(`x', `(active, active)', ` +')dnl +@error{}m4trace: -4- active -> `ACT, IVE' +@error{}m4trace: -4- active -> `ACT, IVE' +@result{} +@result{} +@result{} +@result{} +foreachq(`x', `active, active', ` +')dnl +@error{}m4trace: -3- active -> `ACT, IVE' +@error{}m4trace: -3- active -> `ACT, IVE' +@result{} +@error{}m4trace: -3- active -> `ACT, IVE' +@error{}m4trace: -3- active -> `ACT, IVE' +@result{} +@result{} +@result{} +dnl list of quoted macros; expansion occurs during recursion +foreach(`x', `(`active', `active')', ` +')dnl +@error{}m4trace: -1- active -> `ACT, IVE' +@result{} +@error{}m4trace: -1- active -> `ACT, IVE' +@result{} +foreachq(`x', ``active', `active'', ` +')dnl +@error{}m4trace: -1- active -> `ACT, IVE' +@result{} +@error{}m4trace: -1- active -> `ACT, IVE' +@result{} +dnl list of double-quoted macro names; no expansion +foreach(`x', `(``active'', ``active'')', ` +')dnl +@result{} +@result{} +foreachq(`x', ```active'', ``active''', ` +')dnl +@result{} +@result{} +@end example + +@node Improved cleardivert +@section Solution for @code{cleardivert} + +The @code{cleardivert} macro (@pxref{Cleardivert}) cannot, as it stands, be called without arguments to clear all pending diversions. That is because using undivert with an empty string for an argument is different than using it with no arguments at all. Compare the earlier definition @@ -5060,17 +5950,22 @@ 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: +@node Improved fatal_error +@section Solution for @code{fatal_error} + +The @code{fatal_error} macro (@pxref{M4exit}) is not robust to versions +of @acronym{GNU} M4 earlier than 1.4.8, where invoking +@code{@w{__file__}} (@pxref{Location}) inside @code{m4wrap} would result +in an empty string, and @code{@w{__line__}} resulted in @samp{0} even +though all files start at line 1. Furthermore, versions earlier than +1.4.6 did not support the @code{@w{__program__}} macro. If you want +@code{fatal_error} to work across the entire 1.4.x release series, a +better implementation would be: @example define(`fatal_error', - `errprint(__program__:ifelse(__line__, `0', `', + `errprint(ifdef(`__program__', `__program__', ``m4'')'dnl +`:ifelse(__line__, `0', `', `__file__:__line__:')` fatal error: $* ')m4exit(`1')') @result{} @@ -5078,9 +5973,9 @@ m4wrap(`divnum(`demo of internal message fatal_error(`inside wrapped text')') @result{} ^D -@error{}m4: Warning: excess arguments to builtin `divnum' ignored +@error{}m4:stdin:6: Warning: excess arguments to builtin `divnum' ignored @result{}0 -@error{}m4: fatal error: inside wrapped text +@error{}m4:stdin:6: fatal error: inside wrapped text @end example @c ========================================================== Appendices diff -ruNp m4-1.4.7/doc/stamp-vti m4-1.4.8/doc/stamp-vti --- m4-1.4.7/doc/stamp-vti 2006-09-25 06:10:10.000000000 -0600 +++ m4-1.4.8/doc/stamp-vti 2006-11-20 07:28:42.000000000 -0700 @@ -1,4 +1,4 @@ -@set UPDATED 23 September 2006 -@set UPDATED-MONTH September 2006 -@set EDITION 1.4.7 -@set VERSION 1.4.7 +@set UPDATED 20 November 2006 +@set UPDATED-MONTH November 2006 +@set EDITION 1.4.8 +@set VERSION 1.4.8 diff -ruNp m4-1.4.7/doc/texinfo.tex m4-1.4.8/doc/texinfo.tex --- m4-1.4.7/doc/texinfo.tex 2006-09-25 06:08:02.000000000 -0600 +++ m4-1.4.8/doc/texinfo.tex 2006-11-20 07:08:21.000000000 -0700 @@ -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-08-26.17} +\def\texinfoversion{2006-10-15.13} % % Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free @@ -157,6 +157,18 @@ \chardef\spacecat = 10 \def\spaceisspace{\catcode`\ =\spacecat} +% sometimes characters are active, so we need control sequences. +\chardef\colonChar = `\: +\chardef\commaChar = `\, +\chardef\dashChar = `\- +\chardef\dotChar = `\. +\chardef\exclamChar= `\! +\chardef\lquoteChar= `\` +\chardef\questChar = `\? +\chardef\rquoteChar= `\' +\chardef\semiChar = `\; +\chardef\underChar = `\_ + % Ignore a token. % \def\gobble#1{} @@ -1976,13 +1988,6 @@ where each line of input produces a line % Can't use plain's \frenchspacing because it uses the `\x notation, and % sometimes \x has an active definition that messes things up. % -\chardef\colonChar = `\: -\chardef\commaChar = `\, -\chardef\dotChar = `\. -\chardef\exclamChar= `\! -\chardef\questChar = `\? -\chardef\semiChar = `\; -% \catcode`@=11 \def\plainfrenchspacing{% \sfcode\dotChar =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m @@ -2010,6 +2015,7 @@ where each line of input produces a line \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}% \kern-0.4pt\hrule}% \kern-.06em\raise0.4pt\hbox{\angleright}}}} +\def\key #1{{\nohyphenation \uppercase{#1}}\null} % The old definition, with no lozenge: %\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null} \def\ctrl #1{{\tt \rawbackslash \hat}#1} @@ -2051,11 +2057,14 @@ 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 + \catcode`\'=\active \catcode`\`=\active % \global\def\code{\begingroup - \catcode`\-=\active \catcode`\_=\active \catcode`\'=\active - \let'\singlequotechar + \catcode\rquoteChar=\active \catcode\lquoteChar=\active + \let'\codequoteright \let`\codequoteleft + % + \catcode\dashChar=\active \catcode\underChar=\active \ifallowcodebreaks \let-\codedash \let_\codeunder @@ -5410,7 +5419,7 @@ where each line of input produces a line % evince), the lilypond developers report. xpdf does work with the % regular 0x27. % -\def\singlequotechar{% +\def\codequoteright{% \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax '% \else @@ -5418,6 +5427,18 @@ where each line of input produces a line \fi } % +% and a similar option for the left quote char vs. a grave accent. +% Modern fonts display ASCII 0x60 as a grave accent, so some people like +% the code environments to do likewise. +% +\def\codequoteleft{% + \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax + `% + \else + \char'22 + \fi +} +% \begingroup \catcode`\^^I=\active \gdef\tabexpand{% @@ -5431,12 +5452,15 @@ where each line of input produces a line }% } \catcode`\'=\active - \gdef\quoteexpand{% - \catcode`\'=\active - \def'{\singlequotechar} - }% + \gdef\rquoteexpand{\catcode\rquoteChar=\active \def'{\codequoteright}}% + % + \catcode`\`=\active + \gdef\lquoteexpand{\catcode\lquoteChar=\active \def`{\codequoteleft}}% + % + \gdef\quoteexpand{\rquoteexpand \lquoteexpand}% \endgroup -% + +% start the verbatim environment. \def\setupverbatim{% \let\nonarrowing = t% \nonfillstart diff -ruNp m4-1.4.7/doc/version.texi m4-1.4.8/doc/version.texi --- m4-1.4.7/doc/version.texi 2006-09-25 06:10:10.000000000 -0600 +++ m4-1.4.8/doc/version.texi 2006-11-20 07:12:28.000000000 -0700 @@ -1,4 +1,4 @@ -@set UPDATED 23 September 2006 -@set UPDATED-MONTH September 2006 -@set EDITION 1.4.7 -@set VERSION 1.4.7 +@set UPDATED 20 November 2006 +@set UPDATED-MONTH November 2006 +@set EDITION 1.4.8 +@set VERSION 1.4.8 diff -ruNp m4-1.4.7/examples/Makefile.am m4-1.4.8/examples/Makefile.am --- m4-1.4.7/examples/Makefile.am 2006-07-03 07:16:19.000000000 -0600 +++ m4-1.4.8/examples/Makefile.am 2006-11-20 06:55:43.000000000 -0700 @@ -19,9 +19,40 @@ ## ## This file written by Eric Blake -EXTRA_DIST = capitalize.m4 comments.m4 ddivert.m4 \ -debug.m4 esyscmd.m4 exp.m4 file.m4 foo foreach.m4 forloop.m4 fstab.m4 \ -hanoi.m4 incl.m4 incl-test.m4 include.m4 indir.m4 misc.m4 multiquotes.m4 \ -patsubst.m4 pushpop.m4 regexp.m4 reverse.m4 stackovf.sh sync-lines.m4 \ -sysv-args.m4 trace.m4 translit.m4 undivert.incl undivert.m4 wrap.m4 \ +EXTRA_DIST =\ +capitalize.m4 \ +comments.m4 \ +ddivert.m4 \ +debug.m4 \ +esyscmd.m4 \ +exp.m4 \ +file.m4 \ +foo \ +foreach.m4 \ +foreach2.m4 \ +foreachq.m4 \ +foreachq2.m4 \ +forloop.m4 \ +forloop2.m4 \ +fstab.m4 \ +hanoi.m4 \ +incl-test.m4 \ +incl.m4 \ +include.m4 \ +indir.m4 \ +misc.m4 \ +multiquotes.m4 \ +patsubst.m4 \ +pushpop.m4 \ +quote.m4 \ +regexp.m4 \ +reverse.m4 \ +stackovf.sh \ +sync-lines.m4 \ +sysv-args.m4 \ +trace.m4 \ +translit.m4 \ +undivert.incl \ +undivert.m4 \ +wrap.m4 \ wrapfifo.m4 diff -ruNp m4-1.4.7/examples/Makefile.in m4-1.4.8/examples/Makefile.in --- m4-1.4.7/examples/Makefile.in 2006-09-25 06:07:58.000000000 -0600 +++ m4-1.4.8/examples/Makefile.in 2006-11-20 07:25:48.000000000 -0700 @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. +# Makefile.in generated by automake 1.10 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -13,15 +13,11 @@ # PARTICULAR PURPOSE. @SET_MAKE@ -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -39,24 +35,32 @@ subdir = examples 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/cloexec.m4 \ - $(top_srcdir)/m4/close-stream.m4 $(top_srcdir)/m4/codeset.m4 \ + $(top_srcdir)/m4/alloca.m4 $(top_srcdir)/m4/allocsa.m4 \ + $(top_srcdir)/m4/cloexec.m4 $(top_srcdir)/m4/close-stream.m4 \ + $(top_srcdir)/m4/closeout.m4 $(top_srcdir)/m4/codeset.m4 \ + $(top_srcdir)/m4/config-h.m4 $(top_srcdir)/m4/eealloc.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/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/fatal-signal.m4 $(top_srcdir)/m4/fpending.m4 \ + $(top_srcdir)/m4/free.m4 $(top_srcdir)/m4/getopt.m4 \ + $(top_srcdir)/m4/gl_list.m4 $(top_srcdir)/m4/gnulib-comp.m4 \ + $(top_srcdir)/m4/inline.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/mbstate_t.m4 $(top_srcdir)/m4/memchr.m4 \ + $(top_srcdir)/m4/mkdtemp.m4 $(top_srcdir)/m4/mkstemp.m4 \ + $(top_srcdir)/m4/pathmax.m4 $(top_srcdir)/m4/quotearg.m4 \ + $(top_srcdir)/m4/regex.m4 $(top_srcdir)/m4/sig_atomic_t.m4 \ + $(top_srcdir)/m4/signalblocking.m4 \ + $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/ssize_t.m4 \ $(top_srcdir)/m4/stdarg.m4 $(top_srcdir)/m4/stdbool.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/strstr.m4 $(top_srcdir)/m4/strtol.m4 \ + $(top_srcdir)/m4/sys_stat_h.m4 $(top_srcdir)/m4/tempname.m4 \ + $(top_srcdir)/m4/tmpdir.m4 $(top_srcdir)/m4/ulonglong.m4 \ $(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/unistd_h.m4 \ $(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/vasnprintf.m4 \ $(top_srcdir)/m4/vasprintf.m4 $(top_srcdir)/m4/wchar_t.m4 \ @@ -67,7 +71,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/a am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_HEADER = $(top_builddir)/lib/config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = @@ -77,8 +81,6 @@ ABSOLUTE_SYS_STAT_H = @ABSOLUTE_SYS_STAT ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ ALLOCA_H = @ALLOCA_H@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ @@ -104,8 +106,6 @@ EGREP = @EGREP@ EOVERFLOW = @EOVERFLOW@ EXEEXT = @EXEEXT@ 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@ @@ -116,8 +116,10 @@ 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_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@ HAVE_WCHAR_H = @HAVE_WCHAR_H@ HAVE__BOOL = @HAVE__BOOL@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -128,7 +130,10 @@ LIBM4_LTLIBDEPS = @LIBM4_LTLIBDEPS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ +M4_LIBOBJS = @M4_LIBOBJS@ +M4_LTLIBOBJS = @M4_LTLIBOBJS@ MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -143,8 +148,6 @@ 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@ @@ -153,9 +156,11 @@ UNISTD_H = @UNISTD_H@ VERSION = @VERSION@ WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ WINT_T_SUFFIX = @WINT_T_SUFFIX@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -167,6 +172,7 @@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ +builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ @@ -194,13 +200,47 @@ program_transform_name = @program_transf psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ -EXTRA_DIST = capitalize.m4 comments.m4 ddivert.m4 \ -debug.m4 esyscmd.m4 exp.m4 file.m4 foo foreach.m4 forloop.m4 fstab.m4 \ -hanoi.m4 incl.m4 incl-test.m4 include.m4 indir.m4 misc.m4 multiquotes.m4 \ -patsubst.m4 pushpop.m4 regexp.m4 reverse.m4 stackovf.sh sync-lines.m4 \ -sysv-args.m4 trace.m4 translit.m4 undivert.incl undivert.m4 wrap.m4 \ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +EXTRA_DIST = \ +capitalize.m4 \ +comments.m4 \ +ddivert.m4 \ +debug.m4 \ +esyscmd.m4 \ +exp.m4 \ +file.m4 \ +foo \ +foreach.m4 \ +foreach2.m4 \ +foreachq.m4 \ +foreachq2.m4 \ +forloop.m4 \ +forloop2.m4 \ +fstab.m4 \ +hanoi.m4 \ +incl-test.m4 \ +incl.m4 \ +include.m4 \ +indir.m4 \ +misc.m4 \ +multiquotes.m4 \ +patsubst.m4 \ +pushpop.m4 \ +quote.m4 \ +regexp.m4 \ +reverse.m4 \ +stackovf.sh \ +sync-lines.m4 \ +sysv-args.m4 \ +trace.m4 \ +translit.m4 \ +undivert.incl \ +undivert.m4 \ +wrap.m4 \ wrapfifo.m4 all: all-am @@ -235,7 +275,6 @@ $(top_srcdir)/configure: $(am__configur cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -uninstall-info-am: tags: TAGS TAGS: @@ -244,22 +283,21 @@ CTAGS: distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ @@ -318,12 +356,20 @@ info-am: install-data-am: +install-dvi: install-dvi-am + install-exec-am: +install-html: install-html-am + install-info: install-info-am install-man: +install-pdf: install-pdf-am + +install-ps: install-ps-am + installcheck-am: maintainer-clean: maintainer-clean-am @@ -342,16 +388,19 @@ ps: ps-am ps-am: -uninstall-am: uninstall-info-am +uninstall-am: + +.MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic distclean \ distclean-generic distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \ - uninstall-info-am + mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am # 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. diff -ruNp m4-1.4.7/examples/foreach.m4 m4-1.4.8/examples/foreach.m4 --- m4-1.4.7/examples/foreach.m4 2006-09-23 22:28:02.000000000 -0600 +++ m4-1.4.8/examples/foreach.m4 2006-11-20 06:55:43.000000000 -0700 @@ -1,19 +1,8 @@ -divert(-1) +divert(`-1') # foreach(x, (item_1, item_2, ..., item_n), stmt) -define(`foreach', `pushdef(`$1', `')_foreach(`$1', `$2', `$3')popdef(`$1')') +# parenthesized list, simple version +define(`foreach', `pushdef(`$1')_foreach($@)popdef(`$1')') define(`_arg1', `$1') -define(`_foreach', - `ifelse(`$2', `()', , - `define(`$1', _arg1$2)$3`'_foreach(`$1', (shift$2), `$3')')') -# traceon(`define', `foreach', `_foreach', `ifelse') -divert -foreach(`x', `(foo, bar, foobar)', `Word was: x -') -# Something more complex, from Pierre Gaumond . -define(`case', ` $1) - $2=" -$1";; -')dnl -define(`_cat', `$1$2')dnl -`case' "$1" in -foreach(`x', ((a, vara), (b, varb), (c, varc)), `_cat(`case', x)')dnl -esac +define(`_foreach', `ifelse(`$2', `()', `', + `define(`$1', _arg1$2)$3`'$0(`$1', (shift$2), `$3')')') +divert`'dnl diff -ruNp m4-1.4.7/examples/foreach2.m4 m4-1.4.8/examples/foreach2.m4 --- m4-1.4.7/examples/foreach2.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/examples/foreach2.m4 2006-10-20 20:55:56.000000000 -0600 @@ -0,0 +1,10 @@ +include(`quote.m4')dnl +divert(`-1') +# foreach(x, (item_1, item_2, ..., item_n), stmt) +# parenthesized list, improved version +define(`foreach', `pushdef(`$1')_foreach(`$1', + (dquote(dquote_elt$2)), `$3')popdef(`$1')') +define(`_arg1', `$1') +define(`_foreach', `ifelse(`$2', `(`')', `', + `define(`$1', _arg1$2)$3`'$0(`$1', (dquote(shift$2)), `$3')')') +divert`'dnl diff -ruNp m4-1.4.7/examples/foreachq.m4 m4-1.4.8/examples/foreachq.m4 --- m4-1.4.7/examples/foreachq.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/examples/foreachq.m4 2006-10-20 20:55:56.000000000 -0600 @@ -0,0 +1,9 @@ +include(`quote.m4')dnl +divert(`-1') +# foreachq(x, `item_1, item_2, ..., item_n', stmt) +# quoted list, simple version +define(`foreachq', `pushdef(`$1')_foreachq($@)popdef(`$1')') +define(`_arg1', `$1') +define(`_foreachq', `ifelse(quote($2), `', `', + `define(`$1', `_arg1($2)')$3`'$0(`$1', `shift($2)', `$3')')') +divert`'dnl diff -ruNp m4-1.4.7/examples/foreachq2.m4 m4-1.4.8/examples/foreachq2.m4 --- m4-1.4.7/examples/foreachq2.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/examples/foreachq2.m4 2006-10-20 20:55:56.000000000 -0600 @@ -0,0 +1,10 @@ +include(`quote.m4')dnl +divert(`-1') +# foreachq(x, `item_1, item_2, ..., item_n', stmt) +# quoted list, improved version +define(`foreachq', `pushdef(`$1')_foreachq($@)popdef(`$1')') +define(`_arg1q', ``$1'') +define(`_rest', `ifelse(`$#', `1', `', `dquote(shift($@))')') +define(`_foreachq', `ifelse(`$2', `', `', + `define(`$1', _arg1q($2))$3`'$0(`$1', _rest($2), `$3')')') +divert`'dnl diff -ruNp m4-1.4.7/examples/forloop.m4 m4-1.4.8/examples/forloop.m4 --- m4-1.4.7/examples/forloop.m4 2006-09-23 22:28:02.000000000 -0600 +++ m4-1.4.8/examples/forloop.m4 2006-11-20 06:55:43.000000000 -0700 @@ -1,8 +1,6 @@ divert(`-1') -# forloop(var, from, to, stmt) -define(`forloop', - `pushdef(`$1', `$2')_forloop(`$1', `$2', `$3', `$4')popdef(`$1')') +# forloop(var, from, to, stmt) - simple version +define(`forloop', `pushdef(`$1', `$2')_forloop($@)popdef(`$1')') define(`_forloop', - `$4`'ifelse($1, `$3', , - `define(`$1', incr($1))_forloop(`$1', `$2', `$3', `$4')')') + `$4`'ifelse($1, `$3', `', `define(`$1', incr($1))$0($@)')') divert`'dnl diff -ruNp m4-1.4.7/examples/forloop2.m4 m4-1.4.8/examples/forloop2.m4 --- m4-1.4.7/examples/forloop2.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/examples/forloop2.m4 2006-10-19 10:12:46.000000000 -0600 @@ -0,0 +1,12 @@ +divert(`-1') +# forloop(var, from, to, stmt) - improved version: +# works even if VAR is not a strict macro name +# performs sanity check that FROM is larger than TO +# allows complex numerical expressions in TO and FROM +define(`forloop', `ifelse(eval(`($3) >= ($2)'), `1', + `pushdef(`$1', eval(`$2'))_forloop(`$1', + eval(`$3'), `$4')popdef(`$1')')') +define(`_forloop', + `$3`'ifelse(indir(`$1'), `$2', `', + `define(`$1', incr(indir(`$1')))$0($@)')') +divert`'dnl diff -ruNp m4-1.4.7/examples/quote.m4 m4-1.4.8/examples/quote.m4 --- m4-1.4.7/examples/quote.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/examples/quote.m4 2006-10-19 10:12:46.000000000 -0600 @@ -0,0 +1,9 @@ +divert(`-1') +# quote(args) - convert args to single-quoted string +define(`quote', `ifelse(`$#', `0', `', ``$*'')') +# dquote(args) - convert args to quoted list of quoted strings +define(`dquote', ``$@'') +# dquote_elt(args) - convert args to list of double-quoted strings +define(`dquote_elt', `ifelse(`$#', `0', `', `$#', `1', ```$1''', + ```$1'',$0(shift($@))')') +divert`'dnl diff -ruNp m4-1.4.7/install-sh m4-1.4.8/install-sh --- m4-1.4.7/install-sh 2006-09-25 06:08:01.000000000 -0600 +++ m4-1.4.8/install-sh 2006-11-20 07:08:13.000000000 -0700 @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2006-05-11.20 +scriptversion=2006-10-14.15 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -336,12 +336,26 @@ do trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && - exec $mkdirprog $mkdir_mode -p -- / "$tmpdir/d") >/dev/null 2>&1 + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then - # Check for bugs in HP-UX 11.23 and IRIX 6.5 mkdir. - case `ls -ld "$tmpdir"` in - d????-??-* ) posix_mkdir=:;; - esac + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writeable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + ls_ld_tmpdir=`ls -ld "$tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. diff -ruNp m4-1.4.7/lib/Makefile.am m4-1.4.8/lib/Makefile.am --- m4-1.4.7/lib/Makefile.am 2006-09-23 22:28:58.000000000 -0600 +++ m4-1.4.8/lib/Makefile.am 2006-11-20 07:24:20.000000000 -0700 @@ -1,3 +1,4 @@ +## DO NOT EDIT! GENERATED AUTOMATICALLY! ## Process this file with automake to produce Makefile.in. # Copyright (C) 2004-2006 Free Software Foundation, Inc. # @@ -8,14 +9,16 @@ # 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=. --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 +# Reproduce by: gnulib-tool --import --dir=. --lib=libm4 --source-base=lib --m4-base=m4 --doc-base=doc --aux-dir=. --no-libtool --macro-prefix=M4 avltree-oset binary-io clean-temp cloexec close-stream closeout config-h error fdl fopen-safer free gendocs getopt gnupload mkstemp obstack regex stdbool stdlib-safer strstr strtol unlocked-io verror xalloc xvasprintf -AUTOMAKE_OPTIONS = 1.5 gnits no-dependencies +AUTOMAKE_OPTIONS = 1.5 gnits noinst_LIBRARIES = libm4.a libm4_a_SOURCES = -libm4_a_LIBADD = $(LIBOBJS) +libm4_a_LIBADD = $(M4_LIBOBJS) +libm4_a_DEPENDENCIES = $(M4_LIBOBJS) +EXTRA_libm4_a_SOURCES = noinst_HEADERS = EXTRA_DIST = BUILT_SOURCES = @@ -31,41 +34,93 @@ AM_CPPFLAGS = ## begin gnulib module alloca +EXTRA_DIST += alloca.c + +EXTRA_libm4_a_SOURCES += alloca.c + libm4_a_LIBADD += @ALLOCA@ +libm4_a_DEPENDENCIES += @ALLOCA@ ## end gnulib module alloca ## begin gnulib module alloca-opt BUILT_SOURCES += $(ALLOCA_H) -EXTRA_DIST += alloca_.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. alloca.h: alloca_.h - cp -f $(srcdir)/alloca_.h $@-t + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + cat $(srcdir)/alloca_.h; \ + } > $@-t mv -f $@-t $@ MOSTLYCLEANFILES += alloca.h alloca.h-t +EXTRA_DIST += alloca_.h + ## end gnulib module alloca-opt +## begin gnulib module allocsa + +libm4_a_SOURCES += allocsa.h allocsa.c + +EXTRA_DIST += allocsa.valgrind + +## end gnulib module allocsa + +## begin gnulib module avltree-oset + +libm4_a_SOURCES += gl_avltree_oset.h gl_avltree_oset.c gl_anytree_oset.h + +## end gnulib module avltree-oset + ## begin gnulib module binary-io libm4_a_SOURCES += binary-io.h ## end gnulib module binary-io +## begin gnulib module clean-temp + +libm4_a_SOURCES += clean-temp.h clean-temp.c + +## end gnulib module clean-temp + ## begin gnulib module cloexec -EXTRA_DIST += cloexec.h + +EXTRA_DIST += cloexec.c cloexec.h + +EXTRA_libm4_a_SOURCES += cloexec.c ## end gnulib module cloexec ## begin gnulib module close-stream -EXTRA_DIST += close-stream.h + +EXTRA_DIST += close-stream.c close-stream.h + +EXTRA_libm4_a_SOURCES += close-stream.c ## end gnulib module close-stream +## begin gnulib module closeout + + +EXTRA_DIST += closeout.c closeout.h + +EXTRA_libm4_a_SOURCES += closeout.c + +## end gnulib module closeout + +## begin gnulib module error + + +EXTRA_DIST += error.c error.h + +EXTRA_libm4_a_SOURCES += error.c + +## end gnulib module error + ## begin gnulib module exit libm4_a_SOURCES += exit.h @@ -74,34 +129,63 @@ libm4_a_SOURCES += exit.h ## begin gnulib module exitfail -EXTRA_DIST += exitfail.h + +EXTRA_DIST += exitfail.c exitfail.h + +EXTRA_libm4_a_SOURCES += exitfail.c ## end gnulib module exitfail +## begin gnulib module fatal-signal + +libm4_a_SOURCES += fatal-signal.h fatal-signal.c + +## end gnulib module fatal-signal + ## begin gnulib module fopen-safer -EXTRA_DIST += stdio-safer.h stdio--.h + +EXTRA_DIST += fopen-safer.c stdio--.h stdio-safer.h + +EXTRA_libm4_a_SOURCES += fopen-safer.c ## end gnulib module fopen-safer ## begin gnulib module fpending -EXTRA_DIST += __fpending.h + +EXTRA_DIST += __fpending.c __fpending.h + +EXTRA_libm4_a_SOURCES += __fpending.c ## end gnulib module fpending +## begin gnulib module free + + +EXTRA_DIST += free.c + +EXTRA_libm4_a_SOURCES += free.c + +## end gnulib module free + ## begin gnulib module getopt BUILT_SOURCES += $(GETOPT_H) -EXTRA_DIST += getopt_.h getopt_int.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. getopt.h: getopt_.h - cp -f $(srcdir)/getopt_.h $@-t + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + cat $(srcdir)/getopt_.h; \ + } > $@-t mv -f $@-t $@ MOSTLYCLEANFILES += getopt.h getopt.h-t +EXTRA_DIST += getopt.c getopt1.c getopt_.h getopt_int.h + +EXTRA_libm4_a_SOURCES += getopt.c getopt1.c + ## end gnulib module getopt ## begin gnulib module gettext-h @@ -110,9 +194,33 @@ libm4_a_SOURCES += gettext.h ## end gnulib module gettext-h +## begin gnulib module linkedhash-list + +libm4_a_SOURCES += gl_linkedhash_list.h gl_linkedhash_list.c gl_anyhash_list1.h gl_anyhash_list2.h gl_anylinked_list1.h gl_anylinked_list2.h + +## end gnulib module linkedhash-list + +## begin gnulib module list + +libm4_a_SOURCES += gl_list.h gl_list.c + +## end gnulib module list + +## begin gnulib module malloc + + +EXTRA_DIST += malloc.c + +EXTRA_libm4_a_SOURCES += malloc.c + +## end gnulib module malloc + ## begin gnulib module mbchar -libm4_a_SOURCES += mbchar.h + +EXTRA_DIST += mbchar.c mbchar.h + +EXTRA_libm4_a_SOURCES += mbchar.c ## end gnulib module mbchar @@ -122,90 +230,161 @@ libm4_a_SOURCES += mbuiter.h ## end gnulib module mbuiter +## begin gnulib module memchr + + +EXTRA_DIST += memchr.c + +EXTRA_libm4_a_SOURCES += memchr.c + +## end gnulib module memchr + +## begin gnulib module mkdtemp + + +EXTRA_DIST += mkdtemp.c mkdtemp.h + +EXTRA_libm4_a_SOURCES += mkdtemp.c + +## end gnulib module mkdtemp + ## begin gnulib module mkstemp -EXTRA_DIST += mkstemp.h + +EXTRA_DIST += mkstemp.c mkstemp.h + +EXTRA_libm4_a_SOURCES += mkstemp.c ## end gnulib module mkstemp +## begin gnulib module obstack + + +EXTRA_DIST += obstack.c obstack.h + +EXTRA_libm4_a_SOURCES += obstack.c + +## end gnulib module obstack + +## begin gnulib module oset + +libm4_a_SOURCES += gl_oset.h gl_oset.c + +## end gnulib module oset + +## begin gnulib module pathmax + + +EXTRA_DIST += pathmax.h + +## end gnulib module pathmax + +## begin gnulib module quotearg + + +EXTRA_DIST += quotearg.c quotearg.h + +EXTRA_libm4_a_SOURCES += quotearg.c + +## end gnulib module quotearg + ## begin gnulib module regex -EXTRA_DIST += regcomp.c regex.h regex_internal.c regex_internal.h regexec.c + +EXTRA_DIST += regcomp.c regex.c regex.h regex_internal.c regex_internal.h regexec.c + +EXTRA_libm4_a_SOURCES += regcomp.c regex.c regex_internal.c regexec.c ## end gnulib module regex -## begin gnulib module size_max +## begin gnulib module sigprocmask -libm4_a_SOURCES += size_max.h -## end gnulib module size_max +EXTRA_DIST += sigprocmask.c sigprocmask.h -## begin gnulib module stat-macros +EXTRA_libm4_a_SOURCES += sigprocmask.c -EXTRA_DIST += stat-macros.h +## end gnulib module sigprocmask -## end gnulib module stat-macros +## begin gnulib module size_max + +libm4_a_SOURCES += size_max.h + +## end gnulib module size_max ## begin gnulib module stdbool BUILT_SOURCES += $(STDBOOL_H) -EXTRA_DIST += stdbool_.h # We need the following in order to create when the system # doesn't have one that works. stdbool.h: stdbool_.h rm -f $@-t $@ - sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool_.h > $@-t + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool_.h; \ + } > $@-t mv $@-t $@ MOSTLYCLEANFILES += stdbool.h stdbool.h-t +EXTRA_DIST += 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 rm -f $@-t $@ - sed -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \ - -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \ - -e 's|@''ABSOLUTE_STDINT_H''@|$(ABSOLUTE_STDINT_H)|g' \ - -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_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 + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \ + -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \ + -e 's|@''ABSOLUTE_STDINT_H''@|$(ABSOLUTE_STDINT_H)|g' \ + -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_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/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_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 +EXTRA_DIST += stdint_.h + ## end gnulib module stdint ## begin gnulib module stdlib-safer -EXTRA_DIST += stdlib-safer.h stdlib--.h + +EXTRA_DIST += mkstemp-safer.c stdlib--.h stdlib-safer.h + +EXTRA_libm4_a_SOURCES += mkstemp-safer.c ## end gnulib module stdlib-safer ## begin gnulib module strcase -libm4_a_SOURCES += strcase.h + +EXTRA_DIST += strcase.h strcasecmp.c strncasecmp.c + +EXTRA_libm4_a_SOURCES += strcasecmp.c strncasecmp.c ## end gnulib module strcase @@ -215,29 +394,59 @@ libm4_a_SOURCES += strnlen1.h strnlen1.c ## end gnulib module strnlen1 +## begin gnulib module strstr + + +EXTRA_DIST += strstr.c strstr.h + +EXTRA_libm4_a_SOURCES += strstr.c + +## end gnulib module strstr + +## begin gnulib module strtol + + +EXTRA_DIST += strtol.c + +EXTRA_libm4_a_SOURCES += strtol.c + +## end gnulib module strtol + ## begin gnulib module sys_stat BUILT_SOURCES += $(SYS_STAT_H) -EXTRA_DIST += stat_.h # We need the following in order to create when the system # has one that is incomplete. sys/stat.h: stat_.h test -d sys || mkdir sys rm -f $@-t $@ - sed -e 's|@''ABSOLUTE_SYS_STAT_H''@|$(ABSOLUTE_SYS_STAT_H)|g' \ - < $(srcdir)/stat_.h > $@-t + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's|@''ABSOLUTE_SYS_STAT_H''@|$(ABSOLUTE_SYS_STAT_H)|g' \ + < $(srcdir)/stat_.h; \ + } > $@-t mv $@-t $@ MOSTLYCLEANFILES += sys/stat.h sys/stat.h-t MOSTLYCLEANDIRS += sys +EXTRA_DIST += stat_.h + ## end gnulib module sys_stat -## begin gnulib module tmpfile-safer +## begin gnulib module tempname + + +EXTRA_DIST += tempname.c tempname.h -EXTRA_DIST += stdio-safer.h stdio--.h +EXTRA_libm4_a_SOURCES += tempname.c -## end gnulib module tmpfile-safer +## end gnulib module tempname + +## begin gnulib module tmpdir + +libm4_a_SOURCES += tmpdir.h tmpdir.c + +## end gnulib module tmpdir ## begin gnulib module unistd @@ -246,35 +455,53 @@ BUILT_SOURCES += $(UNISTD_H) # We need the following in order to create an empty placeholder for # when the system doesn't have one. unistd.h: - echo '/* Empty placeholder for $@. */' >$@ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + echo '/* Empty placeholder for $@. */'; \ + } > $@ MOSTLYCLEANFILES += unistd.h ## end gnulib module unistd ## begin gnulib module unistd-safer -EXTRA_DIST += unistd-safer.h unistd--.h + +EXTRA_DIST += dup-safer.c fd-safer.c pipe-safer.c unistd--.h unistd-safer.h + +EXTRA_libm4_a_SOURCES += dup-safer.c fd-safer.c pipe-safer.c ## 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 + +EXTRA_DIST += asnprintf.c printf-args.c printf-args.h printf-parse.c printf-parse.h vasnprintf.c vasnprintf.h + +EXTRA_libm4_a_SOURCES += asnprintf.c printf-args.c printf-parse.c vasnprintf.c ## end gnulib module vasnprintf ## begin gnulib module vasprintf -libm4_a_SOURCES += vasprintf.h + +EXTRA_DIST += asprintf.c vasprintf.c vasprintf.h + +EXTRA_libm4_a_SOURCES += asprintf.c vasprintf.c ## end gnulib module vasprintf +## begin gnulib module verify + +libm4_a_SOURCES += verify.h + +## end gnulib module verify + ## begin gnulib module verror libm4_a_SOURCES += verror.h verror.c @@ -289,7 +516,10 @@ libm4_a_SOURCES += wcwidth.h ## begin gnulib module xalloc -EXTRA_DIST += xalloc.h + +EXTRA_DIST += xalloc.h xmalloc.c + +EXTRA_libm4_a_SOURCES += xmalloc.c ## end gnulib module xalloc @@ -299,6 +529,12 @@ libm4_a_SOURCES += xalloc-die.c ## end gnulib module xalloc-die +## begin gnulib module xallocsa + +libm4_a_SOURCES += xallocsa.h xallocsa.c + +## end gnulib module xallocsa + ## begin gnulib module xsize libm4_a_SOURCES += xsize.h @@ -309,13 +545,14 @@ libm4_a_SOURCES += xsize.h libm4_a_SOURCES += xvasprintf.h xvasprintf.c xasprintf.c +EXTRA_DIST += xalloc.h + ## end gnulib module xvasprintf mostlyclean-local: mostlyclean-generic - @test -z "$(MOSTLYCLEANDIRS)" || \ - for dir in $(MOSTLYCLEANDIRS); do \ - if test -d $$dir; then \ - echo "rmdir $$dir"; rmdir $$dir; \ - fi; \ - done + @for dir in '' $(MOSTLYCLEANDIRS); do \ + if test -n "$$dir" && test -d $$dir; then \ + echo "rmdir $$dir"; rmdir $$dir; \ + fi; \ + done diff -ruNp m4-1.4.7/lib/Makefile.in m4-1.4.8/lib/Makefile.in --- m4-1.4.7/lib/Makefile.in 2006-09-25 06:07:59.000000000 -0600 +++ m4-1.4.8/lib/Makefile.in 2006-11-20 07:25:49.000000000 -0700 @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. +# Makefile.in generated by automake 1.10 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -23,18 +23,14 @@ # 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=. --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 +# Reproduce by: gnulib-tool --import --dir=. --lib=libm4 --source-base=lib --m4-base=m4 --doc-base=doc --aux-dir=. --no-libtool --macro-prefix=M4 avltree-oset binary-io clean-temp cloexec close-stream closeout config-h error fdl fopen-safer free gendocs getopt gnupload mkstemp obstack regex stdbool stdlib-safer strstr strtol unlocked-io verror xalloc xvasprintf -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -50,33 +46,35 @@ build_triplet = @build@ host_triplet = @host@ subdir = lib DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ - $(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 + $(srcdir)/Makefile.in $(srcdir)/config.hin alloca.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/cloexec.m4 \ - $(top_srcdir)/m4/close-stream.m4 $(top_srcdir)/m4/codeset.m4 \ + $(top_srcdir)/m4/alloca.m4 $(top_srcdir)/m4/allocsa.m4 \ + $(top_srcdir)/m4/cloexec.m4 $(top_srcdir)/m4/close-stream.m4 \ + $(top_srcdir)/m4/closeout.m4 $(top_srcdir)/m4/codeset.m4 \ + $(top_srcdir)/m4/config-h.m4 $(top_srcdir)/m4/eealloc.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/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/fatal-signal.m4 $(top_srcdir)/m4/fpending.m4 \ + $(top_srcdir)/m4/free.m4 $(top_srcdir)/m4/getopt.m4 \ + $(top_srcdir)/m4/gl_list.m4 $(top_srcdir)/m4/gnulib-comp.m4 \ + $(top_srcdir)/m4/inline.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/mbstate_t.m4 $(top_srcdir)/m4/memchr.m4 \ + $(top_srcdir)/m4/mkdtemp.m4 $(top_srcdir)/m4/mkstemp.m4 \ + $(top_srcdir)/m4/pathmax.m4 $(top_srcdir)/m4/quotearg.m4 \ + $(top_srcdir)/m4/regex.m4 $(top_srcdir)/m4/sig_atomic_t.m4 \ + $(top_srcdir)/m4/signalblocking.m4 \ + $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/ssize_t.m4 \ $(top_srcdir)/m4/stdarg.m4 $(top_srcdir)/m4/stdbool.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/strstr.m4 $(top_srcdir)/m4/strtol.m4 \ + $(top_srcdir)/m4/sys_stat_h.m4 $(top_srcdir)/m4/tempname.m4 \ + $(top_srcdir)/m4/tmpdir.m4 $(top_srcdir)/m4/ulonglong.m4 \ $(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/unistd_h.m4 \ $(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/vasnprintf.m4 \ $(top_srcdir)/m4/vasprintf.m4 $(top_srcdir)/m4/wchar_t.m4 \ @@ -87,26 +85,29 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/a am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = LIBRARIES = $(noinst_LIBRARIES) AR = ar ARFLAGS = cru libm4_a_AR = $(AR) $(ARFLAGS) -am__DEPENDENCIES_1 = @LIBOBJS@ -libm4_a_DEPENDENCIES = $(am__DEPENDENCIES_1) @ALLOCA@ -am_libm4_a_OBJECTS = strnlen1.$(OBJEXT) verror.$(OBJEXT) \ - xalloc-die.$(OBJEXT) xvasprintf.$(OBJEXT) xasprintf.$(OBJEXT) +am__DEPENDENCIES_1 = +am_libm4_a_OBJECTS = allocsa.$(OBJEXT) gl_avltree_oset.$(OBJEXT) \ + clean-temp.$(OBJEXT) fatal-signal.$(OBJEXT) \ + gl_linkedhash_list.$(OBJEXT) gl_list.$(OBJEXT) \ + gl_oset.$(OBJEXT) strnlen1.$(OBJEXT) tmpdir.$(OBJEXT) \ + verror.$(OBJEXT) xalloc-die.$(OBJEXT) xallocsa.$(OBJEXT) \ + xvasprintf.$(OBJEXT) xasprintf.$(OBJEXT) libm4_a_OBJECTS = $(am_libm4_a_OBJECTS) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = -am__depfiles_maybe = +DEFAULT_INCLUDES = -I.@am__isrc@ +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libm4_a_SOURCES) -DIST_SOURCES = $(libm4_a_SOURCES) +SOURCES = $(libm4_a_SOURCES) $(EXTRA_libm4_a_SOURCES) +DIST_SOURCES = $(libm4_a_SOURCES) $(EXTRA_libm4_a_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags @@ -116,8 +117,6 @@ ABSOLUTE_SYS_STAT_H = @ABSOLUTE_SYS_STAT ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ ALLOCA_H = @ALLOCA_H@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ @@ -143,8 +142,6 @@ EGREP = @EGREP@ EOVERFLOW = @EOVERFLOW@ EXEEXT = @EXEEXT@ 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@ @@ -155,8 +152,10 @@ 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_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@ HAVE_WCHAR_H = @HAVE_WCHAR_H@ HAVE__BOOL = @HAVE__BOOL@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -167,7 +166,10 @@ LIBM4_LTLIBDEPS = @LIBM4_LTLIBDEPS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ +M4_LIBOBJS = @M4_LIBOBJS@ +M4_LTLIBOBJS = @M4_LTLIBOBJS@ MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -182,8 +184,6 @@ 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@ @@ -192,9 +192,11 @@ UNISTD_H = @UNISTD_H@ VERSION = @VERSION@ WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ WINT_T_SUFFIX = @WINT_T_SUFFIX@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -206,6 +208,7 @@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ +builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ @@ -233,23 +236,49 @@ program_transform_name = @program_transf psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ -AUTOMAKE_OPTIONS = 1.5 gnits no-dependencies +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AUTOMAKE_OPTIONS = 1.5 gnits 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 verror.h verror.c \ - wcwidth.h xalloc-die.c xsize.h xvasprintf.h xvasprintf.c \ - xasprintf.c -libm4_a_LIBADD = $(LIBOBJS) @ALLOCA@ +libm4_a_SOURCES = allocsa.h allocsa.c gl_avltree_oset.h \ + gl_avltree_oset.c gl_anytree_oset.h binary-io.h clean-temp.h \ + clean-temp.c exit.h fatal-signal.h fatal-signal.c gettext.h \ + gl_linkedhash_list.h gl_linkedhash_list.c gl_anyhash_list1.h \ + gl_anyhash_list2.h gl_anylinked_list1.h gl_anylinked_list2.h \ + gl_list.h gl_list.c mbuiter.h gl_oset.h gl_oset.c size_max.h \ + strnlen1.h strnlen1.c tmpdir.h tmpdir.c verify.h verror.h \ + verror.c wcwidth.h xalloc-die.c xallocsa.h xallocsa.c xsize.h \ + xvasprintf.h xvasprintf.c xasprintf.c +libm4_a_LIBADD = $(M4_LIBOBJS) @ALLOCA@ +libm4_a_DEPENDENCIES = $(M4_LIBOBJS) @ALLOCA@ +EXTRA_libm4_a_SOURCES = alloca.c cloexec.c close-stream.c closeout.c \ + error.c exitfail.c fopen-safer.c __fpending.c free.c getopt.c \ + getopt1.c malloc.c mbchar.c memchr.c mkdtemp.c mkstemp.c \ + obstack.c quotearg.c regcomp.c regex.c regex_internal.c \ + regexec.c sigprocmask.c mkstemp-safer.c strcasecmp.c \ + strncasecmp.c strstr.c strtol.c tempname.c dup-safer.c \ + fd-safer.c pipe-safer.c asnprintf.c printf-args.c \ + printf-parse.c vasnprintf.c asprintf.c vasprintf.c xmalloc.c noinst_HEADERS = -EXTRA_DIST = alloca_.h cloexec.h close-stream.h exitfail.h \ - stdio-safer.h stdio--.h __fpending.h getopt_.h getopt_int.h \ - mkstemp.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 +EXTRA_DIST = alloca.c alloca_.h allocsa.valgrind cloexec.c cloexec.h \ + close-stream.c close-stream.h closeout.c closeout.h error.c \ + error.h exitfail.c exitfail.h fopen-safer.c stdio--.h \ + stdio-safer.h __fpending.c __fpending.h free.c getopt.c \ + getopt1.c getopt_.h getopt_int.h malloc.c mbchar.c mbchar.h \ + memchr.c mkdtemp.c mkdtemp.h mkstemp.c mkstemp.h obstack.c \ + obstack.h pathmax.h quotearg.c quotearg.h regcomp.c regex.c \ + regex.h regex_internal.c regex_internal.h regexec.c \ + sigprocmask.c sigprocmask.h stdbool_.h stdint_.h \ + mkstemp-safer.c stdlib--.h stdlib-safer.h strcase.h \ + strcasecmp.c strncasecmp.c strstr.c strstr.h strtol.c stat_.h \ + tempname.c tempname.h dup-safer.c fd-safer.c pipe-safer.c \ + unistd--.h unistd-safer.h unlocked-io.h asnprintf.c \ + printf-args.c printf-args.h printf-parse.c printf-parse.h \ + vasnprintf.c vasnprintf.h asprintf.c vasprintf.c vasprintf.h \ + xalloc.h xmalloc.c xalloc.h BUILT_SOURCES = $(ALLOCA_H) $(GETOPT_H) $(STDBOOL_H) $(STDINT_H) \ $(SYS_STAT_H) $(UNISTD_H) SUFFIXES = @@ -261,7 +290,7 @@ CLEANFILES = DISTCLEANFILES = MAINTAINERCLEANFILES = AM_CPPFLAGS = -all: $(BUILT_SOURCES) +all: $(BUILT_SOURCES) config.h $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: @@ -296,6 +325,23 @@ $(top_srcdir)/configure: $(am__configur $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +config.h: stamp-h1 + @if test ! -f $@; then \ + rm -f stamp-h1; \ + $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ + else :; fi + +stamp-h1: $(srcdir)/config.hin $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status lib/config.h +$(srcdir)/config.hin: $(am__configure_deps) + cd $(top_srcdir) && $(AUTOHEADER) + rm -f stamp-h1 + touch $@ + +distclean-hdr: + -rm -f config.h stamp-h1 + clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libm4.a: $(libm4_a_OBJECTS) $(libm4_a_DEPENDENCIES) @@ -309,12 +355,74 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/alloca.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/__fpending.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alloca.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/allocsa.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asnprintf.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asprintf.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/clean-temp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cloexec.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/close-stream.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/closeout.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dup-safer.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/error.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exitfail.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fatal-signal.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fd-safer.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fopen-safer.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/free.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gl_avltree_oset.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gl_linkedhash_list.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gl_list.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gl_oset.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/malloc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mbchar.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memchr.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mkdtemp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mkstemp-safer.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mkstemp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/obstack.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pipe-safer.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/printf-args.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/printf-parse.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/quotearg.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regcomp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regex.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regex_internal.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regexec.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sigprocmask.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strcasecmp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strncasecmp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strnlen1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strstr.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strtol.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tempname.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tmpdir.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vasnprintf.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vasprintf.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/verror.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xalloc-die.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xallocsa.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xasprintf.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmalloc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xvasprintf.Po@am__quote@ + .c.o: - $(COMPILE) -c $< +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: - $(COMPILE) -c `$(CYGPATH_W) '$<'` -uninstall-info-am: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ @@ -326,11 +434,11 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS mkid -fID $$unique tags: TAGS -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ +TAGS: $(HEADERS) $(SOURCES) config.hin $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + list='$(SOURCES) $(HEADERS) config.hin $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ @@ -342,11 +450,11 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEP $$tags $$unique; \ fi ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ +CTAGS: $(HEADERS) $(SOURCES) config.hin $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + list='$(SOURCES) $(HEADERS) config.hin $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ @@ -365,22 +473,21 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ @@ -394,7 +501,7 @@ distdir: $(DISTFILES) check-am: all-am check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-am -all-am: Makefile $(LIBRARIES) $(HEADERS) +all-am: Makefile $(LIBRARIES) $(HEADERS) config.h installdirs: install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-am @@ -431,9 +538,10 @@ clean: clean-am clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am distclean: distclean-am + -rm -rf $(DEPDIR) ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags + distclean-hdr distclean-tags dvi: dvi-am @@ -447,15 +555,24 @@ info-am: install-data-am: +install-dvi: install-dvi-am + install-exec-am: +install-html: install-html-am + install-info: install-info-am install-man: +install-pdf: install-pdf-am + +install-ps: install-ps-am + installcheck-am: maintainer-clean: maintainer-clean-am + -rm -rf $(DEPDIR) ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -472,65 +589,78 @@ ps: ps-am ps-am: -uninstall-am: uninstall-info-am +uninstall-am: + +.MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-noinstLIBRARIES ctags distclean distclean-compile \ - distclean-generic distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ + distclean-generic distclean-hdr distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-local pdf pdf-am ps ps-am tags \ - uninstall uninstall-am uninstall-info-am + uninstall uninstall-am # We need the following in order to create when the system # doesn't have one that works with the given compiler. alloca.h: alloca_.h - cp -f $(srcdir)/alloca_.h $@-t + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + cat $(srcdir)/alloca_.h; \ + } > $@-t mv -f $@-t $@ # We need the following in order to create when the system # doesn't have one that works with the given compiler. getopt.h: getopt_.h - cp -f $(srcdir)/getopt_.h $@-t + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + cat $(srcdir)/getopt_.h; \ + } > $@-t mv -f $@-t $@ # We need the following in order to create when the system # doesn't have one that works. stdbool.h: stdbool_.h rm -f $@-t $@ - sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool_.h > $@-t + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + 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 rm -f $@-t $@ - sed -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \ - -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \ - -e 's|@''ABSOLUTE_STDINT_H''@|$(ABSOLUTE_STDINT_H)|g' \ - -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_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 + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \ + -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \ + -e 's|@''ABSOLUTE_STDINT_H''@|$(ABSOLUTE_STDINT_H)|g' \ + -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_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/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_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 @@ -538,22 +668,25 @@ stdint.h: stdint_.h sys/stat.h: stat_.h test -d sys || mkdir sys rm -f $@-t $@ - sed -e 's|@''ABSOLUTE_SYS_STAT_H''@|$(ABSOLUTE_SYS_STAT_H)|g' \ - < $(srcdir)/stat_.h > $@-t + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's|@''ABSOLUTE_SYS_STAT_H''@|$(ABSOLUTE_SYS_STAT_H)|g' \ + < $(srcdir)/stat_.h; \ + } > $@-t mv $@-t $@ # We need the following in order to create an empty placeholder for # when the system doesn't have one. unistd.h: - echo '/* Empty placeholder for $@. */' >$@ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + echo '/* Empty placeholder for $@. */'; \ + } > $@ mostlyclean-local: mostlyclean-generic - @test -z "$(MOSTLYCLEANDIRS)" || \ - for dir in $(MOSTLYCLEANDIRS); do \ - if test -d $$dir; then \ - echo "rmdir $$dir"; rmdir $$dir; \ - fi; \ - done + @for dir in '' $(MOSTLYCLEANDIRS); do \ + if test -n "$$dir" && test -d $$dir; then \ + echo "rmdir $$dir"; rmdir $$dir; \ + fi; \ + done # 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.7/lib/__fpending.h m4-1.4.8/lib/__fpending.h --- m4-1.4.7/lib/__fpending.h 2006-09-23 22:28:32.000000000 -0600 +++ m4-1.4.8/lib/__fpending.h 2006-11-20 06:57:34.000000000 -0700 @@ -1,6 +1,6 @@ /* Declare __fpending. - Copyright (C) 2000, 2003, 2005 Free Software Foundation, Inc. + Copyright (C) 2000, 2003, 2005, 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,13 +21,14 @@ #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 + +#if HAVE_DECL___FPENDING +# if HAVE_STDIO_EXT_H +# include +# endif +#else size_t __fpending (FILE *); #endif diff -ruNp m4-1.4.7/lib/allocsa.c m4-1.4.8/lib/allocsa.c --- m4-1.4.7/lib/allocsa.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/lib/allocsa.c 2006-11-20 06:57:24.000000000 -0700 @@ -0,0 +1,137 @@ +/* Safe automatic memory allocation. + Copyright (C) 2003, 2006 Free Software Foundation, Inc. + Written by Bruno Haible , 2003. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include + +/* Specification. */ +#include "allocsa.h" + +/* The speed critical point in this file is freesa() applied to an alloca() + result: it must be fast, to match the speed of alloca(). The speed of + mallocsa() and freesa() in the other case are not critical, because they + are only invoked for big memory sizes. */ + +#if HAVE_ALLOCA + +/* Store the mallocsa() results in a hash table. This is needed to reliably + distinguish a mallocsa() result and an alloca() result. + + Although it is possible that the same pointer is returned by alloca() and + by mallocsa() at different times in the same application, it does not lead + to a bug in freesa(), because: + - Before a pointer returned by alloca() can point into malloc()ed memory, + the function must return, and once this has happened the programmer must + not call freesa() on it anyway. + - Before a pointer returned by mallocsa() can point into the stack, it + must be freed. The only function that can free it is freesa(), and + when freesa() frees it, it also removes it from the hash table. */ + +#define MAGIC_NUMBER 0x1415fb4a +#define MAGIC_SIZE sizeof (int) +/* This is how the header info would look like without any alignment + considerations. */ +struct preliminary_header { void *next; char room[MAGIC_SIZE]; }; +/* But the header's size must be a multiple of sa_alignment_max. */ +#define HEADER_SIZE \ + (((sizeof (struct preliminary_header) + sa_alignment_max - 1) / sa_alignment_max) * sa_alignment_max) +struct header { void *next; char room[HEADER_SIZE - sizeof (struct preliminary_header) + MAGIC_SIZE]; }; +/* Verify that HEADER_SIZE == sizeof (struct header). */ +typedef int verify1[2 * (HEADER_SIZE == sizeof (struct header)) - 1]; +/* We make the hash table quite big, so that during lookups the probability + of empty hash buckets is quite high. There is no need to make the hash + table resizable, because when the hash table gets filled so much that the + lookup becomes slow, it means that the application has memory leaks. */ +#define HASH_TABLE_SIZE 257 +static void * mallocsa_results[HASH_TABLE_SIZE]; + +#endif + +void * +mallocsa (size_t n) +{ +#if HAVE_ALLOCA + /* Allocate one more word, that serves as an indicator for malloc()ed + memory, so that freesa() of an alloca() result is fast. */ + size_t nplus = n + HEADER_SIZE; + + if (nplus >= n) + { + char *p = (char *) malloc (nplus); + + if (p != NULL) + { + size_t slot; + + p += HEADER_SIZE; + + /* Put a magic number into the indicator word. */ + ((int *) p)[-1] = MAGIC_NUMBER; + + /* Enter p into the hash table. */ + slot = (unsigned long) p % HASH_TABLE_SIZE; + ((struct header *) (p - HEADER_SIZE))->next = mallocsa_results[slot]; + mallocsa_results[slot] = p; + + return p; + } + } + /* Out of memory. */ + return NULL; +#else +# if !MALLOC_0_IS_NONNULL + if (n == 0) + n = 1; +# endif + return malloc (n); +#endif +} + +#if HAVE_ALLOCA +void +freesa (void *p) +{ + /* mallocsa() may have returned NULL. */ + if (p != NULL) + { + /* Attempt to quickly distinguish the mallocsa() result - which has + a magic indicator word - and the alloca() result - which has an + uninitialized indicator word. It is for this test that sa_increment + additional bytes are allocated in the alloca() case. */ + if (((int *) p)[-1] == MAGIC_NUMBER) + { + /* Looks like a mallocsa() result. To see whether it really is one, + perform a lookup in the hash table. */ + size_t slot = (unsigned long) p % HASH_TABLE_SIZE; + void **chain = &mallocsa_results[slot]; + for (; *chain != NULL;) + { + if (*chain == p) + { + /* Found it. Remove it from the hash table and free it. */ + char *p_begin = (char *) p - HEADER_SIZE; + *chain = ((struct header *) p_begin)->next; + free (p_begin); + return; + } + chain = &((struct header *) ((char *) *chain - HEADER_SIZE))->next; + } + } + /* At this point, we know it was not a mallocsa() result. */ + } +} +#endif diff -ruNp m4-1.4.7/lib/allocsa.h m4-1.4.8/lib/allocsa.h --- m4-1.4.7/lib/allocsa.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/lib/allocsa.h 2006-11-20 06:57:25.000000000 -0700 @@ -0,0 +1,128 @@ +/* Safe automatic memory allocation. + Copyright (C) 2003-2006 Free Software Foundation, Inc. + Written by Bruno Haible , 2003. + + This program is free software; you can 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 _ALLOCSA_H +#define _ALLOCSA_H + +#include +#include +#include + + +#ifdef __cplusplus +extern "C" { +#endif + + +/* safe_alloca(N) is equivalent to alloca(N) when it is safe to call + alloca(N); otherwise it returns NULL. It either returns N bytes of + memory allocated on the stack, that lasts until the function returns, + or NULL. + Use of safe_alloca should be avoided: + - inside arguments of function calls - undefined behaviour, + - in inline functions - the allocation may actually last until the + calling function returns. +*/ +#if HAVE_ALLOCA +/* The OS usually guarantees only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + allocate anything larger than 4096 bytes. Also care for the possibility + of a few compiler-allocated temporary stack slots. + This must be a macro, not an inline function. */ +# define safe_alloca(N) ((N) < 4032 ? alloca (N) : NULL) +#else +# define safe_alloca(N) ((N), NULL) +#endif + +/* allocsa(N) is a safe variant of alloca(N). It allocates N bytes of + memory allocated on the stack, that must be freed using freesa() before + the function returns. Upon failure, it returns NULL. */ +#if HAVE_ALLOCA +# define allocsa(N) \ + ((N) < 4032 - sa_increment \ + ? (void *) ((char *) alloca ((N) + sa_increment) + sa_increment) \ + : mallocsa (N)) +#else +# define allocsa(N) \ + mallocsa (N) +#endif +extern void * mallocsa (size_t n); + +/* Free a block of memory allocated through allocsa(). */ +#if HAVE_ALLOCA +extern void freesa (void *p); +#else +# define freesa free +#endif + +/* Maybe we should also define a variant + nallocsa (size_t n, size_t s) - behaves like allocsa (n * s) + If this would be useful in your application. please speak up. */ + + +#ifdef __cplusplus +} +#endif + + +/* ------------------- Auxiliary, non-public definitions ------------------- */ + +/* Determine the alignment of a type at compile time. */ +#if defined __GNUC__ +# define sa_alignof __alignof__ +#elif defined __cplusplus + template struct sa_alignof_helper { char __slot1; type __slot2; }; +# define sa_alignof(type) offsetof (sa_alignof_helper, __slot2) +#elif defined __hpux + /* Work around a HP-UX 10.20 cc bug with enums constants defined as offsetof + values. */ +# define sa_alignof(type) (sizeof (type) <= 4 ? 4 : 8) +#elif defined _AIX + /* Work around an AIX 3.2.5 xlc bug with enums constants defined as offsetof + values. */ +# define sa_alignof(type) (sizeof (type) <= 4 ? 4 : 8) +#else +# define sa_alignof(type) offsetof (struct { char __slot1; type __slot2; }, __slot2) +#endif + +enum +{ +/* The desired alignment of memory allocations is the maximum alignment + among all elementary types. */ + sa_alignment_long = sa_alignof (long), + sa_alignment_double = sa_alignof (double), +#ifdef HAVE_LONG_LONG_INT + sa_alignment_longlong = sa_alignof (long long), +#endif +#ifdef HAVE_LONG_DOUBLE + sa_alignment_longdouble = sa_alignof (long double), +#endif + sa_alignment_max = ((sa_alignment_long - 1) | (sa_alignment_double - 1) +#ifdef HAVE_LONG_LONG_INT + | (sa_alignment_longlong - 1) +#endif +#ifdef HAVE_LONG_DOUBLE + | (sa_alignment_longdouble - 1) +#endif + ) + 1, +/* The increment that guarantees room for a magic word must be >= sizeof (int) + and a multiple of sa_alignment_max. */ + sa_increment = ((sizeof (int) + sa_alignment_max - 1) / sa_alignment_max) * sa_alignment_max +}; + +#endif /* _ALLOCSA_H */ diff -ruNp m4-1.4.7/lib/allocsa.valgrind m4-1.4.8/lib/allocsa.valgrind --- m4-1.4.7/lib/allocsa.valgrind 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/lib/allocsa.valgrind 2006-11-20 06:57:25.000000000 -0700 @@ -0,0 +1,7 @@ +# Suppress a valgrind message about use of uninitialized memory in freesa(). +# This use is OK because it provides only a speedup. +{ + freesa + Memcheck:Cond + fun:freesa +} diff -ruNp m4-1.4.7/lib/clean-temp.c m4-1.4.8/lib/clean-temp.c --- m4-1.4.7/lib/clean-temp.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/lib/clean-temp.c 2006-11-20 07:22:53.000000000 -0700 @@ -0,0 +1,715 @@ +/* Temporary directories and temporary files with automatic cleanup. + Copyright (C) 2001, 2003, 2006 Free Software Foundation, Inc. + Written by Bruno Haible , 2006. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + + +#include + +/* Specification. */ +#include "clean-temp.h" + +#include +#include +#include +#include +#include +#include +#include + +#include "error.h" +#include "fatal-signal.h" +#include "pathmax.h" +#include "tmpdir.h" +#include "mkdtemp.h" +#include "xalloc.h" +#include "xallocsa.h" +#include "gl_linkedhash_list.h" +#include "gettext.h" +#if GNULIB_FWRITEERROR +# include "fwriteerror.h" +#endif +#if GNULIB_CLOSE_STREAM +# include "close-stream.h" +#endif +#if GNULIB_FCNTL_SAFER +# include "fcntl--.h" +#endif +#if GNULIB_FOPEN_SAFER +# include "stdio--.h" +#endif + +#define _(str) gettext (str) + +/* GNU Hurd doesn't have PATH_MAX. */ +#ifndef PATH_MAX +# ifdef MAXPATHLEN +# define PATH_MAX MAXPATHLEN +# else +# define PATH_MAX 1024 +# endif +#endif + +#ifndef uintptr_t +# define uintptr_t unsigned long +#endif + + +/* The use of 'volatile' in the types below (and ISO C 99 section 5.1.2.3.(5)) + ensure that while constructing or modifying the data structures, the field + values are written to memory in the order of the C statements. So the + signal handler can rely on these field values to be up to date. */ + + +/* Registry for a single temporary directory. + 'struct temp_dir' from the public header file overlaps with this. */ +struct tempdir +{ + /* The absolute pathname of the directory. */ + char * volatile dirname; + /* Whether errors during explicit cleanup are reported to standard error. */ + bool cleanup_verbose; + /* Absolute pathnames of subdirectories. */ + gl_list_t /* */ volatile subdirs; + /* Absolute pathnames of files. */ + gl_list_t /* */ volatile files; +}; + +/* List of all temporary directories. */ +static struct +{ + struct tempdir * volatile * volatile tempdir_list; + size_t volatile tempdir_count; + size_t tempdir_allocated; +} cleanup_list /* = { NULL, 0, 0 } */; + +/* List of all open file descriptors to temporary files. */ +static gl_list_t /* */ volatile descriptors; + + +/* For the subdirs and for the files, we use a gl_list_t of type LINKEDHASH. + Why? We need a data structure that + + 1) Can contain an arbitrary number of 'char *' values. The strings + are compared via strcmp, not pointer comparison. + 2) Has insertion and deletion operations that are fast: ideally O(1), + or possibly O(log n). This is important for GNU sort, which may + create a large number of temporary files. + 3) Allows iteration through all elements from within a signal handler. + 4) May or may not allow duplicates. It doesn't matter here, since + any file or subdir can only be removed once. + + Criterion 1) would allow any gl_list_t or gl_oset_t implementation. + + Criterion 2) leaves only GL_LINKEDHASH_LIST, GL_TREEHASH_LIST, or + GL_TREE_OSET. + + Criterion 3) puts at disadvantage GL_TREEHASH_LIST and GL_TREE_OSET. + Namely, iteration through the elements of a binary tree requires access + to many ->left, ->right, ->parent pointers. However, the rebalancing + code for insertion and deletion in an AVL or red-black tree is so + complicated that we cannot assume that >left, ->right, ->parent pointers + are in a consistent state throughout these operations. Therefore, to + avoid a crash in the signal handler, all destructive operations to the + lists would have to be protected by a + block_fatal_signals (); + ... + unblock_fatal_signals (); + pair. Which causes extra system calls. + + Criterion 3) would also discourage GL_ARRAY_LIST and GL_CARRAY_LIST, + if they were not already excluded. Namely, these implementations use + xrealloc(), leaving a time window in which in the list->elements pointer + points to already deallocated memory. To avoid a crash in the signal + handler at such a moment, all destructive operations would have to + protected by block/unblock_fatal_signals (), in this case too. + + A list of type GL_LINKEDHASH_LIST without duplicates fulfills all + requirements: + 2) Insertion and deletion are O(1) on average. + 3) The gl_list_iterator, gl_list_iterator_next implementations do + not trigger memory allocations, nor other system calls, and are + therefore safe to be called from a signal handler. + Furthermore, since SIGNAL_SAFE_LIST is defined, the implementation + of the destructive functions ensures that the list structure is + safe to be traversed at any moment, even when interrupted by an + asynchronous signal. + */ + +/* String equality and hash code functions used by the lists. */ + +static bool +string_equals (const void *x1, const void *x2) +{ + const char *s1 = (const char *) x1; + const char *s2 = (const char *) x2; + return strcmp (s1, s2) == 0; +} + +#define SIZE_BITS (sizeof (size_t) * CHAR_BIT) + +/* A hash function for NUL-terminated char* strings using + the method described by Bruno Haible. + See http://www.haible.de/bruno/hashfunc.html. */ +static size_t +string_hash (const void *x) +{ + const char *s = (const char *) x; + size_t h = 0; + + for (; *s; s++) + h = *s + ((h << 9) | (h >> (SIZE_BITS - 9))); + + return h; +} + + +/* The signal handler. It gets called asynchronously. */ +static void +cleanup () +{ + size_t i; + + /* First close all file descriptors to temporary files. */ + { + gl_list_t fds = descriptors; + + if (fds != NULL) + { + gl_list_iterator_t iter; + const void *element; + + iter = gl_list_iterator (fds); + while (gl_list_iterator_next (&iter, &element, NULL)) + { + int fd = (int) (uintptr_t) element; + close (fd); + } + gl_list_iterator_free (&iter); + } + } + + for (i = 0; i < cleanup_list.tempdir_count; i++) + { + struct tempdir *dir = cleanup_list.tempdir_list[i]; + + if (dir != NULL) + { + gl_list_iterator_t iter; + const void *element; + + /* First cleanup the files in the subdirectories. */ + iter = gl_list_iterator (dir->files); + while (gl_list_iterator_next (&iter, &element, NULL)) + { + const char *file = (const char *) element; + unlink (file); + } + gl_list_iterator_free (&iter); + + /* Then cleanup the subdirectories. */ + iter = gl_list_iterator (dir->subdirs); + while (gl_list_iterator_next (&iter, &element, NULL)) + { + const char *subdir = (const char *) element; + rmdir (subdir); + } + gl_list_iterator_free (&iter); + + /* Then cleanup the temporary directory itself. */ + rmdir (dir->dirname); + } + } +} + +/* Create a temporary directory. + PREFIX is used as a prefix for the name of the temporary directory. It + should be short and still give an indication about the program. + PARENTDIR can be used to specify the parent directory; if NULL, a default + parent directory is used (either $TMPDIR or /tmp or similar). + CLEANUP_VERBOSE determines whether errors during explicit cleanup are + reported to standard error. + Return a fresh 'struct temp_dir' on success. Upon error, an error message + is shown and NULL is returned. */ +struct temp_dir * +create_temp_dir (const char *prefix, const char *parentdir, + bool cleanup_verbose) +{ + struct tempdir * volatile *tmpdirp = NULL; + struct tempdir *tmpdir; + size_t i; + char *xtemplate; + char *tmpdirname; + + /* See whether it can take the slot of an earlier temporary directory + already cleaned up. */ + for (i = 0; i < cleanup_list.tempdir_count; i++) + if (cleanup_list.tempdir_list[i] == NULL) + { + tmpdirp = &cleanup_list.tempdir_list[i]; + break; + } + if (tmpdirp == NULL) + { + /* See whether the array needs to be extended. */ + if (cleanup_list.tempdir_count == cleanup_list.tempdir_allocated) + { + /* Note that we cannot use xrealloc(), because then the cleanup() + function could access an already deallocated array. */ + struct tempdir * volatile *old_array = cleanup_list.tempdir_list; + size_t old_allocated = cleanup_list.tempdir_allocated; + size_t new_allocated = 2 * cleanup_list.tempdir_allocated + 1; + struct tempdir * volatile *new_array = + XNMALLOC (new_allocated, struct tempdir * volatile); + + if (old_allocated == 0) + /* First use of this facility. Register the cleanup handler. */ + at_fatal_signal (&cleanup); + else + { + /* Don't use memcpy() here, because memcpy takes non-volatile + arguments and is therefore not guaranteed to complete all + memory stores before the next statement. */ + size_t k; + + for (k = 0; k < old_allocated; k++) + new_array[k] = old_array[k]; + } + + cleanup_list.tempdir_list = new_array; + cleanup_list.tempdir_allocated = new_allocated; + + /* Now we can free the old array. */ + if (old_array != NULL) + free ((struct tempdir **) old_array); + } + + tmpdirp = &cleanup_list.tempdir_list[cleanup_list.tempdir_count]; + /* Initialize *tmpdirp before incrementing tempdir_count, so that + cleanup() will skip this entry before it is fully initialized. */ + *tmpdirp = NULL; + cleanup_list.tempdir_count++; + } + + /* Initialize a 'struct tempdir'. */ + tmpdir = XMALLOC (struct tempdir); + tmpdir->dirname = NULL; + tmpdir->cleanup_verbose = cleanup_verbose; + tmpdir->subdirs = gl_list_create_empty (GL_LINKEDHASH_LIST, + string_equals, string_hash, false); + tmpdir->files = gl_list_create_empty (GL_LINKEDHASH_LIST, + string_equals, string_hash, false); + + /* Create the temporary directory. */ + xtemplate = (char *) xallocsa (PATH_MAX); + if (path_search (xtemplate, PATH_MAX, parentdir, prefix, parentdir == NULL)) + { + error (0, errno, + _("cannot find a temporary directory, try setting $TMPDIR")); + goto quit; + } + block_fatal_signals (); + tmpdirname = mkdtemp (xtemplate); + if (tmpdirname != NULL) + { + tmpdir->dirname = tmpdirname; + *tmpdirp = tmpdir; + } + unblock_fatal_signals (); + if (tmpdirname == NULL) + { + error (0, errno, + _("cannot create a temporary directory using template \"%s\""), + xtemplate); + goto quit; + } + /* Replace tmpdir->dirname with a copy that has indefinite extent. + We cannot do this inside the block_fatal_signals/unblock_fatal_signals + block because then the cleanup handler would not remove the directory + if xstrdup fails. */ + tmpdir->dirname = xstrdup (tmpdirname); + freesa (xtemplate); + return (struct temp_dir *) tmpdir; + + quit: + freesa (xtemplate); + return NULL; +} + +/* Register the given ABSOLUTE_FILE_NAME as being a file inside DIR, that + needs to be removed before DIR can be removed. + Should be called before the file ABSOLUTE_FILE_NAME is created. */ +void +register_temp_file (struct temp_dir *dir, + const char *absolute_file_name) +{ + struct tempdir *tmpdir = (struct tempdir *)dir; + + /* Add absolute_file_name to tmpdir->files, without duplicates. */ + if (gl_list_search (tmpdir->files, absolute_file_name) == NULL) + gl_list_add_first (tmpdir->files, xstrdup (absolute_file_name)); +} + +/* Unregister the given ABSOLUTE_FILE_NAME as being a file inside DIR, that + needs to be removed before DIR can be removed. + Should be called when the file ABSOLUTE_FILE_NAME could not be created. */ +void +unregister_temp_file (struct temp_dir *dir, + const char *absolute_file_name) +{ + struct tempdir *tmpdir = (struct tempdir *)dir; + gl_list_t list = tmpdir->files; + gl_list_node_t node; + + node = gl_list_search (list, absolute_file_name); + if (node != NULL) + { + char *old_string = (char *) gl_list_node_value (list, node); + + gl_list_remove_node (list, node); + free (old_string); + } +} + +/* Register the given ABSOLUTE_DIR_NAME as being a subdirectory inside DIR, + that needs to be removed before DIR can be removed. + Should be called before the subdirectory ABSOLUTE_DIR_NAME is created. */ +void +register_temp_subdir (struct temp_dir *dir, + const char *absolute_dir_name) +{ + struct tempdir *tmpdir = (struct tempdir *)dir; + + /* Add absolute_dir_name to tmpdir->subdirs, without duplicates. */ + if (gl_list_search (tmpdir->subdirs, absolute_dir_name) == NULL) + gl_list_add_first (tmpdir->subdirs, xstrdup (absolute_dir_name)); +} + +/* Unregister the given ABSOLUTE_DIR_NAME as being a subdirectory inside DIR, + that needs to be removed before DIR can be removed. + Should be called when the subdirectory ABSOLUTE_DIR_NAME could not be + created. */ +void +unregister_temp_subdir (struct temp_dir *dir, + const char *absolute_dir_name) +{ + struct tempdir *tmpdir = (struct tempdir *)dir; + gl_list_t list = tmpdir->subdirs; + gl_list_node_t node; + + node = gl_list_search (list, absolute_dir_name); + if (node != NULL) + { + char *old_string = (char *) gl_list_node_value (list, node); + + gl_list_remove_node (list, node); + free (old_string); + } +} + +/* Remove a file, with optional error message. + Return 0 upon success, or -1 if there was some problem. */ +static int +do_unlink (struct temp_dir *dir, const char *absolute_file_name) +{ + if (unlink (absolute_file_name) < 0 && dir->cleanup_verbose + && errno != ENOENT) + { + error (0, errno, _("cannot remove temporary file %s"), absolute_file_name); + return -1; + } + return 0; +} + +/* Remove a directory, with optional error message. + Return 0 upon success, or -1 if there was some problem. */ +static int +do_rmdir (struct temp_dir *dir, const char *absolute_dir_name) +{ + if (rmdir (absolute_dir_name) < 0 && dir->cleanup_verbose + && errno != ENOENT) + { + error (0, errno, + _("cannot remove temporary directory %s"), absolute_dir_name); + return -1; + } + return 0; +} + +/* Remove the given ABSOLUTE_FILE_NAME and unregister it. + Return 0 upon success, or -1 if there was some problem. */ +int +cleanup_temp_file (struct temp_dir *dir, + const char *absolute_file_name) +{ + int err; + + err = do_unlink (dir, absolute_file_name); + unregister_temp_file (dir, absolute_file_name); + + return err; +} + +/* Remove the given ABSOLUTE_DIR_NAME and unregister it. + Return 0 upon success, or -1 if there was some problem. */ +int +cleanup_temp_subdir (struct temp_dir *dir, + const char *absolute_dir_name) +{ + int err; + + err = do_rmdir (dir, absolute_dir_name); + unregister_temp_subdir (dir, absolute_dir_name); + + return err; +} + +/* Remove all registered files and subdirectories inside DIR. + Return 0 upon success, or -1 if there was some problem. */ +int +cleanup_temp_dir_contents (struct temp_dir *dir) +{ + struct tempdir *tmpdir = (struct tempdir *)dir; + int err = 0; + gl_list_t list; + gl_list_iterator_t iter; + const void *element; + gl_list_node_t node; + + /* First cleanup the files in the subdirectories. */ + list = tmpdir->files; + iter = gl_list_iterator (list); + while (gl_list_iterator_next (&iter, &element, &node)) + { + char *file = (char *) element; + + err |= do_unlink (dir, file); + gl_list_remove_node (list, node); + /* Now only we can free file. */ + free (file); + } + gl_list_iterator_free (&iter); + + /* Then cleanup the subdirectories. */ + list = tmpdir->subdirs; + iter = gl_list_iterator (list); + while (gl_list_iterator_next (&iter, &element, &node)) + { + char *subdir = (char *) element; + + err |= do_rmdir (dir, subdir); + gl_list_remove_node (list, node); + /* Now only we can free subdir. */ + free (subdir); + } + gl_list_iterator_free (&iter); + + return err; +} + +/* Remove all registered files and subdirectories inside DIR and DIR itself. + DIR cannot be used any more after this call. + Return 0 upon success, or -1 if there was some problem. */ +int +cleanup_temp_dir (struct temp_dir *dir) +{ + struct tempdir *tmpdir = (struct tempdir *)dir; + int err = 0; + size_t i; + + err |= cleanup_temp_dir_contents (dir); + err |= do_rmdir (dir, tmpdir->dirname); + + for (i = 0; i < cleanup_list.tempdir_count; i++) + if (cleanup_list.tempdir_list[i] == tmpdir) + { + /* Remove cleanup_list.tempdir_list[i]. */ + if (i + 1 == cleanup_list.tempdir_count) + { + while (i > 0 && cleanup_list.tempdir_list[i - 1] == NULL) + i--; + cleanup_list.tempdir_count = i; + } + else + cleanup_list.tempdir_list[i] = NULL; + /* Now only we can free the tmpdir->dirname and tmpdir itself. */ + free (tmpdir->dirname); + free (tmpdir); + return err; + } + + /* The user passed an invalid DIR argument. */ + abort (); +} + + +/* Register a file descriptor to be closed. */ +static void +register_fd (int fd) +{ + if (descriptors == NULL) + descriptors = gl_list_create_empty (GL_LINKEDHASH_LIST, NULL, NULL, false); + gl_list_add_first (descriptors, (void *) (uintptr_t) fd); +} + +/* Unregister a file descriptor to be closed. */ +static void +unregister_fd (int fd) +{ + gl_list_t fds = descriptors; + gl_list_node_t node; + + if (fds == NULL) + /* descriptors should already contain fd. */ + abort (); + node = gl_list_search (fds, (void *) (uintptr_t) fd); + if (node == NULL) + /* descriptors should already contain fd. */ + abort (); + gl_list_remove_node (fds, node); +} + +/* Open a temporary file in a temporary directory. + Registers the resulting file descriptor to be closed. */ +int +open_temp (const char *file_name, int flags, mode_t mode) +{ + int fd; + int saved_errno; + + block_fatal_signals (); + fd = open (file_name, flags, mode); /* actually open or open_safer */ + saved_errno = errno; + if (fd >= 0) + register_fd (fd); + unblock_fatal_signals (); + errno = saved_errno; + return fd; +} + +/* Open a temporary file in a temporary directory. + Registers the resulting file descriptor to be closed. */ +FILE * +fopen_temp (const char *file_name, const char *mode) +{ + FILE *fp; + int saved_errno; + + block_fatal_signals (); + fp = fopen (file_name, mode); /* actually fopen or fopen_safer */ + saved_errno = errno; + if (fp != NULL) + { + /* It is sufficient to register fileno (fp) instead of the entire fp, + because at cleanup time there is no need to do an fflush (fp); a + close (fileno (fp)) will be enough. */ + int fd = fileno (fp); + if (!(fd >= 0)) + abort (); + register_fd (fd); + } + unblock_fatal_signals (); + errno = saved_errno; + return fp; +} + +/* Close a temporary file in a temporary directory. + Unregisters the previously registered file descriptor. */ +int +close_temp (int fd) +{ + if (fd >= 0) + { + /* No blocking of signals is needed here, since a double close of a + file descriptor is harmless. */ + int result = close (fd); + int saved_errno = errno; + + /* No race condition here: we assume a single-threaded program, hence + fd cannot be re-opened here. */ + + unregister_fd (fd); + + errno = saved_errno; + return result; + } + else + return close (fd); +} + +/* Close a temporary file in a temporary directory. + Unregisters the previously registered file descriptor. */ +int +fclose_temp (FILE *fp) +{ + int fd = fileno (fp); + /* No blocking of signals is needed here, since a double close of a + file descriptor is harmless. */ + int result = fclose (fp); + int saved_errno = errno; + + /* No race condition here: we assume a single-threaded program, hence + fd cannot be re-opened here. */ + + unregister_fd (fd); + + errno = saved_errno; + return result; +} + +#if GNULIB_FWRITEERROR +/* Like fwriteerror. + Unregisters the previously registered file descriptor. */ +int +fwriteerror_temp (FILE *fp) +{ + int fd = fileno (fp); + /* No blocking of signals is needed here, since a double close of a + file descriptor is harmless. */ + int result = fwriteerror (fp); + int saved_errno = errno; + + /* No race condition here: we assume a single-threaded program, hence + fd cannot be re-opened here. */ + + unregister_fd (fd); + + errno = saved_errno; + return result; +} +#endif + +#if GNULIB_CLOSE_STREAM +/* Like close_stream. + Unregisters the previously registered file descriptor. */ +int +close_stream_temp (FILE *fp) +{ + int fd = fileno (fp); + /* No blocking of signals is needed here, since a double close of a + file descriptor is harmless. */ + int result = close_stream (fp); + int saved_errno = errno; + + /* No race condition here: we assume a single-threaded program, hence + fd cannot be re-opened here. */ + + unregister_fd (fd); + + errno = saved_errno; + return result; +} +#endif diff -ruNp m4-1.4.7/lib/clean-temp.h m4-1.4.8/lib/clean-temp.h --- m4-1.4.7/lib/clean-temp.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/lib/clean-temp.h 2006-11-20 06:57:25.000000000 -0700 @@ -0,0 +1,134 @@ +/* Temporary directories and temporary files with automatic cleanup. + Copyright (C) 2006 Free Software Foundation, Inc. + Written by Bruno Haible , 2006. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef _CLEAN_TEMP_H +#define _CLEAN_TEMP_H + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Temporary directories and temporary files should be automatically removed + when the program exits either normally or through a fatal signal. We can't + rely on the "unlink before close" idiom, because it works only on Unix and + also - if no signal blocking is used - leaves a time window where a fatal + signal would not clean up the temporary file. + + Also, open file descriptors need to be closed before the temporary files + and the temporary directories can be removed, because only on Unix + (excluding Cygwin) can one remove directories containing open files. + + This module provides support for temporary directories and temporary files + inside these temporary directories. Temporary files without temporary + directories are not supported here. */ + +struct temp_dir +{ + /* The absolute pathname of the directory. */ + const char * const dir_name; + /* Whether errors during explicit cleanup are reported to standard error. */ + bool cleanup_verbose; + /* More fields are present here, but not public. */ +}; + +/* Create a temporary directory. + PREFIX is used as a prefix for the name of the temporary directory. It + should be short and still give an indication about the program. + PARENTDIR can be used to specify the parent directory; if NULL, a default + parent directory is used (either $TMPDIR or /tmp or similar). + CLEANUP_VERBOSE determines whether errors during explicit cleanup are + reported to standard error. + Return a fresh 'struct temp_dir' on success. Upon error, an error message + is shown and NULL is returned. */ +extern struct temp_dir * create_temp_dir (const char *prefix, + const char *parentdir, + bool cleanup_verbose); + +/* Register the given ABSOLUTE_FILE_NAME as being a file inside DIR, that + needs to be removed before DIR can be removed. + Should be called before the file ABSOLUTE_FILE_NAME is created. */ +extern void register_temp_file (struct temp_dir *dir, + const char *absolute_file_name); + +/* Unregister the given ABSOLUTE_FILE_NAME as being a file inside DIR, that + needs to be removed before DIR can be removed. + Should be called when the file ABSOLUTE_FILE_NAME could not be created. */ +extern void unregister_temp_file (struct temp_dir *dir, + const char *absolute_file_name); + +/* Register the given ABSOLUTE_DIR_NAME as being a subdirectory inside DIR, + that needs to be removed before DIR can be removed. + Should be called before the subdirectory ABSOLUTE_DIR_NAME is created. */ +extern void register_temp_subdir (struct temp_dir *dir, + const char *absolute_dir_name); + +/* Unregister the given ABSOLUTE_DIR_NAME as being a subdirectory inside DIR, + that needs to be removed before DIR can be removed. + Should be called when the subdirectory ABSOLUTE_DIR_NAME could not be + created. */ +extern void unregister_temp_subdir (struct temp_dir *dir, + const char *absolute_dir_name); + +/* Remove the given ABSOLUTE_FILE_NAME and unregister it. + Return 0 upon success, or -1 if there was some problem. */ +extern int cleanup_temp_file (struct temp_dir *dir, + const char *absolute_file_name); + +/* Remove the given ABSOLUTE_DIR_NAME and unregister it. + Return 0 upon success, or -1 if there was some problem. */ +extern int cleanup_temp_subdir (struct temp_dir *dir, + const char *absolute_dir_name); + +/* Remove all registered files and subdirectories inside DIR. + Return 0 upon success, or -1 if there was some problem. */ +extern int cleanup_temp_dir_contents (struct temp_dir *dir); + +/* Remove all registered files and subdirectories inside DIR and DIR itself. + DIR cannot be used any more after this call. + Return 0 upon success, or -1 if there was some problem. */ +extern int cleanup_temp_dir (struct temp_dir *dir); + +/* Open a temporary file in a temporary directory. + Registers the resulting file descriptor to be closed. */ +extern int open_temp (const char *file_name, int flags, mode_t mode); +extern FILE * fopen_temp (const char *file_name, const char *mode); + +/* Close a temporary file in a temporary directory. + Unregisters the previously registered file descriptor. */ +extern int close_temp (int fd); +extern int fclose_temp (FILE *fp); + +/* Like fwriteerror. + Unregisters the previously registered file descriptor. */ +extern int fwriteerror_temp (FILE *fp); + +/* Like close_stream. + Unregisters the previously registered file descriptor. */ +extern int close_stream_temp (FILE *fp); + + +#ifdef __cplusplus +} +#endif + +#endif /* _CLEAN_TEMP_H */ diff -ruNp m4-1.4.7/lib/closeout.c m4-1.4.8/lib/closeout.c --- m4-1.4.7/lib/closeout.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/lib/closeout.c 2006-11-20 06:57:25.000000000 -0700 @@ -0,0 +1,86 @@ +/* Close standard output and standard error, exiting with a diagnostic on error. + + 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. */ + +#include + +#include "closeout.h" + +#include +#include +#include + +#include "gettext.h" +#define _(msgid) gettext (msgid) + +#include "close-stream.h" +#include "error.h" +#include "exitfail.h" +#include "quotearg.h" + +static const char *file_name; + +/* Set the file name to be reported in the event an error is detected + by close_stdout. */ +void +close_stdout_set_file_name (const char *file) +{ + file_name = file; +} + +/* Close standard output. On error, issue a diagnostic and _exit + with status 'exit_failure'. + + Also close standard error. On error, _exit with status 'exit_failure'. + + Since close_stdout is commonly registered via 'atexit', POSIX + and the C standard both say that it should not call 'exit', + because the behavior is undefined if 'exit' is called more than + once. So it calls '_exit' instead of 'exit'. If close_stdout + is registered via atexit before other functions are registered, + the other functions can act before this _exit is invoked. + + Applications that use close_stdout should flush any streams + other than stdout and stderr before exiting, since the call to + _exit will bypass other buffer flushing. Applications should + be flushing and closing other streams anyway, to check for I/O + errors. Also, applications should not use tmpfile, since _exit + can bypass the removal of these files. + + It's important to detect such failures and exit nonzero because many + tools (most notably `make' and other build-management systems) depend + on being able to detect failure in other tools via their exit status. */ + +void +close_stdout (void) +{ + if (close_stream (stdout) != 0) + { + char const *write_error = _("write error"); + if (file_name) + error (0, errno, "%s: %s", quotearg_colon (file_name), + write_error); + else + error (0, errno, "%s", write_error); + + _exit (exit_failure); + } + + if (close_stream (stderr) != 0) + _exit (exit_failure); +} diff -ruNp m4-1.4.7/lib/closeout.h m4-1.4.8/lib/closeout.h --- m4-1.4.7/lib/closeout.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/lib/closeout.h 2006-11-20 06:57:25.000000000 -0700 @@ -0,0 +1,33 @@ +/* Close standard output and standard error. + + Copyright (C) 1998, 2000, 2003, 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. */ + +#ifndef CLOSEOUT_H +# define CLOSEOUT_H 1 + +# ifdef __cplusplus +extern "C" { +# endif + +void close_stdout_set_file_name (const char *file); +void close_stdout (void); + +# ifdef __cplusplus +} +# endif + +#endif diff -ruNp m4-1.4.7/lib/config.hin m4-1.4.8/lib/config.hin --- m4-1.4.7/lib/config.hin 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/lib/config.hin 2006-11-20 07:28:09.000000000 -0700 @@ -0,0 +1,602 @@ +/* lib/config.hin. 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. + */ +#undef CRAY_STACKSEG_END + +/* Define to 1 if using `alloca.c'. */ +#undef C_ALLOCA + +/* Define to 1 if the changeword(REGEXP) functionality is wanted */ +#undef ENABLE_CHANGEWORD + +/* Define as good substitute value for EOVERFLOW. */ +#undef EOVERFLOW + +/* Define to 1 if the return value of system() disagrees with pclose(). */ +#undef FUNC_SYSTEM_BROKEN + +/* Define to 1 when using the gnulib close-stream module. */ +#undef GNULIB_CLOSE_STREAM + +/* Define to 1 when using the gnulib fopen-safer module. */ +#undef GNULIB_FOPEN_SAFER + +/* Define to 1 if you have 'alloca' after including , a header that + may be supplied by this distribution. */ +#undef HAVE_ALLOCA + +/* Define HAVE_ALLOCA_H for backward compatibility with older code that + includes only if HAVE_ALLOCA_H is defined. */ +#undef HAVE_ALLOCA_H + +/* 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 + +/* Define to 1 if you have the declaration of `isblank', and to 0 if you + don't. */ +#undef HAVE_DECL_ISBLANK + +/* Define to 1 if you have the declaration of `mkdir', and to 0 if you don't. + */ +#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 + +/* Define to 1 if you have the declaration of `strncasecmp', and to 0 if you + don't. */ +#undef HAVE_DECL_STRNCASECMP + +/* Define to 1 if you have the declaration of `wcwidth', and to 0 if you + 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 + +/* Define to 1 if you have the `getopt_long_only' function. */ +#undef HAVE_GETOPT_LONG_ONLY + +/* Define to 1 if you have the `gettimeofday' function. */ +#undef HAVE_GETTIMEOFDAY + +/* Define to 1 if the compiler supports one of the keywords 'inline', + '__inline__', '__inline' and effectively inlines functions marked as such. + */ +#undef HAVE_INLINE + +/* Define if you have the 'intmax_t' type in or . */ +#undef HAVE_INTMAX_T + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define if exists, doesn't clash with , and + declares uintmax_t. */ +#undef HAVE_INTTYPES_H_WITH_UINTMAX + +/* 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 + +/* Define if you have and nl_langinfo(CODESET). */ +#undef HAVE_LANGINFO_CODESET + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIMITS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LOCALE_H + +/* Define if you have the 'long double' type. */ +#undef HAVE_LONG_DOUBLE + +/* Define if you have the 'long long' type. */ +#undef HAVE_LONG_LONG + +/* Define to 1 if the system has the type `long long int'. */ +#undef HAVE_LONG_LONG_INT + +/* Define to 1 if you have the `lstat' function. */ +#undef HAVE_LSTAT + +/* Define to 1 if your system has a GNU libc compatible `malloc' function, and + to 0 otherwise. */ +#undef HAVE_MALLOC + +/* Define to 1 if you have the `mbrtowc' function. */ +#undef HAVE_MBRTOWC + +/* Define to 1 if you have the `mbsinit' function. */ +#undef HAVE_MBSINIT + +/* Define to 1 if declares mbstate_t. */ +#undef HAVE_MBSTATE_T + +/* Define to 1 if you have the `memchr' function. */ +#undef HAVE_MEMCHR + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the `mempcpy' function. */ +#undef HAVE_MEMPCPY + +/* Define to 1 if you have the `mkdtemp' function. */ +#undef HAVE_MKDTEMP + +/* 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 you have the sigset_t type and the sigprocmask function. */ +#undef HAVE_POSIX_SIGNALBLOCKING + +/* Define to 1 if the system has the type `ptrdiff_t'. */ +#undef HAVE_PTRDIFF_T + +/* Define to 1 if you have the `raise' function. */ +#undef HAVE_RAISE + +/* Define to 1 if the system has the type `rlim_t'. */ +#undef HAVE_RLIM_T + +/* Define to 1 if you have the `sigaction' function. */ +#undef HAVE_SIGACTION + +/* Define to 1 if you have the `sigaltstack' function. */ +#undef HAVE_SIGALTSTACK + +/* Define to 1 if the system has the type `sigcontext'. */ +#undef HAVE_SIGCONTEXT + +/* Define to 1 if you have the header file. */ +#undef HAVE_SIGINFO_H + +/* 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 lack the sigprocmask function but have the sigset_t + type. */ +#undef HAVE_SIGSET_T + +/* Define to 1 if you have the `sigstack' function. */ +#undef HAVE_SIGSTACK + +/* Define to 1 if you have the `sigvec' function. */ +#undef HAVE_SIGVEC + +/* Define to 1 if the system has the type `sig_atomic_t'. */ +#undef HAVE_SIG_ATOMIC_T + +/* Define to 1 if you have the `snprintf' function. */ +#undef HAVE_SNPRINTF + +/* Define to 1 if the system has the type `stack_t'. */ +#undef HAVE_STACK_T + +/* Define to 1 if stdbool.h conforms to C99. */ +#undef HAVE_STDBOOL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define if exists, doesn't clash with , and declares + 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 + +/* Define to 1 if you have the `strerror' function. */ +#undef HAVE_STRERROR + +/* Define to 1 if you have the `strerror_r' function. */ +#undef HAVE_STRERROR_R + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the `strncasecmp' function. */ +#undef HAVE_STRNCASECMP + +/* Define to 1 if you have the `strtol' function. */ +#undef HAVE_STRTOL + +/* 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_PARAM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TIME_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_WAIT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* 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 + +/* Define to 1 if you have the `vasprintf' function. */ +#undef HAVE_VASPRINTF + +/* Define to 1 if you have the header file. */ +#undef HAVE_WCHAR_H + +/* Define if you have the 'wchar_t' type. */ +#undef HAVE_WCHAR_T + +/* Define to 1 if you have the `wcrtomb' function. */ +#undef HAVE_WCRTOMB + +/* Define to 1 if you have the `wcscoll' function. */ +#undef HAVE_WCSCOLL + +/* Define to 1 if you have the `wcslen' function. */ +#undef HAVE_WCSLEN + +/* Define to 1 if you have the header file. */ +#undef HAVE_WCTYPE_H + +/* Define to 1 if you have the `wcwidth' function. */ +#undef HAVE_WCWIDTH + +/* Define if you have the 'wint_t' type. */ +#undef HAVE_WINT_T + +/* 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 + +/* If malloc(0) is != NULL, define this to 1. Otherwise define this to 0. */ +#undef MALLOC_0_IS_NONNULL + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* 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 if lists must be signal-safe. */ +#undef SIGNAL_SAFE_LIST + +/* 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. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +#undef STACK_DIRECTION + +/* Define to 1 if the `S_IS*' macros in do not work properly. */ +#undef STAT_MACROS_BROKEN + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define to 1 if strerror_r returns char *. */ +#undef STRERROR_R_CHAR_P + +/* 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 + +/* Define to 1 if on AIX 3. + System headers sometimes define this. + We just want to avoid a redefinition error message. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +#undef _FILE_OFFSET_BITS + +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# undef _GNU_SOURCE +#endif + +/* Define for large files, on AIX-style hosts. */ +#undef _LARGE_FILES + +/* Define to 1 if on MINIX. */ +#undef _MINIX + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +#undef _POSIX_1_SOURCE + +/* Define to 1 if you need to in order for `stat' and other things to work. */ +#undef _POSIX_SOURCE + +/* Define if you want regoff_t to be at least as wide POSIX requires. */ +#undef _REGEX_LARGE_OFFSETS + +/* Enable extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# undef __EXTENSIONS__ +#endif +#ifndef _POSIX_PTHREAD_SEMANTICS +# undef _POSIX_PTHREAD_SEMANTICS +#endif +#ifndef _TANDEM_SOURCE +# undef _TANDEM_SOURCE +#endif + +/* Define to rpl_ if the getopt replacement functions and variables should be + used. */ +#undef __GETOPT_PREFIX + +/* Define to rpl_ if the mkstemp replacement function should be used. */ +#undef __MKSTEMP_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)) + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#undef inline +#endif + +/* Define to long or long long if and don't define. */ +#undef intmax_t + +/* Define to rpl_malloc if the replacement function should be used. */ +#undef malloc + +/* Define to a type if does not define. */ +#undef mbstate_t + +/* Define to rpl_re_comp if the replacement should be used. */ +#undef re_comp + +/* Define to rpl_re_compile_fastmap if the replacement should be used. */ +#undef re_compile_fastmap + +/* Define to rpl_re_compile_pattern if the replacement should be used. */ +#undef re_compile_pattern + +/* Define to rpl_re_exec if the replacement should be used. */ +#undef re_exec + +/* Define to rpl_re_match if the replacement should be used. */ +#undef re_match + +/* Define to rpl_re_match_2 if the replacement should be used. */ +#undef re_match_2 + +/* Define to rpl_re_search if the replacement should be used. */ +#undef re_search + +/* Define to rpl_re_search_2 if the replacement should be used. */ +#undef re_search_2 + +/* Define to rpl_re_set_registers if the replacement should be used. */ +#undef re_set_registers + +/* Define to rpl_re_set_syntax if the replacement should be used. */ +#undef re_set_syntax + +/* Define to rpl_re_syntax_options if the replacement should be used. */ +#undef re_syntax_options + +/* Define to rpl_regcomp if the replacement should be used. */ +#undef regcomp + +/* Define to rpl_regerror if the replacement should be used. */ +#undef regerror + +/* Define to rpl_regexec if the replacement should be used. */ +#undef regexec + +/* Define to rpl_regfree if the replacement should be used. */ +#undef regfree + +/* Define to equivalent of C99 restrict keyword, or to nothing if this is not + supported. Do not define if restrict is supported directly. */ +#undef restrict + +/* Define to int if rlim_t is not defined in sys/resource.h */ +#undef rlim_t + +/* Define as an integer type suitable for memory locations that can be + accessed atomically even in the presence of asynchnonous signals. */ +#undef sig_atomic_t + +/* Define to `unsigned int' if does not define. */ +#undef size_t + +/* Define as a signed type of the same size as size_t. */ +#undef ssize_t + +/* Define to struct sigaltstack if stack_t is not in signal.h */ +#undef stack_t + +/* Define as a macro for copying va_list variables. */ +#undef va_copy diff -ruNp m4-1.4.7/lib/fatal-signal.c m4-1.4.8/lib/fatal-signal.c --- m4-1.4.7/lib/fatal-signal.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/lib/fatal-signal.c 2006-11-20 07:22:55.000000000 -0700 @@ -0,0 +1,270 @@ +/* Emergency actions in case of a fatal signal. + Copyright (C) 2003-2004, 2006 Free Software Foundation, Inc. + Written by Bruno Haible , 2003. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + + +#include + +/* Specification. */ +#include "fatal-signal.h" + +#include +#include +#include +#include + +#include "sigprocmask.h" +#include "xalloc.h" + +#define SIZEOF(a) (sizeof(a) / sizeof(a[0])) + + +/* ========================================================================= */ + + +/* The list of fatal signals. + These are those signals whose default action is to terminate the process + without a core dump, except + SIGKILL - because it cannot be caught, + SIGALRM SIGUSR1 SIGUSR2 SIGPOLL SIGIO SIGLOST - because applications + often use them for their own purpose, + SIGPROF SIGVTALRM - because they are used for profiling, + SIGSTKFLT - because it is more similar to SIGFPE, SIGSEGV, SIGBUS, + SIGSYS - because it is more similar to SIGABRT, SIGSEGV, + SIGPWR - because it of too special use, + SIGRTMIN...SIGRTMAX - because they are reserved for application use. + plus + SIGXCPU, SIGXFSZ - because they are quite similar to SIGTERM. */ + +static int fatal_signals[] = + { + /* ISO C 99 signals. */ +#ifdef SIGINT + SIGINT, +#endif +#ifdef SIGTERM + SIGTERM, +#endif + /* POSIX:2001 signals. */ +#ifdef SIGHUP + SIGHUP, +#endif +#ifdef SIGPIPE + SIGPIPE, +#endif + /* BSD signals. */ +#ifdef SIGXCPU + SIGXCPU, +#endif +#ifdef SIGXFSZ + SIGXFSZ, +#endif + /* Woe32 signals. */ +#ifdef SIGBREAK + SIGBREAK, +#endif + 0 + }; + +#define num_fatal_signals (SIZEOF (fatal_signals) - 1) + +/* Eliminate signals whose signal handler is SIG_IGN. */ + +static void +init_fatal_signals (void) +{ + static bool fatal_signals_initialized = false; + if (!fatal_signals_initialized) + { +#if HAVE_SIGACTION + size_t i; + + for (i = 0; i < num_fatal_signals; i++) + { + struct sigaction action; + + if (sigaction (fatal_signals[i], NULL, &action) >= 0 + && action.sa_handler == SIG_IGN) + fatal_signals[i] = -1; + } +#endif + + fatal_signals_initialized = true; + } +} + + +/* ========================================================================= */ + + +typedef void (*action_t) (void); + +/* Type of an entry in the actions array. + The 'action' field is accessed from within the fatal_signal_handler(), + therefore we mark it as 'volatile'. */ +typedef struct +{ + volatile action_t action; +} +actions_entry_t; + +/* The registered cleanup actions. */ +static actions_entry_t static_actions[32]; +static actions_entry_t * volatile actions = static_actions; +static sig_atomic_t volatile actions_count = 0; +static size_t actions_allocated = SIZEOF (static_actions); + + +/* Uninstall the handlers. */ +static inline void +uninstall_handlers () +{ + size_t i; + + for (i = 0; i < num_fatal_signals; i++) + if (fatal_signals[i] >= 0) + signal (fatal_signals[i], SIG_DFL); +} + + +/* The signal handler. It gets called asynchronously. */ +static void +fatal_signal_handler (int sig) +{ + for (;;) + { + /* Get the last registered cleanup action, in a reentrant way. */ + action_t action; + size_t n = actions_count; + if (n == 0) + break; + n--; + actions_count = n; + action = actions[n].action; + /* Execute the action. */ + action (); + } + + /* Now execute the signal's default action. + If signal() blocks the signal being delivered for the duration of the + signal handler's execution, the re-raised signal is delivered when this + handler returns; otherwise it is delivered already during raise(). */ + uninstall_handlers (); +#if HAVE_RAISE + raise (sig); +#else + kill (getpid (), sig); +#endif +} + + +/* Install the handlers. */ +static inline void +install_handlers () +{ + size_t i; + + for (i = 0; i < num_fatal_signals; i++) + if (fatal_signals[i] >= 0) + signal (fatal_signals[i], &fatal_signal_handler); +} + + +/* Register a cleanup function to be executed when a catchable fatal signal + occurs. */ +void +at_fatal_signal (action_t action) +{ + static bool cleanup_initialized = false; + if (!cleanup_initialized) + { + init_fatal_signals (); + install_handlers (); + cleanup_initialized = true; + } + + if (actions_count == actions_allocated) + { + /* Extend the actions array. Note that we cannot use xrealloc(), + because then the cleanup() function could access an already + deallocated array. */ + actions_entry_t *old_actions = actions; + size_t old_actions_allocated = actions_allocated; + size_t new_actions_allocated = 2 * actions_allocated; + actions_entry_t *new_actions = + XNMALLOC (new_actions_allocated, actions_entry_t); + size_t k; + + /* Don't use memcpy() here, because memcpy takes non-volatile arguments + and is therefore not guaranteed to complete all memory stores before + the next statement. */ + for (k = 0; k < old_actions_allocated; k++) + new_actions[k] = old_actions[k]; + actions = new_actions; + actions_allocated = new_actions_allocated; + /* Now we can free the old actions array. */ + if (old_actions != static_actions) + free (old_actions); + } + /* The two uses of 'volatile' in the types above (and ISO C 99 section + 5.1.2.3.(5)) ensure that we increment the actions_count only after + the new action has been written to the memory location + actions[actions_count]. */ + actions[actions_count].action = action; + actions_count++; +} + + +/* ========================================================================= */ + + +static sigset_t fatal_signal_set; + +static void +init_fatal_signal_set () +{ + static bool fatal_signal_set_initialized = false; + if (!fatal_signal_set_initialized) + { + size_t i; + + init_fatal_signals (); + + sigemptyset (&fatal_signal_set); + for (i = 0; i < num_fatal_signals; i++) + if (fatal_signals[i] >= 0) + sigaddset (&fatal_signal_set, fatal_signals[i]); + + fatal_signal_set_initialized = true; + } +} + +/* Temporarily delay the catchable fatal signals. */ +void +block_fatal_signals () +{ + init_fatal_signal_set (); + sigprocmask (SIG_BLOCK, &fatal_signal_set, NULL); +} + +/* Stop delaying the catchable fatal signals. */ +void +unblock_fatal_signals () +{ + init_fatal_signal_set (); + sigprocmask (SIG_UNBLOCK, &fatal_signal_set, NULL); +} diff -ruNp m4-1.4.7/lib/fatal-signal.h m4-1.4.8/lib/fatal-signal.h --- m4-1.4.7/lib/fatal-signal.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/lib/fatal-signal.h 2006-11-20 06:57:26.000000000 -0700 @@ -0,0 +1,77 @@ +/* Emergency actions in case of a fatal signal. + Copyright (C) 2003-2004 Free Software Foundation, Inc. + Written by Bruno Haible , 2003. + + This program is free software; you can 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 __cplusplus +extern "C" { +#endif + + +/* It is often useful to do some cleanup action when a usually fatal signal + terminates the process, like removing a temporary file or killing a + subprocess that may be stuck waiting for a device, pipe or network input. + Such signals are SIGHUP, SIGINT, SIGPIPE, SIGTERM, and possibly others. + The limitation of this facility is that it cannot work for SIGKILL. + + Signals with a SIG_IGN handler are considered to be non-fatal. The + functions in this file assume that when a SIG_IGN handler is installed + for a signal, it was installed before any functions in this file were + called and it stays so for the whole lifetime of the process. */ + +/* Register a cleanup function to be executed when a catchable fatal signal + occurs. + + Restrictions for the cleanup function: + - The cleanup function can do all kinds of system calls. + - It can also access application dependent memory locations and data + structures provided they are in a consistent state. One way to ensure + this is through block_fatal_signals()/unblock_fatal_signals(), see + below. Another - more tricky - way to ensure this is the careful use + of 'volatile'. + However, + - malloc() and similarly complex facilities are not safe to be called + because they are not guaranteed to be in a consistent state. + - Also, the cleanup function must not block the catchable fatal signals + and leave them blocked upon return. + + The cleanup function is executed asynchronously. It is unspecified + whether during its execution the catchable fatal signals are blocked + or not. */ +extern void at_fatal_signal (void (*function) (void)); + + +/* Sometimes it is necessary to block the usually fatal signals while the + data structures being accessed by the cleanup action are being built or + reorganized. This is the case, for example, when a temporary file or + directory is created through mkstemp() or mkdtemp(), because these + functions create the temporary file or directory _before_ returning its + name to the application. */ + +/* Temporarily delay the catchable fatal signals. + The signals will be blocked (= delayed) until the next call to + unblock_fatal_signals(). If the signals are already blocked, a further + call to block_fatal_signals() has no effect. */ +extern void block_fatal_signals (void); + +/* Stop delaying the catchable fatal signals. */ +extern void unblock_fatal_signals (void); + + +#ifdef __cplusplus +} +#endif diff -ruNp m4-1.4.7/lib/getopt_.h m4-1.4.8/lib/getopt_.h --- m4-1.4.7/lib/getopt_.h 2006-09-23 22:28:35.000000000 -0600 +++ m4-1.4.8/lib/getopt_.h 2006-11-20 07:22:57.000000000 -0700 @@ -1,5 +1,5 @@ /* Declarations for getopt. - Copyright (C) 1989-1994,1996-1999,2001,2003,2004,2005 + Copyright (C) 1989-1994,1996-1999,2001,2003,2004,2005,2006 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -196,9 +196,10 @@ struct option scanning, explicitly telling `getopt' that there are no more options. - If OPTS begins with `--', then non-option arguments are treated as - arguments to the option '\0'. This behavior is specific to the GNU - `getopt'. */ + If OPTS begins with `-', then non-option arguments are treated as + arguments to the option '\1'. This behavior is specific to the GNU + `getopt'. If OPTS begins with `+', or POSIXLY_CORRECT is set in + the environment, then do not permute arguments. */ extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) __THROW; diff -ruNp m4-1.4.7/lib/gettext.h m4-1.4.8/lib/gettext.h --- m4-1.4.7/lib/gettext.h 2006-09-23 22:28:35.000000000 -0600 +++ m4-1.4.8/lib/gettext.h 2006-11-20 07:22:57.000000000 -0700 @@ -24,6 +24,18 @@ /* Get declarations of GNU message catalog functions. */ # include +/* You can set the DEFAULT_TEXT_DOMAIN macro to specify the domain used by + the gettext() and ngettext() macros. This is an alternative to calling + textdomain(), and is useful for libraries. */ +# ifdef DEFAULT_TEXT_DOMAIN +# undef gettext +# define gettext(Msgid) \ + dgettext (DEFAULT_TEXT_DOMAIN, Msgid) +# undef ngettext +# define ngettext(Msgid1, Msgid2, N) \ + dngettext (DEFAULT_TEXT_DOMAIN, Msgid1, Msgid2, N) +# endif + #else /* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which @@ -52,17 +64,22 @@ On pre-ANSI systems without 'const', the config.h file is supposed to contain "#define const". */ # define gettext(Msgid) ((const char *) (Msgid)) -# define dgettext(Domainname, Msgid) ((const char *) (Msgid)) -# define dcgettext(Domainname, Msgid, Category) ((const char *) (Msgid)) +# define dgettext(Domainname, Msgid) ((void) (Domainname), gettext (Msgid)) +# define dcgettext(Domainname, Msgid, Category) \ + ((void) (Category), dgettext (Domainname, Msgid)) # define ngettext(Msgid1, Msgid2, N) \ - ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) + ((N) == 1 \ + ? ((void) (Msgid2), (const char *) (Msgid1)) \ + : ((void) (Msgid1), (const char *) (Msgid2))) # define dngettext(Domainname, Msgid1, Msgid2, N) \ - ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) + ((void) (Domainname), ngettext (Msgid1, Msgid2, N)) # define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ - ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) + ((void) (Category), dngettext(Domainname, Msgid1, Msgid2, N)) # define textdomain(Domainname) ((const char *) (Domainname)) -# define bindtextdomain(Domainname, Dirname) ((const char *) (Dirname)) -# define bind_textdomain_codeset(Domainname, Codeset) ((const char *) (Codeset)) +# define bindtextdomain(Domainname, Dirname) \ + ((void) (Domainname), (const char *) (Dirname)) +# define bind_textdomain_codeset(Domainname, Codeset) \ + ((void) (Domainname), (const char *) (Codeset)) #endif @@ -82,14 +99,24 @@ 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) +#ifdef DEFAULT_TEXT_DOMAIN +# define pgettext(Msgctxt, Msgid) \ + pgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) +#else +# define pgettext(Msgctxt, Msgid) \ + pgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) +#endif #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) +#ifdef DEFAULT_TEXT_DOMAIN +# define npgettext(Msgctxt, Msgid, MsgidPlural, N) \ + npgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES) +#else +# define npgettext(Msgctxt, Msgid, MsgidPlural, N) \ + npgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES) +#endif #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) \ @@ -142,7 +169,7 @@ npgettext_aux (const char *domain, #include #define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS \ - (__GNUC__ >= 3 || defined __cplusplus) + (__GNUC__ >= 3 || __GNUG__ >= 2 /* || __STDC_VERSION__ >= 199901L */ ) #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS #include diff -ruNp m4-1.4.7/lib/gl_anyhash_list1.h m4-1.4.8/lib/gl_anyhash_list1.h --- m4-1.4.7/lib/gl_anyhash_list1.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/lib/gl_anyhash_list1.h 2006-11-20 06:57:26.000000000 -0700 @@ -0,0 +1,28 @@ +/* Sequential list data type implemented by a hash table with another list. + Copyright (C) 2006 Free Software Foundation, Inc. + Written by Bruno Haible , 2006. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Common code of + gl_linkedhash_list.c, gl_avltreehash_list.c, gl_rbtreehash_list.c. */ + +/* Hash table entry. */ +struct gl_hash_entry +{ + struct gl_hash_entry *hash_next; /* chain of entries in same bucket */ + size_t hashcode; /* cache of values' common hash code */ +}; +typedef struct gl_hash_entry * gl_hash_entry_t; diff -ruNp m4-1.4.7/lib/gl_anyhash_list2.h m4-1.4.8/lib/gl_anyhash_list2.h --- m4-1.4.7/lib/gl_anyhash_list2.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/lib/gl_anyhash_list2.h 2006-11-20 07:22:57.000000000 -0700 @@ -0,0 +1,127 @@ +/* Sequential list data type implemented by a hash table with another list. + Copyright (C) 2006 Free Software Foundation, Inc. + Written by Bruno Haible , 2006. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Common code of + gl_linkedhash_list.c, gl_avltreehash_list.c, gl_rbtreehash_list.c. */ + +/* Array of primes, approximately in steps of factor 1.2. + This table was computed by executing the Common Lisp expression + (dotimes (i 244) (format t "nextprime(~D)~%" (ceiling (expt 1.2d0 i)))) + and feeding the result to PARI/gp. */ +static const size_t primes[] = + { + 11, 13, 17, 19, 23, 29, 37, 41, 47, 59, 67, 83, 97, 127, 139, 167, 199, + 239, 293, 347, 419, 499, 593, 709, 853, 1021, 1229, 1471, 1777, 2129, 2543, + 3049, 3659, 4391, 5273, 6323, 7589, 9103, 10937, 13109, 15727, 18899, + 22651, 27179, 32609, 39133, 46957, 56359, 67619, 81157, 97369, 116849, + 140221, 168253, 201907, 242309, 290761, 348889, 418667, 502409, 602887, + 723467, 868151, 1041779, 1250141, 1500181, 1800191, 2160233, 2592277, + 3110741, 3732887, 4479463, 5375371, 6450413, 7740517, 9288589, 11146307, + 13375573, 16050689, 19260817, 23112977, 27735583, 33282701, 39939233, + 47927081, 57512503, 69014987, 82818011, 99381577, 119257891, 143109469, + 171731387, 206077643, 247293161, 296751781, 356102141, 427322587, + 512787097, 615344489, 738413383, 886096061, 1063315271, 1275978331, + 1531174013, 1837408799, 2204890543UL, 2645868653UL, 3175042391UL, + 3810050851UL, +#if SIZE_MAX > 4294967295UL + 4572061027UL, 5486473229UL, 6583767889UL, 7900521449UL, 9480625733UL, + 11376750877UL, 13652101063UL, 16382521261UL, 19659025513UL, 23590830631UL, + 28308996763UL, 33970796089UL, 40764955463UL, 48917946377UL, 58701535657UL, + 70441842749UL, 84530211301UL, 101436253561UL, 121723504277UL, + 146068205131UL, 175281846149UL, 210338215379UL, 252405858521UL, + 302887030151UL, 363464436191UL, 436157323417UL, 523388788231UL, + 628066545713UL, 753679854847UL, 904415825857UL, 1085298991109UL, + 1302358789181UL, 1562830547009UL, 1875396656429UL, 2250475987709UL, + 2700571185239UL, 3240685422287UL, 3888822506759UL, 4666587008147UL, + 5599904409713UL, 6719885291641UL, 8063862349969UL, 9676634819959UL, + 11611961783951UL, 13934354140769UL, 16721224968907UL, 20065469962669UL, + 24078563955191UL, 28894276746229UL, 34673132095507UL, 41607758514593UL, + 49929310217531UL, 59915172260971UL, 71898206713183UL, 86277848055823UL, + 103533417666967UL, 124240101200359UL, 149088121440451UL, 178905745728529UL, + 214686894874223UL, 257624273849081UL, 309149128618903UL, 370978954342639UL, + 445174745211143UL, 534209694253381UL, 641051633104063UL, 769261959724877UL, + 923114351670013UL, 1107737222003791UL, 1329284666404567UL, + 1595141599685509UL, 1914169919622551UL, 2297003903547091UL, + 2756404684256459UL, 3307685621107757UL, 3969222745329323UL, + 4763067294395177UL, 5715680753274209UL, 6858816903929113UL, + 8230580284714831UL, 9876696341657791UL, 11852035609989371UL, + 14222442731987227UL, 17066931278384657UL, 20480317534061597UL, + 24576381040873903UL, 29491657249048679UL, 35389988698858471UL, + 42467986438630267UL, 50961583726356109UL, 61153900471627387UL, + 73384680565952851UL, 88061616679143347UL, 105673940014972061UL, + 126808728017966413UL, 152170473621559703UL, 182604568345871671UL, + 219125482015045997UL, 262950578418055169UL, 315540694101666193UL, + 378648832921999397UL, 454378599506399233UL, 545254319407679131UL, + 654305183289214771UL, 785166219947057701UL, 942199463936469157UL, + 1130639356723763129UL, 1356767228068515623UL, 1628120673682218619UL, + 1953744808418662409UL, 2344493770102394881UL, 2813392524122873857UL, + 3376071028947448339UL, 4051285234736937517UL, 4861542281684325481UL, + 5833850738021191727UL, 7000620885625427969UL, 8400745062750513217UL, + 10080894075300616261UL, 12097072890360739951UL, 14516487468432885797UL, + 17419784962119465179UL, +#endif + SIZE_MAX /* sentinel, to ensure the search terminates */ + }; + +/* Return a suitable prime >= ESTIMATE. */ +static size_t +next_prime (size_t estimate) +{ + size_t i; + + for (i = 0; i < sizeof (primes) / sizeof (primes[0]); i++) + if (primes[i] >= estimate) + return primes[i]; + return SIZE_MAX; /* not a prime, but better than nothing */ +} + +/* Resize the hash table with a new estimated size. */ +static void +hash_resize (gl_list_t list, size_t estimate) +{ + size_t new_size = next_prime (estimate); + + if (new_size > list->table_size) + { + gl_hash_entry_t *old_table = list->table; + /* Allocate the new table. */ + gl_hash_entry_t *new_table = XCALLOC (new_size, gl_hash_entry_t); + size_t i; + + /* Iterate through the entries of the old table. */ + for (i = list->table_size; i > 0; ) + { + gl_hash_entry_t node = old_table[--i]; + + while (node != NULL) + { + gl_hash_entry_t next = node->hash_next; + /* Add the entry to the new table. */ + size_t bucket = node->hashcode % new_size; + node->hash_next = new_table[bucket]; + new_table[bucket] = node; + + node = next; + } + } + + list->table = new_table; + list->table_size = new_size; + free (old_table); + } +} diff -ruNp m4-1.4.7/lib/gl_anylinked_list1.h m4-1.4.8/lib/gl_anylinked_list1.h --- m4-1.4.7/lib/gl_anylinked_list1.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/lib/gl_anylinked_list1.h 2006-11-20 06:57:26.000000000 -0700 @@ -0,0 +1,49 @@ +/* Sequential list data type implemented by a linked list. + Copyright (C) 2006 Free Software Foundation, Inc. + Written by Bruno Haible , 2006. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Common code of gl_linked_list.c and gl_linkedhash_list.c. */ + +/* -------------------------- gl_list_t Data Type -------------------------- */ + +/* Concrete list node implementation, valid for this file only. */ +struct gl_list_node_impl +{ +#if WITH_HASHTABLE + struct gl_hash_entry h; /* hash table entry fields; must be first */ +#endif + struct gl_list_node_impl *next; + struct gl_list_node_impl *prev; + const void *value; +}; + +/* Concrete gl_list_impl type, valid for this file only. */ +struct gl_list_impl +{ + struct gl_list_impl_base base; +#if WITH_HASHTABLE + /* A hash table: managed as an array of collision lists. */ + struct gl_hash_entry **table; + size_t table_size; +#endif + /* A circular list anchored at root. + The first node is = root.next, the last node is = root.prev. + The root's value is unused. */ + struct gl_list_node_impl root; + /* Number of list nodes, excluding the root. */ + size_t count; +}; diff -ruNp m4-1.4.7/lib/gl_anylinked_list2.h m4-1.4.8/lib/gl_anylinked_list2.h --- m4-1.4.7/lib/gl_anylinked_list2.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/lib/gl_anylinked_list2.h 2006-11-20 07:22:58.000000000 -0700 @@ -0,0 +1,1045 @@ +/* Sequential list data type implemented by a linked list. + Copyright (C) 2006 Free Software Foundation, Inc. + Written by Bruno Haible , 2006. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Common code of gl_linked_list.c and gl_linkedhash_list.c. */ + +/* If the symbol SIGNAL_SAFE_LIST is defined, the code is compiled in such + a way that a gl_list_t data structure may be used from within a signal + handler. The operations allowed in the signal handler are: + gl_list_iterator, gl_list_iterator_next, gl_list_iterator_free. + The list and node fields that are therefore accessed from the signal handler + are: + list->root, node->next, node->value. + We are careful to make modifications to these fields only in an order + that maintains the consistency of the list data structure at any moment, + and we use 'volatile' assignments to prevent the compiler from reordering + such assignments. */ +#ifdef SIGNAL_SAFE_LIST +# define ASYNCSAFE(type) *(volatile type *)& +#else +# define ASYNCSAFE(type) +#endif + +/* -------------------------- gl_list_t Data Type -------------------------- */ + +static gl_list_t +gl_linked_create_empty (gl_list_implementation_t implementation, + gl_listelement_equals_fn equals_fn, + gl_listelement_hashcode_fn hashcode_fn, + bool allow_duplicates) +{ + struct gl_list_impl *list = XMALLOC (struct gl_list_impl); + + list->base.vtable = implementation; + list->base.equals_fn = equals_fn; + list->base.hashcode_fn = hashcode_fn; + list->base.allow_duplicates = allow_duplicates; +#if WITH_HASHTABLE + list->table_size = 11; + list->table = XCALLOC (list->table_size, gl_hash_entry_t); +#endif + list->root.next = &list->root; + list->root.prev = &list->root; + list->count = 0; + + return list; +} + +static gl_list_t +gl_linked_create (gl_list_implementation_t implementation, + gl_listelement_equals_fn equals_fn, + gl_listelement_hashcode_fn hashcode_fn, + bool allow_duplicates, + size_t count, const void **contents) +{ + struct gl_list_impl *list = XMALLOC (struct gl_list_impl); + gl_list_node_t tail; + + list->base.vtable = implementation; + list->base.equals_fn = equals_fn; + list->base.hashcode_fn = hashcode_fn; + list->base.allow_duplicates = allow_duplicates; +#if WITH_HASHTABLE + { + size_t estimate = xsum (count, count / 2); /* 1.5 * count */ + if (estimate < 10) + estimate = 10; + list->table_size = next_prime (estimate); + list->table = XCALLOC (list->table_size, gl_hash_entry_t); + } +#endif + list->count = count; + tail = &list->root; + for (; count > 0; contents++, count--) + { + gl_list_node_t node = XMALLOC (struct gl_list_node_impl); + + node->value = *contents; +#if WITH_HASHTABLE + node->h.hashcode = + (list->base.hashcode_fn != NULL + ? list->base.hashcode_fn (node->value) + : (size_t)(uintptr_t) node->value); + + /* Add node to the hash table. */ + add_to_bucket (list, node); +#endif + + /* Add node to the list. */ + node->prev = tail; + tail->next = node; + tail = node; + } + tail->next = &list->root; + list->root.prev = tail; + + return list; +} + +static size_t +gl_linked_size (gl_list_t list) +{ + return list->count; +} + +static const void * +gl_linked_node_value (gl_list_t list, gl_list_node_t node) +{ + return node->value; +} + +static gl_list_node_t +gl_linked_next_node (gl_list_t list, gl_list_node_t node) +{ + return (node->next != &list->root ? node->next : NULL); +} + +static gl_list_node_t +gl_linked_previous_node (gl_list_t list, gl_list_node_t node) +{ + return (node->prev != &list->root ? node->prev : NULL); +} + +static const void * +gl_linked_get_at (gl_list_t list, size_t position) +{ + size_t count = list->count; + gl_list_node_t node; + + if (!(position < count)) + /* Invalid argument. */ + abort (); + /* Here we know count > 0. */ + if (position <= ((count - 1) / 2)) + { + node = list->root.next; + for (; position > 0; position--) + node = node->next; + } + else + { + position = count - 1 - position; + node = list->root.prev; + for (; position > 0; position--) + node = node->prev; + } + return node->value; +} + +static gl_list_node_t +gl_linked_set_at (gl_list_t list, size_t position, const void *elt) +{ + size_t count = list->count; + gl_list_node_t node; + + if (!(position < count)) + /* Invalid argument. */ + abort (); + /* Here we know count > 0. */ + if (position <= ((count - 1) / 2)) + { + node = list->root.next; + for (; position > 0; position--) + node = node->next; + } + else + { + position = count - 1 - position; + node = list->root.prev; + for (; position > 0; position--) + node = node->prev; + } +#if WITH_HASHTABLE + if (elt != node->value) + { + size_t new_hashcode = + (list->base.hashcode_fn != NULL + ? list->base.hashcode_fn (elt) + : (size_t)(uintptr_t) elt); + + if (new_hashcode != node->h.hashcode) + { + remove_from_bucket (list, node); + node->value = elt; + node->h.hashcode = new_hashcode; + add_to_bucket (list, node); + } + else + node->value = elt; + } +#else + node->value = elt; +#endif + return node; +} + +static gl_list_node_t +gl_linked_search_from_to (gl_list_t list, size_t start_index, size_t end_index, + const void *elt) +{ + size_t count = list->count; + + if (!(start_index <= end_index && end_index <= count)) + /* Invalid arguments. */ + abort (); + { +#if WITH_HASHTABLE + size_t hashcode = + (list->base.hashcode_fn != NULL + ? list->base.hashcode_fn (elt) + : (size_t)(uintptr_t) elt); + size_t bucket = hashcode % list->table_size; + gl_listelement_equals_fn equals = list->base.equals_fn; + + if (!list->base.allow_duplicates) + { + /* Look for the first match in the hash bucket. */ + gl_list_node_t found = NULL; + gl_list_node_t node; + + for (node = (gl_list_node_t) list->table[bucket]; + node != NULL; + node = (gl_list_node_t) node->h.hash_next) + if (node->h.hashcode == hashcode + && (equals != NULL + ? equals (elt, node->value) + : elt == node->value)) + { + found = node; + break; + } + if (start_index > 0) + /* Look whether found's index is < start_index. */ + for (node = list->root.next; ; node = node->next) + { + if (node == found) + return NULL; + if (--start_index == 0) + break; + } + if (end_index < count) + /* Look whether found's index is >= end_index. */ + { + end_index = count - end_index; + for (node = list->root.prev; ; node = node->prev) + { + if (node == found) + return NULL; + if (--end_index == 0) + break; + } + } + return found; + } + else + { + /* Look whether there is more than one match in the hash bucket. */ + bool multiple_matches = false; + gl_list_node_t first_match = NULL; + gl_list_node_t node; + + for (node = (gl_list_node_t) list->table[bucket]; + node != NULL; + node = (gl_list_node_t) node->h.hash_next) + if (node->h.hashcode == hashcode + && (equals != NULL + ? equals (elt, node->value) + : elt == node->value)) + { + if (first_match == NULL) + first_match = node; + else + { + multiple_matches = true; + break; + } + } + if (multiple_matches) + { + /* We need the match with the smallest index. But we don't have + a fast mapping node -> index. So we have to walk the list. */ + end_index -= start_index; + node = list->root.next; + for (; start_index > 0; start_index--) + node = node->next; + + for (; + end_index > 0; + node = node->next, end_index--) + if (node->h.hashcode == hashcode + && (equals != NULL + ? equals (elt, node->value) + : elt == node->value)) + return node; + /* The matches must have all been at indices < start_index or + >= end_index. */ + return NULL; + } + else + { + if (start_index > 0) + /* Look whether first_match's index is < start_index. */ + for (node = list->root.next; node != &list->root; node = node->next) + { + if (node == first_match) + return NULL; + if (--start_index == 0) + break; + } + if (end_index < list->count) + /* Look whether first_match's index is >= end_index. */ + { + end_index = list->count - end_index; + for (node = list->root.prev; ; node = node->prev) + { + if (node == first_match) + return NULL; + if (--end_index == 0) + break; + } + } + return first_match; + } + } +#else + gl_listelement_equals_fn equals = list->base.equals_fn; + gl_list_node_t node = list->root.next; + + end_index -= start_index; + for (; start_index > 0; start_index--) + node = node->next; + + if (equals != NULL) + { + for (; end_index > 0; node = node->next, end_index--) + if (equals (elt, node->value)) + return node; + } + else + { + for (; end_index > 0; node = node->next, end_index--) + if (elt == node->value) + return node; + } + return NULL; +#endif + } +} + +static size_t +gl_linked_indexof_from_to (gl_list_t list, size_t start_index, size_t end_index, + const void *elt) +{ + size_t count = list->count; + + if (!(start_index <= end_index && end_index <= count)) + /* Invalid arguments. */ + abort (); + { +#if WITH_HASHTABLE + /* Here the hash table doesn't help much. It only allows us to minimize + the number of equals() calls, by looking up first the node and then + its index. */ + size_t hashcode = + (list->base.hashcode_fn != NULL + ? list->base.hashcode_fn (elt) + : (size_t)(uintptr_t) elt); + size_t bucket = hashcode % list->table_size; + gl_listelement_equals_fn equals = list->base.equals_fn; + gl_list_node_t node; + + /* First step: Look up the node. */ + if (!list->base.allow_duplicates) + { + /* Look for the first match in the hash bucket. */ + for (node = (gl_list_node_t) list->table[bucket]; + node != NULL; + node = (gl_list_node_t) node->h.hash_next) + if (node->h.hashcode == hashcode + && (equals != NULL + ? equals (elt, node->value) + : elt == node->value)) + break; + } + else + { + /* Look whether there is more than one match in the hash bucket. */ + bool multiple_matches = false; + gl_list_node_t first_match = NULL; + + for (node = (gl_list_node_t) list->table[bucket]; + node != NULL; + node = (gl_list_node_t) node->h.hash_next) + if (node->h.hashcode == hashcode + && (equals != NULL + ? equals (elt, node->value) + : elt == node->value)) + { + if (first_match == NULL) + first_match = node; + else + { + multiple_matches = true; + break; + } + } + if (multiple_matches) + { + /* We need the match with the smallest index. But we don't have + a fast mapping node -> index. So we have to walk the list. */ + size_t index; + + index = start_index; + node = list->root.next; + for (; start_index > 0; start_index--) + node = node->next; + + for (; + index < end_index; + node = node->next, index++) + if (node->h.hashcode == hashcode + && (equals != NULL + ? equals (elt, node->value) + : elt == node->value)) + return index; + /* The matches must have all been at indices < start_index or + >= end_index. */ + return (size_t)(-1); + } + node = first_match; + } + + /* Second step: Look up the index of the node. */ + if (node == NULL) + return (size_t)(-1); + else + { + size_t index = 0; + + for (; node->prev != &list->root; node = node->prev) + index++; + + if (index >= start_index && index < end_index) + return index; + else + return (size_t)(-1); + } +#else + gl_listelement_equals_fn equals = list->base.equals_fn; + size_t index = start_index; + gl_list_node_t node = list->root.next; + + for (; start_index > 0; start_index--) + node = node->next; + + if (equals != NULL) + { + for (; + index < end_index; + node = node->next, index++) + if (equals (elt, node->value)) + return index; + } + else + { + for (; + index < end_index; + node = node->next, index++) + if (elt == node->value) + return index; + } + return (size_t)(-1); +#endif + } +} + +static gl_list_node_t +gl_linked_add_first (gl_list_t list, const void *elt) +{ + gl_list_node_t node = XMALLOC (struct gl_list_node_impl); + + ASYNCSAFE(const void *) node->value = elt; +#if WITH_HASHTABLE + node->h.hashcode = + (list->base.hashcode_fn != NULL + ? list->base.hashcode_fn (node->value) + : (size_t)(uintptr_t) node->value); + + /* Add node to the hash table. */ + add_to_bucket (list, node); +#endif + + /* Add node to the list. */ + node->prev = &list->root; + ASYNCSAFE(gl_list_node_t) node->next = list->root.next; + node->next->prev = node; + ASYNCSAFE(gl_list_node_t) list->root.next = node; + list->count++; + +#if WITH_HASHTABLE + hash_resize_after_add (list); +#endif + + return node; +} + +static gl_list_node_t +gl_linked_add_last (gl_list_t list, const void *elt) +{ + gl_list_node_t node = XMALLOC (struct gl_list_node_impl); + + ASYNCSAFE(const void *) node->value = elt; +#if WITH_HASHTABLE + node->h.hashcode = + (list->base.hashcode_fn != NULL + ? list->base.hashcode_fn (node->value) + : (size_t)(uintptr_t) node->value); + + /* Add node to the hash table. */ + add_to_bucket (list, node); +#endif + + /* Add node to the list. */ + ASYNCSAFE(gl_list_node_t) node->next = &list->root; + node->prev = list->root.prev; + ASYNCSAFE(gl_list_node_t) node->prev->next = node; + list->root.prev = node; + list->count++; + +#if WITH_HASHTABLE + hash_resize_after_add (list); +#endif + + return node; +} + +static gl_list_node_t +gl_linked_add_before (gl_list_t list, gl_list_node_t node, const void *elt) +{ + gl_list_node_t new_node = XMALLOC (struct gl_list_node_impl); + + ASYNCSAFE(const void *) new_node->value = elt; +#if WITH_HASHTABLE + new_node->h.hashcode = + (list->base.hashcode_fn != NULL + ? list->base.hashcode_fn (new_node->value) + : (size_t)(uintptr_t) new_node->value); + + /* Add new_node to the hash table. */ + add_to_bucket (list, new_node); +#endif + + /* Add new_node to the list. */ + ASYNCSAFE(gl_list_node_t) new_node->next = node; + new_node->prev = node->prev; + ASYNCSAFE(gl_list_node_t) new_node->prev->next = new_node; + node->prev = new_node; + list->count++; + +#if WITH_HASHTABLE + hash_resize_after_add (list); +#endif + + return new_node; +} + +static gl_list_node_t +gl_linked_add_after (gl_list_t list, gl_list_node_t node, const void *elt) +{ + gl_list_node_t new_node = XMALLOC (struct gl_list_node_impl); + + ASYNCSAFE(const void *) new_node->value = elt; +#if WITH_HASHTABLE + new_node->h.hashcode = + (list->base.hashcode_fn != NULL + ? list->base.hashcode_fn (new_node->value) + : (size_t)(uintptr_t) new_node->value); + + /* Add new_node to the hash table. */ + add_to_bucket (list, new_node); +#endif + + /* Add new_node to the list. */ + new_node->prev = node; + ASYNCSAFE(gl_list_node_t) new_node->next = node->next; + new_node->next->prev = new_node; + ASYNCSAFE(gl_list_node_t) node->next = new_node; + list->count++; + +#if WITH_HASHTABLE + hash_resize_after_add (list); +#endif + + return new_node; +} + +static gl_list_node_t +gl_linked_add_at (gl_list_t list, size_t position, const void *elt) +{ + size_t count = list->count; + gl_list_node_t new_node; + + if (!(position <= count)) + /* Invalid argument. */ + abort (); + + new_node = XMALLOC (struct gl_list_node_impl); + ASYNCSAFE(const void *) new_node->value = elt; +#if WITH_HASHTABLE + new_node->h.hashcode = + (list->base.hashcode_fn != NULL + ? list->base.hashcode_fn (new_node->value) + : (size_t)(uintptr_t) new_node->value); + + /* Add new_node to the hash table. */ + add_to_bucket (list, new_node); +#endif + + /* Add new_node to the list. */ + if (position <= (count / 2)) + { + gl_list_node_t node; + + node = &list->root; + for (; position > 0; position--) + node = node->next; + new_node->prev = node; + ASYNCSAFE(gl_list_node_t) new_node->next = node->next; + new_node->next->prev = new_node; + ASYNCSAFE(gl_list_node_t) node->next = new_node; + } + else + { + gl_list_node_t node; + + position = count - position; + node = &list->root; + for (; position > 0; position--) + node = node->prev; + ASYNCSAFE(gl_list_node_t) new_node->next = node; + new_node->prev = node->prev; + ASYNCSAFE(gl_list_node_t) new_node->prev->next = new_node; + node->prev = new_node; + } + list->count++; + +#if WITH_HASHTABLE + hash_resize_after_add (list); +#endif + + return new_node; +} + +static bool +gl_linked_remove_node (gl_list_t list, gl_list_node_t node) +{ + gl_list_node_t prev; + gl_list_node_t next; + +#if WITH_HASHTABLE + /* Remove node from the hash table. */ + remove_from_bucket (list, node); +#endif + + /* Remove node from the list. */ + prev = node->prev; + next = node->next; + + ASYNCSAFE(gl_list_node_t) prev->next = next; + next->prev = prev; + list->count--; + + free (node); + return true; +} + +static bool +gl_linked_remove_at (gl_list_t list, size_t position) +{ + size_t count = list->count; + gl_list_node_t removed_node; + + if (!(position < count)) + /* Invalid argument. */ + abort (); + /* Here we know count > 0. */ + if (position <= ((count - 1) / 2)) + { + gl_list_node_t node; + gl_list_node_t after_removed; + + node = &list->root; + for (; position > 0; position--) + node = node->next; + removed_node = node->next; + after_removed = node->next->next; + ASYNCSAFE(gl_list_node_t) node->next = after_removed; + after_removed->prev = node; + } + else + { + gl_list_node_t node; + gl_list_node_t before_removed; + + position = count - 1 - position; + node = &list->root; + for (; position > 0; position--) + node = node->prev; + removed_node = node->prev; + before_removed = node->prev->prev; + node->prev = before_removed; + ASYNCSAFE(gl_list_node_t) before_removed->next = node; + } +#if WITH_HASHTABLE + remove_from_bucket (list, removed_node); +#endif + list->count--; + + free (removed_node); + return true; +} + +static bool +gl_linked_remove (gl_list_t list, const void *elt) +{ + gl_list_node_t node = gl_linked_search_from_to (list, 0, list->count, elt); + + if (node != NULL) + return gl_linked_remove_node (list, node); + else + return false; +} + +static void +gl_linked_list_free (gl_list_t list) +{ + gl_list_node_t node; + + for (node = list->root.next; node != &list->root; ) + { + gl_list_node_t next = node->next; + free (node); + node = next; + } +#if WITH_HASHTABLE + free (list->table); +#endif + free (list); +} + +/* --------------------- gl_list_iterator_t Data Type --------------------- */ + +static gl_list_iterator_t +gl_linked_iterator (gl_list_t list) +{ + gl_list_iterator_t result; + + result.vtable = list->base.vtable; + result.list = list; + result.p = list->root.next; + result.q = &list->root; +#ifdef lint + result.i = 0; + result.j = 0; + result.count = 0; +#endif + + return result; +} + +static gl_list_iterator_t +gl_linked_iterator_from_to (gl_list_t list, + size_t start_index, size_t end_index) +{ + gl_list_iterator_t result; + size_t n1, n2, n3; + + if (!(start_index <= end_index && end_index <= list->count)) + /* Invalid arguments. */ + abort (); + result.vtable = list->base.vtable; + result.list = list; + n1 = start_index; + n2 = end_index - start_index; + n3 = list->count - end_index; + /* Find the maximum among n1, n2, n3, so as to reduce the number of + loop iterations to n1 + n2 + n3 - max(n1,n2,n3). */ + if (n1 > n2 && n1 > n3) + { + /* n1 is the maximum, use n2 and n3. */ + gl_list_node_t node; + size_t i; + + node = &list->root; + for (i = n3; i > 0; i--) + node = node->prev; + result.q = node; + for (i = n2; i > 0; i--) + node = node->prev; + result.p = node; + } + else if (n2 > n3) + { + /* n2 is the maximum, use n1 and n3. */ + gl_list_node_t node; + size_t i; + + node = list->root.next; + for (i = n1; i > 0; i--) + node = node->next; + result.p = node; + + node = &list->root; + for (i = n3; i > 0; i--) + node = node->prev; + result.q = node; + } + else + { + /* n3 is the maximum, use n1 and n2. */ + gl_list_node_t node; + size_t i; + + node = list->root.next; + for (i = n1; i > 0; i--) + node = node->next; + result.p = node; + for (i = n2; i > 0; i--) + node = node->next; + result.q = node; + } + +#ifdef lint + result.i = 0; + result.j = 0; + result.count = 0; +#endif + + return result; +} + +static bool +gl_linked_iterator_next (gl_list_iterator_t *iterator, + const void **eltp, gl_list_node_t *nodep) +{ + if (iterator->p != iterator->q) + { + gl_list_node_t node = (gl_list_node_t) iterator->p; + *eltp = node->value; + if (nodep != NULL) + *nodep = node; + iterator->p = node->next; + return true; + } + else + return false; +} + +static void +gl_linked_iterator_free (gl_list_iterator_t *iterator) +{ +} + +/* ---------------------- Sorted gl_list_t Data Type ---------------------- */ + +static gl_list_node_t +gl_linked_sortedlist_search (gl_list_t list, gl_listelement_compar_fn compar, + const void *elt) +{ + gl_list_node_t node; + + for (node = list->root.next; node != &list->root; node = node->next) + { + int cmp = compar (node->value, elt); + + if (cmp > 0) + break; + if (cmp == 0) + return node; + } + return NULL; +} + +static gl_list_node_t +gl_linked_sortedlist_search_from_to (gl_list_t list, + gl_listelement_compar_fn compar, + size_t low, size_t high, + const void *elt) +{ + size_t count = list->count; + + if (!(low <= high && high <= list->count)) + /* Invalid arguments. */ + abort (); + + high -= low; + if (high > 0) + { + /* Here we know low < count. */ + size_t position = low; + gl_list_node_t node; + + if (position <= ((count - 1) / 2)) + { + node = list->root.next; + for (; position > 0; position--) + node = node->next; + } + else + { + position = count - 1 - position; + node = list->root.prev; + for (; position > 0; position--) + node = node->prev; + } + + do + { + int cmp = compar (node->value, elt); + + if (cmp > 0) + break; + if (cmp == 0) + return node; + node = node->next; + } + while (--high > 0); + } + return NULL; +} + +static size_t +gl_linked_sortedlist_indexof (gl_list_t list, gl_listelement_compar_fn compar, + const void *elt) +{ + gl_list_node_t node; + size_t index; + + for (node = list->root.next, index = 0; + node != &list->root; + node = node->next, index++) + { + int cmp = compar (node->value, elt); + + if (cmp > 0) + break; + if (cmp == 0) + return index; + } + return (size_t)(-1); +} + +static size_t +gl_linked_sortedlist_indexof_from_to (gl_list_t list, + gl_listelement_compar_fn compar, + size_t low, size_t high, + const void *elt) +{ + size_t count = list->count; + + if (!(low <= high && high <= list->count)) + /* Invalid arguments. */ + abort (); + + high -= low; + if (high > 0) + { + /* Here we know low < count. */ + size_t index = low; + size_t position = low; + gl_list_node_t node; + + if (position <= ((count - 1) / 2)) + { + node = list->root.next; + for (; position > 0; position--) + node = node->next; + } + else + { + position = count - 1 - position; + node = list->root.prev; + for (; position > 0; position--) + node = node->prev; + } + + do + { + int cmp = compar (node->value, elt); + + if (cmp > 0) + break; + if (cmp == 0) + return index; + node = node->next; + index++; + } + while (--high > 0); + } + return (size_t)(-1); +} + +static gl_list_node_t +gl_linked_sortedlist_add (gl_list_t list, gl_listelement_compar_fn compar, + const void *elt) +{ + gl_list_node_t node; + + for (node = list->root.next; node != &list->root; node = node->next) + if (compar (node->value, elt) >= 0) + return gl_linked_add_before (list, node, elt); + return gl_linked_add_last (list, elt); +} + +static bool +gl_linked_sortedlist_remove (gl_list_t list, gl_listelement_compar_fn compar, + const void *elt) +{ + gl_list_node_t node; + + for (node = list->root.next; node != &list->root; node = node->next) + { + int cmp = compar (node->value, elt); + + if (cmp > 0) + break; + if (cmp == 0) + return gl_linked_remove_node (list, node); + } + return false; +} diff -ruNp m4-1.4.7/lib/gl_anytree_oset.h m4-1.4.8/lib/gl_anytree_oset.h --- m4-1.4.7/lib/gl_anytree_oset.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/lib/gl_anytree_oset.h 2006-11-20 07:22:58.000000000 -0700 @@ -0,0 +1,287 @@ +/* Ordered set data type implemented by a binary tree. + Copyright (C) 2006 Free Software Foundation, Inc. + Written by Bruno Haible , 2006. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Common code of gl_avltree_oset.c and gl_rbtree_oset.c. */ + +/* An item on the stack used for iterating across the elements. */ +typedef struct +{ + gl_oset_node_t node; + bool rightp; +} iterstack_item_t; + +/* A stack used for iterating across the elements. */ +typedef iterstack_item_t iterstack_t[MAXHEIGHT]; + +static gl_oset_t +gl_tree_create_empty (gl_oset_implementation_t implementation, + gl_setelement_compar_fn compar_fn) +{ + struct gl_oset_impl *set = XMALLOC (struct gl_oset_impl); + + set->base.vtable = implementation; + set->base.compar_fn = compar_fn; + set->root = NULL; + set->count = 0; + + return set; +} + +static size_t +gl_tree_size (gl_oset_t set) +{ + return set->count; +} + +static bool +gl_tree_search (gl_oset_t set, const void *elt) +{ + gl_setelement_compar_fn compar = set->base.compar_fn; + gl_oset_node_t node; + + for (node = set->root; node != NULL; ) + { + int cmp = (compar != NULL + ? compar (node->value, elt) + : (node->value > elt ? 1 : + node->value < elt ? -1 : 0)); + + if (cmp < 0) + node = node->right; + else if (cmp > 0) + node = node->left; + else /* cmp == 0 */ + /* We have an element equal to ELT. */ + return true; + } + return false; +} + +static bool +gl_tree_search_atleast (gl_oset_t set, + gl_setelement_threshold_fn threshold_fn, + const void *threshold, + const void **eltp) +{ + gl_oset_node_t node; + + for (node = set->root; node != NULL; ) + { + if (! threshold_fn (node->value, threshold)) + node = node->right; + else + { + /* We have an element >= VALUE. But we need the leftmost such + element. */ + gl_oset_node_t found = node; + node = node->left; + for (; node != NULL; ) + { + if (! threshold_fn (node->value, threshold)) + node = node->right; + else + { + found = node; + node = node->left; + } + } + *eltp = found->value; + return true; + } + } + return false; +} + +static gl_oset_node_t +gl_tree_search_node (gl_oset_t set, const void *elt) +{ + gl_setelement_compar_fn compar = set->base.compar_fn; + gl_oset_node_t node; + + for (node = set->root; node != NULL; ) + { + int cmp = (compar != NULL + ? compar (node->value, elt) + : (node->value > elt ? 1 : + node->value < elt ? -1 : 0)); + + if (cmp < 0) + node = node->right; + else if (cmp > 0) + node = node->left; + else /* cmp == 0 */ + /* We have an element equal to ELT. */ + return node; + } + return NULL; +} + +static bool +gl_tree_add (gl_oset_t set, const void *elt) +{ + gl_setelement_compar_fn compar; + gl_oset_node_t node = set->root; + + if (node == NULL) + { + gl_tree_add_first (set, elt); + return true; + } + + compar = set->base.compar_fn; + + for (;;) + { + int cmp = (compar != NULL + ? compar (node->value, elt) + : (node->value > elt ? 1 : + node->value < elt ? -1 : 0)); + + if (cmp < 0) + { + if (node->right == NULL) + { + gl_tree_add_after (set, node, elt); + return true; + } + node = node->right; + } + else if (cmp > 0) + { + if (node->left == NULL) + { + gl_tree_add_before (set, node, elt); + return true; + } + node = node->left; + } + else /* cmp == 0 */ + return false; + } +} + +static bool +gl_tree_remove (gl_oset_t set, const void *elt) +{ + gl_oset_node_t node = gl_tree_search_node (set, elt); + + if (node != NULL) + return gl_tree_remove_node (set, node); + else + return false; +} + +static void +gl_tree_oset_free (gl_oset_t set) +{ + /* Iterate across all elements in post-order. */ + gl_oset_node_t node = set->root; + iterstack_t stack; + iterstack_item_t *stack_ptr = &stack[0]; + + for (;;) + { + /* Descend on left branch. */ + for (;;) + { + if (node == NULL) + break; + stack_ptr->node = node; + stack_ptr->rightp = false; + node = node->left; + stack_ptr++; + } + /* Climb up again. */ + for (;;) + { + if (stack_ptr == &stack[0]) + goto done_iterate; + stack_ptr--; + node = stack_ptr->node; + if (!stack_ptr->rightp) + break; + /* Free the current node. */ + free (node); + } + /* Descend on right branch. */ + stack_ptr->rightp = true; + node = node->right; + stack_ptr++; + } + done_iterate: + free (set); +} + +/* --------------------- gl_oset_iterator_t Data Type --------------------- */ + +static gl_oset_iterator_t +gl_tree_iterator (gl_oset_t set) +{ + gl_oset_iterator_t result; + gl_oset_node_t node; + + result.vtable = set->base.vtable; + result.set = set; + /* Start node is the leftmost node. */ + node = set->root; + if (node != NULL) + while (node->left != NULL) + node = node->left; + result.p = node; + /* End point is past the rightmost node. */ + result.q = NULL; +#ifdef lint + result.i = 0; + result.j = 0; + result.count = 0; +#endif + + return result; +} + +static bool +gl_tree_iterator_next (gl_oset_iterator_t *iterator, const void **eltp) +{ + if (iterator->p != iterator->q) + { + gl_oset_node_t node = (gl_oset_node_t) iterator->p; + *eltp = node->value; + /* Advance to the next node. */ + if (node->right != NULL) + { + node = node->right; + while (node->left != NULL) + node = node->left; + } + else + { + while (node->parent != NULL && node->parent->right == node) + node = node->parent; + node = node->parent; + } + iterator->p = node; + return true; + } + else + return false; +} + +static void +gl_tree_iterator_free (gl_oset_iterator_t *iterator) +{ +} diff -ruNp m4-1.4.7/lib/gl_avltree_oset.c m4-1.4.8/lib/gl_avltree_oset.c --- m4-1.4.7/lib/gl_avltree_oset.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/lib/gl_avltree_oset.c 2006-11-20 07:22:58.000000000 -0700 @@ -0,0 +1,572 @@ +/* Ordered set data type implemented by a binary tree. + Copyright (C) 2006 Free Software Foundation, Inc. + Written by Bruno Haible , 2006. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include + +/* Specification. */ +#include "gl_avltree_oset.h" + +#include + +#include "xalloc.h" + +/* An AVL tree is a binary tree where + 1. The height of each node is calculated as + heightof(node) = 1 + max (heightof(node.left), heightof(node.right)). + 2. The heights of the subtrees of each node differ by at most 1: + | heightof(right) - heightof(left) | <= 1. + 3. The index of the elements in the node.left subtree are smaller than + the index of node. + The index of the elements in the node.right subtree are larger than + the index of node. + */ + +/* -------------------------- gl_oset_t Data Type -------------------------- */ + +/* Tree node implementation, valid for this file only. */ +struct gl_oset_node_impl +{ + struct gl_oset_node_impl *left; /* left branch, or NULL */ + struct gl_oset_node_impl *right; /* right branch, or NULL */ + /* Parent pointer, or NULL. The parent pointer is not needed for most + operations. It is needed so that a gl_oset_node_t can be returned + without memory allocation, on which the functions gl_oset_remove_node, + gl_oset_add_before, gl_oset_add_after can be implemented. */ + struct gl_oset_node_impl *parent; + int balance; /* heightof(right) - heightof(left), + always = -1 or 0 or 1 */ + const void *value; +}; +typedef struct gl_oset_node_impl * gl_oset_node_t; + +/* Concrete gl_oset_impl type, valid for this file only. */ +struct gl_oset_impl +{ + struct gl_oset_impl_base base; + struct gl_oset_node_impl *root; /* root node or NULL */ + size_t count; /* number of nodes */ +}; + +/* An AVL tree of height h has at least F_(h+2) [Fibonacci number] and at most + 2^h - 1 elements. So, h <= 84 (because a tree of height h >= 85 would have + at least F_87 elements, and because even on 64-bit machines, + sizeof (gl_oset_node_impl) * F_87 > 2^64 + this would exceed the address space of the machine. */ +#define MAXHEIGHT 83 + +/* Ensure the tree is balanced, after an insertion or deletion operation. + The height of NODE is incremented by HEIGHT_DIFF (1 or -1). + PARENT = NODE->parent. (NODE can also be NULL. But PARENT is non-NULL.) + Rotation operations are performed starting at PARENT (not NODE itself!). */ +static void +rebalance (gl_oset_t set, + gl_oset_node_t node, int height_diff, gl_oset_node_t parent) +{ + for (;;) + { + gl_oset_node_t child; + int previous_balance; + int balance_diff; + gl_oset_node_t nodeleft; + gl_oset_node_t noderight; + + child = node; + node = parent; + + previous_balance = node->balance; + + /* The balance of NODE is incremented by BALANCE_DIFF: +1 if the right + branch's height has increased by 1 or the left branch's height has + decreased by 1, -1 if the right branch's height has decreased by 1 or + the left branch's height has increased by 1, 0 if no height change. */ + if (node->left != NULL || node->right != NULL) + balance_diff = (child == node->right ? height_diff : -height_diff); + else + /* Special case where above formula doesn't work, because the caller + didn't tell whether node's left or right branch shrunk from height 1 + to NULL. */ + balance_diff = - previous_balance; + + node->balance += balance_diff; + if (balance_diff == previous_balance) + { + /* node->balance is outside the range [-1,1]. Must rotate. */ + gl_oset_node_t *nodep; + + if (node->parent == NULL) + /* node == set->root */ + nodep = &set->root; + else if (node->parent->left == node) + nodep = &node->parent->left; + else if (node->parent->right == node) + nodep = &node->parent->right; + else + abort (); + + nodeleft = node->left; + noderight = node->right; + + if (balance_diff < 0) + { + /* node->balance = -2. The subtree is heavier on the left side. + Rotate from left to right: + + * + / \ + h+2 h + */ + gl_oset_node_t nodeleftright = nodeleft->right; + if (nodeleft->balance <= 0) + { + /* + * h+2|h+3 + / \ / \ + h+2 h --> / h+1|h+2 + / \ | / \ + h+1 h|h+1 h+1 h|h+1 h + */ + node->left = nodeleftright; + nodeleft->right = node; + + nodeleft->parent = node->parent; + node->parent = nodeleft; + if (nodeleftright != NULL) + nodeleftright->parent = node; + + nodeleft->balance += 1; + node->balance = - nodeleft->balance; + + *nodep = nodeleft; + height_diff = (height_diff < 0 + ? /* noderight's height had been decremented from + h+1 to h. The subtree's height changes from + h+3 to h+2|h+3. */ + nodeleft->balance - 1 + : /* nodeleft's height had been incremented from + h+1 to h+2. The subtree's height changes from + h+2 to h+2|h+3. */ + nodeleft->balance); + } + else + { + /* + * h+2 + / \ / \ + h+2 h --> h+1 h+1 + / \ / \ / \ + h h+1 h L R h + / \ + L R + + */ + gl_oset_node_t L = nodeleft->right = nodeleftright->left; + gl_oset_node_t R = node->left = nodeleftright->right; + nodeleftright->left = nodeleft; + nodeleftright->right = node; + + nodeleftright->parent = node->parent; + if (L != NULL) + L->parent = nodeleft; + if (R != NULL) + R->parent = node; + nodeleft->parent = nodeleftright; + node->parent = nodeleftright; + + nodeleft->balance = (nodeleftright->balance > 0 ? -1 : 0); + node->balance = (nodeleftright->balance < 0 ? 1 : 0); + nodeleftright->balance = 0; + + *nodep = nodeleftright; + height_diff = (height_diff < 0 + ? /* noderight's height had been decremented from + h+1 to h. The subtree's height changes from + h+3 to h+2. */ + -1 + : /* nodeleft's height had been incremented from + h+1 to h+2. The subtree's height changes from + h+2 to h+2. */ + 0); + } + } + else + { + /* node->balance = 2. The subtree is heavier on the right side. + Rotate from right to left: + + * + / \ + h h+2 + */ + gl_oset_node_t noderightleft = noderight->left; + if (noderight->balance >= 0) + { + /* + * h+2|h+3 + / \ / \ + h h+2 --> h+1|h+2 \ + / \ / \ | + h|h+1 h+1 h h|h+1 h+1 + */ + node->right = noderightleft; + noderight->left = node; + + noderight->parent = node->parent; + node->parent = noderight; + if (noderightleft != NULL) + noderightleft->parent = node; + + noderight->balance -= 1; + node->balance = - noderight->balance; + + *nodep = noderight; + height_diff = (height_diff < 0 + ? /* nodeleft's height had been decremented from + h+1 to h. The subtree's height changes from + h+3 to h+2|h+3. */ + - noderight->balance - 1 + : /* noderight's height had been incremented from + h+1 to h+2. The subtree's height changes from + h+2 to h+2|h+3. */ + - noderight->balance); + } + else + { + /* + * h+2 + / \ / \ + h h+2 --> h+1 h+1 + / \ / \ / \ + h+1 h h L R h + / \ + L R + + */ + gl_oset_node_t L = node->right = noderightleft->left; + gl_oset_node_t R = noderight->left = noderightleft->right; + noderightleft->left = node; + noderightleft->right = noderight; + + noderightleft->parent = node->parent; + if (L != NULL) + L->parent = node; + if (R != NULL) + R->parent = noderight; + node->parent = noderightleft; + noderight->parent = noderightleft; + + node->balance = (noderightleft->balance > 0 ? -1 : 0); + noderight->balance = (noderightleft->balance < 0 ? 1 : 0); + noderightleft->balance = 0; + + *nodep = noderightleft; + height_diff = (height_diff < 0 + ? /* nodeleft's height had been decremented from + h+1 to h. The subtree's height changes from + h+3 to h+2. */ + -1 + : /* noderight's height had been incremented from + h+1 to h+2. The subtree's height changes from + h+2 to h+2. */ + 0); + } + } + node = *nodep; + } + else + { + /* No rotation needed. Only propagation of the height change to the + next higher level. */ + if (height_diff < 0) + height_diff = (previous_balance == 0 ? 0 : -1); + else + height_diff = (node->balance == 0 ? 0 : 1); + } + + if (height_diff == 0) + break; + + parent = node->parent; + if (parent == NULL) + break; + } +} + +static gl_oset_node_t +gl_tree_add_first (gl_oset_t set, const void *elt) +{ + /* Create new node. */ + gl_oset_node_t new_node = XMALLOC (struct gl_oset_node_impl); + + new_node->left = NULL; + new_node->right = NULL; + new_node->balance = 0; + new_node->value = elt; + + /* Add it to the tree. */ + if (set->root == NULL) + { + set->root = new_node; + new_node->parent = NULL; + } + else + { + gl_oset_node_t node; + + for (node = set->root; node->left != NULL; ) + node = node->left; + + node->left = new_node; + new_node->parent = node; + node->balance--; + + /* Rebalance. */ + if (node->right == NULL && node->parent != NULL) + rebalance (set, node, 1, node->parent); + } + + set->count++; + return new_node; +} + +static gl_oset_node_t +gl_tree_add_before (gl_oset_t set, gl_oset_node_t node, const void *elt) +{ + /* Create new node. */ + gl_oset_node_t new_node = XMALLOC (struct gl_oset_node_impl); + bool height_inc; + + new_node->left = NULL; + new_node->right = NULL; + new_node->balance = 0; + new_node->value = elt; + + /* Add it to the tree. */ + if (node->left == NULL) + { + node->left = new_node; + node->balance--; + height_inc = (node->right == NULL); + } + else + { + for (node = node->left; node->right != NULL; ) + node = node->right; + node->right = new_node; + node->balance++; + height_inc = (node->left == NULL); + } + new_node->parent = node; + + /* Rebalance. */ + if (height_inc && node->parent != NULL) + rebalance (set, node, 1, node->parent); + + set->count++; + return new_node; +} + +static gl_oset_node_t +gl_tree_add_after (gl_oset_t set, gl_oset_node_t node, const void *elt) +{ + /* Create new node. */ + gl_oset_node_t new_node = XMALLOC (struct gl_oset_node_impl); + bool height_inc; + + new_node->left = NULL; + new_node->right = NULL; + new_node->balance = 0; + new_node->value = elt; + + /* Add it to the tree. */ + if (node->right == NULL) + { + node->right = new_node; + node->balance++; + height_inc = (node->left == NULL); + } + else + { + for (node = node->right; node->left != NULL; ) + node = node->left; + node->left = new_node; + node->balance--; + height_inc = (node->right == NULL); + } + new_node->parent = node; + + /* Rebalance. */ + if (height_inc && node->parent != NULL) + rebalance (set, node, 1, node->parent); + + set->count++; + return new_node; +} + +static bool +gl_tree_remove_node (gl_oset_t set, gl_oset_node_t node) +{ + gl_oset_node_t parent = node->parent; + + if (node->left == NULL) + { + /* Replace node with node->right. */ + gl_oset_node_t child = node->right; + + if (child != NULL) + child->parent = parent; + if (parent == NULL) + set->root = child; + else + { + if (parent->left == node) + parent->left = child; + else /* parent->right == node */ + parent->right = child; + + rebalance (set, child, -1, parent); + } + } + else if (node->right == NULL) + { + /* It is not absolutely necessary to treat this case. But the more + general case below is more complicated, hence slower. */ + /* Replace node with node->left. */ + gl_oset_node_t child = node->left; + + child->parent = parent; + if (parent == NULL) + set->root = child; + else + { + if (parent->left == node) + parent->left = child; + else /* parent->right == node */ + parent->right = child; + + rebalance (set, child, -1, parent); + } + } + else + { + /* Replace node with the rightmost element of the node->left subtree. */ + gl_oset_node_t subst; + gl_oset_node_t subst_parent; + gl_oset_node_t child; + + for (subst = node->left; subst->right != NULL; ) + subst = subst->right; + + subst_parent = subst->parent; + + child = subst->left; + + /* The case subst_parent == node is special: If we do nothing special, + we get confusion about node->left, subst->left and child->parent. + subst_parent == node + <==> The 'for' loop above terminated immediately. + <==> subst == subst_parent->left + [otherwise subst == subst_parent->right] + In this case, we would need to first set + child->parent = node; node->left = child; + and later - when we copy subst into node's position - again + child->parent = subst; subst->left = child; + Altogether a no-op. */ + if (subst_parent != node) + { + if (child != NULL) + child->parent = subst_parent; + subst_parent->right = child; + } + + /* Copy subst into node's position. + (This is safer than to copy subst's value into node, keep node in + place, and free subst.) */ + if (subst_parent != node) + { + subst->left = node->left; + subst->left->parent = subst; + } + subst->right = node->right; + subst->right->parent = subst; + subst->balance = node->balance; + subst->parent = parent; + if (parent == NULL) + set->root = subst; + else if (parent->left == node) + parent->left = subst; + else /* parent->right == node */ + parent->right = subst; + + /* Rebalancing starts at child's parent, that is subst_parent - + except when subst_parent == node. In this case, we need to use + its replacement, subst. */ + rebalance (set, child, -1, subst_parent != node ? subst_parent : subst); + } + + set->count--; + free (node); + return true; +} + +/* Generic binary tree code. */ +#include "gl_anytree_oset.h" + +/* For debugging. */ +static unsigned int +check_invariants (gl_oset_node_t node, gl_oset_node_t parent, size_t *counterp) +{ + unsigned int left_height = + (node->left != NULL ? check_invariants (node->left, node, counterp) : 0); + unsigned int right_height = + (node->right != NULL ? check_invariants (node->right, node, counterp) : 0); + int balance = (int)right_height - (int)left_height; + + if (!(node->parent == parent)) + abort (); + if (!(balance >= -1 && balance <= 1)) + abort (); + if (!(node->balance == balance)) + abort (); + + (*counterp)++; + + return 1 + (left_height > right_height ? left_height : right_height); +} +void +gl_avltree_oset_check_invariants (gl_oset_t set) +{ + size_t counter = 0; + if (set->root != NULL) + check_invariants (set->root, NULL, &counter); + if (!(set->count == counter)) + abort (); +} + +const struct gl_oset_implementation gl_avltree_oset_implementation = + { + gl_tree_create_empty, + gl_tree_size, + gl_tree_search, + gl_tree_search_atleast, + gl_tree_add, + gl_tree_remove, + gl_tree_oset_free, + gl_tree_iterator, + gl_tree_iterator_next, + gl_tree_iterator_free + }; diff -ruNp m4-1.4.7/lib/gl_avltree_oset.h m4-1.4.8/lib/gl_avltree_oset.h --- m4-1.4.7/lib/gl_avltree_oset.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/lib/gl_avltree_oset.h 2006-11-20 06:57:27.000000000 -0700 @@ -0,0 +1,35 @@ +/* Ordered set data type implemented by a binary tree. + Copyright (C) 2006 Free Software Foundation, Inc. + Written by Bruno Haible , 2006. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef _GL_AVLTREE_OSET_H +#define _GL_AVLTREE_OSET_H + +#include "gl_oset.h" + +#ifdef __cplusplus +extern "C" { +#endif + +extern const struct gl_oset_implementation gl_avltree_oset_implementation; +#define GL_AVLTREE_OSET &gl_avltree_oset_implementation + +#ifdef __cplusplus +} +#endif + +#endif /* _GL_AVLTREE_OSET_H */ diff -ruNp m4-1.4.7/lib/gl_linkedhash_list.c m4-1.4.8/lib/gl_linkedhash_list.c --- m4-1.4.7/lib/gl_linkedhash_list.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/lib/gl_linkedhash_list.c 2006-11-20 06:57:27.000000000 -0700 @@ -0,0 +1,123 @@ +/* Sequential list data type implemented by a hash table with a linked list. + Copyright (C) 2006 Free Software Foundation, Inc. + Written by Bruno Haible , 2006. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include + +/* Specification. */ +#include "gl_linkedhash_list.h" + +#include /* for SIZE_MAX */ +#include + +#include "xalloc.h" +#include "xsize.h" + +#ifndef uintptr_t +# define uintptr_t unsigned long +#endif + +#define WITH_HASHTABLE 1 + +/* -------------------------- gl_list_t Data Type -------------------------- */ + +/* Generic hash-table code. */ +#include "gl_anyhash_list1.h" + +/* Generic linked list code. */ +#include "gl_anylinked_list1.h" + +/* Generic hash-table code. */ +#include "gl_anyhash_list2.h" + +/* Resize the hash table if needed, after list->count was incremented. */ +static inline void +hash_resize_after_add (gl_list_t list) +{ + size_t count = list->count; + size_t estimate = xsum (count, count / 2); /* 1.5 * count */ + if (estimate > list->table_size) + hash_resize (list, estimate); +} + +/* Add a node to the hash table structure. */ +static inline void +add_to_bucket (gl_list_t list, gl_list_node_t node) +{ + size_t bucket = node->h.hashcode % list->table_size; + + node->h.hash_next = list->table[bucket]; + list->table[bucket] = &node->h; +} + +/* Remove a node from the hash table structure. */ +static inline void +remove_from_bucket (gl_list_t list, gl_list_node_t node) +{ + size_t bucket = node->h.hashcode % list->table_size; + gl_hash_entry_t *p; + + for (p = &list->table[bucket]; ; p = &(*p)->hash_next) + { + if (*p == &node->h) + { + *p = node->h.hash_next; + break; + } + if (*p == NULL) + /* node is not in the right bucket. Did the hash codes + change inadvertently? */ + abort (); + } +} + +/* Generic linked list code. */ +#include "gl_anylinked_list2.h" + + +const struct gl_list_implementation gl_linkedhash_list_implementation = + { + gl_linked_create_empty, + gl_linked_create, + gl_linked_size, + gl_linked_node_value, + gl_linked_next_node, + gl_linked_previous_node, + gl_linked_get_at, + gl_linked_set_at, + gl_linked_search_from_to, + gl_linked_indexof_from_to, + gl_linked_add_first, + gl_linked_add_last, + gl_linked_add_before, + gl_linked_add_after, + gl_linked_add_at, + gl_linked_remove_node, + gl_linked_remove_at, + gl_linked_remove, + gl_linked_list_free, + gl_linked_iterator, + gl_linked_iterator_from_to, + gl_linked_iterator_next, + gl_linked_iterator_free, + gl_linked_sortedlist_search, + gl_linked_sortedlist_search_from_to, + gl_linked_sortedlist_indexof, + gl_linked_sortedlist_indexof_from_to, + gl_linked_sortedlist_add, + gl_linked_sortedlist_remove + }; diff -ruNp m4-1.4.7/lib/gl_linkedhash_list.h m4-1.4.8/lib/gl_linkedhash_list.h --- m4-1.4.7/lib/gl_linkedhash_list.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/lib/gl_linkedhash_list.h 2006-11-20 06:57:27.000000000 -0700 @@ -0,0 +1,35 @@ +/* Sequential list data type implemented by a hash table with a linked list. + Copyright (C) 2006 Free Software Foundation, Inc. + Written by Bruno Haible , 2006. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef _GL_LINKEDHASH_LIST_H +#define _GL_LINKEDHASH_LIST_H + +#include "gl_list.h" + +#ifdef __cplusplus +extern "C" { +#endif + +extern const struct gl_list_implementation gl_linkedhash_list_implementation; +#define GL_LINKEDHASH_LIST &gl_linkedhash_list_implementation + +#ifdef __cplusplus +} +#endif + +#endif /* _GL_LINKEDHASH_LIST_H */ diff -ruNp m4-1.4.7/lib/gl_list.c m4-1.4.8/lib/gl_list.c --- m4-1.4.7/lib/gl_list.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/lib/gl_list.c 2006-11-20 06:57:27.000000000 -0700 @@ -0,0 +1,272 @@ +/* Abstract sequential list data type. + Copyright (C) 2006 Free Software Foundation, Inc. + Written by Bruno Haible , 2006. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include + +/* Specification. */ +#include "gl_list.h" + +#if !HAVE_INLINE + +/* Define all functions of this file as inline accesses to the + struct gl_list_implementation. + Use #define to avoid a warning because of extern vs. static. */ + +gl_list_t +gl_list_create_empty (gl_list_implementation_t implementation, + gl_listelement_equals_fn equals_fn, + gl_listelement_hashcode_fn hashcode_fn, + bool allow_duplicates) +{ + return implementation->create_empty (implementation, equals_fn, hashcode_fn, + allow_duplicates); +} + +gl_list_t +gl_list_create (gl_list_implementation_t implementation, + gl_listelement_equals_fn equals_fn, + gl_listelement_hashcode_fn hashcode_fn, + bool allow_duplicates, + size_t count, const void **contents) +{ + return implementation->create (implementation, equals_fn, hashcode_fn, + allow_duplicates, count, contents); +} + +size_t +gl_list_size (gl_list_t list) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->size (list); +} + +const void * +gl_list_node_value (gl_list_t list, gl_list_node_t node) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->node_value (list, node); +} + +gl_list_node_t +gl_list_next_node (gl_list_t list, gl_list_node_t node) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->next_node (list, node); +} + +gl_list_node_t +gl_list_previous_node (gl_list_t list, gl_list_node_t node) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->previous_node (list, node); +} + +const void * +gl_list_get_at (gl_list_t list, size_t position) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->get_at (list, position); +} + +gl_list_node_t +gl_list_set_at (gl_list_t list, size_t position, const void *elt) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->set_at (list, position, elt); +} + +gl_list_node_t +gl_list_search (gl_list_t list, const void *elt) +{ + size_t size = ((const struct gl_list_impl_base *) list)->vtable->size (list); + return ((const struct gl_list_impl_base *) list)->vtable + ->search_from_to (list, 0, size, elt); +} + +gl_list_node_t +gl_list_search_from (gl_list_t list, size_t start_index, const void *elt) +{ + size_t size = ((const struct gl_list_impl_base *) list)->vtable->size (list); + return ((const struct gl_list_impl_base *) list)->vtable + ->search_from_to (list, start_index, size, elt); +} + +gl_list_node_t +gl_list_search_from_to (gl_list_t list, size_t start_index, size_t end_index, const void *elt) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->search_from_to (list, start_index, end_index, elt); +} + +size_t +gl_list_indexof (gl_list_t list, const void *elt) +{ + size_t size = ((const struct gl_list_impl_base *) list)->vtable->size (list); + return ((const struct gl_list_impl_base *) list)->vtable + ->indexof_from_to (list, 0, size, elt); +} + +size_t +gl_list_indexof_from (gl_list_t list, size_t start_index, const void *elt) +{ + size_t size = ((const struct gl_list_impl_base *) list)->vtable->size (list); + return ((const struct gl_list_impl_base *) list)->vtable + ->indexof_from_to (list, start_index, size, elt); +} + +size_t +gl_list_indexof_from_to (gl_list_t list, size_t start_index, size_t end_index, const void *elt) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->indexof_from_to (list, start_index, end_index, elt); +} + +gl_list_node_t +gl_list_add_first (gl_list_t list, const void *elt) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->add_first (list, elt); +} + +gl_list_node_t +gl_list_add_last (gl_list_t list, const void *elt) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->add_last (list, elt); +} + +gl_list_node_t +gl_list_add_before (gl_list_t list, gl_list_node_t node, const void *elt) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->add_before (list, node, elt); +} + +gl_list_node_t +gl_list_add_after (gl_list_t list, gl_list_node_t node, const void *elt) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->add_after (list, node, elt); +} + +gl_list_node_t +gl_list_add_at (gl_list_t list, size_t position, const void *elt) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->add_at (list, position, elt); +} + +bool +gl_list_remove_node (gl_list_t list, gl_list_node_t node) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->remove_node (list, node); +} + +bool +gl_list_remove_at (gl_list_t list, size_t position) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->remove_at (list, position); +} + +bool +gl_list_remove (gl_list_t list, const void *elt) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->remove (list, elt); +} + +void +gl_list_free (gl_list_t list) +{ + ((const struct gl_list_impl_base *) list)->vtable->list_free (list); +} + +gl_list_iterator_t +gl_list_iterator (gl_list_t list) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->iterator (list); +} + +gl_list_iterator_t +gl_list_iterator_from_to (gl_list_t list, size_t start_index, size_t end_index) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->iterator_from_to (list, start_index, end_index); +} + +bool +gl_list_iterator_next (gl_list_iterator_t *iterator, + const void **eltp, gl_list_node_t *nodep) +{ + return iterator->vtable->iterator_next (iterator, eltp, nodep); +} + +void +gl_list_iterator_free (gl_list_iterator_t *iterator) +{ + iterator->vtable->iterator_free (iterator); +} + +gl_list_node_t +gl_sortedlist_search (gl_list_t list, gl_listelement_compar_fn compar, const void *elt) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->sortedlist_search (list, compar, elt); +} + +gl_list_node_t +gl_sortedlist_search_from_to (gl_list_t list, gl_listelement_compar_fn compar, size_t start_index, size_t end_index, const void *elt) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->sortedlist_search_from_to (list, compar, start_index, end_index, + elt); +} + +size_t +gl_sortedlist_indexof (gl_list_t list, gl_listelement_compar_fn compar, const void *elt) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->sortedlist_indexof (list, compar, elt); +} + +size_t +gl_sortedlist_indexof_from_to (gl_list_t list, gl_listelement_compar_fn compar, size_t start_index, size_t end_index, const void *elt) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->sortedlist_indexof_from_to (list, compar, start_index, end_index, + elt); +} + +gl_list_node_t +gl_sortedlist_add (gl_list_t list, gl_listelement_compar_fn compar, const void *elt) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->sortedlist_add (list, compar, elt); +} + +bool +gl_sortedlist_remove (gl_list_t list, gl_listelement_compar_fn compar, const void *elt) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->sortedlist_remove (list, compar, elt); +} + +#endif diff -ruNp m4-1.4.7/lib/gl_list.h m4-1.4.8/lib/gl_list.h --- m4-1.4.7/lib/gl_list.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/lib/gl_list.h 2006-11-20 06:57:28.000000000 -0700 @@ -0,0 +1,724 @@ +/* Abstract sequential list data type. + Copyright (C) 2006 Free Software Foundation, Inc. + Written by Bruno Haible , 2006. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef _GL_LIST_H +#define _GL_LIST_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +/* gl_list is an abstract list data type. It can contain any number of + objects ('void *' or 'const void *' pointers) in any given order. + Duplicates are allowed, but can optionally be forbidden. + + There are several implementations of this list datatype, optimized for + different operations or for memory. You can start using the simplest list + implementation, GL_ARRAY_LIST, and switch to a different implementation + later, when you realize which operations are performed the most frequently. + The API of the different implementations is exactly the same; when + switching to a different implementation, you only have to change the + gl_list_create call. + + The implementations are: + GL_ARRAY_LIST a growable array + GL_CARRAY_LIST a growable circular array + GL_LINKED_LIST a linked list + GL_AVLTREE_LIST a binary tree (AVL tree) + GL_RBTREE_LIST a binary tree (red-black tree) + GL_LINKEDHASH_LIST a hash table with a linked list + GL_AVLTREEHASH_LIST a hash table with a binary tree (AVL tree) + GL_RBTREEHASH_LIST a hash table with a binary tree (red-black tree) + + The memory consumption is asymptotically the same: O(1) for every object + in the list. When looking more closely at the average memory consumed + for an object, GL_ARRAY_LIST is the most compact representation, and + GL_LINKEDHASH_LIST and GL_TREEHASH_LIST need more memory. + + The guaranteed average performance of the operations is, for a list of + n elements: + + Operation ARRAY LINKED TREE LINKEDHASH TREEHASH + CARRAY with|without with|without + duplicates duplicates + + gl_list_size O(1) O(1) O(1) O(1) O(1) + gl_list_node_value O(1) O(1) O(1) O(1) O(1) + gl_list_next_node O(1) O(1) O(log n) O(1) O(log n) + gl_list_previous_node O(1) O(1) O(log n) O(1) O(log n) + gl_list_get_at O(1) O(n) O(log n) O(n) O(log n) + gl_list_set_at O(1) O(n) O(log n) O(n) O((log n)²)/O(log n) + gl_list_search O(n) O(n) O(n) O(n)/O(1) O(log n)/O(1) + gl_list_search_from O(n) O(n) O(n) O(n)/O(1) O((log n)²)/O(log n) + gl_list_search_from_to O(n) O(n) O(n) O(n)/O(1) O((log n)²)/O(log n) + gl_list_indexof O(n) O(n) O(n) O(n) O(log n) + gl_list_indexof_from O(n) O(n) O(n) O(n) O((log n)²)/O(log n) + gl_list_indexof_from_to O(n) O(n) O(n) O(n) O((log n)²)/O(log n) + gl_list_add_first O(n)/O(1) O(1) O(log n) O(1) O((log n)²)/O(log n) + gl_list_add_last O(1) O(1) O(log n) O(1) O((log n)²)/O(log n) + gl_list_add_before O(n) O(1) O(log n) O(1) O((log n)²)/O(log n) + gl_list_add_after O(n) O(1) O(log n) O(1) O((log n)²)/O(log n) + gl_list_add_at O(n) O(n) O(log n) O(n) O((log n)²)/O(log n) + gl_list_remove_node O(n) O(1) O(log n) O(n)/O(1) O((log n)²)/O(log n) + gl_list_remove_at O(n) O(n) O(log n) O(n) O((log n)²)/O(log n) + gl_list_remove O(n) O(n) O(n) O(n)/O(1) O((log n)²)/O(log n) + gl_list_iterator O(1) O(1) O(log n) O(1) O(log n) + gl_list_iterator_from_to O(1) O(n) O(log n) O(n) O(log n) + gl_list_iterator_next O(1) O(1) O(log n) O(1) O(log n) + gl_sortedlist_search O(log n) O(n) O(log n) O(n) O(log n) + gl_sortedlist_search_from O(log n) O(n) O(log n) O(n) O(log n) + gl_sortedlist_indexof O(log n) O(n) O(log n) O(n) O(log n) + gl_sortedlist_indexof_fro O(log n) O(n) O(log n) O(n) O(log n) + gl_sortedlist_add O(n) O(n) O(log n) O(n) O((log n)²)/O(log n) + gl_sortedlist_remove O(n) O(n) O(log n) O(n) O((log n)²)/O(log n) + */ + +/* -------------------------- gl_list_t Data Type -------------------------- */ + +/* Type of function used to compare two elements. + NULL denotes pointer comparison. */ +typedef bool (*gl_listelement_equals_fn) (const void *elt1, const void *elt2); + +/* Type of function used to compute a hash code. + NULL denotes a function that depends only on the pointer itself. */ +typedef size_t (*gl_listelement_hashcode_fn) (const void *elt); + +struct gl_list_impl; +/* Type representing an entire list. */ +typedef struct gl_list_impl * gl_list_t; + +struct gl_list_node_impl; +/* Type representing the position of an element in the list, in a way that + is more adapted to the list implementation than a plain index. + Note: It is invalidated by insertions and removals! */ +typedef struct gl_list_node_impl * gl_list_node_t; + +struct gl_list_implementation; +/* Type representing a list datatype implementation. */ +typedef const struct gl_list_implementation * gl_list_implementation_t; + +/* Create an empty list. + IMPLEMENTATION is one of GL_ARRAY_LIST, GL_CARRAY_LIST, GL_LINKED_LIST, + GL_AVLTREE_LIST, GL_RBTREE_LIST, GL_LINKEDHASH_LIST, GL_AVLTREEHASH_LIST, + GL_RBTREEHASH_LIST. + EQUALS_FN is an element comparison function or NULL. + HASHCODE_FN is an element hash code function or NULL. + ALLOW_DUPLICATES is false if duplicate elements shall not be allowed in + the list. The implementation may verify this at runtime. */ +extern gl_list_t gl_list_create_empty (gl_list_implementation_t implementation, + gl_listelement_equals_fn equals_fn, + gl_listelement_hashcode_fn hashcode_fn, + bool allow_duplicates); + +/* Create a list with given contents. + IMPLEMENTATION is one of GL_ARRAY_LIST, GL_CARRAY_LIST, GL_LINKED_LIST, + GL_AVLTREE_LIST, GL_RBTREE_LIST, GL_LINKEDHASH_LIST, GL_AVLTREEHASH_LIST, + GL_RBTREEHASH_LIST. + EQUALS_FN is an element comparison function or NULL. + HASHCODE_FN is an element hash code function or NULL. + ALLOW_DUPLICATES is false if duplicate elements shall not be allowed in + the list. The implementation may verify this at runtime. + COUNT is the number of initial elements. + CONTENTS[0..COUNT-1] is the initial contents. */ +extern gl_list_t gl_list_create (gl_list_implementation_t implementation, + gl_listelement_equals_fn equals_fn, + gl_listelement_hashcode_fn hashcode_fn, + bool allow_duplicates, + size_t count, const void **contents); + +/* Return the current number of elements in a list. */ +extern size_t gl_list_size (gl_list_t list); + +/* Return the element value represented by a list node. */ +extern const void * gl_list_node_value (gl_list_t list, gl_list_node_t node); + +/* Return the node immediately after the given node in the list, or NULL + if the given node is the last (rightmost) one in the list. */ +extern gl_list_node_t gl_list_next_node (gl_list_t list, gl_list_node_t node); + +/* Return the node immediately before the given node in the list, or NULL + if the given node is the first (leftmost) one in the list. */ +extern gl_list_node_t gl_list_previous_node (gl_list_t list, gl_list_node_t node); + +/* Return the element at a given position in the list. + POSITION must be >= 0 and < gl_list_size (list). */ +extern const void * gl_list_get_at (gl_list_t list, size_t position); + +/* Replace the element at a given position in the list. + POSITION must be >= 0 and < gl_list_size (list). + Return its node. */ +extern gl_list_node_t gl_list_set_at (gl_list_t list, size_t position, + const void *elt); + +/* Search whether an element is already in the list. + Return its node if found, or NULL if not present in the list. */ +extern gl_list_node_t gl_list_search (gl_list_t list, const void *elt); + +/* Search whether an element is already in the list, + at a position >= START_INDEX. + Return its node if found, or NULL if not present in the list. */ +extern gl_list_node_t gl_list_search_from (gl_list_t list, size_t start_index, + const void *elt); + +/* Search whether an element is already in the list, + at a position >= START_INDEX and < END_INDEX. + Return its node if found, or NULL if not present in the list. */ +extern gl_list_node_t gl_list_search_from_to (gl_list_t list, + size_t start_index, + size_t end_index, + const void *elt); + +/* Search whether an element is already in the list. + Return its position if found, or (size_t)(-1) if not present in the list. */ +extern size_t gl_list_indexof (gl_list_t list, const void *elt); + +/* Search whether an element is already in the list, + at a position >= START_INDEX. + Return its position if found, or (size_t)(-1) if not present in the list. */ +extern size_t gl_list_indexof_from (gl_list_t list, size_t start_index, + const void *elt); + +/* Search whether an element is already in the list, + at a position >= START_INDEX and < END_INDEX. + Return its position if found, or (size_t)(-1) if not present in the list. */ +extern size_t gl_list_indexof_from_to (gl_list_t list, + size_t start_index, size_t end_index, + const void *elt); + +/* Add an element as the first element of the list. + Return its node. */ +extern gl_list_node_t gl_list_add_first (gl_list_t list, const void *elt); + +/* Add an element as the last element of the list. + Return its node. */ +extern gl_list_node_t gl_list_add_last (gl_list_t list, const void *elt); + +/* Add an element before a given element node of the list. + Return its node. */ +extern gl_list_node_t gl_list_add_before (gl_list_t list, gl_list_node_t node, + const void *elt); + +/* Add an element after a given element node of the list. + Return its node. */ +extern gl_list_node_t gl_list_add_after (gl_list_t list, gl_list_node_t node, + const void *elt); + +/* Add an element add a given position in the list. + POSITION must be >= 0 and <= gl_list_size (list). */ +extern gl_list_node_t gl_list_add_at (gl_list_t list, size_t position, + const void *elt); + +/* Remove an element from the list. + Return true. */ +extern bool gl_list_remove_node (gl_list_t list, gl_list_node_t node); + +/* Remove an element at a given position from the list. + POSITION must be >= 0 and < gl_list_size (list). + Return true. */ +extern bool gl_list_remove_at (gl_list_t list, size_t position); + +/* Search and remove an element from the list. + Return true if it was found and removed. */ +extern bool gl_list_remove (gl_list_t list, const void *elt); + +/* Free an entire list. + (But this call does not free the elements of the list.) */ +extern void gl_list_free (gl_list_t list); + +/* --------------------- gl_list_iterator_t Data Type --------------------- */ + +/* Functions for iterating through a list. */ + +/* Type of an iterator that traverses a list. + This is a fixed-size struct, so that creation of an iterator doesn't need + memory allocation on the heap. */ +typedef struct +{ + /* For fast dispatch of gl_list_iterator_next. */ + const struct gl_list_implementation *vtable; + /* For detecting whether the last returned element was removed. */ + gl_list_t list; + size_t count; + /* Other, implementation-private fields. */ + void *p; void *q; + size_t i; size_t j; +} gl_list_iterator_t; + +/* Create an iterator traversing a list. + The list contents must not be modified while the iterator is in use, + except for replacing or removing the last returned element. */ +extern gl_list_iterator_t gl_list_iterator (gl_list_t list); + +/* Create an iterator traversing the element with indices i, + start_index <= i < end_index, of a list. + The list contents must not be modified while the iterator is in use, + except for replacing or removing the last returned element. */ +extern gl_list_iterator_t gl_list_iterator_from_to (gl_list_t list, + size_t start_index, + size_t end_index); + +/* If there is a next element, store the next element in *ELTP, store its + node in *NODEP if NODEP is non-NULL, advance the iterator and return true. + Otherwise, return false. */ +extern bool gl_list_iterator_next (gl_list_iterator_t *iterator, + const void **eltp, gl_list_node_t *nodep); + +/* Free an iterator. */ +extern void gl_list_iterator_free (gl_list_iterator_t *iterator); + +/* ---------------------- Sorted gl_list_t Data Type ---------------------- */ + +/* The following functions are for lists without duplicates where the + order is given by a sort criterion. */ + +/* Type of function used to compare two elements. Same as for qsort(). + NULL denotes pointer comparison. */ +typedef int (*gl_listelement_compar_fn) (const void *elt1, const void *elt2); + +/* Search whether an element is already in the list. + The list is assumed to be sorted with COMPAR. + Return its node if found, or NULL if not present in the list. + If the list contains several copies of ELT, the node of the leftmost one is + returned. */ +extern gl_list_node_t gl_sortedlist_search (gl_list_t list, + gl_listelement_compar_fn compar, + const void *elt); + +/* Search whether an element is already in the list. + The list is assumed to be sorted with COMPAR. + Only list elements with indices >= START_INDEX and < END_INDEX are + considered; the implementation uses these bounds to minimize the number + of COMPAR invocations. + Return its node if found, or NULL if not present in the list. + If the list contains several copies of ELT, the node of the leftmost one is + returned. */ +extern gl_list_node_t gl_sortedlist_search_from_to (gl_list_t list, + gl_listelement_compar_fn compar, + size_t start_index, + size_t end_index, + const void *elt); + +/* Search whether an element is already in the list. + The list is assumed to be sorted with COMPAR. + Return its position if found, or (size_t)(-1) if not present in the list. + If the list contains several copies of ELT, the position of the leftmost one + is returned. */ +extern size_t gl_sortedlist_indexof (gl_list_t list, + gl_listelement_compar_fn compar, + const void *elt); + +/* Search whether an element is already in the list. + The list is assumed to be sorted with COMPAR. + Only list elements with indices >= START_INDEX and < END_INDEX are + considered; the implementation uses these bounds to minimize the number + of COMPAR invocations. + Return its position if found, or (size_t)(-1) if not present in the list. + If the list contains several copies of ELT, the position of the leftmost one + is returned. */ +extern size_t gl_sortedlist_indexof_from_to (gl_list_t list, + gl_listelement_compar_fn compar, + size_t start_index, + size_t end_index, + const void *elt); + +/* Add an element at the appropriate position in the list. + The list is assumed to be sorted with COMPAR. + Return its node. */ +extern gl_list_node_t gl_sortedlist_add (gl_list_t list, + gl_listelement_compar_fn compar, + const void *elt); + +/* Search and remove an element from the list. + The list is assumed to be sorted with COMPAR. + Return true if it was found and removed. + If the list contains several copies of ELT, only the leftmost one is + removed. */ +extern bool gl_sortedlist_remove (gl_list_t list, + gl_listelement_compar_fn compar, + const void *elt); + +/* ------------------------ Implementation Details ------------------------ */ + +struct gl_list_implementation +{ + /* gl_list_t functions. */ + gl_list_t (*create_empty) (gl_list_implementation_t implementation, + gl_listelement_equals_fn equals_fn, + gl_listelement_hashcode_fn hashcode_fn, + bool allow_duplicates); + gl_list_t (*create) (gl_list_implementation_t implementation, + gl_listelement_equals_fn equals_fn, + gl_listelement_hashcode_fn hashcode_fn, + bool allow_duplicates, + size_t count, const void **contents); + size_t (*size) (gl_list_t list); + const void * (*node_value) (gl_list_t list, gl_list_node_t node); + gl_list_node_t (*next_node) (gl_list_t list, gl_list_node_t node); + gl_list_node_t (*previous_node) (gl_list_t list, gl_list_node_t node); + const void * (*get_at) (gl_list_t list, size_t position); + gl_list_node_t (*set_at) (gl_list_t list, size_t position, const void *elt); + gl_list_node_t (*search_from_to) (gl_list_t list, size_t start_index, + size_t end_index, const void *elt); + size_t (*indexof_from_to) (gl_list_t list, size_t start_index, + size_t end_index, const void *elt); + gl_list_node_t (*add_first) (gl_list_t list, const void *elt); + gl_list_node_t (*add_last) (gl_list_t list, const void *elt); + gl_list_node_t (*add_before) (gl_list_t list, gl_list_node_t node, + const void *elt); + gl_list_node_t (*add_after) (gl_list_t list, gl_list_node_t node, + const void *elt); + gl_list_node_t (*add_at) (gl_list_t list, size_t position, + const void *elt); + bool (*remove_node) (gl_list_t list, gl_list_node_t node); + bool (*remove_at) (gl_list_t list, size_t position); + bool (*remove) (gl_list_t list, const void *elt); + void (*list_free) (gl_list_t list); + /* gl_list_iterator_t functions. */ + gl_list_iterator_t (*iterator) (gl_list_t list); + gl_list_iterator_t (*iterator_from_to) (gl_list_t list, + size_t start_index, + size_t end_index); + bool (*iterator_next) (gl_list_iterator_t *iterator, + const void **eltp, gl_list_node_t *nodep); + void (*iterator_free) (gl_list_iterator_t *iterator); + /* Sorted gl_list_t functions. */ + gl_list_node_t (*sortedlist_search) (gl_list_t list, + gl_listelement_compar_fn compar, + const void *elt); + gl_list_node_t (*sortedlist_search_from_to) (gl_list_t list, + gl_listelement_compar_fn compar, + size_t start_index, + size_t end_index, + const void *elt); + size_t (*sortedlist_indexof) (gl_list_t list, + gl_listelement_compar_fn compar, + const void *elt); + size_t (*sortedlist_indexof_from_to) (gl_list_t list, + gl_listelement_compar_fn compar, + size_t start_index, size_t end_index, + const void *elt); + gl_list_node_t (*sortedlist_add) (gl_list_t list, + gl_listelement_compar_fn compar, + const void *elt); + bool (*sortedlist_remove) (gl_list_t list, + gl_listelement_compar_fn compar, + const void *elt); +}; + +struct gl_list_impl_base +{ + const struct gl_list_implementation *vtable; + gl_listelement_equals_fn equals_fn; + gl_listelement_hashcode_fn hashcode_fn; + bool allow_duplicates; +}; + +#if HAVE_INLINE + +/* Define all functions of this file as inline accesses to the + struct gl_list_implementation. + Use #define to avoid a warning because of extern vs. static. */ + +# define gl_list_create_empty gl_list_create_empty_inline +static inline gl_list_t +gl_list_create_empty (gl_list_implementation_t implementation, + gl_listelement_equals_fn equals_fn, + gl_listelement_hashcode_fn hashcode_fn, + bool allow_duplicates) +{ + return implementation->create_empty (implementation, equals_fn, hashcode_fn, + allow_duplicates); +} + +# define gl_list_create gl_list_create_inline +static inline gl_list_t +gl_list_create (gl_list_implementation_t implementation, + gl_listelement_equals_fn equals_fn, + gl_listelement_hashcode_fn hashcode_fn, + bool allow_duplicates, + size_t count, const void **contents) +{ + return implementation->create (implementation, equals_fn, hashcode_fn, + allow_duplicates, count, contents); +} + +# define gl_list_size gl_list_size_inline +static inline size_t +gl_list_size (gl_list_t list) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->size (list); +} + +# define gl_list_node_value gl_list_node_value_inline +static inline const void * +gl_list_node_value (gl_list_t list, gl_list_node_t node) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->node_value (list, node); +} + +# define gl_list_next_node gl_list_next_node_inline +static inline gl_list_node_t +gl_list_next_node (gl_list_t list, gl_list_node_t node) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->next_node (list, node); +} + +# define gl_list_previous_node gl_list_previous_node_inline +static inline gl_list_node_t +gl_list_previous_node (gl_list_t list, gl_list_node_t node) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->previous_node (list, node); +} + +# define gl_list_get_at gl_list_get_at_inline +static inline const void * +gl_list_get_at (gl_list_t list, size_t position) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->get_at (list, position); +} + +# define gl_list_set_at gl_list_set_at_inline +static inline gl_list_node_t +gl_list_set_at (gl_list_t list, size_t position, const void *elt) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->set_at (list, position, elt); +} + +# define gl_list_search gl_list_search_inline +static inline gl_list_node_t +gl_list_search (gl_list_t list, const void *elt) +{ + size_t size = ((const struct gl_list_impl_base *) list)->vtable->size (list); + return ((const struct gl_list_impl_base *) list)->vtable + ->search_from_to (list, 0, size, elt); +} + +# define gl_list_search_from gl_list_search_from_inline +static inline gl_list_node_t +gl_list_search_from (gl_list_t list, size_t start_index, const void *elt) +{ + size_t size = ((const struct gl_list_impl_base *) list)->vtable->size (list); + return ((const struct gl_list_impl_base *) list)->vtable + ->search_from_to (list, start_index, size, elt); +} + +# define gl_list_search_from_to gl_list_search_from_to_inline +static inline gl_list_node_t +gl_list_search_from_to (gl_list_t list, size_t start_index, size_t end_index, + const void *elt) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->search_from_to (list, start_index, end_index, elt); +} + +# define gl_list_indexof gl_list_indexof_inline +static inline size_t +gl_list_indexof (gl_list_t list, const void *elt) +{ + size_t size = ((const struct gl_list_impl_base *) list)->vtable->size (list); + return ((const struct gl_list_impl_base *) list)->vtable + ->indexof_from_to (list, 0, size, elt); +} + +# define gl_list_indexof_from gl_list_indexof_from_inline +static inline size_t +gl_list_indexof_from (gl_list_t list, size_t start_index, const void *elt) +{ + size_t size = ((const struct gl_list_impl_base *) list)->vtable->size (list); + return ((const struct gl_list_impl_base *) list)->vtable + ->indexof_from_to (list, start_index, size, elt); +} + +# define gl_list_indexof_from_to gl_list_indexof_from_to_inline +static inline size_t +gl_list_indexof_from_to (gl_list_t list, size_t start_index, size_t end_index, + const void *elt) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->indexof_from_to (list, start_index, end_index, elt); +} + +# define gl_list_add_first gl_list_add_first_inline +static inline gl_list_node_t +gl_list_add_first (gl_list_t list, const void *elt) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->add_first (list, elt); +} + +# define gl_list_add_last gl_list_add_last_inline +static inline gl_list_node_t +gl_list_add_last (gl_list_t list, const void *elt) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->add_last (list, elt); +} + +# define gl_list_add_before gl_list_add_before_inline +static inline gl_list_node_t +gl_list_add_before (gl_list_t list, gl_list_node_t node, const void *elt) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->add_before (list, node, elt); +} + +# define gl_list_add_after gl_list_add_after_inline +static inline gl_list_node_t +gl_list_add_after (gl_list_t list, gl_list_node_t node, const void *elt) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->add_after (list, node, elt); +} + +# define gl_list_add_at gl_list_add_at_inline +static inline gl_list_node_t +gl_list_add_at (gl_list_t list, size_t position, const void *elt) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->add_at (list, position, elt); +} + +# define gl_list_remove_node gl_list_remove_node_inline +static inline bool +gl_list_remove_node (gl_list_t list, gl_list_node_t node) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->remove_node (list, node); +} + +# define gl_list_remove_at gl_list_remove_at_inline +static inline bool +gl_list_remove_at (gl_list_t list, size_t position) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->remove_at (list, position); +} + +# define gl_list_remove gl_list_remove_inline +static inline bool +gl_list_remove (gl_list_t list, const void *elt) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->remove (list, elt); +} + +# define gl_list_free gl_list_free_inline +static inline void +gl_list_free (gl_list_t list) +{ + ((const struct gl_list_impl_base *) list)->vtable->list_free (list); +} + +# define gl_list_iterator gl_list_iterator_inline +static inline gl_list_iterator_t +gl_list_iterator (gl_list_t list) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->iterator (list); +} + +# define gl_list_iterator_from_to gl_list_iterator_from_to_inline +static inline gl_list_iterator_t +gl_list_iterator_from_to (gl_list_t list, size_t start_index, size_t end_index) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->iterator_from_to (list, start_index, end_index); +} + +# define gl_list_iterator_next gl_list_iterator_next_inline +static inline bool +gl_list_iterator_next (gl_list_iterator_t *iterator, + const void **eltp, gl_list_node_t *nodep) +{ + return iterator->vtable->iterator_next (iterator, eltp, nodep); +} + +# define gl_list_iterator_free gl_list_iterator_free_inline +static inline void +gl_list_iterator_free (gl_list_iterator_t *iterator) +{ + iterator->vtable->iterator_free (iterator); +} + +# define gl_sortedlist_search gl_sortedlist_search_inline +static inline gl_list_node_t +gl_sortedlist_search (gl_list_t list, gl_listelement_compar_fn compar, const void *elt) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->sortedlist_search (list, compar, elt); +} + +# define gl_sortedlist_search_from_to gl_sortedlist_search_from_to_inline +static inline gl_list_node_t +gl_sortedlist_search_from_to (gl_list_t list, gl_listelement_compar_fn compar, size_t start_index, size_t end_index, const void *elt) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->sortedlist_search_from_to (list, compar, start_index, end_index, + elt); +} + +# define gl_sortedlist_indexof gl_sortedlist_indexof_inline +static inline size_t +gl_sortedlist_indexof (gl_list_t list, gl_listelement_compar_fn compar, const void *elt) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->sortedlist_indexof (list, compar, elt); +} + +# define gl_sortedlist_indexof_from_to gl_sortedlist_indexof_from_to_inline +static inline size_t +gl_sortedlist_indexof_from_to (gl_list_t list, gl_listelement_compar_fn compar, size_t start_index, size_t end_index, const void *elt) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->sortedlist_indexof_from_to (list, compar, start_index, end_index, + elt); +} + +# define gl_sortedlist_add gl_sortedlist_add_inline +static inline gl_list_node_t +gl_sortedlist_add (gl_list_t list, gl_listelement_compar_fn compar, const void *elt) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->sortedlist_add (list, compar, elt); +} + +# define gl_sortedlist_remove gl_sortedlist_remove_inline +static inline bool +gl_sortedlist_remove (gl_list_t list, gl_listelement_compar_fn compar, const void *elt) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->sortedlist_remove (list, compar, elt); +} + +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _GL_LIST_H */ diff -ruNp m4-1.4.7/lib/gl_oset.c m4-1.4.8/lib/gl_oset.c --- m4-1.4.7/lib/gl_oset.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/lib/gl_oset.c 2006-11-20 06:57:28.000000000 -0700 @@ -0,0 +1,94 @@ +/* Abstract ordered set data type. + Copyright (C) 2006 Free Software Foundation, Inc. + Written by Bruno Haible , 2006. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include + +/* Specification. */ +#include "gl_oset.h" + +#if !HAVE_INLINE + +/* Define all functions of this file as inline accesses to the + struct gl_list_implementation. + Use #define to avoid a warning because of extern vs. static. */ + +gl_oset_t +gl_oset_create_empty (gl_oset_implementation_t implementation, + gl_setelement_compar_fn compar_fn) +{ + return implementation->create_empty (implementation, compar_fn); +} + +size_t +gl_oset_size (gl_oset_t set) +{ + return ((const struct gl_oset_impl_base *) set)->vtable->size (set); +} + +bool +gl_oset_search (gl_oset_t set, const void *elt) +{ + return ((const struct gl_oset_impl_base *) set)->vtable->search (set, elt); +} + +bool +gl_oset_search_atleast (gl_oset_t set, + gl_setelement_threshold_fn threshold_fn, + const void *threshold, const void **eltp) +{ + return ((const struct gl_oset_impl_base *) set)->vtable + ->search_atleast (set, threshold_fn, threshold, eltp); +} + +bool +gl_oset_add (gl_oset_t set, const void *elt) +{ + return ((const struct gl_oset_impl_base *) set)->vtable->add (set, elt); +} + +bool +gl_oset_remove (gl_oset_t set, const void *elt) +{ + return ((const struct gl_oset_impl_base *) set)->vtable->remove (set, elt); +} + +void +gl_oset_free (gl_oset_t set) +{ + ((const struct gl_oset_impl_base *) set)->vtable->oset_free (set); +} + +gl_oset_iterator_t +gl_oset_iterator (gl_oset_t set) +{ + return ((const struct gl_oset_impl_base *) set)->vtable->iterator (set); +} + +bool +gl_oset_iterator_next (gl_oset_iterator_t *iterator, const void **eltp) +{ + return iterator->vtable->iterator_next (iterator, eltp); +} + +void +gl_oset_iterator_free (gl_oset_iterator_t *iterator) +{ + iterator->vtable->iterator_free (iterator); +} + +#endif diff -ruNp m4-1.4.7/lib/gl_oset.h m4-1.4.8/lib/gl_oset.h --- m4-1.4.7/lib/gl_oset.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/lib/gl_oset.h 2006-11-20 07:23:00.000000000 -0700 @@ -0,0 +1,265 @@ +/* Abstract ordered set data type. + Copyright (C) 2006 Free Software Foundation, Inc. + Written by Bruno Haible , 2006. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef _GL_OSET_H +#define _GL_OSET_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +/* gl_oset is an abstract ordered set data type. It can contain any number + of objects ('void *' or 'const void *' pointers) in the order of a given + comparator function. Duplicates (in the sense of the comparator) are + forbidden. + + There are several implementations of this ordered set datatype, optimized + for different operations or for memory. You can start using the simplest + ordered set implementation, GL_ARRAY_OSET, and switch to a different + implementation later, when you realize which operations are performed + the most frequently. The API of the different implementations is exactly + the same; when switching to a different implementation, you only have to + change the gl_oset_create call. + + The implementations are: + GL_ARRAY_OSET a growable array + GL_AVLTREE_OSET a binary tree (AVL tree) + GL_RBTREE_OSET a binary tree (red-black tree) + + The memory consumption is asymptotically the same: O(1) for every object + in the set. When looking more closely at the average memory consumed + for an object, GL_ARRAY_OSET is the most compact representation, and + GL_AVLTREE_OSET, GL_RBTREE_OSET need more memory. + + The guaranteed average performance of the operations is, for a set of + n elements: + + Operation ARRAY TREE + + gl_oset_size O(1) O(1) + gl_oset_add O(n) O(log n) + gl_oset_remove O(n) O(log n) + gl_oset_search O(log n) O(log n) + gl_oset_search_atleast O(log n) O(log n) + gl_oset_iterator O(1) O(log n) + gl_oset_iterator_next O(1) O(log n) + */ + +/* -------------------------- gl_oset_t Data Type -------------------------- */ + +/* Type of function used to compare two elements. Same as for qsort(). + NULL denotes pointer comparison. */ +typedef int (*gl_setelement_compar_fn) (const void *elt1, const void *elt2); + +/* Type of function used to compare an element with a threshold. + Return true if the element is greater or equal than the threshold. */ +typedef bool (*gl_setelement_threshold_fn) (const void *elt, const void *threshold); + +struct gl_oset_impl; +/* Type representing an entire ordered set. */ +typedef struct gl_oset_impl * gl_oset_t; + +struct gl_oset_implementation; +/* Type representing a ordered set datatype implementation. */ +typedef const struct gl_oset_implementation * gl_oset_implementation_t; + +/* Create an empty set. + IMPLEMENTATION is one of GL_ARRAY_OSET, GL_AVLTREE_OSET, GL_RBTREE_OSET. + COMPAR_FN is an element comparison function or NULL. */ +extern gl_oset_t gl_oset_create_empty (gl_oset_implementation_t implementation, + gl_setelement_compar_fn compar_fn); + +/* Return the current number of elements in an ordered set. */ +extern size_t gl_oset_size (gl_oset_t set); + +/* Search whether an element is already in the ordered set. + Return true if found, or false if not present in the set. */ +extern bool gl_oset_search (gl_oset_t set, const void *elt); + +/* Search the least element in the ordered set that compares greater or equal + to the given THRESHOLD. The representation of the THRESHOLD is defined + by the THRESHOLD_FN. + Return true and store the found element in *ELTP if found, otherwise return + false. */ +extern bool gl_oset_search_atleast (gl_oset_t set, + gl_setelement_threshold_fn threshold_fn, + const void *threshold, + const void **eltp); + +/* Add an element to an ordered set. + Return true if it was not already in the set and added. */ +extern bool gl_oset_add (gl_oset_t set, const void *elt); + +/* Remove an element from an ordered set. + Return true if it was found and removed. */ +extern bool gl_oset_remove (gl_oset_t set, const void *elt); + +/* Free an entire ordered set. + (But this call does not free the elements of the set.) */ +extern void gl_oset_free (gl_oset_t set); + +/* --------------------- gl_oset_iterator_t Data Type --------------------- */ + +/* Functions for iterating through an ordered set. */ + +/* Type of an iterator that traverses an ordered set. + This is a fixed-size struct, so that creation of an iterator doesn't need + memory allocation on the heap. */ +typedef struct +{ + /* For fast dispatch of gl_oset_iterator_next. */ + const struct gl_oset_implementation *vtable; + /* For detecting whether the last returned element was removed. */ + gl_oset_t set; + size_t count; + /* Other, implementation-private fields. */ + void *p; void *q; + size_t i; size_t j; +} gl_oset_iterator_t; + +/* Create an iterator traversing an ordered set. + The set's contents must not be modified while the iterator is in use, + except for removing the last returned element. */ +extern gl_oset_iterator_t gl_oset_iterator (gl_oset_t set); + +/* If there is a next element, store the next element in *ELTP, advance the + iterator and return true. Otherwise, return false. */ +extern bool gl_oset_iterator_next (gl_oset_iterator_t *iterator, + const void **eltp); + +/* Free an iterator. */ +extern void gl_oset_iterator_free (gl_oset_iterator_t *iterator); + +/* ------------------------ Implementation Details ------------------------ */ + +struct gl_oset_implementation +{ + /* gl_oset_t functions. */ + gl_oset_t (*create_empty) (gl_oset_implementation_t implementation, + gl_setelement_compar_fn compar_fn); + size_t (*size) (gl_oset_t set); + bool (*search) (gl_oset_t set, const void *elt); + bool (*search_atleast) (gl_oset_t set, + gl_setelement_threshold_fn threshold_fn, + const void *threshold, const void **eltp); + bool (*add) (gl_oset_t set, const void *elt); + bool (*remove) (gl_oset_t set, const void *elt); + void (*oset_free) (gl_oset_t set); + /* gl_oset_iterator_t functions. */ + gl_oset_iterator_t (*iterator) (gl_oset_t set); + bool (*iterator_next) (gl_oset_iterator_t *iterator, const void **eltp); + void (*iterator_free) (gl_oset_iterator_t *iterator); +}; + +struct gl_oset_impl_base +{ + const struct gl_oset_implementation *vtable; + gl_setelement_compar_fn compar_fn; +}; + +#if HAVE_INLINE + +/* Define all functions of this file as inline accesses to the + struct gl_oset_implementation. + Use #define to avoid a warning because of extern vs. static. */ + +# define gl_oset_create_empty gl_oset_create_empty_inline +static inline gl_oset_t +gl_oset_create_empty (gl_oset_implementation_t implementation, + gl_setelement_compar_fn compar_fn) +{ + return implementation->create_empty (implementation, compar_fn); +} + +# define gl_oset_size gl_oset_size_inline +static inline size_t +gl_oset_size (gl_oset_t set) +{ + return ((const struct gl_oset_impl_base *) set)->vtable->size (set); +} + +# define gl_oset_search gl_oset_search_inline +static inline bool +gl_oset_search (gl_oset_t set, const void *elt) +{ + return ((const struct gl_oset_impl_base *) set)->vtable->search (set, elt); +} + +# define gl_oset_search_atleast gl_oset_search_atleast_inline +static inline bool +gl_oset_search_atleast (gl_oset_t set, + gl_setelement_threshold_fn threshold_fn, + const void *threshold, const void **eltp) +{ + return ((const struct gl_oset_impl_base *) set)->vtable + ->search_atleast (set, threshold_fn, threshold, eltp); +} + +# define gl_oset_add gl_oset_add_inline +static inline bool +gl_oset_add (gl_oset_t set, const void *elt) +{ + return ((const struct gl_oset_impl_base *) set)->vtable->add (set, elt); +} + +# define gl_oset_remove gl_oset_remove_inline +static inline bool +gl_oset_remove (gl_oset_t set, const void *elt) +{ + return ((const struct gl_oset_impl_base *) set)->vtable->remove (set, elt); +} + +# define gl_oset_free gl_oset_free_inline +static inline void +gl_oset_free (gl_oset_t set) +{ + ((const struct gl_oset_impl_base *) set)->vtable->oset_free (set); +} + +# define gl_oset_iterator gl_oset_iterator_inline +static inline gl_oset_iterator_t +gl_oset_iterator (gl_oset_t set) +{ + return ((const struct gl_oset_impl_base *) set)->vtable->iterator (set); +} + +# define gl_oset_iterator_next gl_oset_iterator_next_inline +static inline bool +gl_oset_iterator_next (gl_oset_iterator_t *iterator, const void **eltp) +{ + return iterator->vtable->iterator_next (iterator, eltp); +} + +# define gl_oset_iterator_free gl_oset_iterator_free_inline +static inline void +gl_oset_iterator_free (gl_oset_iterator_t *iterator) +{ + iterator->vtable->iterator_free (iterator); +} + +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _GL_OSET_H */ diff -ruNp m4-1.4.7/lib/mbchar.c m4-1.4.8/lib/mbchar.c --- m4-1.4.7/lib/mbchar.c 2006-09-23 22:28:35.000000000 -0600 +++ m4-1.4.8/lib/mbchar.c 2006-11-20 06:57:39.000000000 -0700 @@ -24,7 +24,7 @@ #if IS_BASIC_ASCII /* Bit table of characters in the ISO C "basic character set". */ -unsigned int is_basic_table [UCHAR_MAX / 32 + 1] = +const unsigned int is_basic_table [UCHAR_MAX / 32 + 1] = { 0x00001a00, /* '\t' '\v' '\f' */ 0xffffffef, /* ' '...'#' '%'...'?' */ diff -ruNp m4-1.4.7/lib/mbchar.h m4-1.4.8/lib/mbchar.h --- m4-1.4.7/lib/mbchar.h 2006-09-23 22:28:35.000000000 -0600 +++ m4-1.4.8/lib/mbchar.h 2006-11-20 06:57:39.000000000 -0700 @@ -385,18 +385,18 @@ mb_width_aux (wint_t wc) /* Copying a character. */ static inline void -mb_copy (mbchar_t *new, const mbchar_t *old) +mb_copy (mbchar_t *new_mbc, const mbchar_t *old_mbc) { - if (old->ptr == &old->buf[0]) + if (old_mbc->ptr == &old_mbc->buf[0]) { - memcpy (&new->buf[0], &old->buf[0], old->bytes); - new->ptr = &new->buf[0]; + memcpy (&new_mbc->buf[0], &old_mbc->buf[0], old_mbc->bytes); + new_mbc->ptr = &new_mbc->buf[0]; } else - new->ptr = old->ptr; - new->bytes = old->bytes; - if ((new->wc_valid = old->wc_valid)) - new->wc = old->wc; + new_mbc->ptr = old_mbc->ptr; + new_mbc->bytes = old_mbc->bytes; + if ((new_mbc->wc_valid = old_mbc->wc_valid)) + new_mbc->wc = old_mbc->wc; } @@ -430,7 +430,7 @@ mb_copy (mbchar_t *new, const mbchar_t * /* The character set is ISO-646, not EBCDIC. */ # define IS_BASIC_ASCII 1 -extern unsigned int is_basic_table[]; +extern const unsigned int is_basic_table[]; static inline bool is_basic (char c) diff -ruNp m4-1.4.7/lib/mkdtemp.c m4-1.4.8/lib/mkdtemp.c --- m4-1.4.7/lib/mkdtemp.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/lib/mkdtemp.c 2006-11-20 06:57:28.000000000 -0700 @@ -0,0 +1,40 @@ +/* Copyright (C) 1999, 2001-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 + 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. */ + +/* Extracted from misc/mkdtemp.c. */ + +#include + +/* Specification. */ +#include "mkdtemp.h" + +#include "tempname.h" +#include + +/* Generate a unique temporary directory from TEMPLATE. + The last six characters of TEMPLATE must be "XXXXXX"; + they are replaced with a string that makes the filename unique. + The directory is created, mode 700, and its name is returned. + (This function comes from OpenBSD.) */ +char * +mkdtemp (char *template) +{ + if (gen_tempname (template, GT_DIR)) + return NULL; + else + return template; +} diff -ruNp m4-1.4.7/lib/mkdtemp.h m4-1.4.8/lib/mkdtemp.h --- m4-1.4.7/lib/mkdtemp.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/lib/mkdtemp.h 2006-11-20 06:57:28.000000000 -0700 @@ -0,0 +1,32 @@ +/* Creating a private temporary directory. + Copyright (C) 2001-2002 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#if HAVE_MKDTEMP + +/* Get mkdtemp() declaration. */ +#include + +#else + +/* Create a unique temporary directory from TEMPLATE. + The last six characters of TEMPLATE must be "XXXXXX"; + they are replaced with a string that makes the directory name unique. + Returns TEMPLATE, or a null pointer if it cannot get a unique name. + The directory is created mode 700. */ +extern char * mkdtemp (char *template); + +#endif diff -ruNp m4-1.4.7/lib/mkstemp-safer.c m4-1.4.8/lib/mkstemp-safer.c --- m4-1.4.7/lib/mkstemp-safer.c 2006-09-23 22:28:36.000000000 -0600 +++ m4-1.4.8/lib/mkstemp-safer.c 2006-11-20 07:23:01.000000000 -0700 @@ -29,7 +29,7 @@ STDERR_FILENO. */ int -mkstemp_safer (char *template) +mkstemp_safer (char *templ) { - return fd_safer (mkstemp (template)); + return fd_safer (mkstemp (templ)); } diff -ruNp m4-1.4.7/lib/mkstemp.c m4-1.4.8/lib/mkstemp.c --- m4-1.4.7/lib/mkstemp.c 2006-09-23 22:28:36.000000000 -0600 +++ m4-1.4.8/lib/mkstemp.c 2006-11-20 06:57:40.000000000 -0700 @@ -18,7 +18,9 @@ #if !_LIBC # include # include "mkstemp.h" -int __gen_tempname (); +# include "tempname.h" +# define __gen_tempname gen_tempname +# define __GT_FILE GT_FILE #endif #include diff -ruNp m4-1.4.7/lib/mkstemp.h m4-1.4.8/lib/mkstemp.h --- m4-1.4.7/lib/mkstemp.h 2006-09-23 22:28:36.000000000 -0600 +++ m4-1.4.8/lib/mkstemp.h 2006-11-20 06:57:40.000000000 -0700 @@ -19,6 +19,7 @@ /* written by Jim Meyering */ #include +#include #ifdef __MKSTEMP_PREFIX # define _GL_CONCAT(x, y) x ## y diff -ruNp m4-1.4.7/lib/obstack.c m4-1.4.8/lib/obstack.c --- m4-1.4.7/lib/obstack.c 2006-09-23 22:28:36.000000000 -0600 +++ m4-1.4.8/lib/obstack.c 2006-11-20 06:57:41.000000000 -0700 @@ -342,7 +342,7 @@ _obstack_allocated_p (struct obstack *h, # undef obstack_free void -obstack_free (struct obstack *h, void *obj) +__obstack_free (struct obstack *h, void *obj) { register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */ register struct _obstack_chunk *plp; /* point to previous chunk if any */ diff -ruNp m4-1.4.7/lib/obstack.h m4-1.4.8/lib/obstack.h --- m4-1.4.7/lib/obstack.h 2006-09-23 22:28:36.000000000 -0600 +++ m4-1.4.8/lib/obstack.h 2006-11-20 06:57:41.000000000 -0700 @@ -1,5 +1,5 @@ /* obstack.h - object stack macros - Copyright (C) 1988-1994,1996-1999,2003,2004,2005 + Copyright (C) 1988-1994,1996-1999,2003,2004,2005,2006 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -186,7 +186,12 @@ extern int _obstack_begin_1 (struct obst void (*) (void *, void *), void *); extern int _obstack_memory_used (struct obstack *); -void obstack_free (struct obstack *obstack, void *block); +/* The default name of the function for freeing a chunk is 'obstack_free', + but gnulib users can override this by defining '__obstack_free'. */ +#ifndef __obstack_free +# define __obstack_free obstack_free +#endif +extern void __obstack_free (struct obstack *obstack, void *block); /* Error handler called when `obstack_chunk_alloc' failed to allocate @@ -399,7 +404,7 @@ __extension__ \ void *__obj = (OBJ); \ if (__obj > (void *)__o->chunk && __obj < (void *)__o->chunk_limit) \ __o->next_free = __o->object_base = (char *)__obj; \ - else (obstack_free) (__o, __obj); }) + else (__obstack_free) (__o, __obj); }) #else /* not __GNUC__ or not __STDC__ */ @@ -497,7 +502,7 @@ __extension__ \ && (h)->temp.tempint < (h)->chunk_limit - (char *) (h)->chunk)) \ ? (int) ((h)->next_free = (h)->object_base \ = (h)->temp.tempint + (char *) (h)->chunk) \ - : (((obstack_free) ((h), (h)->temp.tempint + (char *) (h)->chunk), 0), 0))) + : (((__obstack_free) ((h), (h)->temp.tempint + (char *) (h)->chunk), 0), 0))) #endif /* not __GNUC__ or not __STDC__ */ diff -ruNp m4-1.4.7/lib/pathmax.h m4-1.4.8/lib/pathmax.h --- m4-1.4.7/lib/pathmax.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/lib/pathmax.h 2006-11-20 06:57:28.000000000 -0700 @@ -0,0 +1,47 @@ +/* Define PATH_MAX somehow. Requires sys/types.h. + Copyright (C) 1992, 1999, 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. */ + +#ifndef _PATHMAX_H +# define _PATHMAX_H + +# include + +# include + +# ifndef _POSIX_PATH_MAX +# define _POSIX_PATH_MAX 256 +# endif + +# if !defined PATH_MAX && defined _PC_PATH_MAX +# define PATH_MAX (pathconf ("/", _PC_PATH_MAX) < 1 ? 1024 \ + : pathconf ("/", _PC_PATH_MAX)) +# endif + +/* Don't include sys/param.h if it already has been. */ +# if defined HAVE_SYS_PARAM_H && !defined PATH_MAX && !defined MAXPATHLEN +# include +# endif + +# if !defined PATH_MAX && defined MAXPATHLEN +# define PATH_MAX MAXPATHLEN +# endif + +# ifndef PATH_MAX +# define PATH_MAX _POSIX_PATH_MAX +# endif + +#endif /* _PATHMAX_H */ diff -ruNp m4-1.4.7/lib/printf-args.c m4-1.4.8/lib/printf-args.c --- m4-1.4.7/lib/printf-args.c 2006-09-23 22:28:37.000000000 -0600 +++ m4-1.4.8/lib/printf-args.c 2006-11-20 06:57:42.000000000 -0700 @@ -56,7 +56,7 @@ printf_fetchargs (va_list args, argument case TYPE_ULONGINT: ap->a.a_ulongint = va_arg (args, unsigned long int); break; -#ifdef HAVE_LONG_LONG +#ifdef HAVE_LONG_LONG_INT case TYPE_LONGLONGINT: ap->a.a_longlongint = va_arg (args, long long int); break; @@ -128,7 +128,7 @@ printf_fetchargs (va_list args, argument case TYPE_COUNT_LONGINT_POINTER: ap->a.a_count_longint_pointer = va_arg (args, long int *); break; -#ifdef HAVE_LONG_LONG +#ifdef HAVE_LONG_LONG_INT case TYPE_COUNT_LONGLONGINT_POINTER: ap->a.a_count_longlongint_pointer = va_arg (args, long long int *); break; diff -ruNp m4-1.4.7/lib/printf-args.h m4-1.4.8/lib/printf-args.h --- m4-1.4.7/lib/printf-args.h 2006-09-23 22:28:37.000000000 -0600 +++ m4-1.4.8/lib/printf-args.h 2006-11-20 06:57:42.000000000 -0700 @@ -1,5 +1,5 @@ /* Decomposed printf argument list. - Copyright (C) 1999, 2002-2003 Free Software Foundation, Inc. + Copyright (C) 1999, 2002-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 @@ -47,7 +47,7 @@ typedef enum TYPE_UINT, TYPE_LONGINT, TYPE_ULONGINT, -#ifdef HAVE_LONG_LONG +#ifdef HAVE_LONG_LONG_INT TYPE_LONGLONGINT, TYPE_ULONGLONGINT, #endif @@ -68,7 +68,7 @@ typedef enum TYPE_COUNT_SHORT_POINTER, TYPE_COUNT_INT_POINTER, TYPE_COUNT_LONGINT_POINTER -#ifdef HAVE_LONG_LONG +#ifdef HAVE_LONG_LONG_INT , TYPE_COUNT_LONGLONGINT_POINTER #endif } arg_type; @@ -87,7 +87,7 @@ typedef struct unsigned int a_uint; long int a_longint; unsigned long int a_ulongint; -#ifdef HAVE_LONG_LONG +#ifdef HAVE_LONG_LONG_INT long long int a_longlongint; unsigned long long int a_ulonglongint; #endif @@ -109,7 +109,7 @@ typedef struct short * a_count_short_pointer; int * a_count_int_pointer; long int * a_count_longint_pointer; -#ifdef HAVE_LONG_LONG +#ifdef HAVE_LONG_LONG_INT long long int * a_count_longlongint_pointer; #endif } diff -ruNp m4-1.4.7/lib/printf-parse.c m4-1.4.8/lib/printf-parse.c --- m4-1.4.7/lib/printf-parse.c 2006-09-23 22:28:37.000000000 -0600 +++ m4-1.4.8/lib/printf-parse.c 2006-11-20 07:23:03.000000000 -0700 @@ -68,7 +68,7 @@ PRINTF_PARSE (const CHAR_T *format, DIRE d->count = 0; d_allocated = 1; - d->dir = malloc (d_allocated * sizeof (DIRECTIVE)); + d->dir = (DIRECTIVE *) malloc (d_allocated * sizeof (DIRECTIVE)); if (d->dir == NULL) /* Out of memory. */ return -1; @@ -92,9 +92,9 @@ PRINTF_PARSE (const CHAR_T *format, DIRE if (size_overflow_p (memory_size)) \ /* Overflow, would lead to out of memory. */ \ goto error; \ - memory = (a->arg \ - ? realloc (a->arg, memory_size) \ - : malloc (memory_size)); \ + memory = (argument *) (a->arg \ + ? realloc (a->arg, memory_size) \ + : malloc (memory_size)); \ if (memory == NULL) \ /* Out of memory. */ \ goto error; \ @@ -382,11 +382,14 @@ PRINTF_PARSE (const CHAR_T *format, DIRE switch (c) { case 'd': case 'i': -#ifdef HAVE_LONG_LONG +#ifdef HAVE_LONG_LONG_INT + /* If 'long long' exists and is larger than 'long': */ if (flags >= 16 || (flags & 4)) type = TYPE_LONGLONGINT; else #endif + /* If 'long long' exists and is the same as 'long', we parse + "lld" into TYPE_LONGINT. */ if (flags >= 8) type = TYPE_LONGINT; else if (flags & 2) @@ -397,11 +400,14 @@ PRINTF_PARSE (const CHAR_T *format, DIRE type = TYPE_INT; break; case 'o': case 'u': case 'x': case 'X': -#ifdef HAVE_LONG_LONG +#ifdef HAVE_LONG_LONG_INT + /* If 'long long' exists and is larger than 'long': */ if (flags >= 16 || (flags & 4)) type = TYPE_ULONGLONGINT; else #endif + /* If 'unsigned long long' exists and is the same as + 'unsigned long', we parse "llu" into TYPE_ULONGINT. */ if (flags >= 8) type = TYPE_ULONGINT; else if (flags & 2) @@ -456,11 +462,14 @@ PRINTF_PARSE (const CHAR_T *format, DIRE type = TYPE_POINTER; break; case 'n': -#ifdef HAVE_LONG_LONG +#ifdef HAVE_LONG_LONG_INT + /* If 'long long' exists and is larger than 'long': */ if (flags >= 16 || (flags & 4)) type = TYPE_COUNT_LONGLONGINT_POINTER; else #endif + /* If 'long long' exists and is the same as 'long', we parse + "lln" into TYPE_COUNT_LONGINT_POINTER. */ if (flags >= 8) type = TYPE_COUNT_LONGINT_POINTER; else if (flags & 2) @@ -506,7 +515,7 @@ PRINTF_PARSE (const CHAR_T *format, DIRE if (size_overflow_p (memory_size)) /* Overflow, would lead to out of memory. */ goto error; - memory = realloc (d->dir, memory_size); + memory = (DIRECTIVE *) realloc (d->dir, memory_size); if (memory == NULL) /* Out of memory. */ goto error; diff -ruNp m4-1.4.7/lib/quotearg.c m4-1.4.8/lib/quotearg.c --- m4-1.4.7/lib/quotearg.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/lib/quotearg.c 2006-11-20 07:23:03.000000000 -0700 @@ -0,0 +1,713 @@ +/* quotearg.c - quote arguments for output + + Copyright (C) 1998, 1999, 2000, 2001, 2002, 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 + 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 "quotearg.h" + +#include "xalloc.h" + +#include +#include +#include +#include +#include +#include + +#include "gettext.h" +#define _(msgid) gettext (msgid) +#define N_(msgid) msgid + +#if HAVE_WCHAR_H + +/* BSD/OS 4.1 wchar.h requires FILE and struct tm to be declared. */ +# include +# include + +# include +#endif + +#if !HAVE_MBRTOWC +/* Disable multibyte processing entirely. Since MB_CUR_MAX is 1, the + other macros are defined only for documentation and to satisfy C + syntax. */ +# undef MB_CUR_MAX +# define MB_CUR_MAX 1 +# undef mbstate_t +# define mbstate_t int +# define mbrtowc(pwc, s, n, ps) ((*(pwc) = *(s)) != 0) +# define iswprint(wc) isprint ((unsigned char) (wc)) +# undef HAVE_MBSINIT +#endif + +#if !defined mbsinit && !HAVE_MBSINIT +# define mbsinit(ps) 1 +#endif + +#ifndef iswprint +# if HAVE_WCTYPE_H +# include +# endif +# if !defined iswprint && !HAVE_ISWPRINT +# define iswprint(wc) 1 +# endif +#endif + +#ifndef SIZE_MAX +# define SIZE_MAX ((size_t) -1) +#endif + +#define INT_BITS (sizeof (int) * CHAR_BIT) + +struct quoting_options +{ + /* Basic quoting style. */ + enum quoting_style style; + + /* Quote the characters indicated by this bit vector even if the + quoting style would not normally require them to be quoted. */ + unsigned int quote_these_too[(UCHAR_MAX / INT_BITS) + 1]; +}; + +/* Names of quoting styles. */ +char const *const quoting_style_args[] = +{ + "literal", + "shell", + "shell-always", + "c", + "escape", + "locale", + "clocale", + 0 +}; + +/* Correspondences to quoting style names. */ +enum quoting_style const quoting_style_vals[] = +{ + literal_quoting_style, + shell_quoting_style, + shell_always_quoting_style, + c_quoting_style, + escape_quoting_style, + locale_quoting_style, + clocale_quoting_style +}; + +/* The default quoting options. */ +static struct quoting_options default_quoting_options; + +/* Allocate a new set of quoting options, with contents initially identical + to O if O is not null, or to the default if O is null. + It is the caller's responsibility to free the result. */ +struct quoting_options * +clone_quoting_options (struct quoting_options *o) +{ + int e = errno; + struct quoting_options *p = xmemdup (o ? o : &default_quoting_options, + sizeof *o); + errno = e; + return p; +} + +/* Get the value of O's quoting style. If O is null, use the default. */ +enum quoting_style +get_quoting_style (struct quoting_options *o) +{ + return (o ? o : &default_quoting_options)->style; +} + +/* In O (or in the default if O is null), + set the value of the quoting style to S. */ +void +set_quoting_style (struct quoting_options *o, enum quoting_style s) +{ + (o ? o : &default_quoting_options)->style = s; +} + +/* In O (or in the default if O is null), + set the value of the quoting options for character C to I. + Return the old value. Currently, the only values defined for I are + 0 (the default) and 1 (which means to quote the character even if + it would not otherwise be quoted). */ +int +set_char_quoting (struct quoting_options *o, char c, int i) +{ + unsigned char uc = c; + unsigned int *p = + (o ? o : &default_quoting_options)->quote_these_too + uc / INT_BITS; + int shift = uc % INT_BITS; + int r = (*p >> shift) & 1; + *p ^= ((i & 1) ^ r) << shift; + return r; +} + +/* MSGID approximates a quotation mark. Return its translation if it + has one; otherwise, return either it or "\"", depending on S. */ +static char const * +gettext_quote (char const *msgid, enum quoting_style s) +{ + char const *translation = _(msgid); + if (translation == msgid && s == clocale_quoting_style) + translation = "\""; + return translation; +} + +/* Place into buffer BUFFER (of size BUFFERSIZE) a quoted version of + argument ARG (of size ARGSIZE), using QUOTING_STYLE and the + non-quoting-style part of O to control quoting. + Terminate the output with a null character, and return the written + size of the output, not counting the terminating null. + If BUFFERSIZE is too small to store the output string, return the + value that would have been returned had BUFFERSIZE been large enough. + If ARGSIZE is SIZE_MAX, use the string length of the argument for ARGSIZE. + + This function acts like quotearg_buffer (BUFFER, BUFFERSIZE, ARG, + ARGSIZE, O), except it uses QUOTING_STYLE instead of the quoting + style specified by O, and O may not be null. */ + +static size_t +quotearg_buffer_restyled (char *buffer, size_t buffersize, + char const *arg, size_t argsize, + enum quoting_style quoting_style, + struct quoting_options const *o) +{ + size_t i; + size_t len = 0; + char const *quote_string = 0; + size_t quote_string_len = 0; + bool backslash_escapes = false; + bool unibyte_locale = MB_CUR_MAX == 1; + +#define STORE(c) \ + do \ + { \ + if (len < buffersize) \ + buffer[len] = (c); \ + len++; \ + } \ + while (0) + + switch (quoting_style) + { + case c_quoting_style: + STORE ('"'); + backslash_escapes = true; + quote_string = "\""; + quote_string_len = 1; + break; + + case escape_quoting_style: + backslash_escapes = true; + break; + + case locale_quoting_style: + case clocale_quoting_style: + { + /* TRANSLATORS: + Get translations for open and closing quotation marks. + + The message catalog should translate "`" to a left + quotation mark suitable for the locale, and similarly for + "'". If the catalog has no translation, + locale_quoting_style quotes `like this', and + clocale_quoting_style quotes "like this". + + For example, an American English Unicode locale should + translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and + should translate "'" to U+201D (RIGHT DOUBLE QUOTATION + MARK). A British English Unicode locale should instead + translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and + U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. + + If you don't know what to put here, please see + + and use glyphs suitable for your language. */ + + char const *left = gettext_quote (N_("`"), quoting_style); + char const *right = gettext_quote (N_("'"), quoting_style); + for (quote_string = left; *quote_string; quote_string++) + STORE (*quote_string); + backslash_escapes = true; + quote_string = right; + quote_string_len = strlen (quote_string); + } + break; + + case shell_always_quoting_style: + STORE ('\''); + quote_string = "'"; + quote_string_len = 1; + break; + + default: + break; + } + + for (i = 0; ! (argsize == SIZE_MAX ? arg[i] == '\0' : i == argsize); i++) + { + unsigned char c; + unsigned char esc; + + if (backslash_escapes + && quote_string_len + && i + quote_string_len <= argsize + && memcmp (arg + i, quote_string, quote_string_len) == 0) + STORE ('\\'); + + c = arg[i]; + switch (c) + { + case '\0': + if (backslash_escapes) + { + STORE ('\\'); + STORE ('0'); + STORE ('0'); + c = '0'; + } + break; + + case '?': + switch (quoting_style) + { + case shell_quoting_style: + goto use_shell_always_quoting_style; + + case c_quoting_style: + if (i + 2 < argsize && arg[i + 1] == '?') + switch (arg[i + 2]) + { + case '!': case '\'': + case '(': case ')': case '-': case '/': + case '<': case '=': case '>': + /* Escape the second '?' in what would otherwise be + a trigraph. */ + c = arg[i + 2]; + i += 2; + STORE ('?'); + STORE ('\\'); + STORE ('?'); + break; + + default: + break; + } + break; + + default: + break; + } + break; + + case '\a': esc = 'a'; goto c_escape; + case '\b': esc = 'b'; goto c_escape; + case '\f': esc = 'f'; goto c_escape; + case '\n': esc = 'n'; goto c_and_shell_escape; + case '\r': esc = 'r'; goto c_and_shell_escape; + case '\t': esc = 't'; goto c_and_shell_escape; + case '\v': esc = 'v'; goto c_escape; + case '\\': esc = c; goto c_and_shell_escape; + + c_and_shell_escape: + if (quoting_style == shell_quoting_style) + goto use_shell_always_quoting_style; + c_escape: + if (backslash_escapes) + { + c = esc; + goto store_escape; + } + break; + + case '{': case '}': /* sometimes special if isolated */ + if (! (argsize == SIZE_MAX ? arg[1] == '\0' : argsize == 1)) + break; + /* Fall through. */ + case '#': case '~': + if (i != 0) + break; + /* Fall through. */ + case ' ': + case '!': /* special in bash */ + case '"': case '$': case '&': + case '(': case ')': case '*': case ';': + case '<': + case '=': /* sometimes special in 0th or (with "set -k") later args */ + case '>': case '[': + case '^': /* special in old /bin/sh, e.g. SunOS 4.1.4 */ + case '`': case '|': + /* A shell special character. In theory, '$' and '`' could + be the first bytes of multibyte characters, which means + we should check them with mbrtowc, but in practice this + doesn't happen so it's not worth worrying about. */ + if (quoting_style == shell_quoting_style) + goto use_shell_always_quoting_style; + break; + + case '\'': + switch (quoting_style) + { + case shell_quoting_style: + goto use_shell_always_quoting_style; + + case shell_always_quoting_style: + STORE ('\''); + STORE ('\\'); + STORE ('\''); + break; + + default: + break; + } + break; + + case '%': case '+': case ',': case '-': case '.': case '/': + case '0': case '1': case '2': case '3': case '4': case '5': + case '6': case '7': case '8': case '9': case ':': + case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': + case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': + case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': + case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': + case 'Y': case 'Z': case ']': case '_': case 'a': case 'b': + case 'c': case 'd': case 'e': case 'f': case 'g': case 'h': + case 'i': case 'j': case 'k': case 'l': case 'm': case 'n': + case 'o': case 'p': case 'q': case 'r': case 's': case 't': + case 'u': case 'v': case 'w': case 'x': case 'y': case 'z': + /* These characters don't cause problems, no matter what the + quoting style is. They cannot start multibyte sequences. */ + break; + + default: + /* If we have a multibyte sequence, copy it until we reach + its end, find an error, or come back to the initial shift + state. For C-like styles, if the sequence has + unprintable characters, escape the whole sequence, since + we can't easily escape single characters within it. */ + { + /* Length of multibyte sequence found so far. */ + size_t m; + + bool printable; + + if (unibyte_locale) + { + m = 1; + printable = isprint (c) != 0; + } + else + { + mbstate_t mbstate; + memset (&mbstate, 0, sizeof mbstate); + + m = 0; + printable = true; + if (argsize == SIZE_MAX) + argsize = strlen (arg); + + do + { + wchar_t w; + size_t bytes = mbrtowc (&w, &arg[i + m], + argsize - (i + m), &mbstate); + if (bytes == 0) + break; + else if (bytes == (size_t) -1) + { + printable = false; + break; + } + else if (bytes == (size_t) -2) + { + printable = false; + while (i + m < argsize && arg[i + m]) + m++; + break; + } + else + { + /* Work around a bug with older shells that "see" a '\' + that is really the 2nd byte of a multibyte character. + In practice the problem is limited to ASCII + chars >= '@' that are shell special chars. */ + if ('[' == 0x5b && quoting_style == shell_quoting_style) + { + size_t j; + for (j = 1; j < bytes; j++) + switch (arg[i + m + j]) + { + case '[': case '\\': case '^': + case '`': case '|': + goto use_shell_always_quoting_style; + + default: + break; + } + } + + if (! iswprint (w)) + printable = false; + m += bytes; + } + } + while (! mbsinit (&mbstate)); + } + + if (1 < m || (backslash_escapes && ! printable)) + { + /* Output a multibyte sequence, or an escaped + unprintable unibyte character. */ + size_t ilim = i + m; + + for (;;) + { + if (backslash_escapes && ! printable) + { + STORE ('\\'); + STORE ('0' + (c >> 6)); + STORE ('0' + ((c >> 3) & 7)); + c = '0' + (c & 7); + } + if (ilim <= i + 1) + break; + STORE (c); + c = arg[++i]; + } + + goto store_c; + } + } + } + + if (! (backslash_escapes + && o->quote_these_too[c / INT_BITS] & (1 << (c % INT_BITS)))) + goto store_c; + + store_escape: + STORE ('\\'); + + store_c: + STORE (c); + } + + if (i == 0 && quoting_style == shell_quoting_style) + goto use_shell_always_quoting_style; + + if (quote_string) + for (; *quote_string; quote_string++) + STORE (*quote_string); + + if (len < buffersize) + buffer[len] = '\0'; + return len; + + use_shell_always_quoting_style: + return quotearg_buffer_restyled (buffer, buffersize, arg, argsize, + shell_always_quoting_style, o); +} + +/* Place into buffer BUFFER (of size BUFFERSIZE) a quoted version of + argument ARG (of size ARGSIZE), using O to control quoting. + If O is null, use the default. + Terminate the output with a null character, and return the written + size of the output, not counting the terminating null. + If BUFFERSIZE is too small to store the output string, return the + value that would have been returned had BUFFERSIZE been large enough. + If ARGSIZE is SIZE_MAX, use the string length of the argument for + ARGSIZE. */ +size_t +quotearg_buffer (char *buffer, size_t buffersize, + char const *arg, size_t argsize, + struct quoting_options const *o) +{ + struct quoting_options const *p = o ? o : &default_quoting_options; + int e = errno; + size_t r = quotearg_buffer_restyled (buffer, buffersize, arg, argsize, + p->style, p); + errno = e; + return r; +} + +/* Like quotearg_buffer (..., ARG, ARGSIZE, O), except return newly + allocated storage containing the quoted string. */ +char * +quotearg_alloc (char const *arg, size_t argsize, + struct quoting_options const *o) +{ + int e = errno; + size_t bufsize = quotearg_buffer (0, 0, arg, argsize, o) + 1; + char *buf = xcharalloc (bufsize); + quotearg_buffer (buf, bufsize, arg, argsize, o); + errno = e; + return buf; +} + +/* A storage slot with size and pointer to a value. */ +struct slotvec +{ + size_t size; + char *val; +}; + +/* Preallocate a slot 0 buffer, so that the caller can always quote + one small component of a "memory exhausted" message in slot 0. */ +static char slot0[256]; +static unsigned int nslots = 1; +static struct slotvec slotvec0 = {sizeof slot0, slot0}; +static struct slotvec *slotvec = &slotvec0; + +void +quotearg_free (void) +{ + struct slotvec *sv = slotvec; + unsigned int i; + for (i = 1; i < nslots; i++) + free (sv[i].val); + if (sv[0].val != slot0) + { + free (sv[0].val); + slotvec0.size = sizeof slot0; + slotvec0.val = slot0; + } + if (sv != &slotvec0) + { + free (sv); + slotvec = &slotvec0; + } + nslots = 1; +} + +/* Use storage slot N to return a quoted version of argument ARG. + ARG is of size ARGSIZE, but if that is SIZE_MAX, ARG is a + null-terminated string. + OPTIONS specifies the quoting options. + The returned value points to static storage that can be + reused by the next call to this function with the same value of N. + N must be nonnegative. N is deliberately declared with type "int" + to allow for future extensions (using negative values). */ +static char * +quotearg_n_options (int n, char const *arg, size_t argsize, + struct quoting_options const *options) +{ + int e = errno; + + unsigned int n0 = n; + struct slotvec *sv = slotvec; + + if (n < 0) + abort (); + + if (nslots <= n0) + { + /* FIXME: technically, the type of n1 should be `unsigned int', + but that evokes an unsuppressible warning from gcc-4.0.1 and + older. If gcc ever provides an option to suppress that warning, + revert to the original type, so that the test in xalloc_oversized + is once again performed only at compile time. */ + size_t n1 = n0 + 1; + bool preallocated = (sv == &slotvec0); + + if (xalloc_oversized (n1, sizeof *sv)) + xalloc_die (); + + slotvec = sv = xrealloc (preallocated ? NULL : sv, n1 * sizeof *sv); + if (preallocated) + *sv = slotvec0; + memset (sv + nslots, 0, (n1 - nslots) * sizeof *sv); + nslots = n1; + } + + { + size_t size = sv[n].size; + char *val = sv[n].val; + size_t qsize = quotearg_buffer (val, size, arg, argsize, options); + + if (size <= qsize) + { + sv[n].size = size = qsize + 1; + if (val != slot0) + free (val); + sv[n].val = val = xcharalloc (size); + quotearg_buffer (val, size, arg, argsize, options); + } + + errno = e; + return val; + } +} + +char * +quotearg_n (int n, char const *arg) +{ + return quotearg_n_options (n, arg, SIZE_MAX, &default_quoting_options); +} + +char * +quotearg (char const *arg) +{ + return quotearg_n (0, arg); +} + +/* Return quoting options for STYLE, with no extra quoting. */ +static struct quoting_options +quoting_options_from_style (enum quoting_style style) +{ + struct quoting_options o; + o.style = style; + memset (o.quote_these_too, 0, sizeof o.quote_these_too); + return o; +} + +char * +quotearg_n_style (int n, enum quoting_style s, char const *arg) +{ + struct quoting_options const o = quoting_options_from_style (s); + return quotearg_n_options (n, arg, SIZE_MAX, &o); +} + +char * +quotearg_n_style_mem (int n, enum quoting_style s, + char const *arg, size_t argsize) +{ + struct quoting_options const o = quoting_options_from_style (s); + return quotearg_n_options (n, arg, argsize, &o); +} + +char * +quotearg_style (enum quoting_style s, char const *arg) +{ + return quotearg_n_style (0, s, arg); +} + +char * +quotearg_char (char const *arg, char ch) +{ + struct quoting_options options; + options = default_quoting_options; + set_char_quoting (&options, ch, 1); + return quotearg_n_options (0, arg, SIZE_MAX, &options); +} + +char * +quotearg_colon (char const *arg) +{ + return quotearg_char (arg, ':'); +} diff -ruNp m4-1.4.7/lib/quotearg.h m4-1.4.8/lib/quotearg.h --- m4-1.4.7/lib/quotearg.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/lib/quotearg.h 2006-11-20 07:23:04.000000000 -0700 @@ -0,0 +1,140 @@ +/* quotearg.h - quote arguments for output + + 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. */ + +/* Written by Paul Eggert */ + +#ifndef QUOTEARG_H_ +# define QUOTEARG_H_ 1 + +# include + +/* Basic quoting styles. */ +enum quoting_style + { + /* Output names as-is (ls --quoting-style=literal). */ + literal_quoting_style, + + /* Quote names for the shell if they contain shell metacharacters + or would cause ambiguous output (ls --quoting-style=shell). */ + shell_quoting_style, + + /* Quote names for the shell, even if they would normally not + require quoting (ls --quoting-style=shell-always). */ + shell_always_quoting_style, + + /* Quote names as for a C language string (ls --quoting-style=c). */ + c_quoting_style, + + /* Like c_quoting_style except omit the surrounding double-quote + characters (ls --quoting-style=escape). */ + escape_quoting_style, + + /* Like clocale_quoting_style, but quote `like this' instead of + "like this" in the default C locale (ls --quoting-style=locale). */ + locale_quoting_style, + + /* Like c_quoting_style except use quotation marks appropriate for + the locale (ls --quoting-style=clocale). */ + clocale_quoting_style + }; + +/* For now, --quoting-style=literal is the default, but this may change. */ +# ifndef DEFAULT_QUOTING_STYLE +# define DEFAULT_QUOTING_STYLE literal_quoting_style +# endif + +/* Names of quoting styles and their corresponding values. */ +extern char const *const quoting_style_args[]; +extern enum quoting_style const quoting_style_vals[]; + +struct quoting_options; + +/* The functions listed below set and use a hidden variable + that contains the default quoting style options. */ + +/* Allocate a new set of quoting options, with contents initially identical + to O if O is not null, or to the default if O is null. + It is the caller's responsibility to free the result. */ +struct quoting_options *clone_quoting_options (struct quoting_options *o); + +/* Get the value of O's quoting style. If O is null, use the default. */ +enum quoting_style get_quoting_style (struct quoting_options *o); + +/* In O (or in the default if O is null), + set the value of the quoting style to S. */ +void set_quoting_style (struct quoting_options *o, enum quoting_style s); + +/* In O (or in the default if O is null), + set the value of the quoting options for character C to I. + Return the old value. Currently, the only values defined for I are + 0 (the default) and 1 (which means to quote the character even if + it would not otherwise be quoted). */ +int set_char_quoting (struct quoting_options *o, char c, int i); + +/* Place into buffer BUFFER (of size BUFFERSIZE) a quoted version of + argument ARG (of size ARGSIZE), using O to control quoting. + If O is null, use the default. + Terminate the output with a null character, and return the written + size of the output, not counting the terminating null. + If BUFFERSIZE is too small to store the output string, return the + value that would have been returned had BUFFERSIZE been large enough. + If ARGSIZE is -1, use the string length of the argument for ARGSIZE. */ +size_t quotearg_buffer (char *buffer, size_t buffersize, + char const *arg, size_t argsize, + struct quoting_options const *o); + +/* Like quotearg_buffer, except return the result in a newly allocated + buffer. It is the caller's responsibility to free the result. */ +char *quotearg_alloc (char const *arg, size_t argsize, + struct quoting_options const *o); + +/* Use storage slot N to return a quoted version of the string ARG. + Use the default quoting options. + The returned value points to static storage that can be + reused by the next call to this function with the same value of N. + N must be nonnegative. */ +char *quotearg_n (int n, char const *arg); + +/* Equivalent to quotearg_n (0, ARG). */ +char *quotearg (char const *arg); + +/* Use style S and storage slot N to return a quoted version of the string ARG. + This is like quotearg_n (N, ARG), except that it uses S with no other + options to specify the quoting method. */ +char *quotearg_n_style (int n, enum quoting_style s, char const *arg); + +/* Use style S and storage slot N to return a quoted version of the + argument ARG of size ARGSIZE. This is like quotearg_n_style + (N, S, ARG), except it can quote null bytes. */ +char *quotearg_n_style_mem (int n, enum quoting_style s, + char const *arg, size_t argsize); + +/* Equivalent to quotearg_n_style (0, S, ARG). */ +char *quotearg_style (enum quoting_style s, char const *arg); + +/* Like quotearg (ARG), except also quote any instances of CH. */ +char *quotearg_char (char const *arg, char ch); + +/* Equivalent to quotearg_char (ARG, ':'). */ +char *quotearg_colon (char const *arg); + +/* Free any dynamically allocated memory. */ +void quotearg_free (void); + +#endif /* !QUOTEARG_H_ */ diff -ruNp m4-1.4.7/lib/sigprocmask.c m4-1.4.8/lib/sigprocmask.c --- m4-1.4.7/lib/sigprocmask.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/lib/sigprocmask.c 2006-11-20 06:57:29.000000000 -0700 @@ -0,0 +1,192 @@ +/* POSIX compatible signal blocking. + Copyright (C) 2006 Free Software Foundation, Inc. + Written by Bruno Haible , 2006. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include + +/* Specification. */ +#include "sigprocmask.h" + +#include +#include +#include + +/* We assume that a platform without POSIX signal blocking functions also + does not have the POSIX sigaction() function, only the signal() function. + This is true for Woe32 platforms. */ + +/* A signal handler. */ +typedef void (*handler_t) (int signal); + +int +sigismember (const sigset_t *set, int sig) +{ + if (sig >= 0 && sig < NSIG) + return (*set >> sig) & 1; + else + return 0; +} + +int +sigemptyset (sigset_t *set) +{ + *set = 0; + return 0; +} + +int +sigaddset (sigset_t *set, int sig) +{ + if (sig >= 0 && sig < NSIG) + { + *set |= 1U << sig; + return 0; + } + else + { + errno = EINVAL; + return -1; + } +} + +int +sigdelset (sigset_t *set, int sig) +{ + if (sig >= 0 && sig < NSIG) + { + *set &= ~(1U << sig); + return 0; + } + else + { + errno = EINVAL; + return -1; + } +} + +int +sigfillset (sigset_t *set) +{ + *set = (2U << (NSIG - 1)) - 1; + return 0; +} + +/* Set of currently blocked signals. */ +static sigset_t blocked_set /* = 0 */; + +/* Set of currently blocked and pending signals. */ +static volatile sig_atomic_t pending_array[NSIG] /* = { 0 } */; + +/* Signal handler that is installed for blocked signals. */ +static void +blocked_handler (int sig) +{ + if (sig >= 0 && sig < NSIG) + pending_array[sig] = 1; +} + +int +sigpending (sigset_t *set) +{ + sigset_t pending = 0; + int sig; + + for (sig = 0; sig < NSIG; sig++) + if (pending_array[sig]) + pending |= 1U << sig; + return pending; +} + +/* The previous signal handlers. + Only the array elements corresponding to blocked signals are relevant. */ +static handler_t old_handlers[NSIG]; + +int +sigprocmask (int operation, const sigset_t *set, sigset_t *old_set) +{ + if (old_set != NULL) + *old_set = blocked_set; + + if (set != NULL) + { + sigset_t new_blocked_set; + sigset_t to_unblock; + sigset_t to_block; + + switch (operation) + { + case SIG_BLOCK: + new_blocked_set = blocked_set | *set; + break; + case SIG_SETMASK: + new_blocked_set = *set; + break; + case SIG_UNBLOCK: + new_blocked_set = blocked_set & ~*set; + break; + default: + errno = EINVAL; + return -1; + } + to_unblock = blocked_set & ~new_blocked_set; + to_block = new_blocked_set & ~blocked_set; + + if (to_block != 0) + { + int sig; + + for (sig = 0; sig < NSIG; sig++) + if ((to_block >> sig) & 1) + { + pending_array[sig] = 0; + if ((old_handlers[sig] = signal (sig, blocked_handler)) != SIG_ERR) + blocked_set |= 1U << sig; + } + } + + if (to_unblock != 0) + { + sig_atomic_t received[NSIG]; + int sig; + + for (sig = 0; sig < NSIG; sig++) + if ((to_unblock >> sig) & 1) + { + if (signal (sig, old_handlers[sig]) != blocked_handler) + /* The application changed a signal handler while the signal + was blocked. We don't support this. */ + abort (); + received[sig] = pending_array[sig]; + blocked_set &= ~(1U << sig); + pending_array[sig] = 0; + } + else + received[sig] = 0; + + for (sig = 0; sig < NSIG; sig++) + if (received[sig]) + { + #if HAVE_RAISE + raise (sig); + #else + kill (getpid (), sig); + #endif + } + } + } + return 0; +} diff -ruNp m4-1.4.7/lib/sigprocmask.h m4-1.4.8/lib/sigprocmask.h --- m4-1.4.7/lib/sigprocmask.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/lib/sigprocmask.h 2006-11-20 06:57:29.000000000 -0700 @@ -0,0 +1,69 @@ +/* POSIX compatible signal blocking. + Copyright (C) 2006 Free Software Foundation, Inc. + Written by Bruno Haible , 2006. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include + +#if ! HAVE_POSIX_SIGNALBLOCKING + +/* Mingw defines sigset_t not in , but in . */ +# include + +# include "verify.h" + +/* Maximum signal number + 1. */ +# ifndef NSIG +# define NSIG 32 +# endif + +/* This code supports only 32 signals. */ +verify (NSIG <= 32); + +/* A set or mask of signals. */ +# if !HAVE_SIGSET_T +typedef unsigned int sigset_t; +# endif + +/* Test whether a given signal is contained in a signal set. */ +extern int sigismember (const sigset_t *set, int sig); + +/* Initialize a signal set to the empty set. */ +extern int sigemptyset (sigset_t *set); + +/* Add a signal to a signal set. */ +extern int sigaddset (sigset_t *set, int sig); + +/* Remove a signal from a signal set. */ +extern int sigdelset (sigset_t *set, int sig); + +/* Fill a signal set with all possible signals. */ +extern int sigfillset (sigset_t *set); + +/* Return the set of those blocked signals that are pending. */ +extern int sigpending (sigset_t *set); + +/* If OLD_SET is not NULL, put the current set of blocked signals in *OLD_SET. + Then, if SET is not NULL, affect the current set of blocked signals by + combining it with *SET as indicated in OPERATION. + In this implementation, you are not allowed to change a signal handler + while the signal is blocked. */ +# define SIG_BLOCK 0 /* blocked_set = blocked_set | *set; */ +# define SIG_SETMASK 1 /* blocked_set = *set; */ +# define SIG_UNBLOCK 2 /* blocked_set = blocked_set & ~*set; */ +extern int sigprocmask (int operation, const sigset_t *set, sigset_t *old_set); + +#endif diff -ruNp m4-1.4.7/lib/stat-macros.h m4-1.4.8/lib/stat-macros.h --- m4-1.4.7/lib/stat-macros.h 2006-09-23 22:28:38.000000000 -0600 +++ m4-1.4.8/lib/stat-macros.h 1969-12-31 17:00:00.000000000 -0700 @@ -1,260 +0,0 @@ -/* stat-related macros - - Copyright (C) 1993, 1994, 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. */ - -/* Written by Paul Eggert and Jim Meyering. */ - -#ifndef STAT_MACROS_H -# define STAT_MACROS_H 1 - -# if ! defined S_ISREG && ! defined S_IFREG -# error "you must include before including this file" -# endif - -# ifndef S_IFMT -# define S_IFMT 0170000 -# endif - -# if STAT_MACROS_BROKEN -# undef S_ISBLK -# undef S_ISCHR -# undef S_ISDIR -# undef S_ISFIFO -# undef S_ISLNK -# undef S_ISNAM -# undef S_ISMPB -# undef S_ISMPC -# undef S_ISNWK -# undef S_ISREG -# undef S_ISSOCK -# endif - - -# ifndef S_ISBLK -# ifdef S_IFBLK -# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) -# else -# define S_ISBLK(m) 0 -# endif -# endif - -# ifndef S_ISCHR -# ifdef S_IFCHR -# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) -# else -# define S_ISCHR(m) 0 -# endif -# endif - -# ifndef S_ISDIR -# ifdef S_IFDIR -# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) -# else -# define S_ISDIR(m) 0 -# endif -# endif - -# ifndef S_ISDOOR /* Solaris 2.5 and up */ -# define S_ISDOOR(m) 0 -# endif - -# ifndef S_ISFIFO -# ifdef S_IFIFO -# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) -# else -# define S_ISFIFO(m) 0 -# endif -# endif - -# ifndef S_ISLNK -# ifdef S_IFLNK -# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) -# else -# define S_ISLNK(m) 0 -# endif -# endif - -# ifndef S_ISMPB /* V7 */ -# ifdef S_IFMPB -# define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB) -# define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC) -# else -# define S_ISMPB(m) 0 -# define S_ISMPC(m) 0 -# endif -# endif - -# ifndef S_ISNAM /* Xenix */ -# ifdef S_IFNAM -# define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM) -# else -# define S_ISNAM(m) 0 -# endif -# endif - -# ifndef S_ISNWK /* HP/UX */ -# ifdef S_IFNWK -# define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK) -# else -# define S_ISNWK(m) 0 -# endif -# endif - -# ifndef S_ISPORT /* Solaris 10 and up */ -# define S_ISPORT(m) 0 -# endif - -# ifndef S_ISREG -# ifdef S_IFREG -# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) -# else -# define S_ISREG(m) 0 -# endif -# endif - -# ifndef S_ISSOCK -# ifdef S_IFSOCK -# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) -# else -# define S_ISSOCK(m) 0 -# endif -# endif - - -# ifndef S_TYPEISMQ -# define S_TYPEISMQ(p) 0 -# endif - -# ifndef S_TYPEISTMO -# define S_TYPEISTMO(p) 0 -# endif - - -# ifndef S_TYPEISSEM -# ifdef S_INSEM -# define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM) -# else -# define S_TYPEISSEM(p) 0 -# endif -# endif - -# ifndef S_TYPEISSHM -# ifdef S_INSHD -# define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD) -# else -# define S_TYPEISSHM(p) 0 -# endif -# endif - -/* high performance ("contiguous data") */ -# ifndef S_ISCTG -# define S_ISCTG(p) 0 -# endif - -/* Cray DMF (data migration facility): off line, with data */ -# ifndef S_ISOFD -# define S_ISOFD(p) 0 -# endif - -/* Cray DMF (data migration facility): off line, with no data */ -# ifndef S_ISOFL -# define S_ISOFL(p) 0 -# endif - -/* 4.4BSD whiteout */ -# ifndef S_ISWHT -# define S_ISWHT(m) 0 -# endif - -/* If any of the following are undefined, - define them to their de facto standard values. */ -# if !S_ISUID -# define S_ISUID 04000 -# endif -# if !S_ISGID -# define S_ISGID 02000 -# endif - -/* S_ISVTX is a common extension to POSIX. */ -# ifndef S_ISVTX -# define S_ISVTX 01000 -# endif - -# if !S_IRUSR && S_IREAD -# define S_IRUSR S_IREAD -# endif -# if !S_IRUSR -# define S_IRUSR 00400 -# endif -# if !S_IRGRP -# define S_IRGRP (S_IRUSR >> 3) -# endif -# if !S_IROTH -# define S_IROTH (S_IRUSR >> 6) -# endif - -# if !S_IWUSR && S_IWRITE -# define S_IWUSR S_IWRITE -# endif -# if !S_IWUSR -# define S_IWUSR 00200 -# endif -# if !S_IWGRP -# define S_IWGRP (S_IWUSR >> 3) -# endif -# if !S_IWOTH -# define S_IWOTH (S_IWUSR >> 6) -# endif - -# if !S_IXUSR && S_IEXEC -# define S_IXUSR S_IEXEC -# endif -# if !S_IXUSR -# define S_IXUSR 00100 -# endif -# if !S_IXGRP -# define S_IXGRP (S_IXUSR >> 3) -# endif -# if !S_IXOTH -# define S_IXOTH (S_IXUSR >> 6) -# endif - -# if !S_IRWXU -# define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR) -# endif -# if !S_IRWXG -# define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP) -# endif -# if !S_IRWXO -# define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH) -# endif - -/* S_IXUGO is a common extension to POSIX. */ -# if !S_IXUGO -# define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH) -# endif - -# ifndef S_IRWXUGO -# define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO) -# endif - -/* All the mode bits that can be affected by chmod. */ -# define CHMOD_MODE_BITS \ - (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO) - -#endif /* STAT_MACROS_H */ diff -ruNp m4-1.4.7/lib/stat_.h m4-1.4.8/lib/stat_.h --- m4-1.4.7/lib/stat_.h 2006-09-23 22:28:38.000000000 -0600 +++ m4-1.4.8/lib/stat_.h 2006-11-20 06:57:46.000000000 -0700 @@ -1,6 +1,5 @@ -/* Provide a complete sys/stat header file. +/* Provide a more complete sys/stat header file. Copyright (C) 2006 Free Software Foundation, Inc. - Written by Eric Blake. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,6 +15,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +/* Written by Eric Blake, Paul Eggert, and Jim Meyering. */ + #ifndef _gl_SYS_STAT_H #define _gl_SYS_STAT_H @@ -24,6 +25,232 @@ needed by an application. Start with what the system provides. */ #include @ABSOLUTE_SYS_STAT_H@ +#ifndef S_IFMT +# define S_IFMT 0170000 +#endif + +#if STAT_MACROS_BROKEN +# undef S_ISBLK +# undef S_ISCHR +# undef S_ISDIR +# undef S_ISFIFO +# undef S_ISLNK +# undef S_ISNAM +# undef S_ISMPB +# undef S_ISMPC +# undef S_ISNWK +# undef S_ISREG +# undef S_ISSOCK +#endif + +#ifndef S_ISBLK +# ifdef S_IFBLK +# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) +# else +# define S_ISBLK(m) 0 +# endif +#endif + +#ifndef S_ISCHR +# ifdef S_IFCHR +# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) +# else +# define S_ISCHR(m) 0 +# endif +#endif + +#ifndef S_ISDIR +# ifdef S_IFDIR +# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) +# else +# define S_ISDIR(m) 0 +# endif +#endif + +#ifndef S_ISDOOR /* Solaris 2.5 and up */ +# define S_ISDOOR(m) 0 +#endif + +#ifndef S_ISFIFO +# ifdef S_IFIFO +# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) +# else +# define S_ISFIFO(m) 0 +# endif +#endif + +#ifndef S_ISLNK +# ifdef S_IFLNK +# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) +# else +# define S_ISLNK(m) 0 +# endif +#endif + +#ifndef S_ISMPB /* V7 */ +# ifdef S_IFMPB +# define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB) +# define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC) +# else +# define S_ISMPB(m) 0 +# define S_ISMPC(m) 0 +# endif +#endif + +#ifndef S_ISNAM /* Xenix */ +# ifdef S_IFNAM +# define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM) +# else +# define S_ISNAM(m) 0 +# endif +#endif + +#ifndef S_ISNWK /* HP/UX */ +# ifdef S_IFNWK +# define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK) +# else +# define S_ISNWK(m) 0 +# endif +#endif + +#ifndef S_ISPORT /* Solaris 10 and up */ +# define S_ISPORT(m) 0 +#endif + +#ifndef S_ISREG +# ifdef S_IFREG +# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) +# else +# define S_ISREG(m) 0 +# endif +#endif + +#ifndef S_ISSOCK +# ifdef S_IFSOCK +# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) +# else +# define S_ISSOCK(m) 0 +# endif +#endif + + +#ifndef S_TYPEISMQ +# define S_TYPEISMQ(p) 0 +#endif + +#ifndef S_TYPEISTMO +# define S_TYPEISTMO(p) 0 +#endif + + +#ifndef S_TYPEISSEM +# ifdef S_INSEM +# define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM) +# else +# define S_TYPEISSEM(p) 0 +# endif +#endif + +#ifndef S_TYPEISSHM +# ifdef S_INSHD +# define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD) +# else +# define S_TYPEISSHM(p) 0 +# endif +#endif + +/* high performance ("contiguous data") */ +#ifndef S_ISCTG +# define S_ISCTG(p) 0 +#endif + +/* Cray DMF (data migration facility): off line, with data */ +#ifndef S_ISOFD +# define S_ISOFD(p) 0 +#endif + +/* Cray DMF (data migration facility): off line, with no data */ +#ifndef S_ISOFL +# define S_ISOFL(p) 0 +#endif + +/* 4.4BSD whiteout */ +#ifndef S_ISWHT +# define S_ISWHT(m) 0 +#endif + +/* If any of the following are undefined, + define them to their de facto standard values. */ +#if !S_ISUID +# define S_ISUID 04000 +#endif +#if !S_ISGID +# define S_ISGID 02000 +#endif + +/* S_ISVTX is a common extension to POSIX. */ +#ifndef S_ISVTX +# define S_ISVTX 01000 +#endif + +#if !S_IRUSR && S_IREAD +# define S_IRUSR S_IREAD +#endif +#if !S_IRUSR +# define S_IRUSR 00400 +#endif +#if !S_IRGRP +# define S_IRGRP (S_IRUSR >> 3) +#endif +#if !S_IROTH +# define S_IROTH (S_IRUSR >> 6) +#endif + +#if !S_IWUSR && S_IWRITE +# define S_IWUSR S_IWRITE +#endif +#if !S_IWUSR +# define S_IWUSR 00200 +#endif +#if !S_IWGRP +# define S_IWGRP (S_IWUSR >> 3) +#endif +#if !S_IWOTH +# define S_IWOTH (S_IWUSR >> 6) +#endif + +#if !S_IXUSR && S_IEXEC +# define S_IXUSR S_IEXEC +#endif +#if !S_IXUSR +# define S_IXUSR 00100 +#endif +#if !S_IXGRP +# define S_IXGRP (S_IXUSR >> 3) +#endif +#if !S_IXOTH +# define S_IXOTH (S_IXUSR >> 6) +#endif + +#if !S_IRWXU +# define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR) +#endif +#if !S_IRWXG +# define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP) +#endif +#if !S_IRWXO +# define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH) +#endif + +/* S_IXUGO is a common extension to POSIX. */ +#if !S_IXUGO +# define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH) +#endif + +#ifndef S_IRWXUGO +# define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO) +#endif + /* mingw does not support symlinks, therefore it does not have lstat. But without links, stat does just fine. */ #if ! HAVE_LSTAT diff -ruNp m4-1.4.7/lib/stdint_.h m4-1.4.8/lib/stdint_.h --- m4-1.4.7/lib/stdint_.h 2006-09-23 22:28:38.000000000 -0600 +++ m4-1.4.8/lib/stdint_.h 2006-11-20 07:23:06.000000000 -0700 @@ -48,10 +48,11 @@ /* defines some of the stdint.h types as well, on glibc, IRIX 6.5, and OpenBSD 3.8 (via ). + AIX 5.2 isn't needed and causes troubles. 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@ +#if @HAVE_SYS_TYPES_H@ && ! defined _AIX # include #endif @@ -124,15 +125,20 @@ #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 +#endif + +#undef uint64_t +#if ULONG_MAX >> 31 >> 31 >> 1 == 1 +# define uint64_t unsigned long int +#elif defined _MSC_VER +# define uint64_t unsigned __int64 +#elif @HAVE_UNSIGNED_LONG_LONG_INT@ # define uint64_t unsigned long long int #endif @@ -164,6 +170,8 @@ #define uint_least32_t uint32_t #ifdef int64_t # define int_least64_t int64_t +#endif +#ifdef uint64_t # define uint_least64_t uint64_t #endif @@ -193,6 +201,8 @@ #define uint_fast32_t unsigned int_fast32_t #ifdef int64_t # define int_fast64_t int64_t +#endif +#ifdef uint64_t # define uint_fast64_t uint64_t #endif @@ -209,15 +219,20 @@ 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 +#endif + +#undef uintmax_t +#if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 +# define uintmax_t unsigned long long int +#elif defined uint64_t +# define uintmax_t uint64_t +#else # define uintmax_t unsigned long int #endif @@ -253,10 +268,13 @@ #undef INT64_MIN #undef INT64_MAX -#undef UINT64_MAX #ifdef int64_t # define INT64_MIN (~ INT64_MAX) # define INT64_MAX INTMAX_C (9223372036854775807) +#endif + +#undef UINT64_MAX +#ifdef uint64_t # define UINT64_MAX UINTMAX_C (18446744073709551615) #endif @@ -289,10 +307,13 @@ #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 +#endif + +#undef UINT_LEAST64_MAX +#ifdef uint64_t # define UINT_LEAST64_MAX UINT64_MAX #endif @@ -325,10 +346,13 @@ #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 +#endif + +#undef UINT_FAST64_MAX +#ifdef uint64_t # define UINT_FAST64_MAX UINT64_MAX #endif @@ -345,13 +369,17 @@ #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 +#endif + +#undef UINTMAX_MAX +#ifdef UINT64_MAX +# define UINTMAX_MAX UINT64_MAX +#else # define UINTMAX_MAX UINT32_MAX #endif @@ -427,27 +455,36 @@ #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 +#endif +#if ULONG_MAX >> 31 >> 31 >> 1 == 1 +# define UINT64_C(x) x##UL +#elif defined _MSC_VER +# define UINT64_C(x) x##ui64 +#elif @HAVE_UNSIGNED_LONG_LONG_INT@ # define UINT64_C(x) x##ULL #endif /* 7.18.4.2. Macros for greatest-width integer constants */ #undef INTMAX_C -#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 +#endif + +#undef UINTMAX_C +#if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 +# define UINTMAX_C(x) x##ULL +#elif defined uint64_t +# define UINTMAX_C(x) UINT64_C(x) +#else # define UINTMAX_C(x) x##UL #endif diff -ruNp m4-1.4.7/lib/strcase.h m4-1.4.8/lib/strcase.h --- m4-1.4.7/lib/strcase.h 2006-09-23 22:28:39.000000000 -0600 +++ m4-1.4.8/lib/strcase.h 2006-11-20 07:23:07.000000000 -0700 @@ -1,5 +1,5 @@ /* Case-insensitive string comparison functions. - Copyright (C) 1995-1996, 2001, 2003, 2005 Free Software Foundation, Inc. + Copyright (C) 1995-1996, 2001, 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 @@ -19,13 +19,19 @@ #define _STRCASE_H #include - +/* Include header files with a possibly conflicting declarations of strcasecmp + before we define it as a macro, so that they will be no-ops if included + after strcasecmp is defined as a macro. */ +#include #ifdef __cplusplus extern "C" { #endif +/* No known system has a strcasecmp() function that works correctly in + multibyte locales. Therefore we use our version always. */ +#define strcasecmp rpl_strcasecmp /* Compare strings S1 and S2, ignoring case, returning less than, equal to or greater than zero if S1 is lexicographically less than, equal to or greater than S2. @@ -37,7 +43,9 @@ extern int strcasecmp (const char *s1, c returning less than, equal to or greater than zero if S1 is lexicographically less than, equal to or greater than S2. Note: This function can not work correctly in multibyte locales. */ +#if ! HAVE_DECL_STRNCASECMP extern int strncasecmp (const char *s1, const char *s2, size_t n); +#endif #ifdef __cplusplus diff -ruNp m4-1.4.7/lib/strnlen1.c m4-1.4.8/lib/strnlen1.c --- m4-1.4.7/lib/strnlen1.c 2006-09-23 22:28:39.000000000 -0600 +++ m4-1.4.8/lib/strnlen1.c 2006-11-20 06:57:47.000000000 -0700 @@ -28,7 +28,7 @@ size_t strnlen1 (const char *string, size_t maxlen) { - const char *end = memchr (string, '\0', maxlen); + const char *end = (const char *) memchr (string, '\0', maxlen); if (end != NULL) return end - string + 1; else diff -ruNp m4-1.4.7/lib/strstr.c m4-1.4.8/lib/strstr.c --- m4-1.4.7/lib/strstr.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/lib/strstr.c 2006-11-20 06:57:29.000000000 -0700 @@ -0,0 +1,126 @@ +/* Searching in a string. + Copyright (C) 2005-2006 Free Software Foundation, Inc. + Written by Bruno Haible , 2005. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include + +/* Specification. */ +#include "strstr.h" + +#include /* for NULL */ + +#if HAVE_MBRTOWC +# include "mbuiter.h" +#endif + +/* Find the first occurrence of NEEDLE in HAYSTACK. */ +char * +strstr (const char *haystack, const char *needle) +{ + /* Be careful not to look at the entire extent of haystack or needle + until needed. This is useful because of these two cases: + - haystack may be very long, and a match of needle found early, + - needle may be very long, and not even a short initial segment of + needle may be found in haystack. */ +#if HAVE_MBRTOWC + if (MB_CUR_MAX > 1) + { + mbui_iterator_t iter_needle; + + mbui_init (iter_needle, needle); + if (mbui_avail (iter_needle)) + { + mbui_iterator_t iter_haystack; + + mbui_init (iter_haystack, haystack); + for (;; mbui_advance (iter_haystack)) + { + if (!mbui_avail (iter_haystack)) + /* No match. */ + return NULL; + + if (mb_equal (mbui_cur (iter_haystack), mbui_cur (iter_needle))) + /* The first character matches. */ + { + mbui_iterator_t rhaystack; + mbui_iterator_t rneedle; + + memcpy (&rhaystack, &iter_haystack, sizeof (mbui_iterator_t)); + mbui_advance (rhaystack); + + mbui_init (rneedle, needle); + if (!mbui_avail (rneedle)) + abort (); + mbui_advance (rneedle); + + for (;; mbui_advance (rhaystack), mbui_advance (rneedle)) + { + if (!mbui_avail (rneedle)) + /* Found a match. */ + return (char *) mbui_cur_ptr (iter_haystack); + if (!mbui_avail (rhaystack)) + /* No match. */ + return NULL; + if (!mb_equal (mbui_cur (rhaystack), mbui_cur (rneedle))) + /* Nothing in this round. */ + break; + } + } + } + } + else + return (char *) haystack; + } + else +#endif + { + if (*needle != '\0') + { + /* Speed up the following searches of needle by caching its first + character. */ + char b = *needle++; + + for (;; haystack++) + { + if (*haystack == '\0') + /* No match. */ + return NULL; + if (*haystack == b) + /* The first character matches. */ + { + const char *rhaystack = haystack + 1; + const char *rneedle = needle; + + for (;; rhaystack++, rneedle++) + { + if (*rneedle == '\0') + /* Found a match. */ + return (char *) haystack; + if (*rhaystack == '\0') + /* No match. */ + return NULL; + if (*rhaystack != *rneedle) + /* Nothing in this round. */ + break; + } + } + } + } + else + return (char *) haystack; + } +} diff -ruNp m4-1.4.7/lib/strstr.h m4-1.4.8/lib/strstr.h --- m4-1.4.7/lib/strstr.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/lib/strstr.h 2006-11-20 06:57:29.000000000 -0700 @@ -0,0 +1,37 @@ +/* Searching in a string. + 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. */ + + +/* Include string.h: on glibc systems, it contains a macro definition of + strstr() that would collide with our definition if included afterwards. */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* No known system has a strstr() function that works correctly in + multibyte locales. Therefore we use our version always. */ +#undef strstr +#define strstr rpl_strstr + +/* Find the first occurrence of NEEDLE in HAYSTACK. */ +extern char *strstr (const char *haystack, const char *needle); + +#ifdef __cplusplus +} +#endif diff -ruNp m4-1.4.7/lib/tempname.c m4-1.4.8/lib/tempname.c --- m4-1.4.7/lib/tempname.c 2006-09-23 22:28:40.000000000 -0600 +++ m4-1.4.8/lib/tempname.c 2006-11-20 07:23:09.000000000 -0700 @@ -17,8 +17,11 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +/* Extracted from glibc sysdeps/posix/tempname.c. See also tmpdir.c. */ + #if !_LIBC # include +# include "tempname.h" #endif #include @@ -63,10 +66,10 @@ # define small_open __open # define large_open __open64 #else -# include "stat-macros.h" # define struct_stat64 struct stat # define small_open open # define large_open open +# define __gen_tempname gen_tempname # define __getpid getpid # define __gettimeofday gettimeofday # define __mkdir mkdir @@ -106,6 +109,7 @@ # define uint64_t uintmax_t #endif +#if _LIBC /* Return nonzero if DIR is an existent directory. */ static int direxists (const char *dir) @@ -176,6 +180,7 @@ __path_search (char *tmpl, size_t tmpl_l sprintf (tmpl, "%.*s/%.*sXXXXXX", (int) dlen, dir, (int) plen, pfx); return 0; } +#endif /* _LIBC */ /* These are the characters used in temporary file names. */ static const char letters[] = diff -ruNp m4-1.4.7/lib/tempname.h m4-1.4.8/lib/tempname.h --- m4-1.4.7/lib/tempname.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/lib/tempname.h 2006-11-20 06:57:30.000000000 -0700 @@ -0,0 +1,40 @@ +/* Create a temporary file or directory. + + 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. */ + +/* header written by Eric Blake */ + +/* In gnulib, always prefer large files. GT_FILE maps to + __GT_BIGFILE, not __GT_FILE, for a reason. */ +#define GT_FILE 1 +#define GT_DIR 2 +#define GT_NOCREATE 3 + +/* Generate a temporary file name based on TMPL. TMPL must match the + rules for mk[s]temp (i.e. end in "XXXXXX"). The name constructed + does not exist at the time of the call to gen_tempname. TMPL is + overwritten with the result. + + KIND may be one of: + GT_NOCREATE: simply verify that the name does not exist + at the time of the call. + GT_FILE: create a large file using open(O_CREAT|O_EXCL) + and return a read-write fd. The file is mode 0600. + GT_DIR: create a directory, which will be mode 0700. + + We use a clever algorithm to get hard-to-predict names. */ +extern int gen_tempname (char *tmpl, int kind); diff -ruNp m4-1.4.7/lib/tmpdir.c m4-1.4.8/lib/tmpdir.c --- m4-1.4.7/lib/tmpdir.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/lib/tmpdir.c 2006-11-20 06:57:30.000000000 -0700 @@ -0,0 +1,133 @@ +/* Copyright (C) 1999, 2001-2002, 2006 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + This program is free software; you can redistribute it and/or modify + 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. */ + +/* Extracted from sysdeps/posix/tempname.c. */ + +#include + +/* Specification. */ +#include "tmpdir.h" + +#include +#include +#include + +#include +#ifndef __set_errno +# define __set_errno(Val) errno = (Val) +#endif + +#include +#ifndef P_tmpdir +# define P_tmpdir "/tmp" +#endif + +#include + +#if _LIBC +# define struct_stat64 struct stat64 +#else +# define struct_stat64 struct stat +# define __xstat64(version, path, buf) stat (path, buf) +#endif + +#if ! (HAVE___SECURE_GETENV || _LIBC) +# define __secure_getenv getenv +#endif + +/* Pathname support. + ISSLASH(C) tests whether C is a directory separator character. + */ +#if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__ + /* Win32, Cygwin, OS/2, DOS */ +# define ISSLASH(C) ((C) == '/' || (C) == '\\') +#else + /* Unix */ +# define ISSLASH(C) ((C) == '/') +#endif + + +/* Return nonzero if DIR is an existent directory. */ +static bool +direxists (const char *dir) +{ + struct_stat64 buf; + return __xstat64 (_STAT_VER, dir, &buf) == 0 && S_ISDIR (buf.st_mode); +} + +/* Path search algorithm, for tmpnam, tmpfile, etc. If DIR is + non-null and exists, uses it; otherwise uses the first of $TMPDIR, + P_tmpdir, /tmp that exists. Copies into TMPL a template suitable + for use with mk[s]temp. Will fail (-1) if DIR is non-null and + doesn't exist, none of the searched dirs exists, or there's not + enough space in TMPL. */ +int +path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx, + bool try_tmpdir) +{ + const char *d; + size_t dlen, plen; + + if (!pfx || !pfx[0]) + { + pfx = "file"; + plen = 4; + } + else + { + plen = strlen (pfx); + if (plen > 5) + plen = 5; + } + + if (try_tmpdir) + { + d = __secure_getenv ("TMPDIR"); + if (d != NULL && direxists (d)) + dir = d; + else if (dir != NULL && direxists (dir)) + /* nothing */ ; + else + dir = NULL; + } + if (dir == NULL) + { + if (direxists (P_tmpdir)) + dir = P_tmpdir; + else if (strcmp (P_tmpdir, "/tmp") != 0 && direxists ("/tmp")) + dir = "/tmp"; + else + { + __set_errno (ENOENT); + return -1; + } + } + + dlen = strlen (dir); + while (dlen >= 1 && ISSLASH (dir[dlen - 1])) + dlen--; /* remove trailing slashes */ + + /* check we have room for "${dir}/${pfx}XXXXXX\0" */ + if (tmpl_len < dlen + 1 + plen + 6 + 1) + { + __set_errno (EINVAL); + return -1; + } + + sprintf (tmpl, "%.*s/%.*sXXXXXX", (int) dlen, dir, (int) plen, pfx); + return 0; +} diff -ruNp m4-1.4.7/lib/tmpdir.h m4-1.4.8/lib/tmpdir.h --- m4-1.4.7/lib/tmpdir.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/lib/tmpdir.h 2006-11-20 06:57:30.000000000 -0700 @@ -0,0 +1,27 @@ +/* Determine a temporary directory. + Copyright (C) 2001-2002 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. */ + +#include +#include + +/* Path search algorithm, for tmpnam, tmpfile, etc. If DIR is + non-null and exists, uses it; otherwise uses the first of $TMPDIR, + P_tmpdir, /tmp that exists. Copies into TMPL a template suitable + for use with mk[s]temp. Will fail (-1) if DIR is non-null and + doesn't exist, none of the searched dirs exists, or there's not + enough space in TMPL. */ +extern int path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx, bool try_tmpdir); diff -ruNp m4-1.4.7/lib/tmpfile-safer.c m4-1.4.8/lib/tmpfile-safer.c --- m4-1.4.7/lib/tmpfile-safer.c 2006-09-23 22:28:40.000000000 -0600 +++ m4-1.4.8/lib/tmpfile-safer.c 1969-12-31 17:00:00.000000000 -0700 @@ -1,74 +0,0 @@ -/* 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. */ - -#include - -#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.7/lib/vasnprintf.c m4-1.4.8/lib/vasnprintf.c --- m4-1.4.7/lib/vasnprintf.c 2006-09-23 22:28:40.000000000 -0600 +++ m4-1.4.8/lib/vasnprintf.c 2006-11-20 06:57:49.000000000 -0700 @@ -248,7 +248,7 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *l case TYPE_COUNT_LONGINT_POINTER: *a.arg[dp->arg_index].a.a_count_longint_pointer = length; break; -#ifdef HAVE_LONG_LONG +#ifdef HAVE_LONG_LONG_INT case TYPE_COUNT_LONGLONGINT_POINTER: *a.arg[dp->arg_index].a.a_count_longlongint_pointer = length; break; @@ -322,7 +322,7 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *l { case 'd': case 'i': case 'u': -# ifdef HAVE_LONG_LONG +# ifdef HAVE_LONG_LONG_INT if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT) tmp_length = (unsigned int) (sizeof (unsigned long long) * CHAR_BIT @@ -352,7 +352,7 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *l break; case 'o': -# ifdef HAVE_LONG_LONG +# ifdef HAVE_LONG_LONG_INT if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT) tmp_length = (unsigned int) (sizeof (unsigned long long) * CHAR_BIT @@ -380,7 +380,7 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *l break; case 'x': case 'X': -# ifdef HAVE_LONG_LONG +# ifdef HAVE_LONG_LONG_INT if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT) tmp_length = (unsigned int) (sizeof (unsigned long long) * CHAR_BIT @@ -527,7 +527,7 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *l switch (type) { -#ifdef HAVE_LONG_LONG +#ifdef HAVE_LONG_LONG_INT case TYPE_LONGLONGINT: case TYPE_ULONGLONGINT: *p++ = 'l'; @@ -681,7 +681,7 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *l SNPRINTF_BUF (arg); } break; -#ifdef HAVE_LONG_LONG +#ifdef HAVE_LONG_LONG_INT case TYPE_LONGLONGINT: { long long int arg = a.arg[dp->arg_index].a.a_longlongint; diff -ruNp m4-1.4.7/lib/verify.h m4-1.4.8/lib/verify.h --- m4-1.4.7/lib/verify.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/lib/verify.h 2006-11-20 06:57:30.000000000 -0700 @@ -0,0 +1,141 @@ +/* Compile-time assert-like macros. + + Copyright (C) 2005, 2006 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */ + +#ifndef VERIFY_H +# define VERIFY_H 1 + +/* Each of these macros verifies that its argument R is nonzero. To + be portable, R should be an integer constant expression. Unlike + assert (R), there is no run-time overhead. + + There are two macros, since no single macro can be used in all + contexts in C. verify_true (R) is for scalar contexts, including + integer constant expression contexts. verify (R) is for declaration + contexts, e.g., the top level. + + Symbols ending in "__" are private to this header. + + The code below uses several ideas. + + * The first step is ((R) ? 1 : -1). Given an expression R, of + integral or boolean or floating-point type, this yields an + expression of integral type, whose value is later verified to be + constant and nonnegative. + + * Next this expression W is wrapped in a type + struct verify_type__ { unsigned int verify_error_if_negative_size__: W; }. + If W is negative, this yields a compile-time error. No compiler can + deal with a bit-field of negative size. + + One might think that an array size check would have the same + effect, that is, that the type struct { unsigned int dummy[W]; } + would work as well. However, inside a function, some compilers + (such as C++ compilers and GNU C) allow local parameters and + variables inside array size expressions. With these compilers, + an array size check would not properly diagnose this misuse of + the verify macro: + + void function (int n) { verify (n < 0); } + + * For the verify macro, the struct verify_type__ will need to + somehow be embedded into a declaration. To be portable, this + declaration must declare an object, a constant, a function, or a + typedef name. If the declared entity uses the type directly, + such as in + + struct dummy {...}; + typedef struct {...} dummy; + extern struct {...} *dummy; + extern void dummy (struct {...} *); + extern struct {...} *dummy (void); + + two uses of the verify macro would yield colliding declarations + if the entity names are not disambiguated. A workaround is to + attach the current line number to the entity name: + + #define GL_CONCAT0(x, y) x##y + #define GL_CONCAT(x, y) GL_CONCAT0 (x, y) + extern struct {...} * GL_CONCAT(dummy,__LINE__); + + But this has the problem that two invocations of verify from + within the same macro would collide, since the __LINE__ value + would be the same for both invocations. + + A solution is to use the sizeof operator. It yields a number, + getting rid of the identity of the type. Declarations like + + extern int dummy [sizeof (struct {...})]; + extern void dummy (int [sizeof (struct {...})]); + extern int (*dummy (void)) [sizeof (struct {...})]; + + can be repeated. + + * Should the implementation use a named struct or an unnamed struct? + Which of the following alternatives can be used? + + extern int dummy [sizeof (struct {...})]; + extern int dummy [sizeof (struct verify_type__ {...})]; + extern void dummy (int [sizeof (struct {...})]); + extern void dummy (int [sizeof (struct verify_type__ {...})]); + extern int (*dummy (void)) [sizeof (struct {...})]; + extern int (*dummy (void)) [sizeof (struct verify_type__ {...})]; + + In the second and sixth case, the struct type is exported to the + outer scope; two such declarations therefore collide. GCC warns + about the first, third, and fourth cases. So the only remaining + possibility is the fifth case: + + extern int (*dummy (void)) [sizeof (struct {...})]; + + * This implementation exploits the fact that GCC does not warn about + the last declaration mentioned above. If a future version of GCC + introduces a warning for this, the problem could be worked around + by using code specialized to GCC, e.g.,: + + #if 4 <= __GNUC__ + # define verify(R) \ + extern int (* verify_function__ (void)) \ + [__builtin_constant_p (R) && (R) ? 1 : -1] + #endif + + * In C++, any struct definition inside sizeof is invalid. + Use a template type to work around the problem. */ + + +/* Verify requirement R at compile-time, as an integer constant expression. + Return 1. */ + +# ifdef __cplusplus +template + struct verify_type__ { unsigned int verify_error_if_negative_size__: w; }; +# define verify_true(R) \ + (!!sizeof (verify_type__<(R) ? 1 : -1>)) +# else +# define verify_true(R) \ + (!!sizeof \ + (struct { unsigned int verify_error_if_negative_size__: (R) ? 1 : -1; })) +# endif + +/* Verify requirement R at compile-time, as a declaration without a + trailing ';'. */ + +# define verify(R) extern int (* verify_function__ (void)) [verify_true (R)] + +#endif diff -ruNp m4-1.4.7/lib/verror.c m4-1.4.8/lib/verror.c --- m4-1.4.7/lib/verror.c 2006-09-23 22:28:41.000000000 -0600 +++ m4-1.4.8/lib/verror.c 2006-11-20 06:57:50.000000000 -0700 @@ -17,9 +17,7 @@ /* Written by Eric Blake. */ -#ifdef HAVE_CONFIG_H -# include -#endif +#include #include "verror.h" #include "xvasprintf.h" diff -ruNp m4-1.4.7/lib/wcwidth.h m4-1.4.8/lib/wcwidth.h --- m4-1.4.7/lib/wcwidth.h 2006-09-23 22:28:41.000000000 -0600 +++ m4-1.4.8/lib/wcwidth.h 2006-11-20 06:57:50.000000000 -0700 @@ -37,7 +37,11 @@ # endif # if !defined iswprint && !HAVE_ISWPRINT static inline int +# if HAVE_WINT_T iswprint (wint_t wc) +# else +iswprint (int wc) +# endif { return (wc >= 0 && wc < 128 ? wc >= ' ' && wc <= '~' diff -ruNp m4-1.4.7/lib/xalloc.h m4-1.4.8/lib/xalloc.h --- m4-1.4.7/lib/xalloc.h 2006-09-23 22:28:41.000000000 -0600 +++ m4-1.4.8/lib/xalloc.h 2006-11-20 07:23:12.000000000 -0700 @@ -1,7 +1,7 @@ /* xalloc.h -- malloc with out-of-memory checking Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2003, 2004 Free Software Foundation, Inc. + 1999, 2000, 2003, 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 @@ -46,13 +46,10 @@ extern "C" { extern void xalloc_die (void) ATTRIBUTE_NORETURN; void *xmalloc (size_t s); -void *xnmalloc (size_t n, size_t s); void *xzalloc (size_t s); void *xcalloc (size_t n, size_t s); void *xrealloc (void *p, size_t s); -void *xnrealloc (void *p, size_t n, size_t s); void *x2realloc (void *p, size_t *pn); -void *x2nrealloc (void *p, size_t *pn, size_t s); void *xmemdup (void const *p, size_t s); char *xstrdup (char const *str); @@ -71,8 +68,199 @@ char *xstrdup (char const *str); # define xalloc_oversized(n, s) \ ((size_t) (sizeof (ptrdiff_t) <= sizeof (size_t) ? -1 : -2) / (s) < (n)) + +/* In the following macros, T must be an elementary or structure/union or + typedef'ed type, or a pointer to such a type. To apply one of the + following macros to a function pointer or array type, you need to typedef + it first and use the typedef name. */ + +/* Allocate an object of type T dynamically, with error checking. */ +/* extern t *XMALLOC (typename t); */ +# define XMALLOC(t) ((t *) xmalloc (sizeof (t))) + +/* Allocate memory for N elements of type T, with error checking. */ +/* extern t *XNMALLOC (size_t n, typename t); */ +# define XNMALLOC(n, t) \ + ((t *) (sizeof (t) == 1 ? xmalloc (n) : xnmalloc (n, sizeof (t)))) + +/* Allocate an object of type T dynamically, with error checking, + and zero it. */ +/* extern t *XZALLOC (typename t); */ +# define XZALLOC(t) ((t *) xzalloc (sizeof (t))) + +/* Allocate memory for N elements of type T, with error checking, + and zero it. */ +/* extern t *XCALLOC (size_t n, typename t); */ +# define XCALLOC(n, t) \ + ((t *) (sizeof (t) == 1 ? xzalloc (n) : xcalloc (n, sizeof (t)))) + + +# if HAVE_INLINE +# define static_inline static inline +# else + void *xnmalloc (size_t n, size_t s); + void *xnrealloc (void *p, size_t n, size_t s); + void *x2nrealloc (void *p, size_t *pn, size_t s); + char *xcharalloc (size_t n); +# endif + +# ifdef static_inline + +/* Allocate an array of N objects, each with S bytes of memory, + dynamically, with error checking. S must be nonzero. */ + +static_inline void * +xnmalloc (size_t n, size_t s) +{ + if (xalloc_oversized (n, s)) + xalloc_die (); + return xmalloc (n * s); +} + +/* Change the size of an allocated block of memory P to an array of N + objects each of S bytes, with error checking. S must be nonzero. */ + +static_inline void * +xnrealloc (void *p, size_t n, size_t s) +{ + if (xalloc_oversized (n, s)) + xalloc_die (); + return xrealloc (p, n * s); +} + +/* If P is null, allocate a block of at least *PN such objects; + otherwise, reallocate P so that it contains more than *PN objects + each of S bytes. *PN must be nonzero unless P is null, and S must + be nonzero. Set *PN to the new number of objects, and return the + pointer to the new block. *PN is never set to zero, and the + returned pointer is never null. + + Repeated reallocations are guaranteed to make progress, either by + allocating an initial block with a nonzero size, or by allocating a + larger block. + + In the following implementation, nonzero sizes are doubled so that + repeated reallocations have O(N log N) overall cost rather than + O(N**2) cost, but the specification for this function does not + guarantee that sizes are doubled. + + Here is an example of use: + + int *p = NULL; + size_t used = 0; + size_t allocated = 0; + + void + append_int (int value) + { + if (used == allocated) + p = x2nrealloc (p, &allocated, sizeof *p); + p[used++] = value; + } + + This causes x2nrealloc to allocate a block of some nonzero size the + first time it is called. + + To have finer-grained control over the initial size, set *PN to a + nonzero value before calling this function with P == NULL. For + example: + + int *p = NULL; + size_t used = 0; + size_t allocated = 0; + size_t allocated1 = 1000; + + void + append_int (int value) + { + if (used == allocated) + { + p = x2nrealloc (p, &allocated1, sizeof *p); + allocated = allocated1; + } + p[used++] = value; + } + + */ + +static_inline void * +x2nrealloc (void *p, size_t *pn, size_t s) +{ + size_t n = *pn; + + if (! p) + { + if (! n) + { + /* The approximate size to use for initial small allocation + requests, when the invoking code specifies an old size of + zero. 64 bytes is the largest "small" request for the + GNU C library malloc. */ + enum { DEFAULT_MXFAST = 64 }; + + n = DEFAULT_MXFAST / s; + n += !n; + } + } + else + { + if (((size_t) -1) / 2 / s < n) + xalloc_die (); + n *= 2; + } + + *pn = n; + return xrealloc (p, n * s); +} + +/* Return a pointer to a new buffer of N bytes. This is like xmalloc, + except it returns char *. */ + +static_inline char * +xcharalloc (size_t n) +{ + return XNMALLOC (n, char); +} + +# endif + # ifdef __cplusplus } + +/* C++ does not allow conversions from void * to other pointer types + without a cast. Use templates to work around the problem when + possible. */ + +template inline T * +xrealloc (T *p, size_t s) +{ + return (T *) xrealloc ((void *) p, s); +} + +template inline T * +xnrealloc (T *p, size_t n, size_t s) +{ + return (T *) xnrealloc ((void *) p, n, s); +} + +template inline T * +x2realloc (T *p, size_t *pn) +{ + return (T *) x2realloc ((void *) p, pn); +} + +template inline T * +x2nrealloc (T *p, size_t *pn, size_t s) +{ + return (T *) x2nrealloc ((void *) p, pn, s); +} + +template inline T * +xmemdup (T const *p, size_t s) +{ + return (T *) xmemdup ((void const *) p, s); +} + # endif diff -ruNp m4-1.4.7/lib/xallocsa.c m4-1.4.8/lib/xallocsa.c --- m4-1.4.7/lib/xallocsa.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/lib/xallocsa.c 2006-11-20 06:57:30.000000000 -0700 @@ -0,0 +1,35 @@ +/* Safe automatic memory allocation with out of memory checking. + Copyright (C) 2003, 2006 Free Software Foundation, Inc. + Written by Bruno Haible , 2003. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include + +/* Specification. */ +#include "xallocsa.h" + +#include "xalloc.h" + +void * +xmallocsa (size_t n) +{ + void *p; + + p = mallocsa (n); + if (p == NULL) + xalloc_die (); + return p; +} diff -ruNp m4-1.4.7/lib/xallocsa.h m4-1.4.8/lib/xallocsa.h --- m4-1.4.7/lib/xallocsa.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/lib/xallocsa.h 2006-11-20 06:57:30.000000000 -0700 @@ -0,0 +1,54 @@ +/* Safe automatic memory allocation with out of memory checking. + Copyright (C) 2003, 2005 Free Software Foundation, Inc. + Written by Bruno Haible , 2003. + + This program is free software; you can 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 _XALLOCSA_H +#define _XALLOCSA_H + +#include "allocsa.h" + + +#ifdef __cplusplus +extern "C" { +#endif + + +/* xallocsa(N) is a checking safe variant of alloca(N). It allocates N bytes + of memory allocated on the stack, that must be freed using freesa() before + the function returns. Upon failure, it exits with an error message. */ +#if HAVE_ALLOCA +# define xallocsa(N) \ + ((N) < 4032 - sa_increment \ + ? (void *) ((char *) alloca ((N) + sa_increment) + sa_increment) \ + : xmallocsa (N)) +extern void * xmallocsa (size_t n); +#else +# define xallocsa(N) \ + xmalloc (N) +#endif + +/* Maybe we should also define a variant + xnallocsa (size_t n, size_t s) - behaves like xallocsa (n * s) + If this would be useful in your application. please speak up. */ + + +#ifdef __cplusplus +} +#endif + + +#endif /* _XALLOCSA_H */ diff -ruNp m4-1.4.7/lib/xasprintf.c m4-1.4.8/lib/xasprintf.c --- m4-1.4.7/lib/xasprintf.c 2006-09-23 22:28:41.000000000 -0600 +++ m4-1.4.8/lib/xasprintf.c 2006-11-20 06:57:51.000000000 -0700 @@ -1,5 +1,5 @@ /* vasprintf and asprintf with out-of-memory checking. - Copyright (C) 1999, 2002-2004 Free Software Foundation, Inc. + Copyright (C) 1999, 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 @@ -15,9 +15,7 @@ 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 /* Specification. */ #include "xvasprintf.h" diff -ruNp m4-1.4.7/lib/xmalloc.c m4-1.4.8/lib/xmalloc.c --- m4-1.4.7/lib/xmalloc.c 2006-09-23 22:28:41.000000000 -0600 +++ m4-1.4.8/lib/xmalloc.c 2006-11-20 07:23:12.000000000 -0700 @@ -20,7 +20,11 @@ #include +#if ! HAVE_INLINE +# define static_inline +#endif #include "xalloc.h" +#undef static_inline #include #include @@ -38,148 +42,27 @@ enum { HAVE_GNU_CALLOC = 1 }; enum { HAVE_GNU_CALLOC = 0 }; #endif -/* Allocate an array of N objects, each with S bytes of memory, - dynamically, with error checking. S must be nonzero. */ - -static inline void * -xnmalloc_inline (size_t n, size_t s) -{ - void *p; - if (xalloc_oversized (n, s) || (! (p = malloc (n * s)) && n != 0)) - xalloc_die (); - return p; -} - -void * -xnmalloc (size_t n, size_t s) -{ - return xnmalloc_inline (n, s); -} - /* Allocate N bytes of memory dynamically, with error checking. */ void * xmalloc (size_t n) { - return xnmalloc_inline (n, 1); -} - -/* Change the size of an allocated block of memory P to an array of N - objects each of S bytes, with error checking. S must be nonzero. */ - -static inline void * -xnrealloc_inline (void *p, size_t n, size_t s) -{ - if (xalloc_oversized (n, s) || (! (p = realloc (p, n * s)) && n != 0)) + void *p = malloc (n); + if (!p && n != 0) xalloc_die (); return p; } -void * -xnrealloc (void *p, size_t n, size_t s) -{ - return xnrealloc_inline (p, n, s); -} - /* Change the size of an allocated block of memory P to N bytes, with error checking. */ void * xrealloc (void *p, size_t n) { - return xnrealloc_inline (p, n, 1); -} - - -/* If P is null, allocate a block of at least *PN such objects; - otherwise, reallocate P so that it contains more than *PN objects - each of S bytes. *PN must be nonzero unless P is null, and S must - be nonzero. Set *PN to the new number of objects, and return the - pointer to the new block. *PN is never set to zero, and the - returned pointer is never null. - - Repeated reallocations are guaranteed to make progress, either by - allocating an initial block with a nonzero size, or by allocating a - larger block. - - In the following implementation, nonzero sizes are doubled so that - repeated reallocations have O(N log N) overall cost rather than - O(N**2) cost, but the specification for this function does not - guarantee that sizes are doubled. - - Here is an example of use: - - int *p = NULL; - size_t used = 0; - size_t allocated = 0; - - void - append_int (int value) - { - if (used == allocated) - p = x2nrealloc (p, &allocated, sizeof *p); - p[used++] = value; - } - - This causes x2nrealloc to allocate a block of some nonzero size the - first time it is called. - - To have finer-grained control over the initial size, set *PN to a - nonzero value before calling this function with P == NULL. For - example: - - int *p = NULL; - size_t used = 0; - size_t allocated = 0; - size_t allocated1 = 1000; - - void - append_int (int value) - { - if (used == allocated) - { - p = x2nrealloc (p, &allocated1, sizeof *p); - allocated = allocated1; - } - p[used++] = value; - } - - */ - -static inline void * -x2nrealloc_inline (void *p, size_t *pn, size_t s) -{ - size_t n = *pn; - - if (! p) - { - if (! n) - { - /* The approximate size to use for initial small allocation - requests, when the invoking code specifies an old size of - zero. 64 bytes is the largest "small" request for the - GNU C library malloc. */ - enum { DEFAULT_MXFAST = 64 }; - - n = DEFAULT_MXFAST / s; - n += !n; - } - } - else - { - if (SIZE_MAX / 2 / s < n) - xalloc_die (); - n *= 2; - } - - *pn = n; - return xrealloc (p, n * s); -} - -void * -x2nrealloc (void *p, size_t *pn, size_t s) -{ - return x2nrealloc_inline (p, pn, s); + p = realloc (p, n); + if (!p && n != 0) + xalloc_die (); + return p; } /* If P is null, allocate a block of at least *PN bytes; otherwise, @@ -191,7 +74,7 @@ x2nrealloc (void *p, size_t *pn, size_t void * x2realloc (void *p, size_t *pn) { - return x2nrealloc_inline (p, pn, 1); + return x2nrealloc (p, pn, 1); } /* Allocate S bytes of zeroed memory dynamically, with error checking. diff -ruNp m4-1.4.7/lib/xvasprintf.c m4-1.4.8/lib/xvasprintf.c --- m4-1.4.7/lib/xvasprintf.c 2006-09-23 22:28:42.000000000 -0600 +++ m4-1.4.8/lib/xvasprintf.c 2006-11-20 07:23:13.000000000 -0700 @@ -15,9 +15,7 @@ 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 /* Specification. */ #include "xvasprintf.h" @@ -66,7 +64,7 @@ xstrcat (size_t argcount, va_list args) } /* Allocate and fill the result string. */ - result = (char *) xmalloc (totalsize + 1); + result = XNMALLOC (totalsize + 1, char); p = result; for (i = argcount; i > 0; i--) { diff -ruNp m4-1.4.7/m4/alloca.m4 m4-1.4.8/m4/alloca.m4 --- m4-1.4.7/m4/alloca.m4 2006-09-23 22:28:42.000000000 -0600 +++ m4-1.4.8/m4/alloca.m4 2006-11-20 07:23:13.000000000 -0700 @@ -1,5 +1,5 @@ -# alloca.m4 serial 5 -dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. +# alloca.m4 serial 7 +dnl Copyright (C) 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. @@ -17,16 +17,24 @@ AC_DEFUN([gl_FUNC_ALLOCA], # Define an additional variable used in the Makefile substitution. if test $ac_cv_working_alloca_h = yes; then - AC_EGREP_CPP([Need own alloca], [ + AC_CACHE_CHECK([for alloca as a compiler built-in], [gl_cv_rpl_alloca], [ + AC_EGREP_CPP([Need own alloca], [ #if defined __GNUC__ || defined _AIX || defined _MSC_VER - Need own alloca + Need own alloca #endif - ], - [AC_DEFINE(HAVE_ALLOCA, 1, - [Define to 1 if you have `alloca' after including , - a header that may be supplied by this distribution.]) - ALLOCA_H=alloca.h], - [ALLOCA_H=]) + ], [gl_cv_rpl_alloca=yes], [gl_cv_rpl_alloca=no]) + ]) + if test $gl_cv_rpl_alloca = yes; then + dnl OK, alloca can be implemented through a compiler built-in. + AC_DEFINE([HAVE_ALLOCA], 1, + [Define to 1 if you have 'alloca' after including , + a header that may be supplied by this distribution.]) + ALLOCA_H=alloca.h + else + dnl alloca exists as a library function, i.e. it is slow and probably + dnl a memory leak. Don't define HAVE_ALLOCA in this case. + ALLOCA_H= + fi else ALLOCA_H=alloca.h fi diff -ruNp m4-1.4.7/m4/allocsa.m4 m4-1.4.8/m4/allocsa.m4 --- m4-1.4.7/m4/allocsa.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/m4/allocsa.m4 2006-11-20 07:23:13.000000000 -0700 @@ -0,0 +1,15 @@ +# allocsa.m4 serial 6 +dnl Copyright (C) 2003-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. + +AC_DEFUN([gl_ALLOCSA], +[ + dnl Use the autoconf tests for alloca(), but not the AC_SUBSTed variables + dnl @ALLOCA@ and @LTALLOCA@. + dnl gl_FUNC_ALLOCA dnl Already brought in by the module dependencies. + AC_REQUIRE([gl_EEMALLOC]) + AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) + AC_REQUIRE([gt_TYPE_LONGDOUBLE]) +]) diff -ruNp m4-1.4.7/m4/close-stream.m4 m4-1.4.8/m4/close-stream.m4 --- m4-1.4.7/m4/close-stream.m4 2006-09-23 22:28:42.000000000 -0600 +++ m4-1.4.8/m4/close-stream.m4 2006-11-20 06:57:53.000000000 -0700 @@ -1,3 +1,4 @@ +#serial 2 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, @@ -6,6 +7,8 @@ dnl with or without modifications, as lo AC_DEFUN([gl_CLOSE_STREAM], [ AC_LIBOBJ([close-stream]) + AC_DEFINE([GNULIB_CLOSE_STREAM], [1], + [Define to 1 when using the gnulib close-stream module.]) dnl Prerequisites of lib/close-stream.c. : diff -ruNp m4-1.4.7/m4/closeout.m4 m4-1.4.8/m4/closeout.m4 --- m4-1.4.7/m4/closeout.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/m4/closeout.m4 2006-11-20 06:57:31.000000000 -0700 @@ -0,0 +1,13 @@ +# closeout.m4 serial 5 +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_CLOSEOUT], +[ + AC_LIBOBJ([closeout]) + + dnl Prerequisites of lib/closeout.c. + : +]) diff -ruNp m4-1.4.7/m4/codeset.m4 m4-1.4.8/m4/codeset.m4 --- m4-1.4.7/m4/codeset.m4 2006-09-23 22:28:42.000000000 -0600 +++ m4-1.4.8/m4/codeset.m4 2006-11-20 06:57:53.000000000 -0700 @@ -1,4 +1,4 @@ -# codeset.m4 serial 2 (gettext-0.15.1) +# codeset.m4 serial 2 (gettext-0.16) dnl Copyright (C) 2000-2002, 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, diff -ruNp m4-1.4.7/m4/config-h.m4 m4-1.4.8/m4/config-h.m4 --- m4-1.4.7/m4/config-h.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/m4/config-h.m4 2006-11-20 06:57:31.000000000 -0700 @@ -0,0 +1,13 @@ +# Say that -DHAVE_CONFIG_H is not needed. + +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. + +dnl Written by Paul Eggert. + +# This package's source files all include config.h unconditionally, +# so there's no need to pass -DHAVE_CONFIG_H to the compiler. +AC_DEFUN([gl_CONFIG_H], + [AC_CONFIG_COMMANDS_PRE([test "X$DEFS" = X-DHAVE_CONFIG_H && DEFS=])]) diff -ruNp m4-1.4.7/m4/eealloc.m4 m4-1.4.8/m4/eealloc.m4 --- m4-1.4.7/m4/eealloc.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/m4/eealloc.m4 2006-11-20 06:57:31.000000000 -0700 @@ -0,0 +1,32 @@ +# eealloc.m4 serial 1 +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. + +AC_DEFUN([gl_EEALLOC], +[ + AC_REQUIRE([gl_EEMALLOC]) + AC_REQUIRE([gl_EEREALLOC]) + AC_REQUIRE([AC_C_INLINE]) +]) + +AC_DEFUN([gl_EEMALLOC], +[ + _AC_FUNC_MALLOC_IF( + [gl_cv_func_malloc_0_nonnull=1], + [gl_cv_func_malloc_0_nonnull=0]) + AC_DEFINE_UNQUOTED([MALLOC_0_IS_NONNULL], $gl_cv_func_malloc_0_nonnull, + [If malloc(0) is != NULL, define this to 1. Otherwise define this + to 0.]) +]) + +AC_DEFUN([gl_EEREALLOC], +[ + _AC_FUNC_REALLOC_IF( + [gl_cv_func_realloc_0_nonnull=1], + [gl_cv_func_realloc_0_nonnull=0]) + AC_DEFINE_UNQUOTED([REALLOC_0_IS_NONNULL], $gl_cv_func_realloc_0_nonnull, + [If realloc(NULL,0) is != NULL, define this to 1. Otherwise define this + to 0.]) +]) diff -ruNp m4-1.4.7/m4/extensions.m4 m4-1.4.8/m4/extensions.m4 --- m4-1.4.7/m4/extensions.m4 2006-09-23 22:28:43.000000000 -0600 +++ m4-1.4.8/m4/extensions.m4 2006-11-20 06:57:54.000000000 -0700 @@ -1,3 +1,4 @@ +# serial 4 -*- Autoconf -*- # Enable extensions on systems that normally disable them. # Copyright (C) 2003, 2006 Free Software Foundation, Inc. @@ -5,14 +6,18 @@ # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# This file is only needed in autoconf <= 2.59. Newer versions of autoconf -# have a macro AC_USE_SYSTEM_EXTENSIONS with identical semantics. +# This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from CVS +# Autoconf. Perhaps we can remove this once we can assume Autoconf +# 2.61 or later everywhere, but since CVS Autoconf mutates rapidly +# enough in this area it's likely we'll need to redefine +# AC_USE_SYSTEM_EXTENSIONS for quite some time. -# gl_USE_SYSTEM_EXTENSIONS +# AC_USE_SYSTEM_EXTENSIONS # ------------------------ # Enable extensions on systems that normally disable them, # typically due to standards-conformance issues. -AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS], [ +AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS], +[ AC_BEFORE([$0], [AC_COMPILE_IFELSE]) AC_BEFORE([$0], [AC_RUN_IFELSE]) @@ -27,16 +32,27 @@ AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS], [ #endif #ifndef _POSIX_PTHREAD_SEMANTICS # undef _POSIX_PTHREAD_SEMANTICS +#endif +#ifndef _TANDEM_SOURCE +# undef _TANDEM_SOURCE #endif]) AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__], [ac_cv_safe_to_define___extensions__], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([ - #define __EXTENSIONS__ 1 +# define __EXTENSIONS__ 1 AC_INCLUDES_DEFAULT])], [ac_cv_safe_to_define___extensions__=yes], [ac_cv_safe_to_define___extensions__=no])]) test $ac_cv_safe_to_define___extensions__ = yes && AC_DEFINE([__EXTENSIONS__]) AC_DEFINE([_POSIX_PTHREAD_SEMANTICS]) + AC_DEFINE([_TANDEM_SOURCE]) ]) + +# gl_USE_SYSTEM_EXTENSIONS +# ------------------------ +# Enable extensions on systems that normally disable them, +# typically due to standards-conformance issues. +AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS], + [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])]) diff -ruNp m4-1.4.7/m4/fatal-signal.m4 m4-1.4.8/m4/fatal-signal.m4 --- m4-1.4.7/m4/fatal-signal.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/m4/fatal-signal.m4 2006-11-20 06:57:31.000000000 -0700 @@ -0,0 +1,13 @@ +# fatal-signal.m4 serial 4 +dnl Copyright (C) 2003-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. + +AC_DEFUN([gl_FATAL_SIGNAL], +[ + AC_REQUIRE([gt_TYPE_SIG_ATOMIC_T]) + AC_CHECK_HEADERS_ONCE(unistd.h) + AC_CHECK_FUNCS_ONCE(raise) + AC_CHECK_FUNCS(sigaction) +]) diff -ruNp m4-1.4.7/m4/fpending.m4 m4-1.4.8/m4/fpending.m4 --- m4-1.4.7/m4/fpending.m4 2006-09-23 22:28:43.000000000 -0600 +++ m4-1.4.8/m4/fpending.m4 2006-11-20 06:57:54.000000000 -0700 @@ -1,4 +1,4 @@ -#serial 9 +#serial 10 # Copyright (C) 2000, 2001, 2004, 2005, 2006 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation @@ -15,7 +15,7 @@ dnl we have to grub around in the FILE s AC_DEFUN([gl_FUNC_FPENDING], [ - AC_CHECK_HEADERS(stdio_ext.h) + AC_CHECK_HEADERS_ONCE(stdio_ext.h) AC_REPLACE_FUNCS([__fpending]) fp_headers=' # include diff -ruNp m4-1.4.7/m4/gl_list.m4 m4-1.4.8/m4/gl_list.m4 --- m4-1.4.7/m4/gl_list.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/m4/gl_list.m4 2006-11-20 07:23:16.000000000 -0700 @@ -0,0 +1,10 @@ +# gl_list.m4 serial 2 +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_LIST], +[ + AC_REQUIRE([gl_INLINE]) +]) diff -ruNp m4-1.4.7/m4/gnulib-cache.m4 m4-1.4.8/m4/gnulib-cache.m4 --- m4-1.4.7/m4/gnulib-cache.m4 2006-09-07 16:48:15.000000000 -0600 +++ m4-1.4.8/m4/gnulib-cache.m4 2006-11-20 06:55:46.000000000 -0700 @@ -15,11 +15,11 @@ # 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=. --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 +# gnulib-tool --import --dir=. --lib=libm4 --source-base=lib --m4-base=m4 --doc-base=doc --aux-dir=. --no-libtool --macro-prefix=M4 avltree-oset binary-io clean-temp cloexec close-stream closeout config-h error fdl fopen-safer free gendocs getopt gnupload mkstemp obstack regex stdbool stdlib-safer strstr strtol unlocked-io verror xalloc xvasprintf # Specification in the form of a few gnulib-tool.m4 macro invocations: gl_LOCAL_DIR([]) -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_MODULES([avltree-oset binary-io clean-temp cloexec close-stream closeout config-h error fdl fopen-safer free gendocs getopt gnupload mkstemp obstack regex stdbool stdlib-safer strstr strtol unlocked-io verror xalloc xvasprintf]) gl_AVOID([]) gl_SOURCE_BASE([lib]) gl_M4_BASE([m4]) diff -ruNp m4-1.4.7/m4/gnulib-comp.m4 m4-1.4.8/m4/gnulib-comp.m4 --- m4-1.4.7/m4/gnulib-comp.m4 2006-09-23 22:29:02.000000000 -0600 +++ m4-1.4.8/m4/gnulib-comp.m4 2006-11-20 07:24:26.000000000 -0700 @@ -1,3 +1,4 @@ +# DO NOT EDIT! GENERATED AUTOMATICALLY! # Copyright (C) 2004-2006 Free Software Foundation, Inc. # # This file is free software, distributed under the terms of the GNU @@ -21,6 +22,8 @@ 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 + m4_pattern_allow([^gl_LIBOBJS$])dnl a variable + m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable AC_REQUIRE([AC_PROG_RANLIB]) AC_REQUIRE([AC_GNU_SOURCE]) AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) @@ -30,40 +33,56 @@ AC_DEFUN([M4_EARLY], # "Check for header files, types and library functions". AC_DEFUN([M4_INIT], [ + m4_pushdef([AC_LIBOBJ], m4_defn([M4_LIBOBJ])) + m4_pushdef([AC_REPLACE_FUNCS], m4_defn([M4_REPLACE_FUNCS])) + m4_pushdef([AC_LIBSOURCES], m4_defn([M4_LIBSOURCES])) AM_CONDITIONAL([GL_COND_LIBTOOL], [false]) gl_cond_libtool=false gl_libdeps= gl_ltlibdeps= gl_source_base='lib' gl_FUNC_ALLOCA + gl_ALLOCSA + AC_DEFINE([SIGNAL_SAFE_LIST], [1], [Define if lists must be signal-safe.]) gl_CLOEXEC gl_CLOSE_STREAM + gl_CLOSEOUT + gl_CONFIG_H gl_ERROR gl_EXITFAIL dnl gl_USE_SYSTEM_EXTENSIONS must be added quite early to configure.ac. + gl_FATAL_SIGNAL gl_FOPEN_SAFER gl_FUNC_FPENDING gl_FUNC_FREE gl_GETOPT + gl_INLINE + gl_LIST AC_FUNC_MALLOC gl_MBCHAR gl_MBITER gl_FUNC_MEMCHR + gt_FUNC_MKDTEMP gl_FUNC_MKSTEMP AC_FUNC_OBSTACK dnl Note: AC_FUNC_OBSTACK does AC_LIBSOURCES([obstack.h, obstack.c]). + gl_LIST + gl_PATHMAX + gl_QUOTEARG gl_REGEX + gl_SIGNALBLOCKING 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_STRSTR gl_FUNC_STRTOL gl_HEADER_SYS_STAT_H - gl_TMPFILE_SAFER + gl_FUNC_GEN_TEMPNAME + gt_TMPDIR gl_HEADER_UNISTD gl_UNISTD_SAFER gl_FUNC_GLIBC_UNLOCKED_IO @@ -77,8 +96,40 @@ AC_DEFUN([M4_INIT], AC_SUBST([LIBM4_LIBDEPS]) LIBM4_LTLIBDEPS="$gl_ltlibdeps" AC_SUBST([LIBM4_LTLIBDEPS]) + m4_popdef([AC_LIBSOURCES]) + m4_popdef([AC_REPLACE_FUNCS]) + m4_popdef([AC_LIBOBJ]) + AC_CONFIG_COMMANDS_PRE([ + M4_libobjs= + M4_ltlibobjs= + if test -n "$M4_LIBOBJS"; then + # Remove the extension. + sed_drop_objext='s/\.o$//;s/\.obj$//' + for i in `for i in $M4_LIBOBJS; do echo "$i"; done | sed "$sed_drop_objext" | sort | uniq`; do + M4_libobjs="$M4_libobjs $i.$ac_objext" + M4_ltlibobjs="$M4_ltlibobjs $i.lo" + done + fi + AC_SUBST([M4_LIBOBJS], [$M4_libobjs]) + AC_SUBST([M4_LTLIBOBJS], [$M4_ltlibobjs]) + ]) ]) +# Like AC_LIBOBJ, except that the module name goes +# into M4_LIBOBJS instead of into LIBOBJS. +AC_DEFUN([M4_LIBOBJ], + [M4_LIBOBJS="$M4_LIBOBJS $1.$ac_objext"]) + +# Like AC_REPLACE_FUNCS, except that the module name goes +# into M4_LIBOBJS instead of into LIBOBJS. +AC_DEFUN([M4_REPLACE_FUNCS], + [AC_CHECK_FUNCS([$1], , [M4_LIBOBJ($ac_func)])]) + +# Like AC_LIBSOURCES, except that it does nothing. +# We rely on EXTRA_lib..._SOURCES instead. +AC_DEFUN([M4_LIBSOURCES], + []) + # This macro records the list of files which have been installed by # gnulib-tool and may be removed by future gnulib-tool invocations. AC_DEFUN([M4_FILE_LIST], [ @@ -90,19 +141,28 @@ AC_DEFUN([M4_FILE_LIST], [ lib/__fpending.h lib/alloca.c lib/alloca_.h + lib/allocsa.c + lib/allocsa.h + lib/allocsa.valgrind lib/asnprintf.c lib/asprintf.c lib/binary-io.h + lib/clean-temp.c + lib/clean-temp.h lib/cloexec.c lib/cloexec.h lib/close-stream.c lib/close-stream.h + lib/closeout.c + lib/closeout.h lib/dup-safer.c lib/error.c lib/error.h lib/exit.h lib/exitfail.c lib/exitfail.h + lib/fatal-signal.c + lib/fatal-signal.h lib/fd-safer.c lib/fopen-safer.c lib/free.c @@ -111,29 +171,48 @@ AC_DEFUN([M4_FILE_LIST], [ lib/getopt_.h lib/getopt_int.h lib/gettext.h + lib/gl_anyhash_list1.h + lib/gl_anyhash_list2.h + lib/gl_anylinked_list1.h + lib/gl_anylinked_list2.h + lib/gl_anytree_oset.h + lib/gl_avltree_oset.c + lib/gl_avltree_oset.h + lib/gl_linkedhash_list.c + lib/gl_linkedhash_list.h + lib/gl_list.c + lib/gl_list.h + lib/gl_oset.c + lib/gl_oset.h lib/malloc.c lib/mbchar.c lib/mbchar.h lib/mbuiter.h lib/memchr.c + lib/mkdtemp.c + lib/mkdtemp.h lib/mkstemp-safer.c lib/mkstemp.c lib/mkstemp.h lib/obstack.c lib/obstack.h + lib/pathmax.h lib/pipe-safer.c lib/printf-args.c lib/printf-args.h lib/printf-parse.c lib/printf-parse.h + lib/quotearg.c + lib/quotearg.h lib/regcomp.c lib/regex.c lib/regex.h lib/regex_internal.c lib/regex_internal.h lib/regexec.c + lib/sigprocmask.c + lib/sigprocmask.h lib/size_max.h - lib/stat-macros.h lib/stat_.h lib/stdbool_.h lib/stdint_.h @@ -146,9 +225,13 @@ AC_DEFUN([M4_FILE_LIST], [ lib/strncasecmp.c lib/strnlen1.c lib/strnlen1.h + lib/strstr.c + lib/strstr.h lib/strtol.c lib/tempname.c - lib/tmpfile-safer.c + lib/tempname.h + lib/tmpdir.c + lib/tmpdir.h lib/unistd--.h lib/unistd-safer.h lib/unlocked-io.h @@ -156,11 +239,14 @@ AC_DEFUN([M4_FILE_LIST], [ lib/vasnprintf.h lib/vasprintf.c lib/vasprintf.h + lib/verify.h lib/verror.c lib/verror.h lib/wcwidth.h lib/xalloc-die.c lib/xalloc.h + lib/xallocsa.c + lib/xallocsa.h lib/xasprintf.c lib/xmalloc.c lib/xsize.h @@ -168,16 +254,23 @@ AC_DEFUN([M4_FILE_LIST], [ lib/xvasprintf.h m4/absolute-header.m4 m4/alloca.m4 + m4/allocsa.m4 m4/cloexec.m4 m4/close-stream.m4 + m4/closeout.m4 m4/codeset.m4 + m4/config-h.m4 + m4/eealloc.m4 m4/eoverflow.m4 m4/error.m4 m4/exitfail.m4 m4/extensions.m4 + m4/fatal-signal.m4 m4/fpending.m4 m4/free.m4 m4/getopt.m4 + m4/gl_list.m4 + m4/inline.m4 m4/intmax_t.m4 m4/inttypes_h.m4 m4/longdouble.m4 @@ -185,13 +278,17 @@ AC_DEFUN([M4_FILE_LIST], [ m4/mbchar.m4 m4/mbiter.m4 m4/mbrtowc.m4 + m4/mbstate_t.m4 m4/memchr.m4 + m4/mkdtemp.m4 m4/mkstemp.m4 + m4/pathmax.m4 + m4/quotearg.m4 m4/regex.m4 - m4/signed.m4 + m4/sig_atomic_t.m4 + m4/signalblocking.m4 m4/size_max.m4 m4/ssize_t.m4 - m4/stat-macros.m4 m4/stdarg.m4 m4/stdbool.m4 m4/stdint.m4 @@ -199,8 +296,12 @@ AC_DEFUN([M4_FILE_LIST], [ m4/stdio-safer.m4 m4/stdlib-safer.m4 m4/strcase.m4 + m4/strstr.m4 m4/strtol.m4 m4/sys_stat_h.m4 + m4/tempname.m4 + m4/tmpdir.m4 + m4/ulonglong.m4 m4/unistd-safer.m4 m4/unistd_h.m4 m4/unlocked-io.m4 diff -ruNp m4-1.4.7/m4/inline.m4 m4-1.4.8/m4/inline.m4 --- m4-1.4.7/m4/inline.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/m4/inline.m4 2006-11-20 07:22:50.000000000 -0700 @@ -0,0 +1,40 @@ +# inline.m4 serial 3 +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. + +dnl Test for the 'inline' keyword or equivalent. +dnl Define 'inline' to a supported equivalent, or to nothing if not supported, +dnl like AC_C_INLINE does. Also, define HAVE_INLINE if 'inline' or an +dnl equivalent is effectively supported, i.e. if the compiler is likely to +dnl drop unused 'static inline' functions. +AC_DEFUN([gl_INLINE], +[ + AC_REQUIRE([AC_C_INLINE]) + AC_CACHE_CHECK([whether the compiler generally respects inline], + [gl_cv_c_inline_effective], + [if test $ac_cv_c_inline = no; then + gl_cv_c_inline_effective=no + else + dnl GCC defines __NO_INLINE__ if not optimizing or if -fno-inline is + dnl specified. + dnl Use AC_COMPILE_IFELSE here, not AC_EGREP_CPP, because the result + dnl depends on optimization flags, which can be in CFLAGS. + dnl (AC_EGREP_CPP looks only at the CPPFLAGS.) + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[]], + [[#ifdef __NO_INLINE__ + #error "inline is not effective" + #endif]])], + [gl_cv_c_inline_effective=yes], + [gl_cv_c_inline_effective=no]) + fi + ]) + if test $gl_cv_c_inline_effective = yes; then + AC_DEFINE([HAVE_INLINE], 1, + [Define to 1 if the compiler supports one of the keywords + 'inline', '__inline__', '__inline' and effectively inlines + functions marked as such.]) + fi +]) diff -ruNp m4-1.4.7/m4/longlong.m4 m4-1.4.8/m4/longlong.m4 --- m4-1.4.7/m4/longlong.m4 2006-09-23 22:28:43.000000000 -0600 +++ m4-1.4.8/m4/longlong.m4 2006-11-20 07:23:16.000000000 -0700 @@ -1,4 +1,4 @@ -# longlong.m4 serial 7 +# longlong.m4 serial 10 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, @@ -10,6 +10,10 @@ dnl From Paul Eggert. # This fixes a bug in Autoconf 2.60, but can be removed once we # assume 2.61 everywhere. +# Note: If the type 'long long int' exists but is only 32 bits large +# (as on some very old compilers), HAVE_LONG_LONG_INT will not be +# defined. In this case you can treat 'long long int' like 'long int'. + AC_DEFUN([AC_TYPE_LONG_LONG_INT], [ AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int], @@ -24,7 +28,31 @@ AC_DEFUN([AC_TYPE_LONG_LONG_INT], [[long long int llmax = 9223372036854775807ll; return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i) | (llmax / ll) | (llmax % ll));]])], - [ac_cv_type_long_long_int=yes], + [dnl This catches a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004. + dnl If cross compiling, assume the bug isn't important, since + dnl nobody cross compiles for this platform as far as we know. + AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[@%:@include + @%:@ifndef LLONG_MAX + @%:@ define HALF \ + (1LL << (sizeof (long long int) * CHAR_BIT - 2)) + @%:@ define LLONG_MAX (HALF - 1 + HALF) + @%:@endif]], + [[long long int n = 1; + int i; + for (i = 0; ; i++) + { + long long int m = n << i; + if (m >> i != n) + return 1; + if (LLONG_MAX / 2 < m) + break; + } + return 0;]])], + [ac_cv_type_long_long_int=yes], + [ac_cv_type_long_long_int=no], + [ac_cv_type_long_long_int=yes])], [ac_cv_type_long_long_int=no])]) if test $ac_cv_type_long_long_int = yes; then AC_DEFINE([HAVE_LONG_LONG_INT], 1, diff -ruNp m4-1.4.7/m4/mbstate_t.m4 m4-1.4.8/m4/mbstate_t.m4 --- m4-1.4.7/m4/mbstate_t.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/m4/mbstate_t.m4 2006-11-20 06:57:31.000000000 -0700 @@ -0,0 +1,30 @@ +# mbstate_t.m4 serial 9 +dnl Copyright (C) 2000, 2001, 2002 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. + +# From Paul Eggert. + +# BeOS 5 has but does not define mbstate_t, +# so you can't declare an object of that type. +# Check for this incompatibility with Standard C. + +# AC_TYPE_MBSTATE_T +# ----------------- +AC_DEFUN([AC_TYPE_MBSTATE_T], + [AC_CACHE_CHECK([for mbstate_t], ac_cv_type_mbstate_t, + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [AC_INCLUDES_DEFAULT +# include ], + [mbstate_t x; return sizeof x;])], + [ac_cv_type_mbstate_t=yes], + [ac_cv_type_mbstate_t=no])]) + if test $ac_cv_type_mbstate_t = yes; then + AC_DEFINE([HAVE_MBSTATE_T], 1, + [Define to 1 if declares mbstate_t.]) + else + AC_DEFINE([mbstate_t], int, + [Define to a type if does not define.]) + fi]) diff -ruNp m4-1.4.7/m4/mkdtemp.m4 m4-1.4.8/m4/mkdtemp.m4 --- m4-1.4.7/m4/mkdtemp.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/m4/mkdtemp.m4 2006-11-20 06:57:31.000000000 -0700 @@ -0,0 +1,18 @@ +# mkdtemp.m4 serial 4 +dnl Copyright (C) 2001-2003, 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([gt_FUNC_MKDTEMP], +[ + AC_REPLACE_FUNCS(mkdtemp) + if test $ac_cv_func_mkdtemp = no; then + gl_PREREQ_MKDTEMP + fi +]) + +# Prerequisites of lib/mkdtemp.c +AC_DEFUN([gl_PREREQ_MKDTEMP], +[: +]) diff -ruNp m4-1.4.7/m4/mkstemp.m4 m4-1.4.8/m4/mkstemp.m4 --- m4-1.4.7/m4/mkstemp.m4 2006-09-23 22:28:44.000000000 -0600 +++ m4-1.4.8/m4/mkstemp.m4 2006-11-20 07:23:17.000000000 -0700 @@ -1,4 +1,4 @@ -#serial 14 +#serial 16 # Copyright (C) 2001, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation @@ -28,9 +28,9 @@ AC_DEFUN([gl_FUNC_MKSTEMP], large = 2147483647; for (i = 0; i < 70; i++) { - char template[] = "conftest.mkstemp/coXXXXXX"; + char templ[] = "conftest.mkstemp/coXXXXXX"; int (*mkstemp_function) (char *) = mkstemp; - int fd = mkstemp_function (template); + int fd = mkstemp_function (templ); if (fd < 0 || lseek (fd, large, SEEK_SET) != large) return 1; close (fd); @@ -45,10 +45,8 @@ AC_DEFUN([gl_FUNC_MKSTEMP], if test $gl_cv_func_working_mkstemp != yes; then AC_DEFINE([__MKSTEMP_PREFIX], [[rpl_]], [Define to rpl_ if the mkstemp replacement function should be used.]) - AC_LIBOBJ(mkstemp) - AC_LIBOBJ(tempname) + AC_LIBOBJ([mkstemp]) gl_PREREQ_MKSTEMP - gl_PREREQ_TEMPNAME fi ]) @@ -56,10 +54,3 @@ AC_DEFUN([gl_FUNC_MKSTEMP], AC_DEFUN([gl_PREREQ_MKSTEMP], [ ]) - -# Prerequisites of lib/tempname.c. -AC_DEFUN([gl_PREREQ_TEMPNAME], -[ - AC_CHECK_HEADERS_ONCE(sys/time.h) - AC_CHECK_FUNCS(__secure_getenv gettimeofday) -]) diff -ruNp m4-1.4.7/m4/pathmax.m4 m4-1.4.8/m4/pathmax.m4 --- m4-1.4.7/m4/pathmax.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/m4/pathmax.m4 2006-11-20 06:57:31.000000000 -0700 @@ -0,0 +1,11 @@ +# pathmax.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_PATHMAX], +[ + dnl Prerequisites of lib/pathmax.h. + AC_CHECK_HEADERS_ONCE(sys/param.h) +]) diff -ruNp m4-1.4.7/m4/quotearg.m4 m4-1.4.8/m4/quotearg.m4 --- m4-1.4.7/m4/quotearg.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/m4/quotearg.m4 2006-11-20 06:57:32.000000000 -0700 @@ -0,0 +1,16 @@ +# quotearg.m4 serial 5 +dnl Copyright (C) 2002, 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_QUOTEARG], +[ + AC_LIBOBJ([quotearg]) + + dnl Prerequisites of lib/quotearg.c. + AC_CHECK_HEADERS_ONCE(wchar.h wctype.h) + AC_CHECK_FUNCS_ONCE(iswprint mbsinit) + AC_TYPE_MBSTATE_T + gl_FUNC_MBRTOWC +]) diff -ruNp m4-1.4.7/m4/sig_atomic_t.m4 m4-1.4.8/m4/sig_atomic_t.m4 --- m4-1.4.7/m4/sig_atomic_t.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/m4/sig_atomic_t.m4 2006-11-20 06:57:32.000000000 -0700 @@ -0,0 +1,14 @@ +# sig_atomic_t.m4 serial 1 (gettext-0.13) +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. + +AC_DEFUN([gt_TYPE_SIG_ATOMIC_T], +[ + AC_CHECK_TYPES(sig_atomic_t, , + [AC_DEFINE(sig_atomic_t, int, + [Define as an integer type suitable for memory locations that can be + accessed atomically even in the presence of asynchnonous signals.])], + [#include ]) +]) diff -ruNp m4-1.4.7/m4/signalblocking.m4 m4-1.4.8/m4/signalblocking.m4 --- m4-1.4.7/m4/signalblocking.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/m4/signalblocking.m4 2006-11-20 06:57:32.000000000 -0700 @@ -0,0 +1,40 @@ +# signalblocking.m4 serial 4 +dnl Copyright (C) 2001-2002, 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. + +# Determine available signal blocking primitives. Three different APIs exist: +# 1) POSIX: sigemptyset, sigaddset, sigprocmask +# 2) SYSV: sighold, sigrelse +# 3) BSD: sigblock, sigsetmask +# For simplicity, here we check only for the POSIX signal blocking. +AC_DEFUN([gl_SIGNALBLOCKING], +[ + signals_not_posix= + AC_EGREP_HEADER(sigset_t, signal.h, , signals_not_posix=1) + if test -z "$signals_not_posix"; then + AC_CHECK_FUNC(sigprocmask, [gl_cv_func_sigprocmask=1]) + fi + if test -n "$gl_cv_func_sigprocmask"; then + AC_DEFINE([HAVE_POSIX_SIGNALBLOCKING], 1, + [Define to 1 if you have the sigset_t type and the sigprocmask function.]) + else + AC_LIBOBJ([sigprocmask]) + gl_PREREQ_SIGPROCMASK + fi +]) + +# Prerequisites of lib/sigprocmask.h and lib/sigprocmask.c. +AC_DEFUN([gl_PREREQ_SIGPROCMASK], [ + AC_CHECK_TYPES([sigset_t], + [gl_cv_type_sigset_t=yes], [gl_cv_type_sigset_t=no], + [#include +/* Mingw defines sigset_t not in , but in . */ +#include ]) + if test $gl_cv_type_sigset_t = yes; then + AC_DEFINE([HAVE_SIGSET_T], [1], + [Define to 1 if you lack the sigprocmask function but have the sigset_t type.]) + fi + AC_CHECK_FUNCS_ONCE(raise) +]) diff -ruNp m4-1.4.7/m4/signed.m4 m4-1.4.8/m4/signed.m4 --- m4-1.4.7/m4/signed.m4 2006-09-23 22:28:44.000000000 -0600 +++ m4-1.4.8/m4/signed.m4 1969-12-31 17:00:00.000000000 -0700 @@ -1,18 +0,0 @@ -# signed.m4 serial 2 -dnl Copyright (C) 2001-2002, 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 Bruno Haible. - -AC_DEFUN([bh_C_SIGNED], -[ - AC_CACHE_CHECK([for signed], bh_cv_c_signed, - [AC_TRY_COMPILE(, [signed char x; return !x;], - bh_cv_c_signed=yes, bh_cv_c_signed=no)]) - if test $bh_cv_c_signed = no; then - AC_DEFINE(signed, , - [Define to empty if the C compiler doesn't support this keyword.]) - fi -]) diff -ruNp m4-1.4.7/m4/size_max.m4 m4-1.4.8/m4/size_max.m4 --- m4-1.4.7/m4/size_max.m4 2006-09-23 22:28:44.000000000 -0600 +++ m4-1.4.8/m4/size_max.m4 2006-11-20 06:57:57.000000000 -0700 @@ -1,4 +1,4 @@ -# size_max.m4 serial 4 +# size_max.m4 serial 5 dnl Copyright (C) 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, @@ -11,8 +11,9 @@ AC_DEFUN([gl_SIZE_MAX], AC_CHECK_HEADERS(stdint.h) dnl First test whether the system already has SIZE_MAX. AC_MSG_CHECKING([for SIZE_MAX]) - result= - AC_EGREP_CPP([Found it], [ + AC_CACHE_VAL([gl_cv_size_max], [ + gl_cv_size_max= + AC_EGREP_CPP([Found it], [ #include #if HAVE_STDINT_H #include @@ -20,41 +21,42 @@ AC_DEFUN([gl_SIZE_MAX], #ifdef SIZE_MAX Found it #endif -], result=yes) - if test -z "$result"; then - dnl Define it ourselves. Here we assume that the type 'size_t' is not wider - dnl than the type 'unsigned long'. Try hard to find a definition that can - dnl be used in a preprocessor #if, i.e. doesn't contain a cast. - _AC_COMPUTE_INT([sizeof (size_t) * CHAR_BIT - 1], size_t_bits_minus_1, - [#include +], gl_cv_size_max=yes) + if test -z "$gl_cv_size_max"; then + dnl Define it ourselves. Here we assume that the type 'size_t' is not wider + dnl than the type 'unsigned long'. Try hard to find a definition that can + dnl be used in a preprocessor #if, i.e. doesn't contain a cast. + _AC_COMPUTE_INT([sizeof (size_t) * CHAR_BIT - 1], size_t_bits_minus_1, + [#include #include ], size_t_bits_minus_1=) - _AC_COMPUTE_INT([sizeof (size_t) <= sizeof (unsigned int)], fits_in_uint, - [#include ], fits_in_uint=) - if test -n "$size_t_bits_minus_1" && test -n "$fits_in_uint"; then - if test $fits_in_uint = 1; then - dnl Even though SIZE_MAX fits in an unsigned int, it must be of type - dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'. - AC_TRY_COMPILE([#include - extern size_t foo; - extern unsigned long foo; - ], [], fits_in_uint=0) - fi - dnl We cannot use 'expr' to simplify this expression, because 'expr' - dnl works only with 'long' integers in the host environment, while we - dnl might be cross-compiling from a 32-bit platform to a 64-bit platform. - if test $fits_in_uint = 1; then - result="(((1U << $size_t_bits_minus_1) - 1) * 2 + 1)" + _AC_COMPUTE_INT([sizeof (size_t) <= sizeof (unsigned int)], fits_in_uint, + [#include ], fits_in_uint=) + if test -n "$size_t_bits_minus_1" && test -n "$fits_in_uint"; then + if test $fits_in_uint = 1; then + dnl Even though SIZE_MAX fits in an unsigned int, it must be of type + dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'. + AC_TRY_COMPILE([#include + extern size_t foo; + extern unsigned long foo; + ], [], fits_in_uint=0) + fi + dnl We cannot use 'expr' to simplify this expression, because 'expr' + dnl works only with 'long' integers in the host environment, while we + dnl might be cross-compiling from a 32-bit platform to a 64-bit platform. + if test $fits_in_uint = 1; then + gl_cv_size_max="(((1U << $size_t_bits_minus_1) - 1) * 2 + 1)" + else + gl_cv_size_max="(((1UL << $size_t_bits_minus_1) - 1) * 2 + 1)" + fi else - result="(((1UL << $size_t_bits_minus_1) - 1) * 2 + 1)" + dnl Shouldn't happen, but who knows... + gl_cv_size_max='((size_t)~(size_t)0)' fi - else - dnl Shouldn't happen, but who knows... - result='((size_t)~(size_t)0)' fi - fi - AC_MSG_RESULT([$result]) - if test "$result" != yes; then - AC_DEFINE_UNQUOTED([SIZE_MAX], [$result], + ]) + AC_MSG_RESULT([$gl_cv_size_max]) + if test "$gl_cv_size_max" != yes; then + AC_DEFINE_UNQUOTED([SIZE_MAX], [$gl_cv_size_max], [Define as the maximum value of type 'size_t', if the system doesn't define it.]) fi ]) diff -ruNp m4-1.4.7/m4/stat-macros.m4 m4-1.4.8/m4/stat-macros.m4 --- m4-1.4.7/m4/stat-macros.m4 2006-09-23 22:28:44.000000000 -0600 +++ m4-1.4.8/m4/stat-macros.m4 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -#serial 3 - -# 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, -# with or without modifications, as long as this notice is preserved. - -AC_DEFUN([gl_STAT_MACROS], -[ - AC_REQUIRE([AC_HEADER_STAT]) -]) diff -ruNp m4-1.4.7/m4/stdint.m4 m4-1.4.8/m4/stdint.m4 --- m4-1.4.7/m4/stdint.m4 2006-09-23 22:28:45.000000000 -0600 +++ m4-1.4.8/m4/stdint.m4 2006-11-20 06:57:58.000000000 -0700 @@ -1,4 +1,4 @@ -# stdint.m4 serial 18 +# stdint.m4 serial 19 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, @@ -11,7 +11,7 @@ AC_DEFUN([gl_STDINT_H], [ AC_PREREQ(2.59)dnl - dnl Check for long long int. + dnl Check for long long int and unsigned 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 @@ -19,6 +19,13 @@ AC_DEFUN([gl_STDINT_H], HAVE_LONG_LONG_INT=0 fi AC_SUBST([HAVE_LONG_LONG_INT]) + AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT]) + if test $ac_cv_type_unsigned_long_long_int = yes; then + HAVE_UNSIGNED_LONG_LONG_INT=1 + else + HAVE_UNSIGNED_LONG_LONG_INT=0 + fi + AC_SUBST([HAVE_UNSIGNED_LONG_LONG_INT]) dnl Check for . AC_CHECK_HEADERS_ONCE([wchar.h]) diff -ruNp m4-1.4.7/m4/stdio-safer.m4 m4-1.4.8/m4/stdio-safer.m4 --- m4-1.4.7/m4/stdio-safer.m4 2006-09-23 22:28:45.000000000 -0600 +++ m4-1.4.8/m4/stdio-safer.m4 2006-11-20 06:57:58.000000000 -0700 @@ -1,4 +1,4 @@ -#serial 8 +#serial 9 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, @@ -7,6 +7,8 @@ dnl with or without modifications, as lo AC_DEFUN([gl_FOPEN_SAFER], [ AC_LIBOBJ([fopen-safer]) + AC_DEFINE([GNULIB_FOPEN_SAFER], [1], + [Define to 1 when using the gnulib fopen-safer module.]) ]) AC_DEFUN([gl_TMPFILE_SAFER], diff -ruNp m4-1.4.7/m4/strcase.m4 m4-1.4.8/m4/strcase.m4 --- m4-1.4.7/m4/strcase.m4 2006-09-23 22:28:45.000000000 -0600 +++ m4-1.4.8/m4/strcase.m4 2006-11-20 07:23:19.000000000 -0700 @@ -1,5 +1,5 @@ -# strcase.m4 serial 3 -dnl Copyright (C) 2002, 2005 Free Software Foundation, Inc. +# strcase.m4 serial 4 +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. @@ -15,13 +15,13 @@ AC_DEFUN([gl_FUNC_STRCASECMP], dnl No known system has a strcasecmp() function that works correctly in dnl multibyte locales. Therefore we use our version always. AC_LIBOBJ(strcasecmp) - AC_DEFINE(strcasecmp, rpl_strcasecmp, [Define to rpl_strcasecmp always.]) gl_PREREQ_STRCASECMP ]) AC_DEFUN([gl_FUNC_STRNCASECMP], [ AC_REPLACE_FUNCS(strncasecmp) + AC_CHECK_DECLS(strncasecmp) if test $ac_cv_func_strncasecmp = no; then gl_PREREQ_STRNCASECMP fi diff -ruNp m4-1.4.7/m4/strstr.m4 m4-1.4.8/m4/strstr.m4 --- m4-1.4.7/m4/strstr.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/m4/strstr.m4 2006-11-20 06:57:32.000000000 -0700 @@ -0,0 +1,19 @@ +# strstr.m4 serial 5 +dnl Copyright (C) 2002-2003, 2005 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_STRSTR], +[ + dnl No known system has a strstr() function that works correctly in + dnl multibyte locales. Therefore we use our version always. + AC_LIBOBJ(strstr) + gl_PREREQ_STRSTR +]) + +# Prerequisites of lib/strstr.c. +AC_DEFUN([gl_PREREQ_STRSTR], [ + AC_REQUIRE([gl_FUNC_MBRTOWC]) + : +]) diff -ruNp m4-1.4.7/m4/sys_stat_h.m4 m4-1.4.8/m4/sys_stat_h.m4 --- m4-1.4.7/m4/sys_stat_h.m4 2006-09-23 22:28:45.000000000 -0600 +++ m4-1.4.8/m4/sys_stat_h.m4 2006-11-20 06:57:59.000000000 -0700 @@ -1,4 +1,4 @@ -# sys_stat_h.m4 serial 3 -*- Autoconf -*- +# sys_stat_h.m4 serial 4 -*- Autoconf -*- 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, @@ -15,18 +15,18 @@ AC_DEFUN([gl_HEADER_SYS_STAT_H], dnl Check for mkdir. Mingw has _mkdir(name) in the nonstandard dnl instead. - AC_CHECK_DECLS([mkdir], [], [], [#include ]) + AC_CHECK_DECLS([mkdir], + [], + [AC_CHECK_HEADERS([io.h])], + [#include ]) + AC_REQUIRE([AC_C_INLINE]) - SYS_STAT_H= - if test $ac_cv_func_lstat:$ac_cv_have_decl_mkdir != yes:yes ; then - gl_ABSOLUTE_HEADER([sys/stat.h]) - ABSOLUTE_SYS_STAT_H=\"$gl_cv_absolute_sys_stat_h\" - AC_CHECK_HEADERS([io.h]) - AC_REQUIRE([AC_C_INLINE]) - SYS_STAT_H='sys/stat.h' - else - ABSOLUTE_SYS_STAT_H=\"no/such/file/sys/stat.h\" - fi + dnl Check for broken stat macros. + AC_REQUIRE([AC_HEADER_STAT]) + + gl_ABSOLUTE_HEADER([sys/stat.h]) + ABSOLUTE_SYS_STAT_H=\"$gl_cv_absolute_sys_stat_h\" AC_SUBST([ABSOLUTE_SYS_STAT_H]) + SYS_STAT_H='sys/stat.h' AC_SUBST([SYS_STAT_H]) ]) # gl_HEADER_SYS_STAT_H diff -ruNp m4-1.4.7/m4/tempname.m4 m4-1.4.8/m4/tempname.m4 --- m4-1.4.7/m4/tempname.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/m4/tempname.m4 2006-11-20 07:23:20.000000000 -0700 @@ -0,0 +1,23 @@ +#serial 2 + +# 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. + +# glibc provides __gen_tempname as a wrapper for mk[ds]temp. Expose +# it as a public API, and provide it on systems that are lacking. +AC_DEFUN([gl_FUNC_GEN_TEMPNAME], +[ + AC_REQUIRE([AC_SYS_LARGEFILE]) + + AC_LIBOBJ([tempname]) + gl_PREREQ_TEMPNAME +]) + +# Prerequisites of lib/tempname.c. +AC_DEFUN([gl_PREREQ_TEMPNAME], +[ + AC_CHECK_HEADERS_ONCE([sys/time.h]) + AC_CHECK_FUNCS_ONCE([gettimeofday]) +]) diff -ruNp m4-1.4.7/m4/tmpdir.m4 m4-1.4.8/m4/tmpdir.m4 --- m4-1.4.7/m4/tmpdir.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/m4/tmpdir.m4 2006-11-20 06:57:32.000000000 -0700 @@ -0,0 +1,12 @@ +# tmpdir.m4 serial 2 (gettext-0.15) +dnl Copyright (C) 2001-2002, 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. + +# Prerequisites for lib/tmpdir.c + +AC_DEFUN([gt_TMPDIR], +[ + AC_CHECK_FUNCS(__secure_getenv) +]) diff -ruNp m4-1.4.7/m4/ulonglong.m4 m4-1.4.8/m4/ulonglong.m4 --- m4-1.4.7/m4/ulonglong.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.8/m4/ulonglong.m4 2006-11-20 06:57:32.000000000 -0700 @@ -0,0 +1,48 @@ +# ulonglong.m4 serial 6 +dnl Copyright (C) 1999-2006 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Paul Eggert. + +# Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works. +# This fixes a bug in Autoconf 2.60, but can be removed once we +# assume 2.61 everywhere. + +# Note: If the type 'unsigned long long int' exists but is only 32 bits +# large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT +# will not be defined. In this case you can treat 'unsigned long long int' +# like 'unsigned long int'. + +AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT], +[ + AC_CACHE_CHECK([for unsigned long long int], + [ac_cv_type_unsigned_long_long_int], + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[unsigned long long int ull = 18446744073709551615ULL; + typedef int a[(18446744073709551615ULL <= (unsigned long long int) -1 + ? 1 : -1)]; + int i = 63;]], + [[unsigned long long int ullmax = 18446744073709551615ull; + return (ull << 63 | ull >> 63 | ull << i | ull >> i + | ullmax / ull | ullmax % ull);]])], + [ac_cv_type_unsigned_long_long_int=yes], + [ac_cv_type_unsigned_long_long_int=no])]) + if test $ac_cv_type_unsigned_long_long_int = yes; then + AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], 1, + [Define to 1 if the system has the type `unsigned long long int'.]) + fi +]) + +# This macro is obsolescent and should go away soon. +AC_DEFUN([gl_AC_TYPE_UNSIGNED_LONG_LONG], +[ + AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT]) + ac_cv_type_unsigned_long_long=$ac_cv_type_unsigned_long_long_int + if test $ac_cv_type_unsigned_long_long = yes; then + AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1, + [Define if you have the 'unsigned long long' type.]) + fi +]) diff -ruNp m4-1.4.7/m4/vasnprintf.m4 m4-1.4.8/m4/vasnprintf.m4 --- m4-1.4.7/m4/vasnprintf.m4 2006-09-23 22:28:46.000000000 -0600 +++ m4-1.4.8/m4/vasnprintf.m4 2006-11-20 06:58:00.000000000 -0700 @@ -1,5 +1,5 @@ -# vasnprintf.m4 serial 5 -dnl Copyright (C) 2002-2004 Free Software Foundation, Inc. +# vasnprintf.m4 serial 7 +dnl Copyright (C) 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. @@ -22,8 +22,7 @@ AC_DEFUN([gl_FUNC_VASNPRINTF], # Prequisites of lib/printf-args.h, lib/printf-args.c. AC_DEFUN([gl_PREREQ_PRINTF_ARGS], [ - AC_REQUIRE([bh_C_SIGNED]) - AC_REQUIRE([gl_AC_TYPE_LONG_LONG]) + AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) AC_REQUIRE([gt_TYPE_LONGDOUBLE]) AC_REQUIRE([gt_TYPE_WCHAR_T]) AC_REQUIRE([gt_TYPE_WINT_T]) @@ -32,7 +31,7 @@ AC_DEFUN([gl_PREREQ_PRINTF_ARGS], # Prequisites of lib/printf-parse.h, lib/printf-parse.c. AC_DEFUN([gl_PREREQ_PRINTF_PARSE], [ - AC_REQUIRE([gl_AC_TYPE_LONG_LONG]) + AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) AC_REQUIRE([gt_TYPE_LONGDOUBLE]) AC_REQUIRE([gt_TYPE_WCHAR_T]) AC_REQUIRE([gt_TYPE_WINT_T]) @@ -45,7 +44,7 @@ AC_DEFUN([gl_PREREQ_PRINTF_PARSE], AC_DEFUN([gl_PREREQ_VASNPRINTF], [ AC_REQUIRE([AC_FUNC_ALLOCA]) - AC_REQUIRE([gl_AC_TYPE_LONG_LONG]) + AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) AC_REQUIRE([gt_TYPE_LONGDOUBLE]) AC_REQUIRE([gt_TYPE_WCHAR_T]) AC_REQUIRE([gt_TYPE_WINT_T]) diff -ruNp m4-1.4.7/m4/wcwidth.m4 m4-1.4.8/m4/wcwidth.m4 --- m4-1.4.7/m4/wcwidth.m4 2006-09-23 22:28:46.000000000 -0600 +++ m4-1.4.8/m4/wcwidth.m4 2006-11-20 06:58:00.000000000 -0700 @@ -1,4 +1,4 @@ -# wcwidth.m4 serial 5 +# wcwidth.m4 serial 6 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, @@ -11,6 +11,7 @@ AC_DEFUN([gl_FUNC_WCWIDTH], AC_REQUIRE([AC_C_INLINE]) AC_REQUIRE([gt_TYPE_WCHAR_T]) + AC_REQUIRE([gt_TYPE_WINT_T]) AC_CHECK_HEADERS_ONCE([wchar.h wctype.h]) AC_CHECK_FUNCS_ONCE([iswprint wcwidth]) diff -ruNp m4-1.4.7/m4/xalloc.m4 m4-1.4.8/m4/xalloc.m4 --- m4-1.4.7/m4/xalloc.m4 2006-09-23 22:28:46.000000000 -0600 +++ m4-1.4.8/m4/xalloc.m4 2006-11-20 07:23:21.000000000 -0700 @@ -1,4 +1,4 @@ -# xalloc.m4 serial 13 +# xalloc.m4 serial 16 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, @@ -14,11 +14,11 @@ AC_DEFUN([gl_XALLOC], # Prerequisites of lib/xalloc.h. AC_DEFUN([gl_PREREQ_XALLOC], [ + AC_REQUIRE([gl_INLINE]) : ]) # Prerequisites of lib/xmalloc.c. AC_DEFUN([gl_PREREQ_XMALLOC], [ - AC_REQUIRE([AC_C_INLINE]) : ]) diff -ruNp m4-1.4.7/src/Makefile.am m4-1.4.8/src/Makefile.am --- m4-1.4.7/src/Makefile.am 2006-09-11 07:17:21.000000000 -0600 +++ m4-1.4.8/src/Makefile.am 2006-11-20 06:55:47.000000000 -0700 @@ -19,6 +19,7 @@ ## ## This file written by Eric Blake +AUTOMAKE_OPTIONS = nostdinc AM_CPPFLAGS = -I$(top_srcdir)/lib -I../lib bin_PROGRAMS = m4 m4_SOURCES = m4.h m4.c builtin.c debug.c eval.c format.c freeze.c input.c \ diff -ruNp m4-1.4.7/src/Makefile.in m4-1.4.8/src/Makefile.in --- m4-1.4.7/src/Makefile.in 2006-09-25 06:08:00.000000000 -0600 +++ m4-1.4.8/src/Makefile.in 2006-11-20 07:25:49.000000000 -0700 @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. +# Makefile.in generated by automake 1.10 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -14,15 +14,11 @@ @SET_MAKE@ -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -42,24 +38,32 @@ 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/cloexec.m4 \ - $(top_srcdir)/m4/close-stream.m4 $(top_srcdir)/m4/codeset.m4 \ + $(top_srcdir)/m4/alloca.m4 $(top_srcdir)/m4/allocsa.m4 \ + $(top_srcdir)/m4/cloexec.m4 $(top_srcdir)/m4/close-stream.m4 \ + $(top_srcdir)/m4/closeout.m4 $(top_srcdir)/m4/codeset.m4 \ + $(top_srcdir)/m4/config-h.m4 $(top_srcdir)/m4/eealloc.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/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/fatal-signal.m4 $(top_srcdir)/m4/fpending.m4 \ + $(top_srcdir)/m4/free.m4 $(top_srcdir)/m4/getopt.m4 \ + $(top_srcdir)/m4/gl_list.m4 $(top_srcdir)/m4/gnulib-comp.m4 \ + $(top_srcdir)/m4/inline.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/mbstate_t.m4 $(top_srcdir)/m4/memchr.m4 \ + $(top_srcdir)/m4/mkdtemp.m4 $(top_srcdir)/m4/mkstemp.m4 \ + $(top_srcdir)/m4/pathmax.m4 $(top_srcdir)/m4/quotearg.m4 \ + $(top_srcdir)/m4/regex.m4 $(top_srcdir)/m4/sig_atomic_t.m4 \ + $(top_srcdir)/m4/signalblocking.m4 \ + $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/ssize_t.m4 \ $(top_srcdir)/m4/stdarg.m4 $(top_srcdir)/m4/stdbool.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/strstr.m4 $(top_srcdir)/m4/strtol.m4 \ + $(top_srcdir)/m4/sys_stat_h.m4 $(top_srcdir)/m4/tempname.m4 \ + $(top_srcdir)/m4/tmpdir.m4 $(top_srcdir)/m4/ulonglong.m4 \ $(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/unistd_h.m4 \ $(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/vasnprintf.m4 \ $(top_srcdir)/m4/vasprintf.m4 $(top_srcdir)/m4/wchar_t.m4 \ @@ -70,7 +74,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/a am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_HEADER = $(top_builddir)/lib/config.h CONFIG_CLEAN_FILES = am__installdirs = "$(DESTDIR)$(bindir)" binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) @@ -85,7 +89,7 @@ am_m4_OBJECTS = m4.$(OBJEXT) builtin.$(O m4_OBJECTS = $(am_m4_OBJECTS) am__DEPENDENCIES_1 = m4_DEPENDENCIES = ../lib/libm4.a $(am__DEPENDENCIES_1) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +DEFAULT_INCLUDES = depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ @@ -102,8 +106,6 @@ ABSOLUTE_SYS_STAT_H = @ABSOLUTE_SYS_STAT ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ ALLOCA_H = @ALLOCA_H@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ @@ -129,8 +131,6 @@ EGREP = @EGREP@ EOVERFLOW = @EOVERFLOW@ EXEEXT = @EXEEXT@ 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@ @@ -141,8 +141,10 @@ 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_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@ HAVE_WCHAR_H = @HAVE_WCHAR_H@ HAVE__BOOL = @HAVE__BOOL@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -153,7 +155,10 @@ LIBM4_LTLIBDEPS = @LIBM4_LTLIBDEPS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ +M4_LIBOBJS = @M4_LIBOBJS@ +M4_LTLIBOBJS = @M4_LTLIBOBJS@ MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -168,8 +173,6 @@ 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@ @@ -178,9 +181,11 @@ UNISTD_H = @UNISTD_H@ VERSION = @VERSION@ WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ WINT_T_SUFFIX = @WINT_T_SUFFIX@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -192,6 +197,7 @@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ +builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ @@ -219,8 +225,12 @@ program_transform_name = @program_transf psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AUTOMAKE_OPTIONS = nostdinc AM_CPPFLAGS = -I$(top_srcdir)/lib -I../lib m4_SOURCES = m4.h m4.c builtin.c debug.c eval.c format.c freeze.c \ input.c macro.c output.c path.c symtab.c $(am__append_1) @@ -260,7 +270,7 @@ $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) - test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" + test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; for p in $$list; do \ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ if test -f $$p \ @@ -283,7 +293,7 @@ clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) m4$(EXEEXT): $(m4_OBJECTS) $(m4_DEPENDENCIES) @rm -f m4$(EXEEXT) - $(LINK) $(m4_LDFLAGS) $(m4_OBJECTS) $(m4_LDADD) $(LIBS) + $(LINK) $(m4_OBJECTS) $(m4_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -305,19 +315,18 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/symtab.Po@am__quote@ .c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` -uninstall-info-am: ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ @@ -368,22 +377,21 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ @@ -399,7 +407,7 @@ check: check-am all-am: Makefile $(PROGRAMS) installdirs: for dir in "$(DESTDIR)$(bindir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am @@ -447,12 +455,20 @@ info-am: install-data-am: +install-dvi: install-dvi-am + install-exec-am: install-binPROGRAMS +install-html: install-html-am + install-info: install-info-am install-man: +install-pdf: install-pdf-am + +install-ps: install-ps-am + installcheck-am: maintainer-clean: maintainer-clean-am @@ -472,18 +488,22 @@ ps: ps-am ps-am: -uninstall-am: uninstall-binPROGRAMS uninstall-info-am +uninstall-am: uninstall-binPROGRAMS + +.MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ clean-generic ctags distclean distclean-compile \ distclean-generic distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-binPROGRAMS \ - install-data install-data-am install-exec install-exec-am \ - install-info install-info-am install-man install-strip \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-binPROGRAMS uninstall-info-am + uninstall-am uninstall-binPROGRAMS # 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. diff -ruNp m4-1.4.7/src/builtin.c m4-1.4.8/src/builtin.c --- m4-1.4.7/src/builtin.c 2006-09-11 07:17:21.000000000 -0600 +++ m4-1.4.8/src/builtin.c 2006-11-20 06:55:47.000000000 -0700 @@ -19,7 +19,7 @@ 02110-1301 USA */ -/* Code for all builtin macros, initialisation of symbol table, and +/* Code for all builtin macros, initialization of symbol table, and expansion of user defined macros. */ #include "m4.h" @@ -27,6 +27,7 @@ extern FILE *popen (); #include "regex.h" +#include "strstr.h" #if HAVE_SYS_WAIT_H # include @@ -34,8 +35,8 @@ extern FILE *popen (); #define ARG(i) (argc > (i) ? TOKEN_DATA_TEXT (argv[i]) : "") -/* Initialisation of builtin and predefined macros. The table - "builtin_tab" is both used for initialisation, and by the "builtin" +/* Initialization of builtin and predefined macros. The table + "builtin_tab" is both used for initialization, and by the "builtin" builtin. */ #define DECLARE(name) \ @@ -73,6 +74,7 @@ DECLARE (m4_len); DECLARE (m4_m4exit); DECLARE (m4_m4wrap); DECLARE (m4_maketemp); +DECLARE (m4_mkstemp); DECLARE (m4_patsubst); DECLARE (m4_popdef); DECLARE (m4_pushdef); @@ -96,59 +98,60 @@ builtin_tab[] = /* name GNUext macros blind function */ - { "__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 }, + { "__file__", true, false, false, m4___file__ }, + { "__line__", true, false, false, m4___line__ }, + { "__program__", true, false, false, m4___program__ }, + { "builtin", true, true, true, m4_builtin }, + { "changecom", false, false, false, m4_changecom }, + { "changequote", false, false, false, m4_changequote }, #ifdef ENABLE_CHANGEWORD - { "changeword", TRUE, FALSE, TRUE, m4_changeword }, + { "changeword", true, false, true, m4_changeword }, #endif - { "debugmode", TRUE, FALSE, FALSE, m4_debugmode }, - { "debugfile", TRUE, FALSE, FALSE, m4_debugfile }, - { "decr", FALSE, FALSE, TRUE, m4_decr }, - { "define", FALSE, TRUE, TRUE, m4_define }, - { "defn", FALSE, FALSE, TRUE, m4_defn }, - { "divert", FALSE, FALSE, FALSE, m4_divert }, - { "divnum", FALSE, FALSE, FALSE, m4_divnum }, - { "dnl", FALSE, FALSE, FALSE, m4_dnl }, - { "dumpdef", FALSE, FALSE, FALSE, m4_dumpdef }, - { "errprint", FALSE, FALSE, TRUE, m4_errprint }, - { "esyscmd", TRUE, FALSE, TRUE, m4_esyscmd }, - { "eval", FALSE, FALSE, TRUE, m4_eval }, - { "format", TRUE, FALSE, TRUE, m4_format }, - { "ifdef", FALSE, FALSE, TRUE, m4_ifdef }, - { "ifelse", FALSE, FALSE, TRUE, m4_ifelse }, - { "include", FALSE, FALSE, TRUE, m4_include }, - { "incr", FALSE, FALSE, TRUE, m4_incr }, - { "index", FALSE, FALSE, TRUE, m4_index }, - { "indir", TRUE, FALSE, TRUE, m4_indir }, - { "len", FALSE, FALSE, TRUE, m4_len }, - { "m4exit", FALSE, FALSE, FALSE, m4_m4exit }, - { "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, TRUE, m4_shift }, - { "sinclude", FALSE, FALSE, TRUE, m4_sinclude }, - { "substr", FALSE, FALSE, TRUE, m4_substr }, - { "syscmd", FALSE, FALSE, TRUE, m4_syscmd }, - { "sysval", FALSE, FALSE, FALSE, m4_sysval }, - { "traceoff", FALSE, FALSE, FALSE, m4_traceoff }, - { "traceon", FALSE, FALSE, FALSE, m4_traceon }, - { "translit", FALSE, FALSE, TRUE, m4_translit }, - { "undefine", FALSE, FALSE, TRUE, m4_undefine }, - { "undivert", FALSE, FALSE, FALSE, m4_undivert }, + { "debugmode", true, false, false, m4_debugmode }, + { "debugfile", true, false, false, m4_debugfile }, + { "decr", false, false, true, m4_decr }, + { "define", false, true, true, m4_define }, + { "defn", false, false, true, m4_defn }, + { "divert", false, false, false, m4_divert }, + { "divnum", false, false, false, m4_divnum }, + { "dnl", false, false, false, m4_dnl }, + { "dumpdef", false, false, false, m4_dumpdef }, + { "errprint", false, false, true, m4_errprint }, + { "esyscmd", true, false, true, m4_esyscmd }, + { "eval", false, false, true, m4_eval }, + { "format", true, false, true, m4_format }, + { "ifdef", false, false, true, m4_ifdef }, + { "ifelse", false, false, true, m4_ifelse }, + { "include", false, false, true, m4_include }, + { "incr", false, false, true, m4_incr }, + { "index", false, false, true, m4_index }, + { "indir", true, true, true, m4_indir }, + { "len", false, false, true, m4_len }, + { "m4exit", false, false, false, m4_m4exit }, + { "m4wrap", false, false, true, m4_m4wrap }, + { "maketemp", false, false, true, m4_maketemp }, + { "mkstemp", false, false, true, m4_mkstemp }, + { "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, true, m4_shift }, + { "sinclude", false, false, true, m4_sinclude }, + { "substr", false, false, true, m4_substr }, + { "syscmd", false, false, true, m4_syscmd }, + { "sysval", false, false, false, m4_sysval }, + { "traceoff", false, false, false, m4_traceoff }, + { "traceon", false, false, false, m4_traceon }, + { "translit", false, false, true, m4_translit }, + { "undefine", false, false, true, m4_undefine }, + { "undivert", false, false, false, m4_undivert }, - { 0, FALSE, FALSE, FALSE, 0 }, + { 0, false, false, false, 0 }, /* placeholder is intentionally stuck after the table end delimiter, so that we can easily find it, while not treating it as a real builtin. */ - { "placeholder", TRUE, FALSE, FALSE, m4_placeholder }, + { "placeholder", true, false, false, m4_placeholder }, }; static predefined const @@ -235,11 +238,11 @@ define_user_macro (const char *name, con free (SYMBOL_TEXT (s)); SYMBOL_TYPE (s) = TOKEN_TEXT; - SYMBOL_TEXT (s) = xstrdup (text); + SYMBOL_TEXT (s) = xstrdup (text ? text : ""); } /*-----------------------------------------------. -| Initialise all builtin and predefined macros. | +| Initialize all builtin and predefined macros. | `-----------------------------------------------*/ void @@ -285,10 +288,10 @@ builtin_init (void) | applicable. | `------------------------------------------------------------------------*/ -static boolean +static bool bad_argc (token_data *name, int argc, int min, int max) { - boolean isbad = FALSE; + bool isbad = false; if (min > 0 && argc < min) { @@ -296,7 +299,7 @@ bad_argc (token_data *name, int argc, in M4ERROR ((warning_status, 0, "Warning: too few arguments to builtin `%s'", TOKEN_DATA_TEXT (name))); - isbad = TRUE; + isbad = true; } else if (max > 0 && argc > max && !suppress_warnings) M4ERROR ((warning_status, 0, @@ -309,10 +312,10 @@ bad_argc (token_data *name, int argc, in /*--------------------------------------------------------------------------. | The function numeric_arg () converts ARG to an int pointed to by VALUEP. | | If the conversion fails, print error message for macro MACRO. Return | -| TRUE iff conversion succeeds. | +| true iff conversion succeeds. | `--------------------------------------------------------------------------*/ -static boolean +static bool numeric_arg (token_data *macro, const char *arg, int *valuep) { char *endp; @@ -333,7 +336,7 @@ numeric_arg (token_data *macro, const ch M4ERROR ((warning_status, 0, "non-numeric argument to builtin `%s'", TOKEN_DATA_TEXT (macro))); - return FALSE; + return false; } if (isspace (to_uchar (*arg))) M4ERROR ((warning_status, 0, @@ -344,7 +347,7 @@ numeric_arg (token_data *macro, const ch "numeric overflow detected in builtin `%s'", TOKEN_DATA_TEXT (macro))); } - return TRUE; + return true; } /*------------------------------------------------------------------------. @@ -356,23 +359,23 @@ numeric_arg (token_data *macro, const ch static char const digits[] = "0123456789abcdefghijklmnopqrstuvwxyz"; static const char * -ntoa (register eval_t value, int radix) +ntoa (eval_t value, int radix) { - boolean negative; + bool negative; unsigned_eval_t uvalue; static char str[256]; - register char *s = &str[sizeof str]; + char *s = &str[sizeof str]; *--s = '\0'; if (value < 0) { - negative = TRUE; + negative = true; uvalue = (unsigned_eval_t) -value; } else { - negative = FALSE; + negative = false; uvalue = (unsigned_eval_t) value; } @@ -404,12 +407,12 @@ shipout_int (struct obstack *obs, int va /*----------------------------------------------------------------------. | Print ARGC arguments from the table ARGV to obstack OBS, separated by | -| SEP, and quoted by the current quotes, if QUOTED is TRUE. | +| SEP, and quoted by the current quotes, if QUOTED is true. | `----------------------------------------------------------------------*/ static void dump_args (struct obstack *obs, int argc, token_data **argv, - const char *sep, boolean quoted) + const char *sep, bool quoted) { int i; size_t len = strlen (sep); @@ -606,8 +609,9 @@ struct dump_symbol_data }; static void -dump_symbol (symbol *sym, struct dump_symbol_data *data) +dump_symbol (symbol *sym, void *arg) { + struct dump_symbol_data *data = (struct dump_symbol_data *) arg; if (!SYMBOL_SHADOWED (sym) && SYMBOL_TYPE (sym) != TOKEN_VOID) { obstack_blank (data->obs, sizeof (symbol *)); @@ -646,7 +650,7 @@ m4_dumpdef (struct obstack *obs, int arg if (argc == 1) { - hack_all_symbols (dump_symbol, (char *) &data); + hack_all_symbols (dump_symbol, &data); } else { @@ -663,9 +667,9 @@ m4_dumpdef (struct obstack *obs, int arg /* Make table of symbols invisible to expand_macro (). */ - (void) obstack_finish (obs); + obstack_finish (obs); - qsort ((char *) data.base, data.size, sizeof (symbol *), dumpdef_cmp); + qsort (data.base, data.size, sizeof (symbol *), dumpdef_cmp); for (; data.size > 0; --data.size, data.base++) { @@ -712,17 +716,34 @@ static void m4_builtin (struct obstack *obs, int argc, token_data **argv) { const builtin *bp; - const char *name = ARG (1); + const char *name; if (bad_argc (argv[0], argc, 2, -1)) return; + if (TOKEN_DATA_TYPE (argv[1]) != TOKEN_TEXT) + { + M4ERROR ((warning_status, 0, + "Warning: %s: invalid macro name ignored", ARG (0))); + return; + } + name = ARG (1); bp = find_builtin_by_name (name); if (bp->func == m4_placeholder) M4ERROR ((warning_status, 0, "undefined builtin `%s'", name)); else - (*bp->func) (obs, argc - 1, argv + 1); + { + int i; + if (! bp->groks_macro_args) + for (i = 2; i < argc; i++) + if (TOKEN_DATA_TYPE (argv[i]) != TOKEN_TEXT) + { + TOKEN_DATA_TYPE (argv[i]) = TOKEN_TEXT; + TOKEN_DATA_TEXT (argv[i]) = (char *) ""; + } + bp->func (obs, argc - 1, argv + 1); + } } /*------------------------------------------------------------------------. @@ -736,23 +757,40 @@ static void m4_indir (struct obstack *obs, int argc, token_data **argv) { symbol *s; - const char *name = ARG (1); + const char *name; if (bad_argc (argv[0], argc, 2, -1)) return; + if (TOKEN_DATA_TYPE (argv[1]) != TOKEN_TEXT) + { + M4ERROR ((warning_status, 0, + "Warning: %s: invalid macro name ignored", ARG (0))); + return; + } + name = ARG (1); s = lookup_symbol (name, SYMBOL_LOOKUP); if (s == NULL || SYMBOL_TYPE (s) == TOKEN_VOID) M4ERROR ((warning_status, 0, "undefined macro `%s'", name)); else - call_macro (s, argc - 1, argv + 1, obs); + { + int i; + if (! SYMBOL_MACRO_ARGS (s)) + for (i = 2; i < argc; i++) + if (TOKEN_DATA_TYPE (argv[i]) != TOKEN_TEXT) + { + TOKEN_DATA_TYPE (argv[i]) = TOKEN_TEXT; + TOKEN_DATA_TEXT (argv[i]) = (char *) ""; + } + call_macro (s, argc - 1, argv + 1, obs); + } } /*-------------------------------------------------------------------------. | The macro "defn" returns the quoted definition of the macro named by the | | first argument. If the macro is builtin, it will push a special | -| macro-definition token on ht input stack. | +| macro-definition token on the input stack. | `-------------------------------------------------------------------------*/ static void @@ -1054,11 +1092,13 @@ m4_undivert (struct obstack *obs, int ar "non-numeric argument to builtin `%s'", ARG (0))); else { - fp = path_search (ARG (i), NULL); + fp = m4_path_search (ARG (i), NULL); if (fp != NULL) { insert_file (fp); - fclose (fp); + if (fclose (fp) == EOF) + M4ERROR ((warning_status, errno, + "error undiverting `%s'", ARG (i))); } else M4ERROR ((warning_status, errno, @@ -1095,7 +1135,7 @@ m4_shift (struct obstack *obs, int argc, { if (bad_argc (argv[0], argc, 2, -1)) return; - dump_args (obs, argc - 1, argv + 1, ",", TRUE); + dump_args (obs, argc - 1, argv + 1, ",", true); } /*--------------------------------------------------------------------------. @@ -1108,6 +1148,7 @@ m4_changequote (struct obstack *obs, int if (bad_argc (argv[0], argc, 1, 3)) return; + /* Explicit NULL distinguishes between empty and missing argument. */ set_quotes ((argc >= 2) ? TOKEN_DATA_TEXT (argv[1]) : NULL, (argc >= 3) ? TOKEN_DATA_TEXT (argv[2]) : NULL); } @@ -1123,11 +1164,9 @@ m4_changecom (struct obstack *obs, int a if (bad_argc (argv[0], argc, 1, 3)) return; - if (argc == 1) - set_comment ("", ""); /* disable comments */ - else - set_comment (TOKEN_DATA_TEXT (argv[1]), - (argc >= 3) ? TOKEN_DATA_TEXT (argv[2]) : NULL); + /* Explicit NULL distinguishes between empty and missing argument. */ + set_comment ((argc >= 2) ? TOKEN_DATA_TEXT (argv[1]) : NULL, + (argc >= 3) ? TOKEN_DATA_TEXT (argv[2]) : NULL); } #ifdef ENABLE_CHANGEWORD @@ -1154,19 +1193,19 @@ m4_changeword (struct obstack *obs, int /*-------------------------------------------------------------------------. | Generic include function. Include the file given by the first argument, | -| if it exists. Complain about inaccesible files iff SILENT is FALSE. | +| if it exists. Complain about inaccesible files iff SILENT is false. | `-------------------------------------------------------------------------*/ static void -include (int argc, token_data **argv, boolean silent) +include (int argc, token_data **argv, bool silent) { FILE *fp; - const char *name; + char *name; if (bad_argc (argv[0], argc, 2, 2)) return; - fp = path_search (ARG (1), &name); + fp = m4_path_search (ARG (1), &name); if (fp == NULL) { if (!silent) @@ -1175,8 +1214,8 @@ include (int argc, token_data **argv, bo return; } - push_file (fp, name, TRUE); - free ((char *) name); + push_file (fp, name, true); + free (name); } /*------------------------------------------------. @@ -1186,7 +1225,7 @@ include (int argc, token_data **argv, bo static void m4_include (struct obstack *obs, int argc, token_data **argv) { - include (argc, argv, FALSE); + include (argc, argv, false); } /*----------------------------------. @@ -1196,7 +1235,7 @@ m4_include (struct obstack *obs, int arg static void m4_sinclude (struct obstack *obs, int argc, token_data **argv) { - include (argc, argv, TRUE); + include (argc, argv, true); } /* More miscellaneous builtins -- "maketemp", "errprint", "__file__", @@ -1206,21 +1245,86 @@ m4_sinclude (struct obstack *obs, int ar | Use the first argument as at template for a temporary file name. | `------------------------------------------------------------------*/ +/* Add trailing 'X' to NAME if necessary, securely create the file, + and place the new file name on OBS. */ static void -m4_maketemp (struct obstack *obs, int argc, token_data **argv) +mkstemp_helper (struct obstack *obs, const char *name) { int fd; + int len; + int i; + + /* Guarantee that there are six trailing 'X' characters, even if the + user forgot to supply them. */ + len = strlen (name); + obstack_grow (obs, name, len); + for (i = 0; len > 0 && i < 6; i++) + if (name[--len] != 'X') + break; + for (; i < 6; i++) + obstack_1grow (obs, 'X'); + obstack_1grow (obs, '\0'); + + errno = 0; + fd = mkstemp ((char *) obstack_base (obs)); + if (fd < 0) + { + M4ERROR ((0, errno, "cannot create tempfile `%s'", name)); + obstack_free (obs, obstack_finish (obs)); + } + else + close (fd); +} + +static void +m4_maketemp (struct obstack *obs, int argc, token_data **argv) +{ if (bad_argc (argv[0], argc, 2, 2)) return; - errno = 0; - if ((fd = mkstemp (ARG (1))) < 0) + if (no_gnu_extensions) { - M4ERROR ((warning_status, errno, "cannot create tempfile `%s'", - ARG (1))); - return; + /* POSIX states "any trailing 'X' characters [are] replaced with + the current process ID as a string", without referencing the + file system. Horribly insecure, but we have to do it when we + are in traditional mode. + + For reference, Solaris m4 does: + maketemp() -> `' + maketemp(X) -> `X' + maketemp(XX) -> `Xn', where n is last digit of pid + maketemp(XXXXXXXX) -> `X00nnnnn', where nnnnn is 16-bit pid + */ + const char *str = ARG (1); + int len = strlen (str); + int i; + int len2; + + M4ERROR ((warning_status, 0, "recommend using mkstemp instead")); + for (i = len; i > 1; i--) + if (str[i - 1] != 'X') + break; + obstack_grow (obs, str, i); + str = ntoa ((eval_t) getpid (), 10); + len2 = strlen (str); + if (len2 > len - i) + obstack_grow0 (obs, str + len2 - (len - i), len - i); + else + { + while (i++ < len - len2) + obstack_1grow (obs, '0'); + obstack_grow0 (obs, str, len2); + } } - close(fd); - obstack_grow (obs, ARG (1), strlen (ARG (1))); + else + mkstemp_helper (obs, ARG (1)); +} + +static void +m4_mkstemp (struct obstack *obs, int argc, token_data **argv) +{ + if (bad_argc (argv[0], argc, 2, 2)) + return; + mkstemp_helper (obs, ARG (1)); } /*----------------------------------------. @@ -1232,7 +1336,7 @@ m4_errprint (struct obstack *obs, int ar { if (bad_argc (argv[0], argc, 2, -1)) return; - dump_args (obs, argc, argv, " ", FALSE); + dump_args (obs, argc, argv, " ", false); obstack_1grow (obs, '\0'); debug_flush_files (); fprintf (stderr, "%s", (char *) obstack_finish (obs)); @@ -1295,14 +1399,11 @@ m4_m4exit (struct obstack *obs, int argc detect any errors it might have encountered. */ debug_set_output (NULL); debug_flush_files (); - if (close_stream (stdout) != 0) - { - M4ERROR ((warning_status, errno, "write error")); - if (exit_code == 0) - exit_code = EXIT_FAILURE; - } - if (exit_code == 0 && retcode != 0) + if (exit_code == EXIT_SUCCESS && retcode != EXIT_SUCCESS) exit_code = retcode; + /* Propagate non-zero status to atexit handlers. */ + if (exit_code != EXIT_SUCCESS) + exit_failure = exit_code; exit (exit_code); } @@ -1320,9 +1421,9 @@ m4_m4wrap (struct obstack *obs, int argc if (no_gnu_extensions) obstack_grow (obs, ARG (1), strlen (ARG (1))); else - dump_args (obs, argc, argv, " ", FALSE); + dump_args (obs, argc, argv, " ", false); obstack_1grow (obs, '\0'); - push_wrapup (obstack_finish (obs)); + push_wrapup ((char *) obstack_finish (obs)); } /* Enable tracing of all specified macros, or all, if none is specified. @@ -1336,9 +1437,9 @@ m4_m4wrap (struct obstack *obs, int argc `-----------------------------------------------------------------------*/ static void -set_trace (symbol *sym, const char *data) +set_trace (symbol *sym, void *data) { - SYMBOL_TRACED (sym) = (boolean) (data != NULL); + SYMBOL_TRACED (sym) = data != NULL; /* Remove placeholder from table if macro is undefined and untraced. */ if (SYMBOL_TYPE (sym) == TOKEN_VOID && data == NULL) lookup_symbol (SYMBOL_NAME (sym), SYMBOL_POPDEF); @@ -1351,12 +1452,12 @@ m4_traceon (struct obstack *obs, int arg int i; if (argc == 1) - hack_all_symbols (set_trace, (char *) obs); + hack_all_symbols (set_trace, obs); else for (i = 1; i < argc; i++) { s = lookup_symbol (TOKEN_DATA_TEXT (argv[i]), SYMBOL_INSERT); - set_trace (s, (char *) obs); + set_trace (s, obs); } } @@ -1476,8 +1577,9 @@ m4_len (struct obstack *obs, int argc, t static void m4_index (struct obstack *obs, int argc, token_data **argv) { - const char *cp, *last; - int l1, l2, retval; + const char *haystack; + const char *result; + int retval; if (bad_argc (argv[0], argc, 3, 3)) { @@ -1487,17 +1589,9 @@ m4_index (struct obstack *obs, int argc, return; } - l1 = strlen (ARG (1)); - l2 = strlen (ARG (2)); - - last = ARG (1) + l1 - l2; - - for (cp = ARG (1); cp <= last; cp++) - { - if (strncmp (cp, ARG (2), l2) == 0) - break; - } - retval = (cp <= last) ? cp - ARG (1) : -1; + haystack = ARG (1); + result = strstr (haystack, ARG (2)); + retval = result ? result - haystack : -1; shipout_int (obs, retval); } @@ -1551,14 +1645,14 @@ m4_substr (struct obstack *obs, int argc static const char * expand_ranges (const char *s, struct obstack *obs) { - char from; - char to; + unsigned char from; + unsigned char to; - for (from = '\0'; *s != '\0'; from = *s++) + for (from = '\0'; *s != '\0'; from = to_uchar (*s++)) { if (*s == '-' && from != '\0') { - to = *++s; + to = to_uchar (*++s); if (to == '\0') { /* trailing dash */ @@ -1580,7 +1674,7 @@ expand_ranges (const char *s, struct obs obstack_1grow (obs, *s); } obstack_1grow (obs, '\0'); - return obstack_finish (obs); + return (char *) obstack_finish (obs); } /*----------------------------------------------------------------------. @@ -1594,9 +1688,12 @@ expand_ranges (const char *s, struct obs static void m4_translit (struct obstack *obs, int argc, token_data **argv) { - register const char *data, *tmp; - const char *from, *to; - int tolen; + const char *data; + const char *from; + const char *to; + char map[256] = {0}; + char found[256] = {0}; + unsigned char ch; if (bad_argc (argv[0], argc, 3, 4)) { @@ -1614,33 +1711,37 @@ m4_translit (struct obstack *obs, int ar return; } - if (argc >= 4) + to = ARG (3); + if (strchr (to, '-') != NULL) { - to = ARG (3); - if (strchr (to, '-') != NULL) - { - to = expand_ranges (to, obs); - if (to == NULL) - return; - } + to = expand_ranges (to, obs); + if (to == NULL) + return; } - else - to = ""; - - tolen = strlen (to); - for (data = ARG (1); *data; data++) + /* Calling strchr(from) for each character in data is quadratic, + since both strings can be arbitrarily long. Instead, create a + from-to mapping in one pass of from, then use that map in one + pass of data, for linear behavior. Traditional behavior is that + only the first instance of a character in from is consulted, + hence the found map. */ + for ( ; (ch = *from) != '\0'; from++) { - tmp = strchr (from, *data); - if (tmp == NULL) - { - obstack_1grow (obs, *data); - } - else + if (! found[ch]) { - if (tmp - from < tolen) - obstack_1grow (obs, *(to + (tmp - from))); + found[ch] = 1; + map[ch] = *to; } + if (*to != '\0') + to++; + } + + for (data = ARG (1); (ch = *data) != '\0'; data++) + { + if (! found[ch]) + obstack_1grow (obs, ch); + else if (map[ch]) + obstack_1grow (obs, map[ch]); } } @@ -1672,7 +1773,7 @@ static void substitute (struct obstack *obs, const char *victim, const char *repl, struct re_registers *regs) { - register unsigned int ch; + int ch; for (;;) { @@ -1931,7 +2032,7 @@ void expand_user_macro (struct obstack *obs, symbol *sym, int argc, token_data **argv) { - register const char *text; + const char *text; int i; for (text = SYMBOL_TEXT (sym); *text != '\0';) diff -ruNp m4-1.4.7/src/debug.c m4-1.4.8/src/debug.c --- m4-1.4.7/src/debug.c 2006-09-11 07:17:21.000000000 -0600 +++ m4-1.4.8/src/debug.c 2006-11-20 06:55:47.000000000 -0700 @@ -200,11 +200,11 @@ debug_flush_files (void) /*-------------------------------------------------------------------------. | Change the debug output to file NAME. If NAME is NULL, debug output is | -| reverted to stderr, and if empty debug output is discarded. Return TRUE | +| reverted to stderr, and if empty debug output is discarded. Return true | | iff the output stream was changed. | `-------------------------------------------------------------------------*/ -boolean +bool debug_set_output (const char *name) { FILE *fp; @@ -217,14 +217,14 @@ debug_set_output (const char *name) { fp = fopen (name, "a"); if (fp == NULL) - return FALSE; + 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; + return true; } /*-----------------------------------------------------------------------. @@ -271,7 +271,7 @@ trace_format (const char *fmt, ...) va_start (args, fmt); - while (TRUE) + while (true) { while ((ch = *fmt++) != '\0' && ch != '%') obstack_1grow (&trace, ch); @@ -352,7 +352,7 @@ trace_flush (void) char *line; obstack_1grow (&trace, '\0'); - line = obstack_finish (&trace); + line = (char *) obstack_finish (&trace); DEBUG_PRINT1 ("%s\n", line); obstack_free (&trace, line); } diff -ruNp m4-1.4.7/src/eval.c m4-1.4.8/src/eval.c --- m4-1.4.7/src/eval.c 2006-07-27 15:41:12.000000000 -0600 +++ m4-1.4.8/src/eval.c 2006-11-20 06:55:47.000000000 -0700 @@ -267,7 +267,7 @@ eval_lex (eval_t *val) | Main entry point, called from "eval". | `---------------------------------------*/ -boolean +bool evaluate (const char *expr, eval_t *val) { eval_token et; @@ -322,7 +322,7 @@ evaluate (const char *expr, eval_t *val) abort (); } - return (boolean) (err != NO_ERROR); + return err != NO_ERROR; } /*---------------------------. diff -ruNp m4-1.4.7/src/format.c m4-1.4.8/src/format.c --- m4-1.4.7/src/format.c 2006-07-22 15:43:27.000000000 -0600 +++ m4-1.4.8/src/format.c 2006-11-20 06:55:47.000000000 -0700 @@ -77,7 +77,7 @@ format (struct obstack *obs, int argc, t char *str; /* malloc'd buffer of formatted text */ enum {INT, UINT, LONG, ULONG, DOUBLE, STR} datatype; - fmt = ARG_STR (argc, argv); + fmt = (char *) ARG_STR (argc, argv); for (;;) { while ((c = *fmt++) != '%') diff -ruNp m4-1.4.7/src/freeze.c m4-1.4.8/src/freeze.c --- m4-1.4.7/src/freeze.c 2006-09-23 22:28:04.000000000 -0600 +++ m4-1.4.8/src/freeze.c 2006-11-20 06:55:47.000000000 -0700 @@ -222,14 +222,14 @@ reload_frozen_state (const char *name) } \ while (character == '\n') - file = path_search (name, NULL); + file = m4_path_search (name, NULL); if (file == NULL) M4ERROR ((EXIT_FAILURE, errno, "cannot open %s", name)); allocated[0] = 100; - string[0] = xmalloc ((size_t) allocated[0]); + string[0] = xcharalloc ((size_t) allocated[0]); allocated[1] = 100; - string[1] = xmalloc ((size_t) allocated[1]); + string[1] = xcharalloc ((size_t) allocated[1]); /* Validate format version. Only `1' is acceptable for now. */ GET_DIRECTIVE; @@ -285,7 +285,7 @@ reload_frozen_state (const char *name) { free (string[0]); allocated[0] = number[0] + 1; - string[0] = xmalloc ((size_t) allocated[0]); + string[0] = xcharalloc ((size_t) allocated[0]); } if (number[0] > 0) @@ -301,7 +301,7 @@ reload_frozen_state (const char *name) { free (string[1]); allocated[1] = number[1] + 1; - string[1] = xmalloc ((size_t) allocated[1]); + string[1] = xcharalloc ((size_t) allocated[1]); } if (number[1] > 0) diff -ruNp m4-1.4.7/src/input.c m4-1.4.8/src/input.c --- m4-1.4.7/src/input.c 2006-09-07 16:48:15.000000000 -0600 +++ m4-1.4.8/src/input.c 2006-11-20 06:55:47.000000000 -0700 @@ -49,11 +49,14 @@ pointer to the final text. The input_block *next is used to manage the coordination between the different push routines. - The current file and line number are stored in two global variables, - for use by the error handling functions in m4.c. Whenever a file - input_block is pushed, the current file name and line number is saved - in the input_block, and the two variables are reset to match the new - input file. */ + The current file and line number are stored in two global + variables, for use by the error handling functions in m4.c. Macro + expansion wants to report the line where a macro name was detected, + rather than where it finished collecting arguments. This also + applies to text resulting from macro expansions. So each input + block maintains its own notion of the current file and line, and + swapping between input blocks updates the global variables + accordingly. */ #ifdef ENABLE_CHANGEWORD #include "regex.h" @@ -61,9 +64,9 @@ enum input_type { - INPUT_FILE, - INPUT_STRING, - INPUT_MACRO + INPUT_STRING, /* String resulting from macro expansion. */ + INPUT_FILE, /* File from command line or include. */ + INPUT_MACRO /* Builtin resulting from defn. */ }; typedef enum input_type input_type; @@ -71,25 +74,24 @@ typedef enum input_type input_type; struct input_block { struct input_block *prev; /* previous input_block on the input stack */ - input_type type; /* INPUT_FILE, INPUT_STRING or INPUT_MACRO */ + input_type type; /* see enum values */ + const char *file; /* file where this input is from */ + int line; /* line where this input is from */ union { struct { - char *string; /* string value */ + char *string; /* remaining string value */ } - u_s; + u_s; /* INPUT_STRING */ struct { - FILE *file; /* input file handle */ - boolean end; /* true if peek has seen EOF */ - boolean close; /* true if we should close file on pop */ - const char *name; /* name of PREVIOUS input file */ - int lineno; /* current line of previous file */ - int out_lineno; /* current output line of previous file */ - boolean advance_line; /* start_of_input_line from next_char () */ + FILE *fp; /* input file handle */ + bool end : 1; /* true if peek has seen EOF */ + bool close : 1; /* true if we should close file on pop */ + bool advance_line : 1; /* track previous start_of_input_line */ } - u_f; + u_f; /* INPUT_FILE */ builtin_func *func; /* pointer to macro's function */ } u; @@ -107,6 +109,9 @@ int current_line; /* Obstack for storing individual tokens. */ static struct obstack token_stack; +/* Obstack for storing file names. */ +static struct obstack file_names; + /* Wrapup input stack. */ static struct obstack *wrapup_stack; @@ -114,7 +119,7 @@ static struct obstack *wrapup_stack; static struct obstack *current_input; /* Bottom of token_stack, for obstack_free. */ -static char *token_bottom; +static void *token_bottom; /* Pointer to top of current_input. */ static input_block *isp; @@ -126,7 +131,10 @@ static input_block *wsp; static input_block *next; /* Flag for next_char () to increment current_line. */ -static boolean start_of_input_line; +static bool start_of_input_line; + +/* Flag for next_char () to recognize change in input block. */ +static bool input_change; #define CHAR_EOF 256 /* character return on EOF */ #define CHAR_MACRO 257 /* character return for MACRO token */ @@ -166,7 +174,7 @@ static const char *token_type_string (to `-------------------------------------------------------------------*/ void -push_file (FILE *fp, const char *title, boolean close) +push_file (FILE *fp, const char *title, bool close) { input_block *i; @@ -182,18 +190,16 @@ push_file (FILE *fp, const char *title, i = (input_block *) obstack_alloc (current_input, sizeof (struct input_block)); i->type = INPUT_FILE; + i->file = (char *) obstack_copy0 (&file_names, title, strlen (title)); + i->line = 1; + input_change = true; - i->u.u_f.end = FALSE; + i->u.u_f.fp = fp; + i->u.u_f.end = false; i->u.u_f.close = close; - i->u.u_f.name = current_file; - i->u.u_f.lineno = current_line; - i->u.u_f.out_lineno = output_current_line; i->u.u_f.advance_line = start_of_input_line; - current_file = obstack_copy0 (current_input, title, strlen (title)); - current_line = 1; output_current_line = -1; - i->u.u_f.file = fp; i->prev = isp; isp = i; } @@ -218,6 +224,9 @@ push_macro (builtin_func *func) i = (input_block *) obstack_alloc (current_input, sizeof (struct input_block)); i->type = INPUT_MACRO; + i->file = current_file; + i->line = current_line; + input_change = true; i->u.func = func; i->prev = isp; @@ -242,6 +251,9 @@ push_string_init (void) next = (input_block *) obstack_alloc (current_input, sizeof (struct input_block)); next->type = INPUT_STRING; + next->file = current_file; + next->line = current_line; + return current_input; } @@ -265,10 +277,11 @@ push_string_finish (void) if (obstack_object_size (current_input) > 0) { obstack_1grow (current_input, '\0'); - next->u.u_s.string = obstack_finish (current_input); + next->u.u_s.string = (char *) obstack_finish (current_input); next->prev = isp; isp = next; ret = isp->u.u_s.string; /* for immediate use only */ + input_change = true; } else obstack_free (current_input, next); /* people might leave garbage on it. */ @@ -276,13 +289,14 @@ push_string_finish (void) return ret; } -/*--------------------------------------------------------------------------. -| The function push_wrapup () pushes a string on the wrapup stack. When | -| he normal input stack gets empty, the wrapup stack will become the input | -| stack, and push_string () and push_file () will operate on wrapup_stack. | -| Push_wrapup should be done as push_string (), but this will suffice, as | -| long as arguments to m4_m4wrap () are moderate in size. | -`--------------------------------------------------------------------------*/ +/*------------------------------------------------------------------. +| The function push_wrapup () pushes a string on the wrapup stack. | +| When the normal input stack gets empty, the wrapup stack will | +| become the input stack, and push_string () and push_file () will | +| operate on wrapup_stack. Push_wrapup should be done as | +| push_string (), but this will suffice, as long as arguments to | +| m4_m4wrap () are moderate in size. | +`------------------------------------------------------------------*/ void push_wrapup (const char *s) @@ -292,7 +306,9 @@ push_wrapup (const char *s) sizeof (struct input_block)); i->prev = wsp; i->type = INPUT_STRING; - i->u.u_s.string = obstack_copy0 (wrapup_stack, s, strlen (s)); + i->file = current_file; + i->line = current_line; + i->u.u_s.string = (char *) obstack_copy0 (wrapup_stack, s, strlen (s)); wsp = i; } @@ -317,43 +333,26 @@ pop_input (void) case INPUT_FILE: if (debug_level & DEBUG_TRACE_INPUT) { - if (isp->u.u_f.lineno) + if (tmp) DEBUG_MESSAGE2 ("input reverted to %s, line %d", - isp->u.u_f.name, isp->u.u_f.lineno); + tmp->file, tmp->line); else DEBUG_MESSAGE ("input exhausted"); } - if (ferror (isp->u.u_f.file)) + if (ferror (isp->u.u_f.fp)) { M4ERROR ((warning_status, 0, "read error")); - fclose (isp->u.u_f.file); + if (isp->u.u_f.close) + fclose (isp->u.u_f.fp); retcode = EXIT_FAILURE; } - else if (isp->u.u_f.close && fclose (isp->u.u_f.file) == EOF) + else if (isp->u.u_f.close && fclose (isp->u.u_f.fp) == 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) - { - /* 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; @@ -366,15 +365,16 @@ pop_input (void) next = NULL; /* might be set in push_string_init () */ isp = tmp; + input_change = true; } /*------------------------------------------------------------------------. | To switch input over to the wrapup stack, main () calls pop_wrapup (). | | Since wrapup text can install new wrapup text, pop_wrapup () returns | -| FALSE when there is no wrapup text on the stack, and TRUE otherwise. | +| false when there is no wrapup text on the stack, and true otherwise. | `------------------------------------------------------------------------*/ -boolean +bool pop_wrapup (void) { next = NULL; @@ -383,9 +383,13 @@ pop_wrapup (void) if (wsp == NULL) { + /* End of the program. Free all memory even though we are about + to exit, since it makes leak detection easier. */ + obstack_free (&token_stack, NULL); + obstack_free (&file_names, NULL); obstack_free (wrapup_stack, NULL); free (wrapup_stack); - return FALSE; + return false; } current_input = wrapup_stack; @@ -394,8 +398,9 @@ pop_wrapup (void) isp = wsp; wsp = NULL; + input_change = true; - return TRUE; + return true; } /*-------------------------------------------------------------------. @@ -429,28 +434,29 @@ static int peek_input (void) { int ch; + input_block *block = isp; while (1) { - if (isp == NULL) + if (block == NULL) return CHAR_EOF; - switch (isp->type) + switch (block->type) { case INPUT_STRING: - ch = to_uchar (isp->u.u_s.string[0]); + ch = to_uchar (block->u.u_s.string[0]); if (ch != '\0') return ch; break; case INPUT_FILE: - ch = getc (isp->u.u_f.file); + ch = getc (block->u.u_f.fp); if (ch != EOF) { - ungetc (ch, isp->u.u_f.file); + ungetc (ch, block->u.u_f.fp); return ch; } - isp->u.u_f.end = TRUE; + block->u.u_f.end = true; break; case INPUT_MACRO: @@ -461,12 +467,7 @@ peek_input (void) "INTERNAL ERROR: input stack botch in peek_input ()")); abort (); } - /* End of current input source --- pop one level if another - level still exists. */ - if (isp->prev != NULL) - pop_input (); - else - return CHAR_EOF; + block = block->prev; } } @@ -481,8 +482,9 @@ peek_input (void) `-------------------------------------------------------------------------*/ #define next_char() \ - (isp && isp->type == INPUT_STRING && isp->u.u_s.string[0] \ - ? to_uchar (*isp->u.u_s.string++) \ + (isp && isp->type == INPUT_STRING && isp->u.u_s.string[0] \ + && !input_change \ + ? to_uchar (*isp->u.u_s.string++) \ : next_char_1 ()) static int @@ -490,16 +492,21 @@ next_char_1 (void) { int ch; - if (start_of_input_line) - { - start_of_input_line = FALSE; - current_line++; - } - while (1) { if (isp == NULL) - return CHAR_EOF; + { + current_file = ""; + current_line = 0; + return CHAR_EOF; + } + + if (input_change) + { + current_file = isp->file; + current_line = isp->line; + input_change = false; + } switch (isp->type) { @@ -510,14 +517,20 @@ next_char_1 (void) break; case INPUT_FILE: + if (start_of_input_line) + { + start_of_input_line = false; + current_line = ++isp->line; + } + /* If stdin is a terminal, calling getc after peek_input already called it would make the user have to hit ^D twice to quit. */ - ch = isp->u.u_f.end ? EOF : getc (isp->u.u_f.file); + ch = isp->u.u_f.end ? EOF : getc (isp->u.u_f.fp); if (ch != EOF) { if (ch == '\n') - start_of_input_line = TRUE; + start_of_input_line = true; return ch; } break; @@ -557,34 +570,41 @@ skip_line (void) previous value we stored earlier. */ M4ERROR_AT_LINE ((warning_status, 0, file, line, "Warning: end of file treated as newline")); + /* On the rare occasion that dnl crosses include file boundaries + (either the input file did not end in a newline, or changeword + was used), calling next_char can update current_file and + current_line, and that update will be undone as we return to + expand_macro. This informs next_char to fix things again. */ + if (file != current_file || line != current_line) + input_change = true; } /*------------------------------------------------------------------. | 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 | +| 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 boolean -match_input (const char *s, boolean consume) +static bool +match_input (const char *s, bool consume) { int n; /* number of characters matched */ int ch; /* input character */ const char *t; - boolean result = FALSE; + bool result = false; ch = peek_input (); if (ch != to_uchar (*s)) - return FALSE; /* fail */ + return false; /* fail */ if (s[1] == '\0') { if (consume) (void) next_char (); - return TRUE; /* short match */ + return true; /* short match */ } (void) next_char (); @@ -595,8 +615,8 @@ match_input (const char *s, boolean cons if (*s == '\0') /* long match */ { if (consume) - return TRUE; - result = TRUE; + return true; + result = true; break; } } @@ -638,21 +658,25 @@ input_init (void) current_file = ""; current_line = 0; - obstack_init (&token_stack); - current_input = (struct obstack *) xmalloc (sizeof (struct obstack)); obstack_init (current_input); wrapup_stack = (struct obstack *) xmalloc (sizeof (struct obstack)); obstack_init (wrapup_stack); - obstack_1grow (&token_stack, '\0'); - token_bottom = obstack_finish (&token_stack); + obstack_init (&file_names); + + /* Allocate an object in the current chunk, so that obstack_free + will always work even if the first token parsed spills to a new + chunk. */ + obstack_init (&token_stack); + obstack_alloc (&token_stack, 1); + token_bottom = obstack_base (&token_stack); isp = NULL; wsp = NULL; next = NULL; - start_of_input_line = FALSE; + start_of_input_line = false; lquote.string = xstrdup (DEF_LQUOTE); lquote.length = strlen (lquote.string); @@ -669,10 +693,11 @@ input_init (void) } -/*--------------------------------------------------------------. -| Functions for setting quotes and comment delimiters. Used by | -| m4_changecom () and m4_changequote (). | -`--------------------------------------------------------------*/ +/*------------------------------------------------------------------. +| Functions for setting quotes and comment delimiters. Used by | +| m4_changecom () and m4_changequote (). Pass NULL if the argument | +| was not present, to distinguish from an explicit empty string. | +`------------------------------------------------------------------*/ void set_quotes (const char *lq, const char *rq) @@ -680,9 +705,24 @@ set_quotes (const char *lq, const char * free (lquote.string); free (rquote.string); - lquote.string = xstrdup (lq ? lq : DEF_LQUOTE); + /* POSIX states that with 0 arguments, the default quotes are used. + POSIX XCU ERN 112 states that behavior is implementation-defined + if there was only one argument, or if there is an empty string in + either position when there are two arguments. We allow an empty + left quote to disable quoting, but a non-empty left quote will + always create a non-empty right quote. See the texinfo for what + some other implementations do. */ + if (!lq) + { + lq = DEF_LQUOTE; + rq = DEF_RQUOTE; + } + else if (!rq || (*lq && !*rq)) + rq = DEF_RQUOTE; + + lquote.string = xstrdup (lq); lquote.length = strlen (lquote.string); - rquote.string = xstrdup (rq ? rq : DEF_RQUOTE); + rquote.string = xstrdup (rq); rquote.length = strlen (rquote.string); } @@ -692,9 +732,21 @@ set_comment (const char *bc, const char free (bcomm.string); free (ecomm.string); - bcomm.string = xstrdup (bc ? bc : DEF_BCOMM); + /* POSIX requires no arguments to disable comments. It requires + empty arguments to be used as-is, but this is counter to + traditional behavior, because a non-null begin and null end makes + it impossible to end a comment. An aardvark has been filed: + http://www.opengroup.org/austin/mailarchives/ag-review/msg02168.html + This implementation assumes the aardvark will be approved. See + the texinfo for what some other implementations do. */ + if (!bc) + bc = ec = ""; + else if (!ec || (*bc && !*ec)) + ec = DEF_ECOMM; + + bcomm.string = xstrdup (bc); bcomm.length = strlen (bcomm.string); - ecomm.string = xstrdup (ec ? ec : DEF_ECOMM); + ecomm.string = xstrdup (ec); ecomm.length = strlen (ecomm.string); } @@ -719,7 +771,7 @@ set_word_regexp (const char *regexp) if (!*regexp || !strcmp (regexp, DEFAULT_WORD_REGEXP)) { - default_word_regexp = TRUE; + default_word_regexp = true; return; } @@ -748,10 +800,10 @@ set_word_regexp (const char *regexp) regexp, msg)); } - default_word_regexp = FALSE; + default_word_regexp = false; if (word_start == NULL) - word_start = xmalloc (256); + word_start = (char *) xmalloc (256); word_start[0] = '\0'; test[1] = '\0'; @@ -787,14 +839,12 @@ next_token (token_data *td) token_type type; #ifdef ENABLE_CHANGEWORD int startpos; - char *orig_text = 0; + char *orig_text = NULL; #endif - const char *file = current_file; - int line = current_line; + const char *file; + int line; obstack_free (&token_stack, token_bottom); - obstack_1grow (&token_stack, '\0'); - token_bottom = obstack_finish (&token_stack); /* Can't consume character until after CHAR_MACRO is handled. */ ch = peek_input (); @@ -818,11 +868,13 @@ next_token (token_data *td) } next_char (); /* Consume character we already peeked at. */ - if (MATCH (ch, bcomm.string, TRUE)) + file = current_file; + line = current_line; + if (MATCH (ch, bcomm.string, true)) { obstack_grow (&token_stack, bcomm.string, bcomm.length); while ((ch = next_char ()) != CHAR_EOF - && !MATCH (ch, ecomm.string, TRUE)) + && !MATCH (ch, ecomm.string, true)) obstack_1grow (&token_stack, ch); if (ch != CHAR_EOF) obstack_grow (&token_stack, ecomm.string, ecomm.length); @@ -856,7 +908,8 @@ next_token (token_data *td) if (ch == CHAR_EOF) break; obstack_1grow (&token_stack, ch); - startpos = re_search (&word_regexp, obstack_base (&token_stack), + startpos = re_search (&word_regexp, + (char *) obstack_base (&token_stack), obstack_object_size (&token_stack), 0, 0, ®s); if (startpos != 0 || @@ -870,7 +923,7 @@ next_token (token_data *td) } obstack_1grow (&token_stack, '\0'); - orig_text = obstack_finish (&token_stack); + orig_text = (char *) obstack_finish (&token_stack); if (regs.start[1] != -1) obstack_grow (&token_stack,orig_text + regs.start[1], @@ -883,7 +936,7 @@ next_token (token_data *td) #endif /* ENABLE_CHANGEWORD */ - else if (!MATCH (ch, lquote.string, TRUE)) + else if (!MATCH (ch, lquote.string, true)) { switch (ch) { @@ -914,13 +967,13 @@ next_token (token_data *td) M4ERROR_AT_LINE ((EXIT_FAILURE, 0, file, line, "ERROR: end of file in string")); - if (MATCH (ch, rquote.string, TRUE)) + 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, TRUE)) + else if (MATCH (ch, lquote.string, true)) { quote_level++; obstack_grow (&token_stack, lquote.string, lquote.length); @@ -934,7 +987,7 @@ next_token (token_data *td) obstack_1grow (&token_stack, '\0'); TOKEN_DATA_TYPE (td) = TOKEN_TEXT; - TOKEN_DATA_TEXT (td) = obstack_finish (&token_stack); + TOKEN_DATA_TEXT (td) = (char *) obstack_finish (&token_stack); #ifdef ENABLE_CHANGEWORD if (orig_text == NULL) orig_text = TOKEN_DATA_TEXT (td); @@ -954,74 +1007,53 @@ next_token (token_data *td) token_type peek_token (void) { + token_type result; int ch = peek_input (); if (ch == CHAR_EOF) { -#ifdef DEBUG_INPUT - fprintf (stderr, "peek_token -> EOF\n"); -#endif - return TOKEN_EOF; + result = TOKEN_EOF; } - if (ch == CHAR_MACRO) + else if (ch == CHAR_MACRO) { -#ifdef DEBUG_INPUT - fprintf (stderr, "peek_token -> MACDEF\n"); -#endif - return TOKEN_MACDEF; + result = TOKEN_MACDEF; } - - if (MATCH (ch, bcomm.string, FALSE)) + else if (MATCH (ch, bcomm.string, false)) { -#ifdef DEBUG_INPUT - fprintf (stderr, "peek_token -> COMMENT\n"); -#endif - return TOKEN_STRING; + result = TOKEN_STRING; } - - if ((default_word_regexp && (isalpha (ch) || ch == '_')) + else 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; + result = TOKEN_WORD; } - - if (MATCH (ch, lquote.string, FALSE)) + else if (MATCH (ch, lquote.string, false)) { -#ifdef DEBUG_INPUT - fprintf (stderr, "peek_token -> QUOTE\n"); -#endif - return TOKEN_STRING; + result = TOKEN_STRING; } + else + switch (ch) + { + case '(': + result = TOKEN_OPEN; + break; + case ',': + result = TOKEN_COMMA; + break; + case ')': + result = TOKEN_CLOSE; + break; + default: + result = TOKEN_SIMPLE; + } - 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; - } + fprintf (stderr, "peek_token -> %s\n", token_type_string (result)); +#endif /* DEBUG_INPUT */ + return result; } diff -ruNp m4-1.4.7/src/m4.c m4-1.4.8/src/m4.c --- m4-1.4.7/src/m4.c 2006-09-20 22:13:22.000000000 -0600 +++ m4-1.4.8/src/m4.c 2006-11-20 06:55:47.000000000 -0700 @@ -65,8 +65,8 @@ const char *program_name; struct macro_definition { struct macro_definition *next; - int code; /* D, U or t */ - const char *macro; + int code; /* D, U, s, t, or '\1' */ + const char *arg; }; typedef struct macro_definition macro_definition; @@ -204,9 +204,6 @@ mismatch, or whatever value was passed t ", stdout); printf ("\nReport bugs to <%s>.\n", PACKAGE_BUGREPORT); } - - if (close_stream (stdout) != 0) - M4ERROR ((EXIT_FAILURE, errno, "write error")); exit (status); } @@ -260,10 +257,49 @@ static const struct option long_options[ where we try to continue execution in the meantime. */ int retcode; +/* Process a command line file NAME, and return true only if it was + stdin. */ +static bool +process_file (const char *name) +{ + bool result = false; + if (strcmp (name, "-") == 0) + { + /* If stdin is a terminal, we want to allow 'm4 - file -' + to read input from stdin twice, like GNU cat. Besides, + there is no point closing stdin before wrapped text, to + minimize bugs in syscmd called from wrapped text. */ + push_file (stdin, "stdin", false); + result = true; + } + else + { + char *full_name; + FILE *fp = m4_path_search (name, &full_name); + if (fp == NULL) + { + error (0, errno, "%s", name); + /* Set the status to EXIT_FAILURE, even though we + continue to process files after a missing file. */ + retcode = EXIT_FAILURE; + return false; + } + push_file (fp, full_name, true); + free (full_name); + } + expand_input (); + return result; +} + +/* POSIX requires only -D, -U, and -s; and says that the first two + must be recognized when interspersed with file names. Traditional + behavior also handles -s between files. Starting OPTSTRING with + '-' forces getopt_long to hand back file names as arguments to opt + '\1', rather than reordering the command line. */ #ifdef ENABLE_CHANGEWORD -#define OPTSTRING "B:D:EF:GH:I:L:N:PQR:S:T:U:W:d::eil:o:st:" +#define OPTSTRING "-B:D:EF:GH:I:L:N:PQR:S:T:U:W:d::eil:o:st:" #else -#define OPTSTRING "B:D:EF:GH:I:L:N:PQR:S:T:U:d::eil:o:st:" +#define OPTSTRING "-B:D:EF:GH:I:L:N:PQR:S:T:U:d::eil:o:st:" #endif int @@ -271,18 +307,20 @@ main (int argc, char *const *argv, char { macro_definition *head; /* head of deferred argument list */ macro_definition *tail; - macro_definition *new; + macro_definition *defn; int optchar; /* option character */ macro_definition *defines; - FILE *fp; - boolean read_stdin = FALSE; - boolean interactive = FALSE; + bool read_stdin = false; + bool interactive = false; + bool seen_file = false; + const char *debugfile = NULL; const char *frozen_file_to_read = NULL; const char *frozen_file_to_write = NULL; program_name = argv[0]; retcode = EXIT_SUCCESS; + atexit (close_stdout); include_init (); debug_init (); @@ -294,9 +332,8 @@ main (int argc, char *const *argv, char head = tail = NULL; - while (optchar = getopt_long (argc, (char **) argv, OPTSTRING, - long_options, NULL), - optchar != EOF) + while ((optchar = getopt_long (argc, (char **) argv, OPTSTRING, + long_options, NULL)) != -1) switch (optchar) { default: @@ -320,20 +357,21 @@ main (int argc, char *const *argv, char case 'D': case 'U': + case 's': case 't': - + case '\1': /* Arguments that cannot be handled until later are accumulated. */ - new = (macro_definition *) xmalloc (sizeof (macro_definition)); - new->code = optchar; - new->macro = optarg; - new->next = NULL; + defn = (macro_definition *) xmalloc (sizeof (macro_definition)); + defn->code = optchar; + defn->arg = optarg; + defn->next = NULL; if (head == NULL) - head = new; + head = defn; else - tail->next = new; - tail = new; + tail->next = defn; + tail = defn; break; @@ -394,7 +432,7 @@ main (int argc, char *const *argv, char error (0, 0, "Warning: `m4 -e' is deprecated, use `-i' instead"); /* fall through */ case 'i': - interactive = TRUE; + interactive = true; break; case 'l': @@ -409,27 +447,20 @@ main (int argc, char *const *argv, char or later is more widely established, as such a warning would interfere with all earlier versions of autoconf. */ case DEBUGFILE_OPTION: - if (!debug_set_output (optarg)) - error (0, errno, "%s", optarg); - break; - - case 's': - sync_output = 1; + /* Don't call debug_set_output here, as it has side effects. */ + debugfile = optarg; break; case VERSION_OPTION: - printf ("%s\n", PACKAGE_STRING); - fputs ("\ + printf ("%s\n", PACKAGE_STRING); + 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); + exit (EXIT_SUCCESS); break; case HELP_OPTION: @@ -439,7 +470,9 @@ Written by Rene' Seindal.\n\ defines = head; - /* Do the basic initialisations. */ + /* Do the basic initializations. */ + if (debugfile && !debug_set_output (debugfile)) + M4ERROR ((0, errno, "cannot set debug file `%s'", debugfile)); input_init (); output_init (); @@ -451,33 +484,53 @@ Written by Rene' Seindal.\n\ else builtin_init (); + /* Interactive mode means unbuffered output, and interrupts ignored. */ + + if (interactive) + { + signal (SIGINT, SIG_IGN); + setbuf (stdout, (char *) NULL); + } + /* Handle deferred command line macro definitions. Must come after - initialisation of the symbol table. */ + initialization of the symbol table. */ while (defines != NULL) { macro_definition *next; - char *macro_value; symbol *sym; switch (defines->code) { case 'D': - macro_value = strchr (defines->macro, '='); - if (macro_value == NULL) - macro_value = ""; - else - *macro_value++ = '\0'; - define_user_macro (defines->macro, macro_value, SYMBOL_INSERT); + { + /* defines->arg is read-only, so we need a copy. */ + char *macro_name = xstrdup (defines->arg); + char *macro_value = strchr (macro_name, '='); + if (macro_value) + *macro_value++ = '\0'; + define_user_macro (macro_name, macro_value, SYMBOL_INSERT); + free (macro_name); + } break; case 'U': - lookup_symbol (defines->macro, SYMBOL_DELETE); + lookup_symbol (defines->arg, SYMBOL_DELETE); break; case 't': - sym = lookup_symbol (defines->macro, SYMBOL_INSERT); - SYMBOL_TRACED (sym) = TRUE; + sym = lookup_symbol (defines->arg, SYMBOL_INSERT); + SYMBOL_TRACED (sym) = true; + break; + + case 's': + sync_output = 1; + break; + + case '\1': + seen_file = true; + if (process_file (defines->arg)) + read_stdin = true; break; default: @@ -491,55 +544,15 @@ Written by Rene' Seindal.\n\ defines = next; } - /* Interactive mode means unbuffered output, and interrupts ignored. */ - - if (interactive) - { - signal (SIGINT, SIG_IGN); - setbuf (stdout, (char *) NULL); - } - - /* Handle the various input files. Each file is pushed on the input, + /* Handle remaining input files. Each file is pushed on the input, and the input read. Wrapup text is handled separately later. */ - if (optind == argc) - { - /* No point closing stdin until after wrapped text is - processed. */ - push_file (stdin, "stdin", FALSE); - read_stdin = TRUE; - expand_input (); - } + if (optind == argc && !seen_file) + read_stdin = process_file ("-"); else for (; optind < argc; optind++) - { - if (strcmp (argv[optind], "-") == 0) - { - /* If stdin is a terminal, we want to allow 'm4 - file -' - to read input from stdin twice, like GNU cat. Besides, - there is no point closing stdin before wrapped text, to - minimize bugs in syscmd called from wrapped text. */ - push_file (stdin, "stdin", FALSE); - read_stdin = TRUE; - } - else - { - const char *name; - fp = path_search (argv[optind], &name); - if (fp == NULL) - { - error (0, errno, "%s", argv[optind]); - /* Set the status to EXIT_FAILURE, even though we - continue to process files after a missing file. */ - retcode = EXIT_FAILURE; - continue; - } - push_file (fp, name, TRUE); - free ((char *) name); - } - expand_input (); - } -#undef NEXTARG + if (process_file (defines->arg)) + read_stdin = true; /* Now handle wrapup text. */ @@ -563,8 +576,6 @@ Written by Rene' Seindal.\n\ make_diversion (0); undivert_all (); } - - if (close_stream (stdout) != 0) - M4ERROR ((EXIT_FAILURE, errno, "write error")); + output_exit (); exit (retcode); } diff -ruNp m4-1.4.7/src/m4.h m4-1.4.8/src/m4.h --- m4-1.4.7/src/m4.h 2006-09-23 22:28:04.000000000 -0600 +++ m4-1.4.8/src/m4.h 2006-11-20 06:55:47.000000000 -0700 @@ -25,52 +25,44 @@ #include -/* Canonicalize UNIX recognition macros. */ -#if defined unix || defined __unix || defined __unix__ \ - || defined _POSIX_VERSION || defined _POSIX2_VERSION \ - || defined __NetBSD__ || defined __OpenBSD__ \ - || defined __APPLE__ || defined __APPLE_CC__ -# define UNIX 1 -#endif - -/* Canonicalize Windows recognition macros. */ -#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__ -# define W32_NATIVE 1 -#endif - -/* Canonicalize OS/2 recognition macro. */ -#ifdef __EMX__ -# define OS2 1 -#endif - #include #include +#include #include #include #include "binary-io.h" +#include "clean-temp.h" #include "cloexec.h" #include "close-stream.h" +#include "closeout.h" #include "error.h" #include "exit.h" +#include "exitfail.h" #include "obstack.h" #include "stdio--.h" #include "stdlib--.h" #include "unistd--.h" #include "verror.h" #include "xalloc.h" +#include "xvasprintf.h" -/* 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 -/* Do not use `enum boolean': this tag is used in SVR4 . */ -typedef enum { FALSE = 0, TRUE = 1 } boolean; -#else -typedef int boolean; +/* Canonicalize UNIX recognition macros. */ +#if defined unix || defined __unix || defined __unix__ \ + || defined _POSIX_VERSION || defined _POSIX2_VERSION \ + || defined __NetBSD__ || defined __OpenBSD__ \ + || defined __APPLE__ || defined __APPLE_CC__ +# define UNIX 1 #endif -#if ! HAVE_MKSTEMP -int mkstemp (char *); +/* Canonicalize Windows recognition macros. */ +#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__ +# define W32_NATIVE 1 +#endif + +/* Canonicalize OS/2 recognition macro. */ +#ifdef __EMX__ +# define OS2 1 #endif /* Used for version mismatch, when -R detects a frozen file it can't parse. */ @@ -224,7 +216,7 @@ extern FILE *debug; void debug_init (void); int debug_decode (const char *); void debug_flush_files (void); -boolean debug_set_output (const char *); +bool debug_set_output (const char *); void debug_message_prefix (void); void trace_prepre (const char *, int); @@ -288,12 +280,12 @@ token_type next_token (token_data *); void skip_line (void); /* push back input */ -void push_file (FILE *, const char *, boolean); +void push_file (FILE *, const char *, bool); 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); +bool pop_wrapup (void); /* current input file, and line */ extern const char *current_file; @@ -319,6 +311,7 @@ extern int current_diversion; extern int output_current_line; void output_init (void); +void output_exit (void); void shipout_text (struct obstack *, const char *, int); void make_diversion (int); void insert_diversion (int); @@ -341,11 +334,11 @@ enum symbol_lookup struct symbol { struct symbol *next; - boolean traced : 1; - boolean shadowed : 1; - boolean macro_args : 1; - boolean blind_no_args : 1; - boolean deleted : 1; + bool traced : 1; + bool shadowed : 1; + bool macro_args : 1; + bool blind_no_args : 1; + bool deleted : 1; int pending_expansions; char *name; @@ -366,7 +359,7 @@ struct symbol typedef enum symbol_lookup symbol_lookup; typedef struct symbol symbol; -typedef void hack_symbol (); +typedef void hack_symbol (symbol *, void *); #define HASHMAX 509 /* default, overridden by -Hsize */ @@ -375,7 +368,7 @@ 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 hack_all_symbols (hack_symbol *, void *); /* File: macro.c --- macro expansion. */ @@ -387,9 +380,9 @@ void call_macro (symbol *, int, token_da struct builtin { const char *name; - boolean gnu_extension : 1; - boolean groks_macro_args : 1; - boolean blind_if_no_args : 1; + bool gnu_extension : 1; + bool groks_macro_args : 1; + bool blind_if_no_args : 1; builtin_func *func; }; @@ -418,7 +411,7 @@ const builtin *find_builtin_by_name (con void include_init (void); void include_env_init (void); void add_include_directory (const char *); -FILE *path_search (const char *, const char **); +FILE *m4_path_search (const char *, char **); /* File: eval.c --- expression evaluation. */ @@ -426,7 +419,7 @@ FILE *path_search (const char *, const c typedef int eval_t; typedef unsigned int unsigned_eval_t; -boolean evaluate (const char *, eval_t *); +bool evaluate (const char *, eval_t *); /* File: format.c --- printf like formatting. */ @@ -458,4 +451,8 @@ void reload_frozen_state (const char *); /* Convert a possibly-signed character to an unsigned character. This is a bit safer than casting to unsigned char, since it catches some type errors that the cast doesn't. */ +#if HAVE_INLINE static inline unsigned char to_uchar (char ch) { return ch; } +#else +# define to_uchar(C) ((unsigned char) (C)) +#endif diff -ruNp m4-1.4.7/src/macro.c m4-1.4.8/src/macro.c --- m4-1.4.7/src/macro.c 2006-08-08 17:17:44.000000000 -0600 +++ m4-1.4.8/src/macro.c 2006-11-20 06:55:47.000000000 -0700 @@ -33,6 +33,23 @@ int expansion_level = 0; /* The number of the current call of expand_macro (). */ static int macro_call_id = 0; +/* The shared stack of collected arguments for macro calls; as each + argument is collected, it is finished and its location stored in + argv_stack. Normally, this stack can be used simultaneously by + multiple macro calls; the exception is when an outer macro has + generated some text, then calls a nested macro, in which case the + nested macro must use a local stack to leave the unfinished text + alone. Too bad obstack.h does not provide an easy way to reopen a + finished object for further growth, but in practice this does not + hurt us too much. */ +static struct obstack argc_stack; + +/* The shared stack of pointers to collected arguments for macro + calls. This object is never finished; we exploit the fact that + obstack_blank is documented to take a negative size to reduce the + size again. */ +static struct obstack argv_stack; + /*----------------------------------------------------------------------. | This function read all input, and expands each token, one at a time. | `----------------------------------------------------------------------*/ @@ -43,8 +60,14 @@ expand_input (void) token_type t; token_data td; + obstack_init (&argc_stack); + obstack_init (&argv_stack); + while ((t = next_token (&td)) != TOKEN_EOF) expand_token ((struct obstack *) NULL, t, &td); + + obstack_free (&argc_stack, NULL); + obstack_free (&argv_stack, NULL); } @@ -111,7 +134,7 @@ expand_token (struct obstack *obs, token | obstack OBS, indirectly through expand_token (). | `-------------------------------------------------------------------------*/ -static boolean +static bool expand_argument (struct obstack *obs, token_data *argp) { token_type t; @@ -143,14 +166,14 @@ expand_argument (struct obstack *obs, to { /* The argument MUST be finished, whether we want it or not. */ obstack_1grow (obs, '\0'); - text = obstack_finish (obs); + text = (char *) obstack_finish (obs); if (TOKEN_DATA_TYPE (argp) == TOKEN_VOID) { TOKEN_DATA_TYPE (argp) = TOKEN_TEXT; TOKEN_DATA_TEXT (argp) = text; } - return (boolean) (t == TOKEN_COMMA); + return t == TOKEN_COMMA; } /* fallthru */ case TOKEN_OPEN: @@ -206,13 +229,13 @@ collect_arguments (symbol *sym, struct o { token_data td; token_data *tdp; - boolean more_args; - boolean groks_macro_args = SYMBOL_MACRO_ARGS (sym); + bool more_args; + bool groks_macro_args = SYMBOL_MACRO_ARGS (sym); TOKEN_DATA_TYPE (&td) = TOKEN_TEXT; TOKEN_DATA_TEXT (&td) = SYMBOL_NAME (sym); - tdp = (token_data *) obstack_copy (arguments, &td, sizeof (td)); - obstack_grow (argptr, &tdp, sizeof (tdp)); + tdp = (token_data *) obstack_copy (arguments, &td, sizeof td); + obstack_ptr_grow (argptr, tdp); if (peek_token () == TOKEN_OPEN) { @@ -224,11 +247,10 @@ collect_arguments (symbol *sym, struct o if (!groks_macro_args && TOKEN_DATA_TYPE (&td) == TOKEN_FUNC) { TOKEN_DATA_TYPE (&td) = TOKEN_TEXT; - TOKEN_DATA_TEXT (&td) = ""; + TOKEN_DATA_TEXT (&td) = (char *) ""; } - tdp = (token_data *) - obstack_copy (arguments, &td, sizeof (td)); - obstack_grow (argptr, &tdp, sizeof (tdp)); + tdp = (token_data *) obstack_copy (arguments, &td, sizeof td); + obstack_ptr_grow (argptr, tdp); } while (more_args); } @@ -278,18 +300,30 @@ call_macro (symbol *sym, int argc, token static void expand_macro (symbol *sym) { - struct obstack arguments; - struct obstack argptr; + struct obstack arguments; /* Alternate obstack if argc_stack is busy. */ + unsigned argv_base; /* Size of argv_stack on entry. */ + bool use_argc_stack = true; /* Whether argc_stack is safe. */ token_data **argv; int argc; struct obstack *expansion; const char *expanded; - boolean traced; + bool traced; int my_call_id; + /* Report errors at the location where the open parenthesis (if any) + was found, but after expansion, restore global state back to the + location of the close parenthesis. This is safe since we + guarantee that macro expansion does not alter the state of + current_file/current_line (dnl, include, and sinclude are special + cased in the input engine to ensure this fact). */ + const char *loc_open_file = current_file; + int loc_open_line = current_line; + const char *loc_close_file; + int loc_close_line; + SYMBOL_PENDING_EXPANSIONS (sym)++; expansion_level++; - if (expansion_level > nesting_limit) + if (nesting_limit > 0 && expansion_level > nesting_limit) M4ERROR ((EXIT_FAILURE, 0, "ERROR: recursion limit of %d exceeded, use -L to change it", nesting_limit)); @@ -297,18 +331,32 @@ expand_macro (symbol *sym) macro_call_id++; my_call_id = macro_call_id; - traced = (boolean) ((debug_level & DEBUG_TRACE_ALL) || SYMBOL_TRACED (sym)); + traced = (debug_level & DEBUG_TRACE_ALL) || SYMBOL_TRACED (sym); - obstack_init (&argptr); - obstack_init (&arguments); + argv_base = obstack_object_size (&argv_stack); + if (obstack_object_size (&argc_stack) > 0) + { + /* We cannot use argc_stack if this is a nested invocation, and an + outer invocation has an unfinished argument being + collected. */ + obstack_init (&arguments); + use_argc_stack = false; + } if (traced && (debug_level & DEBUG_TRACE_CALL)) trace_prepre (SYMBOL_NAME (sym), my_call_id); - collect_arguments (sym, &argptr, &arguments); + collect_arguments (sym, &argv_stack, + use_argc_stack ? &argc_stack : &arguments); - argc = obstack_object_size (&argptr) / sizeof (token_data *); - argv = (token_data **) obstack_finish (&argptr); + argc = ((obstack_object_size (&argv_stack) - argv_base) + / sizeof (token_data *)); + argv = (token_data **) ((char *) obstack_base (&argv_stack) + argv_base); + + loc_close_file = current_file; + loc_close_line = current_line; + current_file = loc_open_file; + current_line = loc_open_line; if (traced) trace_pre (SYMBOL_NAME (sym), my_call_id, argc, argv); @@ -320,12 +368,18 @@ expand_macro (symbol *sym) if (traced) trace_post (SYMBOL_NAME (sym), my_call_id, argc, argv, expanded); + current_file = loc_close_file; + current_line = loc_close_line; + --expansion_level; --SYMBOL_PENDING_EXPANSIONS (sym); if (SYMBOL_DELETED (sym)) free_symbol (sym); - obstack_free (&arguments, NULL); - obstack_free (&argptr, NULL); + if (use_argc_stack) + obstack_free (&argc_stack, argv[0]); + else + obstack_free (&arguments, NULL); + obstack_blank (&argv_stack, -argc * sizeof (token_data *)); } diff -ruNp m4-1.4.7/src/output.c m4-1.4.8/src/output.c --- m4-1.4.7/src/output.c 2006-08-18 17:11:37.000000000 -0600 +++ m4-1.4.8/src/output.c 2006-11-20 06:55:47.000000000 -0700 @@ -21,8 +21,11 @@ #include "m4.h" +#include #include +#include "gl_avltree_oset.h" + /* Size of initial in-memory buffer size for diversions. Small diversions would usually fit in. */ #define INITIAL_BUFFER_SIZE 512 @@ -40,24 +43,41 @@ This code is fairly entangled with the code in input.c, and maybe it belongs there? */ -/* In a struct diversion, only one of file or buffer be may non-NULL, - depending on the fact output is diverted to a file or in memory - buffer. Further, if buffer is NULL, then pointer is NULL, size and - unused are zero. */ +typedef struct temp_dir m4_temp_dir; + +/* When part of diversion_table, each struct m4_diversion either + represents an open file (zero size, non-NULL u.file), an in-memory + buffer (non-zero size, non-NULL u.buffer), or an unused placeholder + diversion (zero size, u is NULL, non-zero used indicates that a + file has been created). When not part of diversion_table, u.next + is a pointer to the free_list chain. */ + +typedef struct m4_diversion m4_diversion; -struct diversion +struct m4_diversion { - FILE *file; /* diversion file on disk */ - char *buffer; /* in-memory diversion buffer */ + union + { + FILE *file; /* diversion file on disk */ + char *buffer; /* in-memory diversion buffer */ + m4_diversion *next; /* free-list pointer */ + } u; + int divnum; /* which diversion this represents */ int size; /* usable size before reallocation */ int used; /* used length in characters */ }; -/* Table of diversions. */ -static struct diversion *diversion_table; +/* Table of diversions 1 through INT_MAX. */ +static gl_oset_t diversion_table; + +/* Diversion 0 (not part of diversion_table). */ +static m4_diversion div0; -/* Number of entries in diversion table. */ -static int diversions; +/* Linked list of reclaimed diversion storage. */ +static m4_diversion *free_list; + +/* Obstack from which diversion storage is allocated. */ +static struct obstack diversion_storage; /* Total size of all in-memory buffer sizes. */ static int total_buffer_size; @@ -67,7 +87,7 @@ static int total_buffer_size; int current_diversion; /* Current output diversion, NULL if output is being currently discarded. */ -static struct diversion *output_diversion; +static m4_diversion *output_diversion; /* Values of some output_diversion fields, cached out for speed. */ static FILE *output_file; /* current value of (file) */ @@ -76,27 +96,179 @@ static int output_unused; /* current val /* Number of input line we are generating output for. */ int output_current_line; + +/* Temporary directory holding all spilled diversion files. */ +static m4_temp_dir *output_temp_dir; + + /*------------------------. -| Output initialisation. | +| Output initialization. | `------------------------*/ +/* Callback for comparing list elements ELT1 and ELT2 for order in + diversion_table. */ +static int +cmp_diversion_CB (const void *elt1, const void *elt2) +{ + const m4_diversion *d1 = (const m4_diversion *) elt1; + const m4_diversion *d2 = (const m4_diversion *) elt2; + /* No need to worry about overflow, since we don't create diversions + with negative divnum. */ + return d1->divnum - d2->divnum; +} + +/* Callback for comparing list element ELT against THRESHOLD. */ +static bool +threshold_diversion_CB (const void *elt, const void *threshold) +{ + const m4_diversion *div = (const m4_diversion *) elt; + /* No need to worry about overflow, since we don't create diversions + with negative divnum. */ + return div->divnum >= *(const int *) threshold; +} + void output_init (void) { - diversion_table = (struct diversion *) xmalloc (sizeof (struct diversion)); - diversions = 1; - diversion_table[0].file = stdout; - diversion_table[0].buffer = NULL; - diversion_table[0].size = 0; - diversion_table[0].used = 0; - - total_buffer_size = 0; - current_diversion = 0; - output_diversion = diversion_table; + diversion_table = gl_oset_create_empty (GL_AVLTREE_OSET, cmp_diversion_CB); + div0.u.file = stdout; + output_diversion = &div0; output_file = stdout; - output_cursor = NULL; - output_unused = 0; + obstack_init (&diversion_storage); +} + +void +output_exit (void) +{ + /* Order is important, since we may have registered cleanup_tmpfile + as an atexit handler, and it must not traverse stale memory. */ + gl_oset_t table = diversion_table; + diversion_table = NULL; + gl_oset_free (table); + obstack_free (&diversion_storage, NULL); +} + +/* Clean up any temporary directory. Designed for use as an atexit + handler, where it is not safe to call exit() recursively; so this + calls _exit if a problem is encountered. */ +static void +cleanup_tmpfile (void) +{ + /* Close any open diversions. */ + bool fail = false; + + if (diversion_table) + { + const void *elt; + gl_oset_iterator_t iter = gl_oset_iterator (diversion_table); + while (gl_oset_iterator_next (&iter, &elt)) + { + m4_diversion *diversion = (m4_diversion *) elt; + if (!diversion->size && diversion->u.file + && close_stream_temp (diversion->u.file) != 0) + { + M4ERROR ((0, errno, + "cannot clean temporary file for diversion")); + fail = true; + } + } + gl_oset_iterator_free (&iter); + } + + /* Clean up the temporary directory. */ + if (cleanup_temp_dir (output_temp_dir) != 0) + fail = true; + if (fail) + _exit (exit_failure); +} + +/* Convert DIVNUM into a temporary file name for use in m4_tmp*. */ +static const char * +m4_tmpname (int divnum) +{ + static char *buffer; + static char *tail; + if (buffer == NULL) + { + tail = xasprintf ("%s/m4-%d", output_temp_dir->dir_name, INT_MAX); + buffer = obstack_copy0 (&diversion_storage, tail, strlen (tail)); + free (tail); + tail = strrchr (buffer, '-') + 1; + } + sprintf (tail, "%d", divnum); + return buffer; +} + +/* Create a temporary file for diversion DIVNUM open for reading and + writing in a secure temp directory. The file will be automatically + closed and deleted on a fatal signal. The file can be closed and + reopened with m4_tmpclose and m4_tmpopen; when finally done with + the file, close it with m4_tmpremove. Exits on failure, so the + return value is always an open file. */ +static FILE * +m4_tmpfile (int divnum) +{ + const char *name; + FILE *file; + + if (output_temp_dir == NULL) + { + errno = 0; + output_temp_dir = create_temp_dir ("m4-", NULL, true); + if (output_temp_dir == NULL) + M4ERROR ((EXIT_FAILURE, errno, + "cannot create temporary file for diversion")); + atexit (cleanup_tmpfile); + } + name = m4_tmpname (divnum); + register_temp_file (output_temp_dir, name); + errno = 0; + file = fopen_temp (name, O_BINARY ? "wb+" : "w+"); + if (file == NULL) + { + unregister_temp_file (output_temp_dir, name); + M4ERROR ((EXIT_FAILURE, errno, + "cannot create temporary file for diversion")); + } + else if (set_cloexec_flag (fileno (file), true) != 0) + M4ERROR ((warning_status, errno, + "Warning: cannot protect diversion across forks")); + return file; +} + +/* Reopen a temporary file for diversion DIVNUM for reading and + writing in a secure temp directory. Exits on failure, so the + return value is always an open file. */ +static FILE * +m4_tmpopen (int divnum) +{ + const char *name = m4_tmpname (divnum); + FILE *file; + + errno = 0; + file = fopen_temp (name, O_BINARY ? "ab+" : "a+"); + if (file == NULL) + M4ERROR ((EXIT_FAILURE, errno, + "cannot create temporary file for diversion")); + else if (set_cloexec_flag (fileno (file), true) != 0) + M4ERROR ((warning_status, errno, + "Warning: cannot protect diversion across forks")); + return file; +} + +/* Close, but don't delete, a temporary FILE. */ +static int +m4_tmpclose (FILE *file) +{ + return close_stream_temp (file); +} + +/* Delete a closed temporary FILE for diversion DIVNUM. */ +static int +m4_tmpremove (int divnum) +{ + return cleanup_temp_file (output_temp_dir, m4_tmpname (divnum)); } /*-----------------------------------------------------------------------. @@ -112,6 +284,7 @@ static void make_room_for (int length) { int wanted_size; + m4_diversion *selected_diversion = NULL; /* Compute needed size for in-memory buffer. Diversions in-memory buffers start at 0 bytes, then 512, then keep doubling until it is @@ -129,10 +302,12 @@ make_room_for (int length) if (total_buffer_size - output_diversion->size + wanted_size > MAXIMUM_TOTAL_SIZE) { - struct diversion *selected_diversion; int selected_used; - struct diversion *diversion; + char *selected_buffer; + m4_diversion *diversion; int count; + gl_oset_iterator_t iter; + const void *elt; /* Find out the buffer having most data, in view of flushing it to disk. Fake the current buffer as having already received the @@ -142,32 +317,34 @@ make_room_for (int length) selected_diversion = output_diversion; selected_used = output_diversion->used + length; - for (diversion = diversion_table + 1; - diversion < diversion_table + diversions; - diversion++) - if (diversion->used > selected_used) - { - selected_diversion = diversion; - selected_used = diversion->used; - } + iter = gl_oset_iterator (diversion_table); + while (gl_oset_iterator_next (&iter, &elt)) + { + diversion = (m4_diversion *) elt; + if (diversion->used > selected_used) + { + selected_diversion = diversion; + selected_used = diversion->used; + } + } + gl_oset_iterator_free (&iter); /* Create a temporary file, write the in-memory buffer of the - diversion to this file, then release the buffer. */ + diversion to this file, then release the buffer. Zero the + diversion before doing anything that can exit () (including + m4_tmpfile), so that the atexit handler doesn't try to close + a garbage pointer as a file. */ - selected_diversion->file = tmpfile (); - 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")); + selected_buffer = selected_diversion->u.buffer; + total_buffer_size -= selected_diversion->size; + selected_diversion->size = 0; + selected_diversion->u.file = NULL; + selected_diversion->u.file = m4_tmpfile (selected_diversion->divnum); if (selected_diversion->used > 0) { - count = fwrite (selected_diversion->buffer, - (size_t) selected_diversion->used, - 1, - selected_diversion->file); + count = fwrite (selected_buffer, (size_t) selected_diversion->used, + 1, selected_diversion->u.file); if (count != 1) M4ERROR ((EXIT_FAILURE, errno, "ERROR: cannot flush diversion to temporary file")); @@ -175,37 +352,39 @@ make_room_for (int length) /* Reclaim the buffer space for other diversions. */ - free (selected_diversion->buffer); - total_buffer_size -= selected_diversion->size; - - selected_diversion->buffer = NULL; - selected_diversion->size = 0; - selected_diversion->used = 0; + free (selected_buffer); + selected_diversion->used = 1; } /* Reload output_file, just in case the flushed diversion was current. */ - output_file = output_diversion->file; - if (output_file) + if (output_diversion == selected_diversion) { - /* The flushed diversion was current indeed. */ + output_file = output_diversion->u.file; output_cursor = NULL; output_unused = 0; } else { + /* Close any selected file since it is not the current diversion. */ + if (selected_diversion) + { + FILE *file = selected_diversion->u.file; + selected_diversion->u.file = 0; + if (m4_tmpclose (file) != 0) + M4ERROR ((0, errno, "cannot close temporary file for diversion")); + } - /* The buffer may be safely reallocated. */ - - output_diversion->buffer - = xrealloc (output_diversion->buffer, (size_t) wanted_size); + /* The current buffer may be safely reallocated. */ + output_diversion->u.buffer + = xrealloc (output_diversion->u.buffer, (size_t) wanted_size); total_buffer_size += wanted_size - output_diversion->size; output_diversion->size = wanted_size; - output_cursor = output_diversion->buffer + output_diversion->used; + output_cursor = output_diversion->u.buffer + output_diversion->used; output_unused = wanted_size - output_diversion->used; } } @@ -279,7 +458,7 @@ output_text (const char *text, int lengt void shipout_text (struct obstack *obs, const char *text, int length) { - static boolean start_of_output_line = TRUE; + static bool start_of_output_line = true; char line[20]; const char *cursor; @@ -325,7 +504,7 @@ shipout_text (struct obstack *obs, const { if (start_of_output_line) { - start_of_output_line = FALSE; + start_of_output_line = false; output_current_line++; #ifdef DEBUG_OUTPUT @@ -333,7 +512,7 @@ shipout_text (struct obstack *obs, const current_line, output_current_line); #endif - /* Output a `#line NUM' synchronisation directive if needed. + /* Output a `#line NUM' synchronization directive if needed. If output_current_line was previously given a negative value (invalidated), rather output `#line NUM "FILE"'. */ @@ -356,7 +535,7 @@ shipout_text (struct obstack *obs, const } OUTPUT_CHARACTER (*text); if (*text == '\n') - start_of_output_line = TRUE; + start_of_output_line = true; } } @@ -373,12 +552,30 @@ shipout_text (struct obstack *obs, const void make_diversion (int divnum) { - struct diversion *diversion; + m4_diversion *diversion = NULL; + + if (current_diversion == divnum) + return; if (output_diversion) { - output_diversion->file = output_file; - output_diversion->used = output_diversion->size - output_unused; + if (!output_diversion->size && !output_diversion->u.file) + { + if (!gl_oset_remove (diversion_table, output_diversion)) + error (EXIT_FAILURE, 0, "INTERNAL ERROR: make_diversion failed"); + output_diversion->u.next = free_list; + output_diversion->used = 0; + free_list = output_diversion; + } + else if (output_diversion->size) + output_diversion->used = output_diversion->size - output_unused; + else if (output_diversion->used) + { + FILE *file = output_diversion->u.file; + output_diversion->u.file = NULL; + if (m4_tmpclose (file) != 0) + M4ERROR ((0, errno, "cannot close temporary file for diversion")); + } output_diversion = NULL; output_file = NULL; output_cursor = NULL; @@ -390,26 +587,51 @@ make_diversion (int divnum) if (divnum < 0) return; - if (divnum >= diversions) + if (divnum == 0) + diversion = &div0; + else { - diversion_table = (struct diversion *) - xrealloc (diversion_table, (divnum + 1) * sizeof (struct diversion)); - for (diversion = diversion_table + diversions; - diversion <= diversion_table + divnum; - diversion++) + const void *elt; + if (gl_oset_search_atleast (diversion_table, threshold_diversion_CB, + &divnum, &elt)) { - diversion->file = NULL; - diversion->buffer = NULL; + m4_diversion *temp = (m4_diversion *) elt; + if (temp->divnum == divnum) + diversion = temp; + } + } + if (diversion == NULL) + { + /* First time visiting this diversion. */ + if (free_list) + { + diversion = free_list; + free_list = diversion->u.next; + } + else + { + diversion = (m4_diversion *) obstack_alloc (&diversion_storage, + sizeof *diversion); diversion->size = 0; diversion->used = 0; } - diversions = divnum + 1; + diversion->u.file = NULL; + diversion->divnum = divnum; + gl_oset_add (diversion_table, diversion); } - output_diversion = diversion_table + divnum; - output_file = output_diversion->file; - output_cursor = output_diversion->buffer + output_diversion->used; - output_unused = output_diversion->size - output_diversion->used; + output_diversion = diversion; + if (output_diversion->size) + { + output_cursor = output_diversion->u.buffer + output_diversion->used; + output_unused = output_diversion->size - output_diversion->used; + } + else + { + if (!output_diversion->u.file && output_diversion->used) + output_diversion->u.file = m4_tmpopen (output_diversion->divnum); + output_file = output_diversion->u.file; + } output_current_line = -1; } @@ -443,58 +665,82 @@ insert_file (FILE *file) } } -/*-------------------------------------------------------------------------. -| Insert diversion number DIVNUM into the current output file. The | -| diversion is NOT placed on the expansion obstack, because it must not be | -| rescanned. When the file is closed, it is deleted by the system. | -`-------------------------------------------------------------------------*/ +/*-------------------------------------------------------------------. +| Insert DIVERSION (but not div0) into the current output file. The | +| diversion is NOT placed on the expansion obstack, because it must | +| not be rescanned. When the file is closed, it is deleted by the | +| system. | +`-------------------------------------------------------------------*/ -void -insert_diversion (int divnum) +static void +insert_diversion_helper (m4_diversion *diversion) { - struct diversion *diversion; - - /* Do not care about unexisting diversions. Also, diversion 0 is stdout, - which is effectively always empty. */ - - if (divnum <= 0 || divnum >= diversions) - return; - - /* Also avoid undiverting into self. */ - - diversion = diversion_table + divnum; - if (diversion == output_diversion) - return; - /* Effectively undivert only if an output stream is active. */ - if (output_diversion) { - if (diversion->file) + if (diversion->size) + output_text (diversion->u.buffer, diversion->used); + else { - rewind (diversion->file); - insert_file (diversion->file); + if (!diversion->u.file && diversion->used) + diversion->u.file = m4_tmpopen (diversion->divnum); + if (diversion->u.file) + { + rewind (diversion->u.file); + insert_file (diversion->u.file); + } } - else if (diversion->buffer) - output_text (diversion->buffer, diversion->used); output_current_line = -1; } /* Return all space used by the diversion. */ - - if (diversion->file) - { - fclose (diversion->file); - diversion->file = NULL; - } - else if (diversion->buffer) + if (diversion->size) { - free (diversion->buffer); - diversion->buffer = NULL; + free (diversion->u.buffer); diversion->size = 0; diversion->used = 0; } + else + { + if (diversion->u.file) + { + FILE *file = diversion->u.file; + diversion->u.file = NULL; + diversion->used = 0; + if (m4_tmpclose (file) != 0) + M4ERROR ((0, errno, "cannot clean temporary file for diversion")); + } + if (m4_tmpremove (diversion->divnum) != 0) + M4ERROR ((0, errno, "cannot clean temporary file for diversion")); + } + gl_oset_remove (diversion_table, diversion); + diversion->u.next = free_list; + free_list = diversion; +} + +/*-------------------------------------------------------------------------. +| Insert diversion number DIVNUM into the current output file. The | +| diversion is NOT placed on the expansion obstack, because it must not be | +| rescanned. When the file is closed, it is deleted by the system. | +`-------------------------------------------------------------------------*/ + +void +insert_diversion (int divnum) +{ + const void *elt; + + /* Do not care about nonexistent diversions, and undiverting stdout + or self is a no-op. */ + if (divnum <= 0 || current_diversion == divnum) + return; + if (gl_oset_search_atleast (diversion_table, threshold_diversion_CB, + &divnum, &elt)) + { + m4_diversion *diversion = (m4_diversion *) elt; + if (diversion->divnum == divnum) + insert_diversion_helper (diversion); + } } /*-------------------------------------------------------------------------. @@ -505,10 +751,15 @@ insert_diversion (int divnum) void undivert_all (void) { - int divnum; - - for (divnum = 1; divnum < diversions; divnum++) - insert_diversion (divnum); + const void *elt; + gl_oset_iterator_t iter = gl_oset_iterator (diversion_table); + while (gl_oset_iterator_next (&iter, &elt)) + { + m4_diversion *diversion = (m4_diversion *) elt; + if (diversion->divnum != current_diversion) + insert_diversion_helper (diversion); + } + gl_oset_iterator_free (&iter); } /*-------------------------------------------------------------. @@ -520,36 +771,42 @@ freeze_diversions (FILE *file) { int saved_number; int last_inserted; - int divnum; - struct diversion *diversion; - struct stat file_stat; + gl_oset_iterator_t iter; + const void *elt; saved_number = current_diversion; last_inserted = 0; make_diversion (0); output_file = file; /* kludge in the frozen file */ - for (divnum = 1; divnum < diversions; divnum++) + iter = gl_oset_iterator (diversion_table); + while (gl_oset_iterator_next (&iter, &elt)) { - diversion = diversion_table + divnum; - if (diversion->file || diversion->buffer) + m4_diversion *diversion = (m4_diversion *) elt;; + if (diversion->size || diversion->u.file) { - if (diversion->file) + if (diversion->size) + fprintf (file, "D%d,%d\n", diversion->divnum, diversion->used); + else { - fflush (diversion->file); - if (fstat (fileno (diversion->file), &file_stat) < 0) + struct stat file_stat; + fflush (diversion->u.file); + if (fstat (fileno (diversion->u.file), &file_stat) < 0) M4ERROR ((EXIT_FAILURE, errno, "cannot stat diversion")); - fprintf (file, "D%d,%d", divnum, (int) file_stat.st_size); + if (file_stat.st_size < 0 + || file_stat.st_size != (unsigned long int) file_stat.st_size) + M4ERROR ((EXIT_FAILURE, 0, "diversion too large")); + fprintf (file, "D%d,%lu", diversion->divnum, + (unsigned long int) file_stat.st_size); } - else - fprintf (file, "D%d,%d\n", divnum, diversion->used); - insert_diversion (divnum); + insert_diversion_helper (diversion); putc ('\n', file); - last_inserted = divnum; + last_inserted = diversion->divnum; } } + gl_oset_iterator_free (&iter); /* Save the active diversion number, if not already. */ diff -ruNp m4-1.4.7/src/path.c m4-1.4.8/src/path.c --- m4-1.4.7/src/path.c 2006-08-18 17:11:37.000000000 -0600 +++ m4-1.4.8/src/path.c 2006-11-20 06:55:48.000000000 -0700 @@ -51,14 +51,18 @@ include_env_init (void) { char *path; char *path_end; + char *env_path; if (no_gnu_extensions) return; - path = getenv ("M4PATH"); - if (path == NULL) + env_path = getenv ("M4PATH"); + if (env_path == NULL) return; + env_path = xstrdup (env_path); + path = env_path; + do { path_end = strchr (path, ':'); @@ -68,6 +72,7 @@ include_env_init (void) path = path_end + 1; } while (path_end); + free (env_path); } void @@ -106,7 +111,7 @@ add_include_directory (const char *dir) respect to the current working directory. */ FILE * -path_search (const char *file, const char **result) +m4_path_search (const char *file, char **result) { FILE *fp; includes *incl; @@ -149,7 +154,7 @@ path_search (const char *file, const cha strcpy (name + incl->len + 1, file); #ifdef DEBUG_INCL - fprintf (stderr, "path_search (%s) -- trying %s\n", file, name); + fprintf (stderr, "m4_path_search (%s) -- trying %s\n", file, name); #endif fp = fopen (name, "r"); diff -ruNp m4-1.4.7/src/symtab.c m4-1.4.8/src/symtab.c --- m4-1.4.7/src/symtab.c 2006-07-30 17:46:51.000000000 -0600 +++ m4-1.4.8/src/symtab.c 2006-11-20 06:55:48.000000000 -0700 @@ -101,7 +101,7 @@ symtab_init (void) size_t i; symbol **s; - s = symtab = (symbol **) xmalloc (hash_table_size * sizeof (symbol *)); + s = symtab = (symbol **) xnmalloc (hash_table_size, sizeof (symbol *)); for (i = 0; i < hash_table_size; i++) s[i] = NULL; @@ -141,7 +141,7 @@ void free_symbol (symbol *sym) { if (SYMBOL_PENDING_EXPANSIONS (sym) > 0) - SYMBOL_DELETED (sym) = TRUE; + SYMBOL_DELETED (sym) = true; else { free (SYMBOL_NAME (sym)); @@ -211,16 +211,16 @@ lookup_symbol (const char *name, symbol_ if (SYMBOL_PENDING_EXPANSIONS (sym) > 0) { symbol *old = sym; - SYMBOL_DELETED (old) = TRUE; + SYMBOL_DELETED (old) = true; sym = (symbol *) xmalloc (sizeof (symbol)); SYMBOL_TYPE (sym) = TOKEN_VOID; SYMBOL_TRACED (sym) = SYMBOL_TRACED (old); SYMBOL_NAME (sym) = xstrdup (name); - SYMBOL_SHADOWED (sym) = FALSE; - SYMBOL_MACRO_ARGS (sym) = FALSE; - SYMBOL_BLIND_NO_ARGS (sym) = FALSE; - SYMBOL_DELETED (sym) = FALSE; + SYMBOL_SHADOWED (sym) = false; + SYMBOL_MACRO_ARGS (sym) = false; + SYMBOL_BLIND_NO_ARGS (sym) = false; + SYMBOL_DELETED (sym) = false; SYMBOL_PENDING_EXPANSIONS (sym) = 0; SYMBOL_NEXT (sym) = SYMBOL_NEXT (old); @@ -239,12 +239,12 @@ lookup_symbol (const char *name, symbol_ sym = (symbol *) xmalloc (sizeof (symbol)); SYMBOL_TYPE (sym) = TOKEN_VOID; - SYMBOL_TRACED (sym) = FALSE; + SYMBOL_TRACED (sym) = false; SYMBOL_NAME (sym) = xstrdup (name); - SYMBOL_SHADOWED (sym) = FALSE; - SYMBOL_MACRO_ARGS (sym) = FALSE; - SYMBOL_BLIND_NO_ARGS (sym) = FALSE; - SYMBOL_DELETED (sym) = FALSE; + SYMBOL_SHADOWED (sym) = false; + SYMBOL_MACRO_ARGS (sym) = false; + SYMBOL_BLIND_NO_ARGS (sym) = false; + SYMBOL_DELETED (sym) = false; SYMBOL_PENDING_EXPANSIONS (sym) = 0; SYMBOL_NEXT (sym) = *spp; @@ -252,7 +252,7 @@ lookup_symbol (const char *name, symbol_ if (mode == SYMBOL_PUSHDEF && cmp == 0) { - SYMBOL_SHADOWED (SYMBOL_NEXT (sym)) = TRUE; + SYMBOL_SHADOWED (SYMBOL_NEXT (sym)) = true; SYMBOL_TRACED (sym) = SYMBOL_TRACED (SYMBOL_NEXT (sym)); } return sym; @@ -270,12 +270,12 @@ lookup_symbol (const char *name, symbol_ if (cmp != 0 || sym == NULL) return NULL; { - boolean traced = FALSE; + bool traced = false; if (SYMBOL_NEXT (sym) != NULL && SYMBOL_SHADOWED (SYMBOL_NEXT (sym)) && mode == SYMBOL_POPDEF) { - SYMBOL_SHADOWED (SYMBOL_NEXT (sym)) = FALSE; + SYMBOL_SHADOWED (SYMBOL_NEXT (sym)) = false; SYMBOL_TRACED (SYMBOL_NEXT (sym)) = SYMBOL_TRACED (sym); } else @@ -292,12 +292,12 @@ lookup_symbol (const char *name, symbol_ { sym = (symbol *) xmalloc (sizeof (symbol)); SYMBOL_TYPE (sym) = TOKEN_VOID; - SYMBOL_TRACED (sym) = TRUE; + SYMBOL_TRACED (sym) = true; SYMBOL_NAME (sym) = xstrdup (name); - SYMBOL_SHADOWED (sym) = FALSE; - SYMBOL_MACRO_ARGS (sym) = FALSE; - SYMBOL_BLIND_NO_ARGS (sym) = FALSE; - SYMBOL_DELETED (sym) = FALSE; + SYMBOL_SHADOWED (sym) = false; + SYMBOL_MACRO_ARGS (sym) = false; + SYMBOL_BLIND_NO_ARGS (sym) = false; + SYMBOL_DELETED (sym) = false; SYMBOL_PENDING_EXPANSIONS (sym) = 0; SYMBOL_NEXT (sym) = *spp; @@ -325,7 +325,7 @@ lookup_symbol (const char *name, symbol_ `-----------------------------------------------------------------*/ void -hack_all_symbols (hack_symbol *func, const char *data) +hack_all_symbols (hack_symbol *func, void *data) { size_t h; symbol *sym; @@ -339,7 +339,7 @@ hack_all_symbols (hack_symbol *func, con for (sym = symtab[h]; sym != NULL; sym = next) { next = SYMBOL_NEXT (sym); - (*func) (sym, data); + func (sym, data); } } }