Commit Graph

2478 Commits

Author SHA1 Message Date
Paolo Bonzini
6d4ddfda94 Use a shell function for _AC_COMPILE_IFELSE.
* lib/autoconf/general.m4 (_AC_COMPILE_IFELSE_BODY): New macro.
(_AC_COMPILE_IFELSE): Use a shell function.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-10-21 21:00:00 -06:00
Eric Blake
6ae40b3dae Use AS_VAR_APPEND.
* lib/autoconf/functions.m4 (AC_CHECK_FUNCS_ONCE): Use new macro.
* lib/autoconf/general.m4 (_AC_INIT_PREPARE)
(_AC_LIBOBJS_NORMALIZE): Likewise.
* lib/autoconf/headers.m4 (AC_CHECK_HEADERS_ONCE): Likewise.
* lib/autoconf/status.m4 (_AC_OUTPUT_SUBDIRS)
(_AC_OUTPUT_CONFIG_STATUS, _AC_OUTPUT_MAIN_LOOP): Likewise.
* lib/autotest/general.m4 (AT_INIT): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-10-21 15:03:45 -06:00
Eric Blake
86ce15b622 Add AS_VAR_APPEND.
* lib/m4sugar/m4sh.m4 (_AS_VAR_APPEND_PREPARE)
(_AS_VAR_APPEND_WORKS, AS_VAR_APPEND): New macros.
(AS_PREPARE, _AS_PREPARE): Emit preparation.
* tests/m4sh.at (AS@&t@_VAR_APPEND): New test.
* doc/autoconf.texi (Polymorphic Variables) <AS_VAR_APPEND>:
Document new macro.
<AS_VAR_SET>: Mention ramification of `""` rules.
* NEWS: Mention new macro.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-10-21 15:03:17 -06:00
Paolo Bonzini
89839f42af Use a shell function for _AC_PREPROC_IFELSE.
* 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>
2008-10-21 10:42:34 -06:00
Eric Blake
91fd5ef60a Add banners to generated files.
* lib/autotest/general.m4 (AT_INIT): Make banners consistent.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-10-21 08:27:07 -06:00
Eric Blake
b8b7615a43 Add banners to generated files.
* 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>
2008-10-21 08:00:57 -06:00
Paolo Bonzini
98c907d8de Add AC_REQUIRE_SHELL_FN and the SHELL_FN diversion.
* lib/autoconf/general.m4 (AC_REQUIRE_SHELL_FN): New.
(m4_divert(SHELL_FN)): New.
2008-10-20 18:58:59 -04:00
Paolo Bonzini
5969d90008 Make sure that nested AS_REQUIRE do not lose the desired diversion.
* 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.
2008-10-19 00:01:16 +02:00
Eric Blake
c6b172ee19 Add m4_curry.
* 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>
2008-10-17 16:32:27 -06:00
Eric Blake
a00c4430ba Improve suggested test filtering.
* 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>
2008-10-17 16:23:21 -06:00
Eric Blake
92f34215fc Add m4_set_map.
* lib/m4sugar/m4sugar.m4 (m4_set_foreach): New macro.
* tests/m4sugar.at (m4@&t@_set): Enhance test.
* doc/autoconf.texi (Set manipulation Macros) <m4_set_map>:
Document it.
* NEWS: Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-10-17 16:02:48 -06:00
Eric Blake
f4ace96990 Document m4_map_args.
* lib/m4sugar/m4sugar.m4 (m4_transform, m4_transform_pair):
Rename...
(m4_map_args, m4_map_args_pair): ...to these names, and document.
(m4_version_unletter): Use the interface.
* lib/m4sugar/foreach.m4 (m4_map_args, m4_map_args_pair)
(_m4_map_args_, _m4_map_args_pair_, _m4_map_args_pair_end):
Perform same renames.
* lib/m4sugar/m4sh.m4 (AS_CASE, AS_IF): Adjust callers.
* tests/m4sugar.at (m4@&t@_map_args): New test.
(recursion): Adjust caller.
* tests/m4sh.at (AS@&t@_IF and AS@&t@_CASE): Likewise.
* doc/autoconf.texi (Looping constructs) <m4_map_args>: Document
this interface.
* NEWS: Mention the new macros.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-10-17 16:00:57 -06:00
Eric Blake
093eca1787 Reduce vertical whitespace in configure.
* lib/autoconf/general.m4 (AC_INIT): Silence newline output during
m4 side effect initializations.
* lib/m4sugar/m4sh.m4 (AS_PREPARE): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-10-17 15:48:51 -06:00
Eric Blake
c7f3d4ef19 Test AS_VAR interfaces.
* 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>
2008-10-17 15:48:17 -06:00
Eric Blake
6e3761f85f Add AS_VAR_COPY.
* lib/m4sugar/m4sh.m4 (AS_VAR_COPY): New macro.
(AS_VAR_IF): Use it, instead of the broken AS_VAR_GET.
* lib/autoconf/general.m4 (AC_CACHE_CHECK): Likewise.
* lib/autoconf/libs.m4 (AC_SEARCH_LIBS): Likewise.
* lib/autotest/general.m4 (_AT_FINISH): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-10-17 14:07:11 -06:00
Eric Blake
7fdde10b5f Sort AS_VAR_* interfaces.
* 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>
2008-10-17 14:01:49 -06:00
Eric Blake
29f8f14acd Allow comments before functions emitted by m4sh.
* lib/m4sugar/m4sh.m4 (AS_REQUIRE_SHELL_FN): Add comment
argument.  Supply closing comment, to ease readability.
(_AS_MKDIR_P_PREPARE): Adjust caller.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-10-16 20:25:28 -06:00
Eric Blake
d99fef0e1e Add AS_FUNCTION_DESCRIBE.
* lib/m4sugar/m4sh.m4 (AS_FUNCTION_DESCRIBE): New macro.
* lib/autotest/general.m4 (AT_INIT): Use it.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-10-16 19:59:11 -06:00
Eric Blake
257a2a68d0 Speed up m4_qlen with caching.
* lib/m4sugar/m4sugar.m4 (_m4_qlen): Renamed from old m4_qlen.
(m4_qlen): Cache results for speed.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-10-16 10:50:25 -06:00
Paolo Bonzini
a38c243f00 Fix Libtool's config.lt test.
* lib/m4sugar/m4sh.m4 (_AS_PREPARE): Disable AS_REQUIRE while
expanding it.
2008-10-16 10:41:51 +02:00
Eric Blake
7eba1c0ae0 Break circular require chain in _AS_LINENO_PREPARE.
* 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>
2008-10-15 16:19:04 -06:00
Eric Blake
6edff90b47 Cleanups to previous patches.
* 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>
2008-10-15 11:22:25 -06:00
Paolo Bonzini
26ba5ebd23 Assume a (possibly buggy) unset' is present after a better shell' was found.
* 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.
2008-10-15 16:05:07 +02:00
Paolo Bonzini
d73b293fd3 Turn AS_SHELL_SANITIZE into a for-Libtool-only wrapper.
* 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.
2008-10-15 16:04:39 +02:00
Paolo Bonzini
cde022163b Use "test x$foo = xyes" to avoid upsetting Libtool's sh.test.
* lib/m4sugar/m4sh.m4 (_AS_DETECT_BETTER_SHELL, _AS_SHELL_FN_WORK): Use
"test x$foo = xyes".
2008-10-15 16:04:08 +02:00
Paolo Bonzini
6265de13fe Trim down the size of the better-shell test.
* lib/m4sugar/m4sh.at (_AT_DETECT_BETTER_SHELL): Store the common
snippets into shell variables.
(_AS_RUN): Rewrite.
2008-10-15 11:06:02 +02:00
Paolo Bonzini
270c996180 Support a stack of LINENO values for AS_MESSAGE.
* 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.
2008-10-15 11:06:01 +02:00
Paolo Bonzini
920874ceda Use m4_require to implement AS_REQUIRE.
* 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.
2008-10-14 15:14:12 +02:00
Paolo Bonzini
45f473304f Add and document AS_INIT_GENERATED.
* 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.
2008-10-13 18:01:21 +02:00
Eric Blake
0ba284a888 Use consistent shell function style.
* 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-13 08:50:25 -06:00
Paolo Bonzini
c04c47665c place names of contributors under m4 rather than shell comments
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.
2008-10-13 14:27:35 +02:00
Paolo Bonzini
06bceefef2 Add and document AS_ME_PREPARE and AS_LINENO_PREPARE
2008-10-10  Paolo Bonzini  <bonzini@gnu.org>

	* lib/m4sugar/m4sh.m4 (AS_ME_PREPARE, AS_LINENO_PREPARE): New.
	* doc/autoconf.texi (Initialization macros): Document them.
	(Portable Shell): Refer to AS_LINENO_PREPARE.

	* bin/autoconf.as: Invoke AS_ME_PREPARE.
	* lib/autotest/general.m4: Likewise.
