#! /bin/sh -e

dir=
if [ $# -eq 3 -a "$2" = '-d' ]; then
    pdir="-d $3"
    dir="$3/"
elif [ $# -ne 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi
case "$1" in
    -patch)
        patch $pdir -f --no-backup-if-mismatch -p0 < $0
        ;;
    -unpatch)
        patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
        ;;
    *)
        echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
        exit 1
esac
exit 0

# DP: 2003-03-10  Andreas Schwab  <schwab at suse dot de>
# DP: With the introduction of multi-os-directory the libdir specification in
# DP: *.la files have /. appended to $(libdir).  This confuses libtool when it
# DP: tries to find out whether to add -rpath, because it only matches literally
# DP: against sys_lib_dlsearch_path members.  Tested on i386-linux.

Andreas.

2003-03-10  Andreas Schwab  <schwab at suse dot de>

boehm-gc:
	* configure.in: Avoid trailing /. in toolexeclibdir.
	* configure: Rebuilt.

libf2c:
	* aclocal.m4 (GLIBCPP_EXPORT_INSTALL_INFO): Avoid trailing /. in
	glibcpp_toolexeclibdir.
	* configure: Rebuilt.

libffi:
	* configure.in: Avoid trailing /. in toolexeclibdir.
	* configure: Rebuilt.

libjava:
	* configure.in: Avoid trailing /. in toolexeclibdir.
	* configure: Rebuilt.

libobjc:
	* aclocal.m4 (GLIBCPP_EXPORT_INSTALL_INFO): Avoid trailing /. in
	glibcpp_toolexeclibdir.
	* configure: Rebuilt.

libstdc++-v3:
	* acinclude.m4 (GLIBCPP_EXPORT_INSTALL_INFO): Avoid trailing /. in
	glibcpp_toolexeclibdir.
	* aclocal.m4, configure: Rebuilt.

zlib:
	* configure.in: Avoid trailing /. in toolexeclibdir.
	* configure: Rebuilt.

Index: boehm-gc/configure.in
===================================================================
RCS file: /cvs/gcc/gcc/boehm-gc/configure.in,v
retrieving revision 1.43.14.2
diff -u -p -a -r1.43.14.2 configure.in
--- boehm-gc/configure.in	20 Feb 2003 09:12:13 -0000	1.43.14.2
+++ boehm-gc/configure.in	7 Mar 2003 23:07:22 -0000
@@ -275,7 +275,11 @@ else
   toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
   toolexeclibdir='$(libdir)'
 fi
-toolexeclibdir=$toolexeclibdir/`$CC -print-multi-os-directory`
+multi_os_directory=`$CC -print-multi-os-directory`
+case $multi_os_directory in
+  .) ;; # Avoid trailing /.
+  *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
+esac
 AC_SUBST(toolexecdir)
 AC_SUBST(toolexeclibdir)
 
Index: libf2c/aclocal.m4
===================================================================
RCS file: /cvs/gcc/gcc/libf2c/aclocal.m4,v
retrieving revision 1.5.14.1
diff -u -p -a -r1.5.14.1 aclocal.m4
--- libf2c/aclocal.m4	28 Jan 2003 01:45:12 -0000	1.5.14.1
+++ libf2c/aclocal.m4	7 Mar 2003 23:07:26 -0000
@@ -212,7 +212,11 @@ if test x"$glibcpp_toolexecdir" = x"no";
     glibcpp_toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
     glibcpp_toolexeclibdir='$(libdir)'
   fi
-  glibcpp_toolexeclibdir=$glibcpp_toolexeclibdir/`$CC -print-multi-os-directory`
+  multi_os_directory=`$CC -print-multi-os-directory`
+  case $multi_os_directory in
+    .) ;; # Avoid trailing /.
+    *) glibcpp_toolexeclibdir=$glibcpp_toolexeclibdir/$multi_os_directory ;;
+  esac
 fi
 
 AC_SUBST(glibcpp_prefixdir)
Index: libffi/configure.in
===================================================================
RCS file: /cvs/gcc/gcc/libffi/configure.in,v
retrieving revision 1.33.2.4
diff -u -p -a -r1.33.2.4 configure.in
--- libffi/configure.in	20 Feb 2003 09:12:03 -0000	1.33.2.4
+++ libffi/configure.in	7 Mar 2003 23:07:26 -0000
@@ -172,7 +172,11 @@ else
   toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
   toolexeclibdir='$(libdir)'
 fi
