/[libtool]/libtool/ltmain.in
ViewVC logotype

Diff of /libtool/ltmain.in

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.334.2.66 by rwild, Fri Apr 8 13:00:49 2005 UTC revision 1.334.2.67 by pogma, Fri Apr 8 15:03:21 2005 UTC
# Line 251  func_extract_an_archive () Line 251  func_extract_an_archive ()
251  {  {
252      f_ex_an_ar_dir="$1"; shift      f_ex_an_ar_dir="$1"; shift
253      f_ex_an_ar_oldlib="$1"      f_ex_an_ar_oldlib="$1"
     f_ex_an_ar_lib=`$echo "X$f_ex_an_ar_oldlib" | $Xsed -e 's%^.*/%%'`  
254    
255      $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"      $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
256      $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?      $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
257      if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then      if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
258       :       :
259      else      else
260        $echo "$modename: warning: object name conflicts; renaming object files" 1>&2        $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
261        $echo "$modename: warning: to ensure that they will not overwrite" 1>&2        exit $EXIT_FAILURE
       $show "cp $f_ex_an_ar_oldlib $f_ex_an_ar_dir/$f_ex_an_ar_lib"  
       $run eval "cp \$f_ex_an_ar_oldlib \$f_ex_an_ar_dir/\$f_ex_an_ar_lib"  
       $AR t "$f_ex_an_ar_oldlib" | sort | uniq -c \  
         | $EGREP -v '^[         ]*1[    ]' | while read count name  
       do  
         i=1  
         while test "$i" -le "$count"  
           do  
           # Put our $i before any first dot (extension)  
           # Never overwrite any file  
           name_to="$name"  
           while test "X$name_to" = "X$name" || test -f "$f_ex_an_ar_dir/$name_to"  
             do  
             name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`  
           done  
           $show "(cd $f_ex_an_ar_dir && $AR x  $f_ex_an_ar_lib '$name' && $mv '$name' '$name_to')"  
           $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_lib '$name' && $mv '$name' '$name_to' && $AR -d \$f_ex_an_ar_lib '$name')" || exit $?  
           i=`expr $i + 1`  
         done  
       done  
       $show "$rm $f_ex_an_ar_dir/$f_ex_an_ar_lib"  
       $run eval "$rm \$f_ex_an_ar_dir/\$f_ex_an_ar_lib"  
262      fi      fi
263  }  }
264    
# Line 5106  fi\ Line 5083  fi\
5083        if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then        if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
5084         cmds=$old_archive_from_new_cmds         cmds=$old_archive_from_new_cmds
5085        else        else
5086            # POSIX demands no paths to be encoded in archives.  We have
5087            # to avoid creating archives with duplicate basenames if we
5088            # might have to extract them afterwards, e.g., when creating a
5089            # static archive out of a convenience library, or when linking
5090            # the entirety of a libtool archive into another (currently
5091            # not supported by libtool).
5092            if (for obj in $oldobjs
5093                do
5094                  $echo "X$obj" | $Xsed -e 's%^.*/%%'
5095                done | sort | sort -uc >/dev/null 2>&1); then
5096              :
5097            else
5098              $echo "copying selected object files to avoid basename conflicts..."
5099    
5100              if test -z "$gentop"; then
5101                gentop="$output_objdir/${outputname}x"
5102                generated="$generated $gentop"
5103    
5104                $show "${rm}r $gentop"
5105                $run ${rm}r "$gentop"
5106                $show "$mkdir $gentop"
5107                $run $mkdir "$gentop"
5108                status=$?
5109                if test "$status" -ne 0 && test ! -d "$gentop"; then
5110                  exit $status
5111                fi
5112              fi
5113    
5114              save_oldobjs=$oldobjs
5115              oldobjs=
5116              counter=1
5117              for obj in $save_oldobjs
5118              do
5119                objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
5120                case " $oldobjs " in
5121                " ") oldobjs=$obj ;;
5122                *[\ /]"$objbase "*)
5123                  while :; do
5124                    # Make sure we don't pick an alternate name that also
5125                    # overlaps.
5126                    newobj=lt$counter-$objbase
5127                    counter=`expr $counter + 1`
5128                    case " $oldobjs " in
5129                    *[\ /]"$newobj "*) ;;
5130                    *) if test ! -f "$gentop/$newobj"; then break; fi ;;
5131                    esac
5132                  done
5133                  $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
5134                  $run ln "$obj" "$gentop/$newobj" ||
5135                  $run cp "$obj" "$gentop/$newobj"
5136                  oldobjs="$oldobjs $gentop/$newobj"
5137                  ;;
5138                *) oldobjs="$oldobjs $obj" ;;
5139                esac
5140              done
5141            fi
5142    
5143          eval cmds=\"$old_archive_cmds\"          eval cmds=\"$old_archive_cmds\"
5144    
5145          if len=`expr "X$cmds" : ".*"` &&          if len=`expr "X$cmds" : ".*"` &&
# Line 5119  fi\ Line 5153  fi\
5153            objlist=            objlist=
5154            concat_cmds=            concat_cmds=
5155            save_oldobjs=$oldobjs            save_oldobjs=$oldobjs
5156            # GNU ar 2.10+ was changed to match POSIX; thus no paths are  
           # encoded into archives.  This makes 'ar r' malfunction in  
           # this piecewise linking case whenever conflicting object  
           # names appear in distinct ar calls; check, warn and compensate.  
             if (for obj in $save_oldobjs  
             do  
               $echo "X$obj" | $Xsed -e 's%^.*/%%'  
             done | sort | sort -uc >/dev/null 2>&1); then  
             :  
           else  
             $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2  
             $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2  
             AR_FLAGS=cq  
           fi  
5157            # Is there a better way of finding the last object in the list?            # Is there a better way of finding the last object in the list?
5158            for obj in $save_oldobjs            for obj in $save_oldobjs
5159            do            do

Legend:
Removed from v.1.334.2.66  
changed lines
  Added in v.1.334.2.67

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26