autoconf/tests
Eric Blake 76754e04fc lib: use shorter way to test if variable is set
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>
2015-04-21 06:15:35 -06:00
..
atlocal.in maint: bump copyright to 2015 2015-01-02 13:03:39 -08:00
autoscan.at maint: bump copyright to 2015 2015-01-02 13:03:39 -08:00
autotest.at maint: bump copyright to 2015 2015-01-02 13:03:39 -08:00
base.at lib: use shorter way to test if variable is set 2015-04-21 06:15:35 -06:00
c.at maint: bump copyright to 2015 2015-01-02 13:03:39 -08:00
compile.at maint: bump copyright to 2015 2015-01-02 13:03:39 -08:00
erlang.at maint: bump copyright to 2015 2015-01-02 13:03:39 -08:00
foreign.at maint: bump copyright to 2015 2015-01-02 13:03:39 -08:00
fortran.at maint: bump copyright to 2015 2015-01-02 13:03:39 -08:00
go.at maint: bump copyright to 2015 2015-01-02 13:03:39 -08:00
local.at maint: bump copyright to 2015 2015-01-02 13:03:39 -08:00
local.mk tests: avoid two false-positive parallel test failures 2015-02-01 19:51:10 -08:00
m4sh.at lib: use shorter way to test if variable is set 2015-04-21 06:15:35 -06:00
m4sugar.at maint: bump copyright to 2015 2015-01-02 13:03:39 -08:00
mktests.sh maint: bump copyright to 2015 2015-01-02 13:03:39 -08:00
semantics.at maint: bump copyright to 2015 2015-01-02 13:03:39 -08:00
statesave.m4 maint: bump copyright to 2015 2015-01-02 13:03:39 -08:00
suite.at maint: bump copyright to 2015 2015-01-02 13:03:39 -08:00
tools.at maint: bump copyright to 2015 2015-01-02 13:03:39 -08:00
torture.at maint: bump copyright to 2015 2015-01-02 13:03:39 -08:00
wrapper.as maint: bump copyright to 2015 2015-01-02 13:03:39 -08:00