Commit Graph

2794 Commits

Author SHA1 Message Date
Eric Blake
c241057ad4 Add stdout-nolog and ignore-nolog to AT_CHECK.
* lib/autotest/general.m4 (AT_DIFF_STDERR(stderr-nolog))
(AT_DIFF_STDERR(ignore-nolog), AT_DIFF_STDOUT(stdout-nolog))
(AT_DIFF_STDOUT(ignore-nolog)): New macros.
* tests/autotest.at (Logging): New test.
* doc/autoconf.texi (Writing Testsuites) <AT_CHECK>: Document the
new logging actions.
* NEWS: Likewise.
Reported by Ralf Wildenhues.

Signed-off-by: Eric Blake <ebb9@byu.net>
2009-04-15 06:00:56 -06:00
Eric Blake
e8f34dca8c Teach AT_CHECK about hard failures.
* lib/autotest/general.m4 (AT_INIT) <at_fn_check_skip>
<at_fn_check_status, at_fn_group_postprocess>: Handle hard
failures.
* doc/autoconf.texi (Writing Testsuites) <AT_CHECK>: Document
AT_CHECK_NOESCAPE and exit status 99.
* NEWS: Likewise.
* tests/autotest.at (Hard fail, Cleanup): New tests.

Signed-off-by: Eric Blake <ebb9@byu.net>
2009-04-15 06:00:24 -06:00
Eric Blake
bc79643383 Fix yesterday's regression in AS_IF.
* lib/m4sugar/m4sh.m4 (_AS_IF_ELSE): Don't corrupt $? in else
branch; it is up to the user to avoid syntax errors.
* tests/m4sh.at (AS@&t@_IF and AS@&t@_CASE): Adjust test.

Signed-off-by: Eric Blake <ebb9@byu.net>
2009-04-14 19:26:29 -06:00
Ralf Wildenhues
63d463427f Add traces for AM_SILENT_RULES.
* lib/autom4te.in (Automake-preselections): Trace
AM_SILENT_RULES.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2009-04-14 22:17:35 +02:00
Eric Blake
52b83b8c37 Make AS_IF, AS_CASE, and AS_FOR more robust to blank arguments.
* lib/m4sugar/m4sh.m4 (_AS_CASE, _AS_CASE_DEFAULT, AS_FOR, _AS_IF)
(_AS_IF_ELSE, AS_IF): Avoid syntax error on blank argument,
including a macro with an empty expansion.
* NEWS: Mention this.
* tests/m4sh.at (AS@&t@_IF and AS@&t@_CASE, AS@&t@_FOR): Update
tests.
Reported by Mike Frysinger.

Signed-off-by: Eric Blake <ebb9@byu.net>
2009-04-13 13:15:34 -06:00
Eric Blake
723c9e5c0f Add m4_blank and friends.
* lib/m4sugar/m4sugar.m4 (m4_blank, m4_nblank, m4_default_nblank)
(m4_default_nblank_quoted): New macros.
* NEWS: Document them.
* doc/autoconf.texi (Conditional constructs): Likewise.
* tests/m4sugar.at (m4sugar shorthand conditionals): New test.
Suggested by Mike Frysinger.

Signed-off-by: Eric Blake <ebb9@byu.net>
2009-04-13 13:15:32 -06:00
Eric Blake
ef8940d9b5 Add undocumented _AS_CLEAN_DIR.
* lib/m4sugar/m4sh.m4 (_AS_CLEAN_DIR): New macro; fixes m4 quoting
in previous patch.
* lib/autotest/general.m4 (AT_INIT) <at_fn_group_prepare>: Use new
macro.
* tests/m4sh.at (_AS@&t@_CLEAN_DIR): New test.
Reported by Ralf Wildenhues.

Signed-off-by: Eric Blake <ebb9@byu.net>
2009-04-10 06:26:33 -06:00
Eric Blake
1c34e5113f Avoid problems caused by deleting in-use directory.
* lib/autotest/general.m4 (AT_INIT) <at_fn_group_prepare>: Only
remove the contents of $at_group_dir, not the directory itself.

Signed-off-by: Eric Blake <ebb9@byu.net>
2009-04-09 17:40:17 -06:00
Eric Blake
bd671cbd57 Fix regression in empty test.
* lib/autotest/general.m4 (AT_SETUP): Prep AT_ingroup for fallback
use in empty test.  Fixes regression introduced 2009-04-06.
(_AT_CHECK): Undo fallback when a test is not empty.
(AT_CLEANUP): Expand AT_ingroup before deleting.

