Do not throw away gccvers compilation errors.
[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
bbc711f9 46usemymalloc='n'
47
48# Intuiting the existence of system calls under AIX is difficult,
49# at best; the safest technique is to find them empirically.
50
51# AIX 4.3.* and above default to using nm for symbol extraction
52case "$osvers" in
53 3.*|4.1.*|4.2.*)
54 usenm='undef'
55 ;;
56 *)
57 usenm='true'
58 ;;
59esac
cc628cc3 60
3c321fdc 61so="a"
62dlext="so"
63
bbc711f9 64# Trying to set this breaks the POSIX.c compilation
65
1aef975c 66# Make setsockopt work correctly. See man page.
67# ccflags='-D_BSD=44'
68
69# uname -m output is too specific and not appropriate here
70case "$archname" in
71'') archname="$osname" ;;
72esac
73
74case "$osvers" in
753*) d_fchmod=undef
fc2c2f48 76 ccflags="$ccflags -D_ALL_SOURCE"
1aef975c 77 ;;
78*) # These hints at least work for 4.x, possibly other systems too.
fc2c2f48 79 ccflags="$ccflags -D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE"
80589958 80 case "$cc" in
81 *gcc*) ;;
fc2c2f48 82 *) ccflags="$ccflags -qmaxmem=8192" ;;
80589958 83 esac
1aef975c 84 nm_opt='-B'
1aef975c 85 ;;
86esac
87
bbc711f9 88# These functions don't work like Perl expects them to.
89d_setregid='undef'
90d_setreuid='undef'
91
1aef975c 92# Changes for dynamic linking by Wayne Scott <wscott@ichips.intel.com>
a0d0e21e 93#
94# Tell perl which symbols to export for dynamic linking.
4633a7c4 95case "$cc" in
bbc711f9 96*gcc*) ccdlflags='-Xlinker -bE:perl.exp' ;;
97*) ccdlflags='-bE:perl.exp' ;;
4633a7c4 98esac
a0d0e21e 99
100# The first 3 options would not be needed if dynamic libs. could be linked
101# with the compiler instead of ld.
42793c05 102# -bI:$(PERL_INC)/perl.exp Read the exported symbols from the perl binary
103# -bE:$(BASEEXT).exp Export these symbols. This file contains only one
104# symbol: boot_$(EXP) can it be auto-generated?
c07a80fd 105case "$osvers" in
1063*)
fa9667c9 107 lddlflags="$lddlflags -H512 -T512 -bhalt:4 -bM:SRE -bI:$(PERL_INC)/perl.exp -bE:$(BASEEXT).exp -e _nostart"
c07a80fd 108 ;;
109*)
fa9667c9 110 lddlflags="$lddlflags -bhalt:4 -bM:SRE -bI:$(PERL_INC)/perl.exp -bE:$(BASEEXT).exp -b noentry"
b691c02f 111 ;;
c07a80fd 112esac
52e1cb5e 113
bbc711f9 114#
115# if $ccflags contains -DSOCKS, then add socks library support.
116#
117# SOCKS support also requires each source module with socket support
118# add the following lines directly after the #include <socket.h>:
119#
120# #ifdef SOCKS
121# #include <socks.h>
122# #endif
123#
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
137 echo >&4 "SOCKS using $incpath/socks.h and $libpath/lib${sockslib}.a"
138 echo >&4 "SOCKS requires source modifications. #include <socket.h> must change to:"
139 echo >&4
140 echo >&4 " #include <socket.h>"
141 echo >&4 " #ifdef SOCKS"
142 echo >&4 " #include <socks.h>"
143 echo >&4 " #endif"
144 echo >&4
145 echo >&4 "in some or all of the following files:"
146 echo >&4
147
148 for arg in `find . \( -name '*.c' -o -name '*.xs' -o -name '*.h' \) \
149 -exec egrep -l '#.*include.*socket\.h' {} \; | \
150 egrep -v "win32|vms|t/lib|Socket.c` ; do
151 echo >&4 " $arg"
152 done
153
154 echo >&4
155
156 lddlflags="$lddlflags -l$sockslib"
157
158 # setting $libs here breaks the optional libraries search
159 # for some reason, so use $libswanted instead
160 #libs="$libs -lsocks5"
161
162 libswanted="$libswanted $sockslib"
163
164 #
165 # path for include file
166 #
167
168 locincpth="$locincpath /usr/local/include"
169
170 #
171 # path for library not needed, if in /usr/local/lib as that
172 # directory is already searched.
173 #
174
175 #loclibpth="$loclibpath /usr/local/lib"
176
177 break
178
179 fi
180
181done
182
183lddllibc="-lc"
184
104d25b7 185# This script UU/usethreads.cbu will get 'called-back' by Configure
186# after it has prompted the user for whether to use threads.
187cat > UU/usethreads.cbu <<'EOCBU'
188case "$usethreads" in
189$define|true|[yY]*)
190 ccflags="$ccflags -DNEED_PTHREAD_INIT"
191 case "$cc" in
bbc711f9 192 gcc) ;;
193 cc_r) ;;
194 cc|xlc_r)
195 echo >&4 "Switching cc to cc_r because of POSIX threads."
196 # xlc_r has been known to produce buggy code in AIX 4.3.2.
197 # (e.g. pragma/overload core dumps)
198 # --jhi@iki.fi
199 cc=cc_r
104d25b7 200 ;;
bbc711f9 201 '')
202 cc=cc_r
104d25b7 203 ;;
204 *)
205 cat >&4 <<EOM
bbc711f9 206For pthreads you should use the AIX C compiler cc_r.
104d25b7 207(now your compiler was '$cc')
208Cannot continue, aborting.
209EOM
210 exit 1
211 ;;
212 esac
213
214 # Add the POSIX threads library and the re-entrant libc.
215
bbc711f9 216 lddllibc="-lpthreads -lc_r"
104d25b7 217
218 # Add the c_r library to the list of wanted libraries.
219 # Make sure the c_r library is before the c library or
220 # make will fail.
bbc711f9 221 set `echo X "$libswanted "| sed -e 's/ c / pthreads c_r /'`
104d25b7 222 shift
223 libswanted="$*"
224 ;;
225esac
bbc711f9 226
104d25b7 227EOCBU
fa9667c9 228
229lddlflags="$lddlflags $lddllibc"