1 GNU m4 NEWS - History of user-visible changes. -*- outline -*-
2 Copyright (C) 1992, 1993, 1994, 1998, 2000, 2001, 2006, 2007, 2008, 2009
3 Free Software Foundation, Inc.
5 * Noteworthy changes in Version 1.9b (200x-??-??) [beta]
6 Released by ????, based on git version 1.9a-*
8 NOTE - there are still a number of FIXMEs to resolve before this can be
13 *** The build environment has been updated to modern GNU practices,
14 depending on newer features of Autoconf, Automake, Libtool, Gettext,
15 and Gnulib to be more portable to a wide variety of platforms.
17 ** New command line behavior
19 *** If the POSIXLY_CORRECT environment variable is set, it implies the
20 `-G' and `-Q' options, effectively giving a more fully POSIX-compliant
21 implementation with only compatible GNU extensions.
23 *** New `-b'/`--batch' command-line option to force non-interactive mode.
24 Also, in addition to `-e'/`--interactive' requesting interactive mode,
25 m4 now follows the lead of sh, and automatically enters interactive
26 mode when there are no files specified, and when both standard input
27 and standard error are terminals.
29 *** New `-B'/`--prepend-include' command-line option allows prepending to
30 the include path, rather than always searching `.' first.
32 *** New `--debuglen' command-line option matches the spelling of a new
33 macro, and the old spelling `--arglength' now issues a warning that it
34 might be withdrawn in the future.
36 *** The `-g'/`--gnu' command-line option is now required to allow all GNU
37 extensions when POSIXLY_CORRECT is set.
39 *** The `-H'/`--hashsize' command-line options, which were made no-ops in
40 a previous beta, now issue a deprecation warning.
42 *** The `-L'/`--nesting-limit' command-line option now performs argument
43 validation and accepts an optional multiplier suffix.
45 *** The `-o'/`--error-output' command-line options, which were replaced by
46 `--debugfile' in M4 1.4.7, now issue a deprecation warning. This
47 warning interferes with all versions of Autoconf prior to 2.61, so plan
48 on installing an updated Autoconf when installing M4 2.0.
50 *** New `-p'/`--pushdef' and `--popdef' command-line options allow more
51 control over macro definitions from the command line between input
54 *** New `--posix' command-line option is a synonym for `-G'/`--traditional'.
56 *** New `-r'/`--regexp-syntax' command-line option changes the default
57 regular expression syntax used by M4. Without this option, M4
58 continues to use EMACS style expressions. A new section in the info
59 docs explains the differences between them, and what builtins are
62 *** New `--safer' command-line option cripples the potentially unsafe
63 builtins `debugfile', `esyscmd', `maketemp', `mkdtemp', `mkstemp', and
66 *** New `--syncoutput' command-line option matches the builtin added in a
67 previous beta, and provides more control over sync line generation
68 from the command line between input files. The previous options
69 `-s'/`--synclines' remain as aliases for `--syncoutput=1'.
71 *** New `--traceoff' command-line option, and new spelling `--traceon' for
72 `--trace', allow more control over macro tracing from the command line
75 *** New `--unload-module' command-line option allows more control over
76 dynamic modules from the command line. Also, `-m'/`--load-module' now
77 acts between input files.
79 *** New `--warnings' command-line option re-enables warnings, overriding
80 `-Q'/`--quiet'/`--silent', allowing warnings even when POSIXLY_CORRECT.
84 *** The `defn' builtin now allows any number of arguments, as POSIX requires.
85 - FIXME: This still doesn't work with concatenating builtins with text.
87 - FIXME: POSIX recommends using ${10} instead of $10 for the tenth
88 positional argument. We should deprecate $10.
92 *** The experimental `epatsubst' and `eregexp' builtins have been removed
93 in favor of a new `changeresyntax' builtin.
97 *** New `changeresyntax' builtin allows programmatic setting of the default
98 regular expression flavor, to match `-r'/`--regexp-syntax' command-line
101 *** New `debuglen' builtin allows runtime setting of debug output length,
102 previously controlled only by the `-l' command line argument.
103 Additionally, whether using the new macro or the command line argument,
104 the length limitation now affects dumpdef output as well as trace
105 output, undergoes argument validation, and accepts an optional
107 - FIXME the multiplier suffix isn't reliable yet
109 *** New `mkdtemp' builtin parallels `mkstemp', but allows the creation of
110 temporary directories instead of files.
112 *** New `refcount' builtin allows tracking how many times a module has
114 - FIXME: consider making m4modules smarter for this purpose
116 *** New `renamesyms' builtin allows programmatic renaming of all symbols
117 according to a regular expression.
118 - FIXME: This feature can cause core dumps when renaming multiple
119 symbols to the same name.
121 *** New `__traditional__' builtin identifies when the traditional module
122 is loaded instead of the gnu module.
124 *** The `modules' and `symbols' builtins, introduced in previous betas,
125 have been renamed `m4modules' and `m4symbols', in order to minimize
126 problems when upgrading from 1.4.x and processing English text. To
127 prevent future problems, any future macro added as a GNU extension will
128 either be blind (ie. be unrecognized without arguments), or begin with
129 the prefix `m4' or `__'.
131 ** Changed behavior of builtins
133 *** The module identifier builtins, such as `__gnu__', `__m4_version__',
134 and `__unix__', now warn if given arguments.
136 *** The `builtin' builtin now has a special form, where if the first
137 argument is exactly the special token representing defn(`builtin'), the
138 expansion is the special token representing the builtin named in the
139 second argument. This allows regenerating a macro with a more
140 efficient mapping directly to a builtin function, rather than through
141 textual indirection through further expansions of `builtin'.
143 *** The `changecom' builtin semantics now match traditional
144 implementations; if the start-comment string resembles a macro name or
145 the start-quote string, comments are effectively disabled.
147 *** The `changesyntax' builtin has been improved, to make it easier to add
148 and remove characters from a syntax class without having to specify the
149 entire set of characters in that class. It also supports new syntax
150 categories, `$', `{' and `}', for extended argument handling in macro
151 definitions. See the manual for more examples.
153 *** New `m' flag to `-d'/`--debug' command-line option or `debugmode'
154 builtin traces actions related to module loading and unloading, and
155 affects `dumpdef' and trace output to show where builtins come from.
156 New `s' flag shows the entire stack of `pushdef' definitions during
157 `dumpdef'. The `c' flag has been updated to add information to the
158 first line to show the definition of the macro being expanded.
160 *** The `eval' and `mpeval' builtins now support the following new
161 operators: `>>>', `\', and `,'.
163 *** The `maketemp' builtin now always warns that it is obsolete, even in GNU
164 mode where it uses the same secure algorithm as `mkstemp', because of
165 the recommendation of POSIX to obsolete `maketemp' as inherently
166 insecure when obeying POSIX.
168 *** The `m4symbols' builtin now warns if given a builtin token instead of
169 a macro name. It remains silent for undefined macros.
171 *** The `patsubst' and `regexp' builtins have a new optional 4th argument
172 to use a different regular expression syntax for the duration of that
175 *** The semantics of the `traceon' and `traceoff' builtins now match
176 traditional implementations: when called without arguments, they affect
177 global state rather than affecting only the macros defined at that
178 moment. The manual includes an example of how to recover 1.4.x
183 *** The syntax of frozen files format V2 has been improved to save
184 additional state. This includes the `R' directive for default regular
185 expression syntax, the `t' directive for traced macros, and the `d'
186 directive for debug mode. Existing directives with consecutive strings
187 now require an intermediate newline, for faster parsing. Also, a V2
188 file can now be represented completely in ASCII, thanks to escape
189 sequences. Unfortunately, files frozen by M4 1.4q cannot be read by
190 1.9b, but since 1.4q was not widely distributed, this is not expected
191 to be much of an issue, and comes with the territory of using a beta
193 - FIXME: format 2 still needs to catch more missing state; once 2.0 is
194 released, any further changes would introduce format 3.
196 *** Improvements made in the 1.4.x and 1.6 stable series have been
200 * Noteworthy changes in Version 1.6 (????-??-??) [stable]
201 Released by ????, based on git versions 1.4.10b.x-* and 1.5.*
203 ** Fix regression introduced in 1.4.4b where using `traceon' could delete
204 a macro. This was most noticeable with `traceon(`traceon')', but
205 would also happen in cases such as `foo(traceon(`foo'))'.
207 ** Fix regressions introduced in 1.4.10b:
208 *** Using `builtin' or `indir' to perform nested `shift' calls triggered
209 an assertion failure (not present in 1.4.11).
210 *** The command-line option -dV, as well as the builtin `debugmode(V)',
211 failed to enable `t' and `c' debug options (not present in 1.4.11).
212 *** Comments that contain unbalanced quotes were not rescanned correctly
213 when passed through $@ (not present in 1.4.11).
214 *** Using `defn' on a traced but undefined macro triggered an assertion
215 failure (also present in 1.4.11, but not 1.4.12).
217 ** Remove the undocumented command-line option '-N', as no one complained
218 about the assertion failure regression that it introduced in 1.4.7.
220 ** Fix the `m4wrap' builtin to accumulate wrapped text in FIFO order, as
221 required by POSIX. The manual mentions a way to restore the LIFO order
222 present in earlier GNU M4 versions. NOTE: this change exposes a bug
223 in Autoconf 2.59 and earlier (which was fixed in Autoconf 2.60).
225 If you want your package to work with pre-installed Autoconf without
226 requiring 2.60, then add these lines to your project's configure.ac,
227 prior to calling AC_INIT:
229 # As long as this project is not ready to upgrade to autoconf 2.60
230 # or newer, make sure that newer M4 will still use LIFO order:
231 m4_define([m4_wrap], [m4_ifdef([_$0_text],
232 [m4_define([_$0_text], [$1]m4_defn([_$0_text]))],
233 [m4_define([_$0_text], [$1])m4_builtin([m4wrap],
234 [m4_default(m4_defn([_$0_text])m4_undefine([_$0_text]))])])])
236 On the other hand, if you want to install Autoconf 2.59 or earlier,
237 then apply this patch:
238 http://git.sv.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=56d42fa71
240 ** The `divert' builtin now accepts an optional second argument of text
241 that is immediately placed in the new diversion, regardless of whether
242 the current expansion is nested within argument collection of another
243 macro. It has also been optimized for faster performance.
245 ** The `substr' builtin now treats negative arguments as indices relative
246 to the end of the string, and accepts an optional fourth argument of
247 text to supply in place of the selected substring. The manual gives an
248 example of how to recover M4 1.4.x behavior, as well as an example of
249 simulating the new negative argument semantics with older M4.
251 ** The `index' builtin now takes an optional third argument as the index
252 to begin searching from, with a negative argument relative to the end of
255 ** The `-d'/`--debug' command-line option now understands `-' and `+'
256 modifiers, the way the builtin `debugmode' has always done; this allows
257 `-d-V' to disable prior debug settings from the command line, similar to
258 using the builtin `debugmode' without arguments. The option
259 `--debugmode' is added as an alias for `-d'. The new flag `d' is added
260 to control whether dereferencing an undefined macro causes a warning;
261 this flag is enabled by default if neither `-d' nor `-E' are specified.
262 The new flag `o' is added to control whether `dumpdef' outputs to stderr
263 or the current `debugfile' location. When the command line option is
264 given the empty string, the mode is treated as `+adeq' instead of `aeq'.
265 Also, the position of `-d' with respect to files on the command line is
268 ** A new predefined text macro, `__m4_version__', expands to the unquoted
269 version number of M4, if GNU extensions are enabled. While you should
270 generally favor feature tests over version number checks, this macro can
271 be used, via `defn', to determine whether the version of m4 processing
272 your file is adequate.
274 ** The `defn', `popdef', and `undefine' builtins gained a new warning when
275 operating on an undefined macro name, to match the warning already
276 present in `builtin', `indir', and `dumpdef'. For backwards
277 compatibility, the warning can be disabled by using `debugmode(`-d')'
278 (or the command line option `--debug=-d'). The flag is also cleared by
279 the command line option `-E'/`--fatal-warnings', so that scripts written
280 for 1.4.x do not cause the script to fail because of new warnings.
282 ** Enhance the `indir' builtin to trace indirect macros, where the trace
283 is requested via `traceon' or the command-line option `-t'. Previously,
284 it was impossible to trace macro names such as `foo-bar' which could
285 only be invoked indirectly, without relying on global tracing (such as
286 with `debugmode(`t')') or the experimental `changeword'.
288 ** Aspects of tracing output that were previously undocumented have been
289 slightly altered, and the effect of the builtin `debugmode' on trace
290 output is more fully documented. As POSIX does not specify trace output
291 format, parsing such output is inherently fragile in the first place.
292 The intent is that future M4 versions will not change documented trace
293 output without adding additional `debugmode' flags.
295 ** Enhance the `ifdef', `ifelse', and `shift' builtins, as well as all
296 user macros, to transparently handle builtin tokens generated by `defn'.
298 ** Allow the concatenation of builtin macros with arbitrary text in
299 several contexts, via the `defn' builtin or argument expansion, rather
300 than warning and converting the builtin token to an empty string.
301 However, it is still not possible to use a concatenated builtin when
304 ** Enhance the `defn', `dumpdef', `ifdef', `popdef', `traceon', `traceoff',
305 and `undefine' macros to warn when encountering a builtin token in the
306 context of a macro name, rather than acting on the empty string. This
307 was already done for `define', `pushdef', `builtin', and `indir'.
309 ** Enhance the `eval' builtin to understand the `?:' operator, and
310 downgrade a failed parse due to an unknown operator from an error to a
313 ** A number of portability improvements inherited from gnulib.
315 * Noteworthy changes in Version 1.4.10b (2008-02-25) [beta]
316 Released by Eric Blake, based on git version 1.4.10a
318 Note that M4 1.4.10b was released prior to 1.4.11, and includes all the
319 features of 1.4.11 except for C99 parsing in the `format' builtin. It also
320 contains the following beta features that were deemed worth deferring until
323 ** Further enhance the `index' builtin to often achieve sublinear results.
325 ** Enhance the `regexp' and `patsubst' builtins to cache frequently used
326 regular expressions, which speeds up typical Autoconf usage.
328 ** Enhance the `format' builtin to warn for more suspicious usages, such as
329 missing arguments or problems parsing according to the format string.
331 ** Enhance the `ifelse' and `shift' builtins so that tail-recursive
332 algorithms based on `$@' operate in linear, rather than quadratic, time
335 ** A number of portability improvements inherited from gnulib.
337 * Noteworthy changes in Version 1.4.13 (2008-12-??) [stable]
338 Released by Eric Blake, based on git version 1.4.12.*
340 ** The manual is now distributed under the terms of FDL 1.3.
342 ** The `divert' and `undivert' builtins have been made more efficient
343 when using temporary files for large diversions.
345 ** The command line option `--debugfile', introduced in 1.4.7, now
346 treats its argument as optional, in order to allow setting the debug
347 output back to stderr when used without an argument; and order is now
348 significant with respect to command line files. You must therefore use
349 `m4 --debugfile=trace file', not `m4 file --debugfile trace'. This
350 change does not affect the deprecated `-o'/`--error-output' option.
352 ** A number of portability improvements inherited from gnulib.
354 * Noteworthy changes in Version 1.4.12 (2008-10-10) [stable]
355 Released by Eric Blake, based on git version 1.4.11.*
357 ** Fix regression introduced in 1.4.4b where using `traceon' could delete
358 a macro. This was most noticeable with `traceon(`traceon')', but
359 would also happen in cases such as `foo(traceon(`foo'))'.
361 ** Fix regression introduced in 1.4.7 where `m4 -N9' died with an assertion
364 ** Fix regression introduced in 1.4.11 where `defn' died with an assertion
365 failure on a traced but undefined macro.
367 ** New `-g'/`--gnu' command-line option overrides `-G'/`--traditional'.
368 For now, the environment variable POSIXLY_CORRECT has no effect on M4
369 behavior; but a future release of M4 will behave as though --traditional
370 is implied if POSIXLY_CORRECT is set (this future change is necessary,
371 because in the current release, there is no way to disable GNU
372 extensions that conflict with POSIX without the use of a non-POSIX
373 command-line argument). Clients of M4 that want to use GNU extensions,
374 even when POSIXLY_CORRECT is set, should start using the -g command-line
375 argument, even though it is currently a no-op if -G did not appear
376 earlier in the command line, so that the client will not break in the
377 face of an upgraded m4 and a POSIXLY_CORRECT execution environment.
379 ** The `-L'/`--nesting-limit' command-line option now defaults to 0 for
380 unlimited on platforms that can detect and deal with stack overflow. On
381 systems that lack alternate stack support, such as Cygwin, and on
382 systems that do not obey the POSIX semantics for distinguishing stack
383 overflow from other exceptions, such as Linux, you can optionally
384 install the libsigsegv library (version 2.6 or newer recommended) to
385 enhance m4's ability to accurately report stack overflow:
386 http://www.gnu.org/software/libsigsegv/
388 ** A number of portability improvements inherited from gnulib.
390 * Noteworthy changes in Version 1.4.11 (2008-04-02) [stable]
391 Released by Eric Blake, based on git version 1.4.10a
393 ** Security fixes for the -F option, for bugs present since -F was
394 introduced in 1.3: Avoid core dump with 'm4 -F file -t undefined', and
395 avoid arbitrary code execution with certain file names.
397 ** Fix regression introduced in 1.4.9b in the `divert' builtin when more
398 than 512 kibibytes are saved in diversions on platforms like NetBSD
399 or darwin where fopen(name,"a+") seeks to the end of the file.
401 ** The output of the `maketemp' and `mkstemp' builtins is now quoted if a
402 file was created. This is a minor security fix, because it was possible
403 (although rather unlikely) that an unquoted string could match an
404 existing macro name, such that use of the `mkstemp' output would trigger
405 inadvertent macro expansion and operate on the wrong file name.
407 ** Enhance the `defn' builtin to support concatenation of multiple text
408 arguments, as required by POSIX. However, at this time, it is not
409 possible to concatenate a builtin macro with anything else; a warning is
410 now issued if this is attempted, although a future version of M4 may
411 lift this restriction to match other implementations.
413 ** Enhance the `format' builtin to parse all C99 floating point numbers,
414 even on platforms where strtod(3) is buggy, although the replacement
415 function does have the known issue of rounding errors when parsing
416 some decimal floating point values. This fixes testsuite failures
417 introduced in 1.4.9b.
419 ** Enhance the `index' builtin to guarantee linear behavior, in spite of
420 the surprisingly large number of systems with a brain-dead quadratic
423 ** A number of portability improvements inherited from gnulib.
425 * Noteworthy changes in Version 1.4.10 (2007-07-09) [stable]
426 Released by Eric Blake, based on CVS version 1.4.9c
428 ** Upgrade from GPL version 2 to GPL version 3 or later.
430 ** A number of portability improvements inherited from gnulib.
432 ** Avoid undefined behavior introduced in 1.4.9b in the `format' builtin
433 when handling %c. However, this area of code has never been documented,
434 and currently does not match the POSIX behavior of printf(1), so it may
435 have further changes in the next version.
437 * Noteworthy changes in Version 1.4.9b (2007-05-29) [beta]
438 Released by Eric Blake, based on CVS version 1.4.9a
440 ** Fix regression introduced in 1.4.9 in the `eval' builtin when performing
443 ** Fix regression introduced in 1.4.8 in the `-F' option that made it
444 impossible to freeze more than 512 kibibytes of diverted text.
446 ** The synclines option `-s' no longer generates sync lines in the middle of
447 multiline comments or quoted strings.
449 ** Work around a number of corner-case POSIX compliance bugs in various
450 broken stdio libraries. In particular, the `syscmd' builtin behaves
451 more predictably when stdin is seekable.
453 ** The `format' builtin now understands formats such as %a, %A, and %'hhd,
454 and works around a number of platform printf bugs. Furthermore, the
455 sequence format(%*.*d,-1,-1,1) no longer outputs random data. However,
456 some non-compliant platforms such as mingw still have known bugs in
457 strtod that may cause testsuite failures.
459 ** The testsuite is improved to also run gnulib portability tests for the
460 features that M4 imports from gnulib.
462 * Noteworthy changes in Version 1.4.9 (2007-03-23) [stable]
463 Released by Eric Blake, based on CVS version 1.4.8c
465 ** Minor documentation and portability cleanups.
467 * Noteworthy changes in Version 1.4.8b (2007-02-24) [beta]
468 Released by Eric Blake, based on CVS version 1.4.8a
470 ** Fix a regression introduced in 1.4.8 that made m4 unable to process
471 files larger than 2GiB on some platforms.
473 ** Fix a regression introduced in 1.4.8 that made m4 dump core when
474 invoked as 'm4 -- file'.
476 ** The `eval' builtin now follows C precedence rules. Additionally, the
477 short-circuit operators correctly short-circuit division by zero. The
478 previously undocumented alias of '=' meaning '==' in eval now triggers a
479 deprecation warning, so that a future version of M4 can implement a form
480 of variable assignment as an extension.
482 ** The `include' builtin now affects exit status on failure, as required by
483 POSIX. Use `sinclude' if you need a successful exit status.
485 ** The `-E'/`--fatal-warnings' command-line option now has two levels. When
486 specified only once, warnings affect exit status, but execution
487 continues, so that you can see all warnings instead of fixing them one
488 at a time. To achieve 1.4.8 behavior, where the first warning
489 immediately exits, specify -E twice on the command line.
491 ** A new `--warn-macro-sequence' command-line option allows detection of
492 sequences in `define' and `pushdef' definitions that match an optional
493 regular expression. The default regular expression is
494 `\$\({[^}]*}\|[0-9][0-9]+\)', corresponding to the sequences that might
495 not behave correctly when upgrading to the eventual M4 2.0. By default,
496 M4 2.0 will follow the POSIX requirement that a macro definition
497 containing `$11' must expand to the first argument concatenated with 1,
498 rather than the eleventh argument; and will take advantage of the POSIX
499 wording that allows implementations to treat `${11}' as the eleventh
500 argument instead of literal text. Be aware that Autoconf 2.61 will not
501 work with this option enabled with the default regular expression; but
502 Autoconf 2.62 will be compatible with this option.
504 ** Improved portability to platforms such as BSD/OS and AIX.
506 * Noteworthy changes in Version 1.4.8 (2006-11-20) [stable]
507 Released by Eric Blake, based on CVS version 1.4.7a
509 ** The `divert' macro and `-H'/`--hashsize' command line option no longer
510 cause a core dump when handed extra large values. Also, `divert' now
511 uses memory proportional to the number of diversions in use, rather than
512 to the maximum diversion number encountered, so that large diversion
513 numbers are less likely to exhaust system memory; and is no longer
514 limited by the maximum number of file descriptors.
516 ** The `--help' and `--version' command line options now consistently
517 override all earlier options. For example, `m4 --debugfile=trace
518 --help' now no longer accidentally creates an empty file `trace'.
520 ** The `-L'/`--nesting-limit' command line option can now be set to 0
521 to remove the default limit of 1024. However, it is still possible that
522 heavily nested input can cause abrupt program termination due to stack
525 ** Problems encountered when writing to standard error, such as with the
526 `errprint' macro, now always cause a non-zero exit status.
528 ** Warnings and errors issued during macro expansion are now consistently
529 reported at the line where the macro name was detected, rather than
530 where the close parenthesis resides. Text wrapped by `m4wrap' now
531 remembers the location that was in effect when m4wrap was invoked,
532 rather than changing to line 0 and the empty string for a file. The
533 macros `__line__' and `__file__' now work correctly even as the last
534 token in an included file.
536 ** The `builtin' and `indir' macros now transparently handle builtin
537 tokens generated by `defn'.
539 ** When diversions created by the `divert' macro collect enough text that
540 M4 must use temporary files, the environment variable $TMPDIR is now
541 consulted, and a better effort is made to clean up those files in the
542 event of a fatal signal.
544 ** The `mkstemp' builtin is added with the same GNU semantics as `maketemp',
545 based on the recommendation of POSIX to deprecate the POSIX semantics of
546 `maketemp' as inherently insecure. In GNU mode (no -G supplied on the
547 command line), `maketemp' silently retains the secure GNU semantics, but
548 a future release of M4 will change this to emit a warning. In
549 traditional mode (m4 -G), `maketemp' now uses the POSIX-mandated
550 insecure semantics, and issues a warning that you should convert your
551 script to use `mkstemp' instead. Additionally, `mkstemp' and `maketemp'
552 are now well-defined even if the template argument does not end in six
555 ** The manual has been improved, including a new section on a composite
558 ** The `changecom' and `changequote' macros now treat an empty second
559 argument the same as if it were missing, rather than using the empty
560 string and making it impossible to end a comment or quote.
562 ** The `translit' macro now operates in linear instead of quadratic time,
563 and is now eight-bit clean.
565 ** The `-D', `-U', `-s', and `-t' command line options now take effect
566 after any files encountered earlier on the command line, rather than up
567 front, as is done in traditional implementations and required by POSIX.
569 * Noteworthy changes in Version 1.4.7 (2006-09-25) [stable]
570 Released by Eric Blake, based on CVS version 1.4.6a
572 ** Fix regression from 1.4.5 in handling a file that ends in a macro
573 expansion without arguments instead of a newline.
575 ** The define and pushdef macros now warn when the first argument is not
576 a string, rather than silently doing nothing.
578 ** Standard input can now be read more than once, as in 'm4 - file -', and
579 is not closed until all wrapped text is handled. This makes a
580 difference when stdin is not a regular file, and also fixes bugs when
581 using the syscmd or esyscmd macros from wrapped text.
583 ** When standard input is a seekable file, the m4exit, syscmd, and esyscmd
584 macros now restore the current position to the next unread byte rather
585 than discarding an arbitrary amount of buffered data.
587 ** SysV command-line compatibility is no longer a goal of GNU M4; the
588 focus will be instead on POSIX compatibility. This release continues to
589 support previous usage, but adds warnings in areas which will allow a
590 future version of GNU M4 to use its own extensions without being tied to
591 the SysV command line interface.
593 ** The no-op compatibility command line options -B, -N, -S, -T, and
594 --diversions may be withdrawn or assigned new meanings in future
595 releases, so they now issue a warning if used.
597 ** A new command line option -i replaces the compatibility -e as the
598 short spelling of --interactive, for consistency with other GNU tools; a
599 warning is issued if the old spelling is used, and it may be assigned
600 new meaning in future releases.
602 ** A new command line option --debugfile replaces the options -o and
603 --error-output as the preferred spelling. The old options were
604 misleading in their names and inconsistent with other GNU tools; they
605 are still silently accepted, but no longer documented in --help, and may
606 be assigned new meanings in future releases.
608 * Noteworthy changes in Version 1.4.6 (2006-08-25) [stable]
609 Released by Eric Blake, based on CVS version 1.4.5a
611 ** Fix buffer overruns in regexp and patsubst macros when handed a trailing
612 backslash in the replacement text, or when handling \n substitutions
613 beyond the number of \(\) groups.
615 ** Fix memory leak in regexp, patsubst, and changeword macros.
617 ** The format macro now understands %F, %g, and %G.
619 ** When loading frozen files, m4 now exits with status 63 if version
620 mismatch is detected.
622 ** Fix bugs that occurred when invoked with stdout or stderr closed,
623 and detect write failures to stdout or to the target of the debugfile
624 macro. In particular, the syscmd and esyscmd macros can no longer
625 interfere with the debug stream or diversions.
627 ** The m4exit macro now converts values outside the range 0-255 to 1.
629 ** It is now an error if a command-line input file ends in the middle of a
630 comment, matching the behavior of mid-string and mid-argument
633 ** The dnl macro now warns if end of file is encountered instead of a
636 ** The error message when end of file is encountered now uses the file and
637 line where the dangling construct started, rather than `NONE:0:'.
639 ** The debugmode and __file__ macros, and the -s/--synclines option, now
640 show what directory a file was found in when the -I/--include option or
641 M4PATH variable had an effect.
643 ** The changequote and changecom macros now work with 8-bit characters, and
644 quotes and comments that begin with `(' are properly recognized
647 ** The new macro __program__ is added, which allows the input file to issue
648 an error message that resembles messages from m4. Warning and error
649 messages have been reformatted to comply with GNU Coding Standards.
651 ** The errprint, m4wrap, and shift macros are now recognized only with
654 ** The index, substr, translit, regexp, and patsubst macros now produce
655 output when given only one argument, but still warn about a missing
658 ** The patsubst macro now reliably finds zero-length matches at the end
661 * Noteworthy changes in Version 1.4.5 (2006-07-15) [stable]
662 Released by Eric Blake, based on CVS version 1.4.4c
664 ** Fix sysval on BeOS, OS/2, and other systems that store exit status
665 in the low-order byte. Additionally, on Unix platforms, if syscmd was
666 terminated by a signal, sysval now displays the signal number shifted
667 left by eight bits, to match traditional m4 implementations.
669 ** The maketemp macro is no longer subject to platform limitations (such as
670 26 or 32 max files from a given template).
672 ** Frozen files now require that the first directive be V (version), to
673 better diagnose version mismatch. Additionally, if the F directive
674 (builtin function) names an unknown builtin that existed in the m4 that
675 froze the file but not in the current m4 (for example, changeword), the
676 warning is deferred until an attempt is made to actually use the
677 builtin. This allows downgrading from beta m4-1.4o to stable m4-1.4.5
678 without breaking autoconf.
680 ** The format and indir macros are now recognized only with arguments.
682 ** The eval macro no longer crashes on x86 architectures when dividing the
683 minimum integer by -1.
685 ** On systems with ecvt and fcvt, format no longer truncates trailing
686 zeroes on integers printed with %.0f. On systems without these
687 functions, format is no longer subject to a buffer overflow that
688 permitted arbitrary code execution.
690 ** On native Windows builds, the macro __windows__ is provided instead of
691 __unix__. Likewise, on OS/2 builds, the macro __os2__ is provided.
692 This allows input files to determine when syscmd might behave
695 ** Fix bug in 1.4.3 patch to use \n line-endings that did not work for
698 ** When given the empty string or 0, undivert is now documented as a no-op
699 rather than closing stdout, warning about a non-existent file, or trying
700 to read a directory as a file.
702 ** Many documentation improvements. Also, the manual is now distributed
703 under FDL 1.2, rather than a stricter verbatim-only license.
705 ** Raise the -L (--nesting-limit) command line option limit from 250 to
708 ** The decr, incr, divert, m4exit, and substr macros treat an empty number
709 as 0, issue a warning, and expand as normal; rather than issuing an
710 error and expanding to the empty string.
712 ** The eval macro now treats an empty radix argument as 10, handles radix 1,
713 and treats the width argument as number of digits excluding the sign,
714 for compatibility with other m4 implementations.
716 ** The ifdef, divert, m4exit, substr, and translit macros now correctly
717 ignore extra arguments.
719 ** The popdef and undefine macros now correctly accept multiple arguments.
721 ** Although changeword is on its last leg, if enabled, it now reverts to the
722 default (faster) regexp when passed the empty string.
724 ** The regexp and substr macros now warn and ignore a trailing backslash in
725 the replacement, and warn on \n for n larger than the number of
726 sub-expressions in the regexp.
728 * Noteworthy changes in Version 1.4.4b (2006-06-17) [beta]
729 Released by Eric Blake, based on CVS version 1.4.4a
731 ** Fix a recursive push_string crashing bug, which affected changequote of
732 three or more characters on some compilers.
734 ** Use automake to fix build portability issues.
736 ** Fix a recursive m4wrap crashing bug.
738 ** Fix a 1 in 2**32 hash crashing bug.
740 ** Tracing a macro by name is now persistent, even if the macro is
741 subsequently undefined or redefined. The traceon and traceoff macros no
742 longer warn about undefined symbols. This solves a crash when using
743 indir on an undefined macro traced with the -t option, as well as an
744 incorrect result of ifdef. Furthermore, tracing is no longer
745 transferred with builtins, solving the bug of "m4 -tm4_eval" failing to
746 give trace output on the input
747 "define(`m4_eval',defn(`eval'))m4_eval(1)".
749 ** Fix a crash when a macro is undefined while collecting its arguments, by
750 always using the definition that was in effect before argument
751 collection. This behavior matches the C pre-processor, and means that
752 the sequence "define(`f',`1')f(define(`f',`2'))f" is now documented to
753 result in "12", rather than the previously undocumented "22".
755 ** Update the regex engine to fix several bugs.
757 ** Fix a potential crash on machines where char is signed.
759 * Noteworthy changes in Version 1.4.4 (Oct 2005) [stable]
760 Released by Gary V. Vaughan
762 ** ./configure --infodir=/usr/share/info now works correctly.
764 ** When any file named on the command line is missing exit with status 1.
766 * Noteworthy changes in Version 1.4.3 (Mar 2005) [stable]
767 Released by Gary V. Vaughan
769 ** DESTDIR installs now work correctly.
771 ** Don't segfault with uncompilable regexps to changeword().
773 ** Always use \n line-endings for frozen files (fixes a Windows bug).
775 ** Portability fix for systems lacking mkstemp(3).
777 ** Approximately 20% speed up in the common case of usage with autoconf.
779 ** Supported on QNX 6.3.
781 * Noteworthy changes in Version 1.4.2 (Aug 2004) [stable]
782 Released by Paul Eggert
784 ** No user visible changes; portability bug fixes only.
786 * Noteworthy changes in Version 1.4.1 (Jun 2004) [stable]
787 Released by Paul Eggert
789 ** The 1.4.x series is intended to be stable; features added in 1.4[a-q]
790 were not backported to 1.4.x unless specifically mentioned above.
792 ** maketemp now creates an empty file with the given name, instead of merely
793 returning the name of a nonexistent file. This closes a security hole.
796 * Version beta 1.4q - August 2001, by Gary V. Vaughan
798 ** Support for the experimental `changeword' has been dropped.
800 ** `m4 --hashsize' and `-H' are still accepted, but have no effect. M4
801 will grow its internal symbol table if the symbol density is having an
802 effect on performance.
804 ** `configure --without-modules' will build an m4 binary with no preloaded
805 modules. At startup it will search for and load modules `m4' and either
806 `gnu' or `traditional'. This mode of operation can be used for
807 development and debugging of the base modules without the need to
808 recompile all of m4 with each modification.
810 ** `configure --with-modules="gnu m4 traditional load"', for example,
811 will build an m4 binary with the named modules preloaded, ready to be
812 activated (even on static lib only machines) with the `-m' option or
813 using the `load' builtin.
815 ** M4 has no builtins or macros in core, they are all loaded from modules
816 at startup. This means that modules are no longer optional, though the
817 standard build will statically link the modules `m4', `gnu' and
818 `traditional', so even on machines with no ltdl support, all of the
819 functionality from previous releases is available.
821 ** New builtin `load' to dynamically load modules which can define new
822 builtins and user macros.
824 ** New builtin `unload' to remove loaded modules (and the builtins and user
825 macros they define) from the running m4 interpreter.
827 ** New builtins `eregexp' and `epatsubst' to use Extended Regular
828 Expressions syntax in lieu of Basic Regular Expressions as used by
829 `regexp' and `patsubst'.
831 ** The names of all currently loaded modules are returned by the new
832 builtin, ``modules''.
834 ** Loadable modules can define new builtin functions or text expansion
837 ** The module code has been rewritten to use libltdl, the libtool dynamic
838 loader, which means GNU m4 can now load (and unload) modules just about
839 anywhere which it can be built. This includes obscure hosts such as
840 cygwin and BeOS, and also on hosts which do not have shared libraries,
841 through preloading (see libtool manual) and GNU dld.
843 ** Modules can now be built without the m4 source being available using the
844 installed m4module.h header file (and some other headers that it
845 includes for you), and the installed libm4.la libtool library. All
846 symbols exported from libm4.la have a prefix of `m4_' or `M4_'. See the
847 modules directory for examples of usage.
849 ** A new V2 format for frozen files that saves module and syntax information.
851 * Version beta 1.4o - January 2000, by Rene' Seindal
853 ** Modules can be loaded from the command line with --load-module
855 ** Modules now use libtool's wrapper libltdl.
857 ** New builtin `symbols' allows dynamic queries of all currently defined
860 ** Various Bug fixes.
862 * Version beta 1.4n - November 1998, by Rene' Seindal
864 ** The module code has been reorganised yet again, and now compiles
865 correctly on GNU/Linux, HPUX 9 and 10, SunOS 5 and Solaris 5.
867 ** When configured --with-gmp a new builtin `mpeval' is now defined. The
868 builtin `eval' retains its normal behaviour.
870 ** m4 --version also shows which options were used for compilation, such as:
871 "GNU m4 1.4n (options: modules gmp changeword)"
873 ** New option --import-environment defines all environment variables as
874 macros. This is done before -D and -U are handled, so the macros can be
875 changed through these options.
877 ** Error messages now always print program name before input file name as
878 specified by GNU coding standards. Reported by Akim Demaille.
880 ** Bug fixed: "undivert(0)" could cause m4 to read standard output. A call
881 of "undivert(0)" is now silently ignored.
883 ** Bug fixed: when compiling --with-included-gettext, <libintl.h> wasn't
884 found in intl/ directory. Reported by Andrew Bettison.
886 * Version beta 1.4m - November 1998, by Rene' Seindal
888 ** Using libtool for compiling modules and for linking main app.
890 ** Reorganised the dynamic module code to encapsulate system dependencies
891 better. The code for HPUX shl_load() still needs testing and debugging.
892 A dld interface is also missing. Any volunteers?
894 ** The files from the GNU m4 web-site is now in examples/WWW as a more
895 complete example of what GNU m4 can do.
897 * Version beta 1.4l - November 1998, by Rene' Seindal
899 ** GNU m4 now has an escape syntax category. If a character is marked as
900 an escape, words are only recognised as macros if preceded by an escape
901 character. It is a bit like -P, but dynamic: it can be turned on and
902 off. The GNU m4 web-site on http://www.seindal.dk/rene/gnu/ is
903 maintained with this feature - the m4 source is available on the site.
905 ** The module interface is improved, thanks to "Brian J. Fox",
906 who has contributed some code from Meta-HTML. The modules now build
907 automatically and installs properly, by default in
908 /usr/local/libexec/m4. There is a preliminary, untested support for
911 ** There is now a __m4_version__ macro that expands to the current version
914 * Version beta 1.4k - November 1998, by Erick Branderhorst and Rene' Seindal
916 ** GNU m4 now uses gettext to support internationalization.
918 ** GNU m4 now uses automake to control Makefile.in generation. This
919 should make it more consistent with the GNU standards.
921 ** GNU m4 will use the gmp library for multiple precision integral and
922 rational arithmetic in `eval' if configured with `--with-gmp'. If
923 configured without `--with-gmp' or if gmp is not available, and the type
924 `long long int' is, GNU m4 will use that for `eval' arithmetic.
926 ** GNU m4 now parses the input according to a syntax table, that can be
927 modified through the new builtin `changesyntax'. It is a generalisation
928 of the existing builtins `changecom' and `changequote'. The changes are
929 completely backwards compatible (except for the existence of
932 ** Sync lines can be turned on and off with the `syncoutput' builtin. The
933 builtin `syncoutput' is a GNU extension.
935 ** New experimental feature: dynamically loadable modules. New builtin
936 `loadmodules' loads shared libraries, that can define new builtin
937 macros, ie, new macros can be written in C. Depends on the dlopen()
938 interface, and is currently only tested on Linux. Enabled at configure
939 time with `--with-modules'. Documentation is in src/module.c and
942 ** Implement a GNU message catalog for French (Franc,ois Pinard).
944 ** Filenames found through path searches are now correctly reflected in
945 error and debug messages and through the `__file__' macro.
949 *** All 8-bit characters can now be used for quotes.
951 * Version 1.4 - October 1994, by Franc,ois Pinard
953 ** (No user visible changes)
955 * Version 1.3 - September 1994, by Franc,ois Pinard
957 ** Diversions are created as needed. Option `-N' is still accepted, but
958 otherwise ignored. Users should use only negative diversion numbers,
959 instead of high positive numbers, for diverting to nowhere.
961 ** Diversions should also work faster. No temporary files will be needed
962 at all if all diversions taken altogether do not use more than 512K.
964 ** Frozen state files may be produced with the `--freeze-state' (-F)
965 option and later brought back through the `--reload-state' (-R) option.
967 * Version 1.2 - July 1994, by Franc,ois Pinard
969 ** In patsubst(STRING, REGEXP, REPLACEMENT), \& in REPLACEMENT has been
970 changed to represent this part of STRING matched by the whole REGEXP,
971 instead of the whole STRING as before. \0 does the same, but emits a
972 diagnostic saying it will disappear in some subsequent release.
974 ** eval(EXPR) emits a diagnostic if EXPR has suffixed crumb. The same for
975 other numeric conversions in incr(), decr(), divert(), etc.
977 ** `--fatal-warnings' (-E) stops execution at first warning.
979 ** `--nesting-limit=LEVEL' (-L LEVEL) sets a limit to macro nesting.
980 It is initially fixed at 250.
982 ** `--word-regexp=REGEXP' (-W REGEXP) modifies macro name syntax, like
983 does the new `changeword(REGEXP)' macro. This feature is experimental,
984 tell me your opinions about it. You do need --enable-changeword at
985 configure time to get these things. Do *not* depend on them yet.
987 ** Trace output format is scannable by GNU Emacs' next-error function.
989 ** Stack overflow is detected and diagnosed on some capable systems.
991 ** Various bugs have been corrected, m4 should be more portable. See the
992 ChangeLog for details.
994 * Version 1.1 - November 1993, by Franc,ois Pinard
996 ** Changes which might affect existing GNU m4 scripts:
998 *** Option `-V' has been removed, use `--version' instead. `--version'
999 writes on standard output instead of standard error, and inhibits any
1002 *** `--no-gnu-extensions' has been renamed `--traditional'.
1004 *** In `eval', `^' used to indicate exponentiation, use `**' instead.
1006 *** The automatic undiversion which takes place at end of all input is
1007 forced into the main output stream.
1009 ** Changes which are unlikely to affect existing scripts:
1011 *** `--help' prints an usage summary on standard output. Script execution
1014 *** `--prefix-builtins' (-P) prefixes all builtin macros by `m4_'.
1016 *** Most builtin macros for which arguments are mandatory, called without
1017 any arguments, are no more recognized as builtin macros: they are
1018 consequently copied verbatim to the output stream.
1020 *** `define' and `pushdef' are usable with only one argument, they give
1021 this argument an empty definition.
1023 *** `eval' new operators for binary representation handling: `^' for
1024 exclusive-or, `~' for the bitwise negation, `<<' and `>>' for shifts.
1026 *** `eval' recognizes the notation 0bDIGITS for binary numbers and the
1027 notation 0rRADIX:DIGITS for numbers in any radix from 1 to 36.
1029 * Version 1.0.3 - December 1992, by Franc,ois Pinard
1031 ** Changes for the user:
1033 *** `dnl' outputs a diagnostic if immediately followed by `('. Usually,
1034 `dnl' is followed by newline or whitespace.
1036 *** `ifelse' accepts without complaining the common idiom of having only
1037 one argument. This is useful for introducing long comments.
1039 *** `eval' always expresses values as signed, whatever the radix.
1041 *** M4OPTS environment variable is no longer obeyed.
1043 *** `--no-warnings' option is renamed `--silent'.
1045 *** Debug lines use a new format more compatible with GNU standards.
1047 *** Various bugs have been corrected. See the ChangeLog for details.
1049 ** Changes for the installer:
1051 *** GNU m4 now uses an Autoconf-generated configure script, and should be
1052 more easily portable in many ways. (Cray is not supported yet).
1054 *** `make check' has been made more portable, expect no errors.
1056 ** Changes for the programmer:
1058 *** Sources have been fully reindented to comply with GNU standards, and
1059 cleaned up in many ways.
1061 *** Sources have been protoized. Non-ANSI compilers are automatically
1062 detected, then sources are unprotoized on the fly before compilation.
1064 *** GNU m4 uses newer versions of obstack, regex, getopt, etc.
1066 * Version 1.0 - October 1991, by Rene' Seindal
1068 ** Uses GNU configure, taken from the gdb distribution.
1070 ** Uses GNU getopt(), with long option names.
1072 ** The -Q/+quiet option is added, which suppresses warnings about missing
1073 or superflous arguments to builtin macros.
1075 ** Added default options via the M4OPTS environment variable.
1077 ** Several minor bugs have been fixed.
1079 * Version 0.99 - July 1991, by Rene' Seindal
1081 ** The builtins `incr' and `decr' are now implemented without use of
1084 ** The builtin `indir' is added, to allow for indirect macro calls
1085 (allows use of "illegal" macro names).
1087 ** The debugging and tracing facilities has been enhanced considerably.
1088 See the manual for details.
1090 ** The -tMACRO option is added, marks MACRO for tracing as soon as it
1093 ** Builtins are traced after renaming iff they were before.
1095 ** Named files can now be undiverted.
1097 ** The -Nnum option can be used to increase the number of divertions
1100 ** Calling changecom without arguments now disables all comment handling.
1102 ** A bug in `dnl' is fixed.
1104 ** A bug in the multi-character quoting code is fixed.
1106 ** Several typos in the manual has been corrected. More probably persist.
1108 * Version 0.75 - November 1990, by Rene' Seindal
1110 ** Implemented search path for include files (-I option and M4PATH
1111 environment variable).
1113 ** Implemented builtin `format' for printf-like formatting.
1115 ** Implemented builtin `regexp' for searching for regular expressions.
1117 ** Implemented builtin `patsubst' for substitution with regular
1120 ** Implemented builtin `esyscmd', which expands to a shell commands output.
1122 ** Implemented `__file__' and `__line__' for use in error messages.
1124 ** Implemented character ranges in `translit'.
1126 ** Implemented control over debugging output.
1128 ** Implemented multi-character quotes.
1130 ** Implemented multi-character comment delimiters.
1132 ** Changed predefined macro `gnu' to `__gnu__'.
1134 ** Changed predefined macro `unix' to `__unix__', when the -G option is
1135 not used. With -G, `unix' is still defined.
1137 ** Added program name to error messages.
1139 ** Fixed two missing null bytes bugs.
1141 * Version 0.50 - January 1990, by Rene' Seindal
1143 * Initial beta release.