X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=blobdiff_plain;f=ltmain.sh;h=c1ef9974d0e8e0a1c866e6a6bdeb615b9ec6ec50;hp=bd76cfb4da08af7b119bc6f0ff8afcc4fd62f0c4;hb=c73a8380d0f168417360abbf94fea49c1308611d;hpb=debdecb85f65b7418b0102076d34a2aca15c541a diff --git a/ltmain.sh b/ltmain.sh index bd76cfb4da0..c1ef9974d0e 100644 --- a/ltmain.sh +++ b/ltmain.sh @@ -107,6 +107,7 @@ show_help= execute_dlfiles= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" +taglist= # Parse our command line options once, thoroughly. while test $# -gt 0 @@ -140,6 +141,7 @@ do CC) # Don't test for the "default" C tag, as we know, it's there, but # not specially marked. + taglist="$taglist $tagname" ;; *) if grep "^### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then @@ -1109,6 +1111,19 @@ EOF finalize_command="$finalize_command $wl$qarg" continue ;; + framework) + case $host in + *-*-darwin*) + case "$deplibs " in + *" $qarg.framework "*) ;; + *) deplibs="$deplibs $qarg.framework" # this is fixed later + ;; + esac + ;; + esac + prev= + continue + ;; *) eval "$prev=\"\$arg\"" prev= @@ -1361,6 +1376,10 @@ EOF prev=xlinker continue ;; + -framework) + prev=framework + continue + ;; # Some other compiler flag. -* | +*) @@ -1839,6 +1858,13 @@ EOF *) . ./$lib ;; esac + case $host in + *-*-darwin*) + # Convert "-framework foo" to "foo.framework" in dependency_libs + test -n "$dependency_libs" && dependency_libs=`$echo "X$dependency_libs" | $Xsed -e 's/-framework \([^ $]*\)/\1.framework/g'` + ;; + esac + if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test $linkmode = oldlib && test $linkmode = obj; }; then @@ -2080,9 +2106,10 @@ EOF else $show "extracting exported symbol list from \`$soname'" IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - eval cmds=\"$extract_expsyms_cmds\" + cmds=$extract_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -2093,9 +2120,10 @@ EOF if test -f "$output_objdir/$newlib"; then :; else $show "generating import library for \`$soname'" IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - eval cmds=\"$old_archive_from_expsyms_cmds\" + cmds=$old_archive_from_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -2444,6 +2472,7 @@ EOF case $outputname in lib*) name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + eval shared_ext=\"$shrext\" eval libname=\"$libname_spec\" ;; *) @@ -2455,6 +2484,7 @@ EOF if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + eval shared_ext=\"$shrext\" eval libname=\"$libname_spec\" else libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` @@ -2604,7 +2634,7 @@ EOF ;; osf) - major=`expr $current - $age` + major=.`expr $current - $age` versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" @@ -2642,7 +2672,16 @@ EOF # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= - verstring="0.0" + case $version_type in + darwin) + # we can't check for "0.0" in archive_cmds due to quoting + # problems, so we reset it completely + verstring= + ;; + *) + verstring="0.0" + ;; + esac if test "$need_version" = no; then versuffix= else @@ -3018,6 +3057,14 @@ EOF fi fi fi + # Time to change all our "foo.framework" stuff back to "-framework foo" + case $host in + *-*-darwin*) + newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).framework% -framework \1%g'` + dependency_libs=`$echo "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).framework% -framework \1%g'` + ;; + esac + # Done checking deplibs! # Done checking deplibs! deplibs=$newdeplibs fi @@ -3086,6 +3133,7 @@ EOF # Get the real and link names of the library. eval library_names=\"$library_names_spec\" + eval shared_ext=\"$shrext\" set dummy $library_names realname="$2" shift; shift @@ -3203,11 +3251,13 @@ EOF # Do each of the archive commands. if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - eval cmds=\"$archive_expsym_cmds\" + eval test_cmds=\"$archive_expsym_cmds\" + cmds=$archive_expsym_cmds else - eval cmds=\"$archive_cmds\" + eval test_cmds=\"$archive_cmds\" + cmds=$archive_cmds fi - if len=`expr "X$cmds" : ".*"` && + if len=`expr "X$test_cmds" : ".*"` && test $len -le $max_cmd_len; then : else @@ -3283,6 +3333,7 @@ EOF IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -3300,9 +3351,9 @@ EOF # Do each of the archive commands. if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - eval cmds=\"$archive_expsym_cmds\" - else - eval cmds=\"$archive_cmds\" + cmds=$archive_expsym_cmds + else + cmds=$archive_cmds fi # Append the command to remove the reloadable object files @@ -3312,6 +3363,7 @@ EOF IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -3531,6 +3583,19 @@ EOF ;; esac + case $host in + *-*-darwin*) + # Don't allow lazy linking, it breaks C++ global constructors + if test "$tagname" = CXX ; then + compile_command="$compile_command ${wl}-bind_at_load" + finalize_command="$finalize_command ${wl}-bind_at_load" + fi + # Time to change all our "foo.framework" stuff back to "-framework foo" + compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).framework% -framework \1%g'` + finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).framework% -framework \1%g'` + ;; + esac + compile_command="$compile_command $compile_deplibs" finalize_command="$finalize_command $finalize_deplibs" @@ -4245,6 +4310,20 @@ fi\ objlist= concat_cmds= save_oldobjs=$oldobjs + # 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 for obj in $save_oldobjs do oldobjs="$objlist $obj" @@ -4299,7 +4378,11 @@ fi\ fi done # Quote the link command for shipping. - relink_command="cd `pwd`; $SHELL $0 --mode=relink $libtool_args" + tagopts= + for tag in $taglist; do + tagopts="$tagopts --tag $tag" + done + relink_command="(cd `pwd`; $SHELL $0$tagopts --mode=relink $libtool_args)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` # Only create the output if not a dry run. @@ -4605,7 +4688,7 @@ relink_command=\"$relink_command\"" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 - continue + exit 1 fi fi