Commit | Line | Data |
---|---|---|
43051805 GS |
1 | # hints/openbsd.sh |
2 | # | |
3 | # hints file for OpenBSD; Todd Miller <millert@openbsd.org> | |
4 | # Edited to allow Configure command-line overrides by | |
1973dd96 | 5 | # Andy Dougherty <doughera@lafayette.edu> |
43051805 | 6 | # |
c347f277 | 7 | # To build with distribution paths, use: |
48827ca2 | 8 | # ./Configure -des -Dopenbsd_distribution=defined |
c347f277 | 9 | # |
43051805 | 10 | |
9b58b542 RGS |
11 | # In OpenBSD > 3.7, use perl's malloc [perl #75742] |
12 | case "$osvers" in | |
13 | 3.[89]*|[4-9]*) | |
14 | test "$usemymalloc" || usemymalloc=y | |
15 | ;; | |
16 | esac | |
43051805 | 17 | |
da0b61dd NC |
18 | # malloc wrap works |
19 | case "$usemallocwrap" in | |
20 | '') usemallocwrap='define' ;; | |
21 | esac | |
22 | ||
35356583 TM |
23 | # Currently, vfork(2) is not a real win over fork(2). |
24 | usevfork="$undef" | |
43051805 | 25 | |
35356583 TM |
26 | # In OpenBSD < 3.3, the setre?[ug]id() are emulated using the |
27 | # _POSIX_SAVED_IDS functionality which does not have the same | |
28 | # semantics as 4.3BSD. Starting with OpenBSD 3.3, the original | |
29 | # semantics have been restored. | |
30 | case "$osvers" in | |
31 | [0-2].*|3.[0-2]) | |
32 | d_setregid=$undef | |
33 | d_setreuid=$undef | |
34 | d_setrgid=$undef | |
35 | d_setruid=$undef | |
36 | esac | |
43051805 GS |
37 | |
38 | # | |
48827ca2 | 39 | # Not all platforms support dynamic loading... |
e9c1fd70 AD |
40 | # For the case of "$openbsd_distribution", the hints file |
41 | # needs to know whether we are using dynamic loading so that | |
42 | # it can set the libperl name appropriately. | |
43 | # Allow command line overrides. | |
43051805 | 44 | # |
5c75dbfa JH |
45 | ARCH=`arch | sed 's/^OpenBSD.//'` |
46 | case "${ARCH}-${osvers}" in | |
35356583 | 47 | alpha-2.[0-8]|mips-2.[0-8]|powerpc-2.[0-7]|m88k-*|hppa-*|vax-*) |
e9c1fd70 | 48 | test -z "$usedl" && usedl=$undef |
43051805 GS |
49 | ;; |
50 | *) | |
e9c1fd70 | 51 | test -z "$usedl" && usedl=$define |
5c75dbfa | 52 | # We use -fPIC here because -fpic is *NOT* enough for some of the |
43051805 GS |
53 | # extensions like Tk on some OpenBSD platforms (ie: sparc) |
54 | cccdlflags="-DPIC -fPIC $cccdlflags" | |
154d43cb JH |
55 | case "$osvers" in |
56 | [01].*|2.[0-7]|2.[0-7].*) | |
57 | lddlflags="-Bshareable $lddlflags" | |
58 | ;; | |
5c75dbfa | 59 | 2.[8-9]|3.0) |
154d43cb | 60 | ld=${cc:-cc} |
eb9cd59d | 61 | lddlflags="-shared -fPIC $lddlflags" |
154d43cb | 62 | ;; |
5c75dbfa JH |
63 | *) # from 3.1 onwards |
64 | ld=${cc:-cc} | |
65 | lddlflags="-shared -fPIC $lddlflags" | |
66 | libswanted=`echo $libswanted | sed 's/ dl / /'` | |
67 | ;; | |
154d43cb | 68 | esac |
29b55857 JH |
69 | |
70 | # We need to force ld to export symbols on ELF platforms. | |
71 | # Without this, dlopen() is crippled. | |
72 | ELF=`${cc:-cc} -dM -E - </dev/null | grep __ELF__` | |
73 | test -n "$ELF" && ldflags="-Wl,-E $ldflags" | |
43051805 GS |
74 | ;; |
75 | esac | |
76 | ||
1528c3db TM |
77 | # |
78 | # Tweaks for various versions of OpenBSD | |
79 | # | |
80 | case "$osvers" in | |
81 | 2.5) | |
82 | # OpenBSD 2.5 has broken odbm support | |
83 | i_dbm=$undef | |
84 | ;; | |
85 | esac | |
86 | ||
43051805 GS |
87 | # OpenBSD doesn't need libcrypt but many folks keep a stub lib |
88 | # around for old NetBSD binaries. | |
89 | libswanted=`echo $libswanted | sed 's/ crypt / /'` | |
90 | ||
43051805 | 91 | # Configure can't figure this out non-interactively |
1528c3db | 92 | d_suidsafe=$define |
43051805 GS |
93 | |
94 | # cc is gcc so we can do better than -O | |
95 | # Allow a command-line override, such as -Doptimize=-g | |
5c75dbfa | 96 | case ${ARCH} in |
1bd427d5 JH |
97 | m88k) |
98 | optimize='-O0' | |
99 | ;; | |
35356583 TM |
100 | hppa) |
101 | optimize='-O0' | |
102 | ;; | |
1bd427d5 JH |
103 | *) |
104 | test "$optimize" || optimize='-O2' | |
105 | ;; | |
106 | esac | |
43051805 | 107 | |
619ffc2b JH |
108 | # This script UU/usethreads.cbu will get 'called-back' by Configure |
109 | # after it has prompted the user for whether to use threads. | |
110 | cat > UU/usethreads.cbu <<'EOCBU' | |
111 | case "$usethreads" in | |
112 | $define|true|[yY]*) | |
113 | # any openbsd version dependencies with pthreads? | |
34163b21 JH |
114 | ccflags="-pthread $ccflags" |
115 | ldflags="-pthread $ldflags" | |
1ac0c030 AT |
116 | case "$osvers" in |
117 | [0-2].*|3.[0-2]) | |
118 | # Change from -lc to -lc_r | |
119 | set `echo "X $libswanted " | sed 's/ c / c_r /'` | |
120 | shift | |
121 | libswanted="$*" | |
122 | ;; | |
123 | esac | |
36e43f01 | 124 | case "$osvers" in |
d767353b SP |
125 | [012].*|3.[0-6]) |
126 | # Broken at least up to OpenBSD 3.6, we'll see about 3.7 | |
36e43f01 JH |
127 | d_getservbyname_r=$undef ;; |
128 | esac | |
619ffc2b JH |
129 | esac |
130 | EOCBU | |
131 | ||
cde16453 MHM |
132 | # This script UU/use64bitint.cbu will get 'called-back' by Configure |
133 | # after it has prompted the user for whether to use 64-bitness. | |
134 | cat > UU/use64bitint.cbu <<'EOCBU' | |
135 | case "$use64bitint" in | |
136 | $define|true|[yY]*) | |
137 | echo " " | |
138 | echo "Checking if your C library has broken 64-bit functions..." >&4 | |
139 | $cat >check.c <<EOCP | |
140 | #include <stdio.h> | |
013ad2b3 | 141 | typedef $uquadtype myULL; |
cde16453 MHM |
142 | int main (void) |
143 | { | |
144 | struct { | |
145 | double d; | |
146 | myULL u; | |
147 | } *p, test[] = { | |
148 | {4294967303.15, 4294967303ULL}, | |
149 | {4294967294.2, 4294967294ULL}, | |
150 | {4294967295.7, 4294967295ULL}, | |
151 | {0.0, 0ULL} | |
152 | }; | |
153 | for (p = test; p->u; p++) { | |
154 | myULL x = (myULL)p->d; | |
155 | if (x != p->u) { | |
156 | printf("buggy\n"); | |
157 | return 0; | |
158 | } | |
159 | } | |
160 | printf("ok\n"); | |
161 | return 0; | |
162 | } | |
163 | EOCP | |
164 | set check | |
165 | if eval $compile_ok; then | |
166 | libcquad=`./check` | |
167 | echo "Your C library's 64-bit functions are $libcquad." | |
168 | else | |
169 | echo "(I can't seem to compile the test program.)" | |
170 | echo "Assuming that your C library's 64-bit functions are ok." | |
171 | libcquad="ok" | |
172 | fi | |
173 | $rm -f check.c check | |
174 | ||
175 | case "$libcquad" in | |
176 | buggy*) | |
177 | cat >&4 <<EOM | |
178 | ||
179 | *** You have a C library with broken 64-bit functions. | |
180 | *** 64-bit support does not work reliably in this configuration. | |
013ad2b3 | 181 | *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits. |
cde16453 | 182 | *** Cannot continue, aborting. |
013ad2b3 | 183 | |
cde16453 MHM |
184 | EOM |
185 | exit 1 | |
186 | ;; | |
187 | esac | |
188 | esac | |
189 | EOCBU | |
190 | ||
c347f277 TM |
191 | # When building in the OpenBSD tree we use different paths |
192 | # This is only part of the story, the rest comes from config.over | |
193 | case "$openbsd_distribution" in | |
48827ca2 | 194 | ''|$undef|false) ;; |
c347f277 TM |
195 | *) |
196 | # We put things in /usr, not /usr/local | |
197 | prefix='/usr' | |
198 | prefixexp='/usr' | |
199 | sysman='/usr/share/man/man1' | |
c347f277 | 200 | libpth='/usr/lib' |
48827ca2 | 201 | glibpth='/usr/lib' |
eb9cd59d TM |
202 | # Local things, however, do go in /usr/local |
203 | siteprefix='/usr/local' | |
204 | siteprefixexp='/usr/local' | |
48827ca2 GS |
205 | # Ports installs non-std libs in /usr/local/lib so look there too |
206 | locincpth='/usr/local/include' | |
207 | loclibpth='/usr/local/lib' | |
208 | # Link perl with shared libperl | |
209 | if [ "$usedl" = "$define" -a -r shlib_version ]; then | |
210 | useshrplib=true | |
211 | libperl=`. ./shlib_version; echo libperl.so.${major}.${minor}` | |
212 | fi | |
c347f277 TM |
213 | ;; |
214 | esac | |
215 | ||
43051805 | 216 | # end |