bug-libtool
[Top][All Lists]
Advanced

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

Re: FYI: ltmain.m4sh needs to handle spaces in paths


From: Derek Price
Subject: Re: FYI: ltmain.m4sh needs to handle spaces in paths
Date: Thu, 07 Jul 2005 13:11:40 -0400
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

Ralf Wildenhues wrote:

>>Heh.  I had no idea I had gotten credit.  Anyhow, give me a few more
>>days before you yank it - I'm working on fixing the other space problem
>>which halts compilation.  That patch should be a little bigger.  :)
>>    
>>
>
>Oh, I wasn't going to yank it.  That was supposed to be a joke.
>If you take it as an incentive to fix more cases, the better.  :)
>  
>

Okay, the attached patch to 1.5 fixes loads of quoting issues on Windows
and passes tests on GNU/Linux.  Basically, I made the minimal set of
changes I needed to to get a large project containing libraries and
executables to compile on Windows, except that if I set up the elements
of a variable to be quoted in one location, I quoted them everywhere for
consistency.

I then backported the changes to get the tests to pass again on Linux. 
The backporting to UNIX entailed a few minor changes to libtool.m4,
demo/Makefile.am, and a few tests.  The test changes basically just
expect the quotes to appear in output now.

What I *didn't* do is move my libtool workspace to a name with a space
and try to run the test suite on LINUX, so there are probably still a
few changes that need to be made to handle spaces in directories on
LINUX.  I also didn't try targets with spaces or relative paths within a
project with spaces.  This should pretty much only handle spaces in `pwd`.


2005-07-07  Derek R. Price  <address@hidden>

    * libtool.m4:  Quote paths in $hardcode_libdir_flag_spec.
    * ltmain.in:  Quote paths potentially containing spaces.  Use set and
    "$@" to loop on variables potentially containing quoted elements.
    * demo/Makefile.am (hc-libflag): Use eval to process quoted
    arguments inside variables.
    * tests/link-order.test, tests/link.test: Expect quoted arguments.


Regards,

Derek
Index: libtool.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/Attic/libtool.m4,v
retrieving revision 1.314.2.95
diff -u -p -r1.314.2.95 libtool.m4
--- libtool.m4  3 Jul 2005 18:15:58 -0000       1.314.2.95
+++ libtool.m4  7 Jul 2005 17:00:45 -0000
@@ -2753,7 +2753,7 @@ if test "$GXX" = yes; then
     _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects 
$libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o 
$lib'
     _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib 
$predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname 
$wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
 
-    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath 
\"${wl}$libdir\"'
     _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
 
     # If archive_cmds runs LD, not CC, wlarc should be empty
@@ -2855,7 +2855,7 @@ case $host_os in
          # path is not listed in the libpath.  Setting hardcode_minus_L
          # to unsupported forces relinking
          _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
-         _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+         _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='\"-L$libdir\"'
          _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
        fi
       esac
@@ -2887,18 +2887,18 @@ case $host_os in
       _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok'
       # Determine the default libpath from the value encoded in an empty 
executable.
       _LT_AC_SYS_LIBPATH_AIX
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, 
$1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, 
$1)='\"${wl}-blibpath:$libdir:'"$aix_libpath"'\"'
 
       _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname 
$libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; 
then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag 
\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
      else
       if test "$host_cpu" = ia64; then
-       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R 
$libdir:/usr/lib:/lib'
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R 
\"$libdir:/usr/lib:/lib\"'
        _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
        _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o 
$output_objdir/$soname $libobjs $deplibs $compiler_flags 
${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag 
\${wl}$exp_sym_flag:\$export_symbols"
       else
        # Determine the default libpath from the value encoded in an empty 
executable.
        _LT_AC_SYS_LIBPATH_AIX
-       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, 
$1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, 
$1)='\"${wl}-blibpath:$libdir:'"$aix_libpath"'\"'
        # Warning - without using the other run time loading flags,
        # -berok will link without error, but may produce a broken library.
        _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
@@ -2926,7 +2926,7 @@ case $host_os in
   cygwin* | mingw* | pw32*)
     # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
     # as there is no search path for DLLs.
-    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='\"-L$libdir\"'
     _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
     _LT_AC_TAGVAR(always_export_symbols, $1)=no
     _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
@@ -3041,7 +3041,7 @@ case $host_os in
   gnu*)
     ;;
   hpux9*)
-    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b \"${wl}$libdir\"'
     _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
     _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
     _LT_AC_TAGVAR(hardcode_direct, $1)=yes
@@ -3080,15 +3080,15 @@ case $host_os in
     if test $with_gnu_ld = no; then
       case $host_cpu in
       hppa*64*)
-       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b \"${wl}$libdir\"'
        _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
        _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
         ;;
       ia64*)
-       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='\"-L$libdir\"'
         ;;
       *)
-       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b \"${wl}$libdir\"'
        _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
        _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
         ;;
@@ -3180,7 +3180,7 @@ case $host_os in
        _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
        ;;
     esac
-    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath \"${wl}$libdir\"'
     _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
     ;;
   linux*)
@@ -3203,7 +3203,7 @@ case $host_os in
        # dependencies.
        output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o 
libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; 
list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; 
*.$objext);; *) list="$list $z";;esac; done; echo $list'
 
-       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir'
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='\"${wl}--rpath,$libdir\"'
        _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
 
        # Archives containing C++ object files must be created using
@@ -3231,7 +3231,7 @@ case $host_os in
          ;;
        esac
        _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
