| 1 | # hints/aix.sh |
| 2 | |
| 3 | # AIX 3 and AIX 4 are split off to aix_3.sh and aix_4.sh |
| 4 | # early Feb 2004 by H.Merijn Brand |
| 5 | # please read comments in there for historic questions. |
| 6 | # many now stripped here |
| 7 | |
| 8 | # Contact dfavor@corridor.com for any of the following: |
| 9 | # |
| 10 | # - AIX 43x and above support |
| 11 | # - gcc + threads support |
| 12 | # - socks support |
| 13 | # |
| 14 | # Notes: |
| 15 | # |
| 16 | # - shared libperl support is tricky. if ever libperl.a ends up |
| 17 | # in /usr/local/lib/* it can override any subsequent builds of |
| 18 | # that same perl release. to make sure you know where the shared |
| 19 | # libperl.a is coming from do a 'dump -Hv perl' and check all the |
| 20 | # library search paths in the loader header. |
| 21 | # |
| 22 | # it would be nice to warn the user if a libperl.a exists that is |
| 23 | # going to override the current build, but that would be complex. |
| 24 | # |
| 25 | # better yet, a solid fix for this situation should be developed. |
| 26 | # |
| 27 | |
| 28 | # Configure finds setrgid and setruid, but they're useless. The man |
| 29 | # pages state: |
| 30 | # setrgid: The EPERM error code is always returned. |
| 31 | # setruid: The EPERM error code is always returned. Processes cannot |
| 32 | # reset only their real user IDs. |
| 33 | d_setrgid='undef' |
| 34 | d_setruid='undef' |
| 35 | |
| 36 | alignbytes=8 |
| 37 | case "$usemymalloc" in |
| 38 | '') usemymalloc='n' ;; |
| 39 | esac |
| 40 | |
| 41 | # malloc wrap works, but not in vac-5, see later |
| 42 | case "$usemallocwrap" in |
| 43 | '') usemallocwrap='define' ;; |
| 44 | esac |
| 45 | |
| 46 | # Intuiting the existence of system calls under AIX is difficult, |
| 47 | # at best; the safest technique is to find them empirically. |
| 48 | |
| 49 | case "$usenativedlopen" in |
| 50 | '') usenativedlopen='true' ;; |
| 51 | esac |
| 52 | |
| 53 | so="a" |
| 54 | # AIX itself uses .o (libc.o) but we prefer compatibility |
| 55 | # with the rest of the world and with rest of the scripting |
| 56 | # languages (Tcl, Python) and related systems (SWIG). |
| 57 | # Stephanie Beals <bealzy@us.ibm.com> |
| 58 | dlext="so" |
| 59 | |
| 60 | # Take possible hint from the environment. If 32-bit is set in the |
| 61 | # environment, we can override it later. If set for 64, the |
| 62 | # 'sizeof' test sees a native 64-bit architecture and never looks back. |
| 63 | case "$OBJECT_MODE" in |
| 64 | 32) cat >&4 <<EOF |
| 65 | |
| 66 | You have OBJECT_MODE=32 set in the environment. |
| 67 | I take this as a hint you do not want to |
| 68 | build for a 64-bit address space. You will be |
| 69 | given the opportunity to change this later. |
| 70 | EOF |
| 71 | ;; |
| 72 | 64) cat >&4 <<EOF |
| 73 | |
| 74 | You have OBJECT_MODE=64 set in the environment. |
| 75 | This forces a full 64-bit build. If that is |
| 76 | not what you intended, please terminate this |
| 77 | program, unset it and restart. |
| 78 | EOF |
| 79 | ;; |
| 80 | esac |
| 81 | |
| 82 | s=`lslpp -lc bos.adt.libm >/dev/null` |
| 83 | if [ $? != 0 ]; then |
| 84 | echo "You cannot build perl without the bos.adt.libm package installed" >&4 |
| 85 | exit |
| 86 | fi |
| 87 | |
| 88 | # uname -m output is too specific and not appropriate here |
| 89 | case "$archname" in |
| 90 | '') archname="$osname" ;; |
| 91 | esac |
| 92 | |
| 93 | cc=${cc:-cc} |
| 94 | |
| 95 | ccflags="$ccflags -D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE" |
| 96 | case "$cc" in |
| 97 | *gcc*) ;; |
| 98 | *) ccflags="$ccflags -qmaxmem=-1 -qnoansialias -qlanglvl=extc99" ;; |
| 99 | esac |
| 100 | nm_opt='-B' |
| 101 | |
| 102 | # These functions don't work like Perl expects them to. |
| 103 | d_setregid='undef' |
| 104 | d_setreuid='undef' |
| 105 | |
| 106 | # Changes for dynamic linking by Wayne Scott <wscott@ichips.intel.com> |
| 107 | # |
| 108 | # Tell perl which symbols to export for dynamic linking. |
| 109 | cccdlflags='none' # All AIX code is position independent |
| 110 | cc_type=xlc # do not export to config.sh |
| 111 | case "$cc" in |
| 112 | *gcc*) |
| 113 | cc_type=gcc |
| 114 | ccdlflags='-Xlinker' |
| 115 | if [ "X$gccversion" = "X" ]; then |
| 116 | # Done too late in Configure if hinted |
| 117 | gccversion=`$cc -dumpversion` |
| 118 | fi |
| 119 | ;; |
| 120 | |
| 121 | *) ccversion=`lslpp -ql -Ou vac.C | grep -v '^Path' | head -1 | awk '{print $1,$2}'` |
| 122 | case "$ccversion" in |
| 123 | '') ccversion=`lslpp -L | grep 'IBM C and C++ Compilers LUM$'` ;; |
| 124 | |
| 125 | *.*.*.*.*.*.*) # Ahhrgg, more than one C compiler installed |
| 126 | first_cc_path=`which ${cc:-cc}` |
| 127 | case "$first_cc_path" in |
| 128 | *vac*) |
| 129 | cc_type=vac ;; |
| 130 | |
| 131 | /usr/bin/cc) # Check the symlink |
| 132 | if [ -h $first_cc_path ] ; then |
| 133 | ls -l $first_cc_path > reflect |
| 134 | if grep -i vac reflect >/dev/null 2>&1 ; then |
| 135 | cc_type=vac |
| 136 | fi |
| 137 | rm -f reflect |
| 138 | fi |
| 139 | ;; |
| 140 | esac |
| 141 | ccversion=`lslpp -L | grep 'C for AIX Compiler$' | grep -i $cc_type | head -1` |
| 142 | ;; |
| 143 | |
| 144 | vac*.*.*.*) |
| 145 | cc_type=vac |
| 146 | ;; |
| 147 | esac |
| 148 | |
| 149 | ccversion=`echo "$ccversion" | awk '{print $2}'` |
| 150 | # Redbooks state AIX-5 only supports vac-5.0.2.0 and up |
| 151 | case "$ccversion" in |
| 152 | 5*) usemallocwrap='n' ;; # panic in miniperl |
| 153 | esac |
| 154 | ;; |
| 155 | esac |
| 156 | |
| 157 | # the required -bE:$installarchlib/CORE/perl.exp is added by |
| 158 | # libperl.U (Configure) later. |
| 159 | |
| 160 | # The first 3 options would not be needed if dynamic libs. could be linked |
| 161 | # with the compiler instead of ld. |
| 162 | # -bI:$(PERL_INC)/perl.exp Read the exported symbols from the perl binary |
| 163 | # -bE:$(BASEEXT).exp Export these symbols. This file contains only one |
| 164 | # symbol: boot_$(EXP) can it be auto-generated? |
| 165 | if test $usenativedlopen = 'true' ; then |
| 166 | lddlflags="$lddlflags -bhalt:4 -G -bI:\$(PERL_INC)/perl.exp -bE:\$(BASEEXT).exp -bnoentry -lc -lm" |
| 167 | else |
| 168 | lddlflags="$lddlflags -bhalt:4 -bM:SRE -bI:\$(PERL_INC)/perl.exp -bE:\$(BASEEXT).exp -bnoentry -lc" |
| 169 | fi |
| 170 | |
| 171 | case "$use64bitall" in |
| 172 | $define|true|[yY]*) use64bitint="$define" ;; |
| 173 | esac |
| 174 | |
| 175 | case "$usemorebits" in |
| 176 | $define|true|[yY]*) use64bitint="$define"; uselongdouble="$define" ;; |
| 177 | esac |
| 178 | |
| 179 | case $cc_type in |
| 180 | vac|xlc) |
| 181 | case "$uselongdouble" in |
| 182 | $define|true|[yY]*) |
| 183 | ccflags="$ccflags -qlongdouble" |
| 184 | libswanted="c128 $libswanted" |
| 185 | lddlflags=`echo "$lddlflags " | sed -e 's/ -lc / -lc128 -lc /'` |
| 186 | ;; |
| 187 | esac |
| 188 | ;; |
| 189 | esac |
| 190 | |
| 191 | case "$cc" in |
| 192 | *gcc*) ;; |
| 193 | |
| 194 | cc*|xlc*) # cc should've been set by line 116 or so if empty. |
| 195 | if test ! -x /usr/bin/$cc -a -x /usr/vac/bin/$cc; then |
| 196 | case ":$PATH:" in |
| 197 | *:/usr/vac/bin:*) ;; |
| 198 | *) if test ! -x /QOpenSys/usr/bin/$cc; then |
| 199 | # The /QOpenSys/usr/bin/$cc saves us if we are |
| 200 | # building natively in OS/400 PASE. |
| 201 | cat >&4 <<EOF |
| 202 | |
| 203 | *** |
| 204 | *** You either implicitly or explicitly specified an IBM C compiler, |
| 205 | *** but you do not seem to have one in /usr/bin, but you seem to have |
| 206 | *** the VAC installed in /usr/vac, but you do not have the /usr/vac/bin |
| 207 | *** in your PATH. I suggest adding that and retrying Configure. |
| 208 | *** |
| 209 | EOF |
| 210 | exit 1 |
| 211 | fi |
| 212 | ;; |
| 213 | esac |
| 214 | fi |
| 215 | ;; |
| 216 | esac |
| 217 | |
| 218 | case "$ldlibpthname" in |
| 219 | '') ldlibpthname=LIBPATH ;; |
| 220 | esac |
| 221 | |
| 222 | # This script UU/usethreads.cbu will get 'called-back' by Configure |
| 223 | # after it has prompted the user for whether to use threads. |
| 224 | cat > UU/usethreads.cbu <<'EOCBU' |
| 225 | case "$usethreads" in |
| 226 | $define|true|[yY]*) |
| 227 | d_drand48_r='undef' |
| 228 | d_endgrent_r='undef' |
| 229 | d_endpwent_r='undef' |
| 230 | d_getgrent_r='undef' |
| 231 | d_getpwent_r='undef' |
| 232 | d_random_r='undef' |
| 233 | d_setgrent_r='undef' |
| 234 | d_setpwent_r='undef' |
| 235 | d_srand48_r='undef' |
| 236 | d_srandom_r='undef' |
| 237 | d_strerror_r='undef' |
| 238 | |
| 239 | ccflags="$ccflags -DNEED_PTHREAD_INIT" |
| 240 | case "$cc" in |
| 241 | *gcc*) |
| 242 | ccflags="-D_THREAD_SAFE $ccflags" |
| 243 | ;; |
| 244 | cc_r) |
| 245 | ;; |
| 246 | xlc_r) |
| 247 | ;; |
| 248 | # we do not need the C++ compiler |
| 249 | xlC_r) |
| 250 | cc=xlc_r |
| 251 | ;; |
| 252 | '') |
| 253 | cc=cc_r |
| 254 | ;; |
| 255 | *) |
| 256 | esac |
| 257 | |
| 258 | # Insert pthreads to libswanted, before any libc or libC. |
| 259 | set `echo X "$libswanted "| sed -e 's/ \([cC]\) / pthreads \1 /'` |
| 260 | shift |
| 261 | libswanted="$*" |
| 262 | # Insert pthreads to lddlflags, before any libc or libC. |
| 263 | set `echo X "$lddlflags " | sed -e 's/ \(-l[cC]\) / -lpthreads \1 /'` |
| 264 | shift |
| 265 | lddlflags="$*" |
| 266 | ;; |
| 267 | *) |
| 268 | case "$cc" in |
| 269 | xlc) |
| 270 | ;; |
| 271 | # we do not need the C++ compiler |
| 272 | xlC) |
| 273 | cc=xlc |
| 274 | ;; |
| 275 | *) |
| 276 | esac |
| 277 | ;; |
| 278 | esac |
| 279 | EOCBU |
| 280 | |
| 281 | # This script UU/uselargefiles.cbu will get 'called-back' by Configure |
| 282 | # after it has prompted the user for whether to use large files. |
| 283 | cat > UU/uselargefiles.cbu <<'EOCBU' |
| 284 | case "$uselargefiles" in |
| 285 | ''|$define|true|[yY]*) |
| 286 | # Configure should take care of use64bitint and use64bitall being |
| 287 | # defined before uselargefiles.cbu is consulted. |
| 288 | if test X"$use64bitint:$quadtype" = X"$define:long" -o X"$use64bitall" = Xdefine; then |
| 289 | # Keep these at the left margin. |
| 290 | ccflags_uselargefiles="`getconf XBS5_LP64_OFF64_CFLAGS 2>/dev/null`" |
| 291 | ldflags_uselargefiles="`getconf XBS5_LP64_OFF64_LDFLAGS 2>/dev/null`" |
| 292 | else |
| 293 | # Keep these at the left margin. |
| 294 | ccflags_uselargefiles="`getconf XBS5_ILP32_OFFBIG_CFLAGS 2>/dev/null`" |
| 295 | ldflags_uselargefiles="`getconf XBS5_ILP32_OFFBIG_LDFLAGS 2>/dev/null`" |
| 296 | fi |
| 297 | if test X"$use64bitint:$quadtype" = X"$define:long" -o X"$use64bitall" = Xdefine; then |
| 298 | # Keep this at the left margin. |
| 299 | libswanted_uselargefiles="`getconf XBS5_LP64_OFF64_LIBS 2>/dev/null|sed -e 's@^-l@@' -e 's@ -l@ @g'`" |
| 300 | else |
| 301 | # Keep this at the left margin. |
| 302 | libswanted_uselargefiles="`getconf XBS5_ILP32_OFFBIG_LIBS 2>/dev/null|sed -e 's@^-l@@' -e 's@ -l@ @g'`" |
| 303 | fi |
| 304 | |
| 305 | case "$ccflags_uselargefiles$ldflags_uselargefiles$libs_uselargefiles" in |
| 306 | '') ;; |
| 307 | *) ccflags="$ccflags $ccflags_uselargefiles" |
| 308 | ldflags="$ldflags $ldflags_uselargefiles" |
| 309 | libswanted="$libswanted $libswanted_uselargefiles" |
| 310 | ;; |
| 311 | esac |
| 312 | |
| 313 | # -bmaxdata:0x80000000 |
| 314 | # - This increases the size of heap memory available to perl. |
| 315 | # Default is 256 MB, which sounds large but caused a software |
| 316 | # vendor problems. So this sets heap to 2 GB maximum. Anything |
| 317 | # higher and you'd want to consider 64 bit perl. |
| 318 | # - NOTE however, that setting this in 64bit mode will limit your |
| 319 | # amount of available memory to 2GB, so we set this only in |
| 320 | # 32bit mode to avoid future problems a la "should be enough |
| 321 | # for everyone" ... |
| 322 | # |
| 323 | case "$use64bitall" in |
| 324 | $define|true|[yY]*) |
| 325 | : |
| 326 | ;; |
| 327 | *) |
| 328 | ldflags="$ldflags -bmaxdata:0x80000000" |
| 329 | ;; |
| 330 | esac |
| 331 | |
| 332 | case "$gccversion" in |
| 333 | '') # Not using gcc. |
| 334 | # Due to calling $cc without $cflags when linking some |
| 335 | # binaries we need to hardwire $cc to the right mode. |
| 336 | # The correct fix would be to have Makefile.SH not set |
| 337 | # CLDFLAGS from $ldflags ... |
| 338 | case "$use64bitall" in |
| 339 | $define|true|[yY]*) cc="$cc -q64" ;; |
| 340 | *) cc="$cc -q32" ;; |
| 341 | esac |
| 342 | # Some 32-bit getconfs will set ccflags to include -qlonglong |
| 343 | # but that's no longer needed with an explicit -qextc99. |
| 344 | ccflags="`echo $ccflags | sed -e 's@ -qlonglong@@'`" |
| 345 | ;; |
| 346 | *) # Remove xlc-specific -qflags. |
| 347 | ccflags="`echo $ccflags | sed -e 's@ -q[^ ]*@ @g' -e 's@^-q[^ ]* @@g'`" |
| 348 | ldflags="`echo $ldflags | sed -e 's@ -q[^ ]*@ @g' -e 's@^-q[^ ]* @@g'`" |
| 349 | # Move xlc-specific -bflags. |
| 350 | ccflags="`echo $ccflags | sed -e 's@ -b@ -Wl,-b@g'`" |
| 351 | ldflags="`echo ' '$ldflags | sed -e 's@ -b@ -Wl,-b@g'`" |
| 352 | lddlflags="`echo ' '$lddlflags | sed -e 's@ -b@ -Wl,-b@g'`" |
| 353 | lddlflags="`echo ' '$lddlflags | sed -e 's@ -G @ -Wl,-G @g'`" |
| 354 | |
| 355 | # Due to calling $cc without $cflags when linking some |
| 356 | # binaries we need to hardwire $cc to the right mode. |
| 357 | case "$use64bitall" in |
| 358 | $define|true|[yY]*) |
| 359 | cc="$cc -maix64" |
| 360 | ld="$cc" |
| 361 | ;; |
| 362 | *) |
| 363 | cc="$cc -maix32" |
| 364 | ld="$cc" |
| 365 | ;; |
| 366 | esac |
| 367 | echo >&4 "(using ccflags $ccflags)" |
| 368 | echo >&4 "(using ldflags $ldflags)" |
| 369 | echo >&4 "(using lddlflags $lddlflags)" |
| 370 | ;; |
| 371 | esac |
| 372 | ;; |
| 373 | esac |
| 374 | EOCBU |
| 375 | |
| 376 | cat > UU/use64bitall.cbu <<'EOCBU' |
| 377 | # This script UU/use64bitall.cbu will get 'called-back' by Configure |
| 378 | # after it has prompted the user for whether to be maximally 64-bitty. |
| 379 | case "$use64bitall" in |
| 380 | $define|true|[yY]*) |
| 381 | echo " " |
| 382 | echo "Checking the CPU width of your hardware..." >&4 |
| 383 | $cat >size.c <<EOCP |
| 384 | #include <stdio.h> |
| 385 | #include <sys/systemcfg.h> |
| 386 | int main (void) |
| 387 | { |
| 388 | printf ("%d\n", _system_configuration.width); |
| 389 | return (0); |
| 390 | } |
| 391 | EOCP |
| 392 | set size |
| 393 | if eval $compile_ok; then |
| 394 | qacpuwidth=`./size` |
| 395 | echo "You are running on $qacpuwidth bit hardware." |
| 396 | else |
| 397 | dflt="32" |
| 398 | echo " " |
| 399 | echo "(I can't seem to compile the test program. Guessing...)" |
| 400 | rp="What is the width of your CPU (in bits)?" |
| 401 | . ./myread |
| 402 | qacpuwidth="$ans" |
| 403 | fi |
| 404 | $rm -f size.c size |
| 405 | |
| 406 | case "$qacpuwidth" in |
| 407 | 32*) |
| 408 | cat >&4 <<EOM |
| 409 | Bzzzt! At present, you can only perform a |
| 410 | full 64-bit build on a 64-bit machine. |
| 411 | EOM |
| 412 | exit 1 |
| 413 | ;; |
| 414 | esac |
| 415 | qacflags="`getconf XBS5_LP64_OFF64_CFLAGS 2>/dev/null`" |
| 416 | qaldflags="`getconf XBS5_LP64_OFF64_LDFLAGS 2>/dev/null`" |
| 417 | # See jhi's comments above regarding this re-eval. I've |
| 418 | # seen similar weirdness in the form of: |
| 419 | # |
| 420 | # 1506-173 (W) Option lm is not valid. Enter xlc for list of valid options. |
| 421 | # |
| 422 | # error messages from 'cc -E' invocation. Again, the offending |
| 423 | # string is simply not detectable by any means. Since it doesn't |
| 424 | # do any harm, I didn't pursue it. -- sh |
| 425 | qaldflags="`echo $qaldflags`" |
| 426 | qalibs="`getconf XBS5_LP64_OFF64_LIBS 2>/dev/null|sed -e 's@^-l@@' -e 's@ -l@ @g'`" |
| 427 | # -q32 and -b32 may have been set by uselargefiles or user. |
| 428 | # Remove them. |
| 429 | ccflags="`echo $ccflags | sed -e 's@-q32@@'`" |
| 430 | ldflags="`echo $ldflags | sed -e 's@-b32@@'`" |
| 431 | case "$cc" in |
| 432 | *gcc*) |
| 433 | ccflags="`echo $ccflags | sed -e 's@-q64@-maix64@'`" |
| 434 | ccflags_uselargefiles="`echo $ccflags_uselargefiles | sed -e 's@-q64@-maix64@'`" |
| 435 | qacflags="`echo $qacflags | sed -e 's@-q64@-maix64@'`" |
| 436 | ;; |
| 437 | esac |
| 438 | # Tell archiver to use large format. Unless we remove 'ar' |
| 439 | # from 'trylist', the Configure script will just reset it to 'ar' |
| 440 | # immediately prior to writing config.sh. This took me hours |
| 441 | # to figure out. |
| 442 | trylist="`echo $trylist | sed -e 's@^ar @@' -e 's@ ar @ @g' -e 's@ ar$@@'`" |
| 443 | ar="ar -X64" |
| 444 | nm_opt="-X64 $nm_opt" |
| 445 | case "$qacflags$qaldflags$qalibs" in |
| 446 | '') ;; |
| 447 | *) ccflags="$ccflags $qacflags" |
| 448 | ldflags="$ldflags" |
| 449 | lddlflags="$qaldflags $lddlflags" |
| 450 | libswanted="$libswanted $qalibs" |
| 451 | ;; |
| 452 | esac |
| 453 | case "$ccflags" in |
| 454 | *-DUSE_64_BIT_ALL*) ;; |
| 455 | *) ccflags="$ccflags -DUSE_64_BIT_ALL";; |
| 456 | esac |
| 457 | case "$archname64" in |
| 458 | ''|64*) archname64=64all ;; |
| 459 | esac |
| 460 | longsize="8" |
| 461 | qacflags='' |
| 462 | qaldflags='' |
| 463 | qalibs='' |
| 464 | qacpuwidth='' |
| 465 | ;; |
| 466 | esac |
| 467 | EOCBU |
| 468 | |
| 469 | if test $usenativedlopen = 'true' ; then |
| 470 | ccflags="$ccflags -DUSE_NATIVE_DLOPEN" |
| 471 | # -brtl Enables a binary to use run time linking |
| 472 | # -bdynamic When used with -brtl, tells linker to search for |
| 473 | # ".so"-suffix libraries as well as ".a" suffix |
| 474 | # libraries. AIX allows both .so and .a libraries to |
| 475 | # contain dynamic shared objects. |
| 476 | case "$cc" in |
| 477 | *gcc*) ldflags="$ldflags -Wl,-brtl -Wl,-bdynamic" ;; |
| 478 | *) ldflags="$ldflags -brtl -bdynamic" ;; |
| 479 | esac |
| 480 | elif test -f /lib/libC.a -a X"`$cc -v 2>&1 | grep gcc`" = X; then |
| 481 | # If the C++ libraries, libC and libC_r, are available we will |
| 482 | # prefer them over the vanilla libc, because the libC contain |
| 483 | # loadAndInit() and terminateAndUnload() which work correctly |
| 484 | # with C++ statics while libc load() and unload() do not. See |
| 485 | # ext/DynaLoader/dl_aix.xs. The C-to-C_r switch is done by |
| 486 | # usethreads.cbu, if needed. |
| 487 | |
| 488 | # Cify libswanted. |
| 489 | set `echo X "$libswanted "| sed -e 's/ c / C c /'` |
| 490 | shift |
| 491 | libswanted="$*" |
| 492 | # Cify lddlflags. |
| 493 | set `echo X "$lddlflags "| sed -e 's/ -lc / -lC -lc /'` |
| 494 | shift |
| 495 | lddlflags="$*" |
| 496 | fi |
| 497 | |
| 498 | case "$PASE" in |
| 499 | define) |
| 500 | case "$prefix" in |
| 501 | '') prefix=/QOpenSys/perl ;; |
| 502 | esac |
| 503 | cat >&4 <<EOF |
| 504 | |
| 505 | *** |
| 506 | *** You seem to be compiling in AIX for the OS/400 PASE environment. |
| 507 | *** I'm not going to use the AIX bind, nsl, and possible util libraries, then. |
| 508 | *** I'm also not going to install perl as /usr/bin/perl. |
| 509 | *** Perl will be installed under $prefix. |
| 510 | *** For instructions how to install this build from AIX to PASE, |
| 511 | *** see the file README.os400. Accept the "aix" for the question |
| 512 | *** about "Operating system name". |
| 513 | *** |
| 514 | EOF |
| 515 | set `echo " $libswanted " | sed -e 's@ bind @ @' -e 's@ nsl @ @' -e 's@ util @ @'` |
| 516 | shift |
| 517 | libswanted="$*" |
| 518 | installusrbinperl="$undef" |
| 519 | |
| 520 | # V5R1 doesn't have this (V5R2 does), without knowing |
| 521 | # which one we have it's safer to be pessimistic. |
| 522 | # Cwd will work fine even without fchdir(), but if |
| 523 | # V5R1 tries to use code compiled assuming fchdir(), |
| 524 | # lots of grief will issue forth from Cwd. |
| 525 | case "$d_fchdir" in |
| 526 | '') d_fchdir="$undef" ;; |
| 527 | esac |
| 528 | ;; |
| 529 | esac |
| 530 | |
| 531 | # remove libbsd.a from wanted libraries |
| 532 | libswanted=`echo " $libswanted " | sed -e 's/ bsd / /'` |
| 533 | libswanted=`echo " $libswanted " | sed -e 's/ BSD / /'` |
| 534 | d_flock='undef' |
| 535 | |
| 536 | # remove libgdbm from wanted libraries |
| 537 | # The libgdbm < 1.8.3-5 from the AIX Toolbox is not working |
| 538 | # because two wrong .h are present |
| 539 | if [ -f "/opt/freeware/include/gdbm/dbm.h" ] || |
| 540 | [ -f "/opt/freeware/include/gdbm/ndbm.h" ]; then |
| 541 | echo "GDBM support disabled because your GDBM package contains extraneous headers - see README.aix." |
| 542 | libswanted=`echo " $libswanted " | sed -e 's/ gdbm / /'` |
| 543 | i_gdbm='undef' |
| 544 | i_gdbmndbm='undef' |
| 545 | fi |
| 546 | |
| 547 | # Some releases (and patch levels) of AIX cannot have both |
| 548 | # long doubles and infinity (infinity plus one equals ... NaNQ!) |
| 549 | # |
| 550 | # This deficiency, and others, is apparently a well-documented feature |
| 551 | # of AIX 128-bit long doubles: |
| 552 | # |
| 553 | # http://www-01.ibm.com/support/knowledgecenter/ssw_aix_61/com.ibm.aix.genprogc/128bit_long_double_floating-point_datatype.htm |
| 554 | # |
| 555 | # The URL seems to be fragile, it has moved around over the years, |
| 556 | # but searching AIX docs at ibm.com for "128-bit long double |
| 557 | # floating-point data type" should surface the latest info. |
| 558 | # |
| 559 | # Some salient points: |
| 560 | # |
| 561 | # <quote> |
| 562 | # * The 128-bit implementation differs from the IEEE standard for long double |
| 563 | # in the following ways: |
| 564 | # * Supports only round-to-nearest mode. If the application changes |
| 565 | # the rounding mode, results are undefined. |
| 566 | # * Does not fully support the IEEE special numbers NaN and INF. |
| 567 | # * Does not support IEEE status flags for overflow, underflow, |
| 568 | # and other conditions. These flags have no meaning for the 128-bit |
| 569 | # long double inplementation. |
| 570 | # * The 128-bit long double data type does not support the following math |
| 571 | # APIs: atanhl, cbrtl, copysignl, exp2l, expm1l, fdiml, fmal, fmaxl, |
| 572 | # fminl, hypotl, ilogbl, llrintl, llroundl, log1pl, log2l, logbl, |
| 573 | # lrintl, lroundl, nanl, nearbyintl, nextafterl, nexttoward, |
| 574 | # nexttowardf, nexttowardl, remainderl, remquol, rintl, roundl, |
| 575 | # scalblnl, scalbnl, tgammal, and truncl. |
| 576 | # * The representation of 128-bit long double numbers means that the |
| 577 | # following macros required by standard C in the values.h file do not |
| 578 | # have clear meaning: |
| 579 | # * Number of bits in the mantissa (LDBL_MANT_DIG) |
| 580 | # * Epsilon (LBDL_EPSILON) |
| 581 | # * Maximum representable finite value (LDBL_MAX) |
| 582 | # </quote> |
| 583 | # |
| 584 | # The missing math functions affect the POSIX extension math interfaces. |
| 585 | |
| 586 | case "$uselongdouble" in |
| 587 | '') |
| 588 | echo "Checking if your infinity is working with long doubles..." >&4 |
| 589 | cat > inf$$.c <<EOF |
| 590 | #include <math.h> |
| 591 | #include <stdio.h> |
| 592 | int main() { |
| 593 | long double inf = INFINITY; |
| 594 | long double one = 1.0L; |
| 595 | printf("%Lg\n", inf + one); |
| 596 | } |
| 597 | EOF |
| 598 | $cc -qlongdouble -o inf$$ inf$$.c -lm |
| 599 | case `./inf$$` in |
| 600 | INF) echo "Your infinity is working correctly with long doubles." >&4 ;; |
| 601 | *) # NaNQ (or anything else than INF) |
| 602 | echo " " |
| 603 | echo "Your infinity is broken, I suggest disabling long doubles." >&4 |
| 604 | rp="Disable long doubles?" |
| 605 | dflt="y" |
| 606 | . UU/myread |
| 607 | case "$ans" in |
| 608 | [Yy]*) |
| 609 | echo "Okay, disabling long doubles." >&4 |
| 610 | uselongdouble="$undef" |
| 611 | ccflags=`echo " $ccflags " | sed -e 's/ -qlongdouble / /'` |
| 612 | libswanted=`echo " $libswanted " | sed -e 's/ c128/ /'` |
| 613 | lddlflags=`echo " $lddlflags " | sed -e 's/ -lc128 / /'` |
| 614 | ;; |
| 615 | *) |
| 616 | echo "Okay, keeping long doubles enabled." >&4 |
| 617 | ;; |
| 618 | esac |
| 619 | ;; |
| 620 | esac |
| 621 | rm -f inf$$.c inf$$ |
| 622 | ;; |
| 623 | esac |
| 624 | |
| 625 | # Some releases (and patch levels) of AIX have a broken powl(). |
| 626 | pp_cflags='' |
| 627 | case "$uselongdouble" in |
| 628 | define) |
| 629 | echo "Checking if your powl() is broken..." >&4 |
| 630 | cat > powl$$.c <<EOF |
| 631 | #include <math.h> |
| 632 | #include <stdio.h> |
| 633 | int main() { |
| 634 | printf("%Lg\n", powl(-3.0L, 2.0L)); |
| 635 | } |
| 636 | EOF |
| 637 | case "$gccversion" in |
| 638 | '') $cc -qlongdouble -o powl$$ powl$$.c -lm ;; |
| 639 | *) $cc -o powl$$ powl$$.c -lm ;; |
| 640 | esac |
| 641 | case `./powl$$` in |
| 642 | 9) echo "Your powl() is working correctly." >&4 ;; |
| 643 | *) |
| 644 | echo "Your powl() is broken, will use a workaround." >&4 |
| 645 | pp_cflags='ccflags="$ccflags -DHAS_AIX_POWL_NEG_BASE_BUG"' |
| 646 | ;; |
| 647 | esac |
| 648 | rm -f powl$$.c powl$$ |
| 649 | ;; |
| 650 | esac |
| 651 | |
| 652 | # Some releases of AIX cc/xlc a broken fmodl(), but -q64 seems to help. |
| 653 | case "$gccversion" in |
| 654 | '') case "$uselongdouble" in |
| 655 | define) |
| 656 | case "$ccflags" in |
| 657 | *-q64*) ;; |
| 658 | *) echo "Checking if your fmodl() is broken..." >&4 |
| 659 | cat > fmodl$$.c <<EOF |
| 660 | #include <math.h> |
| 661 | #include <stdio.h> |
| 662 | int main() { |
| 663 | printf("%ld\n", (long)fmodl(powl(2, 31), (long double)4294967295)); |
| 664 | } |
| 665 | EOF |
| 666 | $cc -qlongdouble -o fmodl$$ fmodl$$.c -lm |
| 667 | case `./fmodl$$` in |
| 668 | 2147483648) echo "Your fmodl() is working correctly." >&4 ;; |
| 669 | *) echo "Your fmodl() is broken, will try with -q64..." >&4 |
| 670 | $cc -q64 -qlongdouble -o fmodl$$ fmodl$$.c -lm |
| 671 | case `./fmodl$$` in |
| 672 | 2147483648) |
| 673 | echo "The -q64 did the trick, will use it." >& 4 |
| 674 | ccflags="`echo $ccflags | sed -e 's@-q32@@g'`" |
| 675 | ldflags="`echo $ldflags | sed -e 's@-q32@@g'`" |
| 676 | ccflags="$ccflags -q64" |
| 677 | ldflags="$ldflags -q64" |
| 678 | ;; |
| 679 | *) echo "Not even the -q64 worked. I'm disabling long doubles." >&4 |
| 680 | echo "And you should have stern talk with your IBM rep." >&4 |
| 681 | uselongdouble="$undef" |
| 682 | ccflags=`echo " $ccflags " | sed -e 's/ -qlongdouble / /'` |
| 683 | libswanted=`echo " $libswanted " | sed -e 's/ c128/ /'` |
| 684 | lddlflags=`echo " $lddlflags " | sed -e 's/ -lc128 / /'` |
| 685 | ;; |
| 686 | esac # second fmodl$$ |
| 687 | ;; |
| 688 | esac # first fmodl$$ |
| 689 | ;; |
| 690 | esac # Checking if ... |
| 691 | ;; |
| 692 | esac # uselongdouble |
| 693 | rm -f fmodl$$.c fmodl$$ |
| 694 | ;; |
| 695 | esac # not gcc |
| 696 | |
| 697 | |
| 698 | # EOF |