Commit Graph

5560 Commits

Author SHA1 Message Date
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
Eric Blake
c8a745ce67 Avoid unportable use of echo in testsuite.
* tests/m4sh.at (AS@&t@_VAR basics): Use AS_ECHO, since string
contains backslash.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-10-20 22:03:36 +02: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
af61badc82 Document bugs in { } handling.
* doc/autoconf.texi (Limitations of Builtins): Mention bug on
empty list.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-10-18 07:27:45 -06:00
Eric Blake
773837cec3 Fix some testsuite failures introduced two days ago.
* tests/m4sh.at (Nested AS@&t@_REQUIRE_SHELL_FN)
(AS@&t@_REQUIRE_SHELL_FN and m4@&t@_require): Adjust to changed
API.
Reported by Ralf Wildenhues.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-10-18 06:50:08 -06:00
Ralf Wildenhues
61b66d572b Show how to extract single substitutions from config.status.
* doc/autoconf.texi (config.status Invocation): Show example
using `--file=-'.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2008-10-18 14:40:56 +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
c8cfd385c2 Document AS_VAR interfaces.
* 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>
2008-10-17 15:48:46 -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
2535dcc192 Add a testcase using more then one language.
* tests/compile.at (Multiple languages): New test.
2008-10-16 10:41:52 +02: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
2079086ce2 Updates to shell portability documentation
* 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.
2008-10-15 16:05:42 +02: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
Eric Blake
460ecbc03e Correct previous patch.
* doc/autoconf.texi (Shell Functions): Bash obeys Posix, after
all.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-10-14 11:52:38 -06:00
Eric Blake
e7c4402520 Document shell function environment pitfall.
* doc/autoconf.texi (Shell Functions): Document bugs in bash,
Solaris /bin/sh.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-10-14 11:28:09 -06: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
c974b65d2c Test AS_LINENO_PREPARE.
* tests/m4sh.at: Use documented AS_LINENO_PREPARE.
2008-10-13 18:04:22 +02:00
Paolo Bonzini
50109ed5c2 Test AS_ME_PREPARE.
* tests/m4sh.at (as_me): New test.
2008-10-13 18:03:37 +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
5a1279d42c commit missing changelog entry 2008-10-13 14:29:06 +02: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
Paolo Bonzini
00382ba1b1 extract "Programming in M4sh" into its own chapter
2008-10-10  Paolo Bonzini  <bonzini@gnu.org>

	* doc/autoconf.texi (Programming in M4sh): Make its own chapter.
2008-10-11 13:05:33 +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
edd65fb24d don't advertise shell function adversely
2008-10-08  Paolo Bonzini  <bonzini@gnu.org>

	* doc/autoconf.texi: Be less wary of shell functions.
2008-10-10 15:33:28 +02: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
Eric Blake
5e7bc716e5 Resync from gnulib.
* cfg.mk (cvs_executable_files, cvs_files): Rewrite...
(fetch): ...into new target.
(executable-update): Delete, now that it is unused.
* maint.mk (update, local_updates, cvs_files, gnulib_repo)
(wget-update, cvs-update): Likewise.
* HACKING (Update the foreign files): Document new procedure.
* GNUmakefile: Resync from upstream, via new 'make fetch'.
* build-aux/config.guess: Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-10-08 09:43:25 -06:00
Paolo Bonzini
734abde3de remove shell function "spy" 2008-10-08 06:17:43 -06:00