-       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='\"${wl}-rpath,$libdir\"'
        _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
        _LT_AC_TAGVAR(whole_archive_flag_spec, 
$1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
        ;;
@@ -3240,7 +3240,7 @@ case $host_os in
        _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects 
$libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o 
$lib'
        _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag 
$predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname 
${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
 
-       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath 
\"${wl}$libdir\"'
        _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
        _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for 
conv in $convenience\"\"; do test  -n \"$conv\" && 
new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` 
${wl}--no-whole-archive'
         ;;
@@ -3250,7 +3250,7 @@ case $host_os in
        _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects 
$libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o 
$lib ${wl}-retain-symbols-file $wl$export_symbols'
 
        runpath_var=LD_RUN_PATH
-       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath \"$libdir\"'
        _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
 
        # Commands to make compiler produce verbose output that lists
@@ -3289,7 +3289,7 @@ case $host_os in
     if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
       _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable  -o $lib 
$predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
       wlarc=
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='\"-R$libdir\"'
       _LT_AC_TAGVAR(hardcode_direct, $1)=yes
       _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
     fi
@@ -3304,7 +3304,7 @@ case $host_os in
     _LT_AC_TAGVAR(hardcode_direct, $1)=yes
     _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
     _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects 
$libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
-    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='\"${wl}-rpath,$libdir\"'
     if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test 
"$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag 
$predep_objects $libobjs $deplibs $postdep_objects $compiler_flags 
${wl}-retain-symbols-file,$export_symbols -o $lib'
       _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
@@ -3322,7 +3322,7 @@ case $host_os in
        # to its proper name (with version) after linking.
        _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e 
'\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e 
"s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs 
$postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib 
$lib'
 
-       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='\"${wl}-rpath,$libdir\"'
        _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
 
        # Archives containing C++ object files must be created using
@@ -3339,7 +3339,7 @@ case $host_os in
        _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved 
${wl}\*'
        _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} 
$predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname 
$soname `test -n "$verstring" && echo ${wl}-set_version $verstring` 
-update_registry ${output_objdir}/so_locations -o $lib'
 
-       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath 
\"${wl}$libdir\"'
        _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
 
        # Commands to make compiler produce verbose output that lists
@@ -3357,7 +3357,7 @@ case $host_os in
          _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved 
${wl}\*'
          _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib 
${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects 
$compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo 
${wl}-set_version ${wl}$verstring` ${wl}-update_registry 
${wl}${output_objdir}/so_locations -o $lib'
 
-         _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath 
${wl}$libdir'
+         _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath 
\"${wl}$libdir\"'
          _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
 
          # Commands to make compiler produce verbose output that lists
@@ -3382,7 +3382,7 @@ case $host_os in
        # to its proper name (with version) after linking.
        _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e 
'\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e 
"s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs 
$postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib 
$lib'
 
-       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='\"${wl}-rpath,$libdir\"'
        _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
 
        # Archives containing C++ object files must be created using
@@ -3402,7 +3402,7 @@ case $host_os in
          $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs 
$postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp  
`test -n "$verstring" && echo -set_version $verstring` -update_registry 
${output_objdir}/so_locations -o $lib~
          $rm $lib.exp'
 
-       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath \"$libdir\"'
        _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
 
        # Commands to make compiler produce verbose output that lists
@@ -3420,7 +3420,7 @@ case $host_os in
          _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved 
${wl}\*'
         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib 
${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects 
$compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && 
echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry 
${wl}${output_objdir}/so_locations -o $lib'
 
-         _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath 
${wl}$libdir'
+         _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath 
\"${wl}$libdir\"'
          _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
 
          # Commands to make compiler produce verbose output that lists
@@ -3479,7 +3479,7 @@ case $host_os in
        _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > 
$lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo 
"local: *; };" >> $lib.exp~
        $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o 
$lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm 
$lib.exp'
 
-       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='\"-R$libdir\"'
        _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
        case $host_os in
          solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
@@ -3546,7 +3546,7 @@ case $host_os in
            output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | 
grep \"\-L\""
          fi
 
-         _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
+         _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R \"$wl$libdir\"'
        fi
        ;;
     esac
@@ -5254,7 +5254,7 @@ ifelse([$1],[CXX],[
     # are reset later if shared libraries are not supported. Putting them
     # here allows them to be overridden if necessary.
     runpath_var=LD_RUN_PATH
-    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath 
\"${wl}$libdir\"'
     _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
     # ancient GNU ld didn't support --whole-archive et. al.
     if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
@@ -5291,7 +5291,7 @@ EOF
 
     amigaos*)
       _LT_AC_TAGVAR(archive_cmds, $1)='$rm 
$output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > 
$output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> 
$output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> 
$output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> 
$output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd 
$output_objdir && a2ixlibrary -32)'
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='\"-L$libdir\"'
       _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
 
       # Samuel A. Falvo II <address@hidden> reports
@@ -5317,7 +5317,7 @@ EOF
     cygwin* | mingw* | pw32*)
       # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
       # as there is no search path for DLLs.
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='\"-L$libdir\"'
       _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
       _LT_AC_TAGVAR(always_export_symbols, $1)=no
       _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
@@ -5502,7 +5502,7 @@ EOF
          # path is not listed in the libpath.  Setting hardcode_minus_L
          # to unsupported forces relinking
          _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
-         _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+         _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='\"-L$libdir\"'
          _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
          fi
        esac
@@ -5534,17 +5534,17 @@ EOF
        _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok'
        # Determine the default libpath from the value encoded in an empty 
executable.
        _LT_AC_SYS_LIBPATH_AIX
-       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, 
$1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, 
$1)='\"${wl}-blibpath:$libdir:'"$aix_libpath"'\"'
        _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o 
$output_objdir/$soname $libobjs $deplibs $compiler_flags `if test 
"x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; 
else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols 
$shared_flag"
        else
        if test "$host_cpu" = ia64; then
-         _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R 
$libdir:/usr/lib:/lib'
+         _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R 
\"$libdir:/usr/lib:/lib\"'
          _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
          _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o 
$output_objdir/$soname $libobjs $deplibs $compiler_flags 
${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag 
\${wl}$exp_sym_flag:\$export_symbols"
        else
         # Determine the default libpath from the value encoded in an empty 
executable.
         _LT_AC_SYS_LIBPATH_AIX
-        _LT_AC_TAGVAR(hardcode_libdir_flag_spec, 
$1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+        _LT_AC_TAGVAR(hardcode_libdir_flag_spec, 
$1)='\"${wl}-blibpath:$libdir:'"$aix_libpath"'\"'
          # Warning - without using the other run time loading flags,
          # -berok will link without error, but may produce a broken library.
          _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
@@ -5562,7 +5562,7 @@ EOF
 
     amigaos*)
       _LT_AC_TAGVAR(archive_cmds, $1)='$rm 
$output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > 
$output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> 
$output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> 
$output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> 
$output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd 
$output_objdir && a2ixlibrary -32)'
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='\"-L$libdir\"'
       _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
       # see comment about different semantics on the GNU ld section
       _LT_AC_TAGVAR(ld_shlibs, $1)=no
@@ -5645,7 +5645,7 @@ EOF
 
     dgux*)
       _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs 
$deplibs $linker_flags'
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='\"-L$libdir\"'
       _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
       ;;
 
@@ -5659,7 +5659,7 @@ EOF
     # extra space).
     freebsd2.2*)
       _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs 
$deplibs $linker_flags /usr/lib/c++rt0.o'
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='\"-R$libdir\"'
       _LT_AC_TAGVAR(hardcode_direct, $1)=yes
       _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
       ;;
@@ -5675,7 +5675,7 @@ EOF
     # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
     freebsd* | kfreebsd*-gnu | dragonfly*)
       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs 
$compiler_flags'
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='\"-R$libdir\"'
       _LT_AC_TAGVAR(hardcode_direct, $1)=yes
       _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
       ;;
@@ -5686,7 +5686,7 @@ EOF
       else
        _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b 
$install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test 
$output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
       fi
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b \"${wl}$libdir\"'
       _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
       _LT_AC_TAGVAR(hardcode_direct, $1)=yes
 
@@ -5719,14 +5719,14 @@ EOF
       if test "$with_gnu_ld" = no; then
        case $host_cpu in
        hppa*64*)
-         _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+         _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b 
\"${wl}$libdir\"'
          _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
          _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
          _LT_AC_TAGVAR(hardcode_direct, $1)=no
          _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
          ;;
        ia64*)
-         _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+         _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='\"-L$libdir\"'
          _LT_AC_TAGVAR(hardcode_direct, $1)=no
          _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
 
@@ -5735,7 +5735,7 @@ EOF
          _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
          ;;
        *)
-         _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+         _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b 
\"${wl}$libdir\"'
          _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
          _LT_AC_TAGVAR(hardcode_direct, $1)=yes
          _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
@@ -5755,7 +5755,7 @@ EOF
        _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs 
$linker_flags -soname $soname `test -n "$verstring" && echo -set_version 
$verstring` -update_registry ${output_objdir}/so_locations -o $lib'
        _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir'
       fi
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath 
\"${wl}$libdir\"'
       _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
       _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
       ;;
@@ -5766,7 +5766,7 @@ EOF
       else
        _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs 
$linker_flags'      # ELF
       fi
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='\"-R$libdir\"'
       _LT_AC_TAGVAR(hardcode_direct, $1)=yes
       _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
       ;;
@@ -5774,7 +5774,7 @@ EOF
     newsos6)
       _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs 
$deplibs $linker_flags'
       _LT_AC_TAGVAR(hardcode_direct, $1)=yes
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath 
\"${wl}$libdir\"'
       _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
       _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
       ;;
@@ -5785,24 +5785,24 @@ EOF
       if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test 
"$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
        _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs 
$deplibs $compiler_flags'
        _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib 
$libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
-       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='\"${wl}-rpath,$libdir\"'
        _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
       else
        case $host_os in
         openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
           _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs 
$deplibs $linker_flags'
-          _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+          _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='\"-R$libdir\"'
           ;;
         *)
           _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib 
$libobjs $deplibs $compiler_flags'
-          _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+          _LT_AC_TAGVAR(hardcode_libdir_flag_spec, 
$1)='\"${wl}-rpath,$libdir\"'
           ;;
        esac
       fi
       ;;
 
     os2*)
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='\"-L$libdir\"'
       _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
       _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
       _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > 
$output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> 
$output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " 
SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> 
$output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC 
-Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags 
$output_objdir/$libname.def'
@@ -5817,7 +5817,7 @@ EOF
        _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
        _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} 
$libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo 
-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
       fi
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath 
\"${wl}$libdir\"'
       _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
       ;;
 
@@ -5825,7 +5825,7 @@ EOF
       if test "$GCC" = yes; then
        _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved 
${wl}\*'
        _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} 
$libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n 
"$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry 
${wl}${output_objdir}/so_locations -o $lib'
-       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath 
\"${wl}$libdir\"'
       else
        _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
        _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} 
$libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && 
echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o 
$lib'
@@ -5833,7 +5833,7 @@ EOF
        $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags 
$libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version 
$verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp'
 
        # Both c and cxx compiler support -rpath directly
-       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath \"$libdir\"'
       fi
       _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
       ;;
@@ -5859,7 +5859,7 @@ EOF
        _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > 
$lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo 
"local: *; };" >> $lib.exp~
        $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs 
$deplibs $linker_flags~$rm $lib.exp'
       fi
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='\"-R$libdir\"'
       _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
       case $host_os in
       solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
@@ -5887,7 +5887,7 @@ EOF
       else
        _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib 
$libobjs $deplibs $linker_flags'
       fi
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='\"-L$libdir\"'
       _LT_AC_TAGVAR(hardcode_direct, $1)=yes
       _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
       _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
@@ -5965,7 +5965,7 @@ EOF
 
     uts4*)
       _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs 
$deplibs $linker_flags'
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='\"-L$libdir\"'
       _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
       ;;
 
Index: ltmain.in
===================================================================
RCS file: /cvsroot/libtool/libtool/Attic/ltmain.in,v
retrieving revision 1.334.2.76
diff -u -p -r1.334.2.76 ltmain.in
--- ltmain.in   3 Jul 2005 16:57:34 -0000       1.334.2.76
+++ ltmain.in   7 Jul 2005 17:00:49 -0000
@@ -251,12 +251,12 @@ func_extract_an_archive ()
     f_ex_an_ar_dir="$1"; shift
     f_ex_an_ar_oldlib="$1"
 
-    $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
-    $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
+    $show "(cd \"$f_ex_an_ar_dir\" && $AR x \"$f_ex_an_ar_oldlib\")"
+    $run eval "(cd \"\$f_ex_an_ar_dir\" && $AR x \"\$f_ex_an_ar_oldlib\")" || 
exit $?
     if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
      :
     else
-      $echo "$modename: ERROR: object name conflicts: 
$f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
+      $echo "$modename: ERROR: object name conflicts: 
\"$f_ex_an_ar_dir/$f_ex_an_ar_oldlib\"" 1>&2
       exit $EXIT_FAILURE
     fi
 }
@@ -1043,7 +1043,7 @@ EOF
     compiler_flags=
     linker_flags=
     dllsearchpath=
-    lib_search_path=`pwd`
+    lib_search_path=\"`pwd`\"
     inst_prefix_dir=
 
     avoid_version=no
@@ -1458,10 +1458,10 @@ EOF
          ;;
        esac
        case "$deplibs " in
-       *" -L$dir "*) ;;
+       *" \"-L$dir\" "*) ;;
        *)
-         deplibs="$deplibs -L$dir"
-         lib_search_path="$lib_search_path $dir"
+         deplibs="$deplibs \"-L$dir\""
+         lib_search_path="$lib_search_path \"$dir\""
          ;;
        esac
        case $host in
@@ -1492,7 +1492,7 @@ EOF
            ;;
          *-*-rhapsody* | *-*-darwin1.[012])
            # Rhapsody C and math libraries are in the System framework
-           deplibs="$deplibs -framework System"
+           deplibs="$deplibs \"-framework\" \"System\""
            continue
          esac
        elif test "X$arg" = "X-lc_r"; then
@@ -1503,7 +1503,7 @@ EOF
           ;;
         esac
        fi
-       deplibs="$deplibs $arg"
+       deplibs="$deplibs \"$arg\""
        continue
        ;;
 
@@ -1814,7 +1814,7 @@ EOF
 
       *.$libext)
        # An archive.
-       deplibs="$deplibs $arg"
+       deplibs="$deplibs \"$arg\""
        old_deplibs="$old_deplibs $arg"
        continue
        ;;
@@ -1831,7 +1831,7 @@ EOF
          dlprefiles="$dlprefiles $arg"
          prev=
        else
-         deplibs="$deplibs $arg"
+         deplibs="$deplibs \"$arg\""
        fi
        continue
        ;;
@@ -1875,7 +1875,17 @@ EOF
 
     if test -n "$shlibpath_var"; then
       # get the directories listed in $shlibpath_var
-      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e 
\'s/:/ /g\'\`
+      shlib_search_path=
+      for var in $shlibpath_var; do
+       eval temp=\$$var
+       save_IFS=$IFS
+       IFS=:
+       for dir in $temp; do
+         IFS=$save_IFS
+         shlib_search_path="\"$dir\" $shlib_search_path"
+       done
+       IFS=$save_IFS
+      done
     else
       shlib_search_path=
     fi
@@ -1925,13 +1935,14 @@ EOF
     libs=
     # Find all interdependent deplibs by searching for libraries
     # that are linked more than once (e.g. -la -lb -la)
-    for deplib in $deplibs; do
+    eval set dummy $deplibs; shift
+    for deplib in ${1+"$@"}; do
       if test "X$duplicate_deps" = "Xyes" ; then
        case "$libs " in
        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
        esac
       fi
-      libs="$libs $deplib"
+      libs="$libs \"$deplib\""
     done
 
     if test "$linkmode" = lib; then
@@ -2000,14 +2011,15 @@ EOF
        save_deplibs="$deplibs"
        deplibs=
       fi
-      for deplib in $libs; do
+      eval set dummy $libs; shift
+      for deplib in ${1+"$@"}; do
        lib=
        found=no
        case $deplib in
        -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
          if test "$linkmode,$pass" = "prog,link"; then
-           compile_deplibs="$deplib $compile_deplibs"
-           finalize_deplibs="$deplib $finalize_deplibs"
+           compile_deplibs="\"$deplib\" $compile_deplibs"
+           finalize_deplibs="\"$deplib\" $finalize_deplibs"
          else
            compiler_flags="$compiler_flags $deplib"
          fi
@@ -2019,7 +2031,8 @@ EOF
            continue
          fi
          name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
-         for searchdir in $newlib_search_path $lib_search_path 
$sys_lib_search_path $shlib_search_path; do
+         eval set dummy $newlib_search_path $lib_search_path 
$sys_lib_search_path $shlib_search_path; shift
+         for searchdir in ${1+"$@"}; do
            for search_ext in .la $std_shrext .so .a; do
              # Search the libtool library
              lib="$searchdir/lib${name}${search_ext}"
@@ -2036,10 +2049,10 @@ EOF
          if test "$found" != yes; then
            # deplib doesn't seem to be a libtool library
            if test "$linkmode,$pass" = "prog,link"; then
-             compile_deplibs="$deplib $compile_deplibs"
-             finalize_deplibs="$deplib $finalize_deplibs"
+             compile_deplibs="\"$deplib\" $compile_deplibs"
+             finalize_deplibs="\"$deplib\" $finalize_deplibs"
            else
-             deplibs="$deplib $deplibs"
+             deplibs="\"$deplib\" $deplibs"
              test "$linkmode" = lib && newdependency_libs="$deplib 
$newdependency_libs"
            fi
            continue
@@ -2066,11 +2079,11 @@ EOF
                    test "X$ladir" = "X$lib" && ladir="."
                    lib=$ladir/$old_library
                    if test "$linkmode,$pass" = "prog,link"; then
-                     compile_deplibs="$deplib $compile_deplibs"
-                     finalize_deplibs="$deplib $finalize_deplibs"
+                     compile_deplibs="\"$deplib\" $compile_deplibs"
+                     finalize_deplibs="\"$deplib\" $finalize_deplibs"
                    else
-                     deplibs="$deplib $deplibs"
-                     test "$linkmode" = lib && newdependency_libs="$deplib 
$newdependency_libs"
+                     deplibs="\"$deplib\" $deplibs"
+                     test "$linkmode" = lib && newdependency_libs="\"$deplib\" 
$newdependency_libs"
                    fi
                    continue
                  fi
@@ -2084,23 +2097,23 @@ EOF
        -L*)
          case $linkmode in
          lib)
-           deplibs="$deplib $deplibs"
+           deplibs="\"$deplib\" $deplibs"
            test "$pass" = conv && continue
-           newdependency_libs="$deplib $newdependency_libs"
-           newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed 
-e 's/^-L//'`
+           newdependency_libs="\"$deplib\" $newdependency_libs"
+           newlib_search_path="$newlib_search_path "\"`$echo "X$deplib" | 
$Xsed -e 's/^-L//'`\" ### testsuite: skip nested quoting test
            ;;
          prog)
            if test "$pass" = conv; then
-             deplibs="$deplib $deplibs"
+             deplibs="\"$deplib\" $deplibs"
              continue
            fi
            if test "$pass" = scan; then
-             deplibs="$deplib $deplibs"
+             deplibs="\"$deplib\" $deplibs"
            else
-             compile_deplibs="$deplib $compile_deplibs"
-             finalize_deplibs="$deplib $finalize_deplibs"
+             compile_deplibs="\"$deplib\" $compile_deplibs"
+             finalize_deplibs="\"$deplib\" $finalize_deplibs"
            fi
-           newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed 
-e 's/^-L//'`
+           newlib_search_path="$newlib_search_path "\"`$echo "X$deplib" | 
$Xsed -e 's/^-L//'`\" ### testsuite: skip nested quoting test
            ;;
          *)
            $echo "$modename: warning: \`-L' is ignored for archives/objects" 
1>&2
@@ -2117,13 +2130,13 @@ EOF
            *) xrpath="$xrpath $dir" ;;
            esac
          fi
-         deplibs="$deplib $deplibs"
+         deplibs="\"$deplib\" $deplibs"
          continue
          ;;
        *.la) lib="$deplib" ;;
        *.$libext)
          if test "$pass" = conv; then
-           deplibs="$deplib $deplibs"
+           deplibs="\"$deplib\" $deplibs"
            continue
          fi
          case $linkmode in
@@ -2155,16 +2168,16 @@ EOF
              $echo
              $echo "*** Warning: Linking the shared library $output against 
the"
              $echo "*** static library $deplib is not portable!"
-             deplibs="$deplib $deplibs"
+             deplibs="\"$deplib\" $deplibs"
            fi
            continue
            ;;
          prog)
            if test "$pass" != link; then
-             deplibs="$deplib $deplibs"
+             deplibs="\"$deplib\" $deplibs"
            else
-             compile_deplibs="$deplib $compile_deplibs"
-             finalize_deplibs="$deplib $finalize_deplibs"
+             compile_deplibs="\"$deplib\" $compile_deplibs"
+             finalize_deplibs="\"$deplib\" $finalize_deplibs"
            fi
            continue
            ;;
@@ -2172,14 +2185,14 @@ EOF
          ;; # *.$libext
        *.lo | *.$objext)
          if test "$pass" = conv; then
-           deplibs="$deplib $deplibs"
+           deplibs="\"$deplib\" $deplibs"
          elif test "$linkmode" = prog; then
            if test "$pass" = dlpreopen || test "$dlopen_support" != yes || 
test "$build_libtool_libs" = no; then
              # If there is no dlopen support or we're linking statically,
              # we need to preload.
              newdlprefiles="$newdlprefiles $deplib"
-             compile_deplibs="$deplib $compile_deplibs"
-             finalize_deplibs="$deplib $finalize_deplibs"
+             compile_deplibs="\"$deplib\" $compile_deplibs"
+             finalize_deplibs="\"$deplib\" $finalize_deplibs"
            else
              newdlfiles="$newdlfiles $deplib"
            fi
@@ -2198,7 +2211,7 @@ EOF
        fi
 
        # Check to see that this really is a libtool archive.
-       if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 
2>&1; then :
+       if (${SED} -e '2q' "$lib" | grep "^# Generated by .*$PACKAGE") 
>/dev/null 2>&1; then :
        else
          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
          exit $EXIT_FAILURE
@@ -2222,8 +2235,8 @@ EOF
 
        # Read the .la file
        case $lib in
-       */* | *\\*) . $lib ;;
-       *) . ./$lib ;;
+       */* | *\\*) . "$lib" ;;
+       *) . "./$lib" ;;
        esac
 
        if test "$linkmode,$pass" = "lib,link" ||
@@ -2235,7 +2248,7 @@ EOF
 
        if test "$pass" = conv; then
          # Only check for convenience libraries
-         deplibs="$lib $deplibs"
+         deplibs="\"$lib\" $deplibs"
          if test -z "$libdir"; then
            if test -z "$old_library"; then
              $echo "$modename: cannot find name of link library for \`$lib'" 
1>&2
@@ -2245,8 +2258,9 @@ EOF
            convenience="$convenience $ladir/$objdir/$old_library"
            old_convenience="$old_convenience $ladir/$objdir/$old_library"
            tmp_libs=
-           for deplib in $dependency_libs; do
-             deplibs="$deplib $deplibs"
+           eval set dummy $dependency_libs; shift
+           for deplib in ${1+"$@"}; do
+             deplibs="\"$deplib\" $deplibs"
               if test "X$duplicate_deps" = "Xyes" ; then
                case "$tmp_libs " in
                *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
@@ -2354,20 +2368,20 @@ EOF
        if test -z "$libdir"; then
          # Link the convenience library
          if test "$linkmode" = lib; then
-           deplibs="$dir/$old_library $deplibs"
+           deplibs="\"$dir/$old_library\" $deplibs"
          elif test "$linkmode,$pass" = "prog,link"; then
-           compile_deplibs="$dir/$old_library $compile_deplibs"
-           finalize_deplibs="$dir/$old_library $finalize_deplibs"
+           compile_deplibs="\"$dir/$old_library\" $compile_deplibs"
+           finalize_deplibs="\"$dir/$old_library\" $finalize_deplibs"
          else
-           deplibs="$lib $deplibs" # used for prog,scan pass
+           deplibs="\"$lib\" $deplibs" # used for prog,scan pass
          fi
          continue
        fi
 
 
        if test "$linkmode" = prog && test "$pass" != link; then
-         newlib_search_path="$newlib_search_path $ladir"
-         deplibs="$lib $deplibs"
+         newlib_search_path="$newlib_search_path \"$ladir\""
+         deplibs="\"$lib\" $deplibs"
 
          linkalldeplibs=no
          if test "$link_all_deplibs" != no || test -z "$library_names" ||
@@ -2376,17 +2390,18 @@ EOF
          fi
 
          tmp_libs=
-         for deplib in $dependency_libs; do
+         eval set dummy $dependency_libs; shift
+         for deplib in ${1+"$@"}; do
            case $deplib in
-           -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | 
$Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
+           -L*) newlib_search_path="$newlib_search_path "\"`$echo "X$deplib" | 
$Xsed -e 's/^-L//'`\";; ### testsuite: skip nested quoting test
            esac
            # Need to link against all dependency_libs?
            if test "$linkalldeplibs" = yes; then
-             deplibs="$deplib $deplibs"
+             deplibs="\"$deplib\" $deplibs"
            else
              # Need to hardcode shared library paths
              # or/and link against static libraries
-             newdependency_libs="$deplib $newdependency_libs"
+             newdependency_libs="\"$deplib\" $newdependency_libs"
            fi
            if test "X$duplicate_deps" = "Xyes" ; then
              case "$tmp_libs " in
@@ -2405,9 +2420,9 @@ EOF
            if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
              # Make sure the rpath contains only unique directories.
              case "$temp_rpath " in
-             *" $dir "*) ;;
-             *" $absdir "*) ;;
-             *) temp_rpath="$temp_rpath $absdir" ;;
+             *" \"$dir\" "*) ;;
+             *" \"$absdir\" "*) ;;
+             *) temp_rpath="$temp_rpath \"$absdir\"" ;;
              esac
            fi
 
@@ -2418,8 +2433,8 @@ EOF
            *" $absdir "*) ;;
            *)
              case "$compile_rpath " in
-             *" $absdir "*) ;;
-             *) compile_rpath="$compile_rpath $absdir"
+             *" \"$absdir\" "*) ;;
+             *) compile_rpath="$compile_rpath \"$absdir\""
              esac
              ;;
            esac
@@ -2472,8 +2487,8 @@ EOF
            *" $absdir "*) ;;
            *)
              case "$compile_rpath " in
-             *" $absdir "*) ;;
-             *) compile_rpath="$compile_rpath $absdir"
+             *" \"$absdir\" "*) ;;
+             *) compile_rpath="$compile_rpath \"$absdir\""
              esac
              ;;
            esac
@@ -2622,11 +2637,11 @@ EOF
              esac
            fi
            if test "$linkmode" = prog; then
-             test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
-             test -n "$add" && compile_deplibs="$add $compile_deplibs"
+             test -n "$add_dir" && compile_deplibs="\"$add_dir\" 
$compile_deplibs"
+             test -n "$add" && compile_deplibs="\"$add\" $compile_deplibs"
            else
-             test -n "$add_dir" && deplibs="$add_dir $deplibs"
-             test -n "$add" && deplibs="$add $deplibs"
+             test -n "$add_dir" && deplibs="\"$add_dir\" $deplibs"
+             test -n "$add" && deplibs="\"$add\" $deplibs"
              if test "$hardcode_direct" != yes && \
                 test "$hardcode_minus_L" != yes && \
                 test "$hardcode_shlibpath_var" = yes; then
@@ -2676,11 +2691,11 @@ EOF
            fi
 
            if test "$linkmode" = prog; then
-             test -n "$add_dir" && finalize_deplibs="$add_dir 
$finalize_deplibs"
-             test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
+             test -n "$add_dir" && finalize_deplibs="\"$add_dir\" 
$finalize_deplibs"
+             test -n "$add" && finalize_deplibs="\"$add\" $finalize_deplibs"
            else
-             test -n "$add_dir" && deplibs="$add_dir $deplibs"
-             test -n "$add" && deplibs="$add $deplibs"
+             test -n "$add_dir" && deplibs="\"$add_dir\" $deplibs"
+             test -n "$add" && deplibs="\"$add\" $deplibs"
            fi
          fi
        elif test "$linkmode" = prog; then
@@ -2689,11 +2704,11 @@ EOF
          # shared platforms.
          if test "$hardcode_direct" != unsupported; then
            test -n "$old_library" && linklib="$old_library"
-           compile_deplibs="$dir/$linklib $compile_deplibs"
-           finalize_deplibs="$dir/$linklib $finalize_deplibs"
+           compile_deplibs="\"$dir/$linklib\" $compile_deplibs"
+           finalize_deplibs="\"$dir/$linklib\" $finalize_deplibs"
          else
-           compile_deplibs="-l$name -L$dir $compile_deplibs"
-           finalize_deplibs="-l$name -L$dir $finalize_deplibs"
+           compile_deplibs="\"-l$name\" \"-L$dir\" $compile_deplibs"
+           finalize_deplibs="\"-l$name\" \"-L$dir\" $finalize_deplibs"
          fi
        elif test "$build_libtool_libs" = yes; then
          # Not a shared library
@@ -2727,7 +2742,7 @@ EOF
              fi
            fi
          else
-           deplibs="$dir/$old_library $deplibs"
+           deplibs="\"$dir/$old_library\" $deplibs"
            link_static=yes
          fi
        fi # link shared/static library?
@@ -2739,7 +2754,8 @@ EOF
               test "$link_static" = yes; }; then
            # Extract -R from dependency_libs
            temp_deplibs=
-           for libdir in $dependency_libs; do
+           eval set dummy $dependency_libs; shift
+           for libdir in ${1+"$@"}; do
              case $libdir in
              -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
                   case " $xrpath " in
@@ -2752,13 +2768,14 @@ EOF
            dependency_libs="$temp_deplibs"
          fi
 
-         newlib_search_path="$newlib_search_path $absdir"
+         newlib_search_path="$newlib_search_path \"$absdir\""
          # Link against this library
-         test "$link_static" = no && newdependency_libs="$abs_ladir/$laname 
$newdependency_libs"
+         test "$link_static" = no && 
newdependency_libs="\"$abs_ladir/$laname\" $newdependency_libs"
          # ... and its dependency_libs
          tmp_libs=
-         for deplib in $dependency_libs; do
-           newdependency_libs="$deplib $newdependency_libs"
+         eval set dummy $dependency_libs; shift
+         for deplib in ${1+"$@"}; do
+           newdependency_libs="\"$deplib\" $newdependency_libs"
            if test "X$duplicate_deps" = "Xyes" ; then
              case "$tmp_libs " in
              *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
@@ -2769,7 +2786,8 @@ EOF
 
          if test "$link_all_deplibs" != no; then
            # Add the search paths of all dependency libraries
-           for deplib in $dependency_libs; do
+           eval set dummy $dependency_libs; shift
+           for deplib in ${1+"$@"}; do
              case $deplib in
              -L*) path="$deplib" ;;
              *.la)
@@ -2814,8 +2832,8 @@ EOF
                    fi
                    # do not add paths which are already there
                    case " $newlib_search_path " in
-                   *" $path "*) ;;
-                   *) newlib_search_path="$newlib_search_path $path";;
+                   *" \"$path\" "*) ;;
+                   *) newlib_search_path="$newlib_search_path \"$path\"";;
                    esac
                  fi
                  path=""
@@ -2830,7 +2848,8 @@ EOF
                *-*-darwin*)
                  # Again, we only want to link against shared libraries
                  eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
-                 for tmp in $newlib_search_path ; do
+                 eval set dummy $newlib_search_path; shift
+                 for tmp in ${1+"$@"} ; do
                    if test -f "$tmp/lib$tmp_libs.dylib" ; then
                      eval depdepl="$tmp/lib$tmp_libs.dylib"
                      break
@@ -2845,31 +2864,33 @@ EOF
              esac
              case " $deplibs " in
              *" $path "*) ;;
-             *) deplibs="$path $deplibs" ;;
+             *) deplibs="\"$path\" $deplibs" ;;
              esac
              case " $deplibs " in
-             *" $depdepl "*) ;;
-             *) deplibs="$depdepl $deplibs" ;;
+             *" \"$depdepl\" "*) ;;
+             *) deplibs="\"$depdepl\" $deplibs" ;;
              esac
            done
          fi # link_all_deplibs != no
        fi # linkmode = lib
       done # for deplib in $libs
-      dependency_libs="$newdependency_libs"
+      dependency_libs=$newdependency_libs
       if test "$pass" = dlpreopen; then
        # Link the dlpreopened libraries before other libraries
-       for deplib in $save_deplibs; do
-         deplibs="$deplib $deplibs"
+       eval set dummy $save_deplibs; shift
+       for deplib in ${1+"$@"}; do
+         deplibs="\"$deplib\" $deplibs"
        done
       fi
       if test "$pass" != dlopen; then
        if test "$pass" != conv; then
          # Make sure lib_search_path contains only unique directories.
          lib_search_path=
-         for dir in $newlib_search_path; do
+         eval set dummy $newlib_search_path; shift
+         for dir in ${1+"$@"}; do
            case "$lib_search_path " in
-           *" $dir "*) ;;
-           *) lib_search_path="$lib_search_path $dir" ;;
+           *" \"$dir\" "*) ;;
+           *) lib_search_path="$lib_search_path \"$dir\"" ;;
            esac
          done
          newlib_search_path=
@@ -2882,9 +2903,10 @@ EOF
        fi
        for var in $vars dependency_libs; do
          # Add libraries to $var in reverse order
-         eval tmp_libs=\"\$$var\"
+         eval tmp_libs=\$$var
          new_libs=
-         for deplib in $tmp_libs; do
+         eval set dummy $tmp_libs; shift
+         for deplib in ${1+"$@"}; do
            # FIXME: Pedantically, this is the right thing to do, so
            #        that some nasty dependency loop isn't accidentally
            #        broken:
@@ -2892,7 +2914,7 @@ EOF
            # Pragmatically, this seems to cause very few problems in
            # practice:
            case $deplib in
-           -L*) new_libs="$deplib $new_libs" ;;
+           -L*) new_libs="\"$deplib\" $new_libs" ;;
            -R*) ;;
            *)
              # And here is the reason: when a library appears more
@@ -2910,11 +2932,11 @@ EOF
              # using -Wl,-lname, so that libtool does not consider it
              # for duplicate removal.
              case " $specialdeplibs " in
-             *" $deplib "*) new_libs="$deplib $new_libs" ;;
+             *" $deplib "*) new_libs="\"$deplib\" $new_libs" ;;
              *)
                case " $new_libs " in
-               *" $deplib "*) ;;
-               *) new_libs="$deplib $new_libs" ;;
+               *" \"$deplib\" "*) ;;
+               *) new_libs="\"$deplib\" $new_libs" ;;
                esac
                ;;
              esac
@@ -2922,31 +2944,33 @@ EOF
            esac
          done
          tmp_libs=
-         for deplib in $new_libs; do
+         eval set dummy $new_libs; shift
+         for deplib in ${1+"$@"}; do
            case $deplib in
            -L*)
              case " $tmp_libs " in
-             *" $deplib "*) ;;
-             *) tmp_libs="$tmp_libs $deplib" ;;
+             *" \"$deplib\" "*) ;;
+             *) tmp_libs="$tmp_libs \"$deplib\"" ;;
              esac
              ;;
-           *) tmp_libs="$tmp_libs $deplib" ;;
+           *) tmp_libs="$tmp_libs \"$deplib\"" ;;
            esac
          done
-         eval $var=\"$tmp_libs\"
+         eval $var=\$tmp_libs
        done # for var
       fi
       # Last step: remove runtime libs from dependency_libs
       # (they stay in deplibs)
       tmp_libs=
-      for i in $dependency_libs ; do
+      eval set dummy $dependency_libs; shift
+      for i in ${1+"$@"} ; do
        case " $predeps $postdeps $compiler_lib_search_path " in
        *" $i "*)
          i=""
          ;;
        esac
        if test -n "$i" ; then
-         tmp_libs="$tmp_libs $i"
+         tmp_libs="$tmp_libs \"$i\""
        fi
       done
       dependency_libs=$tmp_libs
@@ -3314,8 +3338,8 @@ EOF
       # Eliminate all temporary directories.
       for path in $notinst_path; do
        lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
-       deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
-       dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % 
%g'`
+       deplibs=`$echo "$deplibs " | ${SED} -e 's% \"-L$path\" % %g'`
+       dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% \"-L$path\" 
% %g'`
       done
 
       if test -n "$xrpath"; then
@@ -3329,7 +3353,7 @@ EOF
          esac
        done
        if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; 
then
-         dependency_libs="$temp_xrpath $dependency_libs"
+         dependency_libs="\"$temp_xrpath\" $dependency_libs"
        fi
       fi
 
@@ -3361,7 +3385,7 @@ EOF
            ;;
          *-*-rhapsody* | *-*-darwin1.[012])
            # Rhapsody C library is in the System framework
