diff options
author | Gary V. Vaughan <gary@gnu.org> | 2013-01-28 10:44:45 +0700 |
---|---|---|
committer | Gary V. Vaughan <gary@gnu.org> | 2013-01-29 16:47:48 +0700 |
commit | 2b59b6f8a79b8bf77e178ff4e5aa0ede433d39cf (patch) | |
tree | 36462f9e7d254e88968a82bfac61611d012b4f99 /lib/m4sugar | |
parent | bea5177adc0c924fe7483509a5e38a6d49319fcb (diff) | |
download | autoconf-2b59b6f8a79b8bf77e178ff4e5aa0ede433d39cf.tar.gz |
m4sugar: factor away _AS_ECHO_PREPARE.
"printf '%s\n' ..." has been a fine replacement for plain "echo"
for at least 5 years (probably more like 10), even with most
museum-piece shells.
* lib/m4sugar/m4sh.m4 (_AS_ECHO_PREPARE): Remove.
(_AS_SHELL_SANITIZE): Keep as_nl setting originally from
_AS_ECHO_PREPARE here where it more properly belongs.
(AS_ECHO, AS_ECHO_N): Use printf unconditionally.
* doc/autoconf.texi (Limitations of Shell Builtins): Document
preference for 'printf' over working around 'echo' bugs.
* NEWS: Updated.
Reported by Jim Meyering.
Diffstat (limited to 'lib/m4sugar')
-rw-r--r-- | lib/m4sugar/m4sh.m4 | 60 |
1 files changed, 7 insertions, 53 deletions
diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4 index 25b4fe35..479c2d91 100644 --- a/lib/m4sugar/m4sh.m4 +++ b/lib/m4sugar/m4sh.m4 @@ -453,7 +453,6 @@ m4_defun([_AS_SHELL_SANITIZE], [m4_text_box([M4sh Initialization.]) AS_BOURNE_COMPATIBLE -_AS_ECHO_PREPARE _AS_PATH_SEPARATOR_PREPARE # IFS @@ -461,6 +460,9 @@ _AS_PATH_SEPARATOR_PREPARE # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) +as_nl=' +' +export as_nl IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. @@ -1023,63 +1025,15 @@ fi # Output WORD followed by a newline. WORD must be a single shell word # (typically a quoted string). The bytes of WORD are output as-is, even # if it starts with "-" or contains "\". -m4_defun_init([AS_ECHO], -[AS_REQUIRE([_$0_PREPARE])], -[$as_echo $1]) +m4_defun([AS_ECHO], +[printf '%s\n' $1]) # AS_ECHO_N(WORD) # --------------- # Like AS_ECHO(WORD), except do not output the trailing newline. -m4_defun_init([AS_ECHO_N], -[AS_REQUIRE([_AS_ECHO_PREPARE])], -[$as_echo_n $1]) - - -# _AS_ECHO_PREPARE -# ---------------- -# Arrange for $as_echo 'FOO' to echo FOO without escape-interpretation; -# and similarly for $as_echo_n, which omits the trailing newline. -# 'FOO' is an optional single argument; a missing FOO is treated as empty. -m4_defun([_AS_ECHO_PREPARE], -[[as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$][1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$][1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$][1; - case $arg in @%:@( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi -]])# _AS_ECHO_PREPARE +m4_defun([AS_ECHO_N], +[printf %s $1]) # AS_TEST_X |