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