automake/autoconf fluctuations
[swftools.git] / ltmain.sh
index 46a9450..dbb5277 100644 (file)
--- a/ltmain.sh
+++ b/ltmain.sh
@@ -48,6 +48,9 @@ EOF
   exit 0
 fi
 
+# define SED for historic ltconfig's generated by Libtool 1.3
+test -z "$SED" && SED=sed
+
 # The name of this program.
 progname=`$echo "$0" | ${SED} 's%^.*/%%'`
 modename="$progname"
@@ -55,8 +58,8 @@ modename="$progname"
 # Constants.
 PROGRAM=ltmain.sh
 PACKAGE=libtool
-VERSION=1.4.2a
-TIMESTAMP=" (1.922.2.100 2002/06/26 07:25:14)"
+VERSION=1.4.3
+TIMESTAMP=" (1.922.2.111 2002/10/23 02:54:36)"
 
 default_mode=
 help="Try \`$progname --help' for more information."
@@ -226,7 +229,7 @@ if test -z "$show_help"; then
   # Infer the operation mode.
   if test -z "$mode"; then
     case $nonopt in
-    *cc | *++ | gcc* | *-gcc*)
+    *cc | *++ | gcc* | *-gcc* | xlc*)
       mode=link
       for arg
       do
@@ -899,7 +902,7 @@ compiler."
          prev=
          continue
          ;;
-       inst_prefix)
+        inst_prefix)
          inst_prefix_dir="$arg"
          prev=
          continue
@@ -1006,9 +1009,9 @@ compiler."
        ;;
 
       -inst-prefix-dir)
-       prev=inst_prefix
-       continue
-       ;;
+       prev=inst_prefix
+       continue
+       ;;
 
       # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
       # so, if we see these flags be careful not to treat them like -L
@@ -1211,6 +1214,11 @@ compiler."
        continue
        ;;
 
+      -Kthread | -mthreads | -mt | -pthread | -pthreads | -threads | -qthreaded | -kthread )
+        compiler_flags="$compiler_flags $arg"
+        continue
+        ;;
+
       # Some other compiler flag.
       -* | +*)
        # Unknown arguments in both finalize_command and compile_command need
@@ -1390,7 +1398,7 @@ compiler."
        ;;
     esac
     for pass in $passes; do
-      if test $linkmode = prog; then
+      if test "$linkmode" = prog; then
        # Determine which files to process
        case $pass in
        dlopen)
@@ -1407,11 +1415,11 @@ compiler."
        found=no
        case $deplib in
        -l*)
-         if test $linkmode = oldlib && test $linkmode = obj; then
+         if test "$linkmode" = oldlib && test "$linkmode" = obj; then
            $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
            continue
          fi
-         if test $pass = conv; then
+         if test "$pass" = conv; then
            deplibs="$deplib $deplibs"
            continue
          fi
@@ -1431,7 +1439,7 @@ compiler."
              finalize_deplibs="$deplib $finalize_deplibs"
            else
              deplibs="$deplib $deplibs"
-             test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
+             test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
            fi
            continue
          fi
@@ -1440,16 +1448,16 @@ compiler."
          case $linkmode in
          lib)
            deplibs="$deplib $deplibs"
-           test $pass = conv && continue
+           test "$pass" = conv && continue
            newdependency_libs="$deplib $newdependency_libs"
            newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
            ;;
          prog)
-           if test $pass = conv; then
+           if test "$pass" = conv; then
              deplibs="$deplib $deplibs"
              continue
            fi
-           if test $pass = scan; then
+           if test "$pass" = scan; then
              deplibs="$deplib $deplibs"
              newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
            else
@@ -1464,7 +1472,7 @@ compiler."
          continue
          ;; # -L
        -R*)
-         if test $pass = link; then
+         if test "$pass" = link; then
            dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
            # Make sure the xrpath contains only unique directories.
            case "$xrpath " in
@@ -1477,7 +1485,7 @@ compiler."
          ;;
        *.la) lib="$deplib" ;;
        *.$libext)
-         if test $pass = conv; then
+         if test "$pass" = conv; then
            deplibs="$deplib $deplibs"
            continue
          fi
@@ -1500,7 +1508,7 @@ compiler."
            continue
            ;;
          prog)
-           if test $pass != link; then
+           if test "$pass" != link; then
              deplibs="$deplib $deplibs"
            else
              compile_deplibs="$deplib $compile_deplibs"
