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