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