diff options
author | Nicholas Clark <nick@ccl4.org> | 2011-06-15 16:24:43 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2011-06-18 11:06:45 +0200 |
commit | dcffd848632af2c7eabc52ed591fab35f1e73a7f (patch) | |
tree | 4b0375c167e17c5b22235a8a4ff31e1cb264d556 | |
parent | 65374be2e8e6c26ff16c4a32dff08466fba36bc6 (diff) | |
download | perl-dcffd848632af2c7eabc52ed591fab35f1e73a7f.tar.gz |
Prefer the system gcc when searching for libraries such as -lm
40f026236b9959b7 added code to the Linux hints file to use gcc to locate
libraries such as -lm. However, if the user has their own gcc earlier in $PATH
than the system gcc, we don't want its libraries. So try to prefer the system
gcc.
-rw-r--r-- | hints/linux.sh | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/hints/linux.sh b/hints/linux.sh index 970640c29b..2808f865da 100644 --- a/hints/linux.sh +++ b/hints/linux.sh @@ -160,10 +160,18 @@ esac # This unconditionally uses gcc because even if the user is using another # compiler, we still need to find the math library and friends, and I don't # know how other compilers will cope with that situation. +# Morever, if the user has their own gcc earlier in $PATH than the system gcc, +# we don't want its libraries. So we try to prefer the system gcc # Still, as an escape hatch, allow Configure command line overrides to # plibpth to bypass this check. +if [ -x /usr/bin/gcc ] ; then + gcc=/usr/bin/gcc +else + gcc=gcc +fi + case "$plibpth" in -'') plibpth=`gcc -print-search-dirs | grep libraries | +'') plibpth=`$gcc -print-search-dirs | grep libraries | cut -f2- -d= | tr ':' $trnl | grep -v 'gcc' | sed -e 's:/$::'` set X $plibpth # Collapse all entries on one line shift |