libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 6/6] use print or printf or cat as $ECHO (really)


From: Ralf Wildenhues
Subject: Re: [PATCH 6/6] use print or printf or cat as $ECHO (really)
Date: Sun, 23 Nov 2008 09:10:39 +0100
User-agent: Mutt/1.5.18 (2008-05-17)

* Eric Blake wrote on Sat, Nov 22, 2008 at 03:37:03PM CET:
> According to Eric Blake on 11/22/2008 7:31 AM:
> > Maybe a better suggested test would be one that checks for either print or
> > printf (that way, a Solaris machine will let ksh pass the suggested test).
> >    Since the overall test is running with stderr silenced, we don't even
> > have to worry about messages about command not found.  In other words, why
> > not:
> > 
> > test "X`print -r -- $ECHO`" = "X$ECHO" \
> >  || test "X`printf %s $ECHO`" = X$ECHO"
> 
> Scratch that; Solaris /bin/sh passes that test, so we wouldn't favor ksh.
>  It really boils down to finding a shell with either print or a builtin
> printf, so I think we have to play the PATH games, and expend the extra
> fork in looking :(

> At least we can hard-code the fact that ZSH_VERSION or
> BASH_VERSION implies a builtin printf, to skip the forks on those shells.

You mean like this?
Are we certain enough no bash or zsh version has problems with a long
format string?

Thanks,
Ralf

        * libltdl/m4/libtool.m4 (_LT_PROG_ECHO_BACKSLASH): Fix test to
        not influence further tests registered with _AS_DETECT_SUGGESTED
        and do not use a PATH below /tmp, to avoid influence by a third
        party.

diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4
index 35d7d5c..300cfd7 100644
--- a/libltdl/m4/libtool.m4
+++ b/libltdl/m4/libtool.m4
@@ -1114,12 +1114,12 @@ esac
 
 m4_ifdef([_AS_DETECT_SUGGESTED],
 [_AS_DETECT_SUGGESTED([
-  
ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
-  ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
-  ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
-  PATH=/tmp/nonexistent; export PATH;
-  FPATH=$PATH; export FPATH;
-  test "X`printf %s $ECHO`" = "X$ECHO"])])
+  test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || {
+    
ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+    ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+    ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+    ( PATH=/empty FPATH=/empty; export PATH FPATH
+      test "X`printf %s $ECHO`" = "X$ECHO" ) }])])
 
 _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts])
 _LT_DECL([], [ECHO], [1], [An echo program that protects backslashes])




reply via email to

[Prev in Thread] Current Thread [Next in Thread]