1# hints/aix_3.sh 2# 3# On Tue 03 Feb 2004 split off from aix.sh by H.Merijn Brand 4# AIX 3.x.x hints thanks to Wayne Scott <wscott@ichips.intel.com> 5 6# Notes: 7# 8# - shared libperl support is tricky. if ever libperl.a ends up 9# in /usr/local/lib/* it can override any subsequent builds of 10# that same perl release. to make sure you know where the shared 11# libperl.a is coming from do a 'dump -Hv perl' and check all the 12# library search paths in the loader header. 13# 14# it would be nice to warn the user if a libperl.a exists that is 15# going to override the current build, but that would be complex. 16# 17# better yet, a solid fix for this situation should be developed. 18 19alignbytes=8 20 21case "$usemymalloc" in 22 '') usemymalloc='n' ;; 23 esac 24 25# Intuiting the existence of system calls under AIX is difficult, 26# at best; the safest technique is to find them empirically. 27 28case "$usenm" in 29 '') usenm='undef' 30 esac 31 32so="a" 33# AIX itself uses .o (libc.o) but we prefer compatibility 34# with the rest of the world and with rest of the scripting 35# languages (Tcl, Python) and related systems (SWIG). 36# Stephanie Beals <bealzy@us.ibm.com> 37dlext="so" 38 39# Take possible hint from the environment. If 32-bit is set in the 40# environment, we can override it later. If set for 64, the 41# 'sizeof' test sees a native 64-bit architecture and never looks back. 42case "$use64bitint$use64bitall$usemorebits" in 43 *$define*) cat >&4 <<EOM 44 45AIX `oslevel` does not support 64-bit interfaces. 46You should upgrade to at least AIX 4.3. 47EOM 48 exit 49 ;; 50 esac 51 52case "$usemorebits" in 53if [ "$OBJECT_MODE" = "64" ] then 54 cat >&4 <<EOF 55 56You have OBJECT_MODE=64 set in the environment. 57This would force a full 64-bit build, but AIX 3 58does not support 64bit. 59EOF 60 fi 61 62# uname -m output is too specific and not appropriate here 63case "$archname" in 64 '') archname="$osname" ;; 65 esac 66 67cc=${cc:-cc} 68d_fchmod='undef' 69ccflags="$ccflags -D_ALL_SOURCE" 70 71# These functions don't work like Perl expects them to. 72d_setregid='undef' 73d_setreuid='undef' 74 75# Configure finds setrgid and setruid, but they're useless. The man 76# pages state: 77# setrgid: The EPERM error code is always returned. 78# setruid: The EPERM error code is always returned. Processes cannot 79# reset only their real user IDs. 80d_setrgid='undef' 81d_setruid='undef' 82 83# Changes for dynamic linking by Wayne Scott <wscott@ichips.intel.com> 84# 85# Tell perl which symbols to export for dynamic linking. 86cccdlflags='none' # All AIX code is position independent 87 cc_type=xlc # do not export to config.sh 88case "$cc" in 89 *gcc*) 90 cc_type=gcc 91 ccdlflags='-Xlinker' 92 if [ "X$gccversion" = "X" ]; then 93 # Done too late in Configure if hinted 94 gccversion=`$cc -dumpversion` 95 fi 96 ;; 97 98 *) ccversion=`lslpp -L | grep 'C for AIX Compiler$' | grep -v '\.msg\.[A-Za-z_]*\.' | head -1 | awk '{print $1,$2}'` 99 case "$ccversion" in 100 '') ccversion=`lslpp -L | grep 'IBM C and C++ Compilers LUM$'` 101 ;; 102 103 *.*.*.*.*.*.*) # Ahhrgg, more than one C compiler installed 104 first_cc_path=`which ${cc:-cc}` 105 case "$first_cc_path" in 106 *vac*) 107 cc_type=vac 108 ;; 109 /usr/bin/cc) # Check the symlink 110 if [ -h $first_cc_path ]; then 111 ls -l $first_cc_path > reflect 112 if grep -i vac reflect >/dev/null 2>&1 ; then 113 cc_type=vac 114 fi 115 rm -f reflect 116 fi 117 ;; 118 esac 119 ccversion=`lslpp -L | grep 'C for AIX Compiler$' | grep -i $cc_type | head -1` 120 ;; 121 vac*.*.*.*) 122 cc_type=vac 123 ;; 124 esac 125 126 ccversion=`echo "$ccversion" | awk '{print $2}'` 127 case "$ccversion" in 128 3.6.6.0) 129 optimize='none' 130 ;; 131 4.4.0.0|4.4.0.1|4.4.0.2) 132 cat >&4 <<EOF 133*** 134*** This C compiler ($ccversion) is outdated. 135*** 136*** Please upgrade to at least 4.4.0.3. 137*** 138EOF 139 ;; 140 5.0.0.0) 141 cat >&4 <<EOF 142*** 143*** This C compiler ($ccversion) is known to have too many optimizer 144*** bugs to compile a working Perl. 145*** 146*** Consider upgrading your C compiler, or getting the GNU cc (gcc). 147*** 148*** Cannot continue, aborting. 149EOF 150 exit 1 151 ;; 152 5.0.1.0) 153 cat >&4 <<EOF 154*** 155*** This C compiler ($ccversion) is known to have optimizer problems 156*** when compiling regcomp.c. 157*** 158*** Disabling optimization for that file but consider upgrading 159*** your C compiler. 160*** 161EOF 162regcomp_cflags='optimize=' 163 ;; 164 esac 165 esac 166# the required -bE:$installarchlib/CORE/perl.exp is added by 167# libperl.U (Configure) later. 168 169# The first 3 options would not be needed if dynamic libs. could be linked 170# with the compiler instead of ld. 171# -bI:$(PERL_INC)/perl.exp Read the exported symbols from the perl binary 172# -bE:$(BASEEXT).exp Export these symbols. This file contains only one 173# symbol: boot_$(EXP) can it be auto-generated? 174lddlflags="$lddlflags -H512 -T512 -bhalt:4 -bM:SRE -bI:\$(PERL_INC)/perl.exp -bE:\$(BASEEXT).exp -e _nostart -lc" 175 176case $cc_type in 177 vac|xlc) 178 case "$uselongdouble" in 179 $define|true|[yY]*) 180 ccflags="$ccflags -qlongdouble" 181 libswanted="c128 $libswanted" 182 lddlflags=`echo "$lddlflags " | sed -e 's/ -lc / -lc128 -lc /'` 183 ;; 184 esac 185 esac 186 187case "$cc" in 188 *gcc*) ;; 189 cc*|xlc*) # cc should've been set by line 116 or so if empty. 190 if test ! -x /usr/bin/$cc -a -x /usr/vac/bin/$cc; then 191 case ":$PATH:" in 192 *:/usr/vac/bin:*) ;; 193 *) if test ! -x /QOpenSys/usr/bin/$cc; then 194 # The /QOpenSys/usr/bin/$cc saves us if we are 195 # building natively in OS/400 PASE. 196 cat >&4 <<EOF 197 198*** 199*** You either implicitly or explicitly specified an IBM C compiler, 200*** but you do not seem to have one in /usr/bin, but you seem to have 201*** the VAC installed in /usr/vac, but you do not have the /usr/vac/bin 202*** in your PATH. I suggest adding that and retrying Configure. 203*** 204EOF 205 exit 1 206 fi 207 ;; 208 esac 209 fi 210 ;; 211 esac 212 213case "$ldlibpthname" in 214 '') ldlibpthname=LIBPATH ;; 215 esac 216 217# This script UU/usethreads.cbu will get 'called-back' by Configure 218# after it has prompted the user for whether to use threads. 219cat > UU/usethreads.cbu <<'EOCBU' 220case "$usethreads" in 221 $define|true|[yY]*) 222 d_drand48_r='undef' 223 d_endgrent_r='undef' 224 d_endpwent_r='undef' 225 d_getgrent_r='undef' 226 d_getpwent_r='undef' 227 d_random_r='undef' 228 d_setgrent_r='undef' 229 d_setpwent_r='undef' 230 d_srand48_r='undef' 231 d_strerror_r='undef' 232 ccflags="$ccflags -DNEED_PTHREAD_INIT" 233 case "$cc" in 234 *gcc*) 235 ccflags="-D_THREAD_SAFE $ccflags" 236 ;; 237 cc_r) ;; 238 cc|xl[cC]_r) 239 echo >&4 "Switching cc to cc_r because of POSIX threads." 240 # xlc_r has been known to produce buggy code in AIX 4.3.2. 241 # (e.g. pragma/overload core dumps) Let's suspect xlC_r, too. 242 # --jhi@iki.fi 243 cc=cc_r 244 ;; 245 '') 246 cc=cc_r 247 ;; 248 *) 249 cat >&4 <<EOM 250*** For pthreads you should use the AIX C compiler cc_r. 251*** (now your compiler was set to '$cc') 252*** Cannot continue, aborting. 253EOM 254 exit 1 255 ;; 256 esac 257 258 # c_rify libswanted. 259 set `echo X "$libswanted "| sed -e 's/ \([cC]\) / \1_r /g'` 260 shift 261 libswanted="$*" 262 # c_rify lddlflags. 263 set `echo X "$lddlflags "| sed -e 's/ \(-l[cC]\) / \1_r /g'` 264 shift 265 lddlflags="$*" 266 267 # Insert pthreads to libswanted, before any libc or libC. 268 set `echo X "$libswanted "| sed -e 's/ \([cC]_r\) / pthreads \1 /'` 269 shift 270 libswanted="$*" 271 # Insert pthreads to lddlflags, before any libc or libC. 272 set `echo X "$lddlflags " | sed -e 's/ \(-l[cC]_r\) / -lpthreads \1 /'` 273 shift 274 lddlflags="$*" 275 ;; 276 esac 277EOCBU 278 279# This script UU/uselargefiles.cbu will get 'called-back' by Configure 280# after it has prompted the user for whether to use large files. 281cat > UU/uselargefiles.cbu <<'EOCBU' 282case "$uselargefiles" in 283 ''|$define|true|[yY]*) 284 # Configure should take care of use64bitint and use64bitall being 285 # defined before uselargefiles.cbu is consulted. 286 if test X"$use64bitint:$quadtype" = X"$define:long" -o X"$use64bitall" = Xdefine; then 287# Keep these at the left margin. 288ccflags_uselargefiles="`getconf XBS5_LP64_OFF64_CFLAGS 2>/dev/null`" 289ldflags_uselargefiles="`getconf XBS5_LP64_OFF64_LDFLAGS 2>/dev/null`" 290 else 291# Keep these at the left margin. 292ccflags_uselargefiles="`getconf XBS5_ILP32_OFFBIG_CFLAGS 2>/dev/null`" 293ldflags_uselargefiles="`getconf XBS5_ILP32_OFFBIG_LDFLAGS 2>/dev/null`" 294 fi 295 if test X"$use64bitint:$quadtype" = X"$define:long" -o X"$use64bitall" = Xdefine; then 296# Keep this at the left margin. 297libswanted_uselargefiles="`getconf XBS5_LP64_OFF64_LIBS 2>/dev/null|sed -e 's@^-l@@' -e 's@ -l@ @g'`" 298 else 299# Keep this at the left margin. 300libswanted_uselargefiles="`getconf XBS5_ILP32_OFFBIG_LIBS 2>/dev/null|sed -e 's@^-l@@' -e 's@ -l@ @g'`" 301 fi 302 case "$ccflags_uselargefiles$ldflags_uselargefiles$libs_uselargefiles" in 303 '') ;; 304 *) ccflags="$ccflags $ccflags_uselargefiles" 305 ldflags="$ldflags $ldflags_uselargefiles" 306 libswanted="$libswanted $libswanted_uselargefiles" 307 ;; 308 esac 309 case "$gccversion" in 310 '') ;; 311 *) # Remove xlc-specific -qflags. 312 ccflags="`echo $ccflags | sed -e 's@ -q[^ ]*@ @g' -e 's@^-q[^ ]* @@g'`" 313 ldflags="`echo $ldflags | sed -e 's@ -q[^ ]*@ @g' -e 's@^-q[^ ]* @@g'`" 314 # Move xlc-specific -bflags. 315 ccflags="`echo $ccflags | sed -e 's@ -b@ -Wl,-b@g'`" 316 ldflags="`echo ' '$ldflags | sed -e 's@ -b@ -Wl,-b@g'`" 317 lddlflags="`echo ' '$lddlflags | sed -e 's@ -b@ -Wl,-b@g'`" 318 ld='gcc' 319 echo >&4 "(using ccflags $ccflags)" 320 echo >&4 "(using ldflags $ldflags)" 321 echo >&4 "(using lddlflags $lddlflags)" 322 ;; 323 esac 324 ;; 325 esac 326EOCBU 327 328if test $usenativedlopen = 'true' ; then 329 ccflags="$ccflags -DUSE_NATIVE_DLOPEN" 330 case "$cc" in 331 *gcc*) ldflags="$ldflags -Wl,-brtl" ;; 332 *) ldflags="$ldflags -brtl" ;; 333 esac 334else 335 # If the C++ libraries, libC and libC_r, are available we will 336 # prefer them over the vanilla libc, because the libC contain 337 # loadAndInit() and terminateAndUnload() which work correctly 338 # with C++ statics while libc load() and unload() do not. See 339 # ext/DynaLoader/dl_aix.xs. The C-to-C_r switch is done by 340 # usethreads.cbu, if needed. 341 if test -f /lib/libC.a -a X"`$cc -v 2>&1 | grep gcc`" = X; then 342 # Cify libswanted. 343 set `echo X "$libswanted "| sed -e 's/ c / C c /'` 344 shift 345 libswanted="$*" 346 # Cify lddlflags. 347 set `echo X "$lddlflags "| sed -e 's/ -lc / -lC -lc /'` 348 shift 349 lddlflags="$*" 350 fi 351 fi 352 353# EOF 354