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