8f79edfb8d27ef33112addc2972a609a48d79489
[p5sagit/p5-mst-13.2.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         if [ -f /usr/libexec/ld.elf_so ]; then
22                 d_dlopen=$define
23                 d_dlerror=$define
24                 # Include the whole libgcc.a, required for Xerces-P, which
25                 # needs __eh_alloc, __pure_virtual, and others.
26                 # XXX This should be obsoleted by gcc-3.0.
27                 ccdlflags="-Wl,-whole-archive -lgcc -Wl,-no-whole-archive \
28                         -Wl,-E $ccdlflags"
29                 cccdlflags="-DPIC -fPIC $cccdlflags"
30                 lddlflags="--whole-archive -shared $lddlflags"
31         elif [ "`uname -m`" = "pmax" ]; then
32 # NetBSD 1.3 and 1.3.1 on pmax shipped an `old' ld.so, which will not work.
33                 case "$osvers" in
34                 1.3|1.3.1)
35                         d_dlopen=$undef
36                         ;;
37                 esac
38         elif [ -f /usr/libexec/ld.so ]; then
39                 d_dlopen=$define
40                 d_dlerror=$define
41 # we use -fPIC here because -fpic is *NOT* enough for some of the
42 # extensions like Tk on some netbsd platforms (the sparc is one)
43                 cccdlflags="-DPIC -fPIC $cccdlflags"
44                 lddlflags="-Bshareable $lddlflags"
45         else
46                 d_dlopen=$undef
47         fi
48         ;;
49 esac
50
51 # netbsd had these but they don't really work as advertised, in the
52 # versions listed below.  if they are defined, then there isn't a
53 # way to make perl call setuid() or setgid().  if they aren't, then
54 # ($<, $>) = ($u, $u); will work (same for $(/$)).  this is because
55 # you can not change the real userid of a process under 4.4BSD.
56 # netbsd fixed this in 1.3.2.
57 case "$osvers" in
58 0.9*|1.[012]*|1.3|1.3.1)
59         d_setregid="$undef"
60         d_setreuid="$undef"
61         ;;
62 esac
63
64 # These are obsolete in any netbsd.
65 d_setrgid="$undef"
66 d_setruid="$undef"
67
68 # there's no problem with vfork.
69 usevfork=true
70
71 # This is there but in machine/ieeefp_h.
72 ieeefp_h="define"
73
74 # This script UU/usethreads.cbu will get 'called-back' by Configure 
75 # after it has prompted the user for whether to use threads. 
76 cat > UU/usethreads.cbu <<'EOCBU' 
77 case "$usethreads" in 
78 $define|true|[yY]*) 
79         # The GNU pth is the recommended user-level pthreads implementation. 
80         # As of NetBSD 1.5.2 there are no kernel pthreads. 
81         if pkg_info -qe pth; then 
82             # Add -lpthread. 
83             libswanted="$libswanted pthread" 
84             # There is no libc_r as of NetBSD 1.5.2, so no c -> c_r. 
85         else 
86             echo "$0: You need to install the GNU pth.  Aborting." >&4 
87             exit 1 
88         fi 
89         ;; 
90 esac 
91 EOCBU
92
93 # Recognize the NetBSD packages collection.
94 # GDBM might be here, pth might be there.
95 if test -d /usr/pkg/lib; then
96         loclibpth="$loclibpth /usr/pkg/lib"
97         if [ -f /usr/libexec/ld.elf_so ]; then
98                 ldflags="$ldflags -Wl,-R/usr/pkg/lib"
99         else
100                 ldflags="$ldflags -R/usr/pkg/lib"
101         fi
102 fi
103 test -d /usr/pkg/include && locincpth="$locincpth /usr/pkg/include"