3 # On Tue 03 Feb 2004 split off from aix.sh by H.Merijn Brand
4 # AIX 3.x.x hints thanks to Wayne Scott <wscott@ichips.intel.com>
8 # - shared libperl support is tricky. if ever libperl.a ends up
9 # in /usr/local/lib/* it can override any subsequent builds of
10 # that same perl release. to make sure you know where the shared
11 # libperl.a is coming from do a 'dump -Hv perl' and check all the
12 # library search paths in the loader header.
14 # it would be nice to warn the user if a libperl.a exists that is
15 # going to override the current build, but that would be complex.
17 # better yet, a solid fix for this situation should be developed.
21 case "$usemymalloc" in
22 '') usemymalloc='n' ;;
25 # Intuiting the existence of system calls under AIX is difficult,
26 # at best; the safest technique is to find them empirically.
33 # AIX itself uses .o (libc.o) but we prefer compatibility
34 # with the rest of the world and with rest of the scripting
35 # languages (Tcl, Python) and related systems (SWIG).
36 # Stephanie Beals <bealzy@us.ibm.com>
39 # Take possible hint from the environment. If 32-bit is set in the
40 # environment, we can override it later. If set for 64, the
41 # 'sizeof' test sees a native 64-bit architecture and never looks back.
42 case "$use64bitint$use64bitall$usemorebits" in
43 *$define*) cat >&4 <<EOM
45 AIX `oslevel` does not support 64-bit interfaces.
46 You should upgrade to at least AIX 4.3.
52 case "$usemorebits" in
53 if [ "$OBJECT_MODE" = "64" ] then
56 You have OBJECT_MODE=64 set in the environment.
57 This would force a full 64-bit build, but AIX 3
58 does not support 64bit.
62 # uname -m output is too specific and not appropriate here
64 '') archname="$osname" ;;
69 ccflags="$ccflags -D_ALL_SOURCE"
71 # These functions don't work like Perl expects them to.
75 # Configure finds setrgid and setruid, but they're useless. The man
77 # setrgid: The EPERM error code is always returned.
78 # setruid: The EPERM error code is always returned. Processes cannot
79 # reset only their real user IDs.
83 # Changes for dynamic linking by Wayne Scott <wscott@ichips.intel.com>
85 # Tell perl which symbols to export for dynamic linking.
86 cccdlflags='none' # All AIX code is position independent
87 cc_type=xlc # do not export to config.sh
92 if [ "X$gccversion" = "X" ]; then
93 # Done too late in Configure if hinted
94 gccversion=`$cc -dumpversion`
98 *) ccversion=`lslpp -L | grep 'C for AIX Compiler$' | grep -v '\.msg\.[A-Za-z_]*\.' | head -1 | awk '{print $1,$2}'`
100 '') ccversion=`lslpp -L | grep 'IBM C and C++ Compilers LUM$'`
103 *.*.*.*.*.*.*) # Ahhrgg, more than one C compiler installed
104 first_cc_path=`which ${cc:-cc}`
105 case "$first_cc_path" in
109 /usr/bin/cc) # Check the symlink
110 if [ -h $first_cc_path ]; then
111 ls -l $first_cc_path > reflect
112 if grep -i vac reflect >/dev/null 2>&1 ; then
119 ccversion=`lslpp -L | grep 'C for AIX Compiler$' | grep -i $cc_type | head -1`
126 ccversion=`echo "$ccversion" | awk '{print $2}'`
131 4.4.0.0|4.4.0.1|4.4.0.2)
134 *** This C compiler ($ccversion) is outdated.
136 *** Please upgrade to at least 4.4.0.3.
143 *** This C compiler ($ccversion) is known to have too many optimizer
144 *** bugs to compile a working Perl.
146 *** Consider upgrading your C compiler, or getting the GNU cc (gcc).
148 *** Cannot continue, aborting.
155 *** This C compiler ($ccversion) is known to have optimizer problems
156 *** when compiling regcomp.c.
158 *** Disabling optimization for that file but consider upgrading
162 regcomp_cflags='optimize='
166 # the required -bE:$installarchlib/CORE/perl.exp is added by
167 # libperl.U (Configure) later.
169 # The first 3 options would not be needed if dynamic libs. could be linked
170 # with the compiler instead of ld.
171 # -bI:$(PERL_INC)/perl.exp Read the exported symbols from the perl binary
172 # -bE:$(BASEEXT).exp Export these symbols. This file contains only one
173 # symbol: boot_$(EXP) can it be auto-generated?
174 lddlflags="$lddlflags -H512 -T512 -bhalt:4 -bM:SRE -bI:\$(PERL_INC)/perl.exp -bE:\$(BASEEXT).exp -e _nostart -lc"
178 case "$uselongdouble" in
180 ccflags="$ccflags -qlongdouble"
181 libswanted="c128 $libswanted"
182 lddlflags=`echo "$lddlflags " | sed -e 's/ -lc / -lc128 -lc /'`
189 cc*|xlc*) # cc should've been set by line 116 or so if empty.
190 if test ! -x /usr/bin/$cc -a -x /usr/vac/bin/$cc; then
193 *) if test ! -x /QOpenSys/usr/bin/$cc; then
194 # The /QOpenSys/usr/bin/$cc saves us if we are
195 # building natively in OS/400 PASE.
199 *** You either implicitly or explicitly specified an IBM C compiler,
200 *** but you do not seem to have one in /usr/bin, but you seem to have
201 *** the VAC installed in /usr/vac, but you do not have the /usr/vac/bin
202 *** in your PATH. I suggest adding that and retrying Configure.
213 case "$ldlibpthname" in
214 '') ldlibpthname=LIBPATH ;;
217 # This script UU/usethreads.cbu will get 'called-back' by Configure
218 # after it has prompted the user for whether to use threads.
219 cat > UU/usethreads.cbu <<'EOCBU'
220 case "$usethreads" in
232 ccflags="$ccflags -DNEED_PTHREAD_INIT"
235 ccflags="-D_THREAD_SAFE $ccflags"
239 echo >&4 "Switching cc to cc_r because of POSIX threads."
240 # xlc_r has been known to produce buggy code in AIX 4.3.2.
241 # (e.g. pragma/overload core dumps) Let's suspect xlC_r, too.
250 *** For pthreads you should use the AIX C compiler cc_r.
251 *** (now your compiler was set to '$cc')
252 *** Cannot continue, aborting.
259 set `echo X "$libswanted "| sed -e 's/ \([cC]\) / \1_r /g'`
263 set `echo X "$lddlflags "| sed -e 's/ \(-l[cC]\) / \1_r /g'`
267 # Insert pthreads to libswanted, before any libc or libC.
268 set `echo X "$libswanted "| sed -e 's/ \([cC]_r\) / pthreads \1 /'`
271 # Insert pthreads to lddlflags, before any libc or libC.
272 set `echo X "$lddlflags " | sed -e 's/ \(-l[cC]_r\) / -lpthreads \1 /'`
279 # This script UU/uselargefiles.cbu will get 'called-back' by Configure
280 # after it has prompted the user for whether to use large files.
281 cat > UU/uselargefiles.cbu <<'EOCBU'
282 case "$uselargefiles" in
283 ''|$define|true|[yY]*)
284 # Configure should take care of use64bitint and use64bitall being
285 # defined before uselargefiles.cbu is consulted.
286 if test X"$use64bitint:$quadtype" = X"$define:long" -o X"$use64bitall" = Xdefine; then
287 # Keep these at the left margin.
288 ccflags_uselargefiles="`getconf XBS5_LP64_OFF64_CFLAGS 2>/dev/null`"
289 ldflags_uselargefiles="`getconf XBS5_LP64_OFF64_LDFLAGS 2>/dev/null`"
291 # Keep these at the left margin.
292 ccflags_uselargefiles="`getconf XBS5_ILP32_OFFBIG_CFLAGS 2>/dev/null`"
293 ldflags_uselargefiles="`getconf XBS5_ILP32_OFFBIG_LDFLAGS 2>/dev/null`"
295 if test X"$use64bitint:$quadtype" = X"$define:long" -o X"$use64bitall" = Xdefine; then
296 # Keep this at the left margin.
297 libswanted_uselargefiles="`getconf XBS5_LP64_OFF64_LIBS 2>/dev/null|sed -e 's@^-l@@' -e 's@ -l@ @g`"
299 # Keep this at the left margin.
300 libswanted_uselargefiles="`getconf XBS5_ILP32_OFFBIG_LIBS 2>/dev/null|sed -e 's@^-l@@' -e 's@ -l@ @g`"
302 case "$ccflags_uselargefiles$ldflags_uselargefiles$libs_uselargefiles" in
304 *) ccflags="$ccflags $ccflags_uselargefiles"
305 ldflags="$ldflags $ldflags_uselargefiles"
306 libswanted="$libswanted $libswanted_uselargefiles"
309 case "$gccversion" in
311 *) # Remove xlc-specific -qflags.
312 ccflags="`echo $ccflags | sed -e 's@ -q[^ ]*@ @g' -e 's@^-q[^ ]* @@g'`"
313 ldflags="`echo $ldflags | sed -e 's@ -q[^ ]*@ @g' -e 's@^-q[^ ]* @@g'`"
314 # Move xlc-specific -bflags.
315 ccflags="`echo $ccflags | sed -e 's@ -b@ -Wl,-b@g'`"
316 ldflags="`echo ' '$ldflags | sed -e 's@ -b@ -Wl,-b@g'`"
317 lddlflags="`echo ' '$lddlflags | sed -e 's@ -b@ -Wl,-b@g'`"
319 echo >&4 "(using ccflags $ccflags)"
320 echo >&4 "(using ldflags $ldflags)"
321 echo >&4 "(using lddlflags $lddlflags)"
328 if test $usenativedlopen = 'true' ; then
329 ccflags="$ccflags -DUSE_NATIVE_DLOPEN"
331 *gcc*) ldflags="$ldflags -Wl,-brtl" ;;
332 *) ldflags="$ldflags -brtl" ;;
335 # If the C++ libraries, libC and libC_r, are available we will
336 # prefer them over the vanilla libc, because the libC contain
337 # loadAndInit() and terminateAndUnload() which work correctly
338 # with C++ statics while libc load() and unload() do not. See
339 # ext/DynaLoader/dl_aix.xs. The C-to-C_r switch is done by
340 # usethreads.cbu, if needed.
341 if test -f /lib/libC.a -a X"`$cc -v 2>&1 | grep gcc`" = X; then
343 set `echo X "$libswanted "| sed -e 's/ c / C c /'`
347 set `echo X "$lddlflags "| sed -e 's/ -lc / -lC -lc /'`