From xemacs-m  Thu Jun  5 18:36:36 1997
Received: from sanewo.ba2.so-net.or.jp (pppba52.pppp.ap.so-net.or.jp [210.132.186.82])
	by xemacs.org (8.8.5/8.8.5) with ESMTP id SAA18794
	for <xemacs-beta@xemacs.org>; Thu, 5 Jun 1997 18:36:32 -0500 (CDT)
Received: (from sanewo@localhost) by sanewo.ba2.so-net.or.jp (8.8.5/8.7.3) id IAA02735; Fri, 6 Jun 1997 08:34:55 +0900 (JST)
To: xemacs-beta@xemacs.org
Subject: Re: b3 configure failure on FreeBSD-3.0 fix
References: <199706051107.EAA09523@xemacs.eng.sun.com>
From: Takanori Saneto <sanewo@ba2.so-net.or.jp>
In-Reply-To: Martin Buchholz's message of "Thu, 5 Jun 1997 04:07:00 -0700"
X-Emacs: Emacs 19.34.94, MULE 3.0 (MOMIJINOGA)
Mime-Version: 1.0 (generated by SEMI MIME-Edit 0.82)
Content-Type: text/plain; charset=ISO-2022-JP
Date: 06 Jun 1997 08:34:54 +0900
Message-ID: <87soywtyht.fsf@sanewo.ba2.so-net.or.jp>
Lines: 273
X-Mailer: Gnus v5.4.56 with SEMI patch/Emacs 19.34/Mule 3.0 (MOMIJINOGA)

In article <199706051107.EAA09523@xemacs.eng.sun.com>,
	Martin Buchholz <mrb@Eng.Sun.COM> writes:
>Fixed in beta 4 by abandoning echo as a mechanism.  Yes, I'm far too
>much into esthetics, and I don't want my compile commands and
>Makefiles to have random multiple blanks in them.  Programs are an art 
>form, and should be beautiful.

Oh, yes, I understand that.

Instead of abondoning echo's, how about:

	`echo $var' --> 'echo '' $var | sed -e 's/^ *//'`

This echo+sed construct is already used at several places in
configure. Is there any reason not using everywhere?

It makes the processing of configure slower. But, who cares? ;-)

original configure:
real    1m48.181s
user    0m31.386s
sys     0m46.032s

with echo+sed hack:
real    1m55.645s
user    0m31.379s
sys     0m49.335s

Here is the diff of configure.in:

(Conversions are made half-blindly. Some more cleanup may be
necessary.)

Index: configure.in
===================================================================
RCS file: /usr/local/cvs/xemacs/configure.in,v
retrieving revision 1.1.1.9
diff -u -r1.1.1.9 configure.in
--- configure.in	1997-05-31 08:17:07+09	1.1.1.9
+++ configure.in	1997-06-06 08:30:07+09
@@ -169,11 +169,11 @@
 	    eval "ac_cv_lib_$ac_lib_var=no")
 xe_check_libs=""
 ])dnl
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes" ; then
+if eval "test \"`echo '' '$ac_cv_lib_'$ac_lib_var| sed 's/^ *//'`\" = yes" ; then
   AC_MSG_RESULT(yes)
   ifelse([$3], ,
 [changequote(, )dnl
-  ac_tr_lib=HAVE_LIB`echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+  ac_tr_lib=HAVE_LIB`echo '' $1 | sed -e 's/^ *//' -e 's/[^a-zA-Z0-9_]/_/g' \
     -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
 changequote([, ])dnl
   AC_DEFINE_UNQUOTED($ac_tr_lib)
@@ -297,7 +297,7 @@
 dnl apply the * operator to that, so we remove as many leading './././'s
 dnl as are present, but some seds (like Ultrix's sed) don't allow you to
 dnl apply * to a \( \) group.  Bleah.
-progname="`echo $0 | sed 's:^\./\./:\./:'`"
+progname="`echo '' $0 | sed -e 's/^ *//' -e 's:^\./\./:\./:'`"
 
 dnl -----------------------------
 dnl Establish some default values
@@ -591,7 +591,7 @@
    -no-recursion | --no-recursion | --no-recursio | --no-recursi \
    | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
    *)
-   quoted_i="`echo $i | sed $quoted_sed_magic`"
+   quoted_i="`echo '' $i | sed -e 's/^ *//' -e $quoted_sed_magic`"
    quoted_arguments="$quoted_arguments '$quoted_i'" ;;
    esac
 done
@@ -611,8 +611,8 @@
       dnl Separate the switch name from the value it is being given.
       case "$arg" in
         -*=*)
-	  opt=`echo '' $arg | sed -e 's:^ ::' -e 's:^-*\([[^=]]*\)=.*$:\1:'`
-	  val=`echo '' $arg | sed -e 's:^ ::' -e 's:^-*[[^=]]*=\(.*\)$:\1:'`
+	  opt=`echo '' $arg | sed -e 's:^ *::' -e 's:^-*\([[^=]]*\)=.*$:\1:'`
+	  val=`echo '' $arg | sed -e 's:^ *::' -e 's:^-*[[^=]]*=\(.*\)$:\1:'`
 	  valomitted=no
 	;;
            dnl special case these strings since echo may silently eat them:
@@ -625,7 +625,7 @@
            dnl If FOO is a boolean argument, --FOO is equivalent to
            dnl --FOO=yes.  Otherwise, the value comes from the next
            dnl argument - see below.
-	  opt=`echo '' $arg | sed -e 's:^ ::' -e 's:^-*\(.*\)$:\1:'`
+	  opt=`echo '' $arg | sed -e 's:^ *::' -e 's:^-*\(.*\)$:\1:'`
           val="yes"
           valomitted=yes
         ;;
@@ -633,7 +633,7 @@
 
       dnl translate "-" in option string to "_"
       optname="$opt"
-      opt="`echo '' $opt | sed -e 's:^ ::' | tr - _`"
+      opt="`echo '' $opt | sed -e 's:^ *::' | tr - _`"
 
       dnl Process the option.
       case "$opt" in
@@ -736,7 +736,7 @@
 	  with_database_berkdb=no
 	  with_database_dbm=no
 	  with_database_gnudbm=no
-	  for x in `echo "$val" | sed 's/,/ /'` ; do
+	  for x in `echo '' "$val" | sed -e 's/^ *//' -e 's/,/ /'` ; do
 	    case "$x" in
 		no ) ;;
 		b | be | ber | berk | berkd | berkdb )  with_database_berkdb=yes ;;
