Use PodParser 1.18 new test.
[p5sagit/p5-mst-13.2.git] / hints / dec_osf.sh
CommitLineData
a0d0e21e 1# hints/dec_osf.sh
8e964347 2
b971f6e4 3# * If you want to debug perl or want to send a
8e964347 4# stack trace for inclusion into an bug report, call
5# Configure with the additional argument -Doptimize=-g2
6# or uncomment this assignment to "optimize":
7#
8#optimize=-g2
9#
8a019ce7 10# If you want both to optimise and debug with the DEC cc
11# you must have -g3, e.g. "-O4 -g3", and (re)run Configure.
12#
b971f6e4 13# * gcc can always have both -g and optimisation on.
8a019ce7 14#
b971f6e4 15# * debugging optimised code, no matter what compiler
8a019ce7 16# one is using, can be surprising and confusing because of
17# the optimisation tricks like code motion, code removal,
18# loop unrolling, and inlining. The source code and the
19# executable code simply do not agree any more while in
20# mid-execution, the optimiser only cares about the results.
21#
b971f6e4 22# * Configure will automatically add the often quoted
f2c69087 23# -DDEBUGGING for you if the -g is specified.
24#
b971f6e4 25# * There is even more optimisation available in the new
f2c69087 26# (GEM) DEC cc: -O5 and -fast. "man cc" will tell more about them.
27# The jury is still out whether either or neither help for Perl
28# and how much. Based on very quick testing, -fast boosts
29# raw data copy by about 5-15% (-fast brings in, among other
30# things, inlined, ahem, fast memcpy()), while on the other
31# hand searching things (index, m//, s///), seems to get slower.
32# Your mileage will vary.
8e964347 33#
b971f6e4 34# * The -std is needed because the following compiled
e60a08f8 35# without the -std and linked with -lm
36#
37# #include <math.h>
38# #include <stdio.h>
39# int main(){short x=10,y=sqrt(x);printf("%d\n",y);}
40#
41# will in Digital UNIX 3.* and 4.0b print 0 -- and in Digital
42# UNIX 4.0{,a} dump core: Floating point exception in the printf(),
43# the y has become a signaling NaN.
44#
b971f6e4 45# * Compilation warnings like:
46#
47# "Undefined the ANSI standard macro ..."
48#
49# can be ignored, at least while compiling the POSIX extension
50# and especially if using the sfio (the latter is not a standard
51# part of Perl, never mind if it says little to you).
52#
8e964347 53
e60a08f8 54# If using the DEC compiler we must find out the DEC compiler style:
55# the style changed between Digital UNIX (aka DEC OSF/1) 3 and
56# Digital UNIX 4. The old compiler was originally from Ultrix and
57# the MIPS company, the new compiler is originally from the VAX world
58# and it is called GEM. Many of the options we are going to use depend
59# on the compiler style.
60
a68015de 61cc=${cc:-cc}
62
b691c02f 63# do NOT, I repeat, *NOT* take away the leading tabs
64# Configure Black Magic (TM)
b971f6e4 65 # reset
e60a08f8 66 _DEC_cc_style=
8d5a0f9f 67case "`$cc -v 2>&1 | grep cc`" in
f931c1d2 68*gcc*) _gcc_version=`$cc --version 2>&1 | tr . ' '`
2cae8c0d 69 set $_gcc_version
3f8b8817 70 if test "$1" -lt 2 -o \( "$1" -eq 2 -a \( "$2" -lt 95 -o \( "$2" -eq 95 -a "$3" -lt 2 \) \) \); then
2cae8c0d 71 cat >&4 <<EOF
72
3f8b8817 73*** Your cc seems to be gcc and its version seems to be less than 2.95.2.
74*** This is not a good idea since old versions of gcc are known to produce
75*** buggy code when compiling Perl (and no doubt for other programs, too).
76***
77*** Therefore, I strongly suggest upgrading your gcc. (Why don't you
78*** use the vendor cc is also a good question. It comes with the operating
79*** system and produces good code.)
2cae8c0d 80
81Cannot continue, aborting.
82
83EOF
84 exit 1
85 fi
3f8b8817 86 if test "$1" -eq 2 -a "$2" -eq 95 -a "$3" -le 2; then
87 cat >&4 <<EOF
88
89*** Note that as of gcc 2.95.2 (19991024) and Perl 5.6.0 (March 2000)
90*** if the said Perl is compiled with the said gcc the lib/sdbm test
91*** dumps core (meaning that the SDBM_File is unusable). As this core
92*** dump doesn't happen with the vendor cc, this is most probably
93*** a lingering bug in gcc. Therefore unless you have a better gcc
94*** you are still better off using the vendor cc.
95
96Since you explicitly chose gcc, I assume that you know what are doing.
97
98EOF
99 fi
2cae8c0d 100 ;;
e60a08f8 101*) # compile something small: taint.c is fine for this.
102 # the main point is the '-v' flag of 'cc'.
52c7d5b6 103 case "`cc -v -I. -c taint.c -o taint$$.o 2>&1`" in
e60a08f8 104 */gemc_cc*) # we have the new DEC GEM CC
dfa3a3d3 105 _DEC_cc_style=new
8a019ce7 106 ;;
e60a08f8 107 *) # we have the old MIPS CC
dfa3a3d3 108 _DEC_cc_style=old
8a019ce7 109 ;;
e60a08f8 110 esac
111 # cleanup
52c7d5b6 112 rm -f taint$$.o
e60a08f8 113 ;;
114esac
115
b971f6e4 116# be nauseatingly ANSI
8d5a0f9f 117case "`$cc -v 2>&1 | grep gcc`" in
9607fc9c 118*gcc*) ccflags="$ccflags -ansi"
b971f6e4 119 ;;
120*) ccflags="$ccflags -std"
121 ;;
122esac
123
124# for gcc the Configure knows about the -fpic:
125# position-independent code for dynamic loading
126
e60a08f8 127# we want optimisation
128
129case "$optimize" in
8d5a0f9f 130'') case "`$cc -v 2>&1 | grep gcc`" in
e60a08f8 131 *gcc*)
132 optimize='-O3' ;;
133 *) case "$_DEC_cc_style" in
313489a2 134 new) optimize='-O4'
135 ccflags="$ccflags -fprm d -ieee"
136 ;;
e60a08f8 137 old) optimize='-O2 -Olimit 3200' ;;
138 esac
b971f6e4 139 ccflags="$ccflags -D_INTRINSICS"
e60a08f8 140 ;;
8e964347 141 esac
142 ;;
1fc4cb55 143esac
28757baa 144
313489a2 145# Make glibpth agree with the compiler suite. Note that /shlib
146# is not here. That's on purpose. Even though that's where libc
147# really lives from V4.0 on, the linker (and /sbin/loader) won't
148# look there by default. The sharable /sbin utilities were all
149# built with "-Wl,-rpath,/shlib" to get around that. This makes
150# no attempt to figure out the additional location(s) searched by
151# gcc, since not all versions of gcc are easily coerced into
152# revealing that information.
b0362887 153glibpth="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc"
154glibpth="$glibpth /usr/lib /usr/local/lib /var/shlib"
313489a2 155
8e964347 156# dlopen() is in libc
157libswanted="`echo $libswanted | sed -e 's/ dl / /'`"
158
b971f6e4 159# libPW contains nothing useful for perl
8a019ce7 160libswanted="`echo $libswanted | sed -e 's/ PW / /'`"
161
723e14d4 162# libnet contains nothing useful for perl here, and doesn't work
163libswanted="`echo $libswanted | sed -e 's/ net / /'`"
164
b971f6e4 165# libbsd contains nothing used by perl that is not already in libc
8a019ce7 166libswanted="`echo $libswanted | sed -e 's/ bsd / /'`"
167
b971f6e4 168# libc need not be separately listed
8a019ce7 169libswanted="`echo $libswanted | sed -e 's/ c / /'`"
170
b971f6e4 171# ndbm is already in libc
172libswanted="`echo $libswanted | sed -e 's/ ndbm / /'`"
8a019ce7 173
174# the basic lddlflags used always
175lddlflags='-shared -expect_unresolved "*"'
176
b971f6e4 177# Fancy compiler suites use optimising linker as well as compiler.
178# <spider@Orb.Nashua.NH.US>
b8f0c030 179case "`uname -r`" in
b971f6e4 180*[123].*) # old loader
181 lddlflags="$lddlflags -O3"
182 ;;
a07564da 183*) if $test "X$optimize" = "X$undef"; then
184 lddlflags="$lddlflags -msym"
185 else
baa8820a 186 case "`/usr/sbin/sizer -v`" in
e3159d07 187 *4.0D*)
188 # QAR 56761: -O4 + .so may produce broken code,
189 # fixed in 4.0E or better.
190 ;;
191 *)
192 lddlflags="$lddlflags $optimize"
193 ;;
194 esac
195 # -msym: If using a sufficiently recent /sbin/loader,
196 # keep the module symbols with the modules.
baa8820a 197 lddlflags="$lddlflags -msym -std"
a07564da 198 fi
b971f6e4 199 ;;
200esac
201# Yes, the above loses if gcc does not use the system linker.
202# If that happens, let me know about it. <jhi@iki.fi>
203
8a019ce7 204
b971f6e4 205# If debugging or (old systems and doing shared)
206# then do not strip the lib, otherwise, strip.
207# As noted above the -DDEBUGGING is added automagically by Configure if -g.
8a019ce7 208case "$optimize" in
209 *-g*) ;; # left intentionally blank
b8f0c030 210*) case "`uname -r`" in
b971f6e4 211 *[123].*)
212 case "$useshrplib" in
213 false|undef|'') lddlflags="$lddlflags -s" ;;
214 esac
215 ;;
8a019ce7 216 *) lddlflags="$lddlflags -s"
b971f6e4 217 ;;
218 esac
219 ;;
8a019ce7 220esac
8e964347 221
222#
313489a2 223# Make embedding in things like INN and Apache more memory friendly.
224# Keep it overridable on the Configure command line, though, so that
225# "-Uuseshrplib" prevents this default.
226#
227
2bf2710f 228case "$_DEC_cc_style.$useshrplib" in
229 new.) useshrplib="$define" ;;
230esac
313489a2 231
85ab1d1d 232# The EFF_ONLY_OK from <sys/access.h> is present but dysfunctional for
233# [RWX]_OK as of Digital UNIX 4.0[A-D]?. If and when this gets fixed,
234# please adjust this appropriately. See also pp_sys.c just before the
235# emulate_eaccess().
5ff3f7a4 236
baa8820a 237# Fixed in V5.0A.
238case "`/usr/sbin/sizer -v`" in
f60a5d46 239*5.0[A-Z]*|*5.[1-9]*|*[6-9].[0-9]*)
baa8820a 240 : ok
241 ;;
242*)
243# V5.0 or previous
5ff3f7a4 244pp_sys_cflags='ccflags="$ccflags -DNO_EFF_ONLY_OK"'
baa8820a 245 ;;
246esac
5ff3f7a4 247
6b8eaf93 248# The off_t is already 8 bytes, so we do have largefileness.
249
f60a5d46 250cat > UU/usethreads.cbu <<'EOCBU'
104d25b7 251# This script UU/usethreads.cbu will get 'called-back' by Configure
252# after it has prompted the user for whether to use threads.
104d25b7 253case "$usethreads" in
254$define|true|[yY]*)
75d72f2c 255 # Threads interfaces changed with V4.0.
8d5a0f9f 256 case "`$cc -v 2>&1 | grep gcc`" in
75d72f2c 257 *gcc*)ccflags="-D_REENTRANT $ccflags" ;;
258 *) case "`uname -r`" in
259 *[123].*) ccflags="-threads $ccflags" ;;
260 *) ccflags="-pthread $ccflags" ;;
261 esac
104d25b7 262 ;;
75d72f2c 263 esac
264 case "`uname -r`" in
265 *[123].*) libswanted="$libswanted pthreads mach exc c_r" ;;
266 *) libswanted="$libswanted pthread exc" ;;
267 esac
e883c329 268
baa8820a 269 case "$usemymalloc" in
270 '')
271 usemymalloc='n'
272 ;;
273 esac
104d25b7 274 ;;
275esac
276EOCBU
277
f60a5d46 278cat > UU/uselongdouble.cbu <<'EOCBU'
279# This script UU/uselongdouble.cbu will get 'called-back' by Configure
280# after it has prompted the user for whether to use long doubles.
281case "$uselongdouble" in
282$define|true|[yY]*) d_Gconvert='sprintf((b),"%.*Lg",(n),(x))' ;;
283esac
284EOCBU
285
313489a2 286#
e60a08f8 287# Unset temporary variables no more needed.
288#
289
290unset _DEC_cc_style
291
292#
8e964347 293# History:
294#
85ab1d1d 295# perl5.005_51:
296#
297# September-1998 Jarkko Hietaniemi <jhi@iki.fi>
298#
299# * Added the -DNO_EFF_ONLY_OK flag ('use filetest;' support).
300#
313489a2 301# perl5.004_57:
302#
303# 19-Dec-1997 Spider Boardman <spider@Orb.Nashua.NH.US>
304#
85ab1d1d 305# * Newer Digital UNIX compilers enforce signaling for NaN without
313489a2 306# -ieee. Added -fprm d at the same time since it's friendlier for
307# embedding.
308#
309# * Fixed the library search path to match cc, ld, and /sbin/loader.
310#
311# * Default to building -Duseshrplib on newer systems. -Uuseshrplib
312# still overrides.
313#
314# * Fix -pthread additions for useshrplib. ld has no -pthread option.
315#
316#
723e14d4 317# perl5.004_04:
318#
319# 19-Sep-1997 Spider Boardman <spider@Orb.Nashua.NH.US>
320#
321# * libnet on Digital UNIX is for JAVA, not for sockets.
322#
323#
b971f6e4 324# perl5.003_28:
325#
326# 22-Feb-1997 Jarkko Hietaniemi <jhi@iki.fi>
327#
328# * Restructuring Spider's suggestions.
329#
330# * Older Digital UNIXes cannot handle -Olimit ... for $lddlflags.
331#
332# * ld -s cannot be used in older Digital UNIXes when doing shared.
333#
334#
335# 21-Feb-1997 Spider Boardman <spider@Orb.Nashua.NH.US>
336#
337# * -hidden removed.
338#
339# * -DSTANDARD_C removed.
340#
341# * -D_INTRINSICS added. (that -fast does not seem to buy much confirmed)
342#
343# * odbm not in libc, only ndbm. Therefore dbm back to $libswanted.
344#
345# * -msym for the newer runtime loaders.
346#
347# * $optimize also in $lddflags.
348#
349#
e60a08f8 350# perl5.003_27:
351#
352# 18-Feb-1997 Jarkko Hietaniemi <jhi@iki.fi>
353#
354# * unset _DEC_cc_style and more commentary on -std.
355#
356#
dfa3a3d3 357# perl5.003_26:
358#
359# 15-Feb-1997 Jarkko Hietaniemi <jhi@iki.fi>
360#
e60a08f8 361# * -std and -ansi.
dfa3a3d3 362#
363#
f2c69087 364# perl5.003_24:
365#
366# 30-Jan-1997 Jarkko Hietaniemi <jhi@iki.fi>
367#
368# * Fixing the note on -DDEBUGGING.
369#
370# * Note on -O5 -fast.
371#
372#
8a019ce7 373# perl5.003_23:
374#
375# 26-Jan-1997 Jarkko Hietaniemi <jhi@iki.fi>
376#
377# * Notes on how to do both optimisation and debugging.
378#
379#
380# 25-Jan-1997 Jarkko Hietaniemi <jhi@iki.fi>
381#
382# * Remove unneeded libraries from $libswanted: PW, bsd, c, dbm
383#
384# * Restructure the $lddlflags build.
385#
386# * $optimize based on which compiler we have.
387#
388#
8e964347 389# perl5.003_22:
390#
391# 23-Jan-1997 Achim Bohnet <ach@rosat.mpe-garching.mpg.de>
392#
393# * Added comments 'how to create a debugging version of perl'
394#
395# * Fixed logic of this script to prevent stripping of shared
396# objects by the loader (see ld man page for -s) is debugging
397# is set via the -g switch.
398#
399#
400# 21-Jan-1997 Achim Bohnet <ach@rosat.mpe-garching.mpg.de>
401#
402# * now 'dl' is always removed from libswanted. Not only if
403# optimize is an empty string.
404#
405#
406# 17-Jan-1997 Achim Bohnet <ach@rosat.mpe-garching.mpg.de>
407#
408# * Removed 'dl' from libswanted: When the FreePort binary
409# translator for Sun binaries is installed Configure concludes
410# that it should use libdl.x.yz.fpx.so :-(
411# Because the dlopen, dlclose,... calls are in the
412# C library it not necessary at all to check for the
413# dl library. Therefore dl is removed from libswanted.
414#
415#
416# 1-Jan-1997 Achim Bohnet <ach@rosat.mpe-garching.mpg.de>
417#
418# * Set -Olimit to 3200 because perl_yylex.c got too big
419# for the optimizer.
420#