| 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 | 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 |
| 55 | elif test -f /usr/libexec/ld.so; then |
| 56 | # a.out |
| 57 | d_dlopen=$define |
| 58 | d_dlerror=$define |
| 59 | cccdlflags="-DPIC -fPIC $cccdlflags" |
| 60 | lddlflags="-Bshareable $lddlflags" |
| 61 | rpathflag="-R" |
| 62 | else |
| 63 | d_dlopen=$undef |
| 64 | rpathflag= |
| 65 | fi |
| 66 | ;; |
| 67 | esac |
| 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. |
| 74 | # netbsd fixed this in 1.3.2. |
| 75 | case "$osvers" in |
| 76 | 0.9*|1.[012]*|1.3|1.3.1) |
| 77 | d_setregid="$undef" |
| 78 | d_setreuid="$undef" |
| 79 | ;; |
| 80 | esac |
| 81 | |
| 82 | # These are obsolete in any netbsd. |
| 83 | d_setrgid="$undef" |
| 84 | d_setruid="$undef" |
| 85 | |
| 86 | # there's no problem with vfork. |
| 87 | usevfork=true |
| 88 | |
| 89 | # This is there but in machine/ieeefp_h. |
| 90 | ieeefp_h="define" |
| 91 | |
| 92 | # This script UU/usethreads.cbu will get 'called-back' by Configure |
| 93 | # after it has prompted the user for whether to use threads. |
| 94 | cat > UU/usethreads.cbu <<'EOCBU' |
| 95 | case "$usethreads" in |
| 96 | $define|true|[yY]*) |
| 97 | lpthread= |
| 98 | for xxx in pthread; do |
| 99 | for yyy in $loclibpth $plibpth $glibpth dummy; do |
| 100 | zzz=$yyy/lib$xxx.a |
| 101 | if test -f "$zzz"; then |
| 102 | lpthread=$xxx |
| 103 | break; |
| 104 | fi |
| 105 | zzz=$yyy/lib$xxx.so |
| 106 | if test -f "$zzz"; then |
| 107 | lpthread=$xxx |
| 108 | break; |
| 109 | fi |
| 110 | zzz=`ls $yyy/lib$xxx.so.* 2>/dev/null` |
| 111 | if test "X$zzz" != X; then |
| 112 | lpthread=$xxx |
| 113 | break; |
| 114 | fi |
| 115 | done |
| 116 | if test "X$lpthread" != X; then |
| 117 | break; |
| 118 | fi |
| 119 | done |
| 120 | if test "X$lpthread" != X; then |
| 121 | # Add -lpthread. |
| 122 | libswanted="$libswanted $lpthread" |
| 123 | # There is no libc_r as of NetBSD 1.5.2, so no c -> c_r. |
| 124 | # This will be revisited when NetBSD gains a native pthreads |
| 125 | # implementation. |
| 126 | else |
| 127 | echo "$0: No POSIX threads library (-lpthread) found. " \ |
| 128 | "You may want to install GNU pth. Aborting." >&4 |
| 129 | exit 1 |
| 130 | fi |
| 131 | unset lpthread |
| 132 | ;; |
| 133 | esac |
| 134 | EOCBU |
| 135 | |
| 136 | # Set sensible defaults for NetBSD: look for local software in |
| 137 | # /usr/pkg (NetBSD Packages Collection) and in /usr/local. |
| 138 | # |
| 139 | loclibpth="/usr/pkg/lib /usr/local/lib" |
| 140 | locincpth="/usr/pkg/include /usr/local/include" |
| 141 | case "$rpathflag" in |
| 142 | '') |
| 143 | ldflags= |
| 144 | ;; |
| 145 | *) |
| 146 | ldflags= |
| 147 | for yyy in $loclibpth; do |
| 148 | ldflags="$ldflags $rpathflag$yyy" |
| 149 | done |
| 150 | ;; |
| 151 | esac |
| 152 | |
| 153 | case `uname -m` in |
| 154 | alpha) |
| 155 | echo 'int main() {}' > try.c |
| 156 | gcc=`${cc:-cc} -v -c try.c 2>&1|grep 'gcc version egcs-2'` |
| 157 | case "$gcc" in |
| 158 | '' | "gcc version egcs-2.95."[3-9]*) ;; # 2.95.3 or better okay |
| 159 | *) cat >&4 <<EOF |
| 160 | *** |
| 161 | *** Your gcc ($gcc) is known to be |
| 162 | *** too buggy on netbsd/alpha to compile Perl with optimization. |
| 163 | *** It is suggested you install the lang/gcc package which should |
| 164 | *** have at least gcc 2.95.3 which should work okay: use for example |
| 165 | *** Configure -Dcc=/usr/pkg/gcc-2.95.3/bin/cc. You could also |
| 166 | *** Configure -Doptimize=-O0 to compile Perl without any optimization |
| 167 | *** but that is not recommended. |
| 168 | *** |
| 169 | EOF |
| 170 | exit 1 |
| 171 | ;; |
| 172 | esac |
| 173 | rm -f try.* |
| 174 | ;; |
| 175 | esac |
| 176 | |
| 177 | # NetBSD/sparc 1.5.3/1.6.1 dumps core in the semid_ds test of Configure. |
| 178 | case `uname -m` in |
| 179 | sparc) d_semctl_semid_ds=undef ;; |
| 180 | esac |
| 181 | |