-           deplibs="$deplibs -framework System"
+           deplibs="$deplibs \"-framework\" \"System\""
            ;;
          *-*-netbsd*)
            # Don't link with libc until the a.out ld.so is fixed.
@@ -3373,7 +3397,7 @@ EOF
          *)
            # Add libc to deplibs on all other systems if necessary.
            if test "$build_libtool_need_lc" = "yes"; then
-             deplibs="$deplibs -lc"
+             deplibs="$deplibs \"-lc\""
            fi
            ;;
          esac
@@ -3415,14 +3439,15 @@ EOF
          $LTCC -o conftest conftest.c $deplibs
          if test "$?" -eq 0 ; then
            ldd_output=`ldd conftest`
-           for i in $deplibs; do
-             name=`expr $i : '-l\(.*\)'`
+           eval set dummy $deplibs; shift
+           for i in ${1+"$@"}; do
+             name=`expr "$i" : '-l\(.*\)'`
              # If $name is empty we are operating on a -L argument.
               if test "$name" != "" && test "$name" -ne "0"; then
                if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; 
then
                  case " $predeps $postdeps " in
                  *" $i "*)
-                   newdeplibs="$newdeplibs $i"
+                   newdeplibs="$newdeplibs \"$i\""
                    i=""
                    ;;
                  esac
