Richard Stallman <address@hidden> writes:
How about if we modify m4 so that it disables incompatibilities with
POSIX if the POSIXLY_CORRECT environment variable is set? This is
what the GNU coding standards suggest.
That is an ok solution. I had thought that an option would be more
convenient as an interface, but your argument in favor of using the
envvar seems to make sense.
OK, here is a proposed patch against CVS m4 to implement this. It
suppresses all the POSIX incompatibilities that I found in m4, if
POSIXLY_CORRECT is set. Unfortunately I can't easily test this, as
CVS m4 requires a CVS libtool version that I don't have, and the
bootstrap fails with the latest released libtool.
2003-07-03 Gary V. Vaughan <address@hidden>
* tests/builtins.at: New test for smashed definitions.
2003-07-03 Paul Eggert <address@hidden> and
Gary V. Vaughan <address@hidden>
Conform to POSIX if the POSIXLY_CORRECT environment is set.
--traditional `define' now smashes all the definitions.
* NEWS: Explain this.
* doc/m4.texinfo (Defn): `defn' takes any number of arguments.
(Extensions): Explain that extensions that are incompatible with
POSIX are disabled if POSIXLY_CORRECT is set.
(Incompatibilities): Remove.
(Define, Other Incompat): Explain difference
between GNU and POSIX behavior of define, pushdef, popdef.
* m4/m4.c (m4_get_posixly_correct_opt): New undef.
* m4/m4module.h (m4_context_opt_bit_table): Add POSIXLY_CORRECT entry.
* m4/m4private.h (M4_OPT_POSIXLY_CORRECT_BIT): New macro.
(m4_get_posixly_correct_opt): New macro.
* m4/m4macro.c (m4_process_macro): Disable $10, $abc etc. if
POSIXLY_CORRECT.
* modules/m4.c (builtin_functions): defn now takes any number of args.
(M4BUILTIN_HANDLER (define)): Smash all the definitions if
POSIXLY_CORRECT.
(M4BUILTIN_HANDLER (defn)): Allow any number of arguments.
(M4BUILTIN_HANDLER (undivert)): Do not allow nonnumeric arguments
if POSIXLY_CORRECT.
* src/main.c (main): Set posixly-correct behavior if either
POSIXLY_CORRECT is set, or if -G is given.