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