@@ -3433,7 +3458,7 @@ EOF
                  set dummy $deplib_matches
                  deplib_match=$2
                  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
-                   newdeplibs="$newdeplibs $i"
+                   newdeplibs="$newdeplibs \"$i\""
                  else
                    droppeddeps=yes
                    $echo
@@ -3446,14 +3471,15 @@ EOF
                  fi
                fi
              else
-               newdeplibs="$newdeplibs $i"
+               newdeplibs="$newdeplibs \"$i\""
              fi
            done
          else
            # Error occurred in the first compile.  Let's try to salvage
            # the situation: Compile a separate program for each library.
-           for i in $deplibs; do
-             name=`expr $i : '-l\(.*\)'`
+           eval set dummy $deplibs; shift
+           for i in ${1+"$@"}; do
+             name=`expr "$i" : '-l\(.*\)'`
              # If $name is empty we are operating on a -L argument.
               if test "$name" != "" && test "$name" != "0"; then
                $rm conftest
@@ -3464,7 +3490,7 @@ EOF
                  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" 
; then
                    case " $predeps $postdeps " in
                    *" $i "*)
-                     newdeplibs="$newdeplibs $i"
+                     newdeplibs="$newdeplibs \"$i\""
                      i=""
                      ;;
                    esac
@@ -3475,7 +3501,7 @@ EOF
                    set dummy $deplib_matches
                    deplib_match=$2
                    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; 
