# HG changeset patch # User "Yann E. MORIN" # Date 1290544528 -3600 # Node ID 6d909657dbdfca75a022de53b3a468dea6fd8447 # Parent 7579ac8ffe0bfb4d2cfb57aaf393b2b5a3cb7224 scripts/xldd: better find sysroot with old gcc Only starting with 4.4 does gcc have a -print-sysroot option. For 4.3 or before, we have to play some tricks: - ask gcc where libc.so is, (we expect it in ${sysroot}/usr/lib/libc.so) - trim /usr/lib/libc.so from the result Signed-off-by: "Yann E. MORIN" (transplanted from aa2305c5b2a57fbcda9a1b5bb5fb3a476ac49a13) diff -r 7579ac8ffe0b -r 6d909657dbdf scripts/xldd.in --- a/scripts/xldd.in Tue Nov 23 21:35:10 2010 +0100 +++ b/scripts/xldd.in Tue Nov 23 21:35:28 2010 +0100 @@ -132,7 +132,15 @@ exit 1 fi -sysroot="$( "${gcc}" -print-sysroot )" +sysroot="$( "${gcc}" -print-sysroot 2>/dev/null )" +if [ -z "${sysroot}" ]; then + sysroot="$( "${gcc}" -print-file-name=libc.so 2>/dev/null \ + |sed -r -e 's:/usr/lib/libc.so$::;' \ + )" +fi +if [ -z "${sysroot}" ]; then + do_error "unable to find sysroot for \`${gcc}'" +fi do_report_needed_found() { local needed="${1}"