OSDN Git Service

Clean up copy-initialization in overloading code.
[pf3gnuchains/gcc-fork.git] / ltmain.sh
index 81108af..554c82a 100644 (file)
--- a/ltmain.sh
+++ b/ltmain.sh
@@ -55,7 +55,7 @@ modename="$progname"
 PROGRAM=ltmain.sh
 PACKAGE=libtool
 VERSION=1.4a
-TIMESTAMP=" (1.641.2.74 2000/07/26 04:31:03)"
+TIMESTAMP=" (1.641.2.122 2000/09/30 05:27:52)"
 
 default_mode=
 help="Try \`$progname --help' for more information."
@@ -483,7 +483,7 @@ if test -z "$show_help"; then
       "$CC "*) ;;
       # Blanks in the command may have been stripped by the calling shell,
       # but not from the CC environment variable when ltconfig was run.
-      "`$echo X$CC | $Xsed` "*) ;;
+      "`$echo $CC` "*) ;;
       *)
         for z in $available_tags; do
           if grep "^### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
@@ -497,7 +497,7 @@ if test -z "$show_help"; then
               tagname=$z
               break
               ;;
-           "`$echo X$CC | $Xsed` "*)
+           "`$echo $CC` "*)
              tagname=$z
              break
              ;;
@@ -545,7 +545,7 @@ if test -z "$show_help"; then
 
     # On Cygwin there's no "real" PIC flag so we must build both object types
     case "$host_os" in
-    cygwin* | mingw* | os2*)
+    cygwin* | mingw* | pw32* | os2*)
       pic_mode=default
       ;;
     esac
@@ -557,7 +557,7 @@ if test -z "$show_help"; then
     # Calculate the filename of the output object if compiler does
     # not support -o with -c
     if test "$compiler_c_o" = no; then
-      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\..*$%%'`.${objext}
+      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
       lockfile="$output_obj.lock"
       removelist="$removelist $output_obj $lockfile"
       trap "$run $rm $removelist; exit 1" 1 2 15
@@ -570,7 +570,7 @@ if test -z "$show_help"; then
     # Lock this critical section if it is needed
     # We use this script file to make the link, it avoids creating a new file
     if test "$need_locks" = yes; then
-      until ln "$0" "$lockfile" 2>/dev/null; do
+      until $run ln "$0" "$lockfile" 2>/dev/null; do
        $show "Waiting for $lockfile to be removed"
        sleep 2
       done
@@ -768,7 +768,7 @@ EOF
 
     # Unlock the critical section if it was locked
     if test "$need_locks" != no; then
-      $rm "$lockfile"
+      $run $rm "$lockfile"
     fi
 
     exit 0
@@ -778,7 +778,7 @@ EOF
   link | relink)
     modename="$modename: link"
     case "$host" in
-    *-*-cygwin* | *-*-mingw* | *-*-os2*)
+    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
       # It is impossible to link a dll without this setting, and
       # we shouldn't force the makefile maintainer to figure out
       # which system we are compiling for in order to pass an extra
@@ -1046,6 +1046,18 @@ EOF
        continue
        ;;
 