then
-                     newdeplibs="$newdeplibs $i"
+                     newdeplibs="$newdeplibs \"$i\""
                    else
                      droppeddeps=yes
                      $echo
@@ -3496,7 +3522,7 @@ EOF
                  $echo "*** functional.  Installing it before continuing would 
be even better."
                fi
              else
-               newdeplibs="$newdeplibs $i"
+               newdeplibs="$newdeplibs \"$i\""
              fi
            done
          fi
@@ -3504,23 +3530,29 @@ EOF
        file_magic*)
          set dummy $deplibs_check_method
          file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
-         for a_deplib in $deplibs; do
-           name=`expr $a_deplib : '-l\(.*\)'`
+           eval set dummy $deplibs; shift
+           for a_deplib in ${1+"$@"}; do
+           name=`expr "$a_deplib" : '-l\(.*\)'`
            # If $name is empty we are operating on a -L argument.
             if test "$name" != "" && test  "$name" != "0"; then
              if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; 
then
                case " $predeps $postdeps " in
                *" $a_deplib "*)
-                 newdeplibs="$newdeplibs $a_deplib"
+                 newdeplibs="$newdeplibs \"$a_deplib\""
                  a_deplib=""
                  ;;
                esac
              fi
              if test -n "$a_deplib" ; then
                libname=`eval \\$echo \"$libname_spec\"`
