Digital UNIX hints
[p5sagit/p5-mst-13.2.git] / hints / dec_osf.sh
1 # hints/dec_osf.sh
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 #
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 #
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.
36 #
37
38 case "$optimize" in
39 '')     case "$cc" in 
40         *gcc*)  
41                 optimize='-O3'
42                 ;;
43         *)      
44                 # compile something small: taint.c is fine for this.
45                 # the main point is the '-v' flag of 'cc'.
46                 case "`cc -v -I. -c taint.c -o /tmp/taint$$.o 2>&1`" in
47                 */gemc_cc*)
48                         # we have the new DEC GEM CC
49                         optimize='-O4'
50                         ;;
51                 *)
52                         # we have the old MIPS CC
53                         optimize='-O2 -Olimit 3200'
54                         ;;
55                 esac
56                 # cleanup
57                 rm -f /tmp/taint$$.o
58         esac
59         ;;
60 esac
61
62 # we want optimisation
63
64 case "$optimize" in
65 '')     case "$cc" in 
66         *gcc*)  
67                 optimize='-O3'                          ;;
68         *)      case "$_DEC_cc_style" in
69                 new)    optimize='-O4'                  ;;
70                 old)    optimize='-O2 -Olimit 3200'     ;;
71                 esac
72                 ;;
73         esac
74         ;;
75 esac
76
77 # all compilers are ANSI
78 ccflags="$ccflags -DSTANDARD_C"
79
80 # dlopen() is in libc
81 libswanted="`echo $libswanted | sed -e 's/ dl / /'`"
82
83 # PW contains nothing useful for perl
84 libswanted="`echo $libswanted | sed -e 's/ PW / /'`"
85
86 # bsd contains nothing used by perl that is not already in libc
87 libswanted="`echo $libswanted | sed -e 's/ bsd / /'`"
88
89 # c need not be separately listed
90 libswanted="`echo $libswanted | sed -e 's/ c / /'`"
91
92 # dbm is already in libc (as is ndbm)
93 libswanted="`echo $libswanted | sed -e 's/ dbm / /'`"
94
95 # the basic lddlflags used always
96 lddlflags='-shared -expect_unresolved "*"'
97
98 # Check if it's a CMW version of OSF1,
99 # if so, do not hide the symbols.
100 test `uname -s` = "MLS+" || lddlflags="$lddlflags -hidden"
101
102 # If debugging (-g) do not strip the objects, otherwise, strip.
103 case "$optimize" in
104         *-g*) ;; # left intentionally blank
105         *) lddlflags="$lddlflags -s"
106 esac
107
108 #
109 # Unset temporary variables no more needed.
110 #
111
112 unset _DEC_cc_style
113     
114 #
115 # History:
116 #
117 # perl5.003_27:
118 #
119 #       18-Feb-1997 Jarkko Hietaniemi <jhi@iki.fi>
120 #
121 #       * unset _DEC_cc_style and more commentary on -std1.
122 #
123 #
124 # perl5.003_24:
125 #
126 #       30-Jan-1997 Jarkko Hietaniemi <jhi@iki.fi>
127 #
128 #       * Fixing the note on -DDEBUGGING.
129 #
130 #       * Note on -O5 -fast.
131 #
132 #
133 # perl5.003_23:
134 #
135 #       26-Jan-1997 Jarkko Hietaniemi <jhi@iki.fi>
136 #
137 #       * Notes on how to do both optimisation and debugging.
138 #
139 #
140 #       25-Jan-1997 Jarkko Hietaniemi <jhi@iki.fi>
141 #
142 #       * Remove unneeded libraries from $libswanted: PW, bsd, c, dbm
143 #
144 #       * Restructure the $lddlflags build.
145 #
146 #       * $optimize based on which compiler we have.
147 #
148 #
149 # perl5.003_22:
150 #
151 #       23-Jan-1997 Achim Bohnet <ach@rosat.mpe-garching.mpg.de>
152 #
153 #       * Added comments 'how to create a debugging version of perl'
154 #
155 #       * Fixed logic of this script to prevent stripping of shared
156 #         objects by the loader (see ld man page for -s) is debugging
157 #         is set via the -g switch.
158 #
159 #
160 #       21-Jan-1997 Achim Bohnet <ach@rosat.mpe-garching.mpg.de>
161 #
162 #       * now 'dl' is always removed from libswanted. Not only if
163 #         optimize is an empty string.
164 #        
165 #
166 #       17-Jan-1997 Achim Bohnet <ach@rosat.mpe-garching.mpg.de>
167 #
168 #       * Removed 'dl' from libswanted: When the FreePort binary
169 #         translator for Sun binaries is installed Configure concludes
170 #         that it should use libdl.x.yz.fpx.so :-(
171 #         Because the dlopen, dlclose,... calls are in the
172 #         C library it not necessary at all to check for the
173 #         dl library.  Therefore dl is removed from libswanted.
174 #       
175 #
176 #       1-Jan-1997 Achim Bohnet <ach@rosat.mpe-garching.mpg.de>
177 #       
178 #       * Set -Olimit to 3200 because perl_yylex.c got too big
179 #         for the optimizer.
180 #