+2008-11-10 Eric Blake <ebb9@byu.net>
+
+ 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.
+
2008-11-10 Eric Blake <ebb9@byu.net>
Provide a section on all tools allowed in GNU Coding Standards.
@command{/bin/sh} the command @samp{printf %010000x 123} normally dumps
core.
+Since @command{printf} is not always a shell builtin, there is a
+potential speed penalty for using @code{printf %s\\n} as a replacement
+for an @command{echo} that does not interpret @samp{\} or leading
+@samp{-}. With Solaris @command{ksh}, it is possible to use @code{print
+-r --} for this role instead.
+
@item @command{pwd}
@c ----------------
# _AS_ECHO_PREPARE
# -----------------
# Arrange for $as_echo 'FOO' to echo FOO without escape-interpretation;
-# and similarly for $as_echo_foo, which omits the trailing newline.
+# 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='
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
-if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+# 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