Signed-off-by: Eric Blake <ebb9@byu.net>
2009-04-09 17:40:15 -06:00
Paolo Bonzini
fc5c85a6b2 Make a less conservative cross-compilation guess for AC_FUNC_UTIME_NULL.
* lib/autoconf/functions.m4 (AC_FUNC_UTIME_NULL): Assume
not crosscompiling to an obsolete system.
2009-04-09 23:14:27 +02:00
Ralf Wildenhues
34163e58d4 Automake relies on the undocumented `_AC_COMPILER_EXEEXT' macro.
* lib/autoconf/lang.m4 (_AC_COMPILER_EXEEXT): Document that
Automake relies on this macro.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2009-04-09 00:00:30 +02:00
Eric Blake
c283f62edb Handle shell comments in AT_CHECK.
* lib/autotest/general.m4 (_AT_DECIDE_TRACEABLE): Handle # in
test correctly.  Latent bug in handling shell comment was first
fixed 2008-11-20, but regressed two patches later.
* tests/autotest.at (Shell comment in command): New test.
* NEWS: Document the fix.

Signed-off-by: Eric Blake <ebb9@byu.net>
2009-04-06 20:52:44 -06:00
Eric Blake
57e6f69b99 Hard fail any test with syntax errors.
* lib/autotest/general.m4 (AT_INIT) <at_fn_group_postprocess>:
Guarantee test failure on syntax error, rather than inheriting
status from previous test.
* tests/autotest.at (Syntax error): New test.

Signed-off-by: Eric Blake <ebb9@byu.net>
2009-04-06 20:52:41 -06:00
Andris Pavenis
bc9bc82a1e Fix awk substitution of carriage returns on DJGPP.
* lib/autoconf/status.m4 (_AC_OUTPUT_FILES_PREPARE): Fix typo in
generation of ac_cs_awk_cr.
* THANKS: Update.

Signed-off-by: Eric Blake <ebb9@byu.net>
2009-03-24 06:47:09 -06:00
Aaron W. LaFramboise
60e637d68f Work around cygwin bash igncr mode.
* lib/autoconf/status.m4 (_AC_OUTPUT_FILES_PREPARE): Fall back to
bash carriage returns if ac_cr lost \r from ``.
* THANKS: Update.
Suggested by Eric Blake.

Signed-off-by: Eric Blake <ebb9@byu.net>
2009-03-24 06:40:23 -06:00
Jim Meyering
8a54ca8043 Manual: fix a typo.
* lib/m4sugar/m4sh.m4: s/are/is/ => "there is no indirection"
2009-03-17 21:59:14 +01:00
Allan Caffee
286c51ccf3 Fix a typo in comment for AS_LITERAL_IF.
* lib/m4sugar/m4sh.m4 (AS_LITERAL_IF): Update a comment that fell
out of date when this function was moved/renamed in 59ecd766.
* THANKS: Update.

Signed-off-by: Allan Caffee <allan.caffee@gmail.com>
Signed-off-by: Eric Blake <ebb9@byu.net>
2009-03-02 11:13:25 -07:00
Eric Blake
ba524e662f Improve wording for AS_ESCAPE.
* doc/autoconf.texi (Common Shell Constructs) <AS_ESCAPE>: Touch
up documentation.
* lib/m4sugar/m4sh.m4 (_AS_ESCAPE): Fix comment typos.
Reported by Ralf Wildenhues.

Signed-off-by: Eric Blake <ebb9@byu.net>
2009-03-02 11:12:16 -07:00
Eric Blake
b35598a688 Use pkgdatadir consistently.
* bin/Makefile.am (edit): Substitute pkgdatadir, not datadir.
* lib/Makefile.am (edit): Likewise.
* lib/autom4te.in (Autoconf-without-aclocal-m4, Autotest, M4sh)
(M4sugar): Use @pkgdatadir@, not @datadir@.
* bin/autoheader.in ($datadir): Likewise.
* bin/autom4te.in ($datadir): Likewise.
* bin/autoreconf.in ($datadir): Likewise.
* bin/autoscan.in ($datadir): Likewise.
* bin/autoupdate.in ($datadir): Likewise.
* bin/ifnames.in ($datadir): Likewise.
* doc/autoconf.texi (Installation Directory Variables): Update
example to be consistent; focus on $(bindir) as an autoconf
variable, and mention that $(pkgdatadir) comes from automake.
Reported by Reuben Thomas.

Signed-off-by: Eric Blake <ebb9@byu.net>
2009-02-24 09:38:01 -07:00
Eric Blake
4da1abd28b Use m4_translit more efficiently in AS_ESCAPE.
* lib/m4sugar/m4sh.m4 (_AS_ESCAPE): Alter API to take first byte
of set separately from rest.
(AS_ESCAPE, _AS_QUOTE_MODERN, AS_TR_SH, AS_VAR_GET): Adjust
callers.
* lib/autoconf/autoheader.m4 (AH_VERBATIM): Avoid duplicate
characters in translit request.
* doc/autoconf.texi (Common Shell Constructs) <AS_ESCAPE>:
Document the macro.
* NEWS: Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
2009-02-19 14:32:36 -07:00
Eric Blake
be5eef442d Fix m4_set speed regression introduced 2008-12-18.
* lib/m4sugar/m4sugar.m4 (_m4_stack_reverse): Alter API to avoid
creating larger argument on each iteration.
(m4_stack_foreach_sep, m4_stack_foreach_sep_lifo)
(_m4_set_contents_2): Adjust all four-argument callers.

Signed-off-by: Eric Blake <ebb9@byu.net>
2009-02-12 08:27:18 -07:00
Eric Blake
cfb18d385b Use AC_DEFUN_ONCE for some one-shot AC_PROG macros.
* lib/autoconf/programs.m4 (AC_PROG_MKDIR_P): Switch to
AC_DEFUN_ONCE, since this is a one-shot macro.
(AC_PROG_INSTALL): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
2009-02-03 09:37:53 -07:00
Eric Blake
f8fcfad146 Use AC_DEFUN_ONCE for uncontroversial one-shot macros.
* lib/autoconf/headers.m4 (AC_HEADER_ASSERT): Switch to
AC_DEFUN_ONCE, since this is a one-shot macro.
* lib/autoconf/specific.m4 (AC_USE_SYSTEM_EXTENSIONS): Likewise.
* lib/autoconf/general.m4 (AC_CANONICAL_BUILD)
(AC_CANONICAL_HOST, AC_CANONICAL_TARGET): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
2009-01-28 17:04:52 -07:00
Eric Blake
876b3fbfdd Reduce blank lines in AC_DEFUN_ONCE macros.
* lib/m4sugar/m4sugar.m4 (m4_defun_once): Avoid redundant blank
line when a defun_once macro is required.
(_m4_defun_once): New helper macro, for less memory use.
* tests/m4sugar.at (m4@&t@_require: nested): Adjust test.

Signed-off-by: Eric Blake <ebb9@byu.net>
2009-01-28 17:04:43 -07:00
Eric Blake
9c4c7c5ca4 Silence another false positive expand-before-require.
* lib/m4sugar/m4sugar.m4 (_m4_defun_pro_outer)
(_m4_defun_epi_outer, _m4_require_call, m4_provide): Track name
that caused a diversion change, not just diversion number.
(m4_require): Factor...
(_m4_require_check): ...into new macro, which also checks whether
diversion that performed the expansion has been collected.
* tests/m4sugar.at (m4@&t@_require: nested): Enhance test.
Reported by Ralf Wildenhues.

Signed-off-by: Eric Blake <ebb9@byu.net>
2009-01-28 15:08:11 -07:00
Eric Blake
aa30765d64 Fix AC_C_RESTRICT for Sun Studio 12 C++.
* lib/autoconf/c.m4 (AC_C_RESTRICT): Newer Sun Studio C provides
__restrict__ rather than _Restrict, which still trips up Sun
Studio 12 C++.
* THANKS: Update.
Reported by Rolf Vandevaart.

Signed-off-by: Eric Blake <ebb9@byu.net>
2009-01-28 09:59:24 -07:00
Eric Blake
65c175502a Fix years in copyright notices.
* lib/m4sugar/m4sugar.m4 (m4_copyright_condense): New macro,
undocumented for now.
* lib/m4sugar/Makefile.am (version.m4): Add m4_PACKAGE_YEAR,
m4_PACKAGE_URL.
(RELEASE_YEAR): New macro, copied from bin/Makefile.am.
* lib/autoconf/general.m4 (_AC_COPYRIGHT_YEARS): New macro.
(AC_COPYRIGHT): Add undocumented third parameter.
(_AC_INIT_COPYRIGHT): Avoid need to bump copyright years.
* lib/autoconf/status.m4 (_AC_OUTPUT_CONFIG_STATUS): Likewise.
* lib/autotest/general.m4 (AT_INIT): Likewise.
* lib/autoconf/autotest.m4 (AC_CONFIG_TESTDIR): Likewise.
(AT_COPYRIGHT): Add undocumented third parameter.
* tests/local.at (AT_COPYRIGHT): Don't add an extra copyright
parameter; the generic copyright given by autotest is sufficient
since we are the package that owns autotest.

Signed-off-by: Eric Blake <ebb9@byu.net>
2009-01-28 06:12:52 -07:00
Eric Blake
758f763ddf Use URLs in --help output, part 3: testsuite.
* doc/autoconf.texi (Writing Testsuites): Mention autotest
namespace.
(Writing Testsuites) <AT_INIT>: Mention mandatory macros.
(Making testsuite Scripts): Document AT_PACKAGE_URL.
* tests/Makefile.am (package.m4): Follow our own advice.
* lib/autotest/general.m4 (AT_INIT): Give the user a hint about
package.m4.  Enhance --help output.
(_AT_COPYRIGHT_YEARS): New macro, to make copyright bump easier.

Signed-off-by: Eric Blake <ebb9@byu.net>
2009-01-27 16:58:21 -07:00
Eric Blake
d7cc80491d Use URLs in --help output, part 2: configure.
* lib/autoconf/general.m4 (_AC_INIT_COPYRIGHT): Bump copyright
date.
(_AC_INIT_PACKAGE): Support optional URL parameter, mapped to
AC_PACKAGE_URL.
(_AC_INIT_DEFAULTS, _AC_INIT_PREPARE): Substitute it.
(_AC_INIT_HELP): Use it in './configure --help' output.
* lib/autoconf/status.m4 (_AC_OUTPUT_CONFIG_STATUS): Likewise, for
'./config.status --help'.  Bump copyright date.
* doc/autoconf.texi (Initializing configure) <AC_INIT>: Document
new parameter.
* NEWS: Likewise.
* tests/tools.at (autoheader): Adjust test.
* tests/torture.at (@%:@define header templates)
(Torturing config.status): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
2009-01-27 16:57:52 -07:00
Eric Blake
9f32bcf860 Improve AC_DEFUN_ONCE semantics.
* lib/m4sugar/m4sugar.m4 (m4_defun_once): Rewrite to be no-op,
rather than warning, on second use, and make sure first use never
occurs out of order.
* tests/m4sugar.at (m4@&t@_require: one-shot initialization):
Enhance test.
* tests/base.at (AC_REQUIRE & AC_DEFUN_ONCE: [Require, expand],
(AC_REQUIRE & AC_DEFUN_ONCE: [Expand, require]): Adjust tests.
* NEWS: Document this.
* doc/autoconf.texi (Macro Definitions) <AC_DEFUN>: Mention
AC_DEFUN_ONCE.
(Prerequisite Macros) <AC_REQUIRE>: Likewise.
(Expanded Before Required): Likewise.
(One-Shot Macros) <AC_DEFUN_ONCE>: Document new semantics.
Reported by Bruno Haible, with suggestion by Paolo Bonzini.

Signed-off-by: Eric Blake <ebb9@byu.net>
2009-01-26 09:55:57 -07:00
Eric Blake
2cc17c497c Fix typos in recent patches.
* lib/m4sugar/m4sugar.m4: Improve m4_defun comments.
* doc/autoconf.texi (Expanded Before Required): Fix typos.
Reported by Ralf Wildenhues.

Signed-off-by: Eric Blake <ebb9@byu.net>
2009-01-24 06:33:41 -07:00
Eric Blake
3c75e4549b Revert change to AC_DIR_HEADER.
* lib/autoconf/headers.m4 (AC_DIR_HEADER): Explicitly expanding
AC_HEADER_DIRENT no longer triggers a warning, and helps the user
who decides they don't need the obsolete AC_FUNC_CLOSEDIR_VOID.
Reported by Paolo Bonzini.

Signed-off-by: Eric Blake <ebb9@byu.net>
2009-01-24 06:16:48 -07:00
Eric Blake
76b444921d Silence a false positive expand-before-require case.
* lib/m4sugar/m4sugar.m4 (m4_provide): Track the diversion in
which a macro was provided.
(m4_require): Compare diversion numbers, rather than m4_require
nesting, when determining direct requires.
* tests/m4sugar.at (m4@&t@_require: nested): Test it.
Reported by Ralf Wildenhues, affecting Libtool.

Signed-off-by: Eric Blake <ebb9@byu.net>
2009-01-22 08:08:06 -07:00
Eric Blake
46009205a9 Fix out-of-order expansion with expand-before-require.
* lib/m4sugar/m4sugar.m4 (m4_require): Redundantly expand a
required macro when issuing expand-before-require warning.
* doc/autoconf.texi (Prerequisite Macros): Adjust documentation.
(Expanded Before Required): New node.
* tests/m4sugar.at (m4@&t@_require: nested): Adjust test.
* NEWS: Mention this fix.
Suggested by Bruno Haible.

Signed-off-by: Eric Blake <ebb9@byu.net>
2009-01-21 08:57:42 -07:00
Eric Blake
cf7d7f2e82 Warn if macro is provided before indirectly required.
* lib/m4sugar/m4sugar.m4 (m4_provide): Track the set of all macros
provided since last outermost defun.
(_m4_defun_pro_outer): Empty the set.
(_m4_require_call): Distinguish between direct and indirect
requires, and remove required macros from the set.
(m4_require): Check the set, in order to warn.
* tests/m4sugar.at (m4@&t@_require: nested): Remove xfail, and add
test case for direct requires.

Signed-off-by: Eric Blake <ebb9@byu.net>
2009-01-21 08:39:47 -07:00
Eric Blake
b1ba5448b6 Clean up some bugs caught by preliminary dependency validation.
* lib/autoconf/headers.m4 (AC_DIR_HEADER): Don't invoke
AC_HEADER_DIRENT, since AC_FUNC_CLOSEDIR_VOID requires it.
* lib/m4sugar/m4sh.m4 (_AS_DETECT_BETTER_SHELL)
(_AS_SHELL_SANITIZE): Fix quoting bugs.

Signed-off-by: Eric Blake <ebb9@byu.net>
2009-01-20 10:08:11 -07:00
Eric Blake
91d1870bb4 Speed up m4_require.
* lib/m4sugar/m4sugar.m4 (_m4_divert_dump): Change semantics to
always be defined, as either empty or a number.
(_m4_defun_pro_outer, _m4_defun_epi_outer): Treat _m4_divert_dump
as a stack, rather than a one-shot macro.
(_m4_require_call): Expect third argument to be pre-expanded.
(m4_divert_require, m4_require): Adjust clients accordingly.
* lib/m4sugar/m4sh.m4 (AS_REQUIRE): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
2009-01-19 07:06:06 -07:00
Eric Blake
064ceeafb9 Make it easier to track diversion bugs.
* lib/m4sugar/m4sugar.m4 (_m4_divert_raw, _m4_undivert): New
internal macros, which are easier to trace than m4_builtin.
(m4_cleardivert, m4_divert, m4_divert_push, m4_divert_pop)
(m4_undivert): Use them.
(_m4_require_call): Likewise.  Use fewer macros.
* lib/autotest/general.m4 (_AT_DECIDE_TRACEABLE): Fix typo.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-12-30 08:32:08 -07:00
Bruno Haible
c7c8c45b6f Improve multiarch detection.
* lib/autoconf/c.m4 (AC_C_BIGENDIAN): Make detection of options
indicating a universal build more reliable.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-12-29 16:19:31 -07:00
Eric Blake
5f85192b80 Make m4_dumpdef more useful with M4 1.6.
* lib/m4sugar/m4sugar.m4 (_m4_dumpdef): New macro.
(m4_init): Install it for new enough m4.
* tests/m4sugar.at (m4@&t@_dumpdef): Enhance test.
* doc/autoconf.texi (Redefined M4 Macros) <m4_dumpdef>: Mention
lack of sorting.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-12-23 21:17:29 -07:00
Eric Blake
7f4d002958 Document some recently added macros.
* lib/m4sugar/m4sugar.m4 (m4_map_args_w): Add optional sep
parameter.
* doc/autoconf.texi (Looping constructs) <m4_map_args_sep>
<m4_map_args_w, m4_stack_foreach, m4_stack_foreach_sep>: Document
new macros.
(Set manipulation Macros) <m4_set_map_sep>: Likewise.
* tests/m4sugar.at (m4@&t@_stack, M4 loops): Enhance tests.
* NEWS: Document new macros.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-12-19 14:06:46 -07:00
Eric Blake
44579b8316 Fix separator in m4_stack_foreach_sep.
* lib/m4sugar/m4sugar.m4 (_m4_stack_reverse): Separate separator
from prefix.
* tests/m4sugar.at (m4@&t@_stack): Enhance test.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-12-18 17:20:41 -07:00
Jim Meyering
9077bf12d8 AC_HEADER_ASSERT: don't say assertions are disabled when they're not
* lib/autoconf/headers.m4 (AC_HEADER_ASSERT): Do not make configure
report "checking whether to enable assertions... no", when they are
in fact enabled.  This is solely a bug in the output of configure.
In spite of saying "no", NDEBUG was not defined in that case.
Also, as noted by Eric Blake, leave assertions enabled upon
--enable-assert=INVALID.
2008-12-10 16:55:07 +01:00
Eric Blake
0aae415c0c Fix m4_location inside m4_wrap with m4 1.4.5.
* lib/m4sugar/m4sugar.m4 (m4_undefine): Redefine m4_location
inside wrapped text if older m4 is detected.
Reported by William Pursell.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-12-09 10:47:19 -07:00
William Pursell
276044d355 Fix AC_HEADER_ASSERT w.r.t. --enable-assert.
* 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>
2008-12-08 16:30:50 -07:00
Paolo Bonzini
c32b3caff4 Fix AC_HEADER_ASSERT not to treat --enable-assert and --disable-assert the same.
* lib/autoconf/headers.m4 (AC_HEADER_ASSERT): Check value of $enableval.
2008-12-08 22:13:25 +01:00
Ralf Wildenhues
5857d07c98 Hide `set -m' error message, for zsh.
* lib/autotest/general.m4 (AT_JOB_FIFO_FD): Hide zsh 4.3.4
error messages about `set -m'.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2008-11-29 10:57:00 +01:00
Eric Blake
580ada8c2e Add m4_cleardivert.
* 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>
2008-11-25 09:28:43 -07:00
Eric Blake
fb70cde184 Add safety check for m4_expand vs. diversions.
* lib/m4sugar/m4sugar.m4 (m4_expand): Make more robust against
diverted text.
* doc/autoconf.texi (Evaluation Macros) <m4_expand>: Document new
safety check.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-11-25 09:10:25 -07:00
Eric Blake
b74085770f Fix typo in AS_MESSAGE_LOG_FD patch.
* lib/m4sugar/m4sh.m4 (AS_ERROR): Check correct condition.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-11-24 06:28:56 -07:00
Ralf Wildenhues
12ec1304fc More reliable signal handling in Autotest.
* lib/autotest/general.m4 (Driver loop): Rewrite signal handler.
Start parallel jobs in their own process group, enabling job
control in the shell if possible, for better signal handling.
Deal with INT, TERM, and HUP in the testsuite driver.  In the
parallel driver, propagate TSTP to jobs either as TSTP or as
STOP (to avoid fork bombs with ksh).
Inside the job processes, add PIPE handler to write back the
job token, so the master process does not hang.
Disable the parallel driver if job control is not provided or if
trap does not understand signal names.
* tests/autotest.at (parallel autotest and signals): New test,
exercises INT, TERM, and PIPE, serial and parallel, with and
without `make' in the loop.
Kudos to Richard Stevens for writing APUE.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2008-11-23 20:00:39 +01:00
Eric Blake
2cc7d57a17 Clean up AS_MESSAGE_LOG_FD usage.
* lib/m4sugar/m4sh.m4 (AS_MESSAGE_FD, AS_MESSAGE_LOG_FD)
(AS_ORIGINAL_STDIN_FD): Provide default M4sh values.
(_AS_ECHO_LOG, AS_MESSAGE, _AS_ERROR_PREPARE, AS_ERROR): Simplify
usage.
(AS_INIT_GENERATED): Don't shuffle an unchanged AS_MESSAGE_FD.
* tests/m4sh.at (AS@&t@_INIT_GENERATED): Update test.
(AS@&t@_MESSAGE_FD): New test.
* doc/autoconf.texi (Initialization Macros) <AS_INIT_GENERATED>:
Give more details about fd manipulation.
(File Descriptor Macros): Describe M4sh defaults for the fds.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-11-21 17:00:13 -07:00
Eric Blake
48d8391ff3 Use shell function for AS_ERROR.
* lib/m4sugar/m4sh.m4 (_AS_ERROR_PREPARE): New macro, defining a
new shell function.
(AS_ERROR): Use it.
(_AS_LINENO_PREPARE): Break circular dependency.
(AS_PREPARE, _AS_PREPARE): Initialize for child scripts.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-11-21 13:52:21 -07:00
Eric Blake
a8a9b2148d Fix typos in recent testsuite improvements.
* 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>
2008-11-21 13:36:27 -07:00
Eric Blake
bbc3dc81cc Change the semantics of AS_EXIT without argument.
* lib/m4sugar/m4sh.m4 (_AS_EXIT_PREPARE): When defaulting, use $?
even if it is 0.
(AS_ERROR): Guarantee non-zero status.
* bin/autoconf.as (exit_missing_arg, getopt): Revert prior change;
we want non-zero status.
* tests/m4sh.at (AS@&t@_EXIT): Update test accordingly.
* doc/autoconf.texi (Common Shell Constructs) <AS_EXIT>: Update
the documentation.
<AS_SET_STATUS>: Don't overly restrict implementation.
(Printing Messages) <AC_MSG_ERROR>: Describe better default.
Suggestions by Paolo Bonzini and Ralf Wildenhues.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-11-21 08:13:04 -07:00
Eric Blake
abe172f4ba Factor more common code out of AT_CHECK into shell function.
* lib/autotest/general.m4 (_AT_CHECK): Avoid echo bug if AT_LINE
starts with -.  Move preparations...
(AT_INIT) <at_fn_check_prepare_trace>
<at_fn_check_prepare_notrace, at_fn_check_prepare_dynamic>:
...into these new shell functions.
<at_fn_check_newline>: Inline into only caller.
(_AT_DECIDE_TRACEABLE): Use them to condense testsuite size.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-11-20 21:59:23 -07:00
Eric Blake
7811a6d5a9 Handle version numbers as decimal, even if they start with 0.
* lib/m4sugar/m4sugar.m4 (_m4_version_unletter): Avoid
interpreting leading zeros as octal.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-11-20 21:02:22 -07:00
Eric Blake
03118f36d9 Speed up AT_CHECK.
* lib/autotest/general.m4 (AT_CHECK, AT_CHECK_UNQUOTED): Expand
third and fourth arguments once.
(_AT_CHECK): Don't re-expand expected output.  Rearrange code for
fewer scans of arguments.
(AT_CHECK): Update caller.
(AT_INIT) <at_fn_filter_trace>: Drop parameter.
* tests/m4sugar.at (m4@&t@_split): Protect test with
quadrigraphs.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-11-20 18:55:10 -07:00
Eric Blake
79042ea346 Fix XFAIL related to AT_CHECK.
* lib/autotest/general.m4 (AT_CHECK, AT_CHECK_UNQUOTED): Expand
first argument once.
(_AT_CHECK): Don't re-expand commands.
* tests/autotest.at (Multiline command from M4 expansion): Remove
XFAIL.
* tests/tools.at (autoupdating AU_ALIAS): Quote unbalanced paren.
* NEWS: Document the fallout.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-11-20 18:27:35 -07:00
Eric Blake
2d63737afb Reduce forks in AC_DEFINE.
* lib/autoconf/general.m4 (_AC_DEFINE_Q_PRINT): New macro.
(_AC_DEFINE_Q): Use it to avoid forks for all AC_DEFINE and most
AC_DEFINE_UNQUOTED.
* lib/autoconf/fortran.m4 (_AC_FC_WRAPPERS): Properly quote #.
* tests/torture.at (Substitute and define special characters):
(Define to a 2000-byte string): Enhance tests to cover
AC_DEFINE_UNQUOTED.
(@%:@define header templates): Enhance test to cover #.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-11-20 16:18:28 -07:00
Eric Blake
7791129655 Improve m4_expand robustness, part 2.
* lib/m4sugar/m4sugar.m4 (m4_expand): Support unterminated
comments, by wrapping old implementation...
(_m4_expand): ...as this, and renaming old core...
(_m4_expand_): ...to this.
(m4_text_box): Use lighter-weight _m4_expand.
* lib/m4sugar/m4sh.m4 (_AS_DETECT_EXPAND)
(_AS_DETECT_BETTER_SHELL, AS_FUNCTION_DESCRIBE): Likewise.
* lib/autotest/general.m4 (AT_KEYWORDS): Likewise.
* tests/m4sugar.at (m4@&t@_expand): Enhance test.
* tests/autotest.at (AT_CHECK_AT_TITLE_CHAR): Likewise.
* doc/autoconf.texi (Evaluation Macros) <m4_expand>: Mention new
functionality.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-11-20 16:05:04 -07:00
Eric Blake
bcef427e18 Improve m4_expand robustness, part 1.
* lib/m4sugar/m4sugar.m4 (_m4_expand): Tolerate unquoted
unbalanced `)'.
* tests/m4sugar.at (m4@&t@_expand): New test.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-11-20 15:53:22 -07:00
Eric Blake
fa506f9116 Add m4_chomp, m4_esyscmd_s.
* lib/m4sugar/m4sugar.m4 (m4_esyscmd_e, m4_chomp, m4_chomp_all):
New macros.
* doc/autoconf.texi (Redefined M4 Macros) <m4_esyscmd_s>: Document
them.
(Text processing Macros) <m4_chomp>: Likewise.
* NEWS: Likewise.
* tests/m4sugar.at (m4@&t@_esyscmd_s): New test.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-11-20 15:42:39 -07:00
Eric Blake
aa6c52d78a Remove _m4_index.
* lib/m4sugar/m4sugar.m4 (_m4_index): Delete; it is more efficient
to make callers guarantee a match.
(m4_init): Adjust caller.
* lib/autoconf/status.m4 (_AC_CONFIG_COMPUTE_DEST): Likewise.
* lib/autoconf/general.m4 (_AC_DEFINE_Q): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-11-20 15:38:57 -07:00
Eric Blake
0a144bc25e Speed up _AS_QUOTE.
* lib/m4sugar/m4sh.m4 (_AS_QUOTE_IFELSE): Inline into...
(_AS_QUOTE): ...here, delete unused second paramenter, and factor
choice into...
(_AS_QUOTE_MODERN, _AS_QUOTE_OLD): ...new helpers.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-11-20 12:37:11 -07:00
Alfred G. de Wijn
f8185b3938 For consistency, make temporary variable match language name.
* lib/autoconf/fortran.m4 (_AC_PROG_FC_G, _AC_PROG_FC_V_OUTPUT):
Match the save/test variables' names to the FFLAGS/FCFLAGS being
saved.
* THANKS: Update.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-11-20 05:57:14 -07:00
Eric Blake
667dcc0c30 Use fn for shell functions, func for autoconf CHECK_FUNCS.
* lib/autoconf/functions.m4 (AC_CHECK_FUNC): Abbreviate shell
function names.
* lib/autoconf/general.m4 (_AC_PREPROC_IFELSE)
(_AC_COMPILE_IFELSE, _AC_LINK_IFELSE, _AC_RUN_IFELSE)
(AC_CHECK_DECL, AC_COMPUTE_INT): Likewise.
* lib/autoconf/headers.m4 (_AC_CHECK_HEADER_MONGREL)
(_AC_CHECK_HEADER_COMPILE, _AC_CHECK_HEADER_PREPROC): Likewise.
* lib/autoconf/types.m4 (_AC_CHECK_TYPE_NEW, _AC_TYPE_INT)
(_AC_TYPE_UNSIGNED_INT, AC_CHECK_MEMBER): Likewise.
* lib/autotest/general.m4 (AT_INIT): Likewise.
* lib/m4sugar/m4sh.m4 (_AS_SHELL_FN_WORK, _AS_EXIT_PREPARE)
(AS_EXIT, AS_SET_STATUS, _AS_UNSET_PREPARE, _AS_MKDIR_P)
(_AS_MKDIR_P_PREPARE, _AS_VAR_APPEND_PREPARE, AS_VAR_APPEND)
(_AS_VAR_ARITH_PREPARE, AS_VAR_ARITH): Likewise.
* doc/autoconf.texi (Shell Functions): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-11-18 21:33:46 -07:00
Eric Blake
e84b404ff0 Alter default value of AS_EXIT.
* 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>
2008-11-18 21:00:34 -07:00
Eric Blake
740062eb42 Add AS_SET_STATUS, make AS_EXIT more efficient.
* lib/m4sugar/m4sh.m4 (_AS_EXIT_PREPARE, AS_SET_STATUS): New
macros.
(AS_EXIT): Rewrite to avoid forks.
(_AS_SHELL_SANITIZE): Avoid AS_EXIT prior to shell functions.
(AS_PREPARE, _AS_PREPARE): Add new preparation.
* doc/autoconf.texi (Common Shell Constructs) <AS_SET_STATUS>:
Document.
* NEWS: Mention new macro.
* tests/m4sh.at (AS@&t@_EXIT): New test.
(BASENAME_TEST): Sort.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-11-18 09:57:19 -07:00
Eric Blake
7ad7019cf7 Detect empty list in AS_FOR.
* lib/m4sugar/m4sh.m4 (AS_FOR): Handle iteration over $@
properly.
* tests/m4sh.at (AS@&t@_FOR): Enhance test to catch it.
Reported by Paolo Bonzini.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-11-17 06:20:27 -07:00
Ralf Wildenhues
fde7ee974a Simplify, avoid unbalanced parentheses from last change.
* lib/m4sugar/m4sh.m4 (_AS_VAR_ARITH_PREPARE): Simplify, avoid
unbalanced parentheses from last change.
Spotted by Eric Blake, fix suggested by Paolo Bonzini.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2008-11-16 23:00:22 +01:00
Ralf Wildenhues
291d709efd Fix exit status of expr version of as_func_arith.
* lib/m4sugar/m4sh.m4 (_AS_VAR_ARITH_PREPARE): Count an exit
status of 1 of expr also as success, to avoid failure if the
computation result is zero.  Fixes test failures with IRIX sh,
where the expr variant of as_func_arith is used.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2008-11-16 22:18:07 +01:00
Eric Blake
cc854cd040 Use the new AS_FOR function.
* lib/autoconf/functions.m4 (AC_CHECK_FUNCS): Use new
abstraction for cleaner code.
* lib/autoconf/headers.m4 (AC_CHECK_HEADERS): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-11-15 10:41:23 -07:00
Eric Blake
fdcbe002e9 Add AS_FOR, undocumented for now.
* lib/m4sugar/m4sh.m4 (AS_FOR): New macro.
* tests/m4sh.at (AS@&t@_FOR): New test.
Suggested by Paolo Bonzini.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-11-15 10:41:19 -07:00
Eric Blake
2db8890532 Optimize single-argument loop.
* lib/autoconf/functions.m4 (AC_CHECK_FUNCS): Avoid forks when
loop only has one argument.
* lib/autoconf/headers.m4 (AC_CHECK_HEADERS): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-11-13 14:13:25 -07:00
Eric Blake
1a0a363042 Fix AS_ESCAPE usage bugs.
* lib/m4sugar/m4sh.m4 (_AS_VAR_APPEND_PREPARE)
(_AS_VAR_ARITH_PREPARE): Expand macros prior to adding shell
escapes.
(AS_TR_SH, AS_VAR_GET): Use _AS_ESCAPE for speed.
* doc/autoconf.texi (Polymorphic Variables) <AS_VAR_SET>: Document
caveat due to conditional AS_ESCAPE.
* tests/m4sh.at (AS@&t@_VAR basics): Enhance test.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-11-13 12:21:40 -07:00
Eric Blake
d623082df6 Whitespace reduction in configure.
* lib/autoconf/autoheader.m4 (AH_VERBATIM): Avoid empty lines.
* lib/autoconf/general.m4 (_AC_INIT_PREPARE, AC_CHECK_FILES):
Likewise.
(_AC_DEFINE_Q): Restore empty line, since some clients in the wild
depend on it.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-11-12 20:33:01 -07:00
Eric Blake
973149e014 Make M4sh, not autoconf, guarantee sane $SHELL.
* lib/autoconf/general.m4 (_AC_INIT_DEFAULTS): Move setting of
SHELL...
* lib/m4sugar/m4sh.m4 (_AS_DETECT_BETTER_SHELL): ...to here.
* doc/autoconf.texi (Initialization Macros): Document the effect
on SHELL.
* tests/m4sh.at (AS@&t@_INIT_GENERATED): New test.
Reported by Ralf Wildenhues.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-11-12 20:32:51 -07:00
Ralf Wildenhues
1b1851ea3a Wrap keywords in `testsuite --list' output.
* lib/autotest/general.m4 (AT_INIT): Rewrite --list awk script,
avoid lint warnings from gawk, wrap keyword lists to stay below
80 characters per line if possible.
* tests/autotest.at (Keyword wrapping): New test.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2008-11-12 23:54:01 +01:00
Eric Blake
74bb1a450d Work around <=m4-1.4.9 bug in m4_format.
* lib/m4sugar/m4sugar.m4 (_m4_index): New internal macro.
(m4_init): Only use it in older m4.
* lib/autoconf/general.m4 (_AC_DEFINE_Q): Use it to avoid
m4_format bug in older m4.
* lib/autoconf/status.m4 (_AC_CONFIG_COMPUTE_DEST): Likewise.
Reported by Bob Proulx.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-11-10 21:04:46 -07:00
Eric Blake
40f1a994e2 Avoid some regex uses.
* lib/autoconf/general.m4 (_AC_DEFINE_Q): Use m4_format rather
than m4_bpatsubst to grab string prefix.
* lib/autoconf/status.m4 (_AC_CONFIG_REGISTER)
(_AC_CONFIG_REGISTER_DEST, AC_CONFIG_SUBDIRS): Likewise.
(_AC_FILE_DEPENDENCY_TRACE_COLON): Use m4_translit instead of
m4_bpatsubst to change bytes.
(_AC_CONFIG_DEPENDENCY_DEFAULT): Use m4_index rather than
m4_bmatch to find byte.
(_AC_CONFIG_COMPUTE_DEST): New helper macro.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-11-10 11:38:41 -07:00
Eric Blake
3763dba27e Use more efficient macros in AC_CONFIG_SUBDIRS.
* lib/autoconf/status.m4 (_AC_CONFIG_FOOS, AC_CONFIG_SUBDIRS): Use
m4_map_args_w.
(_AC_OUTPUT_FILE): Use m4_map_args_sep and m4_map_args.
(_AC_OUTPUT_FILE_ADJUST_DIR): New helper macro.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-11-10 11:38:14 -07:00
Eric Blake
61055bdb3e Use more efficient macros in AC_CHECK_FILES and AC_CHECK_DECLS.
* lib/autoconf/general.m4 (AC_CHECK_FILES): Use m4_map_args_w,
and avoid typo.
(AC_CHECK_DECLS, AC_CHECK_DECLS_ONCE): Use m4_map_args_sep.
(_AC_CHECK_FILES, _AC_CHECK_DECLS, _AC_CHECK_DECL_ONCE): New
helper macros.
(AC_LIBSOURCES): Use m4_map_args.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-11-10 11:35:42 -07:00
Eric Blake
9187638237 Use more efficient macros in AC_CHECK_TYPES.
* lib/autoconf/types.m4 (AC_CHECK_TYPES, AC_CHECK_MEMBERS): Use
m4_map_args_sep.
(_AC_CHECK_TYPES, _AC_CHECK_MEMBERS): New helper macros.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-11-10 11:35:16 -07:00
Eric Blake
40dc2b77a4 Use more efficient macros in AC_CHECK_HEADERS.
* lib/autoconf/headers.m4 (AH_CHECK_HEADERS)
(AH_CHECK_HEADERS_DIRENT): Rename...
(_AH_CHECK_HEADER, _AH_CHECK_HEADER_DIRENT): ...and take only one
argument, rather than a list.
(AC_CHECK_HEADERS, AC_CHECK_HEADERS_ONCE):
Adjust callers to use m4_map_args_w.
(AC_HEADER_DIRENT): Adjust caller to use m4_map_args.
(_AC_CHECK_HEADER_ONCE): New helper macro.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-11-10 11:34:47 -07:00
Eric Blake
1334bb1195 Use more efficient macros in AC_CHECK_FUNCS.
* lib/autoconf/functions.m4 (_AH_CHECK_FUNCS): Rename...
(_AH_CHECK_FUNC): ...and take only one argument, rather than a
list.
(AC_CHECK_FUNCS, AC_CHECK_FUNCS_ONCE): Adjust callers to use
m4_map_args_w.
(_AC_CHECK_FUNC_ONCE): New helper macro.
(AC_REPLACE_FUNCS): Use m4_map_args_w.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-11-10 11:34:17 -07:00
Eric Blake
786427de58 Use more efficient macro in AT_INIT.
* lib/autotest/general.m4 (AT_INIT): Use m4_map_args.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-11-10 11:33:19 -07:00
Eric Blake
3b78b1ae08 Try 'print -r --' as a non-forking variant of 'printf %s\\n'.
* lib/m4sugar/m4sh.m4 (_AS_ECHO_PREPARE): Cater to Solaris ksh.
* doc/autoconf.texi (Limitations of Builtins) <printf>: Document
the print workaround.
Idea by Paolo Bonzini.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-11-10 09:06:39 -07:00
Paolo Bonzini
5544cc87ec Balance parentheses in _AC_CACHE_DUMP.
* lib/autoconf/general.m4 (_AC_CACHE_DUMP): Balance parentheses
without introducing \).
2008-11-09 14:46:12 +01:00
Eric Blake
7a4705cb7a Skip preprocessor check in AC_CHECK_HEADERS_ONCE.
* lib/autoconf/headers.m4 (_AC_HEADERS_EXPANSION): Provide fourth
argument to speed up check.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-11-06 16:43:24 -07:00
Eric Blake
3d6b5007ca Speed up AC_CHECK_TYPE.
* lib/autoconf/types.m4 (AC_CHECK_TYPE): Factor out $@, and avoid
regex when enough arguments are present.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-11-06 16:29:53 -07:00
Paolo Bonzini
359be416a7 Remove three forks per _AC_RUN_LOG_STDERR in the common case.
* lib/autoconf/general.m4 (_AC_RUN_LOG_STDERR): Avoid grep/rm/cat
sequence when the program's stderr was empty, while providing a
conftest.err file even in that case.
(_AC_CACHE_DUMP): Fix mismatched parenthesis.
2008-11-06 15:23:59 +01:00
Paolo Bonzini
c22cc67be7 Change `present but cannot be compiled' behavior to use compiler result.
* 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.
2008-11-06 10:55:31 +01:00
Eric Blake
b07a2b3d74 Add m4_map_args_w.
* lib/m4sugar/m4sugar.m4 (m4_map_args_w): New macro, undocumented
for now.
(_m4_split): Allow user control over separator.
(m4_split): Adjust caller.
(m4_foreach_w, m4_append_uniq_w, _m4_text_wrap): Rewrite to use
m4_map_args_w.
* tests/m4sugar.at (m4@&t@_append): Augment test keywords.
(M4 loops): Test new interface.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-11-05 20:04:49 -07:00
Eric Blake
4e009d5228 Use m4_set_map_sep in more places.
* lib/m4sugar/m4sugar.m4 (m4_set_difference, m4_set_intersection)
(m4_set_union): Use m4_set_map_sep rather than m4_set_foreach.
* doc/autoconf.texi (Set manipulation Macros) <m4_set_map>:
Enhance documentation.
<m4_set_foreach>: Mention faster alternative.
(Looping constructs) <m4_foreach>: Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-11-05 13:31:46 -07:00
Eric Blake
a8c4be749a Unify m4_set_foreach and m4_set_map.
* lib/m4sugar/m4sugar.m4 (m4_set_map_sep): New macro, undocumented
for now.
(m4_set_contents, m4_set_foreach, m4_set_list, m4_set_listc)
(m4_set_map): Adjust callers.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-11-05 13:27:39 -07:00
Eric Blake
641487fb34 Use _m4_foreach in more places.
* lib/m4sugar/foreach.m4 (m4_dquote_elt, m4_join, m4_joinall)
(_m4_minmax, m4_set_add_all): Use _m4_foreach instead of
m4_foreach.
* lib/m4sugar/m4sugar.m4 (_m4_joinall): Use m4_map_args_sep
instead of m4_foreach or m4_map_args.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-11-05 13:27:30 -07:00
Eric Blake
aae086a2f7 Unify _m4_foreach and _m4_map.
* lib/m4sugar/m4sugar.m4 (_m4_map): Delete, merged with...
(_m4_foreach): ...this.
(m4_foreach, m4_map, m4_mapall, m4_map_sep, _m4_mapall_sep)
(m4_map_args, m4_map_args_sep): Adjust callers.
* lib/m4sugar/foreach.m4 (_m4_map): Rename...
(_m4_foreach): ...to this, overwriting old definition.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-11-05 10:32:47 -07:00
Eric Blake
1329287eb7 Add m4_map_args_sep, undocumented for now.
* lib/m4sugar/m4sugar.m4 (m4_map_args_sep): New macro.
(_m4_map): Change API to cover more of m4_map*.
* lib/m4sugar/foreach.m4 (_m4_map): Adjust to new API.
(m4_map_args): Delete.
* tests/m4sugar.at (m4@&t@_map_args and m4@&t@_curry): Enhance
test.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-11-04 21:23:51 -07:00
Eric Blake
9a79ba954d Improve m4_for performance.
* lib/m4sugar/m4sugar.m4 (_m4_for): Alter API to make it easier to
avoid m4_define by some clients.
(m4_for): Adjust caller.
* lib/m4sugar/foreach.m4 (_m4_foreach, m4_case, m4_bmatch)
(_m4_cond, _m4_bpatsubsts, _m4_shiftn, m4_do, m4_reverse)
(_m4_map, m4_map_args, m4_map_args_pair, _m4_list_pad)
(_m4_list_cmp): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-11-04 21:23:47 -07:00
Eric Blake
bc6676ed11 Reject arguments with leading =.
* lib/autoconf/general.m4 (_AC_INIT_PARSE_ARGS): Detect case of
missing variable name, with fewer forks.  Quote invalid arguments
in message, in case they include spaces.
* lib/autoconf/status.m4 (_AC_OUTPUT_CONFIG_STATUS)
(_AC_OUTPUT_MAIN_LOOP): Quote invalid arguments.
* lib/autotest/general.m4 (AT_INIT): Likewise.
Reported by Jeff Squyres.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-11-04 08:20:00 -07:00
Paolo Bonzini
8e27cc7f52 Dispatch on AC_LANG_CONFTEST
* lib/autoconf/c.m4 (AC_LANG_CONFTEST(C)): Define instead of
AC_LANG_SOURCE(C).
* lib/autoconf/general.m4 (_AC_INIT_PREPARE): Add a comment at the
top of confdefs.h, which also works around cpp deficiencies.
* lib/autoconf/lang.m4 (AC_LANG_DEFINE): Define AC_LANG_CONFTEST(xyz)
(AC_LANG_CONFTEST): Dispatch based on _AC_LANG.
(AC_LANG_CONFTEST()): New.
2008-11-03 14:23:55 +01:00
Paolo Bonzini
cf5862afae Reorganize definition of languages
* lib/autoconf/c.m4 (AC_LANG(C), AC_LANG(C++), AC_LANG(Objective C),
_AC_LANG_ABBREV(C), _AC_LANG_ABBREV(C++), _AC_LANG_ABBREV(Objective C),
_AC_LANG_PREFIX(C), _AC_LANG_PREFIX(C++), _AC_LANG_PREFIX(Objective C)):
Replace definitions with usage of AC_LANG_DEFINE.
(Sections 2b, 2c): Delete.
(Sections 1b, 1c): Move after section 2a.
* lib/autoconf/erlang.m4 (AC_LANG(Erlang), _AC_LANG_ABBREV(Erlang),
_AC_LANG_PREFIX(Erlang), AC_LANG_SOURCE(Erlang)): Replace definitions
with usage of AC_LANG_DEFINE.
(AC_LANG_ERLANG): Define using AU_DEFUN.
* lib/autoconf/fortran.m4 (AC_LANG(Fortran), AC_LANG(Fortran 77),
_AC_LANG_ABBREV(Fortran), _AC_LANG_ABBREV(Fortran 77),
_AC_LANG_PREFIX(Fortran), _AC_LANG_PREFIX(Fortran 77),
_AC_LANG_SOURCE(Fortran), AC_LANG_SOURCE(Fortran 77)): Replace
definitions with usage of AC_LANG_DEFINE.
* lib/autoconf/lang.m4 (AC_LANG_DEFINE, AC_LANG_SOURCE()): New.
2008-11-03 14:23:55 +01:00
Paolo Bonzini
c0e8d2d8ba Rename _AC_CHECK_HEADER_OLD and _AC_CHECK_HEADER_NEW.
* lib/autoconf/headers.m4 (AC_CHECK_HEADER): Adjust naming.
(_AC_CHECK_HEADER_PREPROC_BODY): New name of _AC_CHECK_HEADER_OLD_BODY.
(_AC_CHECK_HEADER_COMPILE_BODY): New name of _AC_CHECK_HEADER_NEW_BODY.
(_AC_CHECK_HEADER_PREPROC): New name of _AC_CHECK_HEADER_OLD.
(_AC_CHECK_HEADER_COMPILE): New name of _AC_CHECK_HEADER_NEW.
* tests/semantics.at (AC_CHECK_HEADERS_OLD, AC_CHECK_HEADER_NEW):
Give better name.
2008-10-31 17:48:03 +01:00
Eric Blake
9279a87aba Support multiple undiverts and dumpdefs at once.
* lib/m4sugar/m4sugar.m4 (m4_dumpdefs, m4_undivert): Allow extra
arguments.
* doc/autoconf.texi (Redefined M4 Macros) <m4_dumpdef>,
<m4_undivert>: Document argument list change.
* tests/m4sugar.at (m4@&t@_divert_stack, m4@&t@_dumpdef): Test
them.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-10-31 10:30:31 -06:00
Eric Blake
9f4363abb6 Simplify diversion stack handling.
* 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>
2008-10-31 10:25:24 -06:00
Eric Blake
852082f119 Simplify expansion stack handling.
* lib/m4sugar/m4sugar.m4 (m4_expansion_stack): Use fewer macros;
always output 'top level'.
(_m4_expansion_stack_entry): New macro, to format the string only
when needed.
(m4_expansion_stack_push): Only push a macro name.
(m4_warn, _m4_defun_pro): Update callers.
(m4_expansion_stack_pop, m4_expansion_stack_dump): Delete.
(_m4_defun_epi, m4_fatal): Inline the calls.
* tests/m4sugar.at (m4@&t@_expansion_stack): New test.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-10-31 09:59:56 -06:00
Paolo Bonzini
718151138d Do not check for $LINENO in generated scripts.
* lib/m4sugar/m4sh.m4 (_AS_PREPARE): Do not call _AS_LINENO_PREPARE,
and explain why.
2008-10-30 16:57:45 +01:00
Eric Blake
4f4ffdc6a6 Don't check for non-POSIX extensions in suggested tests.
* lib/m4sugar/m4sh.m4 (_AS_VAR_APPEND_WORKS): Remove suggestion;
we still use += if available, but should not reject shells (like
dash) that don't provide it.
(_AS_DETECT_SUGGESTED): Document a policy for m4sh.
Reported by Paolo Bonzini.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-10-30 09:50:46 -06:00
Paolo Bonzini
26e664439c Pass CONFIG_SHELL down to generated scripts, and re-export SHELL.
* lib/m4sugar/m4sh.m4 (_AS_DETECT_BETTER_SHELL): If proceeding
with a given CONFIG_SHELL, move it to SHELL.
(AS_INIT_GENERATED): Re-export SHELL.
2008-10-30 15:27:42 +01:00
Eric Blake
a78b497413 Work around Solaris /bin/sh case bug.
* lib/m4sugar/m4sh.m4 (_AS_CASE, _AS_CASE_DEFAULT): Always provide
a non-empty command list.
(AS_CASE): Always guarantee that a case will match.
* doc/autoconf.texi (Limitations of Builtins) <case>: Document the
Solaris bug, and mention AS_CASE.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-10-30 07:40:59 -06:00
Paolo Bonzini
c55740c463 Require _AS_CR_PREPARE where appropriate and fix ChangeLog.
* lib/m4sugar/m4sh.m4 (_AS_PREPARE): Call _AS_CR_PREPARE.
(AS_PREPARE): Require _AS_CR_PREPARE.
2008-10-30 14:00:02 +01:00
Paolo Bonzini
4298bf09e4 trim down the length of the shell function test
* lib/m4sugar/m4sh.m4 (_AS_SHELL_FN_WORK): Condense.
2008-10-30 10:23:40 +01:00
Paolo Bonzini
c29ca1d13b Avoid walking the entire PATH when looking for a better shell.
* lib/m4sugar/m4sh.m4 (_AS_SHELL_SANITIZE): Test shell characteristics
as the PATH is walked.
2008-10-30 09:52:22 +01:00
Paolo Bonzini
3fb0b95667 Add third argument to _AS_PATH_WALK
* lib/m4sugar/m4sh.m4 (_AS_SHELL_SANITIZE): Do not call _AS_CR_PREPARE.
(_AS_PATH_WALK): Add third optional argument.
2008-10-30 09:51:32 +01:00
Eric Blake
d2dabc34ef Fix LINENO detection to work around bash and pdksh limitations.
* lib/m4sugar/m4sh.m4 (_AS_LINENO_WORKS): Enhance the test, so
that we can choose which of two tests to trust.
(_AS_RUN): Set flag when alternate shell is running.
(_AS_DETECT_EXPAND): New macro.
(_AS_DETECT_BETTER_SHELL): Use it to massage LINENO tests.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-10-29 16:06:56 -06:00
Eric Blake
e752d8d90f Mention proper fix for zsh users.
* lib/m4sugar/m4sh.m4 (_AS_DETECT_BETTER_SHELL): Recommend zsh
version known to work.
Suggested by Paolo Bonzini.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-10-29 15:47:18 -06:00
Eric Blake
c0af9c5e4e Document current beta-quality status.
* configure.ac: Reflect fact that change to git-version-gen
produces -, but not always a letter, on non-release builds.
* BUGS: Mention known issues.
* lib/m4sugar/m4sh.m4 (_AS_DETECT_BETTER_SHELL): Ask for help in
debugging platforms with deficient shells.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-10-29 09:30:23 -06:00
Eric Blake
7abb73425a Alter signature of AS_INIT_GENERATED.
* lib/m4sugar/m4sh.m4 (AS_INIT_GENERATED): Add parameters, and
manage here-doc and chmod in place.  This also allows future
changes for optimizing the child via diversion/m4_wrap magic.
* lib/autoconf/status.m4 (_AC_OUTPUT_CONFIG_STATUS): Update
caller.
* doc/autoconf.texi (Initialization Macros) <AS_INIT_GENERATED>:
Update the documentation.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-10-29 06:30:40 -06:00
Eric Blake
c602a5c6d0 Use _m4_stack_reverse in m4_set.
* lib/m4sugar/m4sugar.m4 (_m4_set_contents_1)
(_m4_set_contents_2): Rewrite to share _m4_stack_reverse
implementation.
(m4_set_contents, m4_set_foreach, m4_set_list, m4_set_listc)
(m4_set_map): Adjust callers to new API.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-10-29 06:29:38 -06:00
Eric Blake
52773c7b70 Add m4_stack_foreach_sep.
* lib/m4sugar/m4sugar.m4 (m4_stack_foreach_sep)
(m4_stack_foreach_sep_lifo): New macros.
(_m4_stack_reverse): Adjust prototype, to support it.
(m4_copy): Use fewer macros.
* tests/m4sugar.at (m4@&t@_stack_foreach): Rename...
(m4@&t@_stack): ...and add m4_stack_foreach_sep tests.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-10-29 06:28:37 -06:00
Paolo Bonzini
250422b094 Rewrite handling of diversion and expansion stack.
* 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.
2008-10-29 08:00:08 +01:00
Eric Blake
63ec266226 Reduce forks while searching for better shell.
* lib/m4sugar/m4sh.m4 (_AS_DETECT_REQUIRED)
(_AS_DETECT_SUGGESTED): No need to provide extra subshell; _AS_RUN
already does the job.
(_AS_DETECT_BETTER_SHELL): Simplify AS_EXIT when not run in a trap
0 context.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-10-28 21:33:46 -06:00
Eric Blake
11c8919bdb Undo needless efforts to protect $2 in $2_t.
* lib/autoconf/types.m4 (_AC_TYPE_INT_BODY)
(_AC_TYPE_UNSIGNED_INT_BODY): Reduce extra quoting.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-10-28 20:45:58 -06:00
Ralf Wildenhues
b83aa7ee0d Fix parallel test execution output lossage.
* lib/autotest/general.m4 (_AT_CHECK): Truncate files to hold
standard output and standard error before the test, use append
mode for writing.
* THANKS: Update.
Caught by Bob Proulx' build daemons, analysis and suggested fix
by Stéphane Chazelas.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2008-10-28 22:45:12 +01:00
Eric Blake
2376807bbd Use m4_map_args in more places.
* lib/m4sugar/m4sugar.m4 (m4_defn, m4_dumpdef, m4_popdef)
(m4_undefine, m4_combine): Use m4_map_args, rather than
m4_foreach.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-10-28 14:02:47 -06:00
Eric Blake
0b08f40fc7 Override m4 1.4.x dumpdef, as it breaks autom4te.
* 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>
2008-10-28 14:02:34 -06:00
Eric Blake
0a951c9da7 Allow m4sugar to be used without autom4te, such as in bison.
* lib/m4sugar/m4sugar.m4 (m4_text_wrap, m4_qlen): Document that
alternate escape sequences can be used.
(m4_text_box): Likewise.  Don't output quadrigraphs.
(m4_qdelta): Delete unused macro.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-10-28 13:45:45 -06:00
Paolo Bonzini
1415907c2d add m4_stack_foreach and m4_stack_foreach_lifo
* lib/m4sugar/m4sugar.m4 (_m4_stack_reverse): New from _m4_copy.
(m4_stack_foreach, m4_stack_foreach_lifo): New.
(m4_copy): Use m4_stack_foreach and m4_curry.
(_m4_dumpdefs_down, _m4_dumpdefs_up): Remove.
(m4_dumpdefs): Rewrite using m4_stack_foreach_lifo.
* tests/m4sugar.at (m4_stack_foreach): New test.
2008-10-28 18:29:25 +01:00
Paolo Bonzini
29e6e30d37 use a shell function for AC_TYPE_INTx_T
* lib/autoconf/types.m4 (_AC_TYPE_INT_BODY, _AC_TYPE_UNSIGNED_INT_BODY): New.
(_AC_TYPE_INT, _AC_TYPE_UNSIGNED_INT): Define and use a shell function.
2008-10-28 14:58:23 +01:00
Paolo Bonzini
09012d045b Fix AS_ESCAPE usage together with AC_INCLUDES_DEFAULT.
* lib/autoconf/general.m4 (AC_CHECK_DECL): Fix AS_ESCAPE usage.
* lib/autoconf/headers.m4 (_AC_CHECK_HEADER_MONGREL,
_AC_CHECK_HEADER_NEW): Likewise.
* lib/autoconf/types.m4 (_AC_CHECK_TYPE_NEW, AC_CHECK_MEMBER): Likewise.
2008-10-28 14:52:30 +01:00
Paolo Bonzini
37dd5e9c49 use a shell function for AC_CHECK_MEMBER
* lib/autoconf/types.m4 (_AC_CHECK_MEMBER_BODY): New.
(AC_CHECK_MEMBER): Define and use a shell function.
2008-10-28 13:22:54 +01:00
Eric Blake
d783e51764 Prefer m4_fatal over AC_FATAL.
* lib/autoconf/types.m4 (AC_CHECK_SIZEOF, AC_CHECK_ALIGNOF)
(AC_CHECK_MEMBER): Use non-obsolete macro name.
* lib/autoconf/fortran.m4 (_AC_LIST_MEMBER_IF): Likewise.
* lib/autoconf/general.m4 (AC_REQUIRE_AUX_FILE, AC_SUBST):
Likewise.
* lib/autoconf/lang.m4 (_AC_LANG_DISPATCH): Likewise.
* lib/autoconf/status.m4 (_AC_CONFIG_DEPENDENCY_DEFAULT)
(_AC_CONFIG_UNIQUE, _AC_CONFIG_REGISTER_DEST): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-10-27 17:22:40 -06:00
Eric Blake
cb34ecf15c Avoid raw carriage return in scripts.
* 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>
2008-10-27 16:34:58 -06:00
Eric Blake
cfa144a955 Use AS_VAR_ARITH.
* lib/autotest/general.m4 (at_func_arith): Delete; replace all
clients with AS_VAR_ARITH instead.
* lib/autoconf/general.m4 (_AC_COMPUTE_INT_COMPILE): Use new
macro.
* lib/autoconf/programs.m4 (_AC_FEATURE_CHECK_LENGTH): Likewise.
* tests/torture.at (Torturing config.status): Likewise.
* tests/tools.at (autom4te --force): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-10-27 16:11:59 -06:00
Eric Blake
bc9d68de41 Add AS_VAR_ARITH.
* 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>
2008-10-27 16:11:56 -06:00
Eric Blake
cf99ea9775 Use read, rather than cat, for safe one-line files.
* 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>
2008-10-27 16:04:12 -06:00
Paolo Bonzini
281988f2e2 use a shell function for AC_COMPUTE_INT
* lib/autoconf/general.m4 (_AC_COMPUTE_INT_COMPILE, _AC_COMPUTE_INT_RUN): Add
IF-SUCCESS argument.
(_AC_COMPUTE_INT_BODY): New.
(AC_COMPUTE_INT): Define and use a shell function.
2008-10-27 19:33:17 +01:00
Paolo Bonzini
c8cc5be07a use a shell function for AC_CHECK_TYPE
* 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.
2008-10-27 16:05:00 +01:00
Paolo Bonzini
e90bd84ac8 use a shell function for AC_CHECK_DECL
* lib/autoconf/general.m4 (_AC_CHECK_DECL_BODY): New.
(AC_CHECK_DECL): Use a shell function.
2008-10-27 16:04:56 +01:00
Paolo Bonzini
439f33b1c3 use a shell function for the rest of AC_CHECK_HEADER
* lib/autoconf/headers.m4 (_AC_CHECK_HEADER_OLD, _AC_CHECK_HEADER_NEW):
Use a shell function.
2008-10-27 16:02:37 +01:00
Paolo Bonzini
57079f4e33 Use a shell function for _AC_CHECK_HEADER_MONGREL.
* 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>
2008-10-25 07:45:31 -06:00
Eric Blake
ce2d0f043c Simplify _AS_PREPARE handling of functions.
* 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>
2008-10-25 06:45:57 -06:00
Eric Blake
8425d6363b Fix m4 underquoting in AC_PROG_INSTALL.
* lib/autoconf/programs.m4 (AC_PROG_INSTALL): Produce accurate
character ranges.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-10-24 17:14:40 -06:00
Eric Blake
89e95fc78b Speed up AC_CHECK_HEADER.
* lib/autoconf/headers.m4 (AC_CHECK_HEADER): Factor out $@.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-10-24 16:41:20 -06:00
Paolo Bonzini
2509abe0dc Use a shell function for AC_CHECK_FUNC.
* 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>
2008-10-24 15:26:25 -06:00
Eric Blake
6369d61222 Work around fact that gnulib-tool doesn't use m4_copy.
* 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>
2008-10-24 12:09:48 -06:00
Eric Blake
b4bb9caba2 Make m4_defun_init more robust.
* 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>
2008-10-24 11:24:32 -06:00
Eric Blake
d0c5f482d5 Optimize clients of AS_REQUIRE.
* 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>
2008-10-24 07:13:17 -06:00
Eric Blake
2922868b72 Improve m4_copy.
* 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>
2008-10-24 06:41:49 -06:00
Eric Blake
21bd2e490b AC_FUNC_GETGROUPS: Revert regression.
* 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>
2008-10-24 05:42:10 -06:00
Eric Blake
58a97ecfca Whitespace cleanup.
* lib/autoconf/fortran.m4: Consistently use tabs.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-10-23 19:58:40 -06:00
Chikama Masaki
3f38aadc7c For gfortran on sh, ignore -little.
* 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>
2008-10-23 19:52:05 -06:00
Paolo Bonzini
c0866235e2 Eliminate empty lines after AC_*_IFELSE.
* lib/autoconf/general.m4 (_AC_PREPROC_IFELSE, _AC_COMPILE_IFELSE,
_AC_LINK_IFELSE, _AC_RUN_IFELSE): Add a dnl at end.
2008-10-23 18:39:57 +02:00
Paolo Bonzini
db60987f02 Avoid a fork in _AC_RUN_LOG and _AC_RUN_LOG_STDERR
* lib/autoconf/general.m4 (_AC_RUN_LOG, _AC_RUN_LOG_STDERR):
Return a boolean status code based on $ac_status.
2008-10-23 18:37:08 +02:00
Paolo Bonzini
1cab7acd4a Ensure actions can look at conftest* files.
* lib/autoconf/general.m4 (_AC_PREPROC_IFELSE_BODY,
_AC_COMPILE_IFELSE_BODY, _AC_LINK_IFELSE_BODY, _AC_RUN_IFELSE_BODY):
Move rm commands, except IPA files and Apple debug symbols...
(_AC_PREPROC_IFELSE, __AC_COMPILE_IFELSE, _AC_LINK_IFELSE,
_AC_RUN_IFELSE): ...in here.
* tests/compile.at: Add regression test.
2008-10-23 18:02:14 +02:00
Eric Blake
f6ca9fec69 Remove excess dnl from m4sh.
* lib/m4sugar/m4sh.m4 (_AS_DETECT_BETTER_SHELL, _AS_PREPARE)
(_AS_SHELL_FN_WORK, _AS_SHELL_SANITIZE, AS_IF, _AS_ECHO_LOG)
(AS_MESSAGE, AS_ERROR, AS_BASENAME, _AS_BASENAME_PREPARE)
(_AS_DIRNAME_EXPR, AS_DIRNAME, _AS_DIRNAME_PREPARE, AS_ECHO)
(AS_ECHO_N, AS_TEST_X, AS_EXECUTABLE_P, _AS_ME_PREPARE)
(_AS_LINENO_PREPARE, AS_LN_S, AS_MKDIR_P, _AS_PATH_WALK)
(AS_SET_CATFILE, AS_HELP_STRING, AS_TMPDIR, AS_VERSION_COMPARE)
(_AS_TR_SH_PREPARE, AS_TR_SH, _AS_TR_CPP_PREPARE, AS_TR_CPP)
(_AS_TR_PREPARE, AS_VAR_APPEND, AS_VAR_PUSHDEF)
(AS_INIT_GENERATED): Use fewer dnl in m4sh macro bodies.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-10-23 09:37:47 -06:00
Paolo Bonzini
f2f5427543 Use a shell function for _AC_RUN_IFELSE.
* 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>
2008-10-23 06:35:59 -06:00
Eric Blake
d7921337d3 Formatting tweak: balance () with m4sh case statements.
* lib/m4sugar/m4sh.m4 (_AS_DETECT_BETTER_SHELL)
(_AS_SHELL_SANITIZE, _AS_ECHO_N_PREPARE, _AS_ECHO_PREPARE)
(AS_SET_CATFILE, _AS_TEST_PREPARE): Add strategic shell comments.
(_AS_CASE, _AS_CASE_DEFAULT, AS_CASE): Rearrange newlines, to
allow output of strategic shell comments.
(AS_VERSION_COMPARE): Use AS_CASE.
* tests/m4sh.at (AS@&t@_IF and AS@&t@_CASE): Enhance test.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-10-23 06:13:06 -06:00
Jim Meyering
b218c046a6 AC_FUNC_GETGROUPS: always define $ac_cv_func_getgroups_works
* 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>.
2008-10-23 10:06:15 +02:00
Paolo Bonzini
30249d93c1 Use a shell function for _AC_LINK_IFELSE.
* lib/autoconf/general.m4 (_AC_LINK_IFELSE_BODY): New macro.
(_AC_LINK_IFELSE): Use a shell function.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-10-22 11:29:18 -06:00
Eric Blake
5042ddd81f Fix autoconf logging commands.
* lib/autoconf/general.m4 (AC_MSG_RESULT_UNQUOTED, _AC_EVAL)
(_AC_EVAL_STDERR, AC_RUN_LOG): Respect as_lineno.
(_AC_DO_ECHO): Likewise, and use fewer dnl.
(_AC_RUN_LOG_STDERR): Avoid subshell for logging.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-10-22 11:29:11 -06:00
Eric Blake
ca7380b2a8 Allow AS_VAR_SET_IF in shell lists.
* lib/m4sugar/m4sh.m4 (AS_VAR_SET_IF): Allow continuation of
line.
* lib/autoconf/general.m4 (AC_CACHE_VAL): Supply newline no longer
provided by AS_VAR_SET_IF.
* lib/autoconf/headers.m4 (_AC_CHECK_HEADER_MONGREL): Adjust
clients.
* lib/autoconf/libs.m4 (AC_SEARCH_LIBS): Likewise.
* tests/m4sh.at (AS@&t@_VAR basics): Enhance test.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-10-21 21:04:20 -06:00
Eric Blake
0467924f24 Allow AS_VAR_IF in shell lists.
* lib/m4sugar/m4sh.m4 (AS_VAR_IF): Allow continuation of line.
* lib/autoconf/functions.m4 (AC_CHECK_FUNC): Adjust clients.
* lib/autoconf/general.m4 (AC_CHECK_FILE, AC_CHECK_DECL):
Likewise.
* lib/autoconf/headers.m4 (_AC_CHECK_HEADER_MONGREL)
(_AC_CHECK_HEADER_NEW, _AC_CHECK_HEADER_OLD)
(_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.
* tests/m4sh.at (AS@&t@_VAR basics): Enhance test.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-10-21 21:04:11 -06:00
Eric Blake
e84e41e106 Allow AS_CASE in shell lists.
* 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>
2008-10-21 21:04:02 -06:00
Eric Blake
b837cd019d Allow AS_IF in shell lists.
* 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>
2008-10-21 21:03:57 -06:00
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