[include] autotools.mk: implement PKG_FIXUP:=patch-libtool
[openwrt.git] / tools / libtool / files / libtool-v2.2.patch
1 --- a/ltmain.sh
2 +++ b/ltmain.sh
3 @@ -243,7 +243,7 @@ opt_warning=:
4  # name if it has been set yet.
5  func_echo ()
6  {
7 -    $ECHO "$progname${mode+: }$mode: $*"
8 +    $ECHO "OpenWrt-$progname-patched-2.2${mode+: }$mode: $*"
9  }
10  
11  # func_verbose arg...
12 @@ -262,14 +262,14 @@ func_verbose ()
13  # Echo program name prefixed message to standard error.
14  func_error ()
15  {
16 -    $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
17 +    $ECHO "OpenWrt-$progname-patched-2.2${mode+: }$mode: "${1+"$@"} 1>&2
18  }
19  
20  # func_warning arg...
21  # Echo program name prefixed warning message to standard error.
22  func_warning ()
23  {
24 -    $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
25 +    $opt_warning && $ECHO "OpenWrt-$progname-patched-2.2${mode+: }$mode: warning: "${1+"$@"} 1>&2
26  
27      # bash bug again:
28      :
29 @@ -1048,8 +1048,8 @@ func_infer_tag ()
30         # was found and let the user know that the "--tag" command
31         # line option must be used.
32         if test -z "$tagname"; then
33 -         func_echo "unable to infer tagged configuration"
34 -         func_fatal_error "specify a tag with \`--tag'"
35 +         func_echo "defaulting to \`CC'"
36 +         func_echo "if this is not correct, specify a tag with \`--tag'"
37  #      else
38  #        func_verbose "using $tagname tagged configuration"
39         fi
40 @@ -2009,8 +2009,15 @@ func_mode_install ()
41         dir="$dir$objdir"
42  
43         if test -n "$relink_command"; then
44 +         # Strip any trailing slash from the destination.
45 +         func_stripname '' '/' "$libdir"
46 +         s_libdir=$func_stripname_result
47 +
48 +         func_stripname '' '/' "$destdir"
49 +         s_destdir=$func_stripname_result
50 +
51           # Determine the prefix the user has applied to our future dir.
52 -         inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"`
53 +         inst_prefix_dir=`$ECHO "X$s_destdir" | $Xsed -e "s%$s_libdir\$%%"`
54  
55           # Don't allow the user to place us outside of our expected
56           # location b/c this prevents finding dependent libraries that
57 @@ -2018,8 +2025,11 @@ func_mode_install ()
58           # At present, this check doesn't affect windows .dll's that
59           # are installed into $libdir/../bin (currently, that works fine)
60           # but it's something to keep an eye on.
61 -         test "$inst_prefix_dir" = "$destdir" && \
62 -           func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
63 +         #
64 +         # This breaks install into our staging area.  -PB
65 +         #
66 +         # test "$inst_prefix_dir" = "$destdir" && \
67 +         #   func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
68  
69           if test -n "$inst_prefix_dir"; then
70             # Stick the inst_prefix_dir data into the link command.
71 @@ -2028,6 +2038,9 @@ func_mode_install ()
72             relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"`
73           fi
74  
75 +         relink_command=`$ECHO "$relink_command" | $SED "s%-L[[:space:]]*/lib[^[:space:]]*%%"`
76 +         relink_command=`$ECHO "$relink_command" | $SED "s%-L[[:space:]]*/usr/lib[^[:space:]]*%%"`
77 +
78           func_warning "relinking \`$file'"
79           func_show_eval "$relink_command" \
80             'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
81 @@ -5412,8 +5425,12 @@ func_mode_link ()
82             absdir="$abs_ladir"
83             libdir="$abs_ladir"
84           else
85 -           dir="$libdir"
86 -           absdir="$libdir"
87 +           # Adding 'libdir' from the .la file to our library search paths
88 +           # breaks crosscompilation horribly.  We cheat here and don't add
89 +           # it, instead adding the path where we found the .la.  -CL
90 +           dir="$abs_ladir"
91 +           absdir="$abs_ladir"
92 +           libdir="$abs_ladir"
93           fi
94           test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
95         else
96 @@ -5564,7 +5581,7 @@ func_mode_link ()
97           *)
98             if test "$installed" = no; then
99               notinst_deplibs="$notinst_deplibs $lib"
100 -             need_relink=yes
101 +             need_relink=no
102             fi
103             ;;
104           esac
105 @@ -5768,7 +5785,6 @@ func_mode_link ()
106                test "$hardcode_direct_absolute" = no; then
107               add="$libdir/$linklib"
108             elif test "$hardcode_minus_L" = yes; then
109 -             add_dir="-L$libdir"
110               add="-l$name"
111             elif test "$hardcode_shlibpath_var" = yes; then
112               case :$finalize_shlibpath: in
113 @@ -8052,6 +8068,10 @@ EOF
114             # Replace all uninstalled libtool libraries with the installed ones
115             newdependency_libs=
116             for deplib in $dependency_libs; do
117 +             # Replacing uninstalled with installed can easily break crosscompilation,
118 +             # since the installed path is generally the wrong architecture.  -CL
119 +             newdependency_libs="$newdependency_libs $deplib"
120 +             continue
121               case $deplib in
122               *.la)
123                 func_basename "$deplib"