@@ -1511,7 +1519,7 @@ compiler."
          esac # linkmode
          ;; # *.$libext
        *.lo | *.$objext)
-         if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; 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"
@@ -1527,7 +1535,7 @@ compiler."
          continue
          ;;
        esac # case $deplib
-       if test $found = yes || test -f "$lib"; then :
+       if test "$found" = yes || test -f "$lib"; then :
        else
          $echo "$modename: cannot find the library \`$lib'" 1>&2
          exit 1
@@ -1561,13 +1569,13 @@ compiler."
 
        if test "$linkmode,$pass" = "lib,link" ||
           test "$linkmode,$pass" = "prog,scan" ||
-          { test $linkmode = oldlib && test $linkmode = obj; }; then
+          { test "$linkmode" = oldlib && test "$linkmode" = obj; }; then
           # Add dl[pre]opened files of deplib
          test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
          test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
        fi
 
-       if test $pass = conv; then
+       if test "$pass" = conv; then
          # Only check for convenience libraries
          deplibs="$lib $deplibs"
          if test -z "$libdir"; then
@@ -1588,7 +1596,7 @@ compiler."
               fi
              tmp_libs="$tmp_libs $deplib"
            done
-         elif test $linkmode != prog && test $linkmode != lib; then
+         elif test "$linkmode" != prog && test "$linkmode" != lib; then
            $echo "$modename: \`$lib' is not a convenience library" 1>&2
            exit 1
          fi
@@ -1606,7 +1614,7 @@ compiler."
        fi
 
        # This library was specified with -dlopen.
-       if test $pass = dlopen; then
+       if test "$pass" = dlopen; then
          if test -z "$libdir"; then
            $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
            exit 1
@@ -1655,7 +1663,7 @@ compiler."
        name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
 
        # This library was specified with -dlpreopen.
-       if test $pass = dlpreopen; then
+       if test "$pass" = dlpreopen; then
          if test -z "$libdir"; then
            $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
            exit 1
@@ -1674,7 +1682,7 @@ compiler."
 
        if test -z "$libdir"; then
          # Link the convenience library
-         if test $linkmode = lib; then
+         if test "$linkmode" = lib; then
            deplibs="$dir/$old_library $deplibs"
          elif test "$linkmode,$pass" = "prog,link"; then
            compile_deplibs="$dir/$old_library $compile_deplibs"
@@ -1685,7 +1693,7 @@ compiler."
          continue
        fi
 
-       if test $linkmode = prog && test $pass != link; then
+       if test "$linkmode" = prog && test "$pass" != link; then
          newlib_search_path="$newlib_search_path $ladir"
          deplibs="$lib $deplibs"
 
@@ -1701,7 +1709,7 @@ compiler."
            -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
+           if test "$linkalldeplibs" = yes; then
              deplibs="$deplib $deplibs"
            else
              # Need to hardcode shared library paths
@@ -1724,7 +1732,7 @@ compiler."
          # Link against this shared library
 
          if test "$linkmode,$pass" = "prog,link" ||
-          { test $linkmode = lib && test $hardcode_into_libs = yes; }; then
+          { test "$linkmode" = lib && test "$hardcode_into_libs" = yes; }; then
            # Hardcode the library path.
            # Skip directories that are in the system default run-time
            # search path.
@@ -1746,7 +1754,7 @@ compiler."
              esac
              ;;
            esac
-           if test $linkmode = prog; then
+           if test "$linkmode" = prog; then
              # We need to hardcode the library path
              if test -n "$shlibpath_var"; then
                # Make sure the rpath contains only unique directories.
@@ -1830,7 +1838,7 @@ compiler."
            linklib=$newlib
          fi # test -n $old_archive_from_expsyms_cmds
 
-         if test $linkmode = prog || test "$mode" != relink; then
+         if test "$linkmode" = prog || test "$mode" != relink; then
            add_shlibpath=
            add_dir=
            add=
@@ -1857,14 +1865,6 @@ compiler."
                add="$dir/$linklib"
              elif test "$hardcode_minus_L" = yes; then
                add_dir="-L$dir"
-               # Try looking first in the location we're being installed to.
-               if test -n "$inst_prefix_dir"; then
-                 case "$libdir" in
-                 [\/]*)
-                   add_dir="-L$inst_prefix_dir$libdir $add_dir"
-                   ;;
-                 esac
-               fi
                add="-l$name"
              elif test "$hardcode_shlibpath_var" = yes; then
                add_shlibpath="$dir"
