[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 6/6] use printf as $ECHO
From: |
Paolo Bonzini |
Subject: |
Re: [PATCH 6/6] use printf as $ECHO |
Date: |
Sat, 08 Nov 2008 11:13:32 +0100 |
User-agent: |
Thunderbird 2.0.0.17 (Macintosh/20080914) |
>> M4SH_VERBATIM([[
>
> Hmm. This is a nicer name for m4_echo, for how it is being used; maybe it is
> time to migrated it into the Autoconf manual (perhaps under the name
> AS_VERBATIM)?
Maybe, yes.
>> : ${CP="cp -f"}
>> -: ${ECHO="echo"}
>> +: ${ECHO=$as_echo}
>
> This is delving a bit into m4sh internals ($as_echo is undocumented, only
> AS_ECHO is public), but it seems a lot less painful to maintain than what
> this
> patch is replacing. Maybe it's time to create/document AS_ECHO_PREPARE as
> the
> kosher way to get $as_echo?
Don't know, sooner or later Libtool will use more M4sh and less sh, and
these will disappear.
>> +AC_MSG_CHECKING([for a working printf])
>
> This looks a bit confusing in configure output; would it be better to
> state "printf(1)" rather than "printf" (since many people think of printf(3)
> first)?
I'll leave this to Ralf to judge.
>> +if test "X`printf %s $ECHO`" = "X$ECHO"; then
>> + ECHO='printf %s\n'
>
> Just for safety, shouldn't the test use '%s\n' rather than bare %s (in other
> words, make our test match our usage pattern)?
_AS_ECHO_PREPARE does the same...
>> + for as_base in sh bash ksh zsh sh5; do
>> + as_shell=$as_dir/$as_base
>> + test -f "$as_shell" || test -f "$as_shell.exe" || continue
>
> On the other hand, your copy-n-paste means that you are using a lot of m4sh
> variables; it would be a bit nicer to see these in the lt_ namespace rather
> than as_.
Ok.
>> + lt_func_ECHO='func_do_echo () { '$as_shell' -c "$lt_cmd_ECHO" x "$[]
> 1";}'
>
> This fallback forks for every echo. Can't we rely on $as_echo (if it is
> builtin) rather than having to find an external program?
I know, but especially on newer Autoconfs that have
_AS_DETECT_SUGGESTED, are you sure we will never find a shell that has
functions and LINENO but not printf? I think only pdksh does this.
Also, if this fallback was used in practice, Autoconf would use the
expr-based echo fallback on that system which would be really slow...
>> +case "$ECHO" in
>> + printf*) AC_MSG_RESULT([shell builtin]) ;;
>> + */printf*) AC_MSG_RESULT([$as_dir/printf]) ;;
>
> I guess we aren't worried about mingw \ directory separators? On the other
> hand, any shell ported to mingw tends to have working print.
No, you're right, it should be *${PATH_SEPARATOR}printf*.
> I may have missed something, but it seems like this patch now requires that
> the
> $ECHO solution be based on 'printf', even if a shell has a builtin 'echo'
> that
> fills the job. Is it worth still checking whether 'echo' fits the bill, in
> case it can avoid the forks of lt_func_ECHO?
The point of this patch series is that apparently Autoconf now thinks
printf is better than echo.
Paolo
- [PATCH 6/6] use printf as $ECHO, Paolo Bonzini, 2008/11/07
- Re: [PATCH 6/6] use printf as $ECHO, Eric Blake, 2008/11/07
- Re: [PATCH 6/6] use printf as $ECHO,
Paolo Bonzini <=
- Re: [PATCH 6/6] use printf as $ECHO, Ralf Wildenhues, 2008/11/09
- Re: [PATCH 6/6] use printf as $ECHO, Paolo Bonzini, 2008/11/10
- Re: [PATCH 6/6] use print or printf or cat as $ECHO, Paolo Bonzini, 2008/11/10
- Re: [PATCH 6/6] use print or printf or cat as $ECHO (really), Paolo Bonzini, 2008/11/10
- Re: [PATCH 6/6] use print or printf or cat as $ECHO (really), Ralf Wildenhues, 2008/11/10
- Re: [PATCH 6/6] use print or printf or cat as $ECHO (really), Paolo Bonzini, 2008/11/10
- Re: [PATCH 6/6] use print or printf or cat as $ECHO (really), Ralf Wildenhues, 2008/11/11
- Re: [PATCH 6/6] use print or printf or cat as $ECHO (really), Ralf Wildenhues, 2008/11/22
- Re: [PATCH 6/6] use print or printf or cat as $ECHO (really), Paolo Bonzini, 2008/11/22
- Re: [PATCH 6/6] use print or printf or cat as $ECHO (really), Eric Blake, 2008/11/22