-               for i in $lib_search_path $sys_lib_search_path 
$shlib_search_path; do
-                 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
-                 for potent_lib in $potential_libs; do
+               eval set dummy $lib_search_path $sys_lib_search_path 
$shlib_search_path; shift
+               for i in ${1+"$@"}; do
+                 for potent_lib in "$i/$libname"[.-]*; do
+                     if test "$potent_lib" = "$i/$libname[.-]*"; then
+                       # No matches.
+                       continue
+                     fi
+
                      # Follow soft links.
                      if ls -lLd "$potent_lib" 2>/dev/null \
                         | grep " -> " >/dev/null; then
@@ -3533,7 +3565,7 @@ EOF
                      # but so what?
                      potlib="$potent_lib"
                      while test -h "$potlib" 2>/dev/null; do
-                       potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
+                       potliblink=`ls -ld "$potlib" | ${SED} 's/.* -> //'`
                        case $potliblink in
                        [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
                        *) potlib=`$echo "X$potlib" | $Xsed -e 
's,[^/]*$,,'`"$potliblink";;
@@ -3542,7 +3574,7 @@ EOF
                      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
                         | ${SED} 10q \
                         | $EGREP "$file_magic_regex" > /dev/null; then
-                       newdeplibs="$newdeplibs $a_deplib"
+                       newdeplibs="$newdeplibs \"$a_deplib\""
                        a_deplib=""
                        break 2
                      fi
