summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2011-06-15 16:24:43 +0100
committerRicardo Signes <rjbs@cpan.org>2012-03-20 21:17:48 -0400
commitea7b28194ea62e840460d735b7faec611aa45abc (patch)
tree2cafd105506865062194b46e6fa50590002e0738
parentaa23a9e0af2a399fd4793613aaf2786800053d28 (diff)
downloadperl-ea7b28194ea62e840460d735b7faec611aa45abc.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.sh10
1 files changed, 9 insertions, 1 deletions
diff --git a/hints/linux.sh b/hints/linux.sh
index 8a3837376a..d0ac9fa9ff 100644
--- a/hints/linux.sh
+++ b/hints/linux.sh
@@ -163,10 +163,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