don't blindly set bool=char on linux (from Andy Dougherty)
[p5sagit/p5-mst-13.2.git] / hints / aix.sh
CommitLineData
1aef975c 1# hints/aix.sh
2# AIX 3.x.x hints thanks to Wayne Scott <wscott@ichips.intel.com>
3# AIX 4.1 hints thanks to Christopher Chan-Nui <channui@austin.ibm.com>.
52e1cb5e 4# AIX 4.1 pthreading by Christopher Chan-Nui <channui@austin.ibm.com> and
4e774c84 5# Jarkko Hietaniemi <jhi@iki.fi>.
1aef975c 6# Merged on Mon Feb 6 10:22:35 EST 1995 by
7# Andy Dougherty <doughera@lafcol.lafayette.edu>
8
bbc711f9 9#
10# Contact dfavor@corridor.com for any of the following:
11#
12# - AIX 43x and above support
13# - gcc + threads support
14# - socks support
15#
16# Apr 99 changes:
17#
18# - use nm in AIX 43x and above
19# - gcc + threads now builds
29209bc5 20# [(added support for socks) Jul 99 SOCKS support rewritten]
bbc711f9 21#
22# Notes:
23#
24# - shared libperl support is tricky. if ever libperl.a ends up
25# in /usr/local/lib/* it can override any subsequent builds of
26# that same perl release. to make sure you know where the shared
27# libperl.a is coming from do a 'dump -Hv perl' and check all the
28# library search paths in the loader header.
29#
30# it would be nice to warn the user if a libperl.a exists that is
31# going to override the current build, but that would be complex.
32#
33# better yet, a solid fix for this situation should be developed.
34#
1aef975c 35
36# Configure finds setrgid and setruid, but they're useless. The man
37# pages state:
38# setrgid: The EPERM error code is always returned.
39# setruid: The EPERM error code is always returned. Processes cannot
4e774c84 40# reset only their real user IDs.
a0d0e21e 41d_setrgid='undef'
42d_setruid='undef'
1aef975c 43
5f3774a9 44alignbytes=8
a5f75d66 45
86959918 46case "$usemymalloc" in
47'') usemymalloc='n' ;;
48esac
bbc711f9 49
50# Intuiting the existence of system calls under AIX is difficult,
51# at best; the safest technique is to find them empirically.
52
53# AIX 4.3.* and above default to using nm for symbol extraction
54case "$osvers" in
55 3.*|4.1.*|4.2.*)
56 usenm='undef'
57 ;;
58 *)
59 usenm='true'
60 ;;
61esac
cc628cc3 62
3c321fdc 63so="a"
0d9ec2f4 64# AIX itself uses .o (libc.o) but we prefer compatibility
65# with the rest of the world and with rest of the scripting
66# languages (Tcl, Python) and related systems (SWIG).
67# Stephanie Beals <bealzy@us.ibm.com>
68dlext="so"
3c321fdc 69
bbc711f9 70# Trying to set this breaks the POSIX.c compilation
71
1aef975c 72# Make setsockopt work correctly. See man page.
73# ccflags='-D_BSD=44'
74
75# uname -m output is too specific and not appropriate here
76case "$archname" in
77'') archname="$osname" ;;
78esac
79
bd9b35c9 80cc=${cc:-cc}
81
1aef975c 82case "$osvers" in
833*) d_fchmod=undef
fc2c2f48 84 ccflags="$ccflags -D_ALL_SOURCE"
1aef975c 85 ;;
86*) # These hints at least work for 4.x, possibly other systems too.
fc2c2f48 87 ccflags="$ccflags -D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE"
80589958 88 case "$cc" in
89 *gcc*) ;;
86959918 90 *) ccflags="$ccflags -qmaxmem=16384" ;;
80589958 91 esac
1aef975c 92 nm_opt='-B'
1aef975c 93 ;;
94esac
95
bbc711f9 96# These functions don't work like Perl expects them to.
97d_setregid='undef'
98d_setreuid='undef'
99
1aef975c 100# Changes for dynamic linking by Wayne Scott <wscott@ichips.intel.com>
a0d0e21e 101#
102# Tell perl which symbols to export for dynamic linking.
4633a7c4 103case "$cc" in
5f9d9a17 104*gcc*) ccdlflags='-Xlinker' ;;
4633a7c4 105esac
5f9d9a17 106# the required -bE:$installarchlib/CORE/perl.exp is added by
107# libperl.U (Configure) later.
a0d0e21e 108
5cf1d1f1 109case "$ldlibpthname" in
110'') ldlibpthname=LIBPATH ;;
111esac
112
a0d0e21e 113# The first 3 options would not be needed if dynamic libs. could be linked
114# with the compiler instead of ld.
42793c05 115# -bI:$(PERL_INC)/perl.exp Read the exported symbols from the perl binary
4e774c84 116# -bE:$(BASEEXT).exp Export these symbols. This file contains only one
117# symbol: boot_$(EXP) can it be auto-generated?
c07a80fd 118case "$osvers" in
1193*)
6c79d5f6 120 lddlflags="$lddlflags -H512 -T512 -bhalt:4 -bM:SRE -bI:\$(PERL_INC)/perl.exp -bE:\$(BASEEXT).exp -e _nostart -lc"
c07a80fd 121 ;;
122*)
6c79d5f6 123 lddlflags="$lddlflags -bhalt:4 -bM:SRE -bI:\$(PERL_INC)/perl.exp -bE:\$(BASEEXT).exp -b noentry -lc"
b691c02f 124 ;;
c07a80fd 125esac
52e1cb5e 126
104d25b7 127# This script UU/usethreads.cbu will get 'called-back' by Configure
128# after it has prompted the user for whether to use threads.
129cat > UU/usethreads.cbu <<'EOCBU'
130case "$usethreads" in
131$define|true|[yY]*)
4e774c84 132 ccflags="$ccflags -DNEED_PTHREAD_INIT"
133 case "$cc" in
134 gcc) ;;
135 cc_r) ;;
136 cc|xl[cC]_r)
bbc711f9 137 echo >&4 "Switching cc to cc_r because of POSIX threads."
138 # xlc_r has been known to produce buggy code in AIX 4.3.2.
4e774c84 139 # (e.g. pragma/overload core dumps) Let's suspect xlC_r, too.
bbc711f9 140 # --jhi@iki.fi
141 cc=cc_r
4e774c84 142 ;;
143 '')
bbc711f9 144 cc=cc_r
4e774c84 145 ;;
146 *)
147 cat >&4 <<EOM
bbc711f9 148For pthreads you should use the AIX C compiler cc_r.
549a6b10 149(now your compiler was set to '$cc')
104d25b7 150Cannot continue, aborting.
151EOM
4e774c84 152 exit 1
104d25b7 153 ;;
4e774c84 154 esac
155
c88be79f 156 # c_rify libswanted.
157 set `echo X "$libswanted "| sed -e 's/ \([cC]\) / \1_r /g'`
158 shift
159 libswanted="$*"
160 # c_rify lddlflags.
161 set `echo X "$lddlflags "| sed -e 's/ \(-l[cC]\) / \1_r /g'`
162 shift
163 lddlflags="$*"
164
165 # Insert pthreads to libswanted, before any libc or libC.
166 set `echo X "$libswanted "| sed -e 's/ \([cC]\) / pthreads \1 /'`
167 shift
168 libswanted="$*"
169 # Insert pthreads to lddlflags, before any libc or libC.
170 set `echo X "$lddlflags " | sed -e 's/ \(-l[cC]\) / -lpthreads \1 /'`
171 shift
172 lddlflags="$*"
173
104d25b7 174 ;;
175esac
176EOCBU
fa9667c9 177
bd9b35c9 178# This script UU/uselfs.cbu will get 'called-back' by Configure
179# after it has prompted the user for whether to use large files.
180cat > UU/uselfs.cbu <<'EOCBU'
181case "$uselargefiles" in
182$define|true|[yY]*)
6b8eaf93 183 lfcflags="`getconf XBS5_ILP32_OFFBIG_CFLAGS 2>/dev/null`"
184 lfldflags="`getconf XBS5_ILP32_OFFBIG_LDFLAGS 2>/dev/null`"
185 # _Somehow_ in AIX 4.3.1.0 the above getconf call manages to
186 # insert(?) *something* to $ldflags so that later (in Configure) evaluating
187 # $ldflags causes a newline after the '-b64' (the result of the getconf).
188 # (nothing strange shows up in $ldflags even in hexdump;
189 # so it may be something in the shell, instead?)
190 # Try it out: just uncomment the below line and rerun Configure:
191# echo >&4 "AIX 4.3.1.0 $lfldflags mystery" ; exit 1
192 # Just don't ask me how AIX does it, I spent hours wondering.
193 # Therefore the line re-evaluating lfldflags: it seems to fix
194 # the whatever it was that AIX managed to break. --jhi
195 lfldflags="`echo $lfldflags`"
196 lflibs="`getconf XBS5_ILP32_OFFBIG_LIBS 2>/dev/null|sed -e 's@^-l@@' -e 's@ -l@ @g`"
bd9b35c9 197 case "$lfcflags$lfldflags$lflibs" in
198 '');;
199 *) ccflags="$ccflags $lfcflags"
200 ldflags="$ldflags $ldldflags"
201 libswanted="$libswanted $lflibs"
202 ;;
203 esac
6b8eaf93 204 lfcflags=''
205 lfldflags=''
206 lflibs=''
bd9b35c9 207 ;;
208esac
209EOCBU
6b8eaf93 210
efeaa891 211# This script UU/use64bits.cbu will get 'called-back' by Configure
212# after it has prompted the user for whether to use 64 bits.
213cat > UU/use64bits.cbu <<'EOCBU'
214case "$use64bits" in
215$define|true|[yY]*)
2d4389e4 216 case "`oslevel`" in
efeaa891 217 3.*|4.[012].*)
218 cat >&4 <<EOM
2d4389e4 219AIX `oslevel` does not support 64-bit interfaces.
220You should upgrade to at least AIX 4.2.
efeaa891 221EOM
222 exit 1
223 ;;
224 esac
d7d93a81 225 case "$ccflags" in
ad551343 226 *-DUSE_64_BITS*) ;;
227 *) ccflags="$ccflags -DUSE_64_BITS" ;;
d7d93a81 228 esac
efeaa891 229 # When a 64-bit cc becomes available $archname64
230 # may need setting so that $archname gets it attached.
231 ;;
232esac
233EOCBU
5b877257 234
d9b3e12d 235# This script UU/uselongdouble.cbu will get 'called-back' by Configure
2d4389e4 236# after it has prompted the user for whether to use long doubles.
d9b3e12d 237cat > UU/uselongdouble.cbu <<'EOCBU'
238case "$uselongdouble" in
239$define|true|[yY]*)
240 ccflags="$ccflags -qlongdouble"
4e774c84 241 # The explicit cc128, xlc128, xlC128 are not needed,
242 # the -qlongdouble should do the trick. --jhi
d9b3e12d 243 ;;
244esac
245EOCBU
246
c88be79f 247# If the C++ libraries, libC and libC_r, are available we will prefer them
248# over the vanilla libc, because the libC contain loadAndInit() and
4e774c84 249# terminateAndUnload() which work correctly with C++ statics while libc
250# load() and unload() do not. See ext/DynaLoader/dl_aix.xs.
c88be79f 251# The C-to-C_r switch is done by usethreads.cbu, if needed.
0903b405 252if test -f /lib/libC.a -a X"`$cc -v 2>&1 | grep gcc`" = X; then
e32161bd 253 # Cify libswanted.
254 set `echo X "$libswanted "| sed -e 's/ c / C c /'`
255 shift
256 libswanted="$*"
257 # Cify lddlflags.
258 set `echo X "$lddlflags "| sed -e 's/ -lc / -lC -lc /'`
259 shift
260 lddlflags="$*"
c88be79f 261fi
4e774c84 262
5b877257 263# EOF