@@ -801,7 +801,7 @@
 	  dnl Example: --error-checking=all,noextents,nobufpos
 	  dnl Example: --error-checking=none,malloc,gc
 
-	  for x in `echo "$val" | sed 's/,/ /'` ; do
+	  for x in `echo '' "$val" | sed -e 's/^ *//' -e 's/,/ /'` ; do
 	    case "$x" in
 	      dnl all and none are only permitted as the first in the list.
 	      n | no | non | none ) new_default=no ;;
@@ -942,7 +942,7 @@
 
 dnl Allow use of either ":" or spaces for lists of directories
 define(COLON_TO_SPACE,
-  [case "[$1]" in *:* [)] [$1]="`echo $[$1] | sed 's/:/ /g'`";; esac])dnl
+  [case "[$1]" in *:* [)] [$1]="`echo '' $[$1] | sed -e 's/^ *//' -e 's/:/ /g'`";; esac])dnl
 COLON_TO_SPACE(site_includes)
 COLON_TO_SPACE(site_libraries)
 COLON_TO_SPACE(site_runtime_libraries)
@@ -959,7 +959,7 @@
 if test "$configuration" = "" ; then
   echo '- You did not tell me what kind of host system you want to configure.
 - I will attempt to guess the kind of system this is.' 1>&2
-  guesssys=`echo $progname | sed 's/configure$/config.guess/'`
+  guesssys=`echo '' $progname | sed -e 's/^ *//' -e 's/configure$/config.guess/'`
   dnl Guess the configuration and remove 4th name component, if present.
   if configuration=`${CONFIG_SHELL-/bin/sh} $guesssys | \
       sed '[s/^\([^-][^-]*-[^-][^-]*-[^-][^-]*\)-.*$/\1/]'` ; then
@@ -974,7 +974,7 @@
 
   dnl If srcdir is not specified, see if  "." or ".." might work.
   "" )
-    for dir in "`echo $0 | sed 's|//|/|' | sed 's|/[[^/]]*$||'`" "." ".." ; do
+    for dir in "`echo '' $0 | sed -e 's/^ *//' -e 's|//|/|' | sed 's|/[[^/]]*$||'`" "." ".." ; do
       if test -f "$dir/src/lisp.h" -a \
 	      -f "$dir/lisp/version.el" ; then
         srcdir="$dir"
@@ -1062,7 +1062,7 @@
 dnl Canonicalize the configuration name.
 AC_CHECKING("the configuration name")
 dnl allow -energize or -workshop suffix on configuration name
