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