-toolexeclibdir=$toolexeclibdir/`$CC -print-multi-os-directory`
+multi_os_directory=`$CC -print-multi-os-directory`
+case $multi_os_directory in
+  .) ;; # Avoid trailing /.
+  *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
+esac
 AC_SUBST(toolexecdir)
 AC_SUBST(toolexeclibdir)
 
Index: libjava/configure.in
===================================================================
RCS file: /cvs/gcc/gcc/libjava/configure.in,v
retrieving revision 1.142.4.6
diff -u -p -a -r1.142.4.6 configure.in
--- libjava/configure.in	20 Feb 2003 09:12:24 -0000	1.142.4.6
+++ libjava/configure.in	7 Mar 2003 23:07:27 -0000
@@ -808,7 +808,11 @@ else
   toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
   toolexecmainlibdir='$(libdir)'
 fi
-toolexeclibdir=$toolexecmainlibdir/`$CC -print-multi-os-directory`
+multi_os_directory=`$CC -print-multi-os-directory`
+case $multi_os_directory in
+  .) toolexeclibdir=$toolexecmainlibdir ;; # Avoid trailing /.
+  *) toolexeclibdir=$toolexecmainlibdir/$multi_os_directory ;;
+esac
 AC_SUBST(toolexecdir)
 AC_SUBST(toolexecmainlibdir)
 AC_SUBST(toolexeclibdir)
Index: libobjc/aclocal.m4
===================================================================
RCS file: /cvs/gcc/gcc/libobjc/aclocal.m4,v
retrieving revision 1.5.14.1
diff -u -p -a -r1.5.14.1 aclocal.m4
--- libobjc/aclocal.m4	28 Jan 2003 01:45:01 -0000	1.5.14.1
+++ libobjc/aclocal.m4	7 Mar 2003 23:07:30 -0000
@@ -212,7 +212,11 @@ if test x"$glibcpp_toolexecdir" = x"no";
     glibcpp_toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
     glibcpp_toolexeclibdir='$(libdir)'
   fi
-  glibcpp_toolexeclibdir=$glibcpp_toolexeclibdir/`$CC -print-multi-os-directory`
+  multi_os_directory=`$CC -print-multi-os-directory`
+  case $multi_os_directory in
+  .) ;; # Avoid trailing /.
+  *) glibcpp_toolexeclibdir=$glibcpp_toolexeclibdir/$multi_os_directory ;;
+  esac
 fi
 
 AC_SUBST(glibcpp_prefixdir)
Index: libstdc++-v3/acinclude.m4
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/acinclude.m4,v
retrieving revision 1.223.2.5
diff -u -p -a -r1.223.2.5 acinclude.m4
--- libstdc++-v3/acinclude.m4	28 Feb 2003 08:18:04 -0000	1.223.2.5
+++ libstdc++-v3/acinclude.m4	7 Mar 2003 23:07:31 -0000
@@ -1968,7 +1968,11 @@ if test x"$glibcpp_toolexecdir" = x"no";
     glibcpp_toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
     glibcpp_toolexeclibdir='$(libdir)'
   fi
-  glibcpp_toolexeclibdir=$glibcpp_toolexeclibdir/`$CC -print-multi-os-directory`
+  multi_os_directory=`$CC -print-multi-os-directory`
+  case $multi_os_directory in
+  .) ;; # Avoid trailing /.
+  *) glibcpp_toolexeclibdir=$glibcpp_toolexeclibdir/$multi_os_directory ;;
+  esac
 fi
 
 AC_MSG_CHECKING([for install location])
Index: zlib/configure.in
===================================================================
RCS file: /cvs/gcc/gcc/zlib/configure.in,v
retrieving revision 1.15.20.3
diff -u -p -a -r1.15.20.3 configure.in
--- zlib/configure.in	20 Feb 2003 09:12:20 -0000	1.15.20.3
+++ zlib/configure.in	7 Mar 2003 23:07:34 -0000
@@ -123,6 +123,9 @@ else
 fi
 if test "$GCC" = yes && $CC -print-multi-os-directory > /dev/null 2>&1; then
   multiosdir=/`$CC -print-multi-os-directory`
+  case $multiosdir in
+    /.) multiosdir= ;; # Avoid trailing /.
+  esac
 else
   multiosdir=
 fi

