Commit | Line | Data |
---|---|---|
0f297bd8 | 1 | #! /bin/bash |
fec02dd3 | 2 | # machten.sh |
0f297bd8 | 3 | # This is for MachTen 4.1.4. It might work on other versions and variants |
d0c3e6d6 DD |
4 | # too. MachTen is now obsolete, lacks many features expected in modern UNIX |
5 | # implementations, and suffers from a number of bugs which are likely never | |
6 | # to be fixed. This means that, in the absence of extensive work on | |
7 | # this file and on the perl source code, versions of perl later than 5.6.x | |
8 | # cannot successfully be built on MachTen. This file enforces this | |
9 | # restriction. Should you wish to port a later version of perl to MachTen, | |
10 | # feel free to contact me for pointers. | |
11 | # -- Dominic Dunlop <domo@computer.org> 040213 | |
db90f03e | 12 | # |
a55e790a DD |
13 | # Users of earlier MachTen versions might need a fixed tr from ftp.tenon.com. |
14 | # This should be described in the MachTen release notes. | |
db90f03e | 15 | # |
16 | # MachTen 2.x has its own hint file. | |
17 | # | |
0f297bd8 | 18 | # The original version of this file was put together by Andy Dougherty |
1973dd96 | 19 | # <doughera@lafayette.edu> based on comments from lots of |
db90f03e | 20 | # folks, especially |
21 | # Mark Pease <peasem@primenet.com> | |
22 | # Martijn Koster <m.koster@webcrawler.com> | |
23 | # Richard Yeh <rcyeh@cco.caltech.edu> | |
baf67fda | 24 | # |
d0c3e6d6 DD |
25 | # Prevent building of perls later than 5.6.x, stating why -- see above. |
26 | # -- Dominic Dunlop <domo@computer.org> 040213 | |
2f4b4800 DD |
27 | # Deny system's false claims to support mmap() and munmap(); note |
28 | # also that Sys V IPC (re)disabled by jhi due to continuing inadequacy | |
29 | # -- Dominic Dunlop <domo@computer.org> 001111 | |
0f297bd8 GS |
30 | # Remove dynamic loading libraries from search; enable SysV IPC with |
31 | # MachTen 4.1.4 and above; define SYSTEM_ALIGN_BYTES for old MT versions | |
32 | # -- Dominic Dunlop <domo@computer.org> 000224 | |
7ecd88f1 DD |
33 | # Disable shadow password file access: MT 4.1.1 has necessary library |
34 | # functions, but not header file (or documentation) | |
35 | # -- Dominic Dunlop <domo@computer.org> 990804 | |
e060872b DD |
36 | # For now, explicitly disable dynamic loading -- MT 4.1.1 has it, |
37 | # but these hints do not yet support it. | |
38 | # Define NOTEDEF_MACHTEN to undo gratuitous Tenon hack to signal.h. | |
39 | # -- Dominic Dunlop <domo@computer.org> 9800802 | |
911efb05 DD |
40 | # Completely disable SysV IPC pending more complete support from Tenon |
41 | # -- Dominic Dunlop <domo@computer.org> 980712 | |
38ac2dc8 DD |
42 | # Use vfork and perl's malloc by default |
43 | # -- Dominic Dunlop <domo@computer.org> 980630 | |
83e898de DD |
44 | # Raise perl's stack size again; cut down reg_infty; document |
45 | # -- Dominic Dunlop <domo@computer.org> 980619 | |
2ff233fa | 46 | # Use of semctl() can crash system: disable -- Dominic Dunlop 980506 |
da9788ee DD |
47 | # Raise stack size further; slight tweaks to accomodate MT 4.1 |
48 | # -- Dominic Dunlop <domo@computer.org> 980211 | |
a55e790a | 49 | # Raise perl's stack size -- Dominic Dunlop <domo@tcp.ip.lu> 970922 |
44a8e56a | 50 | # Reinstate sigsetjmp iff version is 4.0.3 or greater; use nm |
51 | # (assumes Configure change); prune libswanted -- Dominic Dunlop 970113 | |
52 | # Warn about test failure due to old Berkeley db -- Dominic Dunlop 970105 | |
55497cff | 53 | # Do not use perl's malloc; SysV IPC OK -- Neil Cutcliffe, Tenon 961030 |
54 | # File::Find's use of link count disabled by Dominic Dunlop 960528 | |
55 | # Perl's use of sigsetjmp etc. disabled by Dominic Dunlop 960521 | |
d0c3e6d6 DD |
56 | |
57 | # Assume that PERL_REVISON in patchlevel.h is 5. | |
58 | # If you want to try building perl-5.8.x or later, set PERL_VERSION_SAFE_MAX | |
59 | # appropriately in your environment before running Configure. | |
60 | if [ `awk '$1=="#define" && $2=="PERL_VERSION"{print $3}' patchlevel.h` \ | |
61 | -gt ${PERL_VERSION_SAFE_MAX:-6} ] | |
62 | then | |
63 | cat <<EOF >&4 | |
64 | ||
65 | Perl versions greater than 5.6.x have not been ported to MachTen. If you | |
66 | wish to build a version from the 5.6 track, please see the notes in | |
67 | README.machten | |
68 | EOF | |
69 | exit 1 | |
70 | fi | |
fec02dd3 | 71 | # |
7ecd88f1 DD |
72 | # MachTen 4.1.1's support for shadow password file access is incomplete: |
73 | # disable its use completely. | |
7ecd88f1 | 74 | d_getspnam=${d_getspnam:-undef} |
7ecd88f1 | 75 | |
e060872b | 76 | # MachTen 4.1.1 does support dynamic loading, but perl doesn't |
db90f03e | 77 | # know how to use it yet. |
e060872b DD |
78 | usedl=${usedl:-undef} |
79 | ||
80 | # MachTen 4.1.1 may have an unhelpful hack in /usr/include/signal.h. | |
81 | # Undo it if so. | |
82 | if grep NOTDEF_MACHTEN /usr/include/signal.h > /dev/null | |
83 | then | |
84 | ccflags="$ccflags -DNOTDEF_MACHTEN" | |
85 | fi | |
55497cff | 86 | |
87 | # Power MachTen is a real memory system and its standard malloc | |
88 | # has been optimized for this. Using this malloc instead of Perl's | |
38ac2dc8 DD |
89 | # malloc may result in significant memory savings. In particular, |
90 | # unlike most UNIX memory allocation subsystems, MachTen's free() | |
91 | # really does return unneeded process data memory to the system. | |
92 | # However, MachTen's malloc() is woefully slow -- maybe 100 times | |
93 | # slower than perl's own, so perl's own is usually the better | |
94 | # choice. In order to use perl's malloc(), the sbrk() system call | |
95 | # must be simulated using MachTen's malloc(). See malloc.c for | |
96 | # precise details of how this is achieved. Recent improvements | |
97 | # to perl's malloc() currently crash MachTen, and so are disabled | |
98 | # by -DPLAIN_MALLOC and -DNO_FANCY_MALLOC. | |
99 | usemymalloc=${usemymalloc:-y} | |
100 | ||
0f297bd8 GS |
101 | # Older versions of MachTen malloc() data on a two-byte boundary, which |
102 | # works, but slows down operations on long, float and double data. | |
103 | # Perl's malloc() can compensate if SYSTEM_ALLOC_ALIGNMENT is suitably | |
104 | # defined. | |
105 | if expr "$osvers" \< "4.1" >/dev/null | |
106 | then | |
107 | system_alloc_alignment=" -DSYSTEM_ALLOC_ALIGNMENT=2" | |
108 | fi | |
38ac2dc8 | 109 | # Do not wrap the following long line |
0f297bd8 | 110 | malloc_cflags='ccflags="$ccflags -DPLAIN_MALLOC -DNO_FANCY_MALLOC -DUSE_PERL_SBRK$system_alloc_alignment"' |
38ac2dc8 | 111 | |
38ac2dc8 DD |
112 | # When MachTen does a fork(), it immediately copies the whole of |
113 | # the parent process' data space for the child. This can be | |
114 | # expensive. Using vfork() where appropriate avoids this cost. | |
115 | d_vfork=${d_vfork:-define} | |
116 | ||
117 | # Specify a high level of optimization (-O3 wouldn't do much more) | |
118 | optimize=${optimize:--O2 -fomit-frame-pointer} | |
c07a80fd | 119 | |
d0c3e6d6 | 120 | # Make symbol table listings less voluminous |
44a8e56a | 121 | nmopts=-gp |
c07a80fd | 122 | |
83e898de DD |
123 | # Set reg_infty -- the maximum allowable number of repeats in regular |
124 | # expressions such as /a{1,$max_repeats}/, and the maximum number of | |
125 | # times /a*/ will match. Setting this too high without having a stack | |
126 | # large enough to accommodate deep recursion in the regular expression | |
127 | # engine allows perl to crash your Mac due to stack overrun if it | |
128 | # encounters a pathological regular expression. The default is a | |
129 | # compromise between capability and required stack size (see below). | |
130 | # You may override the default value from the Configure command-line | |
131 | # like this: | |
132 | # | |
133 | # Configure -Dreg_infty=16368 ... | |
134 | ||
135 | reg_infty=${reg_infty:-2047} | |
136 | ||
137 | # If you want to have many perl processes active simultaneously -- | |
138 | # processing CGI forms -- for example, you should opt for a small stack. | |
139 | # For safety, you should set reg_infty no larger than the corresponding | |
140 | # value given in this table: | |
141 | # | |
142 | # Stack size reg_infty value supported | |
143 | # ---------- ------------------------- | |
144 | # 128k 2**8-1 (256) | |
145 | # 256k 2**9-1 (511) | |
146 | # 512k 2**10-1 (1023) | |
147 | # 1M 2**11-1 (2047) | |
148 | # ... | |
149 | # 16M 2**15-1 (32767) (perl's default value) | |
150 | ||
151 | # This script selects a safe stack size based on the value of reg_infty | |
152 | # specified above. However, you may choose to take a risk and set | |
153 | # stack size lower: pathological regular expressions are rare in real-world | |
154 | # programs. But be aware that, if perl does encounter one, it WILL | |
155 | # crash your system. Do not set stack size lower than 96k unless | |
156 | # you want perl's installation tests ( make test ) to crash your system. | |
157 | # | |
158 | # You may override the default value from the Configure command-line | |
159 | # by specifying the required size in kilobytes like this: | |
160 | # | |
161 | # Configure -Dstack_size=96 | |
162 | ||
163 | if [ "X$stack_size" = 'X' ] | |
164 | then | |
165 | stack_size=128 | |
166 | X=`expr $reg_infty / 256` | |
167 | ||
168 | while [ $X -gt 0 ] | |
169 | do | |
170 | X=`expr $X / 2` | |
171 | stack_size=`expr $stack_size \* 2` | |
172 | done | |
38ac2dc8 | 173 | X=`expr $stack_size \* 1024` |
83e898de DD |
174 | fi |
175 | ||
83e898de DD |
176 | ldflags="$ldflags -Xlstack=$X" |
177 | ccflags="$ccflags -DREG_INFTY=$reg_infty" | |
a55e790a | 178 | |
55497cff | 179 | # Install in /usr/local by default |
180 | prefix='/usr/local' | |
181 | ||
db90f03e | 182 | # At least on PowerMac, doubles must be aligned on 8 byte boundaries. |
183 | # I don't know if this is true for all MachTen systems, or how to | |
184 | # determine this automatically. | |
185 | alignbytes=8 | |
baf67fda | 186 | |
44a8e56a | 187 | # 4.0.2 and earlier had a problem with perl's use of sigsetjmp and |
baf67fda | 188 | # friends. Use setjmp and friends instead. |
44a8e56a | 189 | expr "$osvers" \< "4.0.3" > /dev/null && d_sigsetjmp='undef' |
190 | ||
0f297bd8 | 191 | # System V IPC before MachTen 4.1.4 is incomplete (missing msg function |
911efb05 | 192 | # prototypes, no ftok()), buggy (semctl(.., .., IPC_STATUS, ..) hangs |
0f297bd8 GS |
193 | # system), and undocumented. Claim it's not there at all before 4.1.4. |
194 | if expr "$osvers" \< "4.1.4" >/dev/null | |
195 | then | |
911efb05 DD |
196 | d_msg=${d_msg:-undef} |
197 | d_sem=${d_sem:-undef} | |
198 | d_shm=${d_shm:-undef} | |
0f297bd8 | 199 | fi |
2ff233fa | 200 | |
c6c38f61 GS |
201 | |
202 | # As of MachTen 4.1.4 the msg* and shm* are in libc but unimplemented | |
203 | # (an attempt to use them causes a runtime error) | |
204 | # XXX Configure probe for really functional msg*() is needed XXX | |
205 | # XXX Configure probe for really functional shm*() is needed XXX | |
206 | if test "$d_msg" = ""; then | |
207 | d_msgget=${d_msgget:-undef} | |
208 | d_msgctl=${d_msgctl:-undef} | |
209 | d_msgsnd=${d_msgsnd:-undef} | |
210 | d_msgrcv=${d_msgrcv:-undef} | |
211 | case "$d_msgget$d_msgsnd$d_msgctl$d_msgrcv" in | |
212 | *"undef"*) d_msg="$undef" ;; | |
213 | esac | |
214 | fi | |
215 | if test "$d_shm" = ""; then | |
216 | d_shmat=${d_shmat:-undef} | |
217 | d_shmdt=${d_shmdt:-undef} | |
218 | d_shmget=${d_shmget:-undef} | |
219 | d_shmctl=${d_shmctl:-undef} | |
220 | case "$d_shmat$d_shmctl$d_shmdt$d_shmget" in | |
221 | *"undef"*) d_shm="$undef" ;; | |
222 | esac | |
223 | fi | |
224 | ||
2f4b4800 DD |
225 | # MachTen has stubs for mmap and munmap(), but they just result in the |
226 | # caller being killed on the grounds of "Bad system call" | |
227 | d_mmap=${d_mmap:-undef} | |
228 | d_munmap=${d_munmap:-undef} | |
229 | ||
44a8e56a | 230 | # Get rid of some extra libs which it takes Configure a tediously |
0f297bd8 | 231 | # long time never to find on MachTen, or which break perl |
44a8e56a | 232 | set `echo X "$libswanted "|sed -e 's/ net / /' -e 's/ socket / /' \ |
233 | -e 's/ inet / /' -e 's/ nsl / /' -e 's/ nm / /' -e 's/ malloc / /' \ | |
234 | -e 's/ ld / /' -e 's/ sun / /' -e 's/ posix / /' \ | |
0f297bd8 | 235 | -e 's/ cposix / /' -e 's/ crypt / /' -e 's/ dl / /' -e 's/ dld / /' \ |
44a8e56a | 236 | -e 's/ ucb / /' -e 's/ bsd / /' -e 's/ BSD / /' -e 's/ PW / /'` |
237 | shift | |
238 | libswanted="$*" | |
baf67fda | 239 | |
da9788ee DD |
240 | # While link counts on MachTen 4.1's fast file systems work correctly, |
241 | # on Macintosh Heirarchical File Systems, (and on HFS+) | |
baf67fda | 242 | # MachTen always reports ony two links to directories, even if they |
243 | # contain subdirectories. Consequently, we use this variable to stop | |
244 | # File::Find using the link count to determine whether there are | |
245 | # subdirectories to be searched. This will generate a harmless message: | |
246 | # Hmm...You had some extra variables I don't know about...I'll try to keep 'em. | |
247 | # Propagating recommended variable dont_use_nlink | |
248 | dont_use_nlink=define | |
249 | ||
83e898de | 250 | cat <<EOM >&4 |
baf67fda | 251 | |
2ff233fa DD |
252 | During Configure, you may see the message |
253 | ||
254 | *** WHOA THERE!!! *** | |
911efb05 | 255 | The recommended value for \$d_msg on this machine was "undef"! |
2ff233fa DD |
256 | Keep the recommended value? [y] |
257 | ||
911efb05 DD |
258 | as well as similar messages concerning \$d_sem and \$d_shm. Select the |
259 | default answers: MachTen 4.1 appears to provide System V IPC support, | |
260 | but it is incomplete and buggy: perl should be built without it. | |
2f4b4800 DD |
261 | Similar considerations apply to memory mapping of files, controlled |
262 | by \$d_mmap and \$d_munmap. | |
baf67fda | 263 | |
38ac2dc8 DD |
264 | Similarly, when you see |
265 | ||
266 | *** WHOA THERE!!! *** | |
267 | The recommended value for \$d_vfork on this machine was "define"! | |
268 | Keep the recommended value? [y] | |
269 | ||
270 | select the default answer: vfork() works, and avoids expensive data | |
271 | copying. | |
272 | ||
d722968f JH |
273 | You may also see "WHOA THERE!!!" messages concerning \$d_getspnam. |
274 | Select the default answer: MachTen's support for shadow password | |
275 | file access is incomplete, and should not be used. | |
7ecd88f1 | 276 | |
baf67fda | 277 | At the end of Configure, you will see a harmless message |
278 | ||
279 | Hmm...You had some extra variables I don't know about...I'll try to keep 'em. | |
280 | Propagating recommended variable dont_use_nlink | |
44a8e56a | 281 | Propagating recommended variable nmopts |
38ac2dc8 | 282 | Propagating recommended variable malloc_cflags... |
83e898de | 283 | Propagating recommended variable reg_infty |
0f297bd8 | 284 | Propagating recommended variable system_alloc_alignment |
44a8e56a | 285 | Read the File::Find documentation for more information about dont_use_nlink |
baf67fda | 286 | |
83e898de DD |
287 | Your perl will be built with a stack size of ${stack_size}k and a regular |
288 | expression repeat count limit of $reg_infty. If you want alternative | |
289 | values, see the file hints/machten.sh for advice on how to change them. | |
290 | ||
2ff233fa DD |
291 | Tests |
292 | io/fs test 4 and | |
293 | op/stat test 3 | |
294 | may fail since MachTen may not return a useful nlinks field to stat | |
295 | on directories. | |
296 | ||
baf67fda | 297 | EOM |
2ff233fa DD |
298 | expr "$osvers" \< "4.1" >/dev/null && test -r ./broken-db.msg && \ |
299 | . ./broken-db.msg | |
83e898de DD |
300 | |
301 | unset stack_size X |