config/optimize: add distribution specific libdirs to HOST_LDFLAGS

Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
Stephan Raue 2011-07-13 03:09:12 +02:00
parent c83a2f8b54
commit e83551cf71

View File

@ -61,11 +61,44 @@ HOST_CFLAGS="-O2 -Wall -pipe -I$ROOT/$TOOLCHAIN/include"
HOST_CXXFLAGS="$HOST_CFLAGS"
HOST_LDFLAGS="-Wl,-rpath,$ROOT/$TOOLCHAIN/lib -L$ROOT/$TOOLCHAIN/lib"
# add distro specific library dirs
# ubuntu/debian specific "multiarch support"
FAMILY_TRIPLET=$(echo $HOST_NAME | sed -e "s,$(uname -m),$(uname -i),")
if [ -d /lib/$FAMILY_TRIPLET ]; then
HOST_LDFLAGS="$HOST_LDFLAGS -L/lib/$FAMILY_TRIPLET"
fi
if [ -d /usr/lib/$FAMILY_TRIPLET ]; then
HOST_LDFLAGS="$HOST_LDFLAGS -L/usr/lib/$FAMILY_TRIPLET"
fi
# default multiarch support
case "`uname -m`" in
i*86)
if [ -d /lib32 ]; then
HOST_LDFLAGS="$HOST_LDFLAGS -L/lib32"
fi
if [ -d /usr/lib32 ]; then
HOST_LDFLAGS="$HOST_LDFLAGS -L/usr/lib32"
fi
;;
x86_64)
if [ -d /lib64 ]; then
HOST_LDFLAGS="$HOST_LDFLAGS -L/lib64"
fi
if [ -d /usr/lib64 ]; then
HOST_LDFLAGS="$HOST_LDFLAGS -L/usr/lib64"
fi
;;
esac
# default dirs
HOST_LDFLAGS="$HOST_LDFLAGS -L/lib -L/usr/lib"
# use -fPIC when necessary
case "`uname -m`" in
x86_64|ppc64|arm|armeb|armel)
HOST_CFLAGS="$HOST_CFLAGS -fPIC"
HOST_CXXFLAGS="$HOST_CXXFLAGS -fPIC"
HOST_LDFLAGS="$HOST_LDFLAGS -fPIC"
HOST_CFLAGS="$HOST_CFLAGS -fPIC"
HOST_CXXFLAGS="$HOST_CXXFLAGS -fPIC"
HOST_LDFLAGS="$HOST_LDFLAGS -fPIC"
;;
esac