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 *** New `-p'/`--pushdef' and `--popdef' command-line options allow more
46 control over macro definitions from the command line between input
49 *** New `--posix' command-line option is a synonym for `-G'/`--traditional'.
51 *** New `-r'/`--regexp-syntax' command-line option changes the default
52 regular expression syntax used by M4. Without this option, M4
53 continues to use EMACS style expressions. A new section in the info
54 docs explains the differences between them, and what builtins are
57 *** New `--safer' command-line option cripples the potentially unsafe
58 builtins `debugfile', `esyscmd', `maketemp', `mkdtemp', `mkstemp', and
61 *** New `--syncoutput' command-line option matches the builtin added in a
62 previous beta, and provides more control over sync line generation
63 from the command line between input files. The previous options
64 `-s'/`--synclines' remain as aliases for `--syncoutput=1'.
66 *** New `--traceoff' command-line option, and new spelling `--traceon' for
67 `--trace', allow more control over macro tracing from the command line
70 *** New `--unload-module' command-line option allows more control over
71 dynamic modules from the command line. Also, `-m'/`--load-module' now
72 acts between input files.
74 *** New `--warnings' command-line option re-enables warnings, overriding
75 `-Q'/`--quiet'/`--silent', allowing warnings even when POSIXLY_CORRECT.
79 *** The `defn' builtin now allows any number of arguments, as POSIX requires.
80 - FIXME: This still doesn't work with concatenating builtins with text.
82 - FIXME: POSIX recommends using ${10} instead of $10 for the tenth
83 positional argument. We should deprecate $10.
87 *** The experimental `epatsubst' and `eregexp' builtins have been removed
88 in favor of a new `changeresyntax' builtin.
92 *** New `changeresyntax' builtin allows programmatic setting of the default
93 regular expression flavor, to match `-r'/`--regexp-syntax' command-line
96 *** New `debuglen' builtin allows runtime setting of debug output length,
97 previously controlled only by the `-l' command line argument.
98 Additionally, whether using the new macro or the command line argument,
99 the length limitation now affects dumpdef output as well as trace
100 output, undergoes argument validation, and accepts an optional
102 - FIXME the multiplier suffix isn't reliable yet
104 *** New `mkdtemp' builtin parallels `mkstemp', but allows the creation of
105 temporary directories instead of files.
107 *** New `refcount' builtin allows tracking how many times a module has
109 - FIXME: consider making m4modules smarter for this purpose
111 *** New `renamesyms' builtin allows programmatic renaming of all symbols
112 according to a regular expression.
113 - FIXME: This feature can cause core dumps when renaming multiple
114 symbols to the same name.
116 *** New `__traditional__' builtin identifies when the traditional module
117 is loaded instead of the gnu module.
119 *** The `modules' and `symbols' builtins, introduced in previous betas,
120 have been renamed `m4modules' and `m4symbols', in order to minimize
121 problems when upgrading from 1.4.x and processing English text. To
122 prevent future problems, any future macro added as a GNU extension will
123 either be blind (ie. be unrecognized without arguments), or begin with
124 the prefix `m4' or `__'.
126 ** Changed behavior of builtins
128 *** The module identifier builtins, such as `__gnu__', `__m4_version__',
129 and `__unix__', now warn if given arguments.
131 *** The `builtin' builtin now has a special form, where if the first
132 argument is exactly the special token representing defn(`builtin'), the
133 expansion is the special token representing the builtin named in the
134 second argument. This allows regenerating a macro with a more
135 efficient mapping directly to a builtin function, rather than through
136 textual indirection through further expansions of `builtin'.
138 *** The `changesyntax' builtin has been improved, to make it easier to add
139 and remove characters from a syntax class without having to specify the
140 entire set of characters in that class. It also supports new syntax
141 categories, `$', `{' and `}', for extended argument handling in macro
142 definitions. See the manual for more examples.
144 *** New `m' flag to `-d'/`--debug' command-line option or `debugmode'
145 builtin traces actions related to module loading and unloading, and
146 affects `dumpdef' and trace output to show where builtins come from.
147 New `s' flag shows the entire stack of `pushdef' definitions during
148 `dumpdef'. The `c' flag has been updated to add information to the
149 first line to show the definition of the macro being expanded.
151 *** The `eval' and `mpeval' builtins now support the following new
152 operators: `>>>', `\', and `,'.
154 *** The `maketemp' builtin now always warns that it is obsolete, even in GNU
155 mode where it uses the same secure algorithm as `mkstemp', because of
156 the recommendation of POSIX to obsolete `maketemp' as inherently
157 insecure when obeying POSIX.
159 *** The `m4symbols' builtin now warns if given a builtin token instead of
160 a macro name. It remains silent for undefined macros.
162 *** The `patsubst' and `regexp' builtins have a new optional 4th argument
163 to use a different regular expression syntax for the duration of that
166 *** The semantics of the `traceon' and `traceoff' builtins now match
167 traditional implementations: when called without arguments, they affect
168 global state rather than affecting only the macros defined at that
169 moment. The manual includes an example of how to recover 1.4.x
174 *** The syntax of frozen files format V2 has been improved to save
175 additional state. This includes the `R' directive for default regular
176 expression syntax, the `t' directive for traced macros, and the `d'
177 directive for debug mode. Existing directives with consecutive strings
178 now require an intermediate newline, for faster parsing. Also, a V2
179 file can now be represented completely in ASCII, thanks to escape
180 sequences. Unfortunately, files frozen by M4 1.4q cannot be read by
181 1.9b, but since 1.4q was not widely distributed, this is not expected
182 to be much of an issue, and comes with the territory of using a beta
184 - FIXME: format 2 still needs to catch more missing state; once 2.0 is
185 released, any further changes would introduce format 3.
187 *** Improvements made in the 1.4.x and 1.6 stable series have been
191 * Noteworthy changes in Version 1.6 (????-??-??) [stable]
192 Released by ????, based on git versions 1.4.10b.x-* and 1.5.*
194 ** Fix regression introduced in 1.4.4b where using `traceon' could delete
195 a macro. This was most noticeable with `traceon(`traceon')', but
196 would also happen in cases such as `foo(traceon(`foo'))'.
198 ** Fix regressions introduced in 1.4.10b:
199 *** Using `builtin' or `indir' to perform nested `shift' calls triggered
200 an assertion failure (not present in 1.4.11).
201 *** The command-line option -dV, as well as the builtin `debugmode(V)',
202 failed to enable `t' and `c' debug options (not present in 1.4.11).
203 *** Comments that contain unbalanced quotes were not rescanned correctly
204 when passed through $@ (not present in 1.4.11).
205 *** Using `defn' on a traced but undefined macro triggered an assertion
206 failure (also present in 1.4.11, but not 1.4.12).
208 ** Remove the undocumented command-line option '-N', as no one complained
209 about the assertion failure regression that it introduced in 1.4.7.
211 ** The `-o'/`--error-output' command-line options, which were replaced by
212 `--debugfile' in 1.4.7, now issue a deprecation warning. This warning
213 harmlessly triggers with versions of Autoconf 2.60 and earlier, but can
214 be silenced by applying this patch:
215 http://git.sv.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=714eeee87
217 ** Fix the `m4wrap' builtin to accumulate wrapped text in FIFO order, as
218 required by POSIX. The manual mentions a way to restore the LIFO order
219 present in earlier GNU M4 versions. NOTE: this change exposes a bug
220 in Autoconf 2.59 and earlier (which was fixed in Autoconf 2.60).
222 If you want your package to work with pre-installed Autoconf without
223 requiring 2.60, then add these lines to your project's configure.ac,
224 prior to calling AC_INIT:
226 # As long as this project is not ready to upgrade to autoconf 2.60
227 # or newer, make sure that newer M4 will still use LIFO order:
228 m4_define([m4_wrap], [m4_ifdef([_$0_text],
229 [m4_define([_$0_text], [$1]m4_defn([_$0_text]))],
230 [m4_define([_$0_text], [$1])m4_builtin([m4wrap],
231 [m4_default(m4_defn([_$0_text])m4_undefine([_$0_text]))])])])
233 On the other hand, if you want to install Autoconf 2.59 or earlier,
234 then apply this patch:
235 http://git.sv.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=56d42fa71
237 ** The `changecom' builtin semantics now match traditional
238 implementations; if the start-comment string resembles a macro name or
239 the start-quote string, comments are effectively disabled.
241 ** The `divert' builtin now accepts an optional second argument of text
242 that is immediately placed in the new diversion, regardless of whether
243 the current expansion is nested within argument collection of another
244 macro. It has also been optimized for faster performance.
246 ** The `substr' builtin now treats negative arguments as indices relative
247 to the end of the string, and accepts an optional fourth argument of
248 text to supply in place of the selected substring. The manual gives an
249 example of how to recover M4 1.4.x behavior, as well as an example of
250 simulating the new negative argument semantics with older M4.
252 ** The `index' builtin now takes an optional third argument as the index
253 to begin searching from, with a negative argument relative to the end of
256 ** The `-d'/`--debug' command-line option now understands `-' and `+'
257 modifiers, the way the builtin `debugmode' has always done; this allows
258 `-d-V' to disable prior debug settings from the command line, similar to
259 using the builtin `debugmode' without arguments. The option
260 `--debugmode' is added as an alias for `-d'. The new flag `d' is added
261 to control whether dereferencing an undefined macro causes a warning;
262 this flag is enabled by default if neither `-d' nor `-E' are specified.
263 The new flag `o' is added to control whether `dumpdef' outputs to stderr
264 or the current `debugfile' location. When the command line option is
265 given the empty string, the mode is treated as `+adeq' instead of `aeq'.
266 Also, the position of `-d' with respect to files on the command line is
269 ** A new predefined text macro, `__m4_version__', expands to the unquoted
270 version number of M4, if GNU extensions are enabled. While you should
271 generally favor feature tests over version number checks, this macro can
272 be used, via `defn', to determine whether the version of m4 processing
273 your file is adequate.
275 ** The `defn', `popdef', and `undefine' builtins gained a new warning when
276 operating on an undefined macro name, to match the warning already
277 present in `builtin', `indir', and `dumpdef'. For backwards
278 compatibility, the warning can be disabled by using `debugmode(`-d')'
279 (or the command line option `--debug=-d'). The flag is also cleared by
280 the command line option `-E'/`--fatal-warnings', so that scripts written
281 for 1.4.x do not cause the script to fail because of new warnings.
283 ** Enhance the `indir' builtin to trace indirect macros, where the trace
284 is requested via `traceon' or the command-line option `-t'. Previously,
285 it was impossible to trace macro names such as `foo-bar' which could
286 only be invoked indirectly, without relying on global tracing (such as
287 with `debugmode(`t')') or the experimental `changeword'.
289 ** Aspects of tracing output that were previously undocumented have been
290 slightly altered, and the effect of the builtin `debugmode' on trace
291 output is more fully documented. As POSIX does not specify trace output
292 format, parsing such output is inherently fragile in the first place.
293 The intent is that future M4 versions will not change documented trace
294 output without adding additional `debugmode' flags.
296 ** Enhance the `ifdef', `ifelse', and `shift' builtins, as well as all
297 user macros, to transparently handle builtin tokens generated by `defn'.
299 ** Allow the concatenation of builtin macros with arbitrary text in
300 several contexts, via the `defn' builtin or argument expansion, rather
301 than warning and converting the builtin token to an empty string.
302 However, it is still not possible to use a concatenated builtin when
305 ** Enhance the `defn', `dumpdef', `ifdef', `popdef', `traceon', `traceoff',
306 and `undefine' macros to warn when encountering a builtin token in the
307 context of a macro name, rather than acting on the empty string. This
308 was already done for `define', `pushdef', `builtin', and `indir'.
310 ** Enhance the `eval' builtin to understand the `?:' operator, and
311 downgrade a failed parse due to an unknown operator from an error to a
314 ** A number of portability improvements inherited from gnulib.
316 * Noteworthy changes in Version 1.4.10b (2008-02-25) [beta]
317 Released by Eric Blake, based on git version 1.4.10a
319 Note that M4 1.4.10b was released prior to 1.4.11, and includes all the
320 features of 1.4.11 except for C99 parsing in the `format' builtin. It also
321 contains the following beta features that were deemed worth deferring until
324 ** Further enhance the `index' builtin to often achieve sublinear results.
326 ** Enhance the `regexp' and `patsubst' builtins to cache frequently used
327 regular expressions, which speeds up typical Autoconf usage.
329 ** Enhance the `format' builtin to warn for more suspicious usages, such as
330 missing arguments or problems parsing according to the format string.
332 ** Enhance the `ifelse' and `shift' builtins so that tail-recursive
333 algorithms based on `$@' operate in linear, rather than quadratic, time
336 ** A number of portability improvements inherited from gnulib.
338 * Noteworthy changes in Version 1.4.13 (2009-04-01) [stable]
339 Released by Eric Blake, based on git version 1.4.12.*
341 ** The manual is now distributed under the terms of FDL 1.3.
343 ** The `divert' and `undivert' builtins have been made more efficient
344 when using temporary files for large diversions.
346 ** The `translit' builtin has been made more efficient when the second
349 ** The input engine has been optimized for faster processing.
351 ** The command line option `--debugfile', introduced in 1.4.7, now
352 treats its argument as optional, in order to allow setting the debug
353 output back to stderr when used without an argument; and order is now
354 significant with respect to command line files. You must therefore use
355 `m4 --debugfile=trace file', not `m4 file --debugfile trace'. This
356 change does not affect the deprecated `-o'/`--error-output' option.
358 ** The `syscmd' and `esyscmd' builtins can be configured to use an
359 alternate shell, via the new `configure' option `--with-syscmd-shell'.
361 ** A number of portability improvements inherited from gnulib.
363 * Noteworthy changes in Version 1.4.12 (2008-10-10) [stable]
364 Released by Eric Blake, based on git version 1.4.11.*
366 ** Fix regression introduced in 1.4.4b where using `traceon' could delete
367 a macro. This was most noticeable with `traceon(`traceon')', but
368 would also happen in cases such as `foo(traceon(`foo'))'.
370 ** Fix regression introduced in 1.4.7 where `m4 -N9' died with an assertion
373 ** Fix regression introduced in 1.4.11 where `defn' died with an assertion
374 failure on a traced but undefined macro.
376 ** New `-g'/`--gnu' command-line option overrides `-G'/`--traditional'.
377 For now, the environment variable POSIXLY_CORRECT has no effect on M4
378 behavior; but a future release of M4 will behave as though --traditional
379 is implied if POSIXLY_CORRECT is set (this future change is necessary,
380 because in the current release, there is no way to disable GNU
381 extensions that conflict with POSIX without the use of a non-POSIX
382 command-line argument). Clients of M4 that want to use GNU extensions,
383 even when POSIXLY_CORRECT is set, should start using the -g command-line
384 argument, even though it is currently a no-op if -G did not appear
385 earlier in the command line, so that the client will not break in the
386 face of an upgraded m4 and a POSIXLY_CORRECT execution environment.
388 ** The `-L'/`--nesting-limit' command-line option now defaults to 0 for
389 unlimited on platforms that can detect and deal with stack overflow. On
390 systems that lack alternate stack support, such as Cygwin, and on
391 systems that do not obey the POSIX semantics for distinguishing stack
392 overflow from other exceptions, such as Linux, you can optionally
393 install the libsigsegv library (version 2.6 or newer recommended) to
394 enhance m4's ability to accurately report stack overflow:
395 http://www.gnu.org/software/libsigsegv/
397 ** A number of portability improvements inherited from gnulib.
399 * Noteworthy changes in Version 1.4.11 (2008-04-02) [stable]
400 Released by Eric Blake, based on git version 1.4.10a
402 ** Security fixes for the -F option, for bugs present since -F was
403 introduced in 1.3: Avoid core dump with 'm4 -F file -t undefined', and
404 avoid arbitrary code execution with certain file names.
406 ** Fix regression introduced in 1.4.9b in the `divert' builtin when more
407 than 512 kibibytes are saved in diversions on platforms like NetBSD
408 or darwin where fopen(name,"a+") seeks to the end of the file.
410 ** The output of the `maketemp' and `mkstemp' builtins is now quoted if a
411 file was created. This is a minor security fix, because it was possible
412 (although rather unlikely) that an unquoted string could match an
413 existing macro name, such that use of the `mkstemp' output would trigger
414 inadvertent macro expansion and operate on the wrong file name.
416 ** Enhance the `defn' builtin to support concatenation of multiple text
417 arguments, as required by POSIX. However, at this time, it is not
418 possible to concatenate a builtin macro with anything else; a warning is
419 now issued if this is attempted, although a future version of M4 may
420 lift this restriction to match other implementations.
422 ** Enhance the `format' builtin to parse all C99 floating point numbers,
423 even on platforms where strtod(3) is buggy, although the replacement
424 function does have the known issue of rounding errors when parsing
425 some decimal floating point values. This fixes testsuite failures
426 introduced in 1.4.9b.
428 ** Enhance the `index' builtin to guarantee linear behavior, in spite of
429 the surprisingly large number of systems with a brain-dead quadratic
432 ** A number of portability improvements inherited from gnulib.
434 * Noteworthy changes in Version 1.4.10 (2007-07-09) [stable]
435 Released by Eric Blake, based on CVS version 1.4.9c
437 ** Upgrade from GPL version 2 to GPL version 3 or later.
439 ** A number of portability improvements inherited from gnulib.
441 ** Avoid undefined behavior introduced in 1.4.9b in the `format' builtin
442 when handling %c. However, this area of code has never been documented,
443 and currently does not match the POSIX behavior of printf(1), so it may
444 have further changes in the next version.
446 * Noteworthy changes in Version 1.4.9b (2007-05-29) [beta]
447 Released by Eric Blake, based on CVS version 1.4.9a
449 ** Fix regression introduced in 1.4.9 in the `eval' builtin when performing
452 ** Fix regression introduced in 1.4.8 in the `-F' option that made it
453 impossible to freeze more than 512 kibibytes of diverted text.
455 ** The synclines option `-s' no longer generates sync lines in the middle of
456 multiline comments or quoted strings.
458 ** Work around a number of corner-case POSIX compliance bugs in various
459 broken stdio libraries. In particular, the `syscmd' builtin behaves
460 more predictably when stdin is seekable.
462 ** The `format' builtin now understands formats such as %a, %A, and %'hhd,
463 and works around a number of platform printf bugs. Furthermore, the
464 sequence format(%*.*d,-1,-1,1) no longer outputs random data. However,
465 some non-compliant platforms such as mingw still have known bugs in
466 strtod that may cause testsuite failures.
468 ** The testsuite is improved to also run gnulib portability tests for the
469 features that M4 imports from gnulib.
471 * Noteworthy changes in Version 1.4.9 (2007-03-23) [stable]
472 Released by Eric Blake, based on CVS version 1.4.8c
474 ** Minor documentation and portability cleanups.
476 * Noteworthy changes in Version 1.4.8b (2007-02-24) [beta]
477 Released by Eric Blake, based on CVS version 1.4.8a
479 ** Fix a regression introduced in 1.4.8 that made m4 unable to process
480 files larger than 2GiB on some platforms.
482 ** Fix a regression introduced in 1.4.8 that made m4 dump core when
483 invoked as 'm4 -- file'.
485 ** The `eval' builtin now follows C precedence rules. Additionally, the
486 short-circuit operators correctly short-circuit division by zero. The
487 previously undocumented alias of '=' meaning '==' in eval now triggers a
488 deprecation warning, so that a future version of M4 can implement a form
489 of variable assignment as an extension.
491 ** The `include' builtin now affects exit status on failure, as required by
492 POSIX. Use `sinclude' if you need a successful exit status.
494 ** The `-E'/`--fatal-warnings' command-line option now has two levels. When
495 specified only once, warnings affect exit status, but execution
496 continues, so that you can see all warnings instead of fixing them one
497 at a time. To achieve 1.4.8 behavior, where the first warning
498 immediately exits, specify -E twice on the command line.
500 ** A new `--warn-macro-sequence' command-line option allows detection of
501 sequences in `define' and `pushdef' definitions that match an optional
502 regular expression. The default regular expression is
503 `\$\({[^}]*}\|[0-9][0-9]+\)', corresponding to the sequences that might
504 not behave correctly when upgrading to the eventual M4 2.0. By default,
505 M4 2.0 will follow the POSIX requirement that a macro definition
506 containing `$11' must expand to the first argument concatenated with 1,
507 rather than the eleventh argument; and will take advantage of the POSIX
508 wording that allows implementations to treat `${11}' as the eleventh
509 argument instead of literal text. Be aware that Autoconf 2.61 will not
510 work with this option enabled with the default regular expression; but
511 Autoconf 2.62 will be compatible with this option.
513 ** Improved portability to platforms such as BSD/OS and AIX.
515 * Noteworthy changes in Version 1.4.8 (2006-11-20) [stable]
516 Released by Eric Blake, based on CVS version 1.4.7a
518 ** The `divert' macro and `-H'/`--hashsize' command line option no longer
519 cause a core dump when handed extra large values. Also, `divert' now
520 uses memory proportional to the number of diversions in use, rather than
521 to the maximum diversion number encountered, so that large diversion
522 numbers are less likely to exhaust system memory; and is no longer
523 limited by the maximum number of file descriptors.
525 ** The `--help' and `--version' command line options now consistently
526 override all earlier options. For example, `m4 --debugfile=trace
527 --help' now no longer accidentally creates an empty file `trace'.
529 ** The `-L'/`--nesting-limit' command line option can now be set to 0
530 to remove the default limit of 1024. However, it is still possible that
531 heavily nested input can cause abrupt program termination due to stack
534 ** Problems encountered when writing to standard error, such as with the
535 `errprint' macro, now always cause a non-zero exit status.
537 ** Warnings and errors issued during macro expansion are now consistently
538 reported at the line where the macro name was detected, rather than
539 where the close parenthesis resides. Text wrapped by `m4wrap' now
540 remembers the location that was in effect when m4wrap was invoked,
541 rather than changing to line 0 and the empty string for a file. The
542 macros `__line__' and `__file__' now work correctly even as the last
543 token in an included file.
545 ** The `builtin' and `indir' macros now transparently handle builtin
546 tokens generated by `defn'.
548 ** When diversions created by the `divert' macro collect enough text that
549 M4 must use temporary files, the environment variable $TMPDIR is now
550 consulted, and a better effort is made to clean up those files in the
551 event of a fatal signal.
553 ** The `mkstemp' builtin is added with the same GNU semantics as `maketemp',
554 based on the recommendation of POSIX to deprecate the POSIX semantics of
555 `maketemp' as inherently insecure. In GNU mode (no -G supplied on the
556 command line), `maketemp' silently retains the secure GNU semantics, but
557 a future release of M4 will change this to emit a warning. In
558 traditional mode (m4 -G), `maketemp' now uses the POSIX-mandated
559 insecure semantics, and issues a warning that you should convert your
560 script to use `mkstemp' instead. Additionally, `mkstemp' and `maketemp'
561 are now well-defined even if the template argument does not end in six
564 ** The manual has been improved, including a new section on a composite
567 ** The `changecom' and `changequote' macros now treat an empty second
568 argument the same as if it were missing, rather than using the empty
569 string and making it impossible to end a comment or quote.
571 ** The `translit' macro now operates in linear instead of quadratic time,
572 and is now eight-bit clean.
574 ** The `-D', `-U', `-s', and `-t' command line options now take effect
575 after any files encountered earlier on the command line, rather than up
576 front, as is done in traditional implementations and required by POSIX.
578 * Noteworthy changes in Version 1.4.7 (2006-09-25) [stable]
579 Released by Eric Blake, based on CVS version 1.4.6a
581 ** Fix regression from 1.4.5 in handling a file that ends in a macro
582 expansion without arguments instead of a newline.
584 ** The define and pushdef macros now warn when the first argument is not
585 a string, rather than silently doing nothing.
587 ** Standard input can now be read more than once, as in 'm4 - file -', and
588 is not closed until all wrapped text is handled. This makes a
589 difference when stdin is not a regular file, and also fixes bugs when
590 using the syscmd or esyscmd macros from wrapped text.
592 ** When standard input is a seekable file, the m4exit, syscmd, and esyscmd
593 macros now restore the current position to the next unread byte rather
594 than discarding an arbitrary amount of buffered data.
596 ** SysV command-line compatibility is no longer a goal of GNU M4; the
597 focus will be instead on POSIX compatibility. This release continues to
598 support previous usage, but adds warnings in areas which will allow a
599 future version of GNU M4 to use its own extensions without being tied to
600 the SysV command line interface.
602 ** The no-op compatibility command line options -B, -N, -S, -T, and
603 --diversions may be withdrawn or assigned new meanings in future
604 releases, so they now issue a warning if used.
606 ** A new command line option -i replaces the compatibility -e as the
607 short spelling of --interactive, for consistency with other GNU tools; a
608 warning is issued if the old spelling is used, and it may be assigned
609 new meaning in future releases.
611 ** A new command line option --debugfile replaces the options -o and
612 --error-output as the preferred spelling. The old options were
613 misleading in their names and inconsistent with other GNU tools; they
614 are still silently accepted, but no longer documented in --help, and may
615 be assigned new meanings in future releases.
617 * Noteworthy changes in Version 1.4.6 (2006-08-25) [stable]
618 Released by Eric Blake, based on CVS version 1.4.5a
620 ** Fix buffer overruns in regexp and patsubst macros when handed a trailing
621 backslash in the replacement text, or when handling \n substitutions
622 beyond the number of \(\) groups.
624 ** Fix memory leak in regexp, patsubst, and changeword macros.
626 ** The format macro now understands %F, %g, and %G.
628 ** When loading frozen files, m4 now exits with status 63 if version
629 mismatch is detected.
631 ** Fix bugs that occurred when invoked with stdout or stderr closed,
632 and detect write failures to stdout or to the target of the debugfile
633 macro. In particular, the syscmd and esyscmd macros can no longer
634 interfere with the debug stream or diversions.
636 ** The m4exit macro now converts values outside the range 0-255 to 1.
638 ** It is now an error if a command-line input file ends in the middle of a
639 comment, matching the behavior of mid-string and mid-argument
642 ** The dnl macro now warns if end of file is encountered instead of a
645 ** The error message when end of file is encountered now uses the file and
646 line where the dangling construct started, rather than `NONE:0:'.
648 ** The debugmode and __file__ macros, and the -s/--synclines option, now
649 show what directory a file was found in when the -I/--include option or
650 M4PATH variable had an effect.
652 ** The changequote and changecom macros now work with 8-bit characters, and
653 quotes and comments that begin with `(' are properly recognized
656 ** The new macro __program__ is added, which allows the input file to issue
657 an error message that resembles messages from m4. Warning and error
658 messages have been reformatted to comply with GNU Coding Standards.
660 ** The errprint, m4wrap, and shift macros are now recognized only with
663 ** The index, substr, translit, regexp, and patsubst macros now produce
664 output when given only one argument, but still warn about a missing
667 ** The patsubst macro now reliably finds zero-length matches at the end
670 * Noteworthy changes in Version 1.4.5 (2006-07-15) [stable]
671 Released by Eric Blake, based on CVS version 1.4.4c
673 ** Fix sysval on BeOS, OS/2, and other systems that store exit status
674 in the low-order byte. Additionally, on Unix platforms, if syscmd was
675 terminated by a signal, sysval now displays the signal number shifted
676 left by eight bits, to match traditional m4 implementations.
678 ** The maketemp macro is no longer subject to platform limitations (such as
679 26 or 32 max files from a given template).
681 ** Frozen files now require that the first directive be V (version), to
682 better diagnose version mismatch. Additionally, if the F directive
683 (builtin function) names an unknown builtin that existed in the m4 that
684 froze the file but not in the current m4 (for example, changeword), the
685 warning is deferred until an attempt is made to actually use the
686 builtin. This allows downgrading from beta m4-1.4o to stable m4-1.4.5
687 without breaking autoconf.
689 ** The format and indir macros are now recognized only with arguments.
691 ** The eval macro no longer crashes on x86 architectures when dividing the
692 minimum integer by -1.
694 ** On systems with ecvt and fcvt, format no longer truncates trailing
695 zeroes on integers printed with %.0f. On systems without these
696 functions, format is no longer subject to a buffer overflow that
697 permitted arbitrary code execution.
699 ** On native Windows builds, the macro __windows__ is provided instead of
700 __unix__. Likewise, on OS/2 builds, the macro __os2__ is provided.
701 This allows input files to determine when syscmd might behave
704 ** Fix bug in 1.4.3 patch to use \n line-endings that did not work for
707 ** When given the empty string or 0, undivert is now documented as a no-op
708 rather than closing stdout, warning about a non-existent file, or trying
709 to read a directory as a file.
711 ** Many documentation improvements. Also, the manual is now distributed
712 under FDL 1.2, rather than a stricter verbatim-only license.
714 ** Raise the -L (--nesting-limit) command line option limit from 250 to
717 ** The decr, incr, divert, m4exit, and substr macros treat an empty number
718 as 0, issue a warning, and expand as normal; rather than issuing an
719 error and expanding to the empty string.
721 ** The eval macro now treats an empty radix argument as 10, handles radix 1,
722 and treats the width argument as number of digits excluding the sign,
723 for compatibility with other m4 implementations.
725 ** The ifdef, divert, m4exit, substr, and translit macros now correctly
726 ignore extra arguments.
728 ** The popdef and undefine macros now correctly accept multiple arguments.
730 ** Although changeword is on its last leg, if enabled, it now reverts to the
731 default (faster) regexp when passed the empty string.
733 ** The regexp and substr macros now warn and ignore a trailing backslash in
734 the replacement, and warn on \n for n larger than the number of
735 sub-expressions in the regexp.
737 * Noteworthy changes in Version 1.4.4b (2006-06-17) [beta]
738 Released by Eric Blake, based on CVS version 1.4.4a
740 ** Fix a recursive push_string crashing bug, which affected changequote of
741 three or more characters on some compilers.
743 ** Use automake to fix build portability issues.
745 ** Fix a recursive m4wrap crashing bug.
747 ** Fix a 1 in 2**32 hash crashing bug.
749 ** Tracing a macro by name is now persistent, even if the macro is
750 subsequently undefined or redefined. The traceon and traceoff macros no
751 longer warn about undefined symbols. This solves a crash when using
752 indir on an undefined macro traced with the -t option, as well as an
753 incorrect result of ifdef. Furthermore, tracing is no longer
754 transferred with builtins, solving the bug of "m4 -tm4_eval" failing to
755 give trace output on the input
756 "define(`m4_eval',defn(`eval'))m4_eval(1)".
758 ** Fix a crash when a macro is undefined while collecting its arguments, by
759 always using the definition that was in effect before argument
760 collection. This behavior matches the C pre-processor, and means that
761 the sequence "define(`f',`1')f(define(`f',`2'))f" is now documented to
762 result in "12", rather than the previously undocumented "22".
764 ** Update the regex engine to fix several bugs.
766 ** Fix a potential crash on machines where char is signed.
768 * Noteworthy changes in Version 1.4.4 (Oct 2005) [stable]
769 Released by Gary V. Vaughan
771 ** ./configure --infodir=/usr/share/info now works correctly.
773 ** When any file named on the command line is missing exit with status 1.
775 * Noteworthy changes in Version 1.4.3 (Mar 2005) [stable]
776 Released by Gary V. Vaughan
778 ** DESTDIR installs now work correctly.
780 ** Don't segfault with uncompilable regexps to changeword().
782 ** Always use \n line-endings for frozen files (fixes a Windows bug).
784 ** Portability fix for systems lacking mkstemp(3).
786 ** Approximately 20% speed up in the common case of usage with autoconf.
788 ** Supported on QNX 6.3.
790 * Noteworthy changes in Version 1.4.2 (Aug 2004) [stable]
791 Released by Paul Eggert
793 ** No user visible changes; portability bug fixes only.
795 * Noteworthy changes in Version 1.4.1 (Jun 2004) [stable]
796 Released by Paul Eggert
798 ** The 1.4.x series is intended to be stable; features added in 1.4[a-q]
799 were not backported to 1.4.x unless specifically mentioned above.
801 ** maketemp now creates an empty file with the given name, instead of merely
802 returning the name of a nonexistent file. This closes a security hole.
805 * Version beta 1.4q - August 2001, by Gary V. Vaughan
807 ** Support for the experimental `changeword' has been dropped.
809 ** `m4 --hashsize' and `-H' are still accepted, but have no effect. M4
810 will grow its internal symbol table if the symbol density is having an
811 effect on performance.
813 ** `configure --without-modules' will build an m4 binary with no preloaded
814 modules. At startup it will search for and load modules `m4' and either
815 `gnu' or `traditional'. This mode of operation can be used for
816 development and debugging of the base modules without the need to
817 recompile all of m4 with each modification.
819 ** `configure --with-modules="gnu m4 traditional load"', for example,
820 will build an m4 binary with the named modules preloaded, ready to be
821 activated (even on static lib only machines) with the `-m' option or
822 using the `load' builtin.
824 ** M4 has no builtins or macros in core, they are all loaded from modules
825 at startup. This means that modules are no longer optional, though the
826 standard build will statically link the modules `m4', `gnu' and
827 `traditional', so even on machines with no ltdl support, all of the
828 functionality from previous releases is available.
830 ** New builtin `load' to dynamically load modules which can define new
831 builtins and user macros.
833 ** New builtin `unload' to remove loaded modules (and the builtins and user
834 macros they define) from the running m4 interpreter.
836 ** New builtins `eregexp' and `epatsubst' to use Extended Regular
837 Expressions syntax in lieu of Basic Regular Expressions as used by
838 `regexp' and `patsubst'.
840 ** The names of all currently loaded modules are returned by the new
841 builtin, ``modules''.
843 ** Loadable modules can define new builtin functions or text expansion
846 ** The module code has been rewritten to use libltdl, the libtool dynamic
847 loader, which means GNU m4 can now load (and unload) modules just about
848 anywhere which it can be built. This includes obscure hosts such as
849 cygwin and BeOS, and also on hosts which do not have shared libraries,
850 through preloading (see libtool manual) and GNU dld.
852 ** Modules can now be built without the m4 source being available using the
853 installed m4module.h header file (and some other headers that it
854 includes for you), and the installed libm4.la libtool library. All
855 symbols exported from libm4.la have a prefix of `m4_' or `M4_'. See the
856 modules directory for examples of usage.
858 ** A new V2 format for frozen files that saves module and syntax information.
860 * Version beta 1.4o - January 2000, by Rene' Seindal
862 ** Modules can be loaded from the command line with --load-module
864 ** Modules now use libtool's wrapper libltdl.
866 ** New builtin `symbols' allows dynamic queries of all currently defined
869 ** Various Bug fixes.
871 * Version beta 1.4n - November 1998, by Rene' Seindal
873 ** The module code has been reorganised yet again, and now compiles
874 correctly on GNU/Linux, HPUX 9 and 10, SunOS 5 and Solaris 5.
876 ** When configured --with-gmp a new builtin `mpeval' is now defined. The
877 builtin `eval' retains its normal behaviour.
879 ** m4 --version also shows which options were used for compilation, such as:
880 "GNU m4 1.4n (options: modules gmp changeword)"
882 ** New option --import-environment defines all environment variables as
883 macros. This is done before -D and -U are handled, so the macros can be
884 changed through these options.
886 ** Error messages now always print program name before input file name as
887 specified by GNU coding standards. Reported by Akim Demaille.
889 ** Bug fixed: "undivert(0)" could cause m4 to read standard output. A call
890 of "undivert(0)" is now silently ignored.
892 ** Bug fixed: when compiling --with-included-gettext, <libintl.h> wasn't
893 found in intl/ directory. Reported by Andrew Bettison.
895 * Version beta 1.4m - November 1998, by Rene' Seindal
897 ** Using libtool for compiling modules and for linking main app.
899 ** Reorganised the dynamic module code to encapsulate system dependencies
900 better. The code for HPUX shl_load() still needs testing and debugging.
901 A dld interface is also missing. Any volunteers?
903 ** The files from the GNU m4 web-site is now in examples/WWW as a more
904 complete example of what GNU m4 can do.
906 * Version beta 1.4l - November 1998, by Rene' Seindal
908 ** GNU m4 now has an escape syntax category. If a character is marked as
909 an escape, words are only recognised as macros if preceded by an escape
910 character. It is a bit like -P, but dynamic: it can be turned on and
911 off. The GNU m4 web-site on http://www.seindal.dk/rene/gnu/ is
912 maintained with this feature - the m4 source is available on the site.
914 ** The module interface is improved, thanks to "Brian J. Fox",
915 who has contributed some code from Meta-HTML. The modules now build
916 automatically and installs properly, by default in
917 /usr/local/libexec/m4. There is a preliminary, untested support for
920 ** There is now a __m4_version__ macro that expands to the current version
923 * Version beta 1.4k - November 1998, by Erick Branderhorst and Rene' Seindal
925 ** GNU m4 now uses gettext to support internationalization.
927 ** GNU m4 now uses automake to control Makefile.in generation. This
928 should make it more consistent with the GNU standards.
930 ** GNU m4 will use the gmp library for multiple precision integral and
931 rational arithmetic in `eval' if configured with `--with-gmp'. If
932 configured without `--with-gmp' or if gmp is not available, and the type
933 `long long int' is, GNU m4 will use that for `eval' arithmetic.
935 ** GNU m4 now parses the input according to a syntax table, that can be
936 modified through the new builtin `changesyntax'. It is a generalisation
937 of the existing builtins `changecom' and `changequote'. The changes are
938 completely backwards compatible (except for the existence of
941 ** Sync lines can be turned on and off with the `syncoutput' builtin. The
942 builtin `syncoutput' is a GNU extension.
944 ** New experimental feature: dynamically loadable modules. New builtin
945 `loadmodules' loads shared libraries, that can define new builtin
946 macros, ie, new macros can be written in C. Depends on the dlopen()
947 interface, and is currently only tested on Linux. Enabled at configure
948 time with `--with-modules'. Documentation is in src/module.c and
951 ** Implement a GNU message catalog for French (Franc,ois Pinard).
953 ** Filenames found through path searches are now correctly reflected in
954 error and debug messages and through the `__file__' macro.
958 *** All 8-bit characters can now be used for quotes.
960 * Version 1.4 - October 1994, by Franc,ois Pinard
962 ** (No user visible changes)
964 * Version 1.3 - September 1994, by Franc,ois Pinard
966 ** Diversions are created as needed. Option `-N' is still accepted, but
967 otherwise ignored. Users should use only negative diversion numbers,
968 instead of high positive numbers, for diverting to nowhere.
970 ** Diversions should also work faster. No temporary files will be needed
971 at all if all diversions taken altogether do not use more than 512K.
973 ** Frozen state files may be produced with the `--freeze-state' (-F)
974 option and later brought back through the `--reload-state' (-R) option.
976 * Version 1.2 - July 1994, by Franc,ois Pinard
978 ** In patsubst(STRING, REGEXP, REPLACEMENT), \& in REPLACEMENT has been
979 changed to represent this part of STRING matched by the whole REGEXP,
980 instead of the whole STRING as before. \0 does the same, but emits a
981 diagnostic saying it will disappear in some subsequent release.
983 ** eval(EXPR) emits a diagnostic if EXPR has suffixed crumb. The same for
984 other numeric conversions in incr(), decr(), divert(), etc.
986 ** `--fatal-warnings' (-E) stops execution at first warning.
988 ** `--nesting-limit=LEVEL' (-L LEVEL) sets a limit to macro nesting.
989 It is initially fixed at 250.
991 ** `--word-regexp=REGEXP' (-W REGEXP) modifies macro name syntax, like
992 does the new `changeword(REGEXP)' macro. This feature is experimental,
993 tell me your opinions about it. You do need --enable-changeword at
994 configure time to get these things. Do *not* depend on them yet.
996 ** Trace output format is scannable by GNU Emacs' next-error function.
998 ** Stack overflow is detected and diagnosed on some capable systems.
1000 ** Various bugs have been corrected, m4 should be more portable. See the
1001 ChangeLog for details.
1003 * Version 1.1 - November 1993, by Franc,ois Pinard
1005 ** Changes which might affect existing GNU m4 scripts:
1007 *** Option `-V' has been removed, use `--version' instead. `--version'
1008 writes on standard output instead of standard error, and inhibits any
1011 *** `--no-gnu-extensions' has been renamed `--traditional'.
1013 *** In `eval', `^' used to indicate exponentiation, use `**' instead.
1015 *** The automatic undiversion which takes place at end of all input is
1016 forced into the main output stream.
1018 ** Changes which are unlikely to affect existing scripts:
1020 *** `--help' prints an usage summary on standard output. Script execution
1023 *** `--prefix-builtins' (-P) prefixes all builtin macros by `m4_'.
1025 *** Most builtin macros for which arguments are mandatory, called without
1026 any arguments, are no more recognized as builtin macros: they are
1027 consequently copied verbatim to the output stream.
1029 *** `define' and `pushdef' are usable with only one argument, they give
1030 this argument an empty definition.
1032 *** `eval' new operators for binary representation handling: `^' for
1033 exclusive-or, `~' for the bitwise negation, `<<' and `>>' for shifts.
1035 *** `eval' recognizes the notation 0bDIGITS for binary numbers and the
1036 notation 0rRADIX:DIGITS for numbers in any radix from 1 to 36.
1038 * Version 1.0.3 - December 1992, by Franc,ois Pinard
1040 ** Changes for the user:
1042 *** `dnl' outputs a diagnostic if immediately followed by `('. Usually,
1043 `dnl' is followed by newline or whitespace.
1045 *** `ifelse' accepts without complaining the common idiom of having only
1046 one argument. This is useful for introducing long comments.
1048 *** `eval' always expresses values as signed, whatever the radix.
1050 *** M4OPTS environment variable is no longer obeyed.
1052 *** `--no-warnings' option is renamed `--silent'.
1054 *** Debug lines use a new format more compatible with GNU standards.
1056 *** Various bugs have been corrected. See the ChangeLog for details.
1058 ** Changes for the installer:
1060 *** GNU m4 now uses an Autoconf-generated configure script, and should be
1061 more easily portable in many ways. (Cray is not supported yet).
1063 *** `make check' has been made more portable, expect no errors.
1065 ** Changes for the programmer:
1067 *** Sources have been fully reindented to comply with GNU standards, and
1068 cleaned up in many ways.
1070 *** Sources have been protoized. Non-ANSI compilers are automatically
1071 detected, then sources are unprotoized on the fly before compilation.
1073 *** GNU m4 uses newer versions of obstack, regex, getopt, etc.
1075 * Version 1.0 - October 1991, by Rene' Seindal
1077 ** Uses GNU configure, taken from the gdb distribution.
1079 ** Uses GNU getopt(), with long option names.
1081 ** The -Q/+quiet option is added, which suppresses warnings about missing
1082 or superflous arguments to builtin macros.
1084 ** Added default options via the M4OPTS environment variable.
1086 ** Several minor bugs have been fixed.
1088 * Version 0.99 - July 1991, by Rene' Seindal
1090 ** The builtins `incr' and `decr' are now implemented without use of
1093 ** The builtin `indir' is added, to allow for indirect macro calls
1094 (allows use of "illegal" macro names).
1096 ** The debugging and tracing facilities has been enhanced considerably.
1097 See the manual for details.
1099 ** The -tMACRO option is added, marks MACRO for tracing as soon as it
1102 ** Builtins are traced after renaming iff they were before.
1104 ** Named files can now be undiverted.
1106 ** The -Nnum option can be used to increase the number of divertions
1109 ** Calling changecom without arguments now disables all comment handling.
1111 ** A bug in `dnl' is fixed.
1113 ** A bug in the multi-character quoting code is fixed.
1115 ** Several typos in the manual has been corrected. More probably persist.
1117 * Version 0.75 - November 1990, by Rene' Seindal
1119 ** Implemented search path for include files (-I option and M4PATH
1120 environment variable).
1122 ** Implemented builtin `format' for printf-like formatting.
1124 ** Implemented builtin `regexp' for searching for regular expressions.
1126 ** Implemented builtin `patsubst' for substitution with regular
1129 ** Implemented builtin `esyscmd', which expands to a shell commands output.
1131 ** Implemented `__file__' and `__line__' for use in error messages.
1133 ** Implemented character ranges in `translit'.
1135 ** Implemented control over debugging output.
1137 ** Implemented multi-character quotes.
1139 ** Implemented multi-character comment delimiters.
1141 ** Changed predefined macro `gnu' to `__gnu__'.
1143 ** Changed predefined macro `unix' to `__unix__', when the -G option is
1144 not used. With -G, `unix' is still defined.
1146 ** Added program name to error messages.
1148 ** Fixed two missing null bytes bugs.
1150 * Version 0.50 - January 1990, by Rene' Seindal
1152 * Initial beta release.