2008-10-11 13:30:38 +02:00
Eric Blake
523ee0e116 Fix _AS_MKDIR_P usage.
* 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 08:40:09 -06:00
Paolo Bonzini
b9de80b2dc use a shell function for AS_MKDIR_P
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.
2008-10-10 15:03:22 +02:00
Eric Blake
01dd2bedd0 Only prepare $as_me if it will be used.
* 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 10:58:11 -06:00
Paolo Bonzini
dd0654cc13 more cleanup before adding shell functions
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 16:04:59 +02:00
Paolo Bonzini
34b79a8a83 avoid problems when _AS_BASENAME_EXPR are invoked before _AS_EXPR_PREPARE
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.
2008-10-09 15:41:14 +02:00
Paolo Bonzini
734abde3de remove shell function "spy" 2008-10-08 06:17:43 -06:00
Paolo Bonzini
926ed6a975 place _AS_UNSET_PREPARE in the right diversion 2008-10-08 06:10:10 -06:00
Eric Blake
f789b40e97 Avoid repeating required shell tests in suggested set.
* 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>
2008-10-08 05:53:45 -06:00
Ralf Wildenhues
4da97747ef Do not write to testsuite log fd before initialization.
* 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>
2008-10-08 07:24:06 +02:00
Eric Blake
6f106cdead Ensure _AS_CLEANUP is defined.
* 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>
2008-10-07 12:11:01 -06:00
Eric Blake
7e1c6397cc Improve m4sh maintainability.
* lib/m4sugar/m4sh.m4: Sort macros for sanitizing the shell; no
code change.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-10-07 10:55:05 -06:00
Eric Blake
a2f7e1aa97 Fix m4 quoting in previous patch.
* 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>
2008-10-07 06:14:34 -06:00
Paolo Bonzini
95268678f0 add a separate diversion for shell functions
* 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>
2008-10-06 21:35:11 -06:00
Eric Blake
b30850a851 Add m4_default_quoted.
* 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>
2008-10-06 20:19:32 -06:00
Ralf Wildenhues
22e3751d19 Fix more testsuite hang corner cases.
* 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>
2008-10-03 07:21:25 +02:00
Ralf Wildenhues
1d8609399d Fix hang with `testsuite -k notmatched'.
* 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>
2008-10-02 20:44:22 +02:00
Ralf Wildenhues
f108ed8925 Implement parallel Autotest test execution: testsuite --jobs.
* 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>
2008-10-02 07:52:25 +02:00
Eric Blake
20c24928ab Fix Erlang regression, introduced 2006-11-17.
* lib/autoconf/erlang.m4 (AC_LANG(Erlang)): Avoid M4 comment
caused by underquoting.
* NEWS: Mention this fix.
* THANKS: Update.
Reported by BJ Terry.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-09-16 06:41:46 -06:00