summaryrefslogtreecommitdiff
path: root/lib/m4sugar
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2010-08-25 16:56:37 -0600
committerEric Blake <eblake@redhat.com>2010-08-27 10:05:10 -0600
commitd1bea5123b8ecb406fbeabbe70552271f60de8e7 (patch)
tree1bd6b9693167b66344a4a54c22aefb86acbe32b9 /lib/m4sugar
parent270b8340863c11c5e51bb2841a58974edf52e0db (diff)
downloadautoconf-d1bea5123b8ecb406fbeabbe70552271f60de8e7.tar.gz
m4sh: assume ${a:-b} support
* 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>
Diffstat (limited to 'lib/m4sugar')
-rw-r--r--lib/m4sugar/m4sh.m414
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4
index 2f8baec1..8343b259 100644
--- a/lib/m4sugar/m4sh.m4
+++ b/lib/m4sugar/m4sh.m4
@@ -859,8 +859,10 @@ m4_defun([AS_LINENO_PUSH],
# -----------------------
# If this is call balances the outermost call to AS_LINENO_PUSH,
# AS_MESSAGE will restart printing $LINENO as the line number.
+#
+# No need to use AS_UNSET, since as_lineno is necessarily set.
m4_defun([AS_LINENO_POP],
-[eval $as_lineno_stack; test "x$as_lineno_stack" = x && AS_UNSET([as_lineno])])
+[eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno])
@@ -1620,7 +1622,7 @@ m4_define([_AS_LITERAL_HEREDOC_IF_NO], [$2])
# it is a documented part of the public API and must not be changed.
m4_define([AS_TMPDIR],
[# Create a (secure) tmp directory for tmp files.
-m4_if([$2], [], [: "${TMPDIR=/tmp}"])
+m4_if([$2], [], [: "${TMPDIR:=/tmp}"])
{
tmp=`(umask 077 && mktemp -d "m4_default([$2],
[$TMPDIR])/$1XXXXXX") 2>/dev/null` &&
@@ -1984,10 +1986,12 @@ m4_define([AS_VAR_GET],
# Polymorphic, and avoids sh expansion error upon interrupt or term signal.
m4_define([AS_VAR_IF],
[AS_LITERAL_WORD_IF([$1],
- [AS_IF([test "x$$1" = x""$2]],
+ [AS_IF(m4_ifval([$2], [[test "x$$1" = x[]$2]], [[${$1:+false} :]])],
[AS_VAR_COPY([as_val], [$1])
- AS_IF([test "x$as_val" = x""$2]],
- [AS_IF([eval test \"x\$"$1"\" = x"_AS_ESCAPE([$2], [`], [\"$])"]]),
+ AS_IF(m4_ifval([$2], [[test "x$as_val" = x[]$2]], [[${as_val:+false} :]])],
+ [AS_IF(m4_ifval([$2],
+ [[eval test \"x\$"$1"\" = x"_AS_ESCAPE([$2], [`], [\"$])"]],
+ [[eval \${$1:+false} :]])]),
[$3], [$4])])