This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
check --whole-archive is supported (in cc.cbu) before using it
authorTony Cook <tony@develop-help.com>
Sat, 9 Apr 2011 00:45:37 +0000 (10:45 +1000)
committerTony Cook <tony@develop-help.com>
Mon, 18 Apr 2011 09:42:57 +0000 (19:42 +1000)
netbsd for pre 4.6 gcc requires --whole-archive to build shared
libraries, but this is rejected and not required in 4.6.0.

hints/netbsd.sh

index d812f60..4ecd181 100644 (file)
@@ -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]*)