applied patch, with tweak suggested by Michael Parker
[p5sagit/p5-mst-13.2.git] / hints / machten.sh
CommitLineData
fec02dd3 1# machten.sh
a55e790a 2# This is for MachTen 4.0.3. It might work on other versions and variants too.
db90f03e 3#
a55e790a 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.
db90f03e 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>
baf67fda 15#
911efb05 16# Completely disable SysV IPC pending more complete support from Tenon
17# -- Dominic Dunlop <domo@computer.org> 980712
38ac2dc8 18# Use vfork and perl's malloc by default
19# -- Dominic Dunlop <domo@computer.org> 980630
83e898de 20# Raise perl's stack size again; cut down reg_infty; document
21# -- Dominic Dunlop <domo@computer.org> 980619
2ff233fa 22# Use of semctl() can crash system: disable -- Dominic Dunlop 980506
da9788ee 23# Raise stack size further; slight tweaks to accomodate MT 4.1
24# -- Dominic Dunlop <domo@computer.org> 980211
a55e790a 25# Raise perl's stack size -- Dominic Dunlop <domo@tcp.ip.lu> 970922
44a8e56a 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
55497cff 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
db90f03e 32#
fec02dd3 33# Comments, questions, and improvements welcome!
34#
db90f03e 35# MachTen 4.X does support dynamic loading, but perl doesn't
36# know how to use it yet.
55497cff 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
38ac2dc8 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.
50usemymalloc=${usemymalloc:-y}
51
52# Do not wrap the following long line
53malloc_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.
57case "$usemymalloc" in
58n) unset malloc_cflags;;
59*) ccflags="$ccflags -DHIDEMYMALLOC"
60esac
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.
65d_vfork=${d_vfork:-define}
66
67# Specify a high level of optimization (-O3 wouldn't do much more)
68optimize=${optimize:--O2 -fomit-frame-pointer}
c07a80fd 69
44a8e56a 70# Make symbol table listings les voluminous
71nmopts=-gp
c07a80fd 72
83e898de 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
85reg_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
113if [ "X$stack_size" = 'X' ]
114then
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
38ac2dc8 123 X=`expr $stack_size \* 1024`
83e898de 124fi
125
83e898de 126ldflags="$ldflags -Xlstack=$X"
127ccflags="$ccflags -DREG_INFTY=$reg_infty"
a55e790a 128
55497cff 129# Install in /usr/local by default
130prefix='/usr/local'
131
db90f03e 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.
135alignbytes=8
baf67fda 136
44a8e56a 137# 4.0.2 and earlier had a problem with perl's use of sigsetjmp and
baf67fda 138# friends. Use setjmp and friends instead.
44a8e56a 139expr "$osvers" \< "4.0.3" > /dev/null && d_sigsetjmp='undef'
140
911efb05 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.
144d_msg=${d_msg:-undef}
145d_sem=${d_sem:-undef}
146d_shm=${d_shm:-undef}
2ff233fa 147
44a8e56a 148# Get rid of some extra libs which it takes Configure a tediously
149# long time never to find on MachTen
150set `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 / /'`
155shift
156libswanted="$*"
baf67fda 157
da9788ee 158# While link counts on MachTen 4.1's fast file systems work correctly,
159# on Macintosh Heirarchical File Systems, (and on HFS+)
baf67fda 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
166dont_use_nlink=define
167
83e898de 168cat <<EOM >&4
baf67fda 169
2ff233fa 170During Configure, you may see the message
171
172*** WHOA THERE!!! ***
911efb05 173 The recommended value for \$d_msg on this machine was "undef"!
2ff233fa 174 Keep the recommended value? [y]
175
911efb05 176as well as similar messages concerning \$d_sem and \$d_shm. Select the
177default answers: MachTen 4.1 appears to provide System V IPC support,
178but it is incomplete and buggy: perl should be built without it.
baf67fda 179
38ac2dc8 180Similarly, 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
186select the default answer: vfork() works, and avoids expensive data
187copying.
188
baf67fda 189At the end of Configure, you will see a harmless message
190
191Hmm...You had some extra variables I don't know about...I'll try to keep 'em.
192 Propagating recommended variable dont_use_nlink
44a8e56a 193 Propagating recommended variable nmopts
38ac2dc8 194 Propagating recommended variable malloc_cflags...
83e898de 195 Propagating recommended variable reg_infty
44a8e56a 196Read the File::Find documentation for more information about dont_use_nlink
baf67fda 197
83e898de 198Your perl will be built with a stack size of ${stack_size}k and a regular
199expression repeat count limit of $reg_infty. If you want alternative
200values, see the file hints/machten.sh for advice on how to change them.
201
2ff233fa 202Tests
203 io/fs test 4 and
204 op/stat test 3
205may fail since MachTen may not return a useful nlinks field to stat
206on directories.
207
baf67fda 208EOM
2ff233fa 209expr "$osvers" \< "4.1" >/dev/null && test -r ./broken-db.msg && \
210 . ./broken-db.msg
83e898de 211
212unset stack_size X