summaryrefslogtreecommitdiff
blob: 3d2da52ae4fc2132e40807bd21285e3b0e639c81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
2003-02-06  Jakub Jelinek  <jakub@redhat.com>

	* genscripts.sh (LIB_PATH): Don't append LIBPATH_SUFFIX to paths
	which already have it.  Avoid duplicates.

--- ld/genscripts.sh.jj	2003-01-08 10:02:41.000000000 -0500
+++ ld/genscripts.sh	2003-02-06 12:16:35.000000000 -0500
@@ -77,20 +77,37 @@ if [ "x${LIB_PATH}" = "x" ] && [ "x${USE
   if [ x"$use_sysroot" != xyes ] ; then
     LIB_PATH=${libdir}
   fi
+  LIB_PATH2=""
   for lib in ${NATIVE_LIB_DIRS}; do
     # The "=" is harmless if we aren't using a sysroot, but also needless.
     if [ "x${use_sysroot}" = "xyes" ] ; then
       lib="=${lib}"
     fi
-    case :${LIB_PATH}: in
-      *:${lib}:*) ;;
-      ::) LIB_PATH=${lib} ;;
-      *) LIB_PATH=${LIB_PATH}:${lib} ;;
+    addsuffix=
+    case "${LIBPATH_SUFFIX}:${lib}" in
+      :*) ;;
+      *:*${LIBPATH_SUFFIX}) ;;
+      *) addsuffix=yes ;;
     esac
+    if test -n "$addsuffix"; then
+      case :${LIB_PATH}: in
+	*:${lib}${LIBPATH_SUFFIX}:*) ;;
+	::) LIB_PATH=${lib}${LIBPATH_SUFFIX} ;;
+	*) LIB_PATH=${LIB_PATH}:${lib}${LIBPATH_SUFFIX} ;;
+      esac
+      case :${LIB_PATH}${LIB_PATH2}: in
+	*:${lib}:*) ;;
+        *) LIB_PATH2=${LIB_PATH2}:${lib} ;;
+      esac
+    else
+      case :${LIB_PATH}: in
+        *:${lib}:*) ;;
+        ::) LIB_PATH=${lib} ;;
+        *) LIB_PATH=${LIB_PATH}:${lib} ;;
+      esac
+    fi
   done
-  if test -n "$LIBPATH_SUFFIX" ; then
-    LIB_PATH=`echo ${LIB_PATH}: | sed -e s,:,${LIBPATH_SUFFIX}:,g`$LIB_PATH
-  fi
+  LIB_PATH=${LIB_PATH}${LIB_PATH2}
 fi