@@ -1887,7 +1887,7 @@ compiler."
              *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
              esac
            fi
-           if test $linkmode = prog; then
+           if test "$linkmode" = prog; then
              test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
              test -n "$add" && compile_deplibs="$add $compile_deplibs"
            else
@@ -1904,7 +1904,7 @@ compiler."
            fi
          fi
 
-         if test $linkmode = prog || test "$mode" = relink; then
+         if test "$linkmode" = prog || test "$mode" = relink; then
            add_shlibpath=
            add_dir=
            add=
@@ -1912,7 +1912,16 @@ compiler."
            if test "$hardcode_direct" = yes; then
              add="$libdir/$linklib"
            elif test "$hardcode_minus_L" = yes; then
-             add_dir="-L$libdir"
+             # Try looking first in the location we're being installed to.
+             add_dir=
+             if test -n "$inst_prefix_dir"; then
+               case "$libdir" in
+               [\\/]*)
+                 add_dir="-L$inst_prefix_dir$libdir"
+                 ;;
+               esac
+             fi
+             add_dir="$add_dir -L$libdir"
              add="-l$name"
            elif test "$hardcode_shlibpath_var" = yes; then
              case :$finalize_shlibpath: in
@@ -1922,19 +1931,20 @@ compiler."
              add="-l$name"
            else
              # We cannot seem to hardcode it, guess we'll fake it.
-             add_dir="-L$libdir"
              # Try looking first in the location we're being installed to.
+             add_dir=
              if test -n "$inst_prefix_dir"; then
                case "$libdir" in
-               [\/]*)
-                 add_dir="-L$inst_prefix_dir$libdir $add_dir"
+               [\\/]*)
+                 add_dir="-L$inst_prefix_dir$libdir"
                  ;;
                esac
              fi
+             add_dir="$add_dir -L$libdir"
              add="-l$name"
            fi
 
-           if test $linkmode = prog; then
+           if test "$linkmode" = prog; then
              test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
              test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
            else
@@ -1942,7 +1952,7 @@ compiler."
              test -n "$add" && deplibs="$add $deplibs"
            fi
          fi
-       elif test $linkmode = prog; then
+       elif test "$linkmode" = prog; then
          if test "$alldeplibs" = yes &&
             { test "$deplibs_check_method" = pass_all ||
               { test "$build_libtool_libs" = yes &&
@@ -2002,10 +2012,10 @@ compiler."
          fi
        fi # link shared/static library?
 
-       if test $linkmode = lib; then
+       if test "$linkmode" = lib; then
          if test -n "$dependency_libs" &&
-            { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
-              test $link_static = yes; }; then
+            { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes ||
+              test "$link_static" = yes; }; then
            # Extract -R from dependency_libs
            temp_deplibs=
            for libdir in $dependency_libs; do
@@ -2036,7 +2046,7 @@ compiler."
            tmp_libs="$tmp_libs $deplib"
          done
 
-         if test $link_all_deplibs != no; then
+         if test "$link_all_deplibs" != no; then
            # Add the search paths of all dependency libraries
            for deplib in $dependency_libs; do
              case $deplib in
@@ -2079,15 +2089,15 @@ compiler."
          fi # link_all_deplibs != no
        fi # linkmode = lib
       done # for deplib in $libs
-      if test $pass = dlpreopen; then
+      if test "$pass" = dlpreopen; then
        # Link the dlpreopened libraries before other libraries
        for deplib in $save_deplibs; do
          deplibs="$deplib $deplibs"
        done
       fi
-      if test $pass != dlopen; then
-       test $pass != scan && dependency_libs="$newdependency_libs"
-       if test $pass != conv; then
+      if test "$pass" != dlopen; then
+       test "$pass" != scan && dependency_libs="$newdependency_libs"
+       if test "$pass" != conv; then
          # Make sure lib_search_path contains only unique directories.
          lib_search_path=
          for dir in $newlib_search_path; do
@@ -2145,7 +2155,7 @@ compiler."
        deplibs=
       fi
     done # for pass
-    if test $linkmode = prog; then
+    if test "$linkmode" = prog; then
       dlfiles="$newdlfiles"
       dlprefiles="$newdlprefiles"
     fi
@@ -2263,7 +2273,7 @@ compiler."
 
        # Check that each of the things are valid numbers.
        case $current in
-       0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
+       [0-9]*) ;;
        *)
          $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
