This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
mktables: Add type_of() method to get range's type
[perl5.git] / hints / netbsd.sh
CommitLineData
a0d0e21e 1# hints/netbsd.sh
4633a7c4 2#
068ac78d
JH
3# Please check with packages@netbsd.org before making modifications
4# to this file.
c9ef717e
MG
5
6case "$archname" in
7'')
8 archname=`uname -m`-${osname}
9 ;;
10esac
11
068ac78d
JH
12# NetBSD keeps dynamic loading dl*() functions in /usr/lib/crt0.o,
13# so Configure doesn't find them (unless you abandon the nm scan).
14# Also, NetBSD 0.9a was the first release to introduce shared
15# libraries.
16#
a0d0e21e 17case "$osvers" in
4633a7c4 180.9|0.8*)
a0d0e21e
LW
19 usedl="$undef"
20 ;;
c9ef717e 21*)
068ac78d
JH
22 case `uname -m` in
23 pmax)
24 # NetBSD 1.3 and 1.3.1 on pmax shipped an `old' ld.so,
25 # which will not work.
26 case "$osvers" in
27 1.3|1.3.1)
28 d_dlopen=$undef
29 ;;
30 esac
31 ;;
32 esac
6195bde2 33 if test -f /usr/libexec/ld.elf_so; then
068ac78d 34 # ELF
099685bc
JH
35 d_dlopen=$define
36 d_dlerror=$define
068ac78d
JH
37 cccdlflags="-DPIC -fPIC $cccdlflags"
38 lddlflags="--whole-archive -shared $lddlflags"
39 rpathflag="-Wl,-rpath,"
e36eebf2
JH
40 case "$osvers" in
41 1.[0-5]*)
42 #
43 # Include the whole libgcc.a into the perl executable
44 # so that certain symbols needed by loadable modules
45 # built as C++ objects (__eh_alloc, __pure_virtual,
46 # etc.) will always be defined.
47 #
48 ccdlflags="-Wl,-whole-archive -lgcc \
49 -Wl,-no-whole-archive -Wl,-E $ccdlflags"
50 ;;
51 *)
52 ccdlflags="-Wl,-E $ccdlflags"
53 ;;
54 esac
6195bde2 55 elif test -f /usr/libexec/ld.so; then
068ac78d 56 # a.out
c9ef717e
MG
57 d_dlopen=$define
58 d_dlerror=$define
c9ef717e 59 cccdlflags="-DPIC -fPIC $cccdlflags"
9f060c84 60 lddlflags="-Bshareable $lddlflags"
068ac78d 61 rpathflag="-R"
099685bc
JH
62 else
63 d_dlopen=$undef
068ac78d 64 rpathflag=
099685bc 65 fi
491527d0
GS
66 ;;
67esac
c9ef717e
MG
68
69# netbsd had these but they don't really work as advertised, in the
70# versions listed below. if they are defined, then there isn't a
71# way to make perl call setuid() or setgid(). if they aren't, then
72# ($<, $>) = ($u, $u); will work (same for $(/$)). this is because
73# you can not change the real userid of a process under 4.4BSD.
099685bc 74# netbsd fixed this in 1.3.2.
229e211d 75case "$osvers" in
099685bc 760.9*|1.[012]*|1.3|1.3.1)
4633a7c4
LW
77 d_setregid="$undef"
78 d_setreuid="$undef"
a0d0e21e
LW
79 ;;
80esac
a22def3b 81case "$osvers" in
7f98bb4e 820.9*|1.*|2.*|3.*|4.*|5.*)
a22def3b
MB
83 d_getprotoent_r="$undef"
84 d_getprotobyname_r="$undef"
85 d_getprotobynumber_r="$undef"
86 d_setprotoent_r="$undef"
87 d_endprotoent_r="$undef"
88 d_getservent_r="$undef"
89 d_getservbyname_r="$undef"
90 d_getservbyport_r="$undef"
91 d_setservent_r="$undef"
92 d_endservent_r="$undef"
84f2efb4
RGS
93 d_getprotoent_r_proto="0"
94 d_getprotobyname_r_proto="0"
95 d_getprotobynumber_r_proto="0"
96 d_setprotoent_r_proto="0"
97 d_endprotoent_r_proto="0"
98 d_getservent_r_proto="0"
99 d_getservbyname_r_proto="0"
100 d_getservbyport_r_proto="0"
101 d_setservent_r_proto="0"
102 d_endservent_r_proto="0"
a22def3b
MB
103 ;;
104esac
c4f23d77 105
434e0566
JH
106# These are obsolete in any netbsd.
107d_setrgid="$undef"
108d_setruid="$undef"
109
099685bc 110# there's no problem with vfork.
900cf02d
JH
111usevfork=true
112
9a368ae6
JH
113# This is there but in machine/ieeefp_h.
114ieeefp_h="define"
115
a22def3b
MB
116# This script UU/usethreads.cbu will get 'called-back' by Configure
117# after it has prompted the user for whether to use threads.
118cat > UU/usethreads.cbu <<'EOCBU'
119case "$usethreads" in
120$define|true|[yY]*)
6195bde2 121 lpthread=
068ac78d
JH
122 for xxx in pthread; do
123 for yyy in $loclibpth $plibpth $glibpth dummy; do
124 zzz=$yyy/lib$xxx.a
125 if test -f "$zzz"; then
126 lpthread=$xxx
6195bde2
JH
127 break;
128 fi
068ac78d
JH
129 zzz=$yyy/lib$xxx.so
130 if test -f "$zzz"; then
131 lpthread=$xxx
6195bde2
JH
132 break;
133 fi
068ac78d
JH
134 zzz=`ls $yyy/lib$xxx.so.* 2>/dev/null`
135 if test "X$zzz" != X; then
136 lpthread=$xxx
6195bde2
JH
137 break;
138 fi
139 done
140 if test "X$lpthread" != X; then
141 break;
142 fi
143 done
144 if test "X$lpthread" != X; then
a22def3b
MB
145 # Add -lpthread.
146 libswanted="$libswanted $lpthread"
6195bde2
JH
147 # There is no libc_r as of NetBSD 1.5.2, so no c -> c_r.
148 # This will be revisited when NetBSD gains a native pthreads
149 # implementation.
a22def3b 150 else
6195bde2 151 echo "$0: No POSIX threads library (-lpthread) found. " \
a22def3b
MB
152 "You may want to install GNU pth. Aborting." >&4
153 exit 1
154 fi
6195bde2 155 unset lpthread
5d0b7876 156
a22def3b
MB
157 # several reentrant functions are embeded in libc, but haven't
158 # been added to the header files yet. Let's hold off on using
159 # them until they are a valid part of the API
160 case "$osvers" in
161 [012].*|3.[0-1])
162 d_getprotobyname_r=$undef
163 d_getprotobynumber_r=$undef
164 d_getprotoent_r=$undef
165 d_getservbyname_r=$undef
166 d_getservbyport_r=$undef
167 d_getservent_r=$undef
168 d_setprotoent_r=$undef
169 d_setservent_r=$undef
170 d_endprotoent_r=$undef
171 d_endservent_r=$undef ;;
172 esac
173 ;;
174
175esac
0b196741 176EOCBU
7b938c21 177
068ac78d
JH
178# Set sensible defaults for NetBSD: look for local software in
179# /usr/pkg (NetBSD Packages Collection) and in /usr/local.
180#
181loclibpth="/usr/pkg/lib /usr/local/lib"
182locincpth="/usr/pkg/include /usr/local/include"
183case "$rpathflag" in
184'')
185 ldflags=
186 ;;
187*)
188 ldflags=
189 for yyy in $loclibpth; do
190 ldflags="$ldflags $rpathflag$yyy"
191 done
192 ;;
193esac
f42e9f90
JH
194
195case `uname -m` in
196alpha)
197 echo 'int main() {}' > try.c
198 gcc=`${cc:-cc} -v -c try.c 2>&1|grep 'gcc version egcs-2'`
199 case "$gcc" in
200 '' | "gcc version egcs-2.95."[3-9]*) ;; # 2.95.3 or better okay
201 *) cat >&4 <<EOF
202***
203*** Your gcc ($gcc) is known to be
204*** too buggy on netbsd/alpha to compile Perl with optimization.
205*** It is suggested you install the lang/gcc package which should
206*** have at least gcc 2.95.3 which should work okay: use for example
207*** Configure -Dcc=/usr/pkg/gcc-2.95.3/bin/cc. You could also
208*** Configure -Doptimize=-O0 to compile Perl without any optimization
209*** but that is not recommended.
210***
211EOF
212 exit 1
213 ;;
214 esac
215 rm -f try.*
216 ;;
217esac
218
3332bd48
JH
219# NetBSD/sparc 1.5.3/1.6.1 dumps core in the semid_ds test of Configure.
220case `uname -m` in
221sparc) d_semctl_semid_ds=undef ;;
222esac
223