1 GNU M4 NEWS - History of user-visible changes. -*- outline -*-
3 * Noteworthy changes in Version 1.9b (201x-??-??) [beta]
4 Released by ????, based on git version 1.9a-*
6 NOTE - there are still a number of FIXMEs to resolve before this can be
11 *** The build environment has been updated to modern GNU practices,
12 depending on newer features of Autoconf, Automake, Libtool, Gettext,
13 and Gnulib to be more portable to a wide variety of platforms.
15 ** New command line behavior
17 *** If the POSIXLY_CORRECT environment variable is set, it implies the
18 `-G' and `-Q' options, effectively giving a more fully POSIX-compliant
19 implementation with only compatible GNU extensions.
21 *** New `-b'/`--batch' command-line option to force non-interactive mode.
22 Also, in addition to `-e'/`--interactive' requesting interactive mode,
23 m4 now follows the lead of sh, and automatically enters interactive
24 mode when there are no files specified, and when both standard input
25 and standard error are terminals.
27 *** New `-B'/`--prepend-include' command-line option allows prepending to
28 the include path, rather than always searching `.' first.
30 *** New `--debuglen' command-line option matches the spelling of a new
31 macro, and the old spelling `--arglength' now issues a warning that it
32 might be withdrawn in the future.
34 *** The `-g'/`--gnu' command-line option is now required to allow all GNU
35 extensions when POSIXLY_CORRECT is set.
37 *** The `-H'/`--hashsize' command-line options, which were made no-ops in
38 a previous beta, now issue a deprecation warning.
40 *** The `-L'/`--nesting-limit' command-line option now performs argument
41 validation and accepts an optional multiplier suffix.
43 *** New `-p'/`--pushdef' and `--popdef' command-line options allow more
44 control over macro definitions from the command line between input
47 *** New `--posix' command-line option is a synonym for `-G'/`--traditional'.
49 *** New `-r'/`--regexp-syntax' command-line option changes the default
50 regular expression syntax used by M4. Without this option, M4
51 continues to use EMACS style expressions. A new section in the info
52 docs explains the differences between them, and what builtins are
55 *** New `--safer' command-line option cripples the potentially unsafe
56 builtins `debugfile', `esyscmd', `maketemp', `mkdtemp', `mkstemp', and
59 *** New `--syncoutput' command-line option matches the builtin added in a
60 previous beta, and provides more control over sync line generation
61 from the command line between input files. The previous options
62 `-s'/`--synclines' remain as aliases for `--syncoutput=1'.
64 *** New `--traceoff' command-line option, and new spelling `--traceon' for
65 `--trace', allow more control over macro tracing from the command line
68 *** New `--warnings' command-line option re-enables warnings, overriding
69 `-Q'/`--quiet'/`--silent', allowing warnings even when POSIXLY_CORRECT.
71 *** When GNU extensions are enabled, any command line arguments that wauld
72 have been interpreted as input file names with previous releases are
73 still searched for as before, but will first attempt to be loaded as
74 compiled modules before falling back on loading as m4 input. In
75 POSIXLY_CORRECT mode, only m4 input files in the current directory can
80 *** The `defn' builtin now allows any number of arguments, as POSIX requires.
81 - FIXME: This still doesn't work with concatenating builtins with text.
83 - FIXME: POSIX recommends using ${10} instead of $10 for the tenth
84 positional argument. We should deprecate $10.
88 *** The experimental `epatsubst' and `eregexp' builtins have been removed
89 in favor of a new `changeresyntax' builtin.
91 *** The `load' builtin, introduced in previous betas has been removed in
92 lieu of richer `include' and `sinclude' functionality.
96 *** New `changeresyntax' builtin allows programmatic setting of the default
97 regular expression flavor, to match `-r'/`--regexp-syntax' command-line
100 *** New `debuglen' builtin allows runtime setting of debug output length,
101 previously controlled only by the `-l' command line argument.
102 Additionally, whether using the new macro or the command line argument,
103 the length limitation now affects dumpdef output as well as trace
104 output, undergoes argument validation, and accepts an optional
106 - FIXME the multiplier suffix isn't reliable yet
108 *** New `mkdtemp' builtin parallels `mkstemp', but allows the creation of
109 temporary directories instead of files.
111 *** New `refcount' builtin allows tracking how many times a module has
113 - FIXME: consider making m4modules smarter for this purpose
115 *** New `renamesyms' builtin allows programmatic renaming of all symbols
116 according to a regular expression.
117 - FIXME: This feature can cause core dumps when renaming multiple
118 symbols to the same name.
120 *** New `__traditional__' builtin identifies when the traditional module
121 is loaded instead of the gnu module.
123 *** The `modules' and `symbols' builtins, introduced in previous betas,
124 have been renamed `m4modules' and `m4symbols', in order to minimize
125 problems when upgrading from 1.4.x and processing English text. To
126 prevent future problems, any future macro added as a GNU extension will
127 either be blind (ie. be unrecognized without arguments), or begin with
128 the prefix `m4' or `__'.
130 ** Changed behavior of builtins
132 *** The module identifier builtins, such as `__gnu__', `__m4_version__',
133 and `__unix__', now warn if given arguments.
135 *** The `builtin' builtin now has a special form, where if the first
136 argument is exactly the special token representing defn(`builtin'), the
137 expansion is the special token representing the builtin named in the
138 second argument. This allows regenerating a macro with a more
139 efficient mapping directly to a builtin function, rather than through
140 textual indirection through further expansions of `builtin'.
142 *** The `changesyntax' builtin has been improved, to make it easier to add
143 and remove characters from a syntax class without having to specify the
144 entire set of characters in that class. It also supports new syntax
145 categories, `$', `{' and `}', for extended argument handling in macro
146 definitions. See the manual for more examples.
148 *** New `m' flag to `-d'/`--debug' command-line option or `debugmode'
149 builtin traces actions related to module loading and unloading, and
150 affects `dumpdef' and trace output to show where builtins come from.
151 New `s' flag shows the entire stack of `pushdef' definitions during
152 `dumpdef'. The `c' flag has been updated to add information to the
153 first line to show the definition of the macro being expanded.
155 *** The `eval' and `mpeval' builtins now support the following new
156 operators: `>>>', `\', and `,'.
158 *** When GNU extensions are enabled, the `include' and `sinclude' builtins
159 continue to search directories one at a time, but will first attempt to
160 load arguments as compiled modules and then as m4 input before moving
161 to the next directory in the search path. In POSIXLY_CORRECT mode,
162 only m4 input in the current directory can be loaded.
164 *** The `maketemp' builtin now always warns that it is obsolete, even in GNU
165 mode where it uses the same secure algorithm as `mkstemp', because of
166 the recommendation of POSIX to obsolete `maketemp' as inherently
167 insecure when obeying POSIX.
169 *** The `m4symbols' builtin now warns if given a builtin token instead of
170 a macro name. It remains silent for undefined macros.
172 *** The `patsubst' and `regexp' builtins have a new optional 4th argument
173 to use a different regular expression syntax for the duration of that
176 *** The semantics of the `traceon' and `traceoff' builtins now match
177 traditional implementations: when called without arguments, they affect
178 global state rather than affecting only the macros defined at that
179 moment. The manual includes an example of how to recover 1.4.x
184 *** The syntax of frozen files format V2 has been improved to save
185 additional state. This includes the `R' directive for default regular
186 expression syntax, the `t' directive for traced macros, and the `d'
187 directive for debug mode. Existing directives with consecutive strings
188 now require an intermediate newline, for faster parsing. Also, a V2
189 file can now be represented completely in ASCII, thanks to escape
190 sequences. Unfortunately, files frozen by M4 1.4q cannot be read by
191 1.9b, but since 1.4q was not widely distributed, this is not expected
192 to be much of an issue, and comes with the territory of using a beta
194 - FIXME: format 2 still needs to catch more missing state; once 2.0 is
195 released, any further changes would introduce format 3.
197 *** Improvements made in the 1.4.x and 1.6 stable series have been
201 * Noteworthy changes in Version 1.6 (????-??-??) [stable]
202 Released by ????, based on git versions 1.4.10b.x-* and 1.5.*
204 ** Fix regression introduced in 1.4.4b where using `traceon' could delete
205 a macro. This was most noticeable with `traceon(`traceon')', but
206 would also happen in cases such as `foo(traceon(`foo'))'.
208 ** Fix regressions introduced in 1.4.10b:
209 *** Using `builtin' or `indir' to perform nested `shift' calls triggered
210 an assertion failure (not present in 1.4.11).
211 *** The command-line option -dV, as well as the builtin `debugmode(V)',
212 failed to enable `t' and `c' debug options (not present in 1.4.11).
213 *** Comments that contain unbalanced quotes were not rescanned correctly
214 when passed through $@ (not present in 1.4.11).
215 *** Using `defn' on a traced but undefined macro triggered an assertion
216 failure (also present in 1.4.11, but not 1.4.12).
218 ** Remove the undocumented command-line option '-N', as no one complained
219 about the assertion failure regression that it introduced in 1.4.7.
221 ** The `-o'/`--error-output' command-line options, which were replaced by
222 `--debugfile' in 1.4.7, now issue a deprecation warning. This warning
223 harmlessly triggers with versions of Autoconf 2.60 and earlier, but can
224 be silenced by applying this patch:
225 http://git.sv.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=714eeee87
227 ** Fix the `m4wrap' builtin to accumulate wrapped text in FIFO order, as
228 required by POSIX. The manual mentions a way to restore the LIFO order
229 present in earlier GNU M4 versions. NOTE: this change exposes a bug
230 in Autoconf 2.59 and earlier (which was fixed in Autoconf 2.60).
232 If you want your package to work with pre-installed Autoconf without
233 requiring 2.60, then add these lines to your project's configure.ac,
234 prior to calling AC_INIT:
236 # As long as this project is not ready to upgrade to autoconf 2.60
237 # or newer, make sure that newer M4 will still use LIFO order:
238 m4_define([m4_wrap], [m4_ifdef([_$0_text],
239 [m4_define([_$0_text], [$1]m4_defn([_$0_text]))],
240 [m4_define([_$0_text], [$1])m4_builtin([m4wrap],
241 [m4_default(m4_defn([_$0_text])m4_undefine([_$0_text]))])])])
243 On the other hand, if you want to install Autoconf 2.59 or earlier,
244 then apply this patch:
245 http://git.sv.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=56d42fa71
247 ** The `changecom' builtin semantics now match traditional
248 implementations; if the start-comment string resembles a macro name or
249 the start-quote string, comments are effectively disabled.
251 ** The `divert' builtin now accepts an optional second argument of text
252 that is immediately placed in the new diversion, regardless of whether
253 the current expansion is nested within argument collection of another
254 macro. It has also been optimized for faster performance.
256 ** The `substr' builtin now treats negative arguments as indices relative
257 to the end of the string, and accepts an optional fourth argument of
258 text to supply in place of the selected substring. The manual gives an
259 example of how to recover M4 1.4.x behavior, as well as an example of
260 simulating the new negative argument semantics with older M4.
262 ** The `index' builtin now takes an optional third argument as the index
263 to begin searching from, with a negative argument relative to the end of
266 ** The `-d'/`--debug' command-line option now understands `-' and `+'
267 modifiers, the way the builtin `debugmode' has always done; this allows
268 `-d-V' to disable prior debug settings from the command line, similar to
269 using the builtin `debugmode' without arguments. The option
270 `--debugmode' is added as an alias for `-d'. The new flag `d' is added
271 to control whether dereferencing an undefined macro causes a warning;
272 this flag is enabled by default if neither `-d' nor `-E' are specified.
273 The new flag `o' is added to control whether `dumpdef' outputs to stderr
274 or the current `debugfile' location. When the command line option is
275 given the empty string, the mode is treated as `+adeq' instead of `aeq'.
276 Also, the position of `-d' with respect to files on the command line is
279 ** A new predefined text macro, `__m4_version__', expands to the unquoted
280 version number of M4, if GNU extensions are enabled. While you should
281 generally favor feature tests over version number checks, this macro can
282 be used, via `defn', to determine whether the version of m4 processing
283 your file is adequate.
285 ** The `defn', `popdef', and `undefine' builtins gained a new warning when
286 operating on an undefined macro name, to match the warning already
287 present in `builtin', `indir', and `dumpdef'. For backwards
288 compatibility, the warning can be disabled by using `debugmode(`-d')'
289 (or the command line option `--debug=-d'). The flag is also cleared by
290 the command line option `-E'/`--fatal-warnings', so that scripts written
291 for 1.4.x do not cause the script to fail because of new warnings.
293 ** Enhance the `indir' builtin to trace indirect macros, where the trace
294 is requested via `traceon' or the command-line option `-t'. Previously,
295 it was impossible to trace macro names such as `foo-bar' which could
296 only be invoked indirectly, without relying on global tracing (such as
297 with `debugmode(`t')') or the experimental `changeword'.
299 ** Aspects of tracing output that were previously undocumented have been
300 slightly altered, and the effect of the builtin `debugmode' on trace
301 output is more fully documented. As POSIX does not specify trace output
302 format, parsing such output is inherently fragile in the first place.
303 The intent is that future M4 versions will not change documented trace
304 output without adding additional `debugmode' flags.
306 ** Enhance the `ifdef', `ifelse', and `shift' builtins, as well as all
307 user macros, to transparently handle builtin tokens generated by `defn'.
309 ** Allow the concatenation of builtin macros with arbitrary text in
310 several contexts, via the `defn' builtin or argument expansion, rather
311 than warning and converting the builtin token to an empty string.
312 However, it is still not possible to use a concatenated builtin when
315 ** Enhance the `defn', `dumpdef', `ifdef', `popdef', `traceon', `traceoff',
316 and `undefine' macros to warn when encountering a builtin token in the
317 context of a macro name, rather than acting on the empty string. This
318 was already done for `define', `pushdef', `builtin', and `indir'.
320 ** Enhance the `eval' builtin to understand the `?:' operator, and
321 downgrade a failed parse due to an unknown operator from an error to a
324 ** A number of portability improvements inherited from gnulib.
326 * Noteworthy changes in release 1.4.18 (2016-12-31) [stable]
328 ** Diagnose --word-regexp as unsupported if it was not configured.
330 ** Preliminary support for OS/2.
332 ** A number of portability improvements inherited from gnulib.
335 * Noteworthy changes in release 1.4.17 (2013-09-17) [stable]
337 ** Fix compilation with newer glibc headers.
339 ** Fix a failure with diverting large amounts of text on mingw (does
340 not affect platforms that can rename an open file).
342 ** A number of portability improvements inherited from gnulib.
345 * Noteworthy changes in release 1.4.16 (2011-03-01) [stable]
347 ** Fix regressions in the `index' builtin. On glibc platforms, this
348 avoids false positives from a strstr bug in glibc 2.9 through 2.12;
349 on many other platforms, it fixes two separate regressions, a false
350 positive introduced in 1.4.11 and a false negative in 1.4.15.
352 ** A number of portability improvements inherited from gnulib.
355 * Noteworthy changes in release 1.4.15 (2010-08-31) [stable]
357 ** Fix regression introduced in 1.4.9b where the `format' builtin could
358 crash on an invalid format string.
360 ** Fix compilation against newer glibc, and on AIX 7.1BETA.
362 ** A number of portability improvements inherited from gnulib.
364 * Noteworthy changes in Version 1.4.14 (2010-02-24) [stable]
365 Released by Eric Blake, based on git version 1.4.13.*
367 ** Fix regression introduced in 1.4.12 where executing with stdout closed
368 could crash m4 on exit on some platforms.
370 ** Fix regressions introduced in 1.4.13 in the `esyscmd' builtin, where
371 closed file descriptors could interfere with child execution, and where
372 a child status of 127 made m4 print a spurious message to stderr.
374 ** A number of portability improvements inherited from gnulib.
376 * Noteworthy changes in Version 1.4.13 (2009-04-01) [stable]
377 Released by Eric Blake, based on git version 1.4.12.*
379 ** The manual is now distributed under the terms of FDL 1.3.
381 ** The `divert' and `undivert' builtins have been made more efficient
382 when using temporary files for large diversions.
384 ** The `translit' builtin has been made more efficient when the second
387 ** The input engine has been optimized for faster processing.
389 ** The command line option `--debugfile', introduced in 1.4.7, now
390 treats its argument as optional, in order to allow setting the debug
391 output back to stderr when used without an argument; and order is now
392 significant with respect to command line files. You must therefore use
393 `m4 --debugfile=trace file', not `m4 file --debugfile trace'. This
394 change does not affect the deprecated `-o'/`--error-output' option.
396 ** The `syscmd' and `esyscmd' builtins can be configured to use an
397 alternate shell, via the new `configure' option `--with-syscmd-shell'.
399 ** A number of portability improvements inherited from gnulib.
401 * Noteworthy changes in Version 1.4.12 (2008-10-10) [stable]
402 Released by Eric Blake, based on git version 1.4.11.*
404 ** Fix regression introduced in 1.4.4b where using `traceon' could delete
405 a macro. This was most noticeable with `traceon(`traceon')', but
406 would also happen in cases such as `foo(traceon(`foo'))'.
408 ** Fix regression introduced in 1.4.7 where `m4 -N9' died with an assertion
411 ** Fix regression introduced in 1.4.11 where `defn' died with an assertion
412 failure on a traced but undefined macro.
414 ** New `-g'/`--gnu' command-line option overrides `-G'/`--traditional'.
415 For now, the environment variable POSIXLY_CORRECT has no effect on M4
416 behavior; but a future release of M4 will behave as though --traditional
417 is implied if POSIXLY_CORRECT is set (this future change is necessary,
418 because in the current release, there is no way to disable GNU
419 extensions that conflict with POSIX without the use of a non-POSIX
420 command-line argument). Clients of M4 that want to use GNU extensions,
421 even when POSIXLY_CORRECT is set, should start using the -g command-line
422 argument, even though it is currently a no-op if -G did not appear
423 earlier in the command line, so that the client will not break in the
424 face of an upgraded m4 and a POSIXLY_CORRECT execution environment.
426 ** The `-L'/`--nesting-limit' command-line option now defaults to 0 for
427 unlimited on platforms that can detect and deal with stack overflow. On
428 systems that lack alternate stack support, such as Cygwin, and on
429 systems that do not obey the POSIX semantics for distinguishing stack
430 overflow from other exceptions, such as Linux, you can optionally
431 install the libsigsegv library (version 2.6 or newer recommended) to
432 enhance m4's ability to accurately report stack overflow:
433 http://www.gnu.org/software/libsigsegv/
435 ** A number of portability improvements inherited from gnulib.
437 * Noteworthy changes in Version 1.4.11 (2008-04-02) [stable]
438 Released by Eric Blake, based on git version 1.4.10a
440 ** Security fixes for the -F option, for bugs present since -F was
441 introduced in 1.3: Avoid core dump with 'm4 -F file -t undefined', and
442 avoid arbitrary code execution with certain file names.
444 ** Fix regression introduced in 1.4.9b in the `divert' builtin when more
445 than 512 kibibytes are saved in diversions on platforms like NetBSD
446 or darwin where fopen(name,"a+") seeks to the end of the file.
448 ** The output of the `maketemp' and `mkstemp' builtins is now quoted if a
449 file was created. This is a minor security fix, because it was possible
450 (although rather unlikely) that an unquoted string could match an
451 existing macro name, such that use of the `mkstemp' output would trigger
452 inadvertent macro expansion and operate on the wrong file name.
454 ** Enhance the `defn' builtin to support concatenation of multiple text
455 arguments, as required by POSIX. However, at this time, it is not
456 possible to concatenate a builtin macro with anything else; a warning is
457 now issued if this is attempted, although a future version of M4 may
458 lift this restriction to match other implementations.
460 ** Enhance the `format' builtin to parse all C99 floating point numbers,
461 even on platforms where strtod(3) is buggy, although the replacement
462 function does have the known issue of rounding errors when parsing
463 some decimal floating point values. This fixes testsuite failures
464 introduced in 1.4.9b.
466 ** Enhance the `index' builtin to guarantee linear behavior, in spite of
467 the surprisingly large number of systems with a brain-dead quadratic
470 ** A number of portability improvements inherited from gnulib.
472 * Noteworthy changes in Version 1.4.10b (2008-02-25) [beta]
473 Released by Eric Blake, based on git version 1.4.10a
475 Note that M4 1.4.10b was released prior to 1.4.11, and includes all the
476 features of 1.4.11 except for C99 parsing in the `format' builtin. It also
477 contains the following beta features that were deemed worth deferring until
480 ** Further enhance the `index' builtin to often achieve sublinear results.
482 ** Enhance the `regexp' and `patsubst' builtins to cache frequently used
483 regular expressions, which speeds up typical Autoconf usage.
485 ** Enhance the `format' builtin to warn for more suspicious usages, such as
486 missing arguments or problems parsing according to the format string.
488 ** Enhance the `ifelse' and `shift' builtins so that tail-recursive
489 algorithms based on `$@' operate in linear, rather than quadratic, time
492 ** A number of portability improvements inherited from gnulib.
494 * Noteworthy changes in Version 1.4.10 (2007-07-09) [stable]
495 Released by Eric Blake, based on CVS version 1.4.9c
497 ** Upgrade from GPL version 2 to GPL version 3 or later.
499 ** A number of portability improvements inherited from gnulib.
501 ** Avoid undefined behavior introduced in 1.4.9b in the `format' builtin
502 when handling %c. However, this area of code has never been documented,
503 and currently does not match the POSIX behavior of printf(1), so it may
504 have further changes in the next version.
506 * Noteworthy changes in Version 1.4.9b (2007-05-29) [beta]
507 Released by Eric Blake, based on CVS version 1.4.9a
509 ** Fix regression introduced in 1.4.9 in the `eval' builtin when performing
512 ** Fix regression introduced in 1.4.8 in the `-F' option that made it
513 impossible to freeze more than 512 kibibytes of diverted text.
515 ** The synclines option `-s' no longer generates sync lines in the middle of
516 multiline comments or quoted strings.
518 ** Work around a number of corner-case POSIX compliance bugs in various
519 broken stdio libraries. In particular, the `syscmd' builtin behaves
520 more predictably when stdin is seekable.
522 ** The `format' builtin now understands formats such as %a, %A, and %'hhd,
523 and works around a number of platform printf bugs. Furthermore, the
524 sequence format(%*.*d,-1,-1,1) no longer outputs random data. However,
525 some non-compliant platforms such as mingw still have known bugs in
526 strtod that may cause testsuite failures.
528 ** The testsuite is improved to also run gnulib portability tests for the
529 features that M4 imports from gnulib.
531 * Noteworthy changes in Version 1.4.9 (2007-03-23) [stable]
532 Released by Eric Blake, based on CVS version 1.4.8c
534 ** Minor documentation and portability cleanups.
536 * Noteworthy changes in Version 1.4.8b (2007-02-24) [beta]
537 Released by Eric Blake, based on CVS version 1.4.8a
539 ** Fix a regression introduced in 1.4.8 that made m4 unable to process
540 files larger than 2GiB on some platforms.
542 ** Fix a regression introduced in 1.4.8 that made m4 dump core when
543 invoked as 'm4 -- file'.
545 ** The `eval' builtin now follows C precedence rules. Additionally, the
546 short-circuit operators correctly short-circuit division by zero. The
547 previously undocumented alias of '=' meaning '==' in eval now triggers a
548 deprecation warning, so that a future version of M4 can implement a form
549 of variable assignment as an extension.
551 ** The `include' builtin now affects exit status on failure, as required by
552 POSIX. Use `sinclude' if you need a successful exit status.
554 ** The `-E'/`--fatal-warnings' command-line option now has two levels. When
555 specified only once, warnings affect exit status, but execution
556 continues, so that you can see all warnings instead of fixing them one
557 at a time. To achieve 1.4.8 behavior, where the first warning
558 immediately exits, specify -E twice on the command line.
560 ** A new `--warn-macro-sequence' command-line option allows detection of
561 sequences in `define' and `pushdef' definitions that match an optional
562 regular expression. The default regular expression is
563 `\$\({[^}]*}\|[0-9][0-9]+\)', corresponding to the sequences that might
564 not behave correctly when upgrading to the eventual M4 2.0. By default,
565 M4 2.0 will follow the POSIX requirement that a macro definition
566 containing `$11' must expand to the first argument concatenated with 1,
567 rather than the eleventh argument; and will take advantage of the POSIX
568 wording that allows implementations to treat `${11}' as the eleventh
569 argument instead of literal text. Be aware that Autoconf 2.61 will not
570 work with this option enabled with the default regular expression; but
571 Autoconf 2.62 will be compatible with this option.
573 ** Improved portability to platforms such as BSD/OS and AIX.
575 * Noteworthy changes in Version 1.4.8 (2006-11-20) [stable]
576 Released by Eric Blake, based on CVS version 1.4.7a
578 ** The `divert' macro and `-H'/`--hashsize' command line option no longer
579 cause a core dump when handed extra large values. Also, `divert' now
580 uses memory proportional to the number of diversions in use, rather than
581 to the maximum diversion number encountered, so that large diversion
582 numbers are less likely to exhaust system memory; and is no longer
583 limited by the maximum number of file descriptors.
585 ** The `--help' and `--version' command line options now consistently
586 override all earlier options. For example, `m4 --debugfile=trace
587 --help' now no longer accidentally creates an empty file `trace'.
589 ** The `-L'/`--nesting-limit' command line option can now be set to 0
590 to remove the default limit of 1024. However, it is still possible that
591 heavily nested input can cause abrupt program termination due to stack
594 ** Problems encountered when writing to standard error, such as with the
595 `errprint' macro, now always cause a non-zero exit status.
597 ** Warnings and errors issued during macro expansion are now consistently
598 reported at the line where the macro name was detected, rather than
599 where the close parenthesis resides. Text wrapped by `m4wrap' now
600 remembers the location that was in effect when m4wrap was invoked,
601 rather than changing to line 0 and the empty string for a file. The
602 macros `__line__' and `__file__' now work correctly even as the last
603 token in an included file.
605 ** The `builtin' and `indir' macros now transparently handle builtin
606 tokens generated by `defn'.
608 ** When diversions created by the `divert' macro collect enough text that
609 M4 must use temporary files, the environment variable $TMPDIR is now
610 consulted, and a better effort is made to clean up those files in the
611 event of a fatal signal.
613 ** The `mkstemp' builtin is added with the same GNU semantics as `maketemp',
614 based on the recommendation of POSIX to deprecate the POSIX semantics of
615 `maketemp' as inherently insecure. In GNU mode (no -G supplied on the
616 command line), `maketemp' silently retains the secure GNU semantics, but
617 a future release of M4 will change this to emit a warning. In
618 traditional mode (m4 -G), `maketemp' now uses the POSIX-mandated
619 insecure semantics, and issues a warning that you should convert your
620 script to use `mkstemp' instead. Additionally, `mkstemp' and `maketemp'
621 are now well-defined even if the template argument does not end in six
624 ** The manual has been improved, including a new section on a composite
627 ** The `changecom' and `changequote' macros now treat an empty second
628 argument the same as if it were missing, rather than using the empty
629 string and making it impossible to end a comment or quote.
631 ** The `translit' macro now operates in linear instead of quadratic time,
632 and is now eight-bit clean.
634 ** The `-D', `-U', `-s', and `-t' command line options now take effect
635 after any files encountered earlier on the command line, rather than up
636 front, as is done in traditional implementations and required by POSIX.
638 * Noteworthy changes in Version 1.4.7 (2006-09-25) [stable]
639 Released by Eric Blake, based on CVS version 1.4.6a
641 ** Fix regression from 1.4.5 in handling a file that ends in a macro
642 expansion without arguments instead of a newline.
644 ** The define and pushdef macros now warn when the first argument is not
645 a string, rather than silently doing nothing.
647 ** Standard input can now be read more than once, as in 'm4 - file -', and
648 is not closed until all wrapped text is handled. This makes a
649 difference when stdin is not a regular file, and also fixes bugs when
650 using the syscmd or esyscmd macros from wrapped text.
652 ** When standard input is a seekable file, the m4exit, syscmd, and esyscmd
653 macros now restore the current position to the next unread byte rather
654 than discarding an arbitrary amount of buffered data.
656 ** SysV command-line compatibility is no longer a goal of GNU M4; the
657 focus will be instead on POSIX compatibility. This release continues to
658 support previous usage, but adds warnings in areas which will allow a
659 future version of GNU M4 to use its own extensions without being tied to
660 the SysV command line interface.
662 ** The no-op compatibility command line options -B, -N, -S, -T, and
663 --diversions may be withdrawn or assigned new meanings in future
664 releases, so they now issue a warning if used.
666 ** A new command line option -i replaces the compatibility -e as the
667 short spelling of --interactive, for consistency with other GNU tools; a
668 warning is issued if the old spelling is used, and it may be assigned
669 new meaning in future releases.
671 ** A new command line option --debugfile replaces the options -o and
672 --error-output as the preferred spelling. The old options were
673 misleading in their names and inconsistent with other GNU tools; they
674 are still silently accepted, but no longer documented in --help, and may
675 be assigned new meanings in future releases.
677 * Noteworthy changes in Version 1.4.6 (2006-08-25) [stable]
678 Released by Eric Blake, based on CVS version 1.4.5a
680 ** Fix buffer overruns in regexp and patsubst macros when handed a trailing
681 backslash in the replacement text, or when handling \n substitutions
682 beyond the number of \(\) groups.
684 ** Fix memory leak in regexp, patsubst, and changeword macros.
686 ** The format macro now understands %F, %g, and %G.
688 ** When loading frozen files, m4 now exits with status 63 if version
689 mismatch is detected.
691 ** Fix bugs that occurred when invoked with stdout or stderr closed,
692 and detect write failures to stdout or to the target of the debugfile
693 macro. In particular, the syscmd and esyscmd macros can no longer
694 interfere with the debug stream or diversions.
696 ** The m4exit macro now converts values outside the range 0-255 to 1.
698 ** It is now an error if a command-line input file ends in the middle of a
699 comment, matching the behavior of mid-string and mid-argument
702 ** The dnl macro now warns if end of file is encountered instead of a
705 ** The error message when end of file is encountered now uses the file and
706 line where the dangling construct started, rather than `NONE:0:'.
708 ** The debugmode and __file__ macros, and the -s/--synclines option, now
709 show what directory a file was found in when the -I/--include option or
710 M4PATH variable had an effect.
712 ** The changequote and changecom macros now work with 8-bit characters, and
713 quotes and comments that begin with `(' are properly recognized
716 ** The new macro __program__ is added, which allows the input file to issue
717 an error message that resembles messages from m4. Warning and error
718 messages have been reformatted to comply with GNU Coding Standards.
720 ** The errprint, m4wrap, and shift macros are now recognized only with
723 ** The index, substr, translit, regexp, and patsubst macros now produce
724 output when given only one argument, but still warn about a missing
727 ** The patsubst macro now reliably finds zero-length matches at the end
730 * Noteworthy changes in Version 1.4.5 (2006-07-15) [stable]
731 Released by Eric Blake, based on CVS version 1.4.4c
733 ** Fix sysval on BeOS, OS/2, and other systems that store exit status
734 in the low-order byte. Additionally, on Unix platforms, if syscmd was
735 terminated by a signal, sysval now displays the signal number shifted
736 left by eight bits, to match traditional m4 implementations.
738 ** The maketemp macro is no longer subject to platform limitations (such as
739 26 or 32 max files from a given template).
741 ** Frozen files now require that the first directive be V (version), to
742 better diagnose version mismatch. Additionally, if the F directive
743 (builtin function) names an unknown builtin that existed in the m4 that
744 froze the file but not in the current m4 (for example, changeword), the
745 warning is deferred until an attempt is made to actually use the
746 builtin. This allows downgrading from beta m4-1.4o to stable m4-1.4.5
747 without breaking autoconf.
749 ** The format and indir macros are now recognized only with arguments.
751 ** The eval macro no longer crashes on x86 architectures when dividing the
752 minimum integer by -1.
754 ** On systems with ecvt and fcvt, format no longer truncates trailing
755 zeroes on integers printed with %.0f. On systems without these
756 functions, format is no longer subject to a buffer overflow that
757 permitted arbitrary code execution.
759 ** On native Windows builds, the macro __windows__ is provided instead of
760 __unix__. Likewise, on OS/2 builds, the macro __os2__ is provided.
761 This allows input files to determine when syscmd might behave
764 ** Fix bug in 1.4.3 patch to use \n line-endings that did not work for
767 ** When given the empty string or 0, undivert is now documented as a no-op
768 rather than closing stdout, warning about a non-existent file, or trying
769 to read a directory as a file.
771 ** Many documentation improvements. Also, the manual is now distributed
772 under FDL 1.2, rather than a stricter verbatim-only license.
774 ** Raise the -L (--nesting-limit) command line option limit from 250 to
777 ** The decr, incr, divert, m4exit, and substr macros treat an empty number
778 as 0, issue a warning, and expand as normal; rather than issuing an
779 error and expanding to the empty string.
781 ** The eval macro now treats an empty radix argument as 10, handles radix 1,
782 and treats the width argument as number of digits excluding the sign,
783 for compatibility with other m4 implementations.
785 ** The ifdef, divert, m4exit, substr, and translit macros now correctly
786 ignore extra arguments.
788 ** The popdef and undefine macros now correctly accept multiple arguments.
790 ** Although changeword is on its last leg, if enabled, it now reverts to the
791 default (faster) regexp when passed the empty string.
793 ** The regexp and substr macros now warn and ignore a trailing backslash in
794 the replacement, and warn on \n for n larger than the number of
795 sub-expressions in the regexp.
797 * Noteworthy changes in Version 1.4.4b (2006-06-17) [beta]
798 Released by Eric Blake, based on CVS version 1.4.4a
800 ** Fix a recursive push_string crashing bug, which affected changequote of
801 three or more characters on some compilers.
803 ** Use automake to fix build portability issues.
805 ** Fix a recursive m4wrap crashing bug.
807 ** Fix a 1 in 2**32 hash crashing bug.
809 ** Tracing a macro by name is now persistent, even if the macro is
810 subsequently undefined or redefined. The traceon and traceoff macros no
811 longer warn about undefined symbols. This solves a crash when using
812 indir on an undefined macro traced with the -t option, as well as an
813 incorrect result of ifdef. Furthermore, tracing is no longer
814 transferred with builtins, solving the bug of "m4 -tm4_eval" failing to
815 give trace output on the input
816 "define(`m4_eval',defn(`eval'))m4_eval(1)".
818 ** Fix a crash when a macro is undefined while collecting its arguments, by
819 always using the definition that was in effect before argument
820 collection. This behavior matches the C pre-processor, and means that
821 the sequence "define(`f',`1')f(define(`f',`2'))f" is now documented to
822 result in "12", rather than the previously undocumented "22".
824 ** Update the regex engine to fix several bugs.
826 ** Fix a potential crash on machines where char is signed.
828 * Noteworthy changes in Version 1.4.4 (Oct 2005) [stable]
829 Released by Gary V. Vaughan
831 ** ./configure --infodir=/usr/share/info now works correctly.
833 ** When any file named on the command line is missing exit with status 1.
835 * Noteworthy changes in Version 1.4.3 (Mar 2005) [stable]
836 Released by Gary V. Vaughan
838 ** DESTDIR installs now work correctly.
840 ** Don't segfault with uncompilable regexps to changeword().
842 ** Always use \n line-endings for frozen files (fixes a Windows bug).
844 ** Portability fix for systems lacking mkstemp(3).
846 ** Approximately 20% speed up in the common case of usage with autoconf.
848 ** Supported on QNX 6.3.
850 * Noteworthy changes in Version 1.4.2 (Aug 2004) [stable]
851 Released by Paul Eggert
853 ** No user visible changes; portability bug fixes only.
855 * Noteworthy changes in Version 1.4.1 (Jun 2004) [stable]
856 Released by Paul Eggert
858 ** The 1.4.x series is intended to be stable; features added in 1.4[a-q]
859 were not backported to 1.4.x unless specifically mentioned above.
861 ** maketemp now creates an empty file with the given name, instead of merely
862 returning the name of a nonexistent file. This closes a security hole.
865 * Version beta 1.4q - August 2001, by Gary V. Vaughan
867 ** Support for the experimental `changeword' has been dropped.
869 ** `m4 --hashsize' and `-H' are still accepted, but have no effect. M4
870 will grow its internal symbol table if the symbol density is having an
871 effect on performance.
873 ** `configure --without-modules' will build an m4 binary with no preloaded
874 modules. At startup it will search for and load modules `m4' and either
875 `gnu' or `traditional'. This mode of operation can be used for
876 development and debugging of the base modules without the need to
877 recompile all of m4 with each modification.
879 ** `configure --with-modules="gnu m4 traditional load"', for example,
880 will build an m4 binary with the named modules preloaded, ready to be
881 activated (even on static lib only machines) with the `-m' option or
882 using the `load' builtin.
884 ** M4 has no builtins or macros in core, they are all loaded from modules
885 at startup. This means that modules are no longer optional, though the
886 standard build will statically link the modules `m4', `gnu' and
887 `traditional', so even on machines with no ltdl support, all of the
888 functionality from previous releases is available.
890 ** New builtin `load' to dynamically load modules which can define new
891 builtins and user macros.
893 ** New builtin `unload' to remove loaded modules (and the builtins and user
894 macros they define) from the running m4 interpreter.
896 ** New builtins `eregexp' and `epatsubst' to use Extended Regular
897 Expressions syntax in lieu of Basic Regular Expressions as used by
898 `regexp' and `patsubst'.
900 ** The names of all currently loaded modules are returned by the new
901 builtin, ``modules''.
903 ** Loadable modules can define new builtin functions or text expansion
906 ** The module code has been rewritten to use libltdl, the libtool dynamic
907 loader, which means GNU m4 can now load (and unload) modules just about
908 anywhere which it can be built. This includes obscure hosts such as
909 cygwin and BeOS, and also on hosts which do not have shared libraries,
910 through preloading (see libtool manual) and GNU dld.
912 ** Modules can now be built without the m4 source being available using the
913 installed m4module.h header file (and some other headers that it
914 includes for you), and the installed libm4.la libtool library. All
915 symbols exported from libm4.la have a prefix of `m4_' or `M4_'. See the
916 modules directory for examples of usage.
918 ** A new V2 format for frozen files that saves module and syntax information.
920 * Version beta 1.4o - January 2000, by Rene' Seindal
922 ** Modules can be loaded from the command line with --load-module
924 ** Modules now use libtool's wrapper libltdl.
926 ** New builtin `symbols' allows dynamic queries of all currently defined
929 ** Various Bug fixes.
931 * Version beta 1.4n - November 1998, by Rene' Seindal
933 ** The module code has been reorganised yet again, and now compiles
934 correctly on GNU/Linux, HPUX 9 and 10, SunOS 5 and Solaris 5.
936 ** When configured --with-gmp a new builtin `mpeval' is now defined. The
937 builtin `eval' retains its normal behaviour.
939 ** m4 --version also shows which options were used for compilation, such as:
940 "GNU m4 1.4n (options: modules gmp changeword)"
942 ** New option --import-environment defines all environment variables as
943 macros. This is done before -D and -U are handled, so the macros can be
944 changed through these options.
946 ** Error messages now always print program name before input file name as
947 specified by GNU coding standards. Reported by Akim Demaille.
949 ** Bug fixed: "undivert(0)" could cause m4 to read standard output. A call
950 of "undivert(0)" is now silently ignored.
952 ** Bug fixed: when compiling --with-included-gettext, <libintl.h> wasn't
953 found in intl/ directory. Reported by Andrew Bettison.
955 * Version beta 1.4m - November 1998, by Rene' Seindal
957 ** Using libtool for compiling modules and for linking main app.
959 ** Reorganised the dynamic module code to encapsulate system dependencies
960 better. The code for HPUX shl_load() still needs testing and debugging.
961 A dld interface is also missing. Any volunteers?
963 ** The files from the GNU m4 web-site is now in examples/WWW as a more
964 complete example of what GNU m4 can do.
966 * Version beta 1.4l - November 1998, by Rene' Seindal
968 ** GNU m4 now has an escape syntax category. If a character is marked as
969 an escape, words are only recognised as macros if preceded by an escape
970 character. It is a bit like -P, but dynamic: it can be turned on and
971 off. The GNU m4 web-site on http://www.seindal.dk/rene/gnu/ is
972 maintained with this feature - the m4 source is available on the site.
974 ** The module interface is improved, thanks to "Brian J. Fox",
975 who has contributed some code from Meta-HTML. The modules now build
976 automatically and installs properly, by default in
977 /usr/local/libexec/m4. There is a preliminary, untested support for
980 ** There is now a __m4_version__ macro that expands to the current version
983 * Version beta 1.4k - November 1998, by Erick Branderhorst and Rene' Seindal
985 ** GNU m4 now uses gettext to support internationalization.
987 ** GNU m4 now uses automake to control Makefile.in generation. This
988 should make it more consistent with the GNU standards.
990 ** GNU m4 will use the gmp library for multiple precision integral and
991 rational arithmetic in `eval' if configured with `--with-gmp'. If
992 configured without `--with-gmp' or if gmp is not available, and the type
993 `long long int' is, GNU m4 will use that for `eval' arithmetic.
995 ** GNU m4 now parses the input according to a syntax table, that can be
996 modified through the new builtin `changesyntax'. It is a generalisation
997 of the existing builtins `changecom' and `changequote'. The changes are
998 completely backwards compatible (except for the existence of
1001 ** Sync lines can be turned on and off with the `syncoutput' builtin. The
1002 builtin `syncoutput' is a GNU extension.
1004 ** New experimental feature: dynamically loadable modules. New builtin
1005 `loadmodules' loads shared libraries, that can define new builtin
1006 macros, ie, new macros can be written in C. Depends on the dlopen()
1007 interface, and is currently only tested on Linux. Enabled at configure
1008 time with `--with-modules'. Documentation is in src/module.c and
1011 ** Implement a GNU message catalog for French (Franc,ois Pinard).
1013 ** Filenames found through path searches are now correctly reflected in
1014 error and debug messages and through the `__file__' macro.
1018 *** All 8-bit characters can now be used for quotes.
1020 * Version 1.4 - October 1994, by Franc,ois Pinard
1022 ** (No user visible changes)
1024 * Version 1.3 - September 1994, by Franc,ois Pinard
1026 ** Diversions are created as needed. Option `-N' is still accepted, but
1027 otherwise ignored. Users should use only negative diversion numbers,
1028 instead of high positive numbers, for diverting to nowhere.
1030 ** Diversions should also work faster. No temporary files will be needed
1031 at all if all diversions taken altogether do not use more than 512K.
1033 ** Frozen state files may be produced with the `--freeze-state' (-F)
1034 option and later brought back through the `--reload-state' (-R) option.
1036 * Version 1.2 - July 1994, by Franc,ois Pinard
1038 ** In patsubst(STRING, REGEXP, REPLACEMENT), \& in REPLACEMENT has been
1039 changed to represent this part of STRING matched by the whole REGEXP,
1040 instead of the whole STRING as before. \0 does the same, but emits a
1041 diagnostic saying it will disappear in some subsequent release.
1043 ** eval(EXPR) emits a diagnostic if EXPR has suffixed crumb. The same for
1044 other numeric conversions in incr(), decr(), divert(), etc.
1046 ** `--fatal-warnings' (-E) stops execution at first warning.
1048 ** `--nesting-limit=LEVEL' (-L LEVEL) sets a limit to macro nesting.
1049 It is initially fixed at 250.
1051 ** `--word-regexp=REGEXP' (-W REGEXP) modifies macro name syntax, like
1052 does the new `changeword(REGEXP)' macro. This feature is experimental,
1053 tell me your opinions about it. You do need --enable-changeword at
1054 configure time to get these things. Do *not* depend on them yet.
1056 ** Trace output format is scannable by GNU Emacs' next-error function.
1058 ** Stack overflow is detected and diagnosed on some capable systems.
1060 ** Various bugs have been corrected, m4 should be more portable. See the
1061 ChangeLog for details.
1063 * Version 1.1 - November 1993, by Franc,ois Pinard
1065 ** Changes which might affect existing GNU m4 scripts:
1067 *** Option `-V' has been removed, use `--version' instead. `--version'
1068 writes on standard output instead of standard error, and inhibits any
1071 *** `--no-gnu-extensions' has been renamed `--traditional'.
1073 *** In `eval', `^' used to indicate exponentiation, use `**' instead.
1075 *** The automatic undiversion which takes place at end of all input is
1076 forced into the main output stream.
1078 ** Changes which are unlikely to affect existing scripts:
1080 *** `--help' prints an usage summary on standard output. Script execution
1083 *** `--prefix-builtins' (-P) prefixes all builtin macros by `m4_'.
1085 *** Most builtin macros for which arguments are mandatory, called without
1086 any arguments, are no more recognized as builtin macros: they are
1087 consequently copied verbatim to the output stream.
1089 *** `define' and `pushdef' are usable with only one argument, they give
1090 this argument an empty definition.
1092 *** `eval' new operators for binary representation handling: `^' for
1093 exclusive-or, `~' for the bitwise negation, `<<' and `>>' for shifts.
1095 *** `eval' recognizes the notation 0bDIGITS for binary numbers and the
1096 notation 0rRADIX:DIGITS for numbers in any radix from 1 to 36.
1098 * Version 1.0.3 - December 1992, by Franc,ois Pinard
1100 ** Changes for the user:
1102 *** `dnl' outputs a diagnostic if immediately followed by `('. Usually,
1103 `dnl' is followed by newline or whitespace.
1105 *** `ifelse' accepts without complaining the common idiom of having only
1106 one argument. This is useful for introducing long comments.
1108 *** `eval' always expresses values as signed, whatever the radix.
1110 *** M4OPTS environment variable is no longer obeyed.
1112 *** `--no-warnings' option is renamed `--silent'.
1114 *** Debug lines use a new format more compatible with GNU standards.
1116 *** Various bugs have been corrected. See the ChangeLog for details.
1118 ** Changes for the installer:
1120 *** GNU m4 now uses an Autoconf-generated configure script, and should be
1121 more easily portable in many ways. (Cray is not supported yet).
1123 *** `make check' has been made more portable, expect no errors.
1125 ** Changes for the programmer:
1127 *** Sources have been fully reindented to comply with GNU standards, and
1128 cleaned up in many ways.
1130 *** Sources have been protoized. Non-ANSI compilers are automatically
1131 detected, then sources are unprotoized on the fly before compilation.
1133 *** GNU m4 uses newer versions of obstack, regex, getopt, etc.
1135 * Version 1.0 - October 1991, by Rene' Seindal
1137 ** Uses GNU configure, taken from the gdb distribution.
1139 ** Uses GNU getopt(), with long option names.
1141 ** The -Q/+quiet option is added, which suppresses warnings about missing
1142 or superflous arguments to builtin macros.
1144 ** Added default options via the M4OPTS environment variable.
1146 ** Several minor bugs have been fixed.
1148 * Version 0.99 - July 1991, by Rene' Seindal
1150 ** The builtins `incr' and `decr' are now implemented without use of
1153 ** The builtin `indir' is added, to allow for indirect macro calls
1154 (allows use of "illegal" macro names).
1156 ** The debugging and tracing facilities has been enhanced considerably.
1157 See the manual for details.
1159 ** The -tMACRO option is added, marks MACRO for tracing as soon as it
1162 ** Builtins are traced after renaming iff they were before.
1164 ** Named files can now be undiverted.
1166 ** The -Nnum option can be used to increase the number of divertions
1169 ** Calling changecom without arguments now disables all comment handling.
1171 ** A bug in `dnl' is fixed.
1173 ** A bug in the multi-character quoting code is fixed.
1175 ** Several typos in the manual has been corrected. More probably persist.
1177 * Version 0.75 - November 1990, by Rene' Seindal
1179 ** Implemented search path for include files (-I option and M4PATH
1180 environment variable).
1182 ** Implemented builtin `format' for printf-like formatting.
1184 ** Implemented builtin `regexp' for searching for regular expressions.
1186 ** Implemented builtin `patsubst' for substitution with regular
1189 ** Implemented builtin `esyscmd', which expands to a shell commands output.
1191 ** Implemented `__file__' and `__line__' for use in error messages.
1193 ** Implemented character ranges in `translit'.
1195 ** Implemented control over debugging output.
1197 ** Implemented multi-character quotes.
1199 ** Implemented multi-character comment delimiters.
1201 ** Changed predefined macro `gnu' to `__gnu__'.
1203 ** Changed predefined macro `unix' to `__unix__', when the -G option is
1204 not used. With -G, `unix' is still defined.
1206 ** Added program name to error messages.
1208 ** Fixed two missing null bytes bugs.
1210 * Version 0.50 - January 1990, by Rene' Seindal
1212 * Initial beta release.
1214 ========================================================================
1220 Copyright (C) 1992-1994, 2004-2011, 2013-2014, 2017 Free Software
1223 Permission is granted to copy, distribute and/or modify this document
1224 under the terms of the GNU Free Documentation License, Version 1.3 or
1225 any later version published by the Free Software Foundation; with no
1226 Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
1227 Texts. A copy of the license is included in the ``GNU Free
1228 Documentation License'' file as part of this distribution.