@@ -2272,7 +2282,7 @@ compiler."
        esac
 
        case $revision in
-       0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
+       [0-9]*) ;;
        *)
          $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
@@ -2281,7 +2291,7 @@ compiler."
        esac
 
        case $age in
-       0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
+       [0-9]*) ;;
        *)
          $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
@@ -2350,7 +2360,7 @@ compiler."
          ;;
 
        osf)
-         major=`expr $current - $age`
+         major=.`expr $current - $age`
          versuffix=".$current.$age.$revision"
          verstring="$current.$age.$revision"
 
@@ -2457,7 +2467,7 @@ compiler."
          *) finalize_rpath="$finalize_rpath $libdir" ;;
          esac
        done
-       if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
+       if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
          dependency_libs="$temp_xrpath $dependency_libs"
        fi
       fi
@@ -2500,7 +2510,7 @@ compiler."
            ;;
          *)
            # Add libc to deplibs on all other systems if necessary.
-           if test $build_libtool_need_lc = "yes"; then
+           if test "$build_libtool_need_lc" = "yes"; then
              deplibs="$deplibs -lc"
            fi
            ;;
@@ -2638,6 +2648,13 @@ EOF
                        *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
                        esac
                      done
+                     # It is ok to link against an archive when
+                     # building a shared library.
+                     if $AR -t $potlib > /dev/null 2>&1; then
+                       newdeplibs="$newdeplibs $a_deplib"
+                       a_deplib=""
+                       break 2
+                     fi
                      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
                         | ${SED} 10q \
                         | egrep "$file_magic_regex" > /dev/null; then
@@ -2765,7 +2782,7 @@ EOF
            echo "*** automatically added whenever a program is linked with this library"
            echo "*** or is declared to -dlopen it."
 
-           if test $allow_undefined = no; then
+           if test "$allow_undefined" = no; then
              echo
              echo "*** Since this library must not contain undefined symbols,"
              echo "*** because either the platform does not support them or"
@@ -2792,7 +2809,7 @@ EOF
 
       # Test again, we may have decided not to build it any more
       if test "$build_libtool_libs" = yes; then
-       if test $hardcode_into_libs = yes; then
+       if test "$hardcode_into_libs" = yes; then
          # Hardcode the library paths
          hardcode_libdirs=
          dep_rpath=
@@ -3199,6 +3216,13 @@ EOF
        # On Rhapsody replace the C library is the System framework
        compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
        finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
+       case $host in
+       *darwin*)
+         # Don't allow lazy linking, it breaks C++ global constructors
+         compile_command="$compile_command ${wl}-bind_at_load"
+         finalize_command="$finalize_command ${wl}-bind_at_load"
+         ;;
+       esac
        ;;
       esac
 
@@ -3493,7 +3517,7 @@ static const void *lt_preloaded_setup() {
        finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
       fi
 
-      if test $need_relink = no || test "$build_libtool_libs" != yes; then
+      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
        # Replace the output file specification.
        compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
        link_command="$compile_command$compile_rpath"
@@ -3970,9 +3994,46 @@ fi\
                  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
                  exit 1
                fi
-               newdependency_libs="$newdependency_libs $libdir/$name"
+               # We do not want portage's install root ($D) present.  Check only for
+               # this if the .la is being installed.
+               if test "$installed" = yes && test "$D"; then
+                 eval mynewdependency_lib="`echo "$libdir/$name" |sed -e "s:$D::g" -e 's://:/:g'`"
+               else
+                 mynewdependency_lib="$libdir/$name"
+               fi
+               # Do not add duplicates
+               if test "$mynewdependency_lib"; then
+                 if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then
+                   newdependency_libs="$newdependency_libs $mynewdependency_lib"
+                 fi
+               fi
+               ;;
+                 *)
+               if test "$installed" = yes; then
+         # Rather use S=WORKDIR if our version of portage supports it.
+         # This is because some ebuild (gcc) do not use $S as buildroot.
+                 if test "$PWORKDIR"; then
+                   S="$PWORKDIR"
+                 fi
+                 # We do not want portage's build root ($S) present.
+                 if test -n "`echo $deplib |grep -e "$S"`" && test "$S"; then
+                   mynewdependency_lib=""
+                 # We do not want portage's install root ($D) present.
+                 elif test -n "`echo $deplib |grep -e "$D"`" && test "$D"; then
+                   eval mynewdependency_lib="`echo "$deplib" |sed -e "s:$D::g" -e 's://:/:g'`"
+                 else
+                   mynewdependency_lib="$deplib"
+                 fi
+               else
+                 mynewdependency_lib="$deplib"
+               fi
+               # Do not add duplicates
+               if test "$mynewdependency_lib"; then
+                 if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then
+                       newdependency_libs="$newdependency_libs $mynewdependency_lib"
+                 fi
+               fi
                ;;
