AIX threaded build, plus few more on the side.
[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
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
20# - added support for socks, when Dccflags=-DSOCKS specified
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
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"
64dlext="so"
65
bbc711f9 66# Trying to set this breaks the POSIX.c compilation
67
1aef975c 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
72case "$archname" in
73'') archname="$osname" ;;
74esac
75
76case "$osvers" in
773*) d_fchmod=undef
fc2c2f48 78 ccflags="$ccflags -D_ALL_SOURCE"
1aef975c 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 87 ;;
88esac
89
bbc711f9 90# These functions don't work like Perl expects them to.
91d_setregid='undef'
92d_setreuid='undef'
93
1aef975c 94# Changes for dynamic linking by Wayne Scott <wscott@ichips.intel.com>
a0d0e21e 95#
96# Tell perl which symbols to export for dynamic linking.
4633a7c4 97case "$cc" in
bbc711f9 98*gcc*) ccdlflags='-Xlinker -bE:perl.exp' ;;
99*) ccdlflags='-bE:perl.exp' ;;
4633a7c4 100esac
a0d0e21e 101
102# The first 3 options would not be needed if dynamic libs. could be linked
103# with the compiler instead of ld.
42793c05 104# -bI:$(PERL_INC)/perl.exp Read the exported symbols from the perl binary
105# -bE:$(BASEEXT).exp Export these symbols. This file contains only one
106# symbol: boot_$(EXP) can it be auto-generated?
c07a80fd 107case "$osvers" in
1083*)
5b877257 109 lddlflags="$lddlflags -H512 -T512 -bhalt:4 -bM:SRE -bI:$(PERL_INC)/perl.exp -bE:$(BASEEXT).exp -e _nostart -lc"
c07a80fd 110 ;;
111*)
5b877257 112 lddlflags="$lddlflags -bhalt:4 -bM:SRE -bI:$(PERL_INC)/perl.exp -bE:$(BASEEXT).exp -b noentry -lc"
b691c02f 113 ;;
c07a80fd 114esac
52e1cb5e 115
86959918 116# Save this for backward compatibility for now.
117# Configure already (5.005_58) knows how to probe for
118# <socks.h> and libsocks. What sucks is that the name
119# of the socks library seems to be version dependent
120# (e.g. libsocks5), bleagh.
bbc711f9 121#
122# if $ccflags contains -DSOCKS, then add socks library support.
123#
bbc711f9 124# It is expected that libsocks.a resides in /usr/local/lib and that
125# socks.h resides in /usr/local/include. If these files live some
126# different place then modify
127#
128
129for arg in $ccflags ; do
130
131 if [ "$arg" = "-DSOCKS" ] ; then
132
133 sockslib=socks5
134 incpath=/usr/local/include
135 libpath=/usr/local/lib
136
bbc711f9 137 lddlflags="$lddlflags -l$sockslib"
138
139 # setting $libs here breaks the optional libraries search
140 # for some reason, so use $libswanted instead
141 #libs="$libs -lsocks5"
142
143 libswanted="$libswanted $sockslib"
144
145 #
146 # path for include file
147 #
148
149 locincpth="$locincpath /usr/local/include"
150
151 #
152 # path for library not needed, if in /usr/local/lib as that
153 # directory is already searched.
154 #
155
156 #loclibpth="$loclibpath /usr/local/lib"
157
158 break
159
160 fi
161
162done
163
104d25b7 164# This script UU/usethreads.cbu will get 'called-back' by Configure
165# after it has prompted the user for whether to use threads.
166cat > UU/usethreads.cbu <<'EOCBU'
167case "$usethreads" in
168$define|true|[yY]*)
169 ccflags="$ccflags -DNEED_PTHREAD_INIT"
170 case "$cc" in
bbc711f9 171 gcc) ;;
172 cc_r) ;;
173 cc|xlc_r)
174 echo >&4 "Switching cc to cc_r because of POSIX threads."
175 # xlc_r has been known to produce buggy code in AIX 4.3.2.
176 # (e.g. pragma/overload core dumps)
177 # --jhi@iki.fi
178 cc=cc_r
104d25b7 179 ;;
bbc711f9 180 '')
181 cc=cc_r
104d25b7 182 ;;
183 *)
184 cat >&4 <<EOM
bbc711f9 185For pthreads you should use the AIX C compiler cc_r.
104d25b7 186(now your compiler was '$cc')
187Cannot continue, aborting.
188EOM
189 exit 1
190 ;;
191 esac
192
5b877257 193 # Add the POSIX threads library and the re-entrant libc to lddflags.
194 set `echo X "$lddlflags"| sed -e 's/ -lc$/ -lpthreads -lc_r/'`
195 shift
196 lddlflags="$*"
104d25b7 197
5b877257 198 # Add the POSIX threads library and the re-entrant libc to libswanted.
104d25b7 199 # Make sure the c_r library is before the c library or
200 # make will fail.
bbc711f9 201 set `echo X "$libswanted "| sed -e 's/ c / pthreads c_r /'`
104d25b7 202 shift
203 libswanted="$*"
204 ;;
205esac
206EOCBU
fa9667c9 207
efeaa891 208# This script UU/use64bits.cbu will get 'called-back' by Configure
209# after it has prompted the user for whether to use 64 bits.
210cat > UU/use64bits.cbu <<'EOCBU'
211case "$use64bits" in
212$define|true|[yY]*)
213 case "`uname -r`" in
214 3.*|4.[012].*)
215 cat >&4 <<EOM
216AIX `uname -r` does not support 64-bit interfaces.
217You should upgrade to at least AIX 4.3.
218EOM
219 exit 1
220 ;;
221 esac
222 ccflags="$ccflags `getconf XBS5_LPBIG_OFFBIG_CFLAGS`"
223 ccflags="$ccflags -DUSE_LONG_LONG"
224 ldflags="$ldflags `getconf XBS5_LPBIG_OFFBIG_LDFLAGS`"
225 libswanted="$libswanted `getconf XBS5_LPBIG_OFFBIG_LIBS`"
226 # When a 64-bit cc becomes available $archname64
227 # may need setting so that $archname gets it attached.
228 ;;
229esac
230EOCBU
5b877257 231
232# EOF