-internal_configuration=`echo $configuration | sed 's/-\(energize\|workshop\)//'`
+internal_configuration=`echo '' $configuration | sed -e 's/^ *//' -e 's/-\(energize\|workshop\)//'`
 if canonical=`$srcdir/config.sub "$internal_configuration"` ; then : ; else
   exit $?
 fi
@@ -1424,7 +1424,7 @@
 
     dnl Make $canonical even more so.
     case "$canonical" in *-sunos5*)
-      canonical="`echo \"$canonical\" | sed -e s/sunos5/solaris2/`";;
+      canonical="`echo '' \"$canonical\" | sed -e 's/^ *//' -e s/sunos5/solaris2/`";;
     esac
 
     dnl On SunOS 4, use /usr/lib/cpp,     sans dynodump, /bin/ranlib
@@ -1708,14 +1708,14 @@
 ' > $tempcname
 dnl The value of CPP is a quoted variable reference, so we need to do this
 dnl to get its actual value...
-CPP=`eval "echo $CPP"`
+CPP=`eval "echo '' $CPP | sed 's/^ *//'"`
 eval `$CPP -Isrc $tempcname \
        | grep 'configure___' \
-       | sed -n -e 's/^configure___ \([[^= ]]* *=\)\(.*\)$/\1\`echo \2\`/p'`
+       | sed -n -e 's/^configure___ \([[^= ]]* *=\)\(.*\)$/\1\`echo '"\'\'"' \2\| sed '"'"'s:^ *::'"'"'\`/p'`
 if test -z "$SPECIFIED_CFLAGS"; then
   eval `$CPP -Isrc -DTHIS_IS_CONFIGURE $tempcname \
 	 | grep 'configure___' \
-	 | sed -n -e 's/^configure___ \([[^= ]]* *=\)\(.*\)$/\1\`echo \2\`/p'`
+	 | sed -n -e 's/^configure___ \([[^= ]]* *=\)\(.*\)$/\1\`echo '"\'\'"' \2\| sed '"'"'s:^ *::'"'"'\`/p'`
 else
   REAL_CFLAGS="$CFLAGS"
 fi
@@ -1758,7 +1758,7 @@
 
 dnl --site-runtime-libraries (multiple dirs)
 if test -n "$site_runtime_libraries" ; then
-  LD_RUN_PATH="`echo $site_runtime_libraries | sed 's/ 	*/:/'`"
+  LD_RUN_PATH="`echo '' $site_runtime_libraries | sed -e 's/^ *//' -e 's/ 	*/:/'`"
   export LD_RUN_PATH
 fi
 
@@ -1794,8 +1794,8 @@
 define([XE_COMPUTE_RUNPATH],[
 if test "$add_runtime_path" = "yes" -a -n "$dash_r"; then
   dnl Remove runtime paths from current ld switches
-  ld_switch_site="`echo $ld_switch_site     | sed \"s/${dash_r}[[^ ]]*//\"`"
-  ld_switch_x_site="`echo $ld_switch_x_site | sed \"s/${dash_r}[[^ ]]*//\"`"
+  ld_switch_site="`echo '' $ld_switch_site     | sed -e 's/^ *//' -e \"s/${dash_r}[[^ ]]*//\"`"
+  ld_switch_x_site="`echo '' $ld_switch_x_site | sed -e 's/^ *//' -e \"s/${dash_r}[[^ ]]*//\"`"
   dnl PRINT_VAR(ld_switch_site, ld_switch_x_site)
 
   dnl Fix up Runtime path
@@ -1808,7 +1808,7 @@
     runpath=""
     for arg in $ld_switch_site $ld_switch_x_site; do
       case "$arg" in -L* )
-	dir=`echo "$arg" | sed 's/^-L//'`
+	dir=`echo '' "$arg" | sed 's/^ *-L//'`
 	if test -n "`ls ${dir}/*.s[[ol]] 2>/dev/null`"; then
 	  test -n "$runpath" && runpath="${runpath}:"
 	  runpath="${runpath}${dir}"
@@ -2020,7 +2020,7 @@
   dnl Try to find Motif/CDE/Tooltalk dirs
   dnl These take precedence over other X libs/includes, so PRE-pend
   for lib_dir in "/usr/dt/lib" "/usr/lib/Motif1.2" "/usr/lib/Motif1.1"; do
-    inc_dir="`echo $lib_dir | sed 's/lib/include/'`"
+    inc_dir="`echo '' $lib_dir | sed -e 's/^ *//' -e 's/lib/include/'`"
     if test -d "$lib_dir" -a -d "$inc_dir"; then
       case "$x_libraries" in *"$lib_dir"* ) ;; *)
         x_libraries="$lib_dir $x_libraries"
