Commit | Line | Data |
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 |
41 | d_setrgid='undef' |
42 | d_setruid='undef' |
1aef975c |
43 | |
5f3774a9 |
44 | alignbytes=8 |
a5f75d66 |
45 | |
86959918 |
46 | case "$usemymalloc" in |
47 | '') usemymalloc='n' ;; |
48 | esac |
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 |
54 | case "$osvers" in |
55 | 3.*|4.1.*|4.2.*) |
56 | usenm='undef' |
57 | ;; |
58 | *) |
59 | usenm='true' |
60 | ;; |
61 | esac |
cc628cc3 |
62 | |
3c321fdc |
63 | so="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> |
68 | dlext="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 |
76 | case "$archname" in |
77 | '') archname="$osname" ;; |
78 | esac |
79 | |
80 | case "$osvers" in |
81 | 3*) d_fchmod=undef |
fc2c2f48 |
82 | ccflags="$ccflags -D_ALL_SOURCE" |
1aef975c |
83 | ;; |
84 | *) # These hints at least work for 4.x, possibly other systems too. |
fc2c2f48 |
85 | ccflags="$ccflags -D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE" |
80589958 |
86 | case "$cc" in |
87 | *gcc*) ;; |
86959918 |
88 | *) ccflags="$ccflags -qmaxmem=16384" ;; |
80589958 |
89 | esac |
1aef975c |
90 | nm_opt='-B' |
1aef975c |
91 | ;; |
92 | esac |
93 | |
bbc711f9 |
94 | # These functions don't work like Perl expects them to. |
95 | d_setregid='undef' |
96 | d_setreuid='undef' |
97 | |
1aef975c |
98 | # Changes for dynamic linking by Wayne Scott <wscott@ichips.intel.com> |
a0d0e21e |
99 | # |
100 | # Tell perl which symbols to export for dynamic linking. |
4633a7c4 |
101 | case "$cc" in |
5f9d9a17 |
102 | *gcc*) ccdlflags='-Xlinker' ;; |
4633a7c4 |
103 | esac |
5f9d9a17 |
104 | # the required -bE:$installarchlib/CORE/perl.exp is added by |
105 | # libperl.U (Configure) later. |
a0d0e21e |
106 | |
5cf1d1f1 |
107 | case "$ldlibpthname" in |
108 | '') ldlibpthname=LIBPATH ;; |
109 | esac |
110 | |
a0d0e21e |
111 | # The first 3 options would not be needed if dynamic libs. could be linked |
112 | # with the compiler instead of ld. |
42793c05 |
113 | # -bI:$(PERL_INC)/perl.exp Read the exported symbols from the perl binary |
4e774c84 |
114 | # -bE:$(BASEEXT).exp Export these symbols. This file contains only one |
115 | # symbol: boot_$(EXP) can it be auto-generated? |
c07a80fd |
116 | case "$osvers" in |
117 | 3*) |
5b877257 |
118 | lddlflags="$lddlflags -H512 -T512 -bhalt:4 -bM:SRE -bI:$(PERL_INC)/perl.exp -bE:$(BASEEXT).exp -e _nostart -lc" |
c07a80fd |
119 | ;; |
120 | *) |
5b877257 |
121 | lddlflags="$lddlflags -bhalt:4 -bM:SRE -bI:$(PERL_INC)/perl.exp -bE:$(BASEEXT).exp -b noentry -lc" |
b691c02f |
122 | ;; |
c07a80fd |
123 | esac |
52e1cb5e |
124 | |
104d25b7 |
125 | # This script UU/usethreads.cbu will get 'called-back' by Configure |
126 | # after it has prompted the user for whether to use threads. |
127 | cat > UU/usethreads.cbu <<'EOCBU' |
128 | case "$usethreads" in |
129 | $define|true|[yY]*) |
4e774c84 |
130 | ccflags="$ccflags -DNEED_PTHREAD_INIT" |
131 | case "$cc" in |
132 | gcc) ;; |
133 | cc_r) ;; |
134 | cc|xl[cC]_r) |
bbc711f9 |
135 | echo >&4 "Switching cc to cc_r because of POSIX threads." |
136 | # xlc_r has been known to produce buggy code in AIX 4.3.2. |
4e774c84 |
137 | # (e.g. pragma/overload core dumps) Let's suspect xlC_r, too. |
bbc711f9 |
138 | # --jhi@iki.fi |
139 | cc=cc_r |
549a6b10 |
140 | if test ! -e /bin/cc_r; then |
4e774c84 |
141 | cat >&4 <<EOM |
549a6b10 |
142 | For pthreads you should use the AIX C compiler cc_r. |
4e774c84 |
143 | But I cannot find it as /bin/cc_r. |
549a6b10 |
144 | Cannot continue, aborting. |
145 | EOM |
146 | fi |
4e774c84 |
147 | ;; |
148 | '') |
bbc711f9 |
149 | cc=cc_r |
4e774c84 |
150 | ;; |
151 | *) |
152 | cat >&4 <<EOM |
bbc711f9 |
153 | For pthreads you should use the AIX C compiler cc_r. |
549a6b10 |
154 | (now your compiler was set to '$cc') |
104d25b7 |
155 | Cannot continue, aborting. |
156 | EOM |
4e774c84 |
157 | exit 1 |
104d25b7 |
158 | ;; |
4e774c84 |
159 | esac |
160 | |
c88be79f |
161 | # c_rify libswanted. |
162 | set `echo X "$libswanted "| sed -e 's/ \([cC]\) / \1_r /g'` |
163 | shift |
164 | libswanted="$*" |
165 | # c_rify lddlflags. |
166 | set `echo X "$lddlflags "| sed -e 's/ \(-l[cC]\) / \1_r /g'` |
167 | shift |
168 | lddlflags="$*" |
169 | |
170 | # Insert pthreads to libswanted, before any libc or libC. |
171 | set `echo X "$libswanted "| sed -e 's/ \([cC]\) / pthreads \1 /'` |
172 | shift |
173 | libswanted="$*" |
174 | # Insert pthreads to lddlflags, before any libc or libC. |
175 | set `echo X "$lddlflags " | sed -e 's/ \(-l[cC]\) / -lpthreads \1 /'` |
176 | shift |
177 | lddlflags="$*" |
178 | |
104d25b7 |
179 | ;; |
180 | esac |
181 | EOCBU |
fa9667c9 |
182 | |
6b8eaf93 |
183 | # Turn on largefileness, if available. |
184 | lfcflags="`getconf XBS5_ILP32_OFFBIG_CFLAGS 2>/dev/null`" |
185 | lfldflags="`getconf XBS5_ILP32_OFFBIG_LDFLAGS 2>/dev/null`" |
186 | # _Somehow_ in AIX 4.3.1.0 the above getconf call manages to |
187 | # insert(?) *something* to $ldflags so that later (in Configure) evaluating |
188 | # $ldflags causes a newline after the '-b64' (the result of the getconf). |
189 | # (nothing strange shows up in $ldflags even in hexdump; |
190 | # so it may be something in the shell, instead?) |
191 | # Try it out: just uncomment the below line and rerun Configure: |
192 | # echo >&4 "AIX 4.3.1.0 $lfldflags mystery" ; exit 1 |
193 | # Just don't ask me how AIX does it, I spent hours wondering. |
194 | # Therefore the line re-evaluating lfldflags: it seems to fix |
195 | # the whatever it was that AIX managed to break. --jhi |
196 | lfldflags="`echo $lfldflags`" |
197 | lflibs="`getconf XBS5_ILP32_OFFBIG_LIBS 2>/dev/null|sed -e 's@^-l@@' -e 's@ -l@ @g`" |
198 | case "$lfcflags$lfldflags$lflibs" in |
199 | '');; |
200 | *) ccflags="$ccflags $lfcflags" |
201 | ldflags="$ldflags $ldldflags" |
202 | libswanted="$libswanted $lflibs" |
203 | ;; |
204 | esac |
205 | lfcflags='' |
206 | lfldflags='' |
207 | lflibs='' |
208 | |
efeaa891 |
209 | # This script UU/use64bits.cbu will get 'called-back' by Configure |
210 | # after it has prompted the user for whether to use 64 bits. |
211 | cat > UU/use64bits.cbu <<'EOCBU' |
212 | case "$use64bits" in |
213 | $define|true|[yY]*) |
2d4389e4 |
214 | case "`oslevel`" in |
efeaa891 |
215 | 3.*|4.[012].*) |
216 | cat >&4 <<EOM |
2d4389e4 |
217 | AIX `oslevel` does not support 64-bit interfaces. |
218 | You should upgrade to at least AIX 4.2. |
efeaa891 |
219 | EOM |
220 | exit 1 |
221 | ;; |
222 | esac |
d7d93a81 |
223 | case "$ccflags" in |
224 | *-DUSE_LONG_LONG*) ;; |
225 | *) ccflags="$ccflags -DUSE_LONG_LONG" ;; |
226 | esac |
efeaa891 |
227 | # When a 64-bit cc becomes available $archname64 |
228 | # may need setting so that $archname gets it attached. |
229 | ;; |
230 | esac |
231 | EOCBU |
5b877257 |
232 | |
d9b3e12d |
233 | # This script UU/uselongdouble.cbu will get 'called-back' by Configure |
2d4389e4 |
234 | # after it has prompted the user for whether to use long doubles. |
d9b3e12d |
235 | cat > UU/uselongdouble.cbu <<'EOCBU' |
236 | case "$uselongdouble" in |
237 | $define|true|[yY]*) |
238 | ccflags="$ccflags -qlongdouble" |
4e774c84 |
239 | # The explicit cc128, xlc128, xlC128 are not needed, |
240 | # the -qlongdouble should do the trick. --jhi |
d9b3e12d |
241 | ;; |
242 | esac |
243 | EOCBU |
244 | |
c88be79f |
245 | # If the C++ libraries, libC and libC_r, are available we will prefer them |
246 | # over the vanilla libc, because the libC contain loadAndInit() and |
4e774c84 |
247 | # terminateAndUnload() which work correctly with C++ statics while libc |
248 | # load() and unload() do not. See ext/DynaLoader/dl_aix.xs. |
c88be79f |
249 | # The C-to-C_r switch is done by usethreads.cbu, if needed. |
0903b405 |
250 | if test -f /lib/libC.a -a X"`$cc -v 2>&1 | grep gcc`" = X; then |
e32161bd |
251 | # Cify libswanted. |
252 | set `echo X "$libswanted "| sed -e 's/ c / C c /'` |
253 | shift |
254 | libswanted="$*" |
255 | # Cify lddlflags. |
256 | set `echo X "$lddlflags "| sed -e 's/ -lc / -lC -lc /'` |
257 | shift |
258 | lddlflags="$*" |
c88be79f |
259 | fi |
4e774c84 |
260 | |
5b877257 |
261 | # EOF |