diff options
author | Tony Cook <tony@develop-help.com> | 2011-04-09 00:05:24 +1000 |
---|---|---|
committer | Tony Cook <tony@develop-help.com> | 2011-04-13 16:16:57 +1000 |
commit | 673d8593b7ef274dadbfff97fd641e3c563fc716 (patch) | |
tree | c0dcfe94ebab920f71b0a18d527e23a83595dd84 /hints/netbsd.sh | |
parent | 9645299c5cba107a7c8cb0abd6b23360d3df6b59 (diff) | |
download | perl-673d8593b7ef274dadbfff97fd641e3c563fc716.tar.gz |
check --whole-archive is supported 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.
Simply changing the option to -Wl,--whole-archive works on gcc 4.6.0
but fails for the system cc on NetBSD 5.1/x64.
Diffstat (limited to 'hints/netbsd.sh')
-rw-r--r-- | hints/netbsd.sh | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/hints/netbsd.sh b/hints/netbsd.sh index d812f60fea..c64be440e0 100644 --- a/hints/netbsd.sh +++ b/hints/netbsd.sh @@ -35,7 +35,15 @@ case "$osvers" in d_dlopen=$define d_dlerror=$define cccdlflags="-DPIC -fPIC $cccdlflags" - lddlflags="--whole-archive -shared $lddlflags" + lddlflags="-shared $lddlflags" + # gcc 4.6 doesn't support --whole-archive, but check for it + # if the user chooses a new compiler later, this is pointless + 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 rpathflag="-Wl,-rpath," case "$osvers" in 1.[0-5]*) |