+      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
+      # so, if we see these flags be careful not to treat them like -L
+      -L[A-Z][A-Z]*:*)
+       case $with_gcc/$host in
+       no/*-*-irix*)
+         compile_command="$compile_command $arg"
+         finalize_command="$finalize_command $arg"
+         ;;
+       esac
+       continue
+       ;;
+       
       -L*)
        dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
        # We need an absolute path.
@@ -1068,7 +1080,7 @@ EOF
          ;;
        esac
        case "$host" in
-       *-*-cygwin* | *-*-mingw* | *-*-os2*)
+       *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
          case ":$dllsearchpath:" in
          *":$dir:"*) ;;
          *) dllsearchpath="$dllsearchpath:$dir";;
@@ -1081,14 +1093,14 @@ EOF
       -l*)
        if test "$arg" = "-lc"; then
          case "$host" in
-         *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
+         *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
            # These systems don't actually have c library (as such)
            continue
            ;;
          esac
        elif test "$arg" = "-lm"; then
          case "$host" in
-         *-*-cygwin* | *-*-beos*)
+         *-*-cygwin* | *-*-pw32* | *-*-beos*)
            # These systems don't actually have math library (as such)
            continue
            ;;
@@ -1110,7 +1122,7 @@ EOF
 
       -no-install)
        case "$host" in
-       *-*-cygwin* | *-*-mingw* | *-*-os2*)
+       *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
          # The PATH hackery in wrapper scripts is required on Windows
          # in order for the loader to find any dlls it needs.
          $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
@@ -1168,11 +1180,11 @@ EOF
        ;;
 
       -static)
-       # If we have no pic_flag, then this is the same as -all-static.
-       if test -z "$pic_flag" && test -n "$link_static_flag"; then
-         compile_command="$compile_command $link_static_flag"
-         finalize_command="$finalize_command $link_static_flag"
-       fi
+        # The effects of -static are defined in a previous loop.
+       # We used to do the same as -all-static on platforms that
+       # didn't have a PIC flag, but the assumption that the effects
+       # would be equivalent was wrong.  It would break on at least
+       # Digital Unix and AIX.
        continue
        ;;
 
@@ -1402,7 +1414,7 @@ EOF
       "$CC "*) ;;
       # Blanks in the command may have been stripped by the calling shell,
       # but not from the CC environment variable when ltconfig was run.
-      "`$echo X$CC | $Xsed` "*) ;;
+      "`$echo $CC` "*) ;;
       *)
         for z in $available_tags; do
           if grep "^### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
@@ -1416,7 +1428,7 @@ EOF
               tagname=$z
               break
              ;;
-           "`$echo X$CC | $Xsed` "*)
+           "`$echo $CC` "*)
              tagname=$z
              break
              ;;
@@ -1809,6 +1821,9 @@ EOF
          # are required to link).
          if test -n "$old_library"; then
            newdlprefiles="$newdlprefiles $dir/$old_library"
+         # Otherwise, use the dlname, so that lt_dlopen finds it.
+         elif test -n "$dlname"; then
+           newdlprefiles="$newdlprefiles $dir/$dlname"
          else
            newdlprefiles="$newdlprefiles $dir/$linklib"
          fi
@@ -1860,7 +1875,6 @@ EOF
 
        if test "$linkmode,$pass" = "prog,link"; then
          if test -n "$library_names" &&
-            { test "$hardcode_into_libs" != all || test "$alldeplibs" != yes; } &&
             { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
            # We need to hardcode the library path
            if test -n "$shlibpath_var"; then
@@ -1913,7 +1927,8 @@ EOF
            need_relink=yes
          fi
          # This is a shared library
-         if test $linkmode = lib && test "$hardcode_into_libs" = all; then
+         if 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.
@@ -2113,7 +2128,7 @@ EOF
 
        if test $linkmode = lib; then
          if test -n "$dependency_libs" &&
-            { test "$hardcode_into_libs" = no || test $build_old_libs = yes ||
+            { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
               test $link_static = yes; }; then
            # Extract -R from dependency_libs
            temp_deplibs=
@@ -2466,10 +2481,10 @@ EOF
          ;;
 
        windows)
-         # Like Linux, but with '-' rather than '.', since we only
-         # want one extension on Windows 95.
+         # Use '-' rather than '.', since we only want one
+         # extension on DOS 8.3 filesystems.
          major=`expr $current - $age`
-         versuffix="-$major-$age-$revision"
+         versuffix="-$major"
          ;;
 
        *)
@@ -2556,7 +2571,7 @@ EOF
          *) finalize_rpath="$finalize_rpath $libdir" ;;
          esac
        done
-       if test "$hardcode_into_libs" = no || 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
@@ -2584,7 +2599,7 @@ EOF
       if test "$build_libtool_libs" = yes; then
        if test -n "$rpath"; then
          case "$host" in
-         *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
+         *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
            # these systems don't actually have a c library (as such)!
            ;;
          *)
@@ -2806,7 +2821,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" != no; then
+       if test $hardcode_into_libs = yes; then
          # Hardcode the library paths
          hardcode_libdirs=
          dep_rpath=
@@ -2972,7 +2987,7 @@ EOF
        fi
 
        # Make a backup of the uninstalled library when relinking
-       if test "$mode" = relink && test "$hardcode_into_libs" = all; then
+       if test "$mode" = relink; then
          $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
        fi
 
@@ -2991,7 +3006,7 @@ EOF
        IFS="$save_ifs"
 
        # Restore the uninstalled library and exit
-       if test "$mode" = relink && test "$hardcode_into_libs" = all; then
+       if test "$mode" = relink; then
          $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
          exit 0
        fi
@@ -3236,7 +3251,7 @@ EOF
          esac
        fi
        case "$host" in
-       *-*-cygwin* | *-*-mingw* | *-*-os2*)
+       *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
          case ":$dllsearchpath:" in
          *":$libdir:"*) ;;
          *) dllsearchpath="$dllsearchpath:$libdir";;
@@ -3552,7 +3567,7 @@ static const void *lt_preloaded_setup() {
        exit 0
       fi
 
-      if test "$hardcode_action" = relink || test "$hardcode_into_libs" = all; then
+      if test "$hardcode_action" = relink; then
        # Fast installation is not supported
        link_command="$compile_var$compile_command$compile_rpath"
        relink_command="$finalize_var$finalize_command$finalize_rpath"
@@ -3590,9 +3605,14 @@ static const void *lt_preloaded_setup() {
       if test -n "$relink_command"; then
        # Preserve any variables that may affect compiler behavior
        for var in $variables_saved_for_relink; do
-         eval var_value=\$$var
-         var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
-         relink_command="$var=\"$var_value\"; export $var; $relink_command"
+         if eval test -z \"\${$var+set}\"; then
+           relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
+         elif eval var_value=\$$var; test -z "$var_value"; then
+           relink_command="$var=; export $var; $relink_command"
+         else
+           var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
+           relink_command="$var=\"$var_value\"; export $var; $relink_command"
+         fi
        done
        relink_command="cd `pwd`; $relink_command"
        relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
@@ -3765,7 +3785,7 @@ else
        case $host in
        # win32 systems need to use the prog path for dll
        # lookup to work
-       *-*-cygwin*)
+       *-*-cygwin* | *-*-pw32*)
          $echo >> $output "\
       exec \$progdir/\$program \${1+\"\$@\"}
 "
@@ -3908,9 +3928,14 @@ fi\
 
       # Preserve any variables that may affect compiler behavior
       for var in $variables_saved_for_relink; do
-       eval var_value=\$$var
-       var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
-       relink_command="$var=\"$var_value\"; export $var; $relink_command"
+       if eval test -z \"\${$var+set}\"; then
+         relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
+       elif eval var_value=\$$var; test -z "$var_value"; then
+         relink_command="$var=; export $var; $relink_command"
+       else
+         var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
+         relink_command="$var=\"$var_value\"; export $var; $relink_command"
+       fi
       done
       # Quote the link command for shipping.
       relink_command="cd `pwd`; $SHELL $0 --mode=relink $libtool_args"
@@ -3998,8 +4023,7 @@ dlpreopen='$dlprefiles'
 
 # Directory that this library needs to be installed in:
 libdir='$install_libdir'"
-         if test $hardcode_into_libs = all &&
-            test "$installed" = no && test $need_relink = yes; then
+         if test "$installed" = no && test $need_relink = yes; then
            $echo >> $output "\
 relink_command=\"$relink_command\""
          fi
@@ -4023,7 +4047,7 @@ relink_command=\"$relink_command\""
     # install_prog (especially on Windows NT).
     if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
        # Allow the use of GNU shtool's install command.
-       expr "X$nonopt" : "X.*shtool.*" > /dev/null; then
+       $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
       # Aesthetically quote it.
       arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
       case "$arg" in
@@ -4209,7 +4233,7 @@ relink_command=\"$relink_command\""
        test "X$dir" = "X$file/" && dir=
        dir="$dir$objdir"
 
-       if test "$hardcode_into_libs" = all && test -n "$relink_command"; then
+       if test -n "$relink_command"; then
          $echo "$modename: warning: relinking \`$file'" 1>&2
          $show "$relink_command"
          if $run eval "$relink_command"; then :
@@ -4227,7 +4251,7 @@ relink_command=\"$relink_command\""
          shift
 
          srcname="$realname"
-         test "$hardcode_into_libs" = all && test -n "$relink_command" && srcname="$realname"T
+         test -n "$relink_command" && srcname="$realname"T
 
          # Install the shared library and build the symlinks.
          $show "$install_prog $dir/$srcname $destdir/$realname"