-             *) newdependency_libs="$newdependency_libs $deplib" ;;
              esac
            done
            dependency_libs="$newdependency_libs"
@@ -4005,6 +4066,10 @@ fi\
          case $host,$output,$installed,$module,$dlname in
            *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
          esac
+         # Do not add duplicates
+         if test "$installed" = yes && test "$D"; then
+           install_libdir="`echo "$install_libdir" |sed -e "s:$D::g" -e 's://:/:g'`"
+         fi
          $echo > $output "\
 # $outputname - a libtool library file
 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
@@ -4038,7 +4103,7 @@ dlpreopen='$dlprefiles'
 
 # Directory that this library needs to be installed in:
 libdir='$install_libdir'"
-         if test "$installed" = no && test $need_relink = yes; then
+         if test "$installed" = no && test "$need_relink" = yes; then
            $echo >> $output "\
 relink_command=\"$relink_command\""
          fi
@@ -4249,25 +4314,25 @@ relink_command=\"$relink_command\""
        dir="$dir$objdir"
 
        if test -n "$relink_command"; then
-          # Determine the prefix the user has applied to our future dir.
-          inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"`
-          # Don't allow the user to place us outside of our expected
-          # location b/c this prevents finding dependent libraries that
-          # are installed to the same prefix.
-          if test "$inst_prefix_dir" = "$destdir"; then
-            $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
-            exit 1
-          fi
-          if test -n "$inst_prefix_dir"; then
-            # Stick the inst_prefix_dir data into the link command.
-            relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
-          else
-            relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%%"`
-          fi
-
-         $echo "$modename: warning: relinking \`$file'" 1>&2
+         # Determine the prefix the user has applied to our future dir.
+         inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"`
+
+         # Don't allow the user to place us outside of our expected
+         # location b/c this prevents finding dependent libraries that
+         # are installed to the same prefix.
+         if test "$inst_prefix_dir" = "$destdir"; then
+           $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
+           exit 1
+         fi
+
+         if test -n "$inst_prefix_dir"; then
+           # Stick the inst_prefix_dir data into the link command.
+           relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
+         else
+           relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%%"`
+         fi
+
+         $echo "$modename: warning: relinking \`$file'" 1>&2
          $show "$relink_command"
          if $run eval "$relink_command"; then :
          else
@@ -4435,7 +4500,11 @@ relink_command=\"$relink_command\""
            if test "$finalize" = yes && test -z "$run"; then
              tmpdir="/tmp"
              test -n "$TMPDIR" && tmpdir="$TMPDIR"
-             tmpdir="$tmpdir/libtool-$$"
+              tmpdir=`mktemp -d $tmpdir/libtool-XXXXXX 2> /dev/null`
+              if test $? = 0 ; then :
+              else
+                tmpdir="$tmpdir/libtool-$$"
+              fi
              if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
              else
                $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
@@ -4776,10 +4845,10 @@ relink_command=\"$relink_command\""
        objdir="$dir/$objdir"
       fi
       name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
-      test $mode = uninstall && objdir="$dir"
+      test "$mode" = uninstall && objdir="$dir"
 
       # Remember objdir for removal later, being careful to avoid duplicates
-      if test $mode = clean; then
+      if test "$mode" = clean; then
        case " $rmdirs " in
          *" $objdir "*) ;;
          *) rmdirs="$rmdirs $objdir" ;;
@@ -4811,9 +4880,9 @@ relink_command=\"$relink_command\""
            rmfiles="$rmfiles $objdir/$n"
          done
          test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
-         test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
+         test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
 
-         if test $mode = uninstall; then
+         if test "$mode" = uninstall; then
            if test -n "$library_names"; then
              # Do each command in the postuninstall commands.
              eval cmds=\"$postuninstall_cmds\"
@@ -4857,7 +4926,7 @@ relink_command=\"$relink_command\""
 
       *)
        # Do a test to see if this is a libtool program.
-       if test $mode = clean &&
+       if test "$mode" = clean &&
           (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
          relink_command=
          . $dir/$file