From 3b23fcb13d39c0c5249be5a0a886edeacfc914f2 Mon Sep 17 00:00:00 2001 From: Brian Fraser Date: Wed, 22 Jan 2014 19:33:51 -0300 Subject: [PATCH] Linux hints: Improve the code that looks for libc.so --- hints/linux.sh | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/hints/linux.sh b/hints/linux.sh index 5f92bba..4c2c5f5 100644 --- a/hints/linux.sh +++ b/hints/linux.sh @@ -60,17 +60,6 @@ libswanted="$*" # Debian 4.0 puts ndbm in the -lgdbm_compat library. libswanted="$libswanted gdbm_compat" -# If you have glibc, then report the version for ./myconfig bug reporting. -# (Configure doesn't need to know the specific version since it just uses -# gcc to load the library for all tests.) -# We don't use __GLIBC__ and __GLIBC_MINOR__ because they -# are insufficiently precise to distinguish things like -# libc-2.0.6 and libc-2.0.7. -if test -L /lib/libc.so.6; then - libc=`ls -l /lib/libc.so.6 | awk '{print $NF}'` - libc=/lib/$libc -fi - # Configure may fail to find lstat() since it's a static/inline # function in . d_lstat=define @@ -185,6 +174,32 @@ case "$plibpth" in ;; esac +case "$libc" in +'') +# If you have glibc, then report the version for ./myconfig bug reporting. +# (Configure doesn't need to know the specific version since it just uses +# gcc to load the library for all tests.) +# We don't use __GLIBC__ and __GLIBC_MINOR__ because they +# are insufficiently precise to distinguish things like +# libc-2.0.6 and libc-2.0.7. + for p in $plibpth + do + for trylib in libc.so.6 libc.so + do + if $test -e $p/$trylib; then + libc=`ls -l $p/$trylib | awk '{print $NF}'` + if $test "X$libc" != X; then + break + fi + fi + done + if $test "X$libc" != X; then + break + fi + done + ;; +esac + # Are we using ELF? Thanks to Kenneth Albanowski # for this test. cat >try.c <<'EOM' -- 2.7.4