summaryrefslogtreecommitdiff
path: root/tests/m4sh.at
Commit message (Collapse)AuthorAgeFilesLines
* Autotest: add official way to execute code before all/each test.Zack Weinberg2020-12-021-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, there isn’t any documented way for an Autotest testsuite to add custom code to be run either right before the main driver loop, or at the point of each AT_SETUP. For instance, there’s no good place to put environment variable sanitization that should apply to the entire testsuite (but isn’t universally relevant), or shell function definitions to be used by custom test macros. Autoconf’s test suite is poking shell functions directly into the PREPARE_TESTS diversion, and doing environment variable sanitization in each individual test. Both of these are obviously undesirable. This patch adds three new AT_* macros that can be used to do these things in an officially-supported way: AT_PREPARE_TESTS adds code to be run right before the main driver loop, AT_PREPARE_EACH_TEST adds code to be run at the beginning of each test, and AT_TEST_HELPER_FN defines a shell function that will be available to each test. In Autoconf’s test suite, I use AT_PREPARE_TESTS to factor out environment variable sanitization that *ought* to apply across the board, and AT_TEST_HELPER_FN for the helper function used by AT_CHECK_ENV. (This fixes the testsuite bug reported by Jannick at https://lists.gnu.org/archive/html/autoconf/2020-10/msg00052.html : CONFIG_SITE in the parent environment will no longer be visible to tests.) It would be nice to give an example of when AT_PREPARE_EACH_TEST is useful, in the documentation, but I didn’t find one in the autoconf test suite. * lib/autotest/general.m4 (AT_PREPARE_TESTS, AT_PREPARE_EACH_TEST) (AT_TEST_HELPER_FN): New macros. (AT_INIT, AT_TESTED): Emit the code to report tested programs only if it’s needed, and make sure it’s after any code added by AT_PREPARE_TESTS. * tests/local.at: Add AT_PREPARE_TESTS block that ensures $MAKE is set sensibly and $MAKEFLAGS and $CONFIG_SITE are unset. Use AT_TEST_HELPER_FN for the helper function needed by AT_CHECK_ENV. (AT_CHECK_MAKE): No need to sanitize $MAKE or $MAKEFLAGS here. * tests/base.at, tests/compile.at, tests/m4sh.at, tests/torture.at: No need to unset or neutralize $CONFIG_SITE in individual tests. * tests/autotest.at: Add tests for new macros. * doc/autoconf.texi, NEWS: Document new macros.
* Make “redefining AS_ECHO internals” test more robust.Zack Weinberg2020-11-301-4/+14
| | | | | | | | | M4-redefining ‘printf’ as ‘echo’ brings back all the variations in ‘echo’ behavior that we were trying to get away from by switching to ‘printf’ in the first place. This caused a spurious failure on AIX. * tests/m4sh.at (Redefining AS_ECHO internals): Redefine ‘printf’ as a shell function with fully predictable output, not as ‘echo’.
* AS_ECHO(_N): Do not expand macros named ‘s’ or ‘n’ (#110377)Zack Weinberg2020-11-161-0/+90
| | | | | | | | | | | | | | | | | | | | | | | AS_ECHO expands to ‘printf "%s\n" $1’. If a configure script defines an M4 macro named ‘s’ or ‘n’ it will be expanded in the first argument to printf, which is almost certainly not what was intended. The configure script for ruby 2.7.2 uses ‘AS_VAR_PUSHDEF([s], ...)’ and breaks with 2.69d because of this. Add some extra quoting so that the ‘%s\n’ is treated as literal; similarly for AS_ECHO_N and the legacy shell variables $as_echo and $as_echo_n. For now, anyway, don’t quote the word ‘printf’; if someone does define that as a M4 macro they might well mean to affect AS_ECHO. (Whether this is something we *want* to allow, we can worry about when it comes up.) Fixes bug #110377. * lib/m4sugar/m4sh.m4 (_AS_ECHO_N_PREPARE, AS_ECHO, AS_ECHO_N): Add another layer of quoting around the first argument to printf. * tests/m4sh.at (Redefining AS_ECHO internals): New test.
* AS_IF: Handle else clause being empty after macro expansion (#110369)Zack Weinberg2020-11-151-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | AS_IF can emit a syntactically invalid shell if-then-else, if CONDITION then : # ... else fi when its IF-FALSE argument consists of macros that don’t produce any shell code. This was a documented limitation in AS_IF, but it’s a bad limitation to have, because macros that *used* to expand to shell commands might start expanding to nothing in future releases. For instance, this broke the libzmq configure script, which did AC_PROG_CC AX_CHECK_COMPILE_FLAG([-std=gnu11], [CFLAGS+=" -std=gnu11"], [AC_PROG_CC_C99]) Perfectly valid in 2.69, but in 2.70 AC_PROG_CC_C99 doesn’t produce any shell code and the script crashes. We had that limitation for good reason: we can’t just put ‘:’ at the beginning of the else-clause, like we do for the then-clause, because that would clobber $? and the IF-FALSE commands might want to inspect it. (This doesn’t matter for the then-clause, because $? is always zero at the beginning of a then-clause anyway.) The simplest and least inefficient shell construct I can find that works in this context is a shell function that does ‘return $?’. Due to awkward M4sh initialization ordering constraints (AS_IF gets used before we can safely use shell functions) an indirection through a shell variable is necessary. The structure of a m4sh script is now #! /bin/sh ## M4sh Initialization as_nop=: ... ## M4sh Shell Functions as_fn_nop () { return $?; } as_nop=as_fn_nop ... and AS_IF emits if CONDITION then : # ... else $as_nop # ... fi The uses of AS_IF that appear before the beginning of the M4sh Shell Functions section are all under our control and they don’t need to look at $?. If anyone has a better idea for how to make this work I will be glad to hear it. Fixes bug #110369. * lib/m4sugar/m4sh.m4 (_AS_IF_ELSE): When $1 is nonempty, invoke _AS_EMPTY_ELSE_PREPARE. Emit $as_nop at beginning of else clause. (_AS_BOURNE_COMPATIBLE): Initialize as_nop to ‘:’. (_AS_EMPTY_ELSE_PREPARE): New macro which emits a definition of as_fn_nop and resets as_nop to as_fn_nop. (AS_PREPARE, _AS_PREPARE): Invoke _AS_EMPTY_ELSE_PREPARE. (_AS_UNSET_PREPARE): Tweak white space. * tests/m4sh.at (AS_IF and AS_CASE): Test AS_IF’s IF-FALSE argument being empty after macro expansion. * doc/autoconf.texi (AS_IF): Remove warning about use with ‘run-if-false’ argument empty after macro expansion.
* tests/m4sh.at: prevent an undesirable expansion of __oline__.Zack Weinberg2020-10-291-1/+1
| | | | | | | | | The descriptive comment for AT_DATA_LINENO mentions __oline__, and this is expanded when generating the testsuite, which is confusing to anyone reading the generated testuite. Defang it with @&t@. * tests/m4sh.at (AT_DATA_LINENO): Prevent expansion of __oline__ in the descriptive comment.
* Manually sync ChannelDefs.pm from automake.Zack Weinberg2020-09-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ChannelDefs.pm *ought* to be kept in sync between automake and autoconf, because it defines the set of valid -W options, and autoreconf assumes that it can pass arbitrary -W options to all of the tools it invokes. However, it isn’t covered by either project’s ‘make fetch’ and it hasn’t actually *been* in sync for more than 17 years. This patch manually brings over all of the changes made on the automake side. Once the complementary patch is applied by the automake team, both versions of the file will be the same, and then we can add it to the list in fetch.pl and not have this problem any more in the future. There are some user-visible consequences to bringing this file back into sync. The only one worth mentioning in NEWS is that the ‘obsolete’ category of warnings is now on by default. This had quite a bit of fallout throughout the testsuite. There are also some new warning categories that get mentioned in --help output, but we don’t actually generate any warnings in those categories, so people using ‘-Wall’ won’t see any change. More diagnostics are automatically tagged with ‘warning:’ or ‘error:’, which also had some fallout in the testsuite. Finally, ‘-Werror’ no longer causes complaints about unknown warning categories to be treated as hard errors. Internally, there are some small API changes: ‘parse_warnings’ is no longer usable as a ‘getopt’ callback function, and we now have a stub Autom4te/Config.pm to match the automake code’s expectations. (This file *should* also be synced from automake by ‘make fetch’, but we can’t quite do that yet because it’s a generated file and our build system is not prepared to handle adding *two* directories to @INC when running a not-yet-installed Perl script. I plan to fix that after 2.70.) As a side-effect of adding a Config.pm, ‘prog_error’ now says to report the bug to bug-autoconf, not bug-automake. If this is why we mostly haven’t been using prog_error for internal errors, we can stop avoiding it. (I did not change anything to use prog_error in this patch.) * lib/Autom4te/ChannelDefs.pm: Merge from automake. * lib/Autom4te/Config.pm: New file. * lib/local.mk (dist_perllib_DATA): Add Autom4te/Config.pm. * bin/autoconf.as: Update list of warning categories to match Autom4te::ChannelDefs::usage. * bin/autoheader.in (@warnings): New global. (parse_args): Don’t use parse_warnings as a getopt callback. (main): Add warnings options from our command line to $autoconf. No need to turn on 'obsolete' warnings explicitly. No need to include "warning: " in warning messages. * bin/autom4te.in (parse_args): Don’t use parse_warnings as a getopt callback. (main): No need to include "warning: " in warning messages. * bin/autoreconf.in (parse_args): parse_warnings now takes only one argument. * bin/autoupdate.in: Set WARNINGS=none in environment for all child processes. * tests/local.at (AT_CHECK_M4): Handle `autom4te: error: /usr/bin/m4 ...` like `autom4te: /usr/bin/m4 ...`. (_AT_CHECK_AC_MACRO): Add AUTOCONF-FLAGS argument, passed to both autoconf and autoheader. (AT_CHECK_MACRO): Default AUTOCONF-FLAGS argument to empty. Pass that argument to autoheader as well as autoconf. (AT_CHECK_AU_MACRO): Expect a “macro ‘NAME’ is obsolete’ diagnostic on the first run of autoconf. Pass -Wno-obsolete to autoconf on the second run, and to autoheader on both runs. * tests/base.at * tests/c.at * tests/compile.at * tests/m4sh.at * tests/m4sugar.at * tests/semantics.at * tests/tools.at * tests/torture.at: No need to pass -Wobsolete to autoconf. Pass -Wno-obsolete to autoheader where needed to avoid handling the same warning twice. Update various expectations for diagnostics to match behavior changes. * tests/tools.at (autoupdating AU_ALIAS): Add an AC_CONFIG_HEADERS line to the test configure.ac to eliminate an unrelated diagnostic.
* Warn if AC_INIT or AC_OUTPUT are missing from configure.ac (#107986)Zack Weinberg2020-08-181-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is almost always incorrect for a configure script to omit either AC_INIT or AC_OUTPUT. Issue warnings in the ‘syntax’ category for this. The implementation is, unfortunately, a bit of a kludge. To check for the _absence_ of a macro invocation, we can use m4_provide_if inside a m4_wrap hook. However, if we activate the m4_wrap hook directly from general.m4, we get spurious warnings at freeze time. We also get warnings whenever a script that’s missing AC_INIT and/or AC_OUTPUT is *traced*, which means we get double warnings from autoconf, and autoheader and aclocal complain about it too, which seems unnecessary. A clean way to deal with this would be to make the hook look for a special macro that’s defined only when autoconf (the program) is invoked without any --trace arguments. Unfortunately, autom4te doesn’t pass --define down to M4, and changing that would involve coordinating with Automake (the project), so instead I’ve gone for the kludge: a new file lib/autoconf/trailer.m4 that calls m4_wrap. This file is *not* included in autoconf.m4f, but it’s installed, and it’s added to the m4 invocation by autoconf (the program) only when not tracing. (It still uses m4_wrap, because we pass it to m4 *before* configure.ac, because otherwise we get nonsense locations for any *other* diagnostics coming out of this autoconf invocation. I don’t know why.) The additional checks in autoreconf are intended to make sure that if autoreconf skips a directory entirely, you get told why. Lots of tests in the testsuite didn’t bother with AC_OUTPUT, and somewhat fewer didn’t bother with AC_INIT; where possible I just added them. Suggested by David A. Wheeler, who submitted a patch, but I didn’t wind up using any of his code. (His implementation used an extra tracing pass, only checked for a missing AC_INIT, and invented a new command-line option to turn off this specific warning. I thought this was tidier overall, despite the kludge.) * lib/autoconf/general.m4 (_AC_FINALIZE): New macro: code to be run when generating configure, after the entire configure.ac is processed. Currently only checks that AC_INIT and AC_OUTPUT were called at some point, issuing syntax-category warnings if not. (AC_INIT, AC_OUTPUT): m4_provide self. * lib/autoconf/trailer.m4: New file that just calls m4_wrap([_AC_FINALIZE]). * lib/local.mk: Install new file. * bin/autoconf.as: Add trailer.m4 to the final invocation of autom4te, but only when not tracing. * bin/autoreconf.in (autoreconf_current_directory): Distinguish in diagnostics between “directory skipped because it doesn’t have a configure.ac or configure.in” (e.g. Cygnus configure) and “directory has a configure.ac but it doesn’t appear to be autoconf input.” * tests/*.at: Fix all tests affected by the new warnings.
* AS_INIT: basename __file__Luke Mewburn2020-07-051-0/+19
| | | | | | Fix AS_INIT to encode the basename of __file__ instead of the full path to the source directory. Allows for reproducible builds.
* Define $as_echo and $as_echo_n for backward compatibility.Zack Weinberg2020-03-131-0/+74
| | | | | | | | | | | | | Commit 2b59b6f8a79b8bf77e178ff4e5aa0ede433d39cf removed the internal shell variables $as_echo and $as_echo_n. It turns out that these are used by several widely-used third-party m4 files (notably both gnulib-common.m4 from gnulib, and ax_pthread.m4 from the Autoconf macro archive) as well as any number of existing configure.ac’s. Restore these shell variables, unconditionally defining them to use printf. Issue -Wobsolete warnings if they are used, recommending the use of AS_ECHO and AS_ECHO_N respectively. Add a test which checks both that they do work and that they trigger warnings.
* maint: make update-copyrightJim Meyering2020-01-011-1/+1
|
* Port tests to Bash 5Ondrej Dubaj2019-09-101-2/+2
| | | | | | | | * tests/local.at (AT_CHECK_ENV, AT_CONFIG_CMP): Add BASH_ARGC, BASH_ARGV to list of variables to be ignored when comparing variable space dumps. (AT_CONFIG_CMP): Also ignore LINENO. * tests/m4sh.at: Also unset LINENO in 'reference' and 'test/test-1'.
* maint: update URLsPaul Eggert2017-09-231-2/+2
| | | | Most of this is replacing http: with https: when either will do.
* Prefer HTTPS to FTP and HTTPPaul Eggert2017-09-161-1/+1
|
* maint: update copyright dates for 2017Jim Meyering2017-01-011-1/+1
| | | | | * all files: Run "make update-copyright". * doc/autoconf.texi: Update manually.
* maint: make update-copyrightPaul Eggert2016-02-061-1/+1
|
* lib: use shorter way to test if variable is setEric Blake2015-04-211-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Based on an idea by Bernhard Reutner-Fischer. We frequently used the idiom of 'test "${var+set}" = set' to test if $var was set to a non-empty string, but this can portably be trimmed to a more compact 'test ${var+y}' for a smaller configure file. Testing that a variable is not set can be done with '${var+false} :' (although the value of $? is not reliably 1 when the variable is set). The code for AS_VAR_TEST_SET already used the form '${var+:} false', but it is slightly longer, and does not guarantee $? of 1. Tested on coreutils, where the resulting configure file is about 1k smaller. * doc/autoconf.texi (Shell Substitutions): Prefer shorter sequence for testing if a variable is set. (Limitations of Builtins) <test (strings)>: Document it. * configure.ac: Use it. * lib/autoconf/c.m4 (_AC_PROG_CC_G, _AC_PROG_CXX_G) (_AC_PROG_OBJC_G, _AC_PROG_OBJCXX_G): Likewise. * lib/autoconf/fortran.m4 (_AC_PROG_FC_G): Likewise. * lib/autoconf/general.m4 (_AC_ENABLE_IF_ACTION, AC_CACHE_SAVE): Likewise. * lib/autoconf/lang.m4 (_AC_COMPILER_EXEEXT_DEFAULT): Likewise. * lib/autoconf/programs.m4 (AC_PROG_INSTALL, AC_PROG_MKDIR_P) (_AC_PROG_LEX_YYTEXT_DECL): Likewise. * lib/autoconf/status.m4 (_AC_OUTPUT_MAIN_LOOP): Likewise. * lib/autotest/general.m4 (AT_INIT): Likewise. * tests/base.at (AC_CACHE_CHECK): Likewise. * tests/m4sh.at (LINENO): Likewise. * lib/m4sugar/m4sh.m4 (_AS_BOURNE_COMPATIBLE) (_AS_DETECT_BETTER_SHELL, _AS_SHELL_SANITIZE) (_AS_PATH_SEPARATOR_PREPARE): Likewise. (AS_VAR_TEST_SET): Use shorter sequence. Signed-off-by: Eric Blake <eblake@redhat.com>
* maint: bump copyright to 2015Paul Eggert2015-01-021-1/+1
| | | | * all files: Run 'make update-copyright'.
* m4sh: allow trailing newlines in shell conditionsEric Blake2014-07-171-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Dimitrios Apostolou reported getting a shell syntax error for this construct in his configure.ac: AM_CONDITIONAL([HAVE_LIBXML2], [test "x$with_libxml2" != xno && test "x$ac_cv_lib_xml2_xmlFirstElementChild" = xyes] ) He analyzed it to a root cause: his trailing newline, coupled with an 'if $2; then' construct in the macro body, resulted in configure containing: if test ... xyes ; then where the semicolon is a syntax error in shell; and proposed a patch to automake to fix his use case. While that macro is not under our control, it does highlight the fact that the shell can use either ; or newline to terminate a conditional prior to the next keyword in a compound statement. If we use newline, we gain two benefits - the configure file is slightly smaller (more lines, but fewer bytes), and any user that doesn't realize that unquoted trailing newlines in a macro argument are still significant can still generate valid shell code when their argument is used in a shell compound statement. * lib/m4sugar/m4sh.m4 (AS_IF, _AS_IF, _AS_CLEAN_DIR): Prefer newline over semicolon to end user-supplied conditionals. * lib/autoconf/general.m4 (AC_CONFIG_AUX_DIRS): Likewise. * lib/autoconf/libs.m4 (AC_SEARCH_LIBS): Likewise. * lib/autoconf/programs.m4 (_AC_PATH_PROGS_FEATURE_CHECK): Likewise. * tests/m4sh.at (AS_IF and AS_CASE): Test it. Signed-off-by: Eric Blake <eblake@redhat.com>
* maint: bump copyright to 2014Eric Blake2014-01-011-1/+1
| | | | | | | Done via 'make update-copyright', since all files are effectively modified and distributed this year via public version control. * all files: Update copyright year.
* maint: bump copyright to 2013Eric Blake2013-01-031-1/+1
| | | | | | | Done via 'make update-copyright', since all files are effectively modified and distributed this year via public version control. * all files: Update copyright year.
* tests: fix spurious failure due to Solaris XPG4 sh bugStefano Lattarini2012-03-041-3/+7
| | | | | | | | | | | | | | | | | | | On Solaris 10, the /usr/xpg4/bin/sh shell seems unable to execute a shell script named 'script': $ touch script $ /bin/sh script; echo status: $? # As expected. status: 0 $ /usr/xpg4/bin/sh script; echo status: $? # Weirdness follows. /usr/xpg4/bin/sh: script: cannot execute status: 1 This was causing a spurious testsuite failure for users which have /usr/xpg4/bin in $PATH before /bin and /usr/bin. Fix that. * tests/m4sh.at (Configure re-execs self with CONFIG_SHELL): Rename the m4sh-produced script to 'script2', to avoid the just-described issue.
* tests: fix spurious failure when CONFIG_SITE is setStefano Lattarini2012-03-041-1/+4
| | | | | | * tests/m4sh.at (Configure re-execs self with CONFIG_SHELL): Export $CONFIG_SITE to "/dev/null", to avoid spurious diffs in expected stdout/stderr.
* tests: port AS_TR_SH and AS_TR_CPP test to Solaris 8 wcPaul Eggert2012-03-031-2/+3
| | | | | | * tests/m4sh.at (AS@&t@_TR_SH and AS@&t@_TR_CPP): Do not assume that "wc -l" outputs only digits; on Solaris 8 it also outputs blanks and POSIX allows this.
* tests: fix "#/bin/sh" typoPaul Eggert2012-03-031-1/+1
| | | | | | * tests/m4sh.at (AS@&t@_EXECUTABLE): "#!/bin/sh", not "#/bin/sh". Typo reported by Tim Rice in: http://lists.gnu.org/archive/html/autoconf-patches/2012-03/msg00009.html
* tests: port AS_EXECUTABLE_P test to Solaris 8 /bin/shPaul Eggert2012-03-031-1/+1
| | | | | | | * tests/m4sh.at (AS@&t@_EXECUTABLE): Treat any nonzero exit status as failure. This is needed for Solaris 8 /bin/sh, where executing a nonexecutable file causes the shell to say the file had exit status 1.
* tests: add test for AS_EXECUTABLE_PEric Blake2012-02-251-0/+52
| | | | | | | | Now that this is public, we should regression test it. * tests/m4sh.at (AS@&t@_EXECUTABLE): New test. Signed-off-by: Eric Blake <eblake@redhat.com>
* maint: tweak to avoid triggering space-tab-prohibiting syntax-checkJim Meyering2012-01-211-2/+2
| | | | | * tests/m4sh.at (nargs): Use TAB-SP, not SP-TAB in abusive file name, to avoid triggering the space-tab-prohibiting syntax-check.
* maint: update copyright yearPaul Eggert2012-01-041-1/+1
| | | | All files changed to add 2012, via 'make update-copyright'.
* configure: will re-execute with $CONFIG_SHELL, if it's setStefano Lattarini2011-12-261-0/+27
| | | | | | | | | | | | | | * lib/m4sugar/general.m4 (_AS_DETECT_BETTER_SHELL): Define the macro `_AS_FORCE_REEXEC_WITH_CONFIG_SHELL' to `yes', so that the code in `_AS_DETECT_BETTER_SHELL' will cause autoconf-generated configure scripts to always re-execute themselves with $CONFIG_SHELL, if it's set in the environment. * doc/autoconf.texi (config.status Invocation): Update. * doc/install.texi (Defining Variables): Likewise. * NEWS: Likewise. * tests/m4sh.at: Add tests for the new semantics in ... (Configure re-execs self with CONFIG_SHELL): ... this new test group.
* m4sh: allow forced re-execution with $CONFIG_SHELL, if it's setStefano Lattarini2011-12-261-0/+87
| | | | | | | | | | * lib/m4sugar/m4sh.m4 (_AS_DETECT_BETTER_SHELL): If the m4sh client has defined the macro `_AS_FORCE_REEXEC_WITH_CONFIG_SHELL' to "yes", emit code to always re-execute the current script with $CONFIG_SHELL, if that's set. * tests/m4sh.at: Add tests for the new and old semantics, in ... (Re-exec with CONFIG_SHELL, Forced re-exec with CONFIG_SHELL): ... these new test groups.
* maint: update copyright yearEric Blake2011-01-041-2/+1
| | | | | | All files changed to add 2011, via 'make update-copyright'. Signed-off-by: Eric Blake <eblake@redhat.com>
* AS_LITERAL_IF: Treat raw = as literal again.Eric Blake2010-10-081-10/+26
| | | | | | | | | | * lib/m4sugar/m4sh.m4 (_AS_LITERAL_IF): Treat = like +. * tests/m4sh.at (AS@&t@_TR_SH and AS@&t@_TR_CPP) (AS@&t@_LITERAL_IF): Expand tests. * NEWS: Document the fix. Reported via Ben Pfaff; originally http://bugs.debian.org/593838 Signed-off-by: Eric Blake <eblake@redhat.com>
* m4sugar: fix regression in AC_MSG_ERROR expansionEric Blake2010-09-161-1/+65
| | | | | | | | | | | | | | | | | AS_ERROR Regression introduced in commit cffdc3947, but the underlying problem stems from the introduction of m4_defun_init in commit d0c5f482. * lib/m4sugar/m4sugar.m4 (m4_defun_init): Avoid macro concatenation on subsequent expansions * tests/m4sh.at (AS_WARN and AS_ERROR): New test. * tests/m4sugar.at (m4@&t@_require: one-shot initialization): Enhance test. * NEWS: Document the fix. * THANKS: Update. Reported by Adrian Bunk and and Nishio Futoshi. Signed-off-by: Eric Blake <eblake@redhat.com>
* m4sh: assume ${a:-b} supportEric Blake2010-08-271-0/+64
| | | | | | | | | | | * tests/m4sh.at (Null variable substitution): New test. * doc/autoconf.texi (Shell Substitutions) <${var:-value}>: Mention that m4sh guarantees support. (Limitations of Usual Tools) <mktemp>: Use it. * lib/m4sugar/m4sh.m4 (AS_LINENO_POP, AS_VAR_IF, AS_TMPDIR): Exploit use of colon for smaller files. Signed-off-by: Eric Blake <eblake@redhat.com>
* tests: improve some shell assumption testingEric Blake2010-08-251-6/+19
| | | | | | * tests/m4sh.at (Functions Support, Functions and return Support) (Negated classes in globbing): Update comments. (AS@&t@_VAR basics): Test comparison to empty string.
* Relax AC_INIT requirements for PACKAGE and VERSION strings again.Ralf Wildenhues2010-07-191-2/+17
| | | | | | | | | | | | | * lib/m4sugar/m4sh.m4 (AS_LITERAL_HEREDOC_IF): New macro. (_AS_LITERAL_HEREDOC_IF, _AS_LITERAL_HEREDOC_IF_YES) (_AS_LITERAL_HEREDOC_IF_NO): New helper macros. * lib/autoconf/general.m4 (_AC_INIT_PACKAGE): Use AS_LITERAL_HEREDOC_IF for PACKAGE and VERSION strings. * tests/base.at (AC_INIT with unusual version strings): New test. * tests/m4sh.at (AS@&t@_LITERAL_IF): Extend test. * NEWS: Update. Signed-off-by: Eric Blake <eblake@redhat.com>
* Fix minor copy&paste leftover in m4sh tests.Stefano Lattarini2010-07-041-1/+0
| | | | | | | * tests/m4sh.at (AS@&t@_TR_SH and AS@&t@_TR_CPP): Remove useless variables assignements ($var, $vAr, $VAR). Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* Make AS_TR_SH and AS_TR_CPP similar.Eric Blake2010-07-021-0/+77
| | | | | | | | | | * lib/m4sugar/m4sh.m4 (_AS_TR_CPP_LITERAL): Avoid underquoting. (_AS_TR_CPP_INDIR): Handle all polymorphic variables. * tests/m4sh.at (AS@&t@_TR_SH and AS@&t@_TR_CPP): New test. * NEWS: Document the fix. Reported by Bruno Haible. Signed-off-by: Eric Blake <eblake@redhat.com>
* Add tests for AS_BOX.Eric Blake2010-07-021-3/+45
| | | | | | | | | | * tests/m4sugar.at (m4@&t@_text_box): New test. * tests/m4sh.at (AS@&t@_BOX): Likewise. * lib/m4sugar/m4sugar.m4 (m4_text_box): Support comma. * doc/autoconf.texi (Text processing Macros) <m4_text_box>: Document further limitations. Signed-off-by: Eric Blake <eblake@redhat.com>
* Add optional argument to AS_LITERAL_IF.Eric Blake2010-07-021-3/+3
| | | | | | | | | | | | | | | | | * lib/m4sugar/m4sh.m4 (_AS_LITERAL_IF): Rewrite to generate macro name, without using m4_cond. (_AS_LITERAL_IF_, _AS_LITERAL_IF_YES, _AS_LITERAL_IF_NO): New helpers. (AS_LITERAL_IF, AS_LITERAL_WORD_IF, _AS_TR_SH, _AS_TR_CPP) (_AS_VAR_PUSHDEF): Adjust callers. * lib/autoconf/types.m4 (AC_CHECK_ALIGNOF): Relax restrictions on invalid bytes, since this allows inline struct layouts. (_AC_CHECK_ALIGNOF): New helper macro. * tests/m4sh.at (AS@&t@_LITERAL_IF): Update test. * doc/autoconf.texi (Polymorphic Variables) <AS_LITERAL_IF>: Update documentation. Signed-off-by: Eric Blake <eblake@redhat.com>
* Add AS_LITERAL_WORD_IF.Eric Blake2010-07-021-8/+28
| | | | | | | | | | | | * lib/m4sugar/m4sh.m4 (_AS_LITERAL_IF): Also reject shell quoting characters as non-literal, and provide way to reject space. (AS_LITERAL_WORD_IF): New macro. * doc/autoconf.texi (Polymorphic Variables) <AS_LITERAL_IF>: Document new macro. Fix example to match reality. * NEWS: Document change and new macro. * tests/m4sh.at (AS@&t@_LITERAL_IF): Update test. Signed-off-by: Eric Blake <eblake@redhat.com>
* Make AS_SET_CATFILE polymorphic, and add testsuite coverage.Ralf Wildenhues2010-06-081-0/+42
| | | | | | | | | | | * lib/m4sugar/m4sh.m4 (AS_SET_CATFILE): Use AS_VAR_SET to set the variable. * tests/m4sh.at (AS@&t@_SET_CATFILE): New test. * doc/autoconf.texi (Common Shell Constructs): Document that AS_SET_CATFILE is polymorphic in its VAR argument now. * NEWS: Update. Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* Formatting cleanups in macro comments.Ralf Wildenhues2010-03-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | For a list of candidate unaligned underlines, use this script: for f in `git ls-files`; do awk '{ len[NR] = length($0) } /----*/ && len[NR-1] != 0 { if (len[NR-1] != len[NR]) print FILENAME ":" NR ":" $0 }' $f done * lib/autoconf/c.m4, lib/autoconf/erlang.m4, lib/autoconf/fortran.m4, lib/autoconf/functions.m4, lib/autoconf/general.m4, lib/autoconf/lang.m4, lib/autoconf/programs.m4, lib/autoconf/specific.m4, lib/autoconf/status.m4, lib/autoconf/types.m4, lib/autotest/general.m4, lib/autotest/specific.m4, lib/m4sugar/m4sh.m4, lib/m4sugar/m4sugar.m4, tests/autotest.at, tests/local.at, tests/m4sh.at, tests/semantics.at, tests/tools.at, tests/torture.at: Fix macro comment format. Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* Update copyright year.Eric Blake2010-01-051-1/+1
| | | | | | All files changed to add 2010, via 'make update-copyright'. Signed-off-by: Eric Blake <ebb9@byu.net>
* Warn if using unnamed diversion.Eric Blake2009-12-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | * lib/m4sugar/m4sugar.m4 (_m4_divert, m4_divert_push): Add optional parameter, which controls warning. (m4_divert_pop, m4_cleardivert, m4_divert_require) (_m4_require_call): Adjust callers. * lib/m4sugar/m4sh.m4 (AS_REQUIRE): Likewise. * tests/m4sh.at (AT_DATA_LINENO): Avoid triggering the warning. * tests/m4sugar.at (AT_CHECK_M4SUGAR_TEXT, m4@&t@_append) (m4@&t@_text_wrap, recursion): Likewise. (m4@&t@_warn, m4@&t@_divert_stack): Adjust expected output. * tests/tools.at (autom4te and whitespace in file names) (autoconf: the empty token): Avoid triggering the warning. (autoconf: AC_PRESERVE_HELP_ORDER): New test. * tests/mktests.sh (ac_exclude_list): Retire prior test. * NEWS: Document the warning. * doc/autoconf.texi (Redefined M4 Macros) <m4_divert>, <m4_undivert>: Make even more explicit that using these directly is discouraged. (Diversion support): Further warn against improper diversion changes. <m4_divert_text>: Give an example of proper use. Reported by Mike Frysinger. Signed-off-by: Eric Blake <ebb9@byu.net>
* Fix corner cases in AS_LITERAL_IF and AS_TR_SH.Eric Blake2009-10-281-2/+2
| | | | | | | | | | | | | | | * lib/m4sugar/m4sh.m4 (AS_LITERAL_IF): Fix bug with unbalanced parens. Move guts... (_AS_LITERAL_IF): into new helper. (AS_TR_SH, AS_TR_CPP): Fix bugs with expansion of wrong macro. Move guts... (_AS_TR_SH, _AS_TR_SH_LITERAL, _AS_TR_SH_INDIR, _AS_TR_CPP) (_AS_TR_CPP_LITERAL, _AS_TR_CPP_INDIR): ...into new helpers. (AS_VAR_PUSHDEF): Hoist m4_require, by moving guts... (_AS_VAR_PUSHDEF): ...into new helper. * tests/m4sh.at (AS@&t@_LITERAL_IF): Enhance test. Signed-off-by: Eric Blake <ebb9@byu.net>
* Update License to GPLv3+ including new Autoconf Exception.Ralf Wildenhues2009-09-091-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * NEWS, README: Update licensing information. * COPYING.EXCEPTION: New file. * Makefile.am (EXTRA_DIST): Distribute it. * cfg.mk (autom4te-update): Remove copyright change warning. * lib/autoconf/autoconf.m4, lib/autoconf/autoheader.m4, lib/autoconf/autoscan.m4, lib/autoconf/autotest.m4, lib/autoconf/autoupdate.m4, lib/autoconf/c.m4, lib/autoconf/erlang.m4, lib/autoconf/fortran.m4, lib/autoconf/functions.m4, lib/autoconf/general.m4, lib/autoconf/headers.m4, lib/autoconf/lang.m4, lib/autoconf/libs.m4, lib/autoconf/oldnames.m4, lib/autoconf/programs.m4, lib/autoconf/specific.m4, lib/autoconf/status.m4, lib/autoconf/types.m4, lib/autotest/autotest.m4, lib/autotest/general.m4, lib/autotest/specific.m4, lib/m4sugar/foreach.m4, lib/m4sugar/m4sh.m4, lib/m4sugar/m4sugar.m4: Update exception statement, bump to GPLv3. * bin/autoconf.as, bin/autoheader.in, bin/autom4te.in, bin/autoreconf.in, bin/autoscan.in, bin/autoupdate.in, bin/ifnames.in: Bump to GPLv3+, adjust --version output to reflect the GPLv3+ and the Autoconf Exception. * lib/Autom4te/C4che.pm, lib/Autom4te/ChannelDefs.pm, lib/Autom4te/General.pm, lib/Autom4te/Request.pm, lib/autom4te.in, lib/autoscan/autoscan.pre, lib/emacs/autoconf-mode.el, lib/emacs/autotest-mode.el, lib/freeze.mk, tests/atlocal.in, tests/autoscan.at, tests/autotest.at, tests/base.at, tests/c.at, tests/compile.at, tests/erlang.at, tests/foreign.at, tests/fortran.at, tests/local.at, tests/m4sh.at, tests/m4sugar.at, tests/mktests.sh, tests/semantics.at, tests/statesave.m4, tests/suite.at, tests/tools.at, tests/torture.at, tests/wrapper.as: Bump to GPLv3+.
* Fix test typo.Eric Blake2009-07-091-1/+1
| | | | | | | * tests/m4sh.at (AS@&t@_INIT_GENERATED): Close fd, rather than creating file named -. Signed-off-by: Eric Blake <ebb9@byu.net>
* Fix testsuite under dash.Eric Blake2009-07-091-43/+43
| | | | | | | | | | | | | | | | | * tests/m4sh.at (LINENO stack, AS@&t@_BASENAME, AS@&t@_DIRNAME) (AS@&t@_ECHO and AS@&t@_ECHO_N, AS@&t@_EXIT, AS@&t@_MKDIR_P) (AS@&t@_VERSION_COMPARE, as_me, Negated classes in globbing) (Functions Support, Functions and return Support) (Nested AS@&t@_REQUIRE_SHELL_FN, Nested AS@&t@_REQUIRE) (AS@&t@_REQUIRE_SHELL_FN and m4@&t@_require, AS@&t@_HELP_STRING) (AS@&t@_IF and AS@&t@_CASE, AS@&t@_FOR, AS@&t@_LITERAL_IF) (AS@&t@_VAR basics, AS@&t@_VAR_APPEND, AS@&t@_VAR_ARITH) (AS@&t@_INIT cleanup, AS@&t@_INIT_GENERATED, AS@&t@_MESSAGE_FD) (_AS@&t@_CLEAN_DIR, ECHO_C): Allow testing different CONFIG_SHELL options during the testsuite run. Reported by Ralf Wildenhues. Signed-off-by: Eric Blake <ebb9@byu.net>
* Avoid AIX 6.1 ksh88 ECHO_C command substitution bug.Jan Madzik2009-06-301-0/+20
| | | | | | | | | | | * lib/m4sugar/m4sh.m4 (_AS_ECHO_N_PREPARE): Ensure more than one character is output with `\c'; reset echo output state if buggy ksh was detected, and set ECHO_T instead of ECHO_C. * doc/autoconf.texi (Limitations of Builtins): Document it. * tests/m4sh.at (ECHO_C): New test. * THANKS: Update. Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>