This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
NetBSD patch-ab from Johnny Lam:
[perl5.git] / hints / netbsd.sh
1 # hints/netbsd.sh
2 #
3 # talk to packages@netbsd.org if you want to change this file.
4 #
5 # netbsd keeps dynamic loading dl*() functions in /usr/lib/crt0.o,
6 # so Configure doesn't find them (unless you abandon the nm scan).
7 # this should be *just* 0.9 below as netbsd 0.9a was the first to
8 # introduce shared libraries.
9
10 case "$archname" in
11 '')
12     archname=`uname -m`-${osname}
13     ;;
14 esac
15
16 case "$osvers" in
17 0.9|0.8*)
18         usedl="$undef"
19         ;;
20 *)
21         # Note that we use the value of $prefix in this block.  The user
22         # should specify -Dprefix=... to the Configure script.
23         if [ -f /usr/libexec/ld.elf_so ]; then
24                 d_dlopen=$define
25                 d_dlerror=$define
26                 # Include the whole libgcc.a, required for Xerces-P, which
27                 # needs __eh_alloc, __pure_virtual, and others.
28                 # XXX This should be obsoleted by gcc-3.0.
29                 ccdlflags="-Wl,-whole-archive -lgcc -Wl,-no-whole-archive \
30                         -Wl,-E -Wl,-R$prefix/lib $ccdlflags"
31                 cccdlflags="-DPIC -fPIC $cccdlflags"
32                 lddlflags="--whole-archive -shared $lddlflags"
33         elif [ "`uname -m`" = "pmax" ]; then
34 # NetBSD 1.3 and 1.3.1 on pmax shipped an `old' ld.so, which will not work.
35                 case "$osvers" in
36                 1.3|1.3.1)
37                         d_dlopen=$undef
38                         ;;
39                 esac
40         elif [ -f /usr/libexec/ld.so ]; then
41                 d_dlopen=$define
42                 d_dlerror=$define
43                 ccdlflags="-Wl,-R$prefix/lib $ccdlflags"
44 # we use -fPIC here because -fpic is *NOT* enough for some of the
45 # extensions like Tk on some netbsd platforms (the sparc is one)
46                 cccdlflags="-DPIC -fPIC $cccdlflags"
47                 lddlflags="-Bshareable $lddlflags"
48         else
49                 d_dlopen=$undef
50         fi
51         ;;
52 esac
53
54 # netbsd had these but they don't really work as advertised, in the
55 # versions listed below.  if they are defined, then there isn't a
56 # way to make perl call setuid() or setgid().  if they aren't, then
57 # ($<, $>) = ($u, $u); will work (same for $(/$)).  this is because
58 # you can not change the real userid of a process under 4.4BSD.
59 # netbsd fixed this in 1.3.2.
60 case "$osvers" in
61 0.9*|1.[012]*|1.3|1.3.1)
62         d_setregid="$undef"
63         d_setreuid="$undef"
64         ;;
65 esac
66
67 # These are obsolete in any netbsd.
68 d_setrgid="$undef"
69 d_setruid="$undef"
70
71 # there's no problem with vfork.
72 usevfork=true
73
74 # This is there but in machine/ieeefp_h.
75 ieeefp_h="define"
76
77 # This script UU/usethreads.cbu will get 'called-back' by Configure 
78 # after it has prompted the user for whether to use threads. 
79 cat > UU/usethreads.cbu <<'EOCBU' 
80 case "$usethreads" in 
81 $define|true|[yY]*) 
82         # The GNU pth is the recommended user-level pthreads implementation. 
83         # As of NetBSD 1.5.2 there are no kernel pthreads. 
84         if pkg_info -qe pth; then 
85             # Add -lpthread. 
86             libswanted="$libswanted pthread" 
87             # There is no libc_r as of NetBSD 1.5.2, so no c -> c_r. 
88         else 
89             echo "$0: You need to install the GNU pth.  Aborting." >&4 
90             exit 1 
91         fi 
92         ;; 
93 esac 
94 EOCBU
95
96 # Recognize the NetBSD packages collection.
97 # GDBM might be here, pth might be there.
98 if test -d /usr/pkg/lib; then
99         loclibpth="$loclibpth /usr/pkg/lib"
100         ldflags="$ldflags -R/usr/pkg/lib"
101 fi
102 test -d /usr/pkg/include && locincpth="$locincpth /usr/pkg/include"