@@ -2929,15 +2929,15 @@
 dnl --------------------------------
 dnl We ignore (C|LD)_SWITCH_X_(MACHINE|SYSTEM)
 dnl Use `echo ...` to remove extraneous blanks
-c_switch_general=`echo -DHAVE_CONFIG_H $c_switch_site $c_switch_machine $c_switch_system`
-c_switch_window_system=`echo $c_switch_x_site $X_CFLAGS`
-c_switch_all=`echo $c_switch_general $c_switch_window_system`
-ld_switch_general=`echo $ld_switch_site $ld_switch_machine $ld_switch_system $ld_switch_run`
-ld_switch_window_system=`echo $ld_switch_x_site`
-ld_switch_all=`echo $ld_switch_general $ld_switch_window_system`
-ld_libs_general=`echo $LIBS $libs_machine $libs_system $libs_standard`
-ld_libs_window_system=`echo $X_EXTRA_LIBS $libs_x $X_PRE_LIBS`
-ld_libs_all=`echo $ld_libs_window_system $ld_libs_general`
+c_switch_general=`echo '' -DHAVE_CONFIG_H $c_switch_site $c_switch_machine $c_switch_system | sed 's/^ *//'`
+c_switch_window_system=`echo '' $c_switch_x_site $X_CFLAGS | sed 's/^ *//'`
+c_switch_all=`echo '' $c_switch_general $c_switch_window_system | sed 's/^ *//'`
+ld_switch_general=`echo '' $ld_switch_site $ld_switch_machine $ld_switch_system $ld_switch_run | sed 's/^ *//'`
+ld_switch_window_system=`echo '' $ld_switch_x_site | sed 's/^ *//'`
+ld_switch_all=`echo '' $ld_switch_general $ld_switch_window_system | sed 's/^ *//'`
+ld_libs_general=`echo '' $LIBS $libs_machine $libs_system $libs_standard | sed 's/^ *//'`
+ld_libs_window_system=`echo '' $X_EXTRA_LIBS $libs_x $X_PRE_LIBS | sed 's/^ *//'`
+ld_libs_all=`echo '' $ld_libs_window_system $ld_libs_general | sed 's/^ *//'`
 
 dnl Compute lists of Makefiles and subdirs
 SRC_SUBDIR_DEPS="$MAKE_SUBDIR"
@@ -2948,8 +2948,8 @@
 test -d lock || mkdir lock
 for dir in $MAKE_SUBDIR; do
   test -d "$dir" || mkdir "$dir"
-  SUBDIR_MAKEFILES=`echo $SUBDIR_MAKEFILES $dir/Makefile`
-  internal_makefile_list=`echo $internal_makefile_list $dir/Makefile.in`
+  SUBDIR_MAKEFILES=`echo '' $SUBDIR_MAKEFILES $dir/Makefile | sed 's/^ *//'`
+  internal_makefile_list=`echo '' $internal_makefile_list $dir/Makefile.in | sed 's/^ *//'`
 done
 AC_SUBST(MAKE_SUBDIR)
 AC_SUBST(SUBDIR_MAKEFILES)
@@ -3232,9 +3232,9 @@
 AC_SUBST(internal_makefile_list)
 # Remove any trailing slashes in these variables.
 test -n "$prefix" &&
-  prefix=`echo "$prefix" | sed 's,\([[^/]]\)/*$,\1,'`
+  prefix=`echo '' "$prefix" | sed -e 's/^ *//' -e 's,\([[^/]]\)/*$,\1,'`
 test -n "$exec_prefix" &&
-  exec_prefix=`echo "$exec_prefix" | sed 's,\([[^/]]\)/*$,\1,'`
+  exec_prefix=`echo '' "$exec_prefix" | sed -e 's/^ *//' -e 's,\([[^/]]\)/*$,\1,'`
 
 dnl Build Makefile.in's from Makefile.in.in's
 dnl except ./Makefile from $srcdir/Makefile.in

-- 
$B$5$M$r(B (SANETO Takanori)             // [$B<qL#(B] $BK\6H$r$9$k$3$H(B //
$B!&!&!&!&!&!&!&!&!&!&!&!&!&!&!&!&!&!&(B //    Bonjour Chapeau    //
<URL:mailto:sanewo@ba2.so-net.or.jp> // [$BK\6H(B] $B<qL#$KAv$k$3$H(B //

