summaryrefslogtreecommitdiff
path: root/hints
diff options
context:
space:
mode:
authorTony Cook <tony@develop-help.com>2011-04-09 10:45:37 +1000
committerTony Cook <tony@develop-help.com>2011-04-18 19:42:57 +1000
commite2a47f809bfc63d49b2a2c9318b120e63a8fa531 (patch)
treeae80d13fe7e3acd3cd880b4a50f713bd6f2a9dd8 /hints
parent5e17a751850058bfb7550cd74c5226303f99d9b4 (diff)
downloadperl-e2a47f809bfc63d49b2a2c9318b120e63a8fa531.tar.gz
check --whole-archive is supported (in cc.cbu) before using it
netbsd for pre 4.6 gcc requires --whole-archive to build shared libraries, but this is rejected and not required in 4.6.0.
Diffstat (limited to 'hints')
-rw-r--r--hints/netbsd.sh12
1 files changed, 11 insertions, 1 deletions
diff --git a/hints/netbsd.sh b/hints/netbsd.sh
index d812f60fea..4ecd1817c4 100644
--- a/hints/netbsd.sh
+++ b/hints/netbsd.sh
@@ -35,7 +35,17 @@ case "$osvers" in
d_dlopen=$define
d_dlerror=$define
cccdlflags="-DPIC -fPIC $cccdlflags"
- lddlflags="--whole-archive -shared $lddlflags"
+ lddlflags="-shared $lddlflags"
+ cat >UU/cc.cbu <<'EOCBU'
+# gcc 4.6 doesn't support --whole-archive, but it's required for the
+# system gcc to build correctly, so check for it
+echo 'int f(void) { return 0; }' >try.c
+if ${cc:-cc} $cccdlflags -c try.c -otry.o 2>&1 &&
+ ${cc:-cc} --whole-archive $lddlflags try.o -otry.so 2>&1 ; then
+ lddlflags="--whole-archive $lddlflags"
+fi
+rm try.c try.o try.so 2>/dev/null
+EOCBU
rpathflag="-Wl,-rpath,"
case "$osvers" in
1.[0-5]*)