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