Commit | Line | Data |
---|---|---|
85f483a2 | 1 | # hints/irix_6.sh |
e8c10df3 SH |
2 | # |
3 | # original from Krishna Sethuraman, krishna@sgi.com | |
4 | # | |
ba51d756 | 5 | # Modified Mon Jul 22 14:52:25 EDT 1996 |
1973dd96 | 6 | # Andy Dougherty <doughera@lafayette.edu> |
e8c10df3 SH |
7 | # with help from Dean Roehrich <roehrich@cray.com>. |
8 | # cc -n32 update info from Krishna Sethuraman, krishna@sgi.com. | |
9 | # additional update from Scott Henry, scotth@sgi.com | |
f4cb4c40 | 10 | |
ba51d756 CS |
11 | # Futzed with by John Stoffel <jfs@fluent.com> on 4/24/1997 |
12 | # - assumes 'cc -n32' by default | |
13 | # - tries to check for various compiler versions and do the right | |
14 | # thing when it can | |
15 | # - warnings turned off (-n32 messages): | |
b238e826 JH |
16 | # 1184 - "=" is used where where "==" may have been intended |
17 | # 1552 - variable "foo" set but never used | |
ba51d756 CS |
18 | |
19 | # Tweaked by Chip Salzenberg <chip@perl.com> on 5/13/97 | |
20 | # - don't assume 'cc -n32' if the n32 libm.so is missing | |
85f483a2 | 21 | |
eb1cfdd6 MB |
22 | # Threaded by Jarkko Hietaniemi <jhi@iki.fi> on 11/18/97 |
23 | # - POSIX threads knowledge by IRIX version | |
24 | ||
37c4c505 KS |
25 | # gcc-enabled by Kurt Starsinic <kstar@isinet.com> on 3/24/1998 |
26 | ||
5ff3f7a4 GS |
27 | # 64-bitty by Jarkko Hietaniemi on 9/1998 |
28 | ||
2c549067 MP |
29 | # Martin Pool added -shared for gcc on 2004-01-27 |
30 | ||
e8c10df3 SH |
31 | # Use sh Configure -Dcc='cc -n32' to try compiling with -n32. |
32 | # or -Dcc='cc -n32 -mips3' (or -mips4) to force (non)portability | |
33 | # Don't bother with -n32 unless you have the 7.1 or later compilers. | |
34 | # But there's no quick and light-weight way to check in 6.2. | |
f4cb4c40 | 35 | |
1381c0fe JH |
36 | # NOTE: some IRIX cc versions, e.g. 7.3.1.1m (try cc -version) have |
37 | # been known to have issues (coredumps) when compiling perl.c. | |
38 | # If you've used -OPT:fast_io=ON and this happens, try removing it. | |
39 | # If that fails, or you didn't use that, then try adjusting other | |
40 | # optimization options (-LNO, -INLINE, -O3 to -O2, etcetera). | |
41 | # The compiler bug has been reported to SGI. | |
20f6aaab | 42 | # -- Allen Smith <allens@cpan.org> |
44e4f4cc | 43 | |
6d240721 JH |
44 | case "$use64bitall" in |
45 | $define|true|[yY]*) | |
46 | case "`uname -s`" in | |
47 | IRIX) | |
48 | cat <<END >&2 | |
49 | You have asked for use64bitall but you aren't running on 64-bit IRIX. | |
50 | I'll try changing it to use64bitint. | |
51 | END | |
52 | use64bitall="$undef" | |
53 | ||
54 | case "`uname -r`" in | |
55 | [1-5]*|6.[01]) | |
56 | cat <<END >&2 | |
57 | Sorry, can't do use64bitint either. Try upgrading to IRIX 6.2 or later. | |
58 | END | |
59 | use64bitint="$undef" | |
60 | ;; | |
61 | *) use64bitint="$define" | |
62 | ;; | |
63 | esac | |
64 | ;; | |
65 | esac | |
66 | ;; | |
67 | esac | |
68 | ||
69 | # Until we figure out what to be probed for in Configure (ditto for hpux.sh) | |
70 | case "$usemorebits" in # Need to expand this now, then. | |
71 | $define|true|[yY]*) | |
72 | case "`uname -r`" in | |
73 | [1-5]*|6.[01]) | |
74 | uselongdouble="$define" | |
75 | ;; | |
76 | *) use64bitint="$define" uselongdouble="$define" ;; | |
77 | esac | |
78 | esac | |
79 | ||
ba51d756 CS |
80 | # Let's assume we want to use 'cc -n32' by default, unless the |
81 | # necessary libm is missing (which has happened at least twice) | |
85f483a2 | 82 | case "$cc" in |
a3489f11 JH |
83 | '') case "$use64bitall" in |
84 | "$define"|true|[yY]*) test -f /usr/lib64/libm.so && cc='cc -64' ;; | |
85 | *) test -f /usr/lib32/libm.so && cc='cc -n32' ;; | |
86 | esac | |
87 | esac | |
6b356c8e | 88 | |
6d240721 JH |
89 | case "$use64bitint" in |
90 | "$define"|true|[yY]*) ;; | |
91 | *) d_casti32="$undef" ;; | |
92 | esac | |
93 | ||
5e4c82f0 | 94 | cc=${cc:-cc} |
20f6aaab | 95 | cat=${cat:-cat} |
a3489f11 | 96 | |
20f6aaab | 97 | $cat > UU/cc.cbu <<'EOCCBU' |
6d240721 JH |
98 | # This script UU/cc.cbu will get 'called-back' by Configure after it |
99 | # has prompted the user for the C compiler to use. | |
100 | ||
6b356c8e JH |
101 | case "$cc" in |
102 | *gcc*) ;; | |
220a9130 | 103 | *) ccversion=`cc -version 2>&1` ;; |
6b356c8e JH |
104 | esac |
105 | ||
85f483a2 SH |
106 | # Check for which compiler we're using |
107 | ||
e8c10df3 SH |
108 | case "$cc" in |
109 | *"cc -n32"*) | |
6d240721 | 110 | test -z "$ldlibpthname" && ldlibpthname='LD_LIBRARYN32_PATH' |
85f483a2 | 111 | |
f1edc4d6 GS |
112 | # If a library is requested to link against, make sure the |
113 | # objects in the library are of the same ABI we are compiling | |
114 | # against. Albert Chin-A-Young <china@thewrittenword.com> | |
6d240721 JH |
115 | |
116 | # In other words, you no longer have to worry regarding having old | |
117 | # library paths (/usr/lib) in the searchpath for -n32 or -64; thank | |
118 | # you very much, Albert! Now if we could just get more module authors | |
119 | # to use something like this... - Allen | |
120 | ||
f1edc4d6 | 121 | libscheck='case "$xxx" in |
eade9b71 | 122 | *.a) /bin/ar p $xxx `/bin/ar t $xxx | sed q` >$$.o; |
f1edc4d6 GS |
123 | case "`/usr/bin/file $$.o`" in |
124 | *N32*) rm -f $$.o ;; | |
125 | *) rm -f $$.o; xxx=/no/n32$xxx ;; | |
126 | esac ;; | |
127 | *) case "`/usr/bin/file $xxx`" in | |
128 | *N32*) ;; | |
129 | *) xxx=/no/n32$xxx ;; | |
130 | esac ;; | |
6e553f51 JH |
131 | esac' |
132 | ||
a3489f11 | 133 | # NOTE: -L/usr/lib32 -L/lib32 are automatically selected by the linker |
6d240721 | 134 | test -z "$ldflags" && ldflags=' -L/usr/local/lib32 -L/usr/local/lib' |
a3489f11 JH |
135 | cccdlflags=' ' |
136 | # From: David Billinghurst <David.Billinghurst@riotinto.com.au> | |
137 | # If you get complaints about so_locations then change the following | |
138 | # line to something like: | |
139 | # lddlflags="-n32 -shared -check_registry /usr/lib32/so_locations" | |
6d240721 JH |
140 | test -z "$lddlflags" && lddlflags="-n32 -shared" |
141 | test -z "$libc" && libc='/usr/lib32/libc.so' | |
142 | test -z "$plibpth" && plibpth='/usr/lib32 /lib32 /usr/ccs/lib' | |
a3489f11 | 143 | ;; |
f737ff5c | 144 | *"cc -64"*) |
6d240721 JH |
145 | case "`uname -s`" in |
146 | IRIX) | |
20f6aaab | 147 | $cat >&4 <<EOM |
6d240721 JH |
148 | You cannot use cc -64 or -Duse64bitall in 32-bit IRIX, sorry. |
149 | Cannot continue, aborting. | |
150 | EOM | |
151 | exit 1 | |
152 | ;; | |
153 | esac | |
154 | test -z "$ldlibpthname" && ldlibpthname='LD_LIBRARY64_PATH' | |
155 | test -z "$use64bitall" && use64bitall="$define" | |
156 | test -z "$use64bitint" && use64bitint="$define" | |
a3489f11 JH |
157 | loclibpth="$loclibpth /usr/lib64" |
158 | libscheck='case "`/usr/bin/file $xxx`" in | |
159 | *64-bit*) ;; | |
160 | *) xxx=/no/64-bit$xxx ;; | |
161 | esac' | |
162 | # NOTE: -L/usr/lib64 -L/lib64 are automatically selected by the linker | |
6d240721 | 163 | test -z "$ldflags" && ldflags=' -L/usr/local/lib64 -L/usr/local/lib' |
a3489f11 | 164 | cccdlflags=' ' |
6d240721 | 165 | test -z "$archname64" && archname64='64all' |
a3489f11 JH |
166 | # From: David Billinghurst <David.Billinghurst@riotinto.com.au> |
167 | # If you get complaints about so_locations then change the following | |
168 | # line to something like: | |
169 | # lddlflags="-64 -shared -check_registry /usr/lib64/so_locations" | |
6d240721 JH |
170 | test -z lddlflags="-64 -shared" |
171 | test -z "$libc" && libc='/usr/lib64/libc.so' | |
172 | test -z "$plibpth" && plibpth='/usr/lib64 /lib64 /usr/ccs/lib' | |
a3489f11 JH |
173 | ;; |
174 | *gcc*) | |
3a2263fe | 175 | ccflags="$ccflags -D_BSD_TYPES -D_BSD_TIME" |
6d240721 | 176 | test -z "$optimize" && optimize="-O3" |
a3489f11 | 177 | usenm='undef' |
2c549067 MP |
178 | # It seems gcc can build Irix shlibs, but of course it needs |
179 | # -shared. Otherwise you get link errors looking for main(). | |
180 | lddlflags="$lddlflags -shared" | |
a3489f11 JH |
181 | case "`uname -s`" in |
182 | # Without the -mabi=64 gcc in 64-bit IRIX has problems passing | |
183 | # and returning small structures. This affects inet_*() and semctl(). | |
184 | # See http://reality.sgi.com/ariel/freeware/gcc-2.8.1-notes.html | |
185 | # for more information. Reported by Lionel Cons <lionel.cons@cern.ch>. | |
186 | IRIX64) ccflags="$ccflags -mabi=64" | |
187 | ldflags="$ldflags -mabi=64 -L/usr/lib64" | |
188 | lddlflags="$lddlflags -mabi=64" | |
189 | ;; | |
190 | *) ccflags="$ccflags -DIRIX32_SEMUN_BROKEN_BY_GCC" | |
191 | ;; | |
192 | esac | |
193 | ;; | |
194 | *) | |
195 | # this is needed to force the old-32 paths | |
196 | # since the system default can be changed. | |
197 | ccflags="$ccflags -32 -D_BSD_TYPES -D_BSD_TIME -Olimit 3100" | |
198 | optimize='-O' | |
199 | ;; | |
200 | esac | |
201 | ||
202 | # Settings common to both native compiler modes. | |
203 | case "$cc" in | |
f737ff5c | 204 | *"cc -n32"*|*"cc -64"*) |
6d240721 | 205 | test -z "$ld" && ld=$cc |
a3489f11 JH |
206 | |
207 | # perl's malloc can return improperly aligned buffer | |
5ec73030 JH |
208 | # which (under 5.6.0RC1) leads into really bizarre bus errors |
209 | # and freak test failures (lib/safe1 #18, for example), | |
210 | # even more so with -Duse64bitall: for example lib/io_linenumtb. | |
211 | # fails under the harness but succeeds when run separately, | |
212 | # under make test pragma/warnings #98 fails, and lib/io_dir | |
213 | # apparently coredumps (the last two don't happen under | |
214 | # the harness. Helmut Jarausch is seeing bus errors from | |
215 | # miniperl, as was Scott Henry with snapshots from just before | |
216 | # the RC1. --jhi | |
217 | usemymalloc='undef' | |
a3489f11 | 218 | |
6d240721 JH |
219 | # Was at the first of the line - Allen |
220 | #malloc_cflags='ccflags="-DSTRICT_ALIGNMENT $ccflags"' | |
221 | ||
222 | nm_opt="$nm_opt -p" | |
223 | nm_so_opt="$nm_so_opt -p" | |
a3489f11 | 224 | |
1f3e59ba JH |
225 | # Warnings to turn off because the source code hasn't |
226 | # been cleaned up enough yet to satisfy the IRIX cc. | |
227 | # 1184: "=" is used where where "==" may have been intended. | |
228 | # 1552: The variable "foobar" is set but never used. | |
229 | woff=1184,1552 | |
230 | ||
29c7c2ae SH |
231 | # Perl 5.004_57 introduced new qsort code into pp_ctl.c that |
232 | # makes IRIX cc prior to 7.2.1 to emit bad code. | |
233 | # so some serious hackery follows to set pp_ctl flags correctly. | |
234 | ||
85f483a2 SH |
235 | # Check for which version of the compiler we're running |
236 | case "`$cc -version 2>&1`" in | |
237 | *7.0*) # Mongoose 7.0 | |
1f3e59ba | 238 | ccflags="$ccflags -D_BSD_TYPES -D_BSD_TIME -woff $woff -OPT:Olimit=0" |
589615b8 | 239 | optimize='none' |
85f483a2 | 240 | ;; |
cd25c765 | 241 | *7.1*|*7.2|*7.20) # Mongoose 7.1+ |
6d240721 JH |
242 | ccflags="$ccflags -D_BSD_TYPES -D_BSD_TIME -woff $woff" |
243 | case "$optimize" in | |
244 | '') optimize='-O3 -OPT:Olimit=0' ;; | |
245 | '-O') optimize='-O3 -OPT:Olimit=0' ;; | |
246 | *) ;; | |
247 | esac | |
248 | ||
249 | # This is a temporary fix for 5.005+. | |
250 | # See hints/README.hints, especially the section | |
251 | # =head2 Propagating variables to config.sh | |
252 | ||
253 | # Note the part about case statements not working without | |
254 | # weirdness like the below echo statement... and, since | |
255 | # we're in a callback unit, it's to config.sh, not UU/config.sh | |
256 | # - Allen | |
257 | ||
258 | ||
259 | pp_ctl_cflags="$pp_ctl_flags optimize=\"$optimize -O1\"" | |
260 | echo "pp_ctl_cflags=\"$pp_ctl_flags optimize=\\\"\$optimize -O1\\\"\"" >> config.sh | |
29c7c2ae | 261 | ;; |
6d240721 JH |
262 | |
263 | ||
264 | ||
20f6aaab | 265 | # XXX What is space=ON doing in here? Could someone ask Scott Henry? - Allen |
6d240721 | 266 | |
29c7c2ae | 267 | *7.*) # Mongoose 7.2.1+ |
6d240721 JH |
268 | ccflags="$ccflags -D_BSD_TYPES -D_BSD_TIME -woff $woff" |
269 | case "$optimize" in | |
270 | '') optimize='-O3 -OPT:Olimit=0:space=ON' ;; | |
271 | '-O') optimize='-O3 -OPT:Olimit=0:space=ON' ;; | |
272 | *) ;; | |
273 | esac | |
85f483a2 SH |
274 | ;; |
275 | *6.2*) # Ragnarok 6.2 | |
1f3e59ba | 276 | ccflags="$ccflags -D_BSD_TYPES -D_BSD_TIME -woff $woff" |
589615b8 | 277 | optimize='none' |
85f483a2 SH |
278 | ;; |
279 | *) # Be safe and not optimize | |
20f6aaab | 280 | ccflags="$ccflags -D_BSD_TYPES -D_BSD_TIME -woff $woff" |
85f483a2 SH |
281 | optimize='none' |
282 | ;; | |
283 | esac | |
284 | ||
9ea370a7 KS |
285 | # this is to accommodate the 'modules' capability of the |
286 | # 7.2 MIPSPro compilers, which allows for the compilers to be installed | |
287 | # in a nondefault location. Almost everything works as expected, but | |
288 | # /usr/include isn't caught properly. Hence see the /usr/include/pthread.h | |
289 | # change below to include TOOLROOT (a modules environment variable), | |
290 | # and the following code. Additional | |
291 | # code to accommodate the 'modules' environment should probably be added | |
292 | # here if possible, or be inserted as a ${TOOLROOT} reference before | |
293 | # absolute paths (again, see the pthread.h change below). | |
294 | # -- krishna@sgi.com, 8/23/98 | |
295 | ||
a3489f11 JH |
296 | if [ "X${TOOLROOT}" != "X" ]; then |
297 | # we cant set cppflags because it gets overwritten | |
298 | # we dont actually need $TOOLROOT/usr/include on the cc line cuz the | |
299 | # modules functionality already includes it but | |
300 | # XXX - how do I change cppflags in the hints file? | |
301 | ccflags="$ccflags -I${TOOLROOT}/usr/include" | |
9ea370a7 | 302 | usrinc="${TOOLROOT}/usr/include" |
a3489f11 | 303 | fi |
9ea370a7 | 304 | |
e8c10df3 SH |
305 | ;; |
306 | esac | |
c43fed53 | 307 | |
1381c0fe | 308 | # workaround for an optimizer bug |
6d240721 JH |
309 | # Made to work via UU/config.sh thing (or, rather, config.sh, since we're in |
310 | # a callback) from README.hints, plus further stuff; doesn't handle -g still, | |
311 | # unfortunately - Allen | |
ea437474 | 312 | case "`$cc -version 2>&1`" in |
6d240721 JH |
313 | *7.2.*) |
314 | test -z "$op_cflags" && echo "op_cflags=\"optimize=\\\"\$optimize -O1\\\"\"" >> config.sh | |
315 | test -z "$op_cflags" && op_cflags="optimize=\"\$optimize -O1\"" | |
316 | test -z "$opmini_cflags" && echo "opmini_cflags=\"optimize=\\\"\$optimize -O1\\\"\"" >> config.sh | |
317 | test -z "$opmini_cflags" && opmini_cflags="optimize=\"\$optimize -O1\"" | |
318 | ;; | |
319 | *7.3.1.*) | |
320 | test -z "$op_cflags" && echo "op_cflags=\"optimize=\\\"\$optimize -O2\\\"\"" >> config.sh | |
321 | test -z "$op_cflags" && op_cflags="$op_cflags optimize=\"\$optimize -O2\"" | |
322 | test -z "$opmini_cflags" && echo "opmini_cflags=\"optimize=\\\"\$optimize -O2\\\"\"" >> config.sh | |
323 | test -z "$opmini_cflags" && opmini_cflags="optimize=\"\$optimize -O2\"" | |
324 | ;; | |
ea6ddde2 JH |
325 | esac |
326 | ||
6d240721 JH |
327 | EOCCBU |
328 | ||
329 | # End of cc.cbu callback unit. - Allen | |
330 | ||
f5a8bab6 GS |
331 | # We don't want these libraries. |
332 | # Socket networking is in libc, these are not installed by default, | |
333 | # and just slow perl down. (scotth@sgi.com) | |
53df3d8c JH |
334 | # librt contains nothing we need (some places need it for Time::HiRes) --jhi |
335 | set `echo X "$libswanted "|sed -e 's/ socket / /' -e 's/ nsl / /' -e 's/ dl / /' -e 's/ rt / /'` | |
f4cb4c40 AD |
336 | shift |
337 | libswanted="$*" | |
e8c10df3 SH |
338 | |
339 | # I have conflicting reports about the sun, crypt, bsd, and PW | |
340 | # libraries on Irix 6.2. | |
341 | # | |
20f6aaab | 342 | # One user reports: |
e8c10df3 SH |
343 | # Don't need sun crypt bsd PW under 6.2. You *may* need to link |
344 | # with these if you want to run perl built under 6.2 on a 5.3 machine | |
345 | # (I haven't checked) | |
ecfc5424 | 346 | # |
e8c10df3 SH |
347 | # Another user reported that if he included those libraries, a large number |
348 | # of the tests failed (approx. 20-25) and he would get a core dump. To | |
349 | # make things worse, test results were inconsistent, i.e., some of the | |
350 | # tests would pass some times and fail at other times. | |
351 | # The safest thing to do seems to be to eliminate them. | |
352 | # | |
353 | # Actually, the only libs that you want are '-lm'. Everything else | |
354 | # you need is in libc. You do also need '-lbsd' if you choose not | |
355 | # to use the -D_BSD_* defines. Note that as of 6.2 the only | |
356 | # difference between '-lmalloc' and '-lc' malloc is the debugging | |
f5a8bab6 | 357 | # and control calls, which aren't used by perl. -- scotth@sgi.com |
f4cb4c40 | 358 | |
f5a8bab6 | 359 | set `echo X "$libswanted "|sed -e 's/ sun / /' -e 's/ crypt / /' -e 's/ bsd / /' -e 's/ PW / /' -e 's/ malloc / /'` |
e8c10df3 SH |
360 | shift |
361 | libswanted="$*" | |
eb1cfdd6 | 362 | |
6d240721 JH |
363 | # libbind.{so|a} would be from a BIND/named installation - IRIX 6.5.* has |
364 | # pretty much everything that would be useful in libbind in libc, including | |
365 | # accessing a local caching server (nsd) that will also look in /etc/hosts, | |
366 | # NIS (yuck!), etcetera. libbind also doesn't have the _r (thread-safe | |
367 | # reentrant) functions. | |
368 | # - Allen <easmith@beatrice.rutgers.edu> | |
369 | ||
370 | case "`uname -r`" in | |
371 | 6.5) | |
372 | set `echo X "$libswanted "|sed -e 's/ bind / /'` | |
373 | shift | |
374 | libswanted="$*" | |
375 | ;; | |
376 | esac | |
377 | ||
378 | # Don't groan about unused libraries. | |
379 | case "$ldflags" in | |
380 | *-Wl,-woff,84*) ;; | |
381 | *) ldflags="$ldflags -Wl,-woff,84" ;; | |
382 | esac | |
383 | ||
384 | # Irix 6.5.6 seems to have a broken header <sys/mode.h> | |
385 | # don't include that (it doesn't contain S_IFMT, S_IFREG, et al) | |
386 | ||
387 | i_sysmode="$undef" | |
388 | ||
20f6aaab | 389 | $cat > UU/usethreads.cbu <<'EOCBU' |
104d25b7 JH |
390 | # This script UU/usethreads.cbu will get 'called-back' by Configure |
391 | # after it has prompted the user for whether to use threads. | |
104d25b7 JH |
392 | case "$usethreads" in |
393 | $define|true|[yY]*) | |
394 | if test ! -f ${TOOLROOT}/usr/include/pthread.h -o ! -f /usr/lib/libpthread.so; then | |
395 | case "`uname -r`" in | |
396 | [1-5].*|6.[01]) | |
397 | cat >&4 <<EOM | |
398 | IRIX `uname -r` does not support POSIX threads. | |
399 | You should upgrade to at least IRIX 6.2 with pthread patches. | |
400 | EOM | |
401 | ;; | |
402 | 6.2) | |
403 | cat >&4 <<EOM | |
404 | IRIX 6.2 can have the POSIX threads. | |
7162771d | 405 | However, the following IRIX patches (or their replacements) MUST be installed: |
104d25b7 JH |
406 | 1404 Irix 6.2 Posix 1003.1b man pages |
407 | 1645 IRIX 6.2 & 6.3 POSIX header file updates | |
408 | 2000 Irix 6.2 Posix 1003.1b support modules | |
409 | 2254 Pthread library fixes | |
410 | 2401 6.2 all platform kernel rollup | |
411 | IMPORTANT: | |
412 | Without patch 2401, a kernel bug in IRIX 6.2 will | |
413 | cause your machine to panic and crash when running | |
414 | threaded perl. IRIX 6.3 and up should be OK. | |
415 | EOM | |
416 | ;; | |
417 | [67].*) | |
418 | cat >&4 <<EOM | |
419 | IRIX `uname -r` should have the POSIX threads. | |
420 | But, somehow, you do not seem to have them installed. | |
421 | EOM | |
422 | ;; | |
423 | esac | |
424 | cat >&4 <<EOM | |
425 | Cannot continue, aborting. | |
426 | EOM | |
427 | exit 1 | |
428 | fi | |
429 | set `echo X "$libswanted "| sed -e 's/ c / pthread /'` | |
104d25b7 JH |
430 | shift |
431 | libswanted="$*" | |
432 | ||
433 | usemymalloc='n' | |
5ad89fa3 JH |
434 | |
435 | # These are hidden behind a _POSIX1C ifdef that would | |
436 | # require including <pthread.h> for the Configure hasproto | |
437 | # to see these. | |
6d240721 JH |
438 | |
439 | # d_asctime_r_proto="$define" | |
440 | # d_ctime_r_proto="$define" | |
441 | # d_gmtime_r_proto="$define" | |
442 | # d_localtime_r_proto="$define" | |
443 | ||
444 | # Safer just to go ahead and include it, for other ifdefs like them | |
445 | # (there are a lot, such as in netdb.h). - Allen | |
446 | ccflags="$ccflags -DPTHREAD_H_FIRST" | |
447 | ||
448 | pthread_h_first="$define" | |
449 | echo "pthread_h_first='define'" >> config.sh | |
450 | ||
104d25b7 | 451 | ;; |
6d240721 | 452 | |
104d25b7 JH |
453 | esac |
454 | EOCBU | |
455 | ||
6b8eaf93 JH |
456 | # The -n32 makes off_t to be 8 bytes, so we should have largefileness. |
457 | ||
20f6aaab | 458 | $cat > UU/use64bitint.cbu <<'EOCBU' |
6d240721 JH |
459 | # This script UU/use64bitint.cbu will get 'called-back' by Configure |
460 | # after it has prompted the user for whether to use 64 bit integers. | |
461 | ||
db3030c0 | 462 | case "$use64bitint" in |
6d240721 JH |
463 | $define|true|[yY]*) |
464 | case "`uname -r`" in | |
465 | [1-5]*|6.[01]) | |
466 | cat >&4 <<EOM | |
467 | IRIX `uname -r` does not support 64-bit types. | |
468 | You should upgrade to at least IRIX 6.2. | |
469 | Cannot continue, aborting. | |
470 | EOM | |
471 | exit 1 | |
472 | ;; | |
473 | esac | |
474 | usemymalloc="$undef" | |
475 | ;; | |
476 | *) d_casti32="$undef" ;; | |
db3030c0 | 477 | esac |
afd0dee8 | 478 | |
6d240721 JH |
479 | EOCBU |
480 | ||
20f6aaab | 481 | $cat > UU/use64bitall.cbu <<'EOCBU' |
6d240721 JH |
482 | # This script UU/use64bitall.cbu will get 'called-back' by Configure |
483 | # after it has prompted the user for whether to be maximally 64 bitty. | |
484 | ||
485 | case "$use64bitall" in | |
486 | $define|true|[yY]*) | |
487 | case "$cc" in | |
488 | *-n32*|*-32*) | |
489 | cat >&4 <<EOM | |
490 | You cannot use a non-64 bit cc for -Duse64bitall, sorry. | |
491 | Cannot continue, aborting. | |
492 | EOM | |
493 | exit 1 | |
494 | ;; | |
495 | esac | |
496 | ;; | |
497 | esac | |
498 | ||
499 | EOCBU | |
500 | ||
20f6aaab AS |
501 | $cat > UU/uselongdouble.cbu <<'EOCBU' |
502 | # This script UU/uselongdouble.cbu will get 'called-back' by Configure | |
503 | # after it has prompted the user for whether to use long doubles. | |
504 | ||
505 | # This script is designed to test IRIX (and other machines, once it's put into | |
506 | # Configure) for a bug in which they fail to round correctly when using | |
507 | # sprintf/printf/etcetera on a long double with precision specified (%.0Lf or | |
508 | # whatever). Sometimes, this only happens when the number in question is | |
509 | # between 1 and -1, weirdly enough. - Allen | |
510 | ||
511 | case "$uselongdouble" in | |
512 | $define|true|[yY]*) | |
513 | ||
514 | case "$d_PRIfldbl" in | |
515 | $define|true|[yY]*) | |
516 | ||
517 | echo " " >try.c | |
518 | $cat >>try.c <<EOP | |
519 | #include <stdio.h> | |
520 | ||
521 | #define sPRIfldbl $sPRIfldbl | |
522 | ||
523 | #define I_STDLIB $i_stdlib | |
524 | #ifdef I_STDLIB | |
525 | #include <stdlib.h> | |
526 | #endif | |
527 | ||
528 | int main() | |
529 | { | |
530 | char buf1[64]; | |
531 | char buf2[64]; | |
532 | buf1[63] = '\0'; | |
533 | buf2[63] = '\0'; | |
534 | ||
535 | (void)sprintf(buf1,"%.0"sPRIfldbl,(long double)0.6L); | |
536 | (void)sprintf(buf2,"%.0f",(double)0.6); | |
537 | if (strcmp(buf1,buf2)) { | |
538 | exit(1); | |
539 | } | |
540 | (void)sprintf(buf1,"%.0"sPRIfldbl,(long double)-0.6L); | |
541 | (void)sprintf(buf2,"%.0f",(double)-0.6); | |
542 | if (strcmp(buf1,buf2)) { | |
543 | exit(1); | |
544 | } else { | |
545 | exit(0); | |
546 | } | |
547 | } | |
548 | ||
549 | EOP | |
550 | ||
551 | set try | |
552 | if eval $compile && $run ./try; then | |
553 | rm -f try try.* >/dev/null | |
554 | else | |
555 | rm -f try try.* core a.out >/dev/null | |
556 | ccflags="$ccflags -DHAS_LDBL_SPRINTF_BUG" | |
557 | cppflags="$cppflags -DHAS_LDBL_SPRINTF_BUG" | |
558 | ||
559 | echo " " >try.c | |
560 | $cat >>try.c <<EOP | |
561 | #include <stdio.h> | |
562 | ||
563 | #define sPRIfldbl $sPRIfldbl | |
564 | ||
565 | #define I_STDLIB $i_stdlib | |
566 | #ifdef I_STDLIB | |
567 | #include <stdlib.h> | |
568 | #endif | |
569 | ||
570 | int main() | |
571 | { | |
572 | char buf1[64]; | |
573 | char buf2[64]; | |
574 | buf1[63] = '\0'; | |
575 | buf2[63] = '\0'; | |
576 | ||
577 | (void)sprintf(buf1,"%.0"sPRIfldbl,(long double)1.6L); | |
578 | (void)sprintf(buf2,"%.0f",(double)1.6); | |
579 | if (strcmp(buf1,buf2)) { | |
580 | exit(1); | |
581 | } | |
582 | (void)sprintf(buf1,"%.0"sPRIfldbl,(long double)-1.6L); | |
583 | (void)sprintf(buf2,"%.0f",(double)-1.6); | |
584 | if (strcmp(buf1,buf2)) { | |
585 | exit(1); | |
586 | } else { | |
587 | exit(0); | |
588 | } | |
589 | } | |
590 | ||
591 | EOP | |
592 | ||
593 | set try | |
594 | if eval $compile && $run ./try; then | |
595 | rm -f try try.c >/dev/null | |
596 | ccflags="$ccflags -DHAS_LDBL_SPRINTF_BUG_LESS1" | |
597 | cppflags="$cppflags -DHAS_LDBL_SPRINTF_BUG_LESS1" | |
598 | else | |
599 | rm -f try try.c core try.o a.out >/dev/null | |
600 | fi | |
601 | fi | |
602 | ;; | |
603 | *) # Can't tell! | |
604 | ccflags="$ccflags -DHAS_LDBL_SPRINTF_BUG" | |
605 | cppflags="$cppflags -DHAS_LDBL_SPRINTF_BUG" | |
606 | ;; | |
607 | esac | |
608 | ||
609 | # end of case statement for how to print ldbl with 'f' | |
610 | ;; | |
611 | *) ;; | |
612 | esac | |
613 | ||
614 | # end of case statement for whether to do long doubles | |
615 | ||
616 | EOCBU | |
617 | ||
d1a954cb JH |
618 | # Helmut Jarausch reports that Perl's malloc is rather unusable |
619 | # with IRIX, and SGI confirms the problem. | |
620 | usemymalloc=${usemymalloc:-false} |