# --- T2-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
# 
# T2 SDE: package/.../libtool/multilib.patch
# Copyright (C) 2006 The T2 SDE Project
# 
# More information can be found in the files COPYING and README.
# 
# This patch file is dual-licensed. It is available under the license the
# patched project is licensed under, as long as it is an OpenSource license
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
# of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
# --- T2-COPYRIGHT-NOTE-END ---


Multilib support for libtool on linux systems:
libsuff is either set by environment variable LIBSUFF, or from libdir
or by checking the compiler ABI (the latter one is taken from 
libtool-1.5.18-multilib.patch by RedHat).
	--jsaw


diff -ur libtool-1.5.22/libtool.m4 libtool-1.5.22-T2/libtool.m4
--- libtool-1.5.22/libtool.m4	2005-12-18 22:53:17.000000000 +0100
+++ libtool-1.5.22-T2/libtool.m4	2006-03-07 10:44:33.000000000 +0100
@@ -1572,10 +1572,46 @@
   # before this can be enabled.
   hardcode_into_libs=yes
 
+  # Check for libdir suffix (libsuff)
+  # If the environment varialbe LIBSUFF is set, use it as libsuff,
+  # or try to find out the suffix by checking the $libdir var, or
+  # use the compiler ABI
+  libsuffixes="64|32|nofp"
+  if test x${LIBSUFF-none} = xnone; then
+    case "${libdir##*/lib}" in
+    $libsuffixes) libsuff=${libdir##*/lib} ;;
+    *) # try checking compiler ABI, support libsuff=64 only
+       # (this check is copied from RetHat libtool-1.5.18-multilib.patch)
+      case "$host_cpu" in
+      x86_64*|s390x*|powerpc64*)
+        echo '[#]line __oline__ "configure"' > conftest.$ac_ext
+        if AC_TRY_EVAL(ac_compile); then
+          case `/usr/bin/file conftest.$ac_objext` in
+          *64-bit*)
+            libsuff=64
+            ;;
+          esac
+        fi
+        rm -rf conftest*
+      esac
+      ;;
+    esac
+  else
+    libsuff=$LIBSUFF
+  fi
+  libsuffixes=`$echo " $libsuffixes " | ${SED} -e "s%|% %g" -e "s% $libsuff % %g"`
+  # add remaining libsuffixes to notinst_path, if libsuff!=""
+  if test x$libsuff != x; then
+    global_notinst_path="$global_notinst_path .*/lib"
+    for suff in $libsuffixes; do
+        global_notinst_path="$global_notinst_path .*/lib$suff"
+    done
+  fi
+  
   # Append ld.so.conf contents to the search path
   if test -f /etc/ld.so.conf; then
     lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
-    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+    sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra"
   fi
 
   # We used to test for /lib/ld.so.1 and disable shared libraries on
@@ -4399,6 +4435,9 @@
 # The coded name of the library, if different from the real name.
 soname_spec=$lt_soname_spec
 
+# paths that contain not-installed libtool libraries
+global_notinst_path="$global_notinst_path"
+
 # Commands used to build and install an old-style archive.
 RANLIB=$lt_RANLIB
 old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1)
diff -ur libtool-1.5.22/ltmain.in libtool-1.5.22-T2/ltmain.in
--- libtool-1.5.22/ltmain.in	2005-12-18 22:43:52.000000000 +0100
+++ libtool-1.5.22-T2/ltmain.in	2006-03-07 10:43:43.000000000 +0100
@@ -1117,7 +1117,7 @@
     no_install=no
     objs=
     non_pic_objects=
-    notinst_path= # paths that contain not-installed libtool libraries
+    notinst_path="$global_notinst_path" # paths that contain not-installed libtool libraries
     precious_files_regex=
     prefer_static_libs=no
     preload=no
@@ -3411,9 +3411,9 @@
 
       # Eliminate all temporary directories.
       for path in $notinst_path; do
-	lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
-	deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
-	dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
+	lib_search_path=`$echo " $lib_search_path " | ${SED} -e "s% $path % %g"`
+	deplibs=`$echo " $deplibs " | ${SED} -e "s% -L$path % %g"`
+	dependency_libs=`$echo " $dependency_libs " | ${SED} -e "s% -L$path % %g"`
       done
 
       if test -n "$xrpath"; then
diff -ur libtool-1.5.22/ltmain.sh libtool-1.5.22-T2/ltmain.sh
--- libtool-1.5.22/ltmain.sh	2005-12-18 23:14:54.000000000 +0100
+++ libtool-1.5.22-T2/ltmain.sh	2006-03-07 10:45:54.000000000 +0100
@@ -1117,7 +1117,7 @@
     no_install=no
     objs=
     non_pic_objects=
-    notinst_path= # paths that contain not-installed libtool libraries
+    notinst_path="$global_notinst_path" # paths that contain not-installed libtool libraries
     precious_files_regex=
     prefer_static_libs=no
     preload=no
@@ -3411,9 +3411,9 @@
 
       # Eliminate all temporary directories.
       for path in $notinst_path; do
-	lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
-	deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
-	dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
+	lib_search_path=`$echo " $lib_search_path " | ${SED} -e "s% $path % %g"`
+	deplibs=`$echo " $deplibs " | ${SED} -e "s% -L$path % %g"`
+	dependency_libs=`$echo " $dependency_libs " | ${SED} -e "s% -L$path % %g"`
       done
 
       if test -n "$xrpath"; then