From d460ab58231f7e1acb87b8a4c1f3a54981976fad Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 7 Feb 2003 14:21:03 +0000 Subject: * genscripts.sh (LIB_PATH): Don't append LIBPATH_SUFFIX to paths which already have it. Avoid duplicates. --- ld/ChangeLog | 5 +++++ ld/genscripts.sh | 31 ++++++++++++++++++++++++------- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index 8c697cf..958acc0 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,8 @@ +2003-02-07 Jakub Jelinek + + * genscripts.sh (LIB_PATH): Don't append LIBPATH_SUFFIX to paths + which already have it. Avoid duplicates. + 2003-02-06 Jakub Jelinek * emulparams/elf64_s390.sh (LIBPATH_SUFFIX): Set to 64. diff --git a/ld/genscripts.sh b/ld/genscripts.sh index 63a7d09..39d97ae 100755 --- a/ld/genscripts.sh +++ b/ld/genscripts.sh @@ -77,20 +77,37 @@ if [ "x${LIB_PATH}" = "x" ] && [ "x${USE_LIBPATH}" = xyes ] ; then 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 -- cgit v1.1