This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[dummy merge]
[perl5.git] / hints / dec_osf.sh
CommitLineData
a0d0e21e 1# hints/dec_osf.sh
8e964347
AB
2
3#
4# How to make a DEBUGGING VERSION of perl for DECs cc compiler
5#
6# If you want to debug perl or want to send a
7# stack trace for inclusion into an bug report, call
8# Configure with the additional argument -Doptimize=-g2
9# or uncomment this assignment to "optimize":
10#
11#optimize=-g2
12#
8a019ce7
JH
13# If you want both to optimise and debug with the DEC cc
14# you must have -g3, e.g. "-O4 -g3", and (re)run Configure.
15#
16# Note 1: gcc can always have both -g and optimisation on.
17#
18# Note 2: debugging optimised code, no matter what compiler
19# one is using, can be surprising and confusing because of
20# the optimisation tricks like code motion, code removal,
21# loop unrolling, and inlining. The source code and the
22# executable code simply do not agree any more while in
23# mid-execution, the optimiser only cares about the results.
24#
f2c69087
JH
25# Note 3: Configure will automatically add the often quoted
26# -DDEBUGGING for you if the -g is specified.
27#
28# Note 4: There is even more optimisation available in the new
29# (GEM) DEC cc: -O5 and -fast. "man cc" will tell more about them.
30# The jury is still out whether either or neither help for Perl
31# and how much. Based on very quick testing, -fast boosts
32# raw data copy by about 5-15% (-fast brings in, among other
33# things, inlined, ahem, fast memcpy()), while on the other
34# hand searching things (index, m//, s///), seems to get slower.
35# Your mileage will vary.
8e964347 36#
e60a08f8
JH
37# Note 5: The -std is needed because the following compiled
38# without the -std and linked with -lm
39#
40# #include <math.h>
41# #include <stdio.h>
42# int main(){short x=10,y=sqrt(x);printf("%d\n",y);}
43#
44# will in Digital UNIX 3.* and 4.0b print 0 -- and in Digital
45# UNIX 4.0{,a} dump core: Floating point exception in the printf(),
46# the y has become a signaling NaN.
47#
8e964347 48
e60a08f8
JH
49# If using the DEC compiler we must find out the DEC compiler style:
50# the style changed between Digital UNIX (aka DEC OSF/1) 3 and
51# Digital UNIX 4. The old compiler was originally from Ultrix and
52# the MIPS company, the new compiler is originally from the VAX world
53# and it is called GEM. Many of the options we are going to use depend
54# on the compiler style.
55
56# do NOT, I repeat, *NOT* take away that leading tab
57 _DEC_cc_style=
58# Configure Black Magic (TM)
59
60case "$cc" in
61*gcc*) ;; # pass
62*) # compile something small: taint.c is fine for this.
63 # the main point is the '-v' flag of 'cc'.
64 case "`cc -v -I. -c taint.c -o /tmp/taint$$.o 2>&1`" in
65 */gemc_cc*) # we have the new DEC GEM CC
dfa3a3d3 66 _DEC_cc_style=new
8a019ce7 67 ;;
e60a08f8 68 *) # we have the old MIPS CC
dfa3a3d3 69 _DEC_cc_style=old
8a019ce7 70 ;;
e60a08f8
JH
71 esac
72 # cleanup
73 rm -f /tmp/taint$$.o
74 ;;
75esac
76
77# we want optimisation
78
79case "$optimize" in
80'') case "$cc" in
81 *gcc*)
82 optimize='-O3' ;;
83 *) case "$_DEC_cc_style" in
84 new) optimize='-O4' ;;
85 old) optimize='-O2 -Olimit 3200' ;;
86 esac
87 ;;
8e964347
AB
88 esac
89 ;;
1fc4cb55 90esac
28757baa 91
8a019ce7 92# all compilers are ANSI
fed7345c 93ccflags="$ccflags -DSTANDARD_C"
28757baa 94
dfa3a3d3
CS
95# be nauseatingly ANSI
96case "$cc" in
97gcc) ccflags="$ccflags -ansi"
98 ;;
e60a08f8 99*) ccflags="$ccflags -std"
dfa3a3d3
CS
100 ;;
101esac
102
8e964347
AB
103# dlopen() is in libc
104libswanted="`echo $libswanted | sed -e 's/ dl / /'`"
105
8a019ce7
JH
106# PW contains nothing useful for perl
107libswanted="`echo $libswanted | sed -e 's/ PW / /'`"
108
109# bsd contains nothing used by perl that is not already in libc
110libswanted="`echo $libswanted | sed -e 's/ bsd / /'`"
111
112# c need not be separately listed
113libswanted="`echo $libswanted | sed -e 's/ c / /'`"
114
115# dbm is already in libc (as is ndbm)
116libswanted="`echo $libswanted | sed -e 's/ dbm / /'`"
117
118# the basic lddlflags used always
119lddlflags='-shared -expect_unresolved "*"'
120
121# Check if it's a CMW version of OSF1,
122# if so, do not hide the symbols.
123test `uname -s` = "MLS+" || lddlflags="$lddlflags -hidden"
124
125# If debugging (-g) do not strip the objects, otherwise, strip.
126case "$optimize" in
127 *-g*) ;; # left intentionally blank
128 *) lddlflags="$lddlflags -s"
129esac
8e964347
AB
130
131#
e60a08f8
JH
132# Unset temporary variables no more needed.
133#
134
135unset _DEC_cc_style
136
137#
8e964347
AB
138# History:
139#
e60a08f8
JH
140# perl5.003_27:
141#
142# 18-Feb-1997 Jarkko Hietaniemi <jhi@iki.fi>
143#
144# * unset _DEC_cc_style and more commentary on -std.
145#
146#
dfa3a3d3
CS
147# perl5.003_26:
148#
149# 15-Feb-1997 Jarkko Hietaniemi <jhi@iki.fi>
150#
e60a08f8 151# * -std and -ansi.
dfa3a3d3
CS
152#
153#
f2c69087
JH
154# perl5.003_24:
155#
156# 30-Jan-1997 Jarkko Hietaniemi <jhi@iki.fi>
157#
158# * Fixing the note on -DDEBUGGING.
159#
160# * Note on -O5 -fast.
161#
162#
8a019ce7
JH
163# perl5.003_23:
164#
165# 26-Jan-1997 Jarkko Hietaniemi <jhi@iki.fi>
166#
167# * Notes on how to do both optimisation and debugging.
168#
169#
170# 25-Jan-1997 Jarkko Hietaniemi <jhi@iki.fi>
171#
172# * Remove unneeded libraries from $libswanted: PW, bsd, c, dbm
173#
174# * Restructure the $lddlflags build.
175#
176# * $optimize based on which compiler we have.
177#
178#
8e964347
AB
179# perl5.003_22:
180#
181# 23-Jan-1997 Achim Bohnet <ach@rosat.mpe-garching.mpg.de>
182#
183# * Added comments 'how to create a debugging version of perl'
184#
185# * Fixed logic of this script to prevent stripping of shared
186# objects by the loader (see ld man page for -s) is debugging
187# is set via the -g switch.
188#
189#
190# 21-Jan-1997 Achim Bohnet <ach@rosat.mpe-garching.mpg.de>
191#
192# * now 'dl' is always removed from libswanted. Not only if
193# optimize is an empty string.
194#
195#
196# 17-Jan-1997 Achim Bohnet <ach@rosat.mpe-garching.mpg.de>
197#
198# * Removed 'dl' from libswanted: When the FreePort binary
199# translator for Sun binaries is installed Configure concludes
200# that it should use libdl.x.yz.fpx.so :-(
201# Because the dlopen, dlclose,... calls are in the
202# C library it not necessary at all to check for the
203# dl library. Therefore dl is removed from libswanted.
204#
205#
206# 1-Jan-1997 Achim Bohnet <ach@rosat.mpe-garching.mpg.de>
207#
208# * Set -Olimit to 3200 because perl_yylex.c got too big
209# for the optimizer.
210#