@@ -3566,35 +3598,41 @@ EOF
              fi
            else
              # Add a -L argument.
-             newdeplibs="$newdeplibs $a_deplib"
+             newdeplibs="$newdeplibs \"$a_deplib\""
            fi
          done # Gone through all deplibs.
          ;;
        match_pattern*)
          set dummy $deplibs_check_method
          match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
-         for a_deplib in $deplibs; do
-           name=`expr $a_deplib : '-l\(.*\)'`
+         eval set dummy $deplibs; shift
+         for a_deplib in ${1+"$@"}; do
+           name=`expr "$a_deplib" : '-l\(.*\)'`
            # If $name is empty we are operating on a -L argument.
            if test -n "$name" && test "$name" != "0"; then
              if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; 
then
                case " $predeps $postdeps " in
                *" $a_deplib "*)
-                 newdeplibs="$newdeplibs $a_deplib"
+                 newdeplibs="$newdeplibs \"$a_deplib\""
                  a_deplib=""
                  ;;
                esac
              fi
              if test -n "$a_deplib" ; then
                libname=`eval \\$echo \"$libname_spec\"`
-               for i in $lib_search_path $sys_lib_search_path 
$shlib_search_path; do
-                 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
-                 for potent_lib in $potential_libs; do
+               eval set dummy $lib_search_path $sys_lib_search_path 
$shlib_search_path; shift
+               for i in ${1+"$@"}; do
+                 for potent_lib in "$i/$libname"[.-]*; do
+                   if test "$potent_lib" = "$i/$libname[.-]*"; then
+                     # No matches.
+                     continue
+                   fi
+
                    potlib="$potent_lib" # see symlink-check above in 
