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