diff --git a/ChangeLog b/ChangeLog index 7833c3fb..3478afd4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,22 @@ +Thu Aug 28 20:58:56 1997 Gordon Matzigkeit + + * ltmain.sh.in (echo): Change test to one that uses printf. + This works on AIX, which has the same problems that Solaris does, + but no working echo program. + Wed Aug 27 09:54:21 1997 Gordon Matzigkeit * ltmain.sh.in (link): Make sure that compile_command and finalize_command are always evaled. Quote any unknown linker flags we need to pass through. + (compile): Use quoting for flags we pass. + (echo): I hate Sun! The /usr/bin/echo on Solaris handles + backslash sequences, which makes it impossible to do backslash + quoting using echo and sed. So, we search for an echo that obeys + the `echo '\t'` = '\t' equality. Then we use `$echo' everywhere + in ltmain.sh. + Put tabs back into the ${IFS= } sequences. Emacs untabify is + libtool bane. * ltconfig.in: Quote all variable values that may contain metacharacters creating the libtool script. This provides diff --git a/NEWS b/NEWS index f6d50183..fc094fde 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,8 @@ New in 1.0b: * Suppress duplicate compiler output during `compile' mode. * New `execute' mode to support debugging uninstalled libtool libraries and executables. +* New quoting code to robustly handle any metacharacters passed in + arguments to libtool commands. * Deleted `dlname' mode. Dlopen applications should only use the runtime search method described in (libtool)Finding the dlname. * Experimental support for dynamically loaded modules, even on diff --git a/TODO b/TODO index 277d254f..d5b08349 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,14 @@ For next public release: ************************ +* #@%$ing SUN makes their Solaris /usr/bin/echo always interpret +backslashes, so: + var='\n' + newvar=`echo "$var"` + test "$var" = "$newvar" +returns false. We need to detect this, and use the other +echo (/usr/ucb/echo). + * Document `execute' mode, and the experimental nature of -dlopen and -dlpreopen. diff --git a/ltmain.sh.in b/ltmain.sh.in index 9eaa2b5f..69effa30 100644 --- a/ltmain.sh.in +++ b/ltmain.sh.in @@ -22,8 +22,34 @@ # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. +echo=echo +if test X`$echo '\t'` = 'X\t'; then : +else + # The Solaris and AIX default echo program unquotes backslashes. + # This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # So, we emulate echo with printf '%s\n' + echo='printf %s\n' + if test X`$echo '\t'` = 'X\t'; then : + else + # Oops. We have no working printf. Try to find a not-so-buggy echo. + echo=echo + IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" + save_PATH="$PATH" + PATH="$PATH":/usr/ucb + for dir in $PATH; do + if test -f $dir/echo && test X`$dir/echo '\t'` = 'X\t'; then + echo="$dir/echo" + break + fi + done + IFS="$save_ifs" + PATH="$save_PATH" + fi +fi + # The name of this program. -progname=`echo "$0" | sed 's%^.*/%%'` +progname=`$echo "$0" | sed 's%^.*/%%'` # Constants. PROGRAM=ltmain.sh @@ -50,15 +76,15 @@ if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi if test "${LANG+set}" = set; then LANG=C; export LANG; fi if test "$LTCONFIG_VERSION" != "$VERSION"; then - echo "$progname: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2 - echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + $echo "$progname: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2 + $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit 1 fi # if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then - echo "$progname: not configured to build any kind of library" 1>&2 - echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + $echo "$progname: not configured to build any kind of library" 1>&2 + $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit 1 fi @@ -68,7 +94,7 @@ nonopt= prev= prevopt= run= -show=echo +show="$echo" show_help= execute_dlfiles= @@ -79,7 +105,7 @@ do shift case "$arg" in - -*=*) optarg=`echo "$arg" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + -*=*) optarg=`$echo "$arg" | sed 's/[-_a-zA-Z0-9]*=//'` ;; *) optarg= ;; esac @@ -106,7 +132,7 @@ do ;; --version) - echo "$PROGRAM (GNU $PACKAGE) $VERSION" + $echo "$PROGRAM (GNU $PACKAGE) $VERSION" exit 0 ;; @@ -115,16 +141,16 @@ do ;; --features) - echo "host: $host" + $echo "host: $host" if test "$build_libtool_libs" = yes; then - echo "enable shared libraries" + $echo "enable shared libraries" else - echo "disable shared libraries" + $echo "disable shared libraries" fi if test "$build_old_libs" = yes; then - echo "enable static libraries" + $echo "enable static libraries" else - echo "disable static libraries" + $echo "disable static libraries" fi exit 0 ;; @@ -144,8 +170,8 @@ do ;; -*) - echo "$progname: unrecognized option \`$arg'" 1>&2 - echo "$help" 1>&2 + $echo "$progname: unrecognized option \`$arg'" 1>&2 + $echo "$help" 1>&2 exit 1 ;; @@ -157,8 +183,8 @@ do done if test -n "$prevopt"; then - echo "$progname: option \`$prevopt' requires an argument" 1>&2 - echo "$help" 1>&2 + $echo "$progname: option \`$prevopt' requires an argument" 1>&2 + $echo "$help" 1>&2 exit 1 fi @@ -195,9 +221,9 @@ if test -z "$show_help"; then # Just use the default operation mode. if test -z "$mode"; then if test -n "$nonopt"; then - echo "$progname: warning: cannot infer operation mode from \`$nonopt'" 1>&2 + $echo "$progname: warning: cannot infer operation mode from \`$nonopt'" 1>&2 else - echo "$progname: warning: cannot infer operation mode without MODE-ARGS" 1>&2 + $echo "$progname: warning: cannot infer operation mode without MODE-ARGS" 1>&2 fi fi ;; @@ -206,8 +232,8 @@ if test -z "$show_help"; then # Only execute mode is allowed to have -dlopen flags. if test -n "$execute_dlfiles" && test "$mode" != execute; then - echo "$progname: unrecognized option \`-dlopen'" 1>&2 - echo "$help" 1>&2 + $echo "$progname: unrecognized option \`-dlopen'" 1>&2 + $echo "$help" 1>&2 exit 1 fi @@ -230,8 +256,8 @@ if test -z "$show_help"; then do # The only flag that cannot be specified is the output filename. if test "X$arg" = "X-o"; then - echo "$progname: you cannot specify the output filename with \`-o'" 1>&2 - echo "$help" 1>&2 + $echo "$progname: you cannot specify the output filename with \`-o'" 1>&2 + $echo "$help" 1>&2 exit 1 fi @@ -244,7 +270,7 @@ if test -z "$show_help"; then # Backslashify any backslashes, double quotes, and dollar signs. # These are the only characters that are still specially # interpreted inside of double-quoted scrings. - lastarg=`echo "$lastarg" | sed "$sed_quote_subst"` + lastarg=`$echo "$lastarg" | sed "$sed_quote_subst"` # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly in scan @@ -264,7 +290,7 @@ if test -z "$show_help"; then done # Get the name of the library object. - libobj=`echo "$srcfile" | sed -e 's%^.*/%%'` + libobj=`$echo "$srcfile" | sed -e 's%^.*/%%'` # Recognize several different file suffixes. xform='[cCFSfm]' @@ -277,19 +303,19 @@ if test -z "$show_help"; then *.for) xform=for ;; esac - libobj=`echo "$libobj" | sed -e "s/\.$xform$/.lo/"` + libobj=`$echo "$libobj" | sed -e "s/\.$xform$/.lo/"` case "$libobj" in - *.lo) obj=`echo "$libobj" | sed -e 's/\.lo$/.o/'` ;; + *.lo) obj=`$echo "$libobj" | sed -e 's/\.lo$/.o/'` ;; *) - echo "$progname: cannot determine name of library object from \`$srcfile'" 1>&2 + $echo "$progname: cannot determine name of library object from \`$srcfile'" 1>&2 exit 1 ;; esac if test -z "$base_compile"; then - echo "$progname: you must specify a compilation command" 1>&2 - echo "$help" 1>&2 + $echo "$progname: you must specify a compilation command" 1>&2 + $echo "$help" 1>&2 exit 1 fi @@ -341,8 +367,8 @@ if test -z "$show_help"; then # Create an invalid libtool object if no PIC, so that we don't accidentally # link it into a program. if test "$build_libtool_libs" != yes; then - $show "echo timestamp > $libobj" - $run eval "echo timestamp > \$libobj" || exit $? + $show "$echo timestamp > $libobj" + $run eval "$echo timestamp > \$libobj" || exit $? fi exit 0 @@ -382,7 +408,7 @@ if test -z "$show_help"; then -static) if test "$build_libtool_libs" = yes; then if test "$hardcode_direct" = unsupported && test -z "$link_static_flag"; then - echo "$progname: warning: static linking is impossible in this configuration" 1>&2 + $echo "$progname: warning: static linking is impossible in this configuration" 1>&2 else build_libtool_libs=no fi @@ -445,7 +471,7 @@ if test -z "$show_help"; then -export-dynamic) if test "$export_dynamic" != yes; then export_dynamic=yes - arg=`eval echo "$export_dynamic_flag_spec"` + arg=`eval $echo "$export_dynamic_flag_spec"` # Add the symbol object into the linking commands. compile_command="$compile_command @SYMFILE@" @@ -454,12 +480,12 @@ if test -z "$show_help"; then ;; -L*) - dir=`echo "$arg" | sed 's%^-L\(.*\)$%\1%'` + dir=`$echo "$arg" | sed 's%^-L\(.*\)$%\1%'` case "$dir" in /*) ;; *) - echo "$progname: \`-L$dir' cannot specify a relative directory" 1>&2 + $echo "$progname: \`-L$dir' cannot specify a relative directory" 1>&2 exit 1 ;; esac @@ -491,7 +517,7 @@ if test -z "$show_help"; then -*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. - arg=`echo "$arg" | sed "$sed_quote_subst"` + arg=`$echo "$arg" | sed "$sed_quote_subst"` case "$arg" in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" @@ -519,7 +545,7 @@ if test -z "$show_help"; then if test "$prev" = dlprefiles; then # Preload the old-style object. - dlprefiles="$dlprefiles "`echo "$arg" | sed 's/\.lo$/\.o/'` + dlprefiles="$dlprefiles "`$echo "$arg" | sed 's/\.lo$/\.o/'` prev= fi libobjs="$libobjs $arg" @@ -536,7 +562,7 @@ if test -z "$show_help"; then # Check to see that this really is a libtool archive. if egrep "^# Generated by ltmain.sh" $arg >/dev/null 2>&1; then : else - echo "$progname: \`$arg' is not a valid libtool archive" 1>&2 + $echo "$progname: \`$arg' is not a valid libtool archive" 1>&2 exit 1 fi @@ -547,7 +573,7 @@ if test -z "$show_help"; then esac if test -z "$libdir"; then - echo "$progname: \`$arg' contains no -rpath information" 1>&2 + $echo "$progname: \`$arg' contains no -rpath information" 1>&2 exit 1 fi @@ -558,13 +584,13 @@ if test -z "$show_help"; then done if test -z "$linklib"; then - echo "$progname: cannot find name of link library for \`$arg'" 1>&2 + $echo "$progname: cannot find name of link library for \`$arg'" 1>&2 exit 1 fi # Find the relevant object directory and library name. - name=`echo "$arg" | sed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'` - dir=`echo "$arg" | sed 's%/[^/]*$%%'` + name=`$echo "$arg" | sed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'` + dir=`$echo "$arg" | sed 's%/[^/]*$%%'` if test "X$dir" = "X$arg"; then dir="$objdir" else @@ -621,7 +647,7 @@ if test -z "$show_help"; then fi if test -n "$libdir"; then - flag=`eval echo \"$hardcode_libdir_flag_spec\"` + flag=`eval $echo \"$hardcode_libdir_flag_spec\"` compile_command="$compile_command $flag" finalize_command="$finalize_command $flag" @@ -654,7 +680,7 @@ if test -z "$show_help"; then *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then - echo "$progname: cannot determine absolute directory name of \`$dir'" 1>&2 + $echo "$progname: cannot determine absolute directory name of \`$dir'" 1>&2 exit 1 fi dir="$absdir" @@ -672,7 +698,7 @@ if test -z "$show_help"; then ;; *) - echo "$progname: \`$hardcode_action' is an unknown hardcode action" 1>&2 + $echo "$progname: \`$hardcode_action' is an unknown hardcode action" 1>&2 exit 1 ;; esac @@ -692,7 +718,7 @@ if test -z "$show_help"; then else # Transform directly to old archives if we don't build new libraries. if test -n "$pic_flag" && test -z "$old_library"; then - echo "$progname: cannot find static library for \`$arg'" 1>&2 + $echo "$progname: cannot find static library for \`$arg'" 1>&2 exit 1 fi @@ -711,8 +737,8 @@ if test -z "$show_help"; then ;; *) - echo "$progname: unknown file suffix for \`$arg'" 1>&2 - echo "$help" 1>&2 + $echo "$progname: unknown file suffix for \`$arg'" 1>&2 + $echo "$help" 1>&2 exit 1 ;; esac @@ -723,33 +749,33 @@ if test -z "$show_help"; then done if test -n "$prev"; then - echo "$progname: the \`$prevarg' option requires an argument" 1>&2 - echo "$help" 1>&2 + $echo "$progname: the \`$prevarg' option requires an argument" 1>&2 + $echo "$help" 1>&2 exit 1 fi # Substitute the hardcoded libdirs into the compile commands. if test -n "$hardcode_libdir_separator"; then - compile_command=`echo "$compile_command" | sed "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"` - finalize_command=`echo "$finalize_command" | sed "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"` + compile_command=`$echo "$compile_command" | sed "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"` + finalize_command=`$echo "$finalize_command" | sed "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"` fi oldlib= oldobjs= case "$output" in "") - echo "$progname: you must specify an output file" 1>&2 - echo "$help" 1>&2 + $echo "$progname: you must specify an output file" 1>&2 + $echo "$help" 1>&2 exit 1 ;; */*) - echo "$progname: output file \`$output' must have no directory components" 1>&2 + $echo "$progname: output file \`$output' must have no directory components" 1>&2 exit 1 ;; *.la) - libname=`echo "$output" | sed 's/\.la$//'` + libname=`$echo "$output" | sed 's/\.la$//'` # All the library-specific variables (install_libdir is set above). library_names= @@ -760,36 +786,36 @@ if test -z "$show_help"; then age=0 if test -n "$objs"; then - echo "$progname: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1 + $echo "$progname: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1 exit 1 fi # How the heck are we supposed to write a wrapper for a shared library? if test -n "$link_against_libtool_libs"; then - echo "$progname: libtool library \`$output' may not depend on uninstalled libraries:$link_against_libtool_libs" 1>&2 + $echo "$progname: libtool library \`$output' may not depend on uninstalled libraries:$link_against_libtool_libs" 1>&2 exit 1 fi if test -n "$dlfiles$dlprefiles"; then - echo "$progname: warning: \`-dlopen' is ignored while creating libtool libraries" 1>&2 + $echo "$progname: warning: \`-dlopen' is ignored while creating libtool libraries" 1>&2 # Nullify the symbol file. - compile_command=`echo "$compile_command" | sed "s% @SYMFILE@%%"` - finalize_command=`echo "$finalize_command" | sed "s% @SYMFILE@%%"` + compile_command=`$echo "$compile_command" | sed "s% @SYMFILE@%%"` + finalize_command=`$echo "$finalize_command" | sed "s% @SYMFILE@%%"` fi if test -z "$install_libdir"; then - echo "$progname: you must specify an installation directory with \`-rpath'" 1>&2 + $echo "$progname: you must specify an installation directory with \`-rpath'" 1>&2 exit 1 fi # Parse the version information argument. - IFS="${IFS= }"; save_ifs="$IFS"; IFS=':' + IFS="${IFS= }"; save_ifs="$IFS"; IFS=':' set dummy $vinfo IFS="$save_ifs" if test -n "$5"; then - echo "$progname: too many parameters to \`-version-info'" 1>&2 - echo "$help" 1>&2 + $echo "$progname: too many parameters to \`-version-info'" 1>&2 + $echo "$help" 1>&2 exit 1 fi @@ -801,8 +827,8 @@ if test -z "$show_help"; then case "$current" in 0 | [1-9] | [1-9][0-9]*) ;; *) - echo "$progname: CURRENT \`$current' is not a nonnegative integer" 1>&2 - echo "$progname: \`$vinfo' is not valid version information" 1>&2 + $echo "$progname: CURRENT \`$current' is not a nonnegative integer" 1>&2 + $echo "$progname: \`$vinfo' is not valid version information" 1>&2 exit 1 ;; esac @@ -810,8 +836,8 @@ if test -z "$show_help"; then case "$revision" in 0 | [1-9] | [1-9][0-9]*) ;; *) - echo "$progname: REVISION \`$revision' is not a nonnegative integer" 1>&2 - echo "$progname: \`$vinfo' is not valid version information" 1>&2 + $echo "$progname: REVISION \`$revision' is not a nonnegative integer" 1>&2 + $echo "$progname: \`$vinfo' is not valid version information" 1>&2 exit 1 ;; esac @@ -819,15 +845,15 @@ if test -z "$show_help"; then case "$age" in 0 | [1-9] | [1-9][0-9]*) ;; *) - echo "$progname: AGE \`$age' is not a nonnegative integer" 1>&2 - echo "$progname: \`$vinfo' is not valid version information" 1>&2 + $echo "$progname: AGE \`$age' is not a nonnegative integer" 1>&2 + $echo "$progname: \`$vinfo' is not valid version information" 1>&2 exit 1 ;; esac if test $age -gt $current; then - echo "$progname: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 - echo "$progname: \`$vinfo' is not valid version information" 1>&2 + $echo "$progname: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 + $echo "$progname: \`$vinfo' is not valid version information" 1>&2 exit 1 fi @@ -867,8 +893,8 @@ if test -z "$show_help"; then ;; *) - echo "$progname: unknown library version type \`$version_type'" 1>&2 - echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + $echo "$progname: unknown library version type \`$version_type'" 1>&2 + $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit 1 ;; esac @@ -885,7 +911,7 @@ if test -z "$show_help"; then # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then - echo "$progname: warning: undefined symbols not allowed in $host shared libraries" 1>&2 + $echo "$progname: warning: undefined symbols not allowed in $host shared libraries" 1>&2 build_libtool_libs=no build_old_libs=yes fi @@ -896,13 +922,13 @@ if test -z "$show_help"; then if test "$build_libtool_libs" = yes; then # Get the real and link names of the library. - library_names=`eval echo \"$library_names_spec\"` + library_names=`eval $echo \"$library_names_spec\"` set dummy $library_names realname="$2" shift; shift if test -n "$soname_spec"; then - soname=`eval echo \"$soname_spec\"` + soname=`eval $echo \"$soname_spec\"` else soname="$realname" fi @@ -915,11 +941,11 @@ if test -z "$show_help"; then done # Use standard objects if they are PIC. - test -z "$pic_flag" && libobjs=`echo "$libobjs " | sed -e 's/\.lo /.o /g' -e 's/ $//g'` + test -z "$pic_flag" && libobjs=`$echo "$libobjs " | sed -e 's/\.lo /.o /g' -e 's/ $//g'` # Do each of the archive commands. - cmds=`eval echo \"$archive_cmds\"` - IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' + cmds=`eval $echo \"$archive_cmds\"` + IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" @@ -943,37 +969,37 @@ if test -z "$show_help"; then *.lo | *.o) if test -n "$link_against_libtool_libs"; then - echo "$progname: error: cannot link libtool libraries into reloadable objects" 1>&2 + $echo "$progname: error: cannot link libtool libraries into reloadable objects" 1>&2 exit 1 fi if test -n "$deplibs"; then - echo "$progname: warning: \`-l' and \`-L' are ignored while creating objects" 1>&2 + $echo "$progname: warning: \`-l' and \`-L' are ignored while creating objects" 1>&2 fi if test -n "$dlfiles$dlprefiles"; then - echo "$progname: warning: \`-dlopen' is ignored while creating objects" 1>&2 + $echo "$progname: warning: \`-dlopen' is ignored while creating objects" 1>&2 # Nullify the symbol file. - compile_command=`echo "$compile_command" | sed "s% @SYMFILE@%%"` - finalize_command=`echo "$finalize_command" | sed "s% @SYMFILE@%%"` + compile_command=`$echo "$compile_command" | sed "s% @SYMFILE@%%"` + finalize_command=`$echo "$finalize_command" | sed "s% @SYMFILE@%%"` fi if test -n "$install_libdir"; then - echo "$progname: warning: \`-rpath' is ignored while creating objects" 1>&2 + $echo "$progname: warning: \`-rpath' is ignored while creating objects" 1>&2 fi if test -n "$vinfo"; then - echo "$progname: warning: \`-version-info' is ignored while creating objects" 1>&2 + $echo "$progname: warning: \`-version-info' is ignored while creating objects" 1>&2 fi case "$output" in *.lo) if test -n "$objs"; then - echo "$progname: cannot build library object \`$output' from non-libtool objects" 1>&2 + $echo "$progname: cannot build library object \`$output' from non-libtool objects" 1>&2 exit 1 fi libobj="$output" - obj=`echo "$output" | sed 's/\.lo$/.o/'` + obj=`$echo "$output" | sed 's/\.lo$/.o/'` ;; *) libobj= @@ -985,11 +1011,11 @@ if test -z "$show_help"; then $run $rm $obj $libobj # Create the old-style object. - reload_objs="$objs"`echo "$libobjs " | sed -e 's/[^ ]*\.a //g' -e 's/\.lo /.o /g' -e 's/ $//g'` + reload_objs="$objs"`$echo "$libobjs " | sed -e 's/[^ ]*\.a //g' -e 's/\.lo /.o /g' -e 's/ $//g'` output="$obj" - cmds=`eval echo \"$reload_cmds\"` - IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' + cmds=`eval $echo \"$reload_cmds\"` + IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" @@ -1003,8 +1029,8 @@ if test -z "$show_help"; then if test "$build_libtool_libs" != yes; then # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. - $show "echo timestamp > $libobj" - $run eval "echo timestamp > $libobj" || exit $? + $show "$echo timestamp > $libobj" + $run eval "$echo timestamp > $libobj" || exit $? exit 0 fi @@ -1012,8 +1038,8 @@ if test -z "$show_help"; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs" output="$libobj" - cmds=`eval echo \"$reload_cmds\"` - IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' + cmds=`eval $echo \"$reload_cmds\"` + IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" @@ -1031,22 +1057,22 @@ if test -z "$show_help"; then *) if test -n "$install_libdir"; then - echo "$progname: warning: \`-rpath' is ignored while linking programs" 1>&2 + $echo "$progname: warning: \`-rpath' is ignored while linking programs" 1>&2 fi if test -n "$vinfo"; then - echo "$progname: warning: \`-version-info' is ignored while linking programs" 1>&2 + $echo "$progname: warning: \`-version-info' is ignored while linking programs" 1>&2 fi if test -n "$libobjs"; then # Transform all the library objects into standard objects. - compile_command=`echo "$compile_command " | sed -e 's/\.lo /.o /g' -e 's/ $//'` - finalize_command=`echo "$finalize_command " | sed -e 's/\.lo /.o /g' -e 's/ $//'` + compile_command=`$echo "$compile_command " | sed -e 's/\.lo /.o /g' -e 's/ $//'` + finalize_command=`$echo "$finalize_command " | sed -e 's/\.lo /.o /g' -e 's/ $//'` fi if test "$export_dynamic" = yes && test -n "$global_symbol_pipe" && test -n "$NM"; then # Add our own program objects to the preloaded list. - dlprefiles=`echo "$objs$dlprefiles " | sed -e 's/\.lo /.o /g' -e 's/ $//'` + dlprefiles=`$echo "$objs$dlprefiles " | sed -e 's/\.lo /.o /g' -e 's/ $//'` # Discover the nlist of each of the dlfiles. dlsyms="$objdir/${output}S.c" @@ -1054,18 +1080,18 @@ if test -z "$show_help"; then $run rm -f "$nlist" "$nlist"T for arg in $dlprefiles; do - echo "extracting global symbols from \`$arg'" + $echo "extracting global symbols from \`$arg'" $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done # Parse the name list into a C file. - echo "creating $dlsyms" + $echo "creating $dlsyms" if test -z "$run"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" wcout=`wc "$nlist" 2>/dev/null` - count=`echo "$wcout" | sed 's/^[ ]*\([0-9][0-9]*\).*$/\1/'` + count=`$echo "$wcout" | sed 's/^[ ]*\([0-9][0-9]*\).*$/\1/'` test "$wcout" = "$count" && count=-1 else rm -f "$nlist"T @@ -1076,17 +1102,23 @@ if test -z "$show_help"; then /* $dlsyms - symbol resolution table for \`$output' dlsym emulation. */ /* Generated by $PROGRAM - GNU $PACKAGE $VERSION */ +/* Prevent the only kind of circular reference mistakes we can make. */ +#define dld_preloaded_symbol_count some_other_symbol +#define dld_preloaded_symbols some_other_symbol + /* External symbol declarations for the compiler. */ EOF if test -f "$nlist"; then - # Prevent the only kind of circular reference mistakes we can make. - sed -e '/ dld_preloaded_symbol\(s\|_count\)$/d' -e 's/^.* \(.*\)$/extern char \1;/' < "$nlist" >> "$dlsyms" + sed -e 's/^.* \(.*\)$/extern char \1;/' < "$nlist" >> "$dlsyms" else - echo "/* NONE */" >> "$dlsyms" + $echo "/* NONE */" >> "$dlsyms" fi cat <> "$dlsyms" +#undef dld_preloaded_symbol_count +#undef dld_preloaded_symbols + #if defined (__STDC__) && __STDC__ # define __ptr_t void * #else @@ -1121,25 +1153,25 @@ EOF $run eval '(cd $objdir && $CC -c$no_builtin_flag "${output}S.c")' || exit $? # Transform the symbol file into the correct name. - compile_command=`echo "$compile_command" | sed "s%@SYMFILE@%$objdir/${output}S.o%"` - finalize_command=`echo "$finalize_command" | sed "s%@SYMFILE@%$objdir/${output}S.o%"` + compile_command=`$echo "$compile_command" | sed "s%@SYMFILE@%$objdir/${output}S.o%"` + finalize_command=`$echo "$finalize_command" | sed "s%@SYMFILE@%$objdir/${output}S.o%"` elif test "$export_dynamic" != yes; then - test -n "$dlfiles$dlprefiles" && echo "$progname: warning: \`-dlopen' and \`-dlpreopen' are ignored without \`-export-dynamic'" 1>&2 + test -n "$dlfiles$dlprefiles" && $echo "$progname: warning: \`-dlopen' and \`-dlpreopen' are ignored without \`-export-dynamic'" 1>&2 else # We keep going just in case the user didn't refer to # dld_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. - echo "$progname: not configured to extract global symbols from dlpreopened files" 1>&2 + $echo "$progname: not configured to extract global symbols from dlpreopened files" 1>&2 # Nullify the symbol file. - compile_command=`echo "$compile_command" | sed "s% @SYMFILE@%%"` - finalize_command=`echo "$finalize_command" | sed "s% @SYMFILE@%%"` + compile_command=`$echo "$compile_command" | sed "s% @SYMFILE@%%"` + finalize_command=`$echo "$finalize_command" | sed "s% @SYMFILE@%%"` fi if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then # Replace the output file specification. - compile_command=`echo "$compile_command" | sed 's%@OUTPUT@%'"$output"'%g'` - finalize_command=`echo "$finalize_command" | sed 's%@OUTPUT@%'"$output"'%g'` + compile_command=`$echo "$compile_command" | sed 's%@OUTPUT@%'"$output"'%g'` + finalize_command=`$echo "$finalize_command" | sed 's%@OUTPUT@%'"$output"'%g'` # We have no uninstalled library dependencies, so finalize right now. $show "$compile_command" @@ -1148,8 +1180,8 @@ EOF # If we failed to link statically, then try again. if test $status -ne 0 && test -n "$link_static"; then - echo "$progname: cannot link \`$output' statically; retrying semi-dynamically" 1>&2 - compile_command=`echo "$compile_command " | sed -e "s% $link_static % %" -e 's/ $//'` + $echo "$progname: cannot link \`$output' statically; retrying semi-dynamically" 1>&2 + compile_command=`$echo "$compile_command " | sed -e "s% $link_static % %" -e 's/ $//'` $show "$compile_command" $run eval "$compile_command" status=$? @@ -1158,8 +1190,8 @@ EOF fi # Replace the output file specification. - compile_command=`echo "$compile_command" | sed 's%@OUTPUT@%'"$objdir/$output"'%g'` - finalize_command=`echo "$finalize_command" | sed 's%@OUTPUT@%'"$objdir/$output"'T%g'` + compile_command=`$echo "$compile_command" | sed 's%@OUTPUT@%'"$objdir/$output"'%g'` + finalize_command=`$echo "$finalize_command" | sed 's%@OUTPUT@%'"$objdir/$output"'T%g'` # Create the binary in the object directory, then wrap it. if test -d $objdir; then : @@ -1209,8 +1241,8 @@ EOF case "$hardcode_action" in relink) # AGH! Flame the AIX and HP-UX people for me, will ya? - echo "$progname: warning: using a buggy system linker" 1>&2 - echo "$progname: relinking will be required before \`$output' can be installed" 1>&2 + $echo "$progname: warning: using a buggy system linker" 1>&2 + $echo "$progname: relinking will be required before \`$output' can be installed" 1>&2 ;; esac @@ -1218,10 +1250,10 @@ EOF $run eval "$compile_command" || exit $? # Now create the wrapper script. - echo "creating $output" + $echo "creating $output" # Quote the finalize command for shipping. - finalize_command=`echo "$finalize_command" | sed "$sed_quote_subst"` + finalize_command=`$echo "$finalize_command" | sed "$sed_quote_subst"` # Only actually do things if our run command is non-null. if test -z "$run"; then @@ -1250,7 +1282,7 @@ else test "\$libtool_execute_magic" = "$magic" || file="\$0" # Find the directory that this script lives in. - thisdir=\`echo "\$file" | sed 's%/[^/]*$%%'\` + thisdir=\`$echo "\$file" | sed 's%/[^/]*$%%'\` test "x\$thisdir" = "x\$file" && thisdir=. # Try to get the absolute directory name. @@ -1278,7 +1310,7 @@ EOF $shlibpath_var="$temp_rpath\$$shlibpath_var" # Some systems cannot cope with colon-terminated $shlibpath_var - $shlibpath_var=\`echo \$$shlibpath_var | sed -e 's/:*\$//'\` + $shlibpath_var=\`$echo \$$shlibpath_var | sed -e 's/:*\$//'\` export $shlibpath_var @@ -1293,7 +1325,7 @@ EOF do # Quote arguments (to preserve shell metacharacters). sed_quote_subst='$sed_quote_subst' - arg=\`echo "\$arg" | sed "\$sed_quote_subst"\` + arg=\`$echo "\$arg" | sed "\$sed_quote_subst"\` args="\$args \\"\$arg\\"" done @@ -1303,14 +1335,14 @@ EOF eval "exec \$program \$args" - echo "\$0: cannot exec \$program \$args" + $echo "\$0: cannot exec \$program \$args" exit 1 fi else # The program doesn't exist. - echo "\$0: error: neither \$oprogdir/\$program nor \$progdir/\$program exists" 1>&2 - echo "This script is just a wrapper for \$program." 1>&2 - echo "See the $PACKAGE documentation for more information." 1>&2 + $echo "\$0: error: neither \$oprogdir/\$program nor \$progdir/\$program exists" 1>&2 + $echo "This script is just a wrapper for \$program." 1>&2 + $echo "See the $PACKAGE documentation for more information." 1>&2 exit 1 fi fi @@ -1328,7 +1360,7 @@ EOF oldlib="$objdir/$libname.a" # Transform .lo files to .o files. - oldobjs="$objs"`echo "$libobjs " | sed -e 's/[^ ]*\.a //g' -e 's/\.lo /.o /g' -e 's/ $//g'` + oldobjs="$objs"`$echo "$libobjs " | sed -e 's/[^ ]*\.a //g' -e 's/\.lo /.o /g' -e 's/ $//g'` if test -d "$objdir"; then $show "$rm $oldlib" @@ -1339,8 +1371,8 @@ EOF fi # Do each command in the archive commands. - cmds=`eval echo \"$old_archive_cmds\"` - IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' + cmds=`eval $echo \"$old_archive_cmds\"` + IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" @@ -1355,7 +1387,7 @@ EOF old_library= test "$build_old_libs" = yes && old_library="$libname.a" - echo "creating $output" + $echo "creating $output" # Only create the output if not a dry run. if test -z "$run"; then @@ -1397,7 +1429,7 @@ EOF # The first argument is the name of the installation program. # Aesthetically quote it. - arg=`echo "$nonopt" | sed "$sed_quote_subst"` + arg=`$echo "$nonopt" | sed "$sed_quote_subst"` case "$arg" in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" @@ -1445,7 +1477,7 @@ EOF esac # Aesthetically quote the argument. - arg=`echo "$arg" | sed "$sed_quote_subst"` + arg=`$echo "$arg" | sed "$sed_quote_subst"` case "$arg" in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" @@ -1455,29 +1487,29 @@ EOF done if test -z "$install_prog"; then - echo "$progname: you must specify an install program" 1>&2 - echo "$help" 1>&2 + $echo "$progname: you must specify an install program" 1>&2 + $echo "$help" 1>&2 exit 1 fi if test -n "$prev"; then - echo "$progname: the \`$prev' option requires an argument" 1>&2 - echo "$help" 1>&2 + $echo "$progname: the \`$prev' option requires an argument" 1>&2 + $echo "$help" 1>&2 exit 1 fi if test -z "$files"; then if test -z "$dest"; then - echo "$progname: no file or destination specified" 1>&2 + $echo "$progname: no file or destination specified" 1>&2 else - echo "$progname: you must specify a destination" 1>&2 + $echo "$progname: you must specify a destination" 1>&2 fi - echo "$help" 1>&2 + $echo "$help" 1>&2 exit 1 fi # Strip any trailing slash from the destination. - dest=`echo "$dest" | sed 's%/$%%'` + dest=`$echo "$dest" | sed 's%/$%%'` # Check to see that the destination is a directory. test -d "$dest" && isdir=yes @@ -1485,15 +1517,15 @@ EOF destdir="$dest" destname= else - destdir=`echo "$dest" | sed 's%/[^/]*$%%'` + destdir=`$echo "$dest" | sed 's%/[^/]*$%%'` test "X$destdir" = "X$dest" && destdir=. - destname=`echo "$dest" | sed 's%^.*/%%'` + destname=`$echo "$dest" | sed 's%^.*/%%'` # Not a directory, so check to see that there is only one file specified. set dummy $files if test $# -gt 2; then - echo "$progname: \`$dest' is not a directory" 1>&2 - echo "$help" 1>&2 + $echo "$progname: \`$dest' is not a directory" 1>&2 + $echo "$help" 1>&2 exit 1 fi fi @@ -1504,8 +1536,8 @@ EOF case "$file" in *.lo) ;; *) - echo "$progname: \`$destdir' must be an absolute directory name" 1>&2 - echo "$help" 1>&2 + $echo "$progname: \`$destdir' must be an absolute directory name" 1>&2 + $echo "$help" 1>&2 exit 1 ;; esac @@ -1533,8 +1565,8 @@ EOF # Check to see that this really is a libtool archive. if egrep "^# Generated by ltmain.sh" $file >/dev/null 2>&1; then : else - echo "$progname: \`$file' is not a valid libtool archive" 1>&2 - echo "$help" 1>&2 + $echo "$progname: \`$file' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 exit 1 fi @@ -1560,7 +1592,7 @@ EOF esac fi - dir="`echo "$file" | sed 's%/[^/]*$%%'`/" + dir="`$echo "$file" | sed 's%/[^/]*$%%'`/" test "X$dir" = "X$file/" && dir= dir="$dir$objdir" @@ -1582,7 +1614,7 @@ EOF $show "$striplib $destdir/$realname" $run $striplib $destdir/$realname || exit $? else - echo "$progname: warning: no library stripping program" 1>&2 + $echo "$progname: warning: no library stripping program" 1>&2 fi fi @@ -1613,8 +1645,8 @@ EOF # Do each command in the postinstall commands. lib="$destdir/$realname" - cmds=`eval echo \"$postinstall_cmds\"` - IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' + cmds=`eval $echo \"$postinstall_cmds\"` + IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" @@ -1624,7 +1656,7 @@ EOF fi # Install the pseudo-library for information purposes. - name=`echo "$file" | sed 's%^.*/%%'` + name=`$echo "$file" | sed 's%^.*/%%'` $show "$install_prog $file $destdir/$name" $run eval "$install_prog $file $destdir/$name" || exit $? @@ -1639,22 +1671,22 @@ EOF if test -n "$destname"; then destfile="$destdir/$destname" else - destfile=`echo "$file" | sed 's%^.*/%%'` + destfile=`$echo "$file" | sed 's%^.*/%%'` destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case "$destfile" in *.lo) - staticdest=`echo "$destfile" | sed 's/\.lo$/\.o/'` + staticdest=`$echo "$destfile" | sed 's/\.lo$/\.o/'` ;; *.o) staticdest="$destfile" destfile= ;; *) - echo "$progname: cannot copy a libtool object to \`$destfile'" 1>&2 - echo "$help" 1>&2 + $echo "$progname: cannot copy a libtool object to \`$destfile'" 1>&2 + $echo "$help" 1>&2 exit 1 ;; esac @@ -1668,7 +1700,7 @@ EOF # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. - staticobj=`echo "$file" | sed 's/\.lo$/\.o/'` + staticobj=`$echo "$file" | sed 's/\.lo$/\.o/'` $show "$install_prog $staticobj $staticdest" $run eval "$install_prog \$staticobj \$staticdest" || exit $? @@ -1690,7 +1722,7 @@ EOF # Check the variables that should have been set. if test -z "$link_against_libtool_libs" || test -z "$finalize_command"; then - echo "$progname: invalid libtool wrapper script \`$file'" 1>&2 + $echo "$progname: invalid libtool wrapper script \`$file'" 1>&2 exit 1 fi @@ -1705,32 +1737,32 @@ EOF *) . ./$lib ;; esac fi - libfile="$libdir/`echo "$lib" | sed 's%^.*/%%g'`" + libfile="$libdir/`$echo "$lib" | sed 's%^.*/%%g'`" if test -z "$libdir"; then - echo "$progname: warning: \`$lib' contains no -rpath information" 1>&2 + $echo "$progname: warning: \`$lib' contains no -rpath information" 1>&2 elif test -f "$libfile"; then : else - echo "$progname: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 + $echo "$progname: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 finalize=no fi done if test "$hardcode_action" = relink; then if test "$finalize" = yes; then - echo "$progname: warning: relinking \`$file' on behalf of your buggy system linker" 1>&2 + $echo "$progname: warning: relinking \`$file' on behalf of your buggy system linker" 1>&2 $show "$finalize_command" if $run eval "$finalize_command"; then : else - echo "$progname: error: relink \`$file' with the above command before installing it" 1>&2 + $echo "$progname: error: relink \`$file' with the above command before installing it" 1>&2 continue fi file="$objdir/$file"T else - echo "$progname: warning: cannot relink \`$file' on behalf of your buggy system linker" 1>&2 + $echo "$progname: warning: cannot relink \`$file' on behalf of your buggy system linker" 1>&2 fi else # Install the binary that we compiled earlier. - file=`echo "$file" | sed "s%\([^/]*\)$%$objdir/\1%"` + file=`$echo "$file" | sed "s%\([^/]*\)$%$objdir/\1%"` fi fi @@ -1741,7 +1773,7 @@ EOF done for file in $staticlibs; do - name=`echo "$file" | sed 's%^.*/%%'` + name=`$echo "$file" | sed 's%^.*/%%'` # Set up the ranlib parameters. oldlib="$destdir/$name" @@ -1755,13 +1787,13 @@ EOF $show "$old_striplib $oldlib" $run $old_striplib $oldlib || exit $? else - echo "$progname: warning: no static library stripping program" 1>&2 + $echo "$progname: warning: no static library stripping program" 1>&2 fi fi # Do each command in the postinstall commands. - cmds=`eval echo \"$old_postinstall_cmds\"` - IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' + cmds=`eval $echo \"$old_postinstall_cmds\"` + IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" @@ -1771,7 +1803,7 @@ EOF done if test -n "$future_libdirs"; then - echo "$progname: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 + $echo "$progname: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 fi if test -n "$current_libdirs"; then @@ -1797,8 +1829,8 @@ EOF for libdir in $libdirs; do # Do each command in the postinstall commands. - cmds=`eval echo \"$finish_cmds\"` - IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' + cmds=`eval $echo \"$finish_cmds\"` + IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" @@ -1808,11 +1840,11 @@ EOF done fi - echo "To link against installed libraries in LIBDIR, users may have to:" + $echo "To link against installed libraries in LIBDIR, users may have to:" if test -n "$shlibpath_var"; then - echo " - add LIBDIR to their \`$shlibpath_var' environment variable" + $echo " - add LIBDIR to their \`$shlibpath_var' environment variable" fi - echo " - use the \`-LLIBDIR' linker flag" + $echo " - use the \`-LLIBDIR' linker flag" exit 0 ;; @@ -1823,8 +1855,8 @@ EOF # The first argument is the command name. cmd="$nonopt" if test -z "$cmd"; then - echo "$progname: you must specify a COMMAND" 1>&2 - echo "$help" + $echo "$progname: you must specify a COMMAND" 1>&2 + $echo "$help" exit 1 fi @@ -1832,8 +1864,8 @@ EOF for file in $execute_dlfiles; do if test -f "$file"; then : else - echo "$progname: \`$file' is not a file" 1>&2 - echo "$help" 1>&2 + $echo "$progname: \`$file' is not a file" 1>&2 + $echo "$help" 1>&2 exit 1 fi @@ -1843,8 +1875,8 @@ EOF # Check to see that this really is a libtool archive. if egrep "^# Generated by ltmain.sh" $file >/dev/null 2>&1; then : else - echo "$progname: \`$lib' is not a valid libtool archive" 1>&2 - echo "$help" 1>&2 + $echo "$progname: \`$lib' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 exit 1 fi @@ -1861,29 +1893,29 @@ EOF # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. - test -n "$library_names" && echo "$progname: warning: \`$file' was not linked with \`-export-dynamic'" + test -n "$library_names" && $echo "$progname: warning: \`$file' was not linked with \`-export-dynamic'" continue fi - dir=`echo "$file" | sed 's%/[^/]*$%%'` + dir=`$echo "$file" | sed 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. if test -f "$dir/$objdir/$dlname"; then dir="$dir/$objdir" else - echo "$progname: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 + $echo "$progname: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 exit 1 fi ;; *.lo) # Just add the directory containing the .lo file. - dir=`echo "$file" | sed 's%/[^/]*$%%'` + dir=`$echo "$file" | sed 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. ;; *) - echo "$progname: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 + $echo "$progname: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 continue ;; esac @@ -1924,7 +1956,7 @@ EOF ;; esac # Quote arguments (to preserve shell metacharacters). - file=`echo "$file" | sed "$sed_quote_subst"` + file=`$echo "$file" | sed "$sed_quote_subst"` args="$args \"$file\"" done @@ -1935,13 +1967,13 @@ EOF # Now actually exec the command. eval "exec \$cmd$args" - echo "$progname: cannot exec \$cmd$args" + $echo "$progname: cannot exec \$cmd$args" exit 1 else # Display what would be done. - eval "echo \"\$shlibpath_var=\$$shlibpath_var\"" - echo "export $shlibpath_var" - echo "$cmd$args" + eval "$echo \"\$shlibpath_var=\$$shlibpath_var\"" + $echo "export $shlibpath_var" + $echo "$cmd$args" exit 0 fi ;; @@ -1961,15 +1993,15 @@ EOF done if test -z "$rm"; then - echo "$progname: you must specify an RM program" 1>&2 - echo "$help" 1>&2 + $echo "$progname: you must specify an RM program" 1>&2 + $echo "$help" 1>&2 exit 1 fi for file in $files; do - dir=`echo "$file" | sed -e 's%/[^/]*$%%'` + dir=`$echo "$file" | sed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. - name=`echo "$file" | sed -e 's%^.*/%%'` + name=`$echo "$file" | sed -e 's%^.*/%%'` rmfiles="$file" @@ -1993,7 +2025,7 @@ EOF *.lo) if test "$build_old_libs" = yes; then - oldobj=`echo "$name" | sed 's/\.lo$/\.o/'` + oldobj=`$echo "$name" | sed 's/\.lo$/\.o/'` rmfiles="$rmfiles $dir/$oldobj" fi ;; @@ -2006,14 +2038,14 @@ EOF ;; "") - echo "$progname: you must specify a MODE" 1>&2 - echo "$generic_help" 1>&2 + $echo "$progname: you must specify a MODE" 1>&2 + $echo "$generic_help" 1>&2 exit 1 ;; esac - echo "$progname: invalid operation mode \`$mode'" 1>&2 - echo "$generic_help" 1>&2 + $echo "$progname: invalid operation mode \`$mode'" 1>&2 + $echo "$generic_help" 1>&2 exit 1 fi # test -z "$show_help" @@ -2167,18 +2199,14 @@ EOF ;; *) - echo "$progname: invalid operation mode \`$mode'" 1>&2 - echo "$help" 1>&2 + $echo "$progname: invalid operation mode \`$mode'" 1>&2 + $echo "$help" 1>&2 exit 1 ;; esac -case "$mode" in -archive|compile) - echo - echo "Try \`$progname --help' for more information about other modes." - ;; -esac +$echo +$echo "Try \`$progname --help' for more information about other modes." exit 0 diff --git a/tests/ChangeLog b/tests/ChangeLog index 136e3c73..db57c6ef 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,13 @@ +Thu Aug 28 20:58:30 1997 Gordon Matzigkeit + + * quote.test (echo): Change test to version that uses printf. + Be less strict about return results. + +Wed Aug 27 23:22:06 1997 Gordon Matzigkeit + + * quote.test (echo): Add the test for a non-backslash-mangling + echo. + Tue Aug 26 13:39:40 1997 Gordon Matzigkeit * quote.test: New torture test for libtool metacharacter quoting. diff --git a/tests/quote.test b/tests/quote.test index 75f2ccc9..d35b909e 100755 --- a/tests/quote.test +++ b/tests/quote.test @@ -13,8 +13,34 @@ fi # Do the torture test. status=0 +echo=echo +if test X`$echo '\t'` = 'X\t'; then : +else + # The Solaris and AIX default echo program unquotes backslashes. + # This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # So, we emulate echo with printf '%s\n' + echo='printf %s\n' + if test X`$echo '\t'` = 'X\t'; then : + else + # Oops. We have no working printf. Try to find a not-so-buggy echo. + echo=echo + IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" + save_PATH="$PATH" + PATH="$PATH":/usr/ucb + for dir in $PATH; do + if test -f $dir/echo && test X`$dir/echo '\t'` = 'X\t'; then + echo="$dir/echo" + break + fi + done + IFS="$save_ifs" + PATH="$save_PATH" + fi +fi + for mode in compile link install; do - echo "= $mode mode" + $echo "== $mode mode" # Unfortunately, without an array data type, it is nearly impossible # to protect libtool from metacharacters in filenames. So, we just @@ -42,28 +68,28 @@ for mode in compile link install; do esac # Trivial. - echo "TRYING: no quoting" + $echo "= trying: no quoting" result=`$libtool -n --mode=$mode $preargs "${flag}test" $postargs` || status=1 case "$result" in - *"$preargs ${flag}test $postargs"*) - echo "PASSED: $result" + *"$preargs ${flag}test "*) + $echo "= passed: $result" ;; *) - echo "FAILED: $result" + $echo "= failed: $result" status=1 ;; esac # Metacharacters that should be backslashified. for mchar in \\ \" \$; do - echo "TRYING: \\$mchar quoting" + $echo "= trying: \\$mchar quoting" result=`$libtool -n --mode=$mode $preargs "${flag}${mchar}test${mchar}" $postargs` || status=1 case "$result" in - *"$preargs ${flag}\\${mchar}test\\${mchar} $postargs"*) - echo "PASSED: $result" + *"$preargs ${flag}\\${mchar}test\\${mchar} "*) + $echo "= passed: $result" ;; *) - echo "FAILED: $result" + $echo "= failed: $result" status=1 ;; esac @@ -73,14 +99,14 @@ for mode in compile link install; do for mchar in "[" "]" "~" "#" "^" "&" "*" "(" ")" "{" "}" "|" ";" "<" ">" "?" \ "'" " " " "; do - echo "TRYING: \"$mchar\" quoting" + $echo "= trying: \"$mchar\" quoting" result=`$libtool -n --mode=$mode $preargs "${flag}${mchar}test${mchar}" $postargs` || status=1 case "$result" in - *"$preargs \"${flag}${mchar}test${mchar}\" $postargs"*) - echo "PASSED: $result" + *"$preargs \"${flag}${mchar}test${mchar}\" "*) + $echo "= passed: $result" ;; *) - echo "FAILED: $result" + $echo "= failed: $result" status=1 ;; esac