1--- a/ltmain.sh	2010-06-09 15:08:53.000000000 +0200
2+++ b/ltmain.sh	2014-07-30 22:33:41.176710372 +0200
3@@ -1214,8 +1214,8 @@
4 	# was found and let the user know that the "--tag" command
5 	# line option must be used.
6 	if test -z "$tagname"; then
7-	  func_echo "unable to infer tagged configuration"
8-	  func_fatal_error "specify a tag with \`--tag'"
9+	  func_echo "defaulting to \`CC'"
10+	  func_echo "if this is not correct, specify a tag with \`--tag'"
11 #	else
12 #	  func_verbose "using $tagname tagged configuration"
13 	fi
14@@ -2239,8 +2239,11 @@
15 	  # At present, this check doesn't affect windows .dll's that
16 	  # are installed into $libdir/../bin (currently, that works fine)
17 	  # but it's something to keep an eye on.
18-	  test "$inst_prefix_dir" = "$destdir" && \
19-	    func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
20+	  #
21+	  # This breaks install into our staging area.  -PB
22+	  #
23+	  # test "$inst_prefix_dir" = "$destdir" && \
24+	  #   func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
25
26 	  if test -n "$inst_prefix_dir"; then
27 	    # Stick the inst_prefix_dir data into the link command.
28@@ -4429,7 +4432,8 @@
29 	;;
30       -all-static | -static | -static-libtool-libs)
31 	case $arg in
32-	-all-static)
33+	# Make -static behave like -all-static
34+	-all-static | -static)
35 	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
36 	    func_warning "complete static linking is impossible in this configuration"
37 	  fi
38@@ -4438,12 +4442,6 @@
39 	  fi
40 	  prefer_static_libs=yes
41 	  ;;
42-	-static)
43-	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
44-	    dlopen_self=$dlopen_self_static
45-	  fi
46-	  prefer_static_libs=built
47-	  ;;
48 	-static-libtool-libs)
49 	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
50 	    dlopen_self=$dlopen_self_static
51@@ -4726,7 +4724,8 @@
52       prevarg="$arg"
53
54       case $arg in
55-      -all-static)
56+      # Make -static behave like -all-static
57+      -all-static | -static)
58 	if test -n "$link_static_flag"; then
59 	  # See comment for -static flag below, for more details.
60 	  func_append compile_command " $link_static_flag"
61@@ -4995,7 +4994,7 @@
62 	continue
63 	;;
64
65-      -static | -static-libtool-libs)
66+      -static-libtool-libs)
67 	# The effects of -static are defined in a previous loop.
68 	# We used to do the same as -all-static on platforms that
69 	# didn't have a PIC flag, but the assumption that the effects
70@@ -5739,8 +5738,14 @@
71 	    absdir="$abs_ladir"
72 	    libdir="$abs_ladir"
73 	  else
74-	    dir="$libdir"
75-	    absdir="$libdir"
76+            # Adding 'libdir' from the .la file to our library search paths
77+            # breaks crosscompilation horribly.  We cheat here and don't add
78+            # it, instead adding the path where we found the .la.  -CL
79+	    dir="$abs_ladir"
80+	    absdir="$abs_ladir"
81+	    libdir="$abs_ladir"
82+	    #dir="$libdir"
83+	    #absdir="$libdir"
84 	  fi
85 	  test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
86 	else
87@@ -5891,7 +5896,7 @@
88 	  *)
89 	    if test "$installed" = no; then
90 	      notinst_deplibs="$notinst_deplibs $lib"
91-	      need_relink=yes
92+	      need_relink=no
93 	    fi
94 	    ;;
95 	  esac
96@@ -8373,6 +8378,10 @@
97 	    # Replace all uninstalled libtool libraries with the installed ones
98 	    newdependency_libs=
99 	    for deplib in $dependency_libs; do
100+              # Replacing uninstalled with installed can easily break crosscompilation,
101+              # since the installed path is generally the wrong architecture.  -CL
102+              newdependency_libs="$newdependency_libs $deplib"
103+              continue
104 	      case $deplib in
105 	      *.la)
106 		func_basename "$deplib"
107