* lib/autoconf/status.m4 (_AC_OUTPUT_FILES_PREPARE): Generate CR
via tr, rather than with literal byte.
* THANKS: Update.
Reported by Steven R. Loomis; patch suggested by Thomas Dickey.
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/autotest/general.m4 (AT_CLEANUP): Avoid a fork, since it is
known that the file has only one line and no \.
* lib/autoconf/general.m4 (_AC_COMPUTE_INT_RUN): Likewise.
Signed-off-by: Eric Blake <ebb9@byu.net>
* lib/autoconf/types.m4 (_AC_CHECK_TYPE_NEW_BODY): Extract
test body here. Move head comment of _AC_CHECK_TYPE_NEW here.
(_AC_CHECK_TYPE_NEW): Define a shell function and call it.
* lib/autoconf/headers.m4 (_AC_CHECK_HEADER_MONGREL_BODY): New
macro.
(_AC_CHECK_HEADER_MONGREL): Use a shell function.
Signed-off-by: Eric Blake <ebb9@byu.net>
* lib/m4sugar/m4sh.m4 (AS_REQUIRE_SHELL_FN): Factor...
(_AS_REQUIRE_SHELL_FN): ...into new helper macro.
(_AS_PREPARE): Temporarily redefine AS_REQUIRE_SHELL_FN to make
this task easier.
(_AS_LINENO_PREPARE): Make more efficient.
(_AS_MKDIR_P_PREPARE): Simplify use in _AS_PREPARE.
(_AS_UNSET_PREPARE): Avoid blank newline.
(AS_INIT): Emit as_func_unset alongside other functions.
Signed-off-by: Eric Blake <ebb9@byu.net>
* lib/autoconf/functions.m4 (_AC_CHECK_FUNC_BODY): New macro.
(AC_CHECK_FUNC): Use a shell function.
* lib/autoconf/c.m4 (AC_LANG_SOURCE(C)): Reduce number of forks.
Signed-off-by: Eric Blake <ebb9@byu.net>
* lib/autoconf/general.m4 (AC_LIBOBJ, AC_LIBSOURCES): Defun, not
define, so that an initial location is present, to account for
fact that gnulib-tool pushes another AC_DEFUN'd macro on top.
Signed-off-by: Eric Blake <ebb9@byu.net>
* lib/m4sugar/m4sugar.m4 (m4_defun_init): Handle indirect macro
names, and correct number of arguments.
(m4_copy): Also set up location of the copy.
(m4_defun): When copied, use current macro name, not original.
* tests/m4sugar.at (m4@&t@_require: one-shot initialization):
Update test.
Signed-off-by: Eric Blake <ebb9@byu.net>
* lib/m4sugar/m4sugar.m4 (m4_defun): Add undocumented third
argument.
(m4_defun_init): New undocumented macro.
* lib/m4sugar/m4sh.m4 (_AS_ECHO_LOG, AS_MESSAGE, AS_BASENAME)
(_AS_DIRNAME_EXPR, AS_DIRNAME, AS_ECHO, AS_ECHO_N, AS_TEST_X)
(AS_LN_S, AS_MKDIR_P, _AS_PATH_WALK, AS_VERSION_COMPARE)
(AS_TR_SH, AS_TR_CPP, AS_VAR_APPEND, AS_VAR_PUSHDEF): Use it to
simplify these macros once the one-shot initialization is
complete.
* tests/m4sugar.at (m4@&t@_require: one-shot initialization): New
test.
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/autoconf/functions.m4 (AC_FUNC_GETGROUPS): Only set
ac_cv_func_getgroups_works=no when it is not available.
Signed-off-by: Eric Blake <ebb9@byu.net>
* lib/autoconf/fortran.m4 (_AC_FC_LIBRARY_LDFLAGS): Add -little to
list of ignored arguments.
* THANKS: Update.
Signed-off-by: Eric Blake <ebb9@byu.net>
* lib/autoconf/general.m4 (_AC_RUN_IFELSE_BODY): New macro.
(_AC_RUN_IFELSE): Use a shell function.
(_AC_RUN_LOG): Avoid subshell for logging.
Signed-off-by: Eric Blake <ebb9@byu.net>
* lib/autoconf/functions.m4 (AC_FUNC_GETGROUPS): Always define
the shell variable, $ac_cv_func_getgroups_works. Otherwise, if
it is set to "yes" in the environment and configure is run on
a system like mingw that lacks the getgroups function, it would
mistakenly define HAVE_GETGROUPS. Reported by Simon Josefsson in
<http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/15354>.
* 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/m4sh.m4 (AS_IF): Always execute test, in case of
side effects. Allow continuation of script on same line as fi.
(_AS_DETECT_BETTER_SHELL): Adjust clients.
(AS_VAR_IF, AS_VAR_SET_IF): For now, supply newline no longer
given by AS_IF.
* lib/autoconf/c.m4 (_AC_PROG_PREPROC_WORKS_IFELSE): Likewise.
* lib/autoconf/general.m4 (_AC_ENABLE_IF): Likewise.
(AC_EGREP_CPP, _AC_RUN_IFELSE): Adjust client.
* lib/autoconf/libs.m4 (AC_SEARCH_LIBS): Likewise.
* doc/autoconf.texi (Common Shell Constructs) <AS_IF>: Fix typo.
(Polymorphic Variables): Move mention of dnl to the only two
AS_VAR functions that need it.
Signed-off-by: Eric Blake <ebb9@byu.net>
* lib/autoconf/general.m4 (_AC_PREPROC_IFELSE_BODY): New macro.
(_AC_PREPROC_IFELSE): Use a shell function.
* lib/m4sugar/m4sh.m4 (AS_REQUIRE): Factor for faster execution.
(AS_REQUIRE_SHELL_FN): Bypass AS_REQUIRE if function has already
been provided.
Signed-off-by: Eric Blake <ebb9@byu.net>
* lib/m4sugar/m4sh.m4 (_AS_SHELL_SANITIZE): Use m4_text_box for
existing banner.
(AS_INIT): Add new banners at strategic points.
* lib/autoconf/general.m4 (AC_INIT): Alter banner location, and
make consistent with other banners.
Signed-off-by: Eric Blake <ebb9@byu.net>
* lib/m4sugar/m4sh.m4 (AS_REQUIRE): Expand _m4_divert_desired before
passing it to m4_divert_require, so that its content is not used
anymore.
* tests/m4sh.at (Nested AS_REQUIRE): New testcase.
* 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>
* lib/m4sugar/m4sh.m4 (_AS_DETECT_SUGGESTED_PRUNE): New macro,
extracted from...
(_AS_DETECT_BETTER_SHELL): ...here, to use faster API. No need to
check for an empty required set.
Signed-off-by: Eric Blake <ebb9@byu.net>
* tests/m4sh.at (AS@&t@_VAR): New test.
* lib/m4sugar/m4sh.m4 (AS_VAR_PUSHDEF): Force expansion of
_AS_TR_SH_PREPARE at top level, rather than argument collection.
(AS_TR_SH): Support command substitution.
Signed-off-by: Eric Blake <ebb9@byu.net>
* lib/m4sugar/m4sh.m4 (AS_VAR_GET): Reduce output to one line.
(AS_VAR_TEST_SET, AS_VAR_SET, AS_VAR_SET_IF, AS_VAR_POPDEF): Sort,
no code changes.
Signed-off-by: Eric Blake <ebb9@byu.net>
* lib/m4sugar/m4sh.m4 (_AS_LINENO_PREPARE): Ensure that logging is
disabled when reporting LINENO failure, since logging requires
LINENO.
* doc/autoconf.texi (Initialization Macros): Recommend m4_pushdef,
not m4_rename, since the latter is undocumented.
* lib/autoconf/status.m4 (_AC_OUTPUT_CONFIG_STATUS): Avoid
m4_rename, as it does not yet handle pushdef stacks.
Reported by Ralf Wildenhues.
Signed-off-by: Eric Blake <ebb9@byu.net>
* doc/autoconf.texi (Portable Shell): Minor edits.
(Limitations of Builtins): Touch up wording.
* lib/m4sugar/m4sh.m4 (AS_LINENO_PUSH): Nuke trailing whitespace.
(_AS_SHELL_SANITIZE): Wrap comments less than 80 columns.
Signed-off-by: Eric Blake <ebb9@byu.net>
* lib/autoconf/general.m4 (_AC_CACHE_DUMP): Use AS_UNSET.
* lib/autoconf/programs.m4 (AC_PROG_SED): Use AS_UNSET.
* lib/m4sugar/m4sh.m4 (_AS_UNSET_PREPARE): Provide $as_unset as an
alias for AS_UNSET, for backwards compatibility.
(_AS_DETECT_BETTER_SHELL): Set BASH_ENV and ENV to /dev/null in case
the shell does not support unset.
(_AS_SHELL_SANITIZE): Work around Bash 2.01 bugs. Unset BASH_ENV.
(AS_INIT, _AS_PREPARE, AS_PREPARE): Call it.
(AS_UNSET): Assume it is there but it might fail if the variable is
not set. Use it throughout instead of $as_unset.
* lib/m4sugar/m4sh.m4 (_AS_DETECT_REQUIRED, _AS_DETECT_SUGGESTED): Remove
m4_require of _AS_DETECT_BETTER_SHELL.
(_AS_CLEANUP): Add it here.
(_AS_DETECT_BETTER_SHELL): Just expand the test instead of appending it
to _AS_CLEANUP.
(_AS_SHELL_SANITIZE): New name of the old AS_SHELL_SANITIZE macro.
(AS_SHELL_SANITIZE): New macro hacking around Libtool misuse.
(AS_PREPARE): Use _AS_SHELL_SANITIZE.
(AS_INIT): Add m4_provide of itself.
* lib/m4sugar/m4sh.m4 (_AS_ECHO_LOG): If defined, use $as_lineno as
the line number emitted to the log file.
(AS_LINENO_PUSH, AS_LINENO_POP): New.
* tests/m4sh.at (LINENO Stack): New test.
* lib/m4sugar/m4sugar.m4 (_m4_require_call): Accept a third argument.
(m4_require): Pass it.
(m4_divert_require): New.
* lib/m4sugar/m4sh.m4 (AS_REQUIRE): Rewrite using m4_divert_require.
Remove comment about differences with m4_require.
* tests/m4sh.at (AS_REQUIRE_SHELL_FN and m4_require): Update to test
the expected behavior.
(Nested AS_REQUIRE_SHELL_FN): New test.
* lib/m4sugar/m4sh.m4 (AS_INIT_GENERATED): New.
* lib/autoconf/status.m4 (_AC_OUTPUT_CONFIG_STATUS): Use it.
* doc/autoconf.texi (Initialization macros): Document it.
* lib/m4sugar/m4sh.m4 (_AS_PREPARE, AS_REQUIRE_SHELL_FN)
(_AS_SHELL_FN_WORK): Imitate GNU Coding Standards for C
functions.
Signed-off-by: Eric Blake <ebb9@byu.net>
2008-10-12 Paolo Bonzini <bonzini@gnu.org>
* lib/m4sugar/m4sh.m4 (_AS_LINENO_PREPARE): Place names of
contributors under m4 rather than shell comments.
* lib/m4sugar/m4sh.m4 (_AS_MKDIR_P): Correct documentation to
match implementation.
(_AS_PREPARE, _AS_MKDIR_P_PREPARE): Adjust callers.
* doc/autoconf.texi (Programming in M4sh) <AS_MKDIR_P>: Tweak
wording to better match behavior.
Signed-off-by: Eric Blake <ebb9@byu.net>
2008-10-10 Paolo Bonzini <bonzini@gnu.org>
* m4sugar/m4sh.m4 (_AS_MKDIR_P): New, from AS_MKDIR_P. Adjust
meaning of as_mkdir_p to be `false' or a full `mkdir -p' command.
(AS_MKDIR_P): Just dispatch to as_func_mkdir_p.
(_AS_PREPARE): Define shell functions.
(_AS_MKDIR_P_PREPARE): Set as_mkdir_p according to the above change.
Define shell functions.
* lib/m4sugar/m4sh.m4 (AS_SHELL_SANITIZE): Avoid unconditional
preparation.
(_AS_ECHO_LOG): Depend on $LINENO preparation.
(AS_MESSAGE): Depend on $as_me preparation.
(AS_TMPDIR): Use AS_ERROR, rather than a hand-rolled copy.
Signed-off-by: Eric Blake <ebb9@byu.net>
2008-10-09 Paolo Bonzini <bonzini@gnu.org>
* m4sugar/m4sh.m4 (AS_SHELL_SANITIZE): Delay setting as_me
until the M4SH-INIT diversion using _AS_ME_PREPARE.
(_AS_PREPARE): Invoke _AS_EXPR_PREPARE before _AS_BASENAME_PREPARE
and _AS_DIRNAME_PREPARE, and _AS_BASENAME_PREPARE and _AS_ME_PREPARE
before _AS_LINENO_PREPARE.
(AS_PREPARE): Include all the AS_REQUIREs manually.
(_AS_ME_PREPARE): New.
(_AS_LINENO_PREPARE): Use m4_defun.
2008-10-09 Paolo Bonzini <bonzini@gnu.org>
* m4sugar/m4sh.m4 (_AS_BASENAME_EXPR, _AS_DIRNAME_EXPR): Do not
require _AS_EXPR_PREPARE.
(_AS_BASENAME_PREPARE, _AS_DIRNAME_PREPARE): Do it here.
(_AS_PREPARE): Add _AS_BASENAME_PREPARE.
* lib/m4sugar/m4sh.m4 (_AS_DETECT_REQUIRED, _AS_DETECT_SUGGESTED):
Use m4_set, rather than m4_expand_once/m4_append.
(_AS_DETECT_SUGGESTED): Adjust to new storage layout, and filter
required tests out of suggested tests.
Reported by Paolo Bonzini.
Signed-off-by: Eric Blake <ebb9@byu.net>
* 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/m4sh.m4 (_AS_CLEANUP): Give initial definition.
* tests/m4sh.at (AS@&t@_INIT cleanup): Expose the need for this.
Signed-off-by: Eric Blake <ebb9@byu.net>
* lib/m4sugar/m4sh.m4 (AS_REQUIRE_SHELL_FN): Determine diversion
name prior to invoking AS_REQUIRE.
Reported by Ralf Wildenhues.
Signed-off-by: Eric Blake <ebb9@byu.net>
* lib/m4sugar/m4sh.m4 (M4SH-INIT-FN): New diversion.
(AS_REQUIRE): Accept diversion parameter.
(AS_REQUIRE_SHELL_FN): Use it.
Signed-off-by: Eric Blake <ebb9@byu.net>
* 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: Use the serial code path if no test
is to be run.
* tests/autotest.at (parallel test execution): Test -j and -jN
with `-k notmatched'.
Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* lib/autotest/general.m4: Do not reset $at_jobs if it is equal
to one. Fixes hang with `-k notmatched'.
Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* 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/programs.m4 (_AC_TOOL_WARN): Support cross-compiles
with poorly named tools; the issue has been reported too many
times in the last four years to pull support.
* doc/autoconf.texi (Specifying Names, Generic Programs): Update
documentation accordingly.
* THANKS: Update.
Reported by Josef Tran and others, wording suggested by Ralf
Wildenhues.
Signed-off-by: Eric Blake <ebb9@byu.net>
* doc/autoconf.texi (C Compiler) <AC_C_BIGENDIAN>: Mention that
universal builds require a config header.
* lib/autoconf/c.m4 (AC_C_BIGENDIAN): Enhance comments. Check
AH_HEADER at the last possible moment, so that users can use
AC_CONFIG_HEADER after this macro.
Reported by Stepan Kasal.
Signed-off-by: Eric Blake <ebb9@byu.net>
* lib/m4sugar/foreach.m4 (_m4_shiftn): Handle case when shifting
all arguments.
* tests/m4sugar.at (M4 loops): Test it.
Reported by Akim Demaille.
Signed-off-by: Eric Blake <ebb9@byu.net>
* lib/m4sugar/m4sugar.m4 (m4_defn, m4_popdef, m4_undefine): Move
freeze-time decision of using faster 1.6 implementation...
(m4_init): ...to a runtime decision, and add use of new debugmode
flag.
Signed-off-by: Eric Blake <ebb9@byu.net>
* 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_mapall_sep, m4_list_cmp): Wrap
around...
(_m4_mapall_sep, _m4_list_cmp_raw): ...new helpers, to avoid
duplicate side effects.
(m4_version_compare): Adjust caller.
* lib/m4sugar/foreach.m4 (m4_list_cmp): Rename...
(_m4_list_cmp_raw): ...to match m4sugar.
* doc/autoconf.texi (Looping constructs): Document the behavior of
side effects.
* tests/m4sugar.at (M4 loops, m4@&t@_map, m4@&t@_version_compare):
Ensure only one side effect.
(recursion): Fix test typo.
Reported by Ralf Wildenhues.
Signed-off-by: Eric Blake <ebb9@byu.net>
* doc/autoconf.texi (Shell Substitutions): Document the issue.
* lib/m4sugar/m4sh.m4 (AS_VAR_IF): New function.
* lib/autoconf/functions.m4 (AC_CHECK_FUNC): Use it in place of
"test AS_VAR_GET([...]) = yes"
* lib/autoconf/general.m4 (AC_CHECK_FILE, AC_CHECK_DECL): Likewise.
* lib/autoconf/headers.m4 (_AC_CHECK_HEADER_MONGREL): Likewise.
(_AC_CHECK_HEADER_NEW, _AC_CHECK_HEADER_OLD): Likewise.
(_AC_CHECK_HEADER_DIRENT): Likewise.
* lib/autoconf/libs.m4 (AC_CHECK_LIB): Likewise.
* lib/autoconf/types.m4 (_AC_CHECK_TYPE_NEW, AC_CHECK_MEMBER): Likewise.
* lib/autoconf/status.m4 (_AC_OUTPUT_FILES_PREPARE): Use
temporary variable to work around the issue.
* tests/foreign.at (Libtool): Quote result of command
substitution.
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/m4sugar/m4sugar.m4 (m4_transform, m4_transform_pair): New
macros, undocumented for now.
* lib/m4sugar/foreach.m4 (m4_transform, m4_transform_pair): Also
the m4 1.4.x counterparts.
* lib/m4sugar/m4sh.m4 (AS_IF, AS_CASE): Use it.
* tests/m4sh.at (AS@&t@_IF and AS@&t@_CASE): Test it.
Signed-off-by: Eric Blake <ebb9@byu.net>