rename some long file names to be 8.3 truncation-safe
[p5sagit/p5-mst-13.2.git] / hints / machten.sh
1 # machten.sh
2 # This is for MachTen 4.0.3.  It might work on other versions and variants too.
3 #
4 # Users of earlier MachTen versions might need a fixed tr from ftp.tenon.com.
5 # This should be described in the MachTen release notes.
6 #
7 # MachTen 2.x has its own hint file.
8 #
9 # This file has been put together by Andy Dougherty
10 # <doughera@lafcol.lafayette.edu> based on comments from lots of
11 # folks, especially 
12 #       Mark Pease <peasem@primenet.com>
13 #       Martijn Koster <m.koster@webcrawler.com>
14 #       Richard Yeh <rcyeh@cco.caltech.edu>
15 #
16 # Completely disable SysV IPC pending more complete support from Tenon
17 #                      -- Dominic Dunlop <domo@computer.org> 980712
18 # Use vfork and perl's malloc by default
19 #                      -- Dominic Dunlop <domo@computer.org> 980630
20 # Raise perl's stack size again; cut down reg_infty; document
21 #                      -- Dominic Dunlop <domo@computer.org> 980619
22 # Use of semctl() can crash system: disable -- Dominic Dunlop 980506
23 # Raise stack size further; slight tweaks to accomodate MT 4.1
24 #                      -- Dominic Dunlop <domo@computer.org> 980211
25 # Raise perl's stack size -- Dominic Dunlop <domo@tcp.ip.lu> 970922
26 # Reinstate sigsetjmp iff version is 4.0.3 or greater; use nm
27 # (assumes Configure change); prune libswanted -- Dominic Dunlop 970113
28 # Warn about test failure due to old Berkeley db -- Dominic Dunlop 970105
29 # Do not use perl's malloc; SysV IPC OK -- Neil Cutcliffe, Tenon 961030
30 # File::Find's use of link count disabled by Dominic Dunlop 960528
31 # Perl's use of sigsetjmp etc. disabled by Dominic Dunlop 960521
32 #
33 # Comments, questions, and improvements welcome!
34 #
35 # MachTen 4.X does support dynamic loading, but perl doesn't
36 # know how to use it yet.
37
38 # Power MachTen is a real memory system and its standard malloc
39 # has been optimized for this. Using this malloc instead of Perl's
40 # malloc may result in significant memory savings.  In particular,
41 # unlike most UNIX memory allocation subsystems, MachTen's free()
42 # really does return unneeded process data memory to the system.
43 # However, MachTen's malloc() is woefully slow -- maybe 100 times
44 # slower than perl's own, so perl's own is usually the better
45 # choice.  In order to use perl's malloc(), the sbrk() system call
46 # must be simulated using MachTen's malloc().  See malloc.c for
47 # precise details of how this is achieved.  Recent improvements
48 # to perl's malloc() currently crash MachTen, and so are disabled
49 # by -DPLAIN_MALLOC and -DNO_FANCY_MALLOC.
50 usemymalloc=${usemymalloc:-y}
51
52 # Do not wrap the following long line
53 malloc_cflags='ccflags="$ccflags -DPLAIN_MALLOC -DNO_FANCY_MALLOC -DUSE_PERL_SBRK"'
54
55 # Note that an empty malloc_cflags appears in config.sh if perl's
56 # malloc() is not used.  his is harmless.
57 case "$usemymalloc" in
58 n) unset malloc_cflags;;
59 *) ccflags="$ccflags  -DHIDEMYMALLOC"
60 esac
61
62 # When MachTen does a fork(), it immediately copies the whole of
63 # the parent process' data space for the child.  This can be
64 # expensive.  Using vfork() where appropriate avoids this cost.
65 d_vfork=${d_vfork:-define}
66
67 # Specify a high level of optimization (-O3 wouldn't do much more)
68 optimize=${optimize:--O2 -fomit-frame-pointer}
69
70 # Make symbol table listings les voluminous
71 nmopts=-gp
72
73 # Set reg_infty -- the maximum allowable number of repeats in regular
74 # expressions such as  /a{1,$max_repeats}/, and the maximum number of
75 # times /a*/ will match.  Setting this too high without having a stack
76 # large enough to accommodate deep recursion in the regular expression
77 # engine allows perl to crash your Mac due to stack overrun if it
78 # encounters a pathological regular expression.  The default is a
79 # compromise between capability and required stack size (see below).
80 # You may override the default value from the Configure command-line
81 # like this:
82 #
83 #   Configure -Dreg_infty=16368 ...
84
85 reg_infty=${reg_infty:-2047}
86
87 # If you want to have many perl processes active simultaneously --
88 # processing CGI forms -- for example, you should opt for a small stack.
89 # For safety, you should set reg_infty no larger than the corresponding
90 # value given in this table:
91 #
92 # Stack size  reg_infty value supported
93 # ----------  -------------------------
94 # 128k        2**8-1    (256)
95 # 256k        2**9-1    (511)
96 # 512k        2**10-1  (1023)
97 #   1M        2**11-1  (2047)
98 # ...
99 #  16M        2**15-1 (32767) (perl's default value)
100
101 # This script selects a safe stack size based on the value of reg_infty
102 # specified above.  However, you may choose to take a risk and set
103 # stack size lower: pathological regular expressions are rare in real-world
104 # programs.  But be aware that, if perl does encounter one, it WILL
105 # crash your system.  Do not set stack size lower than 96k unless
106 # you want perl's installation tests ( make test ) to crash your system.
107 #
108 # You may override the default value from the Configure command-line
109 # by specifying the required size in kilobytes like this:
110 #
111 #   Configure -Dstack_size=96
112
113 if [ "X$stack_size" = 'X' ]
114 then
115     stack_size=128
116     X=`expr $reg_infty / 256`
117
118     while [ $X -gt 0 ]
119     do
120         X=`expr $X / 2`
121         stack_size=`expr $stack_size \* 2`
122     done
123     X=`expr $stack_size \* 1024`
124 fi
125
126 ldflags="$ldflags -Xlstack=$X"
127 ccflags="$ccflags -DREG_INFTY=$reg_infty"
128
129 # Install in /usr/local by default
130 prefix='/usr/local'
131
132 # At least on PowerMac, doubles must be aligned on 8 byte boundaries.
133 # I don't know if this is true for all MachTen systems, or how to
134 # determine this automatically.
135 alignbytes=8
136
137 # 4.0.2 and earlier had a problem with perl's use of sigsetjmp and
138 # friends.  Use setjmp and friends instead.
139 expr "$osvers" \< "4.0.3" > /dev/null && d_sigsetjmp='undef'
140
141 # System V IPC support in MachTen 4.1 is incomplete (missing msg function
142 # prototypes, no ftok()), buggy (semctl(.., ..,  IPC_STATUS, ..) hangs
143 # system), and undocumented.  Claim it's not there until things improve.
144 d_msg=${d_msg:-undef}
145 d_sem=${d_sem:-undef}
146 d_shm=${d_shm:-undef}
147
148 # Get rid of some extra libs which it takes Configure a tediously
149 # long time never to find on MachTen
150 set `echo X "$libswanted "|sed -e 's/ net / /' -e 's/ socket / /' \
151     -e 's/ inet / /' -e 's/ nsl / /' -e 's/ nm / /' -e 's/ malloc / /' \
152     -e 's/ ld / /' -e 's/ sun / /' -e 's/ posix / /' \
153     -e 's/ cposix / /' -e 's/ crypt / /' \
154     -e 's/ ucb / /' -e 's/ bsd / /' -e 's/ BSD / /' -e 's/ PW / /'`
155 shift
156 libswanted="$*"
157
158 # While link counts on MachTen 4.1's fast file systems work correctly,
159 # on Macintosh Heirarchical File Systems, (and on HFS+)
160 # MachTen always reports ony two links to directories, even if they
161 # contain subdirectories.  Consequently, we use this variable to stop
162 # File::Find using the link count to determine whether there are
163 # subdirectories to be searched.  This will generate a harmless message:
164 # Hmm...You had some extra variables I don't know about...I'll try to keep 'em.
165 #       Propagating recommended variable dont_use_nlink
166 dont_use_nlink=define
167
168 cat <<EOM >&4
169
170 During Configure, you may see the message
171
172 *** WHOA THERE!!! ***
173     The recommended value for \$d_msg on this machine was "undef"!
174     Keep the recommended value? [y]
175
176 as well as similar messages concerning \$d_sem and \$d_shm.  Select the
177 default answers: MachTen 4.1 appears to provide System V IPC support,
178 but it is incomplete and buggy: perl should be built without it.
179
180 Similarly, when you see
181
182 *** WHOA THERE!!! ***
183     The recommended value for \$d_vfork on this machine was "define"!
184     Keep the recommended value? [y]
185
186 select the default answer: vfork() works, and avoids expensive data
187 copying.
188
189 At the end of Configure, you will see a harmless message
190
191 Hmm...You had some extra variables I don't know about...I'll try to keep 'em.
192         Propagating recommended variable dont_use_nlink
193         Propagating recommended variable nmopts
194         Propagating recommended variable malloc_cflags...
195         Propagating recommended variable reg_infty
196 Read the File::Find documentation for more information about dont_use_nlink
197
198 Your perl will be built with a stack size of ${stack_size}k and a regular
199 expression repeat count limit of $reg_infty.  If you want alternative
200 values, see the file hints/machten.sh for advice on how to change them.
201
202 Tests
203         io/fs test 4  and
204         op/stat test 3
205 may fail since MachTen may not return a useful nlinks field to stat
206 on directories.
207
208 EOM
209 expr "$osvers" \< "4.1" >/dev/null && test -r ./broken-db.msg && \
210     . ./broken-db.msg
211
212 unset stack_size X