file_magic test
                    if eval $echo \"$potent_lib\" 2>/dev/null \
                        | ${SED} 10q \
                        | $EGREP "$match_pattern_regex" > /dev/null; then
-                     newdeplibs="$newdeplibs $a_deplib"
+                     newdeplibs="$newdeplibs \"$a_deplib\""
                      a_deplib=""
                      break 2
                    fi
@@ -3618,18 +3656,18 @@ EOF
              fi
            else
              # Add a -L argument.
-             newdeplibs="$newdeplibs $a_deplib"
+             newdeplibs="$newdeplibs \"$a_deplib\""
            fi
          done # Gone through all deplibs.
          ;;
        none | unknown | *)
          newdeplibs=""
-         tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
+         tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ \"-lc\"$//' \
            -e 's/ -[LR][^ ]*//g'`
          if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
            for i in $predeps $postdeps ; do
              # can't use Xsed below, because $i might contain '/'
-             tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e 
"s,$i,,"`
+             tmp_deplibs=`$echo "X $tmp_deplibs" | $Xsed -e "s,$i,,"`
            done
          fi
          if $echo "X $tmp_deplibs" | $Xsed -e 's/[     ]//g' \
@@ -3654,7 +3692,7 @@ EOF
        case $host in
        *-*-rhapsody* | *-*-darwin1.[012])
          # On Rhapsody replace the C library is the System framework
-         newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework 
System /'`
+         newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ "-lc" / "-framework" 
"System" /'`
          ;;
        esac
 
@@ -3832,11 +3870,12 @@ EOF
        fi
 
        tmp_deplibs=
-       for test_deplib in $deplibs; do
+       eval set dummy $deplibs; shift
+       for test_deplib in ${1+"$@"}; do
                case " $convenience " in
                *" $test_deplib "*) ;;
                *)
-                       tmp_deplibs="$tmp_deplibs $test_deplib"
+                       tmp_deplibs="$tmp_deplibs \"$test_deplib\""
                        ;;
                esac
        done
@@ -4214,7 +4253,8 @@ EOF
       # Now hardcode the library paths
       rpath=
       hardcode_libdirs=
-      for libdir in $compile_rpath $finalize_rpath; do
+      eval set dummy $compile_rpath $finalize_rpath; shift
+      for libdir in ${1+"$@"}; do
        if test -n "$hardcode_libdir_flag_spec"; then
          if test -n "$hardcode_libdir_separator"; then
            if test -z "$hardcode_libdirs"; then
@@ -4529,7 +4569,8 @@ static const void *lt_preloaded_setup() 
       if test -n "$shlibpath_var"; then
        # We should set the shlibpath_var
        rpath=
-       for dir in $temp_rpath; do
+       eval set dummy $temp_rpath; shift
+       for dir in ${1+"$@"}; do
          case $dir in
          [\\/]* | [A-Za-z]:[\\/]*)
            # Absolute path.
@@ -5013,7 +5054,7 @@ else
        if test -n "$dllsearchpath"; then
          $echo >> $output "\
     # Add the dll search path components to the executable PATH
-    PATH=$dllsearchpath:\$PATH
+    PATH=\"$dllsearchpath\":\$PATH
 "
        fi
 
@@ -5238,21 +5279,22 @@ fi\
            output="$output_objdir/$outputname"i
            # Replace all uninstalled libtool libraries with the installed ones
            newdependency_libs=
-           for deplib in $dependency_libs; do
+           eval set dummy $dependency_libs; shift
+           for deplib in ${1+"$@"}; do
              case $deplib in
              *.la)
                name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
-               eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+               eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' "$deplib"`
                if test -z "$libdir"; then
                  $echo "$modename: \`$deplib' is not a valid libtool archive" 
1>&2
                  exit $EXIT_FAILURE
                fi
-               newdependency_libs="$newdependency_libs $libdir/$name"
+               newdependency_libs="$newdependency_libs \"$libdir/$name\""
                ;;
-             *) newdependency_libs="$newdependency_libs $deplib" ;;
+             *) newdependency_libs="$newdependency_libs \"$deplib\"" ;;
              esac
            done
-           dependency_libs="$newdependency_libs"
+           dependency_libs=$newdependency_libs
            newdlfiles=
            for lib in $dlfiles; do
              name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
Index: demo/Makefile.am
===================================================================
RCS file: /cvsroot/libtool/libtool/demo/Attic/Makefile.am,v
retrieving revision 1.29.2.2
diff -u -p -r1.29.2.2 Makefile.am
--- demo/Makefile.am    19 Sep 2004 12:04:52 -0000      1.29.2.2
+++ demo/Makefile.am    7 Jul 2005 17:00:50 -0000
@@ -98,7 +98,7 @@ hc-libflag: $(hell_OBJECTS) $(hell_DEPEN
            echo unsupported > $@ || status="$$?"; \
          else \
            echo "$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$flag 
-L$(libdir) -lhello $(LIBS) $(LIBM)"; \
-           $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$flag -L$(libdir) 
-lhello $(LIBS) $(LIBM) || status="$$?"; \
+           eval "$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$flag 
-L$(libdir) -lhello $(LIBS) $(LIBM)" || status="$$?"; \
          fi; \
          exit $$status
 
Index: tests/link-order.test
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/Attic/link-order.test,v
retrieving revision 1.1.2.1
diff -u -p -r1.1.2.1 link-order.test
--- tests/link-order.test       8 Apr 2005 15:17:28 -0000       1.1.2.1
+++ tests/link-order.test       7 Jul 2005 17:00:50 -0000
@@ -52,6 +52,7 @@ EOF
   $libtool --mode=link $CC $CFLAGS -o $srcdir/liba.la $srcdir/a.lo \
       $srcdir/libb.la -L$prefix_old/lib -lcee -rpath $prefix/lib
   $libtool --mode=install cp $srcdir/libb.la $prefix/lib/libb.la
+  #sh -x $libtool --mode=install cp $srcdir/liba.la $prefix/lib/liba.la
   $libtool --mode=install cp $srcdir/liba.la $prefix/lib/liba.la \
       >$srcdir/stdout 2>$srcdir/stderr || retcode=1
   cat $srcdir/stdout
@@ -60,7 +61,7 @@ done
 
 # Do not error if we do not relink (e.g. static-only systems)
 if $EGREP relinking $srcdir/stderr; then
-  if $EGREP ' -L.*\/new\/lib -lb -L.*\/old\/lib -lcee' $srcdir/stdout; then :; 
else
+  if $EGREP ' "-L.*\/new\/lib" "-lb" "-L.*\/old\/lib" "-lcee"' $srcdir/stdout; 
then :; else
     echo "$0: wrong link order" 1>&2
     retcode=1
   fi
Index: tests/link.test
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/link.test,v
retrieving revision 1.2
diff -u -p -r1.2 link.test
--- tests/link.test     30 Jun 2001 20:31:34 -0000      1.2
+++ tests/link.test     7 Jul 2005 17:00:50 -0000
@@ -16,7 +16,7 @@ test $? -eq 0 || exit 1
 
 echo "$linkresult"
 case "$linkresult" in
-*../lib/libnlsut.a) ;;
+*\"../lib/libnlsut.a\") ;;
 *)
   echo "$progname: ../lib/libnlsut.a was not used as expected in linking"
   exit 1

reply via email to

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