summaryrefslogtreecommitdiff
path: root/hints
diff options
context:
space:
mode:
authorAndy Dougherty <doughera@lafayette.edu>2011-04-17 18:19:57 +1000
committerJesse Vincent <jesse@bestpractical.com>2011-04-17 18:22:18 +1000
commit40f026236b9959b7ad3260fedc6c66cd30bb7abc (patch)
tree73e460fe3086470199a17347fd37531ab7b1ca19 /hints
parent6368643f69732288ff1d372b5d0fd3958f332e9c (diff)
downloadperl-40f026236b9959b7ad3260fedc6c66cd30bb7abc.tar.gz
As part of their switch to a multi-arch library layout,
Ubuntu 11.04 (and later, presumably) doesn't keep most libraries (such as -lm) in /lib or /usr/lib. So we have to ask gcc to tell us where to look. We don't want gcc's own libraries, however, so we filter those out. This could be conditional on Ubuntu, but other distributions have announced their intent follow suit, and this scheme seems to work even on rather old gcc's. 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. Still, as an escape hatch, allow Configure command line overrides to plibpth to bypass this check.
Diffstat (limited to 'hints')
-rw-r--r--hints/linux.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/hints/linux.sh b/hints/linux.sh
index ac27f23639..e03ab1edcf 100644
--- a/hints/linux.sh
+++ b/hints/linux.sh
@@ -151,6 +151,24 @@ case "$optimize" in
;;
esac
+# Ubuntu 11.04 (and later, presumably) doesn't keep most libraries
+# (such as -lm) in /lib or /usr/lib. So we have to ask gcc to tell us
+# where to look. We don't want gcc's own libraries, however, so we
+# filter those out.
+# This could be conditional on Unbuntu, but other distributions may
+# follow suit, and this scheme seems to work even on rather old gcc's.
+# 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.
+# Still, as an escape hatch, allow Configure command line overrides to
+# plibpth to bypass this check.
+case "$plibpth" in
+'') plibpth=`gcc -print-search-dirs | grep libraries |
+ cut -f2- -d= | tr ':' $trnl | grep -v 'gcc'`
+ plibpth="$plibpth" # Collapse all entries on one line
+ ;;
+esac
+
# Are we using ELF? Thanks to Kenneth Albanowski <kjahds@kjahds.com>
# for this test.
cat >try.c <<'EOM'