* doc/autoconf.texi (Number processing Macros)
<m4_version_prereq>: Add documentation.
* NEWS: Mention it.
Reported by Bruno Haible.
Signed-off-by: Eric Blake <ebb9@byu.net>
* lib/autoconf/headers.m4 (AC_HEADER_ASSERT): Honor --enable-assert,
rather than treating it as a synonym for --disable-assert.
* NEWS: Document the fix.
Signed-off-by: Eric Blake <ebb9@byu.net>
* lib/m4sugar/m4sugar.m4 (m4_cleardivert): New macro.
* lib/autotest/general.m4 (AT_INIT): Use it.
* lib/autoconf/general.m4 (_AC_INIT_NOTICE): Likewise.
* tests/m4sugar.at (m4@&t@_divert_stack): Test it.
* doc/autoconf.texi (Diversion support) <m4_cleardivert>: Document
it.
* NEWS: Likewise.
Suggested by Paolo Bonzini.
Signed-off-by: Eric Blake <ebb9@byu.net>
* lib/autotest/general.m4 (AT_INIT) <at_fn_check_prepare_dynamic>:
Fix typo.
* NEWS: Clarify the potential impact to users.
* tests/autotest.at (AT_DATA_AUTOTEST): New macro, patterned after
AT_DATA_M4SUGAR.
(AT_CHECK_AT_PREP, AT_CHECK_AT_TITLE): Use it.
(unusual file names): Test that the recent echo fix does not
regress. Fix quoting bug that made the test a no-op.
Reported by Paolo Bonzini and Ralf Wildenhues.
Signed-off-by: Eric Blake <ebb9@byu.net>
* lib/m4sugar/m4sh.m4 (_AS_EXIT_PREPARE): Let as_func_exit
parameter be optional.
(AS_EXIT): Use it to make better default.
(_AS_DETECT_BETTER_SHELL): Use new default.
* bin/autoconf.as (exit_missing_arg, getopt): Likewise.
* lib/autoconf/status.m4 (AC_OUTPUT): Likewise.
* tests/m4sh.at (AS@&t@_EXIT): Update test.
* doc/autoconf.texi (Common Shell Constructs) <AS_EXIT>: Mention
new default behavior.
(Limitations of Builtins) <trap>: Adjust to use new default.
* NEWS: Mention the semantic change.
Suggested by Ralf Wildenhues.
Signed-off-by: Eric Blake <ebb9@byu.net>
* NEWS: Document it.
* doc/autoconf.texi (Present But Cannot Be Compiled): Document it.
* lib/autoconf/headers.m4 (_AC_CHECK_HEADER_MONGREL): Implement it
and adjust warning.
* tests/semantics.at (AC_CHECK_HEADERS): Test new semantics.
* lib/m4sugar/m4sugar.m4 (m4_divert_stack): Use fewer macros, and
avoid extra newlines.
(m4_divert_stack_push): Compute location here, rather than caller.
(m4_divert_push): Update caller.
(m4_divert): Likewise, and also adjust current diversion name.
(m4_divert_pop): Simplify rule that diversion stack must never go
empty.
(_m4_require_call): Bypass diversion stack when collecting
required macro text.
(m4_init): Set current diversion without requiring m4_init.
* lib/m4sugar/m4sh.m4 (AS_INIT): Avoid too many pops.
* lib/autotest/general.m4 (AT_INIT): Likewise.
* lib/autoconf/general.m4 (_AC_INIT_DEFAULTS): Schedule wrapped
text to run prior to m4sugar cleanup.
* doc/autoconf.texi (Text processing Macros) <m4_newline>: Mention
optional argument.
(Conditional constructs) <m4_ifvaln, m4_n>: Mention use of dnl.
* NEWS: Undo blurb about m4_divert.
* tests/m4sugar.at (m4@&t@_divert_stack): New test.
Signed-off-by: Eric Blake <ebb9@byu.net>
* NEWS: Document stricter requirement on m4_init.
* lib/m4sugar/m4sugar.m4 (m4_divert_stack): New, replacing
_m4_divert_n_stack.
(_m4_divert_stack_push): New.
(m4_divert): Use _m4_divert_stack_push and replace m4_define with
m4_popdef.
(m4_divert_push): Use _m4_divert_stack_push.
(m4_divert_pop): Use m4_divert_stack instead of _m4_divert_n_stack,
pop _m4_divert_stack instead of m4_divert_stack.
(m4_expansion_stack): New. Update comment above it.
(m4_expansion_stack_push, m4_expansion_stack_pop): Work on
_m4_expansion_stack instead of m4_expansion_stack.
(m4_expansion_stack_dump): Check presence of _m4_expansion_stack
instead of m4_expansion_stack. Use m4_expansion_stack's expansion
instead of the definition, and compensate for the trailing newline
in the expansion.
(m4_warn, _m4_defun_pro, _m4_defun_epi): Check presence of
_m4_expansion_stack instead of m4_expansion_stack.
(m4_newline): Expand first argument after the newline.
(m4_init): Use m4_divert_stack instead of _m4_divert_n_stack,
* tests/m4sugar.at (m4_append, m4_text_wrap): Invoke m4_init.
* tests/tools.at (whitespace in file names, the empty token): Likewise.
* lib/m4sugar/m4sugar.m4 (m4_dumpdef): New implementation.
* doc/autoconf.texi (Redefined M4 Macros) <m4_dumpdef>: Mention
semantic differences as well as m4_dumpdefs.
* NEWS: Likewise.
* tests/m4sugar.at (m4@&t@_dumpdef): New test.
Signed-off-by: Eric Blake <ebb9@byu.net>
* lib/m4sugar/m4sh.m4 (_AS_VAR_ARITH_PREPARE, _AS_VAR_ARITH_WORKS)
(AS_VAR_ARITH): New macros.
(_AS_PREPARE, AS_PREPARE): Emit preparation.
* tests/m4sh.at (AS@&t@_VAR_ARITH): New test.
* doc/autoconf.texi (Polymorphic Variables) <AS_VAR_ARITH>:
Document new macro.
(Limitations of Usual Tools) <expr>: Mention portability problem
if first argument starts with -.
(Shell Substitutions) <$((expression))>: Mention it.
* NEWS: Likewise.
Signed-off-by: Eric Blake <ebb9@byu.net>
* lib/m4sugar/m4sugar.m4 (m4_copy): Add second implementation for
public use.
(_m4_copy): New macro, which preserves pushdef stacks.
(_m4_defun_pro_outer): Bypass it, for speed.
(m4_init): Bypass new implementation, since it breaks on m4_defn.
* bin/autoupdate.in (handle_autoconf_macros): Likewise.
* lib/autoconf/general.m4 (AC_PREREQ): Undefine before redefining,
now that m4_copy checks this.
* doc/autoconf.texi (Redefined M4 Macros) <m4_copy>: Document
this, as well as m4_rename.
* lib/autoconf/autoconf.m4 (m4_copy): Temporarily redefine when
renaming builtins.
* NEWS: Likewise.
* tests/m4sugar.at (m4@&t@_defn): Enhance test.
Signed-off-by: Eric Blake <ebb9@byu.net>
* lib/m4sugar/m4sh.m4 (AS_CASE): Always execute test, in case of
side effects. Allow continuation of script on same line as esac.
* lib/autoconf/c.m4 (AC_PROG_CC_STDC): Adjust client.
* tests/m4sh.at (AS@&t@_IF and AS@&t@_CASE): Enhance test.
* NEWS: Document the subtle change.
Signed-off-by: Eric Blake <ebb9@byu.net>
* lib/m4sugar/m4sugar.m4 (m4_curry, _m4_curry): New macros.
* tests/m4sugar.at (m4@&t@_map_args): Rename...
(m4@&t@_map_args and m4@&t@_curry): ...and add currying tests.
* doc/autoconf.texi (Looping constructs) <m4_map_args>: Document
currying as a way to add parameters.
(Evaluation Macros) <m4_curry>: Document the new macro.
* NEWS: Likewise.
Signed-off-by: Eric Blake <ebb9@byu.net>
* doc/autoconf.texi (Programming in M4sh): M4sh is now prime-time.
(Polymorphic Variables): New node.
* NEWS: Update accordingly.
Signed-off-by: Eric Blake <ebb9@byu.net>
* doc/autoconf.texi: Updates all references to "Portable Shell" and
"Limitations of Builtins" to use three-argument commands.
(Programming in M4sh): Document AS_ECHO, AS_ECHO_N, AS_UNSET.
(Portable Shell): Move here discussion about "Where is the POSIX
shell?" Mention that M4sh provides a SVR2 shell and takes care
of unsetting variables if necessary. Talk about M4sh and not only
Autoconf-generated scripts.
(Special Shell Variables): Talk about M4sh and not only
Autoconf-generated scripts. Don't talk about things that Autoconf
does not do. Mention problems of $LINENO with shell functions.
(Limitations of Builtins). Mention AS_ECHO and AS_ECHO_N. Move
discussion of eval bugs before discussion on proper use of eval.
Mention AS_IF. Reword why not to use "shift N". Mention "foo=;
unset foo" trick. Include M4sh code that unsets MAIL for Bash 2.01.
* NEWS: Update list of documented M4sh macros.
* lib/autotest/general.m4 (AS_MESSAGE_LOG_FD, AT_JOB_FIFO_FD):
Define fds only when initializing the log fd so early error
messages do not try to write to it.
* tests/autotest.at (Startup error messages): New test.
* NEWS: Document this 2.63 regression.
Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* lib/m4sugar/m4sugar.m4 (m4_default_quoted): New macro.
(m4_for, m4_expand_once, m4_text_wrap, m4_text_box): Use it.
* doc/autoconf.texi (Conditional constructs): Document it.
* NEWS: Likewise.
Signed-off-by: Eric Blake <ebb9@byu.net>
* lib/autotest/general.m4 (AT_JOB_FIFO_FD): New macro.
(AT_INIT): <at_jobs>: New variable.
Accept -j, -jN, --jobs[=N], document them in --help output.
Implement parallel driver loop using a FIFO, enabled with --jobs
and if mkfifo works; otherwise, fall back to sequential loop.
(AT_SETUP): Store, do not output summary progress line if
parallel.
* tests/autotest.at (parallel test execution, parallel truth)
(parallel fallacy, parallel skip): New tests.
* doc/autoconf.texi (testsuite Invocation): Document -j, --jobs,
the mkfifo requirement, and that --errexit may cause concurrent
jobs to finish.
* NEWS: Update.
Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* lib/autoconf/c.m4 (AC_C_BIGENDIAN): Limit the check to
__APPLE_CC__ with possible -arch flags.
* NEWS: Document it.
Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* lib/m4sugar/m4sugar.m4 (_m4_apply): New macro.
(m4_map): Ignore empty sublists. For a list consisting of only an
empty sublist, this restores 2.61 behavior of being a no-op.
(m4_map_sep): Likewise, and expand separator.
(m4_mapall, m4_mapall_sep): New macros, to regain 2.62 behavior.
(_m4_map): Rewrite, to be common base for all four variants.
* lib/m4sugar/foreach.m4 (_m4_map): Adjust to new prototype.
* tests/m4sugar.at (m4@&t@_map): Add tests.
* doc/autoconf.texi (Looping constructs) <m4_map>: Document new
macros, and mention ramifications of expanded separator.
* NEWS: Mention the change.
Signed-off-by: Eric Blake <ebb9@byu.net>
* lib/autoconf/programs.m4 (AC_PATH_TARGET_TOOL)
(AC_CHECK_TARGET_TOOL, AC_CHECK_TARGET_TOOLS): Require, do not
warn about previous AC_CANONICAL_TARGET.
(AC_CHECK_TARGET_TOOL): Add missing `$' making the macro
unusable in the non-cross-compiling case.
* NEWS, THANKS: Update.
Report by Dave Erickson.
Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* lib/m4sugar/foreach.m4 (m4_bmatch): Provide linear
implementation for m4 1.4.x.
* tests/m4sugar.at (m4@&t@_bmatch): New test.
(recursion): Test the linear nature.
* NEWS: Document the fix.
Signed-off-by: Eric Blake <ebb9@byu.net>
* lib/autoconf/specific.m4 (AC_USE_SYSTEM_EXTENSIONS): Use a
unique key for the AH_VERBATIM.
* tests/c.at (AC_USE_SYSTEM_EXTENSIONS): New test.
* NEWS: Mention the fix.
Reported by Andreas Schwab, analyzed by Stepan Kasal.
Signed-off-by: Eric Blake <ebb9@byu.net>
* lib/m4sugar/m4sugar.m4 (m4_cond): Split into...
(_m4_cond): ...this, for fewer macros per iteration.
* lib/m4sugar/foreach.m4 (_m4_cond): New implementation.
* tests/m4sugar.at (recursion): Test it.
* NEWS: Document the linear guarantee.
Signed-off-by: Eric Blake <ebb9@byu.net>
* lib/m4sugar/m4sugar.m4 (m4_bpatsubsts): Match documentation
about anchors, even for only one substitution.
* lib/m4sugar/foreach.m4 (_m4_bpatsubsts): New implementation.
* doc/autoconf.texi (Conditional constructs) <m4_bpatsubsts>:
Clarify behavior with regard to quoting.
* tests/m4sugar.at (recursion): Test scaling of m4_bpatsubsts.
(m4@&t@_bpatsubsts): New test.
* NEWS: Document the linear guarantee.
Signed-off-by: Eric Blake <ebb9@byu.net>
* lib/m4sugar/m4sugar.m4 (m4_reverse): New macro.
(m4_list_cmp): Rewrite to give linear behavior with M4 1.6 on an
m4_reverse'd list.
* lib/m4sugar/foreach.m4 (m4_reverse): Add the M4 1.4.x
counterpart.
* tests/m4sugar.at (recursion): Test it.
* doc/autoconf.texi (Evaluation Macros) <m4_reverse>: Document
it.
(Text processing Macros) <m4_append>: Cross-reference to m4_set.
* NEWS: Mention new macro.
Signed-off-by: Eric Blake <ebb9@byu.net>
* lib/m4sugar/m4sugar.m4 (m4_set_add, m4_set_add_all)
(m4_set_contains, m4_set_contents, m4_set_delete)
(m4_set_difference, m4_set_dump, m4_set_empty, m4_set_foreach)
(m4_set_intersection, m4_set_list, m4_set_listc, m4_set_remove)
(m4_set_size, m4_set_union): New macros.
* lib/m4sugar/foreach.m4 (m4_set_add_all): Add O(n) fallback for
m4 1.4.x.
* lib/autoconf/general.m4 (_AC_INIT_DEFAULTS, AC_SUBST): Use
new m4_set API for the set most likely to be large.
* doc/autoconf.texi (Set manipulation Macros): New node.
* NEWS: Mention new macros.
* tests/m4sugar.at (m4@&t@_set): New test.
Signed-off-by: Eric Blake <ebb9@byu.net>
* lib/m4sugar/foreach.m4: New file.
(m4_foreach, m4_case, _m4_shiftn, m4_do, m4_dquote_elt, _m4_map)
(m4_join, m4_joinall, m4_list_cmp, _m4_minmax): Replace m4sugar
macros based on $@ recursion [fast on M4 1.6, but quadratic on M4
1.4.x] with versions based on m4_for/m4_foreach [slow on 1.6, but
linear on 1.4.x].
* lib/m4sugar/m4sugar.m4 (m4_init): Dynamically load new file if
older M4 is assumed.
(m4_map_sep): Optimize.
(m4_max, m4_min): Refactor, by adding...
(_m4_max, _m4_min, _m4_minmax): ...more efficient helpers.
(m4_defn, m4_popdef, m4_undefine): Use foreach recursion.
* lib/m4sugar/Makefile.am (dist_m4sugarlib_DATA): Distribute new
file.
* tests/m4sugar.at (M4 loops): Add a stress test that takes
forever if m4_foreach and friends are quadratic.
* NEWS: Mention this.
Signed-off-by: Eric Blake <ebb9@byu.net>
* lib/m4sugar/m4sugar.m4 (m4_PACKAGE_VERSION): Ignore failure to
find version.texi, since bison does not provide it.
(m4_prepend): Add new macro, from bison.
(m4_prepend_uniq, m4_prepend_uniq_w): Add new macros, for
completeness.
(_m4_append_uniq): Rename...
(_m4_grow_uniq_1): ...to this to share implementation, and
optimize initial assignment.
(m4_append_uniq_w): Adjust caller.
* NEWS: Document new macros.
* doc/autoconf.texi (Text processing Macros) <m4_append>: Mention
speed consideration.
<m4_prepend>: Document the new prepend variants.
* tests/m4sugar.at (m4@&t@_prepend): New test.
Signed-off-by: Eric Blake <ebb9@byu.net>