Chip noticed that the intended optionality of the 'IV' was
[p5sagit/p5-mst-13.2.git] / hints / netbsd.sh
1 # hints/netbsd.sh
2 #
3 # Please check with packages@netbsd.org before making modifications
4 # to this file.
5
6 case "$archname" in
7 '')
8     archname=`uname -m`-${osname}
9     ;;
10 esac
11
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 #
17 case "$osvers" in
18 0.9|0.8*)
19         usedl="$undef"
20         ;;
21 *)
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
33         if test -f /usr/libexec/ld.elf_so; then
34                 # ELF
35                 d_dlopen=$define
36                 d_dlerror=$define
37                 cccdlflags="-DPIC -fPIC $cccdlflags"
38                 lddlflags="--whole-archive -shared $lddlflags"
39                 rpathflag="-Wl,-rpath,"
40                 #
41                 # Include the whole libgcc.a into the perl executable so
42                 # that certain symbols needed by loadable modules built as
43                 # C++ objects (__eh_alloc, __pure_virtual, etc.) will always
44                 # be defined.
45                 #
46                 # XXX This should be obsoleted by gcc-3.0.
47                 #
48                 ccdlflags="-Wl,-whole-archive -lgcc -Wl,-no-whole-archive \
49                         -Wl,-E $ccdlflags"
50         elif test -f /usr/libexec/ld.so; then
51                 # a.out
52                 d_dlopen=$define
53                 d_dlerror=$define
54                 cccdlflags="-DPIC -fPIC $cccdlflags"
55                 lddlflags="-Bshareable $lddlflags"
56                 rpathflag="-R"
57         else
58                 d_dlopen=$undef
59                 rpathflag=
60         fi
61         ;;
62 esac
63
64 # netbsd had these but they don't really work as advertised, in the
65 # versions listed below.  if they are defined, then there isn't a
66 # way to make perl call setuid() or setgid().  if they aren't, then
67 # ($<, $>) = ($u, $u); will work (same for $(/$)).  this is because
68 # you can not change the real userid of a process under 4.4BSD.
69 # netbsd fixed this in 1.3.2.
70 case "$osvers" in
71 0.9*|1.[012]*|1.3|1.3.1)
72         d_setregid="$undef"
73         d_setreuid="$undef"
74         ;;
75 esac
76
77 # These are obsolete in any netbsd.
78 d_setrgid="$undef"
79 d_setruid="$undef"
80
81 # there's no problem with vfork.
82 usevfork=true
83
84 # This is there but in machine/ieeefp_h.
85 ieeefp_h="define"
86
87 # This script UU/usethreads.cbu will get 'called-back' by Configure 
88 # after it has prompted the user for whether to use threads. 
89 cat > UU/usethreads.cbu <<'EOCBU' 
90 case "$usethreads" in 
91 $define|true|[yY]*) 
92         lpthread=
93         for xxx in pthread; do
94                 for yyy in $loclibpth $plibpth $glibpth dummy; do
95                         zzz=$yyy/lib$xxx.a
96                         if test -f "$zzz"; then
97                                 lpthread=$xxx
98                                 break;
99                         fi
100                         zzz=$yyy/lib$xxx.so
101                         if test -f "$zzz"; then
102                                 lpthread=$xxx
103                                 break;
104                         fi
105                         zzz=`ls $yyy/lib$xxx.so.* 2>/dev/null`
106                         if test "X$zzz" != X; then
107                                 lpthread=$xxx
108                                 break;
109                         fi
110                 done
111                 if test "X$lpthread" != X; then
112                         break;
113                 fi
114         done
115         if test "X$lpthread" != X; then
116                 # Add -lpthread. 
117                 libswanted="$libswanted $lpthread" 
118                 # There is no libc_r as of NetBSD 1.5.2, so no c -> c_r.
119                 # This will be revisited when NetBSD gains a native pthreads
120                 # implementation.
121         else 
122                 echo "$0: No POSIX threads library (-lpthread) found.  " \
123                      "You may want to install GNU pth.  Aborting." >&4 
124                 exit 1 
125         fi
126         unset lpthread
127         ;; 
128 esac 
129 EOCBU
130
131 # Set sensible defaults for NetBSD: look for local software in
132 # /usr/pkg (NetBSD Packages Collection) and in /usr/local.
133 #
134 loclibpth="/usr/pkg/lib /usr/local/lib"
135 locincpth="/usr/pkg/include /usr/local/include"
136 case "$rpathflag" in
137 '')
138         ldflags=
139         ;;
140 *)
141         ldflags=
142         for yyy in $loclibpth; do
143                 ldflags="$ldflags $rpathflag$yyy"
144         done
145         ;;
146 esac
147
148 case `uname -m` in
149 alpha)
150     echo 'int main() {}' > try.c
151     gcc=`${cc:-cc} -v -c try.c 2>&1|grep 'gcc version egcs-2'`
152     case "$gcc" in
153     '' | "gcc version egcs-2.95."[3-9]*) ;; # 2.95.3 or better okay
154     *)  cat >&4 <<EOF
155 ***
156 *** Your gcc ($gcc) is known to be
157 *** too buggy on netbsd/alpha to compile Perl with optimization.
158 *** It is suggested you install the lang/gcc package which should
159 *** have at least gcc 2.95.3 which should work okay: use for example
160 *** Configure -Dcc=/usr/pkg/gcc-2.95.3/bin/cc.  You could also
161 *** Configure -Doptimize=-O0 to compile Perl without any optimization
162 *** but that is not recommended.
163 ***
164 EOF
165         exit 1
166         ;;
167     esac
168     rm -